$tabs[$params['active_tab']] = true;
}
if (isset($params['is_submitted'])) {
    foreach ($this->Plugins() as $plugin => $parameters) {
        $this->SetPreference($plugin, $params[$plugin]);
    }
}
$headers = $this->StartTabHeaders() . $this->SetTabHeader('scripts', 'Scripts', $tabs['scripts']) . $this->SetTabHeader('plugins', 'Plugins', $tabs['plugins']) . $this->SetTabHeader('options', $this->lang('options'), $tabs['options']) . $this->EndTabHeaders() . $this->StartTabContent();
$this->smarty->assign('tab_headers', $headers);
$this->smarty->assign('end_tab', $this->EndTab());
$this->smarty->assign('tab_footers', $this->EndTabContent());
$this->smarty->assign('start_plugins_tab', $this->StartTab('plugins'));
$this->smarty->assign('start_scripts_tab', $this->StartTab('scripts'));
$this->smarty->assign('start_options_tab', $this->StartTab('options'));
// Scripts
$scripts = jQueryScript::doSelect();
foreach ($scripts as &$script) {
    $script->title = $this->CreateLink($id, 'manageScript', $returnid, $script->getName(), array('script_id' => $script->getId()));
    $script->edit = $this->CreateLink($id, 'manageScript', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $script->getName(), '', '', 'systemicon'), array('script_id' => $script->getId()));
    $script->delete = $this->CreateLink($id, 'manageScript', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $script->getName(), '', '', 'systemicon'), array('script_id' => $script->getId(), 'delete' => true), $this->lang('are_you_sure'));
    if ($script->getLoadDefault()) {
        $script->load_default_state = $this->CreateLink($id, 'manageScript', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/true.gif', $script->getName(), '', '', 'systemicon'), array('script_id' => $script->getId(), 'load_default_state' => true));
    } else {
        $script->load_default_state = $this->CreateLink($id, 'manageScript', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/false.gif', $script->getName(), '', '', 'systemicon'), array('script_id' => $script->getId(), 'load_default_state' => true));
    }
    if ($script->getInHeader()) {
        $script->in_header_state = $this->CreateLink($id, 'manageScript', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/true.gif', $script->getName(), '', '', 'systemicon'), array('script_id' => $script->getId(), 'in_header_state' => true));
    } else {
        $script->in_header_state = $this->CreateLink($id, 'manageScript', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/false.gif', $script->getName(), '', '', 'systemicon'), array('script_id' => $script->getId(), 'in_header_state' => true));
    }
}
 private function generateHeader()
 {
     global $jQuery;
     if (isset($jQuery['loaded'])) {
         return;
     }
     $html = jQueryBase::getJavascriptTag($this->config['root_url'] . '/modules/jQuery/libraries/jquery-1.4.2/jquery.js');
     $html .= jQueryBase::getJavascriptTag(null, 'jQuery.noConflict();');
     // foreach ($this->getPlugins() as $plugin => $parameters)
     // 		{
     // 			if (isset($parameters['active'] ))
     // 			$html .= ($parameters['active'] == 1)?jQueryBase::getJavascriptTag($this->config['root_url'] . '/modules/jQuery/libraries/plugins/' . $parameters['path']):'';
     // 		}
     // Scripts loading
     $default_scripts = jQueryScript::doSelect(array('where' => array('load_default' => true)));
     foreach ($default_scripts as $script) {
         $jQuery['headers']['scripts'][$script->getPosition()] = $script->getId();
         $required_plugins = explode(',', $script->getRequiredPlugins());
         foreach ($required_plugins as $plugin) {
             if ($plugin != '') {
                 $jQuery['headers']['plugins'][$plugin] = 1;
             }
             //TODO: FIX THE POSITION ISSUE
         }
     }
     // Plugins
     $plugins = $this->getActivePlugins();
     foreach ($plugins as $plugin => $status) {
         $jQuery['headers']['plugins'][$plugin] = 1;
     }
     // Output plugins
     if (is_array($jQuery['headers']['plugins'])) {
         foreach ($jQuery['headers']['plugins'] as $plugin => $status) {
             $html .= jQueryBase::getJavascriptTag($this->getPluginUrl($plugin));
         }
     }
     // Output scripts
     if (is_array($jQuery['headers']['scripts'])) {
         ksort($jQuery['headers']['scripts']);
         foreach ($jQuery['headers']['scripts'] as $script_id) {
             $html .= jQueryBase::getJavascriptTag($this->config['root_url'] . '/modules/jQuery/load.php?id=' . $script_id);
         }
     }
     $jQuery['loaded'] = true;
     return $html;
 }
Example #3
0
<?php

if (!isset($gCms)) {
    exit;
}
if (isset($params['script'])) {
    $script = jQueryScript::retrieveByPk($params['script']);
    if (!is_null($script)) {
        if ($script->getInHeader() || $script->getLoadDefault()) {
            // We have to load it in header
            global $jQuery;
            $jQuery['headers']['scripts'][$script->getPosition()] = $script->getId();
            $required_plugins = explode(',', $script->getRequiredPlugins());
            foreach ($required_plugins as $plugin) {
                if ($plugin != '') {
                    $jQuery['headers']['plugins'][$plugin] = 1;
                }
                //TODO: FIX THE POSITION ISSUE
            }
        } else {
            echo jQueryBase::getJavascriptTag($this->config['root_url'] . '/modules/jQuery/load.php?id=' . $script->getId());
        }
    }
}
if (!isset($gCms)) {
    exit;
}
if (!$this->CheckAccess()) {
    return $this->DisplayErrorPage($id, $params, $returnid, $this->Lang('accessdenied'));
}
if (isset($params['cancel'])) {
    return $this->Redirect($id, 'defaultadmin', $returnid, array('active_tab' => 'scripts'));
}
$script = null;
if (isset($params['script_id']) && $params['script_id'] != '') {
    $script = jQueryScript::retrieveByPk($params['script_id']);
}
if (is_null($script)) {
    $script = new jQueryScript();
}
if (isset($params['delete'])) {
    $script->delete();
    return $this->Redirect($id, 'defaultadmin', $returnid, array('active_tab' => 'scripts'));
}
if (isset($params['load_default_state'])) {
    $script->setLoadDefault(!$script->getLoadDefault());
    $script->save();
    return $this->Redirect($id, 'defaultadmin', $returnid, array('active_tab' => 'scripts'));
}
if (isset($params['in_header_state'])) {
    $script->setInHeader(!$script->getInHeader());
    $script->save();
    return $this->Redirect($id, 'defaultadmin', $returnid, array('active_tab' => 'scripts'));
}
Example #5
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'include.php';
global $gCms;
$db =& $gCms->GetDb();
if (isset($_REQUEST['id'])) {
    //	$module = $gCms->modules['jQuery']['object'];
    $script = jQueryScript::retrieveByPk($_REQUEST['id']);
    echo $script->getCode();
}
// TODO: Load required plugins first !
// NOTE: This have to be done prior to this call, like in the headers when we build the call to this script!