});

    // Dynamically change enabled state
    $('.enabled input').change(function() {
        $.get('<?php 
echo get_url('setting');
?>
'+(this.checked ? '/activate_plugin/':'/deactivate_plugin/')+this.value, function(){
            location.reload(true);
        });
    });

    // Dynamically uninstall
    $('.uninstall a').click(function(e) {
        if (confirm('<?php 
echo jsEscape(__('Are you sure you wish to uninstall this plugin?'));
?>
')) {
            var pluginId = this.name.replace('uninstall_', '');
            $.get('<?php 
echo get_url('setting/uninstall_plugin/');
?>
'+pluginId, function() {
                location.reload(true);
            });
        }
        e.preventDefault();
    });

});
Exemple #2
0
/**
*	Return JS escaped phrase
*
*	@param		code		string		language phrase code
*
*	@return		string		JS escaped language phrase
*/
function JL($code)
{
    return jsEscape(L($code));
}
function node_pick_step1($request)
{
    global $config;
    // Cacti config object
    $host_id = -1;
    $overlib = false;
    $aggregate = false;
    $SQL_picklist = "SELECT graph_templates_graph.id, graph_local.host_id, graph_templates_graph.local_graph_id, graph_templates_graph.height, graph_templates_graph.width, graph_templates_graph.title_cache as description, graph_templates.name, graph_local.host_id\tFROM (graph_local,graph_templates_graph) LEFT JOIN graph_templates ON (graph_local.graph_template_id=graph_templates.id) WHERE graph_local.id=graph_templates_graph.local_graph_id ";
    if (isset($request['host_id'])) {
        $host_id = intval($request['host_id']);
        if ($host_id >= 0) {
            $SQL_picklist .= " and graph_local.host_id={$host_id} ";
        }
    }
    $SQL_picklist .= " order by title_cache";
    cactiDatabaseConnect();
    $sources = db_fetch_assoc($SQL_picklist);
    uasort($sources, "usortNaturalDescriptions");
    $hosts = cactiHostList();
    $tpl = new SimpleTemplate();
    $tpl->set("title", "Pick a graph");
    $tpl->set("hosts", $hosts);
    $tpl->set("sources", $sources);
    $tpl->set("overlib", $overlib ? 1 : 0);
    $tpl->set("selected_host", $host_id);
    $tpl->set("aggregate", $aggregate ? 1 : 0);
    $tpl->set("base_url", isset($config['base_url']) ? $config['base_url'] : '');
    $tpl->set("rra_path", jsEscape($config['rra_path']));
    echo $tpl->fetch("editor-resources/templates/picker-graph.php");
}