Example #1
0
 /**
  *
  * Parse all queue to page
  *
  */
 public function addMedia()
 {
     $document = JFactory::getDocument();
     $docType = $document->getType();
     if ($this->_load_js_language) {
         JSNFactory::localimport('libraries.joomlashine.language.javascriptlanguages');
         $jsLang = JSNJavascriptLanguages::getInstance();
         $this->addScriptDeclaration($jsLang->loadLang());
     }
     if ($this->_docType == 'raw') {
         $medias = array();
         //Add all style file to page
         if (count($this->_styles)) {
             foreach ($this->_styles as $style) {
                 $medias[] = '<link  type="text/css" rel="stylesheet" href="' . $style . '" />';
             }
         }
         //Add all script file to page
         if (count($this->_scripts)) {
             foreach ($this->_scripts as $script) {
                 $medias[] = '<script type="text/javascript" src="' . $script . '"></script>';
             }
             if (!in_array(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'conflict.js'), $this->_scripts)) {
                 $medias[] = '<script type="text/javascript" src="' . PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.conflict.js') . '"></script>';
             }
         }
         //Add all custom tag to page
         if (count($this->_customs)) {
             foreach ($this->_customs as $custom) {
                 $medias[] = $custom;
             }
         }
         //Add all style declaration to page
         if (count($this->_styleDeclaration)) {
             $medias[] = '<style type="text/css">' . implode(PHP_EOL, $this->_styleDeclaration) . '</style>';
         }
         //Add all script declaration to page
         if (count($this->_scriptDeclaration)) {
             $medias[] = '<script type="text/javascript">' . implode(PHP_EOL, $this->_scriptDeclaration) . '</script>';
         }
         echo implode(PHP_EOL, $medias);
     } else {
         //behavior mootools
         JHtmlBehavior::framework();
         //behavior modal
         JHtml::_('behavior.modal');
         //behavior tooltip
         JHtml::_('behavior.tooltip');
         //behavior formvalidation
         JHtml::_('behavior.formvalidation');
         //behavior combobox
         JHtml::_('behavior.combobox');
         //Add all style file to page
         if (count($this->_styles)) {
             foreach ($this->_styles as $style) {
                 $document->addStyleSheet($style);
             }
         }
         $system_js = array();
         $user_js = array();
         $docScripts = $document->_scripts;
         if (count($docScripts)) {
             foreach ($docScripts as $key => $script) {
                 if (strpos($key, '/media/system/') !== false) {
                     $system_js[$key] = $script;
                 } else {
                     if (!is_jquery($key)) {
                         $user_js[$key] = $script;
                     }
                 }
             }
             $document->_scripts = array();
         }
         //Add all script file to page
         if (count($this->_scripts)) {
             foreach ($this->_scripts as $script) {
                 JSNHtmlAsset::addScript($script);
             }
             if (!in_array(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'conflict.js'), $this->_scripts)) {
                 JSNHtmlAsset::addScript(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.conflict.js'));
             }
         }
         $docScripts = $document->_scripts;
         $index = 0;
         $jsn_jquery = array();
         foreach ($docScripts as $key => $script) {
             if ($index < 2) {
                 $jsn_jquery[$key] = $script;
             } else {
                 $user_js[$key] = $script;
             }
             $index++;
         }
         $document->_scripts = $system_js + $jsn_jquery + $user_js;
         //Add all custom tag to page
         if (count($this->_customs)) {
             foreach ($this->_customs as $custom) {
                 $document->addCustomTag($custom);
             }
         }
         //Add all style declaration to page
         if (count($this->_styleDeclaration)) {
             $document->addStyleDeclaration(implode(PHP_EOL, $this->_styleDeclaration));
         }
         //Add all script declaration to page
         if (count($this->_scriptDeclaration)) {
             $document->addScriptDeclaration(implode(PHP_EOL, $this->_scriptDeclaration));
         }
     }
     $this->_dispatch = true;
     $this->__construct();
 }
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'styles.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . "jsn.mousecheck.js");
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . "jsn.submenu.js");
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . "jsn.manage-styles.js");
     $JSNMedia->addStyleDeclaration("\n\t\t.template-item {\n\t\t\tbackground: url(" . JSN_POWERADMIN_IMAGES_URI . "icons-24/icon-24-loading-circle.gif) no-repeat center center;\n\t\t}\n\t\t.loading {\n\t\t\tbackground: url(" . JSN_POWERADMIN_IMAGES_URI . "icons-16/icon-16-loading-circle.gif) no-repeat center right;\n\t\t}\n\t\t");
     $JSNMedia->addScriptDeclaration("\n            (function (\$){\n               \$(document).ready(function (){\n                    \$('#client-switch').change(function (e) {\n                        var val =\$(this).attr('value');\n                        if(val == 0){\n                            \$('.template-list').hide();\n                            \$('#site').show();\n                        }else{\n                            \$('.template-list').hide();\n                            \$('#admin').show();\n                        }\n                    })\n\t           });\n            })(JoomlaShine.jQuery);\n        ");
     // Add javascript lang translation
     $jsnLang = new JSNJavascriptLanguages();
     $jsnLang->addLang('JSN_POWERADMIN_TM_MAKE_DEFAULT');
     $jsnLang->addLang('JSN_POWERADMIN_TM_UNINSTALL_TEMPLATE');
     $jsnLang->addLang('JSN_POWERADMIN_TM_MAKE_DEFAULT');
     $jsnLang->addLang('JSN_POWERADMIN_TM_UNINSTALL_TEMPLATE');
     $jsnLang->addLang('JSN_POWERADMIN_TM_CLOSE_BEFORE_DELETE');
     $jsnLang->addLang('JSN_POWERADMIN_TM_CLOSE_BEFORE_UNINSTALL');
     $jsnLang->addLang('JSN_POWERADMIN_TM_ALREADY_DEFAULT');
     $jsnLang->addLang('JSN_POWERADMIN_TM_CANNOT_DELETE_DEFAULT');
     $jsnLang->addLang('JSN_POWERADMIN_TM_CANNOT_UNINSTALL_DEFAULT');
     $jsnLang->addLang('JSN_POWERADMIN_TM_DELETE_STYLE_CONFIRM');
     $jsnLang->addLang('JSN_POWERADMIN_TM_UNINSTALL_TEMPLATE_CONFIRM');
     $JSNMedia->addScriptDeclaration($jsnLang->loadLang());
     $model = $this->getModel('templates');
     $rows = $model->getTemplates();
     $adminRows = $model->getTemplates(1);
     // Check permission for removing styles.
     JSNFactory::import('components.com_templates.helpers.templates');
     $canDo = version_compare(JVERSION, '3.2.2', 'ge') ? JHelperContent::getActions('com_templates') : TemplatesHelper::getActions();
     $canDelete = $canDo->get('core.delete');
     $canDelete = '<input type="hidden" id="candelete" value="' . $canDelete . '"></input>';
     echo $canDelete;
     // Check permission for uninstalling template.
     JSNFactory::import('components.com_installer.helpers.installer');
     $canDo = version_compare(JVERSION, '3.2.2', 'ge') ? JHelperContent::getActions('com_installer') : TemplatesHelper::getActions();
     $canUninstall = $canDo->get('core.delete');
     $canUninstall = '<input type="hidden" id="canuninstall" value="' . $canUninstall . '"></input>';
     echo $canUninstall;
     //assign to view
     $this->assign('templates', $rows);
     $this->assign('adminTemplates', $adminRows);
     $this->assign('canDelete', $canDelete);
     return parent::display();
 }
 /**
  * Method to parse language difinition to javascript string
  * @param string $key Language key
  */
 public static function addLang($key)
 {
     $jsnLang = JSNJavascriptLanguages::getInstance();
     $jsnLang->addLang($key);
 }
Example #4
0
 /**
  * This event fired right after this plugin loaded
  */
 public static function loadJavascriptLang()
 {
     $jsnLang = new JSNJavascriptLanguages();
     $jsnLang->addLang('JSN_RAWMODE_COMPONENT_EDIT_CONTACT');
     return $jsnLang->loadLang(false);
 }