Projekt

Obecné

Profil

Stáhnout (4.07 KB) Statistiky
| Větev: | Tag: | Revize:
8baed187 Michal Kliment
<?php
/**
* Devices show javascript view.
*
* @author Michal Kliment, Ondřej Fibich
*/

// IDE complementation
c2e44ab0 Michal Kliment
if (FALSE): ?><script type='text/javascript'><?php endif;
$etm = new Enum_type_Model();
8baed187 Michal Kliment
?>
var device_id = $('#device_id').val();
var depth = 2;
function initTrees()
{
$('#tree').jstree({
'json_data' : {
'ajax' : {
'url' : '<?php echo url_lang::base() ?>devices/get_map',
'data' : function (n) {
// the result is fed to the AJAX request `data` option
return {
'root' : n.attr ? 'false' : 'true',
'from' : n.attr ? n.attr('id') : device_id,
'depth' : 2
};
}
}
},
'themes' : {
'theme' : 'classic',
'url' : '<?php echo url::base() ?>media/css/jquery.jstree.css'
},
'types' : {
'valid_children' : [ 'root' ],
'types' : {
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('pc', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/pc.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('client', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/client.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('router', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/router.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('switch', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/switch.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('notebook', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/notebook.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('home ap', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/homeap.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('voip', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/voip.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('ap', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/ap.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('tablet', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/tablet.png'
}
},
c2e44ab0 Michal Kliment
'<?php echo $etm->get_type_id('server', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
8baed187 Michal Kliment
'icon' : {
'image' : '<?php echo url::base() ?>media/images/icons/devices/server.png'
}
}
}
},
'plugins' : ['themes', 'json_data', 'ui', 'types']
});
}
$('#device_id').change(function()
{
$('#tree').empty();
device_id = $('#device_id').val();
initTrees();
})
$('#tree a').live('click', function()
{
var link = '<?php echo url_lang::base() ?>devices/show/' + $(this).parent().attr('id');
if (!$(this).hasClass('popup_link'))
{
$(this).addClass('popup_link').attr('href', link).trigger('click');
}
})
$(document).ready(function()
{
initTrees();
})