Esempio n. 1
0
 /**
  *
  * Add Scripts and StyleSheets for this view
  * @param String $currentUrl
  */
 protected function addMedia($currentItemid, $render_url, $php_to_js)
 {
     $currentItemid = (int) $currentItemid;
     /** load libraries for the system rener **/
     $JSNTemplate = JSNFactory::getTemplate();
     $JSNMedia = JSNFactory::getMedia();
     $template = JFactory::getDocument()->template;
     $currUri = new JURI($render_url);
     JSNHtmlAsset::addStyle(JSN_POWERADMIN_STYLE_URI . 'uilayout/layout-default-latest.css');
     JSNHtmlAsset::addStyle(JSN_POWERADMIN_STYLE_URI . 'styles.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.tinyscrollbar.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-hotkeys/jquery.hotkeys.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery-baseencode64.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstorage/jquery.jstorage.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.autodragdrop.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.rawmode.draganddrop.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.rawmode.component.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.rawmode.grid.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-layout/js/jquery.layout-latest.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jstree/jstree.override.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.jstreecontext.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.menuitems.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.jquery.override.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.filter.js');
     //check sef on/off
     $sef = JFactory::getConfig()->get('sef');
     /** Add Custom Scripts **/
     $customScript = "\n\t\t\tvar jsnpoweradmin = true;\n\t\t\tvar baseUrl       = '" . JURI::root() . "';\n\t\t\tvar sef           = " . $sef . ";\n\t\t\tvar currentUrl    = '" . $render_url . "';\n\t\t\tvar lang          = '" . $JSNMedia->getLang() . "';\n\t\t\tvar positions     = new Array();\n\t\t\tvar JSNGrid, JSNComponent;\n\n\t\t\t(function(\$){\n\t\t\t    " . implode(PHP_EOL, $php_to_js) . "\n\t\t\t    \$.uiBackCompat = false;\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#page-loading').hide();\n\t\t\t\t\t\$('#jsn-rawmode-layout').css('visibility', 'visible');\n\t\t\t\t\tif (\$('#jsn-adminbar').size() == 0) {\n\t\t\t\t\t\t\$('body').addClass('no-adminbar');\n\t\t\t\t\t}\n\n\t\t\t\t\tfunction setFullScreen () {\n\t\t\t\t\t\t\$('body').toggleClass('jsn-fullscreen');\n\t\t\t\t\t\tif (\$('body').hasClass('jsn-fullscreen')) {\n\t\t\t\t\t\t\t\$('.header').hide();\n\t\t\t\t\t\t\t\$('.subhead-collapse').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\$('.header').show();\n\t\t\t\t\t\t\t\$('.subhead-collapse').show();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\$(window).trigger('resize');\n\t\t\t\t\t}\n\n\t\t\t\t\t\$('a#jsn-fullscreen').click(function () {\n\t\t\t\t\t\tsetFullScreen();\n\t\t\t\t\t\t\$.cookie('jsn-fullscreen', \$('body').hasClass('jsn-fullscreen'));\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t});\n\n\t\t\t\t\tvar isFullScreen = \$.cookie('jsn-fullscreen');\n\t\t\t\t\tif (isFullScreen !== undefined && (isFullScreen == 'true' || isFullScreen == '1')) {\n\t\t\t\t\t\tsetFullScreen();\n\t\t\t\t\t}\n\n\t\t\t\t\t\$.jStorage.set('selected_node', " . $currentItemid . ");\n\t\t\t\t\t\$.ajaxSetup({\n\t\t\t\t\t   timeout: 10000\n\t\t\t\t\t});\n\t\t\t\t\tJSNGrid      = new \$.JSNGrid();\n\t\t\t\t\tJSNComponent = new \$.JSNComponent('" . $currUri->getVar('option') . "', '" . $currUri->getVar('view') . "', '" . $currUri->getVar('layout') . "', '" . $currentItemid . "');\n \t\t\t\t\t\$._menuitems.mode  = 'rawmode';\n \t\t\t\t\t\$._menuitems.init();\n \t\t\t\t\t\$.jsnmouse.init();\n\t\t\t\t\tJSNFilter\t= new \$.JSNSpotligthModuleFilter(\$('#module_spotlight_filter'), {defaultText: '" . JText::_('JSN_RAWMODE_MODULE_FILTER_DEFAULT_TEXT', true) . "'});\n\t\t\t\t});\n\n\t\t\t})(JoomlaShine.jQuery);\n\t\t";
     $JSNMedia->addScriptDeclaration($customScript);
 }
Esempio n. 2
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'styles.css');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-hotkeys/jquery.hotkeys.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstorage/jquery.jstorage.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.topzindex.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.tinyscrollbar.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.assignpages.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstree/jquery.jstree.js');
     $JSNMedia->addScriptDeclaration("var baseUrl = '" . JURI::root() . "';");
     //require helper
     JSNFactory::localimport('libraries.joomlashine.page.assignpages');
     $viewHelper = JSNAssignpages::getInstance();
     $menuTypes = $viewHelper->menuTypeDropDownList(false);
     $this->assign('menutypes', $menuTypes);
     $moduleid = JRequest::getVar('id', 0);
     $menuitems = $viewHelper->renderMenu($moduleid);
     $this->assign('menuitems', $menuitems);
     JSNFactory::localimport('libraries.joomlashine.modules');
     $assignType = JSNModules::checkAssign($moduleid);
     $this->assign('assignType', $assignType);
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $language = JFactory::getLanguage();
     $language->load('com_modules');
     parent::display($tpl);
 }
Esempio n. 3
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     // Include the component HTML helpers.
     JSNFactory::import('components.com_content.helpers.content');
     JSNFactory::import('components.com_content.helpers.html.contentadministrator');
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'content.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.content.js');
     if ($this->getLayout() == 'pagebreak') {
         // TODO: This is really dogy - should change this one day.
         $eName = JRequest::getVar('e_name');
         $eName = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName);
         $document = JFactory::getDocument();
         $document->setTitle(JText::_('COM_CONTENT_PAGEBREAK_DOC_TITLE'));
         $this->assignRef('eName', $eName);
         parent::display($tpl);
         return;
     }
     // Initialiase variables.
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $language = JFactory::getLanguage();
     $language->load('com_content');
     parent::display($tpl);
 }
Esempio n. 4
0
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.filter.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $language = JFactory::getLanguage();
     $language->load('com_menus');
     $model = $this->getModel();
     $this->assign('model', $model);
     $menutype = '';
     $menutypeid = JRequest::getVar("menutypeid", '');
     if ($menutypeid) {
         JSNFactory::localimport('models.menuitem');
         $paMenuModel = new PoweradminModelMenuitem();
         $menutype = $paMenuModel->getMenuType($menutypeid);
     }
     $parentid = JRequest::getVar("parentid", '');
     $customScript = "\n\t\t\tvar selectMenuType;\n            (function(\$){\n\t\t\t\t\$(window).ready(function(){\n\t\t\t\t  \t  selectMenuType =  \$.jsnFilter(\n\t\t\t\t  \t  {\n\t\t\t  \t  \t\t  frameElement: \$('.jsn-menu-type'),\n\t\t\t  \t  \t\t  category    : true,\n\t\t\t\t\t  \t  itemClass   : '.jsn-item-type',\n\t\t\t\t\t  \t  totalColumn : 3,\n\t\t\t\t\t  \t  itemWidth   : 220,\n\t\t\t\t\t  \t  itemHeight  : 30,\n\t\t\t\t\t  \t  mPosLeft    : 0,\n\t\t\t\t\t  \t  mPosTop     : 15,\n\t\t\t\t\t  \t  marginOffset: {\n\t\t\t\t\t  \t  \t  right : 15,\n\t\t\t\t\t  \t  \t  bottom: 20\n\t\t\t\t\t  \t  },\n\t\t\t\t\t  \t  eventClick: function(){\n\t\t\t\t\t  \t  \t var params = \$(this).attr('params');\n\t\t\t\t\t  \t  \t window.parent.JoomlaShine.jQuery.addNewMenuItem(params, '" . $menutype . "', '" . $menutypeid . "', '" . $parentid . "');\n\t\t\t\t\t  \t  }\n\t\t\t\t  \t  \t}\n\t\t\t\t  \t  );\n\t\t\t\t  });\n\t\t\t  })(JoomlaShine.jQuery);\n\t\t";
     $JSNMedia->addScriptDeclaration($customScript);
     return parent::display();
 }
Esempio n. 5
0
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'styles.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.cook.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.tinyscrollbar.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-hotkeys/jquery.hotkeys.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jstree/jstree.override.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstorage/jquery.jstorage.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.topzindex.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.assignpages.js');
     $JSNMedia->addScriptDeclaration("var baseUrl = '" . JURI::root() . "';");
     //require classes
     JSNFactory::localimport('libraries.joomlashine.modules');
     JSNFactory::localimport('libraries.joomlashine.page.assignpages');
     $viewHelper = JSNAssignpages::getInstance();
     $menuTypes = $viewHelper->menuTypeDropDownList(false);
     $this->assign('menutypes', $menuTypes);
     $app = JFactory::getApplication();
     $moduleid = $app->getUserState('com_poweradmin.assignpages.custompage.moduleid', JRequest::getVar('moduleid', array(), 'get', 'array'));
     if (count($moduleid) == 1) {
         $menuitems = $viewHelper->renderMenu($moduleid[0]);
         $assignType = JSNModules::checkAssign($moduleid[0]);
     } else {
         $menuitems = $viewHelper->renderMenu(0);
         $assignType = 3;
     }
     $this->assign('menuitems', $menuitems);
     $this->assign('assignType', $assignType);
     return parent::display();
 }
Esempio n. 6
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $JSNMedia = JSNFactory::getMedia();
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.datas.validation.js');
     $JSNMedia->addScriptDeclaration("\n\t\t\tvar baseUrl = '" . JURI::root() . "';\n\t\t\t(function(\$){\n\t\t\t\t\$(window).ready(function(){\n\t\t\t\t\t\$('#jsn-component-settings').textboxDataNumberic({maxValue:500});\n\t\t\t\t\t\$('.apply-setting-area').click(function(){\n\t\t\t\t\t\tif (\$(this).children('input').val() == 'globally'){\n\t\t\t\t\t\t\t\$(this).children('input').val('only');\n\t\t\t\t\t\t\t\$(this).children('span.symbol-only').show();\n\t\t\t\t\t\t\t\$(this).children('span.symbol-globally').hide();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\$(this).children('span.symbol-only').hide();\n\t\t\t\t\t\t\t\$(this).children('span.symbol-globally').show();\n\t\t\t\t\t\t\t\$(this).children('input').val('globally');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t})(JoomlaShine.jQuery);\n\t\t");
     $JSNConfig = JSNFactory::getConfig();
     $params = $JSNConfig->getMenuParams($app->getUserState('com_poweradmin.component.menuid', 0));
     $JSNConfig->megreGlobalParams('com_content', $params, true);
     $this->assign('params', $params);
     return parent::display();
 }
Esempio n. 7
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'content.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.content.js');
     //Load language
     JFactory::getLanguage()->load('com_categories');
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->canDo = CategoriesHelper::getActions($this->state->get('category.component'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
 }
Esempio n. 8
0
 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();
 }
Esempio n. 9
0
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.filter.js');
     $state = $this->get('State');
     $items = $this->get('Items');
     $position = JRequest::getVar('position', '');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('items', $items);
     $this->assignRef('position', $position);
     $customScript = "\n\t\t\tvar selectModuleType;\n            (function(\$){\n\t\t\t\t\$(window).ready(function(){\n\t\t\t\t  \t  selectModuleType =  \$.jsnFilter(\n\t\t\t\t  \t  {\n\t\t\t  \t  \t\t  frameElement: \$('#jsn-module-type-container'),\n\t\t\t\t\t  \t  totalItems  : " . count($items) . ",\n\t\t\t\t\t  \t  itemClass   : '.jsn-item-type',\n\t\t\t\t\t  \t  totalColumn : 3,\n\t\t\t\t\t  \t  itemWidth   : 220,\n\t\t\t\t\t  \t  itemHeight  : 30,\n\t\t\t\t\t  \t  mPosLeft    : 0,\n\t\t\t\t\t  \t  mPosTop     : 0,\n\t\t\t\t\t  \t  marginOffset: {\n\t\t\t\t\t  \t  \t  right : 15,\n\t\t\t\t\t  \t  \t  bottom: 20\n\t\t\t\t\t  \t  },\n\t\t\t\t\t  \t  eventClick: function(){\n\t\t\t\t\t\t  \t  var extension_id = \$(this).attr('id');\n\t\t\t\t\t\t  \t  var position     = \$('#position').val();\n\t\t\t\t\t\t  \t  window.parent.JoomlaShine.jQuery.addNewModule(extension_id, position);\n\t\t\t\t\t  \t  }\n\t\t\t\t  \t  \t}\n\t\t\t\t  \t  );\n\t\t\t\t  });\n\t\t\t  })(JoomlaShine.jQuery);\n\t\t";
     $JSNMedia->addScriptDeclaration($customScript);
     return parent::display();
 }
Esempio n. 10
0
 /**
  * Add jquery files
  * @return: Array
  */
 protected function addScripts()
 {
     $JSNMedia = JSNFactory::getMedia();
     $template = JSNFactory::getTemplate();
     $template_js_positions = $template->loadArrayJavascriptTemplatePositions(true);
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery-baseencode64.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.autodragdrop.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.visualmode.draganddrop.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.visualmode.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.showblock.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jstorage.js');
     $currentUrlInos = $this->jsnpwrender->getCurrentUrlInfos();
     $showTemplatePosition = $currentUrlInos->showTemplatePosition ? 'true' : 'false';
     $customscripts = "\n\t\t\t" . $template_js_positions . "\n\t\t\tvar jsnpoweradmin = true;\n\t\t\tvar baseUrl       = '" . JURI::root() . "';\n\t\t\tvar lang          = '" . $JSNMedia->getLang() . "';\n\t\t\tvar currItemid    = '" . $this->jsnpwrender->getCurrentItemid() . "';\n\n\t\t\t(function(\$){\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\tif (" . $showTemplatePosition . "){\n\t\t\t\t\t\t\$('.poweradmin-module-item').each(function(){\n\t\t\t\t\t\t\tvar el = \$(this);\n\t\t\t\t\t\t\tif ( el.attr('id').split('-')[0] == '0'){\n\t\t\t\t\t\t\t\tif (el.parent().find('.poweradmin-module-item').length == 1){\n\t\t\t\t\t\t\t\t\tel.parent().addClass('inactive-position');\n\t\t\t\t\t\t\t\t\tel.parent().html('<label class=\"jsn-position-name\">'+el.parent().attr('id').replace('-jsnposition', '')+'</label><a class=\"add-new-module\" title=\"Add new module to this position.\" href=\"javascript:;\"></a>');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tel.remove();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tif (el.find('.mod-preview-wrapper').length > 0){\n\t\t\t\t\t\t\t\t\tvar moduleContent = \$('.mod-preview-wrapper', el).html();\n\t\t\t\t\t\t\t\t\tel.children().html( moduleContent );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof window.parent !== undefined){\n\t\t\t\t\t\tif (typeof window.parent.jQuery._visualmode.changeToolbar == 'function' ){\n\t\t\t\t\t\t\twindow.parent.jQuery._visualmode.changeToolbar('" . $currentUrlInos->urlString . "');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof window.parent.jQuery._visualmode.jsnRenderReady == 'function' ){\n\t\t\t\t\t\t\twindow.parent.jQuery._visualmode.jsnRenderReady();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\$.jsnmouse.init();\n\t\t\t\t\t//no show browser context menu\n\t    \t\t\t\$('body')[0].oncontextmenu = function() {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t })(JoomlaShine.jQuery);";
     $JSNMedia->addScriptDeclaration($customscripts);
     $this->assign('JSNMedia', $JSNMedia);
 }
Esempio n. 11
0
 /**
  *
  * Add Scripts and StyleSheets for this view
  */
 protected function addMedia()
 {
     $JSNMedia = JSNFactory::getMedia();
     /* require jsnpwTemplate class */
     $template = JSNFactory::getTemplate();
     $template_js_positions = $template->loadArrayJavascriptTemplatePositions(true);
     $JSNMedia->addStyleDeclaration(JSN_POWERADMIN_LIB_JSUILAYOUT_URI, 'layout-default-latest.css');
     $JSNMedia->addStyleDeclaration(JSN_POWERADMIN_STYLE_URI, 'styles.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSUILAYOUT_URI . 'jquery.layout-latest.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-hotkeys/jquery.hotkeys.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstree/jquery.jstree.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.topzindex.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery-baseencode64.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstorage/jquery.jstorage.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.menuitems.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.visualmode.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     //check sef on/off
     $sef = JFactory::getConfig()->get('sef');
     $customScript = "\n\t\t" . $template_js_positions . "\n\t\tvar lang    = '" . $JSNMedia->getLang() . "';\n\t\tvar baseUrl = '" . JURI::root() . "';\n\t\tvar sef     = " . $sef . ";\n\n\t\t(function(\$){\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$._visualmode.showLoading(true);\n\t\t\t\t\t\$( '.jsn-toolbar-button' ).buttonset();\n\t\t\t\t\t\$._visualmode.initLayout();\n\t\t\t\t\t\$.jsnmouse.init();\n\t\t\t\t\t\$._menuitems.init();\n\t\t\t\t\t\$._menuitems.layoutResize();\n\t\t\t\t\t\$._visualmode.init();\n                    \$(window).resize(function(){\n                    \t\$._visualmode.initLayout();\n                    });\n                    \$._visualmode.calculatorRate();\n\t\t\t\t\t//init status value and set it in to browser cookie\n\t\t\t\t\tvar index = \$.jStorage.index();\n\t\t\t\t\tif (!\$.inArray('module_highlight', index)){\n\t\t\t\t\t\t\$.jStorage.set('module_hightlight', false);\n\t\t\t\t\t\t\$.jStorage.set('inactive_position', false);\n\t\t\t\t\t\t\$.jStorage.set('unpublish_module', false);\n\t\t\t\t\t\t\$.jStorage.set('add_new_module', false);\n\t\t\t\t\t\t\$.jStorage.set('render_url', '');\n\t\t\t\t\t}\n\t\t\t\t\t/**\n\t\t\t\t\t * Support call to iframe page\n\t\t\t\t\t */\n\t\t\t\t\t\$.autoDragDrop = function(_ops){\n\t\t\t\t\t\twindow.frames.jsnrender.jQuery.autoDragDrop(_ops);\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t})(JoomlaShine.jQuery);\n\t\t";
     $JSNMedia->addScriptDeclaration($customScript);
 }
Esempio n. 12
0
    /**
     *
     * Add an toolbar switch mode
     *
     * @param: String $icon suffix class
     * @param: String $text is string text of icon
     * @param: String $enmodeTitle is enmode title
     * @param: String $offmodeTitle is offmode title
     */
    public static function switchmode($icon = '', $text = '', $enmodeTitle = '', $offmodeTitle = '')
    {
        $params = JSNConfigHelper::get('com_poweradmin');
        $JSNMedia = JSNFactory::getMedia();
        JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jquery.context-help.js');
        $customScript = "\n\t\t(function(\$) {\n\t\t\tfunction getVisisblePosition () {\n\t\t\t\tvar listOffset = \$('#modules-list').offset();\n\t\t\t\tvar listScrollTop = \$('#modules-list').scrollTop();\n\n\t\t\t\tvar items = \$('.jsn-element-container_inner');\n\t\t\t\tvar minOffset = null;\n\t\t\t\tvar visibleItem = null;\n\n\t\t\t\titems.each(function () {\n\t\t\t\t\tvar element = \$(this);\n\t\t\t\t\tvar offsetTop = element.offset().top - listOffset.top;\n\n\t\t\t\t\tif (element.find('.poweradmin-module-item').size() == 0)\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\tif ((offsetTop > 0 && minOffset == null) || (offsetTop > 0 && minOffset > offsetTop)) {\n\t\t\t\t\t\tminOffset = offsetTop;\n\t\t\t\t\t\tvisibleItem = element;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn visibleItem;\n\t\t\t}\n\n\t\t\t\$(function () {\n\t\t\t\tvar helps =\n\t\t\t\t[{\n\t\t\t\t\t'element'\t: '#jsn-rawmode-leftcolumn .jsn-heading-panel-title:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_01', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '.jsn-menu-selector-container',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_02', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 130,\n\t\t\t\t\t'offset'\t: { left: 60, top: 65 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-leftcolumn .jsn-toggle-button:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_03', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 200,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-center .jsn-heading-panel-title:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_04', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 105,\n\t\t\t\t\t'offset'\t: { left: 20, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-rightcolumn .jsn-heading-panel-title:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_05', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-rightcolumn .jsn-toggle-button:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_06', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -37 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-component-details',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_07', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 70,\n\t\t\t\t\t'offset'\t: { left: '50%', top: '40%' }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-center .jsn-toggle-button',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_08', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 70,\n\t\t\t\t\t'offset'\t: { left: -5, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_09', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 70,\n\t\t\t\t\t'refresh'\t: function (item) {\n\t\t\t\t\t\tvar visibleItem = getVisisblePosition();\n\t\t\t\t\t\tif (visibleItem == null)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\titem.setLocation(visibleItem.offset().left + 220, visibleItem.offset().top + 5);\n\t\t\t\t\t}\n\t\t\t\t}, {\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_10', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 270,\n\t\t\t\t\t'height'\t: 160,\n\t\t\t\t\t'refresh'\t: function (item) {\n\t\t\t\t\t\tvar visibleItem = getVisisblePosition();\n\t\t\t\t\t\tif (visibleItem == null)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\tvar elmOffset = null;\n\t\t\t\t\t\tvisibleItem.find('.poweradmin-module-item').each(function () {\n\t\t\t\t\t\t\tif (\$(this).css('display') != 'none') {\n\t\t\t\t\t\t\t\telmOffset = \$(this).offset();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (elmOffset == null)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\titem.setLocation(elmOffset.left + 100, elmOffset.top + 20);\n\t\t\t\t\t}\n\t\t\t\t}];\n\n\t\t\t\tvar contextHelp = new JSNContextHelp(helps, {});\n\t\t\t\tvar dismissHint = \$('<span/>', { 'id': 'dismiss-hint' }).appendTo(\$('#toolbar-switch-help-mode'));\n\t\t\t\tvar interval \t= null;\n\n\t\t\t\t\$('#toolbar-switch-help-mode')\n\t\t\t\t.unbind('turnoffmode')\n\t\t\t\t.bind('turnoffmode', function(){\n\t\t\t\t\tcontextHelp.hide();\n\t\t\t\t\tclearInterval(interval);\n\t\t\t\t})\n\t\t\t\t.unbind('turnonmode')\n\t\t\t\t.bind('turnonmode', function(){\n\t\t\t\t\tcontextHelp.show();\n\t\t\t\t\tinterval = setInterval(function () {\n\t\t\t\t\t\tif (\$('#toolbar-switch-help-mode').hasClass('turn-on') && \$('.ui-widget-overlay').size() > 0) {\n\t\t\t\t\t\t\t\$('#toolbar-switch-help-mode').click();\n\t\t\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 500);\n\t\t\t\t});\n\t\t\t});\n\t\t})(JoomlaShine.jQuery);\n\t\t";
        $JSNMedia->addScriptDeclaration($customScript);
        // Proceed first
        $_firstRunScript = '';
        if (intval(@$params->get('show_help_on_first_run', 1)) == 1) {
            $_firstRunScript = '
				if(!$.jStorage.get("sitemanager_run", false)){
					$.jStorage.set("sitemanager_show_help", true);
					_helpOff = true;
				}
			';
        }
        $JSNMedia->addScriptDeclaration('
			JoomlaShine.jQuery(function ($) {
				var _helpOff = false;
				' . $_firstRunScript . '
				if($.jStorage.get("sitemanager_show_help") ){
					var interval = setInterval(function () {
						if (jQuery(\'.ui-widget-overlay\').size() == 0) {
							jQuery(\'#toolbar-switch-help-mode\').click();
							clearInterval(interval);
						}
						if(_helpOff){
							$.jStorage.set("sitemanager_show_help", false);
						}
						$.jStorage.set("sitemanager_run", true);
					}, 500);
				}

			})
		');
        JSNFactory::localimport('helpers.html.toolbar.button.jsnswitchmode');
        $bar = JToolBar::getInstance('toolbar');
        // Add a standard button.
        $bar->appendButton('JSNSwitchmode', $icon, $text, $enmodeTitle, $offmodeTitle);
    }
 public function onAfterDispatch()
 {
     $input = $this->_application->input;
     if ($this->_application->isAdmin() && $input->getVar('format', '') != 'raw' && $input->getVar('option', '') == 'com_poweradmin' && $input->getVar('view') != 'update') {
         $JSNMedia = JSNFactory::getMedia();
         $JSNMedia->addMedia();
         return;
     }
 }
Esempio n. 14
0
 /**
  * Proceed positions rendering
  *
  * Remove default tp=1 layout, replace by jsn style to
  * show page positions
  *
  * @return  void
  */
 public function onAfterDispatch()
 {
     if (!JSNVersion::isJoomlaCompatible(JSN_FRAMEWORK_REQUIRED_JOOMLA_VER)) {
         return;
     }
     // Keep this for joomla 2.5. Will be deprecated.
     if (JSNVersion::isJoomlaCompatible('2.5') and !JSNVersion::isJoomlaCompatible('3.0')) {
         if (self::$_app->isAdmin() and self::$_app->input->getVar('format', '') != 'raw' and self::$_app->input->getVar('option', '') == 'com_poweradmin' and self::$_app->input->getVar('view') != 'update' and self::$_app->input->getVar('view') != 'changeposition') {
             $version = PoweradminHelper::getVersion();
             if (version_compare($version, '1.1.3', '>=')) {
                 $JSNMedia = JSNFactory::getMedia();
                 $JSNMedia->addMedia();
             }
         }
     }
     if (self::$_app->input->getCmd('poweradmin', 0) == 1) {
         $jsnHelper = JSNPositionsModel::_getInstance();
         $jsnHelper->renderEmptyComponent();
         $jsnHelper->renderEmptyModule();
     }
 }