Example #1
1
 /**
  *
  * Ajax render to store in session
  */
 public function ajaxGetRender()
 {
     /** load libraries for the system rener **/
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     /** get url **/
     $render_url = JRequest::getVar('render_url', '');
     $urlRender = base64_decode($render_url);
     $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
     if ($render_url == '') {
         $urlRender = JSNDatabase::getDefaultPage()->link;
     }
     $currUri = new JURI($urlRender);
     if (!$currUri->hasVar('Itemid')) {
         $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
     }
     $urlString = $currUri->toString();
     $session->set('rawmode_render_url', base64_encode($urlString));
     $parts = JString::parse_url($urlString);
     if (!empty($parts['query'])) {
         parse_str($parts['query'], $params);
     } else {
         $params = array();
     }
     $jsntemplate = JSNFactory::getTemplate();
     $jsnrawmode = JSNRawmode::getInstance($params);
     $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
     $jsnrawmode->renderAll();
     $session = JSession::getInstance('files', array('name' => 'jsnajaxgetrender'));
     $session->set('component', $jsnrawmode->getHTML('component'));
     $session->set('jsondata', $jsnrawmode->getScript('positions', 'JSON'));
     jexit('success');
 }
 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();
 }
 function uninstall()
 {
     JSNFactory::import('components.com_installer.helpers.installer');
     $canDo = InstallerHelper::getActions();
     if (!$canDo->get('core.delete')) {
         $response = array('isUninstalled' => false);
         echo json_encode($response);
         jexit();
     }
     $id = JRequest::getVar('id', 0);
     if (!is_numeric($id) || $id <= 0) {
         return;
     }
     $dbo = JFactory::getDBO();
     $dbo->setQuery("SELECT e.extension_id FROM #__extensions e INNER JOIN #__template_styles s ON e.element=s.template WHERE e.type='template' AND s.id={$id} LIMIT 1");
     $extensionId = $dbo->loadResult();
     if ($extensionId > 0) {
         JFactory::getLanguage()->load('com_installer');
         JSNFactory::import('components.com_installer.models.manage');
         $model = $this->getModel('manage', 'InstallerModel', array('ignore_request' => true));
         $result = $model->remove(array($extensionId));
         $response = array('isUninstalled' => true);
         echo json_encode($response);
     }
     jexit();
 }
 public function getItems($pk)
 {
     if (!count($this->_items)) {
         $app = JFactory::getApplication();
         $menu = $app->getMenu();
         $active = $menu->getActive();
         $this->params = $params = $this->getState('params');
         if ($active) {
             $params->loadString($active->params);
         }
         $options = array();
         $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0);
         $categories = JCategories::getInstance('Contact', $options);
         $this->_parent = $categories->get($pk['id']);
         $JSNConfig = JSNFactory::getConfig();
         $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
         $JSNConfig->megreGlobalParams('com_contact', $this->params, true);
         if (is_object($this->_parent)) {
             $this->_items = $this->_parent->getChildren();
         } else {
             $this->_items = false;
         }
     }
     return $this->_items;
 }
 /**
  *
  * Get data
  * @param Array $pk
  */
 public function &prepareDisplayedData($pk)
 {
     $parentId = JRequest::getInt('id');
     $this->setState('filter.parentId', $pk['id']);
     $data = null;
     $state = $this->getState();
     $items = $this->getItems($pk);
     $parent = $this->getParent();
     if ($items === false) {
         echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
         return;
     }
     if ($parent == false) {
         echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
         return;
     }
     $params =& $state->params;
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreMenuParams($pk['Itemid'], $params);
     $JSNConfig->megreGlobalParams('com_weblinks', $params, true);
     $items = array($parent->id => $items);
     // 		//Escape strings for HTML output
     $data->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $data->maxLevelcat = $params->get('maxLevelcat', -1);
     $data->params = $params;
     $data->parent = $parent;
     $data->items = $items;
     return $data;
 }
 /**
  * Method to do additional instant update according config change
  *
  * @param	string	Name of changed config parameter
  * @param	mixed	Recent config parameter value
  * @return	void
  */
 protected function instantUpdate($name, $value)
 {
     $input = JFactory::getApplication()->input;
     if ($name == 'disable_all_messages') {
         // Get name of messages table
         $table = '#__jsn_' . substr(JRequest::getCmd('option'), 4) . '_messages';
         // Enable/disable all messages
         $db = JFactory::getDbo();
         $db->setQuery("UPDATE `{$table}` SET published = " . (1 - $value) . " WHERE 1");
         $db->query();
     } elseif ($name == 'languagemanager') {
         // Get variable
         $lang = $input->getVar('languagemanager', array(), 'default', 'array');
         // Install backend languages
         if (isset($lang['a'])) {
             JSNFactory::import('components.com_poweradmin.helpers.language');
             JSNLanguageHelper::installSupportedExtLangs($lang['a']);
             JSNUtilsLanguage::install($lang['a']);
         }
         // Install frontend languages
         if (isset($lang['s'])) {
             JSNUtilsLanguage::install($lang['s'], true);
         }
     } else {
         return parent::instantUpdate($name, $value);
     }
     return true;
 }
 /**
  * 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);
 }
Example #8
0
 /**
  *
  * Get data
  * @param Array $pk
  */
 public function &prepareDisplayedData($pk)
 {
     $data = null;
     $JSNConfig = JSNFactory::getConfig();
     $params = $JSNConfig->getMenuParams($pk['Itemid']);
     $JSNConfig->megreGlobalParams('com_content', $params);
     $items = $this->getItems();
     $pagination = $this->getPagination();
     foreach ($items as $item) {
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
     }
     $form = new stdClass();
     // Month Field
     $months = array('' => JText::_('COM_CONTENT_MONTH'), '01' => JText::_('JANUARY_SHORT'), '02' => JText::_('FEBRUARY_SHORT'), '03' => JText::_('MARCH_SHORT'), '04' => JText::_('APRIL_SHORT'), '05' => JText::_('MAY_SHORT'), '06' => JText::_('JUNE_SHORT'), '07' => JText::_('JULY_SHORT'), '08' => JText::_('AUGUST_SHORT'), '09' => JText::_('SEPTEMBER_SHORT'), '10' => JText::_('OCTOBER_SHORT'), '11' => JText::_('NOVEMBER_SHORT'), '12' => JText::_('DECEMBER_SHORT'));
     $form->monthField = JHtml::_('select.genericlist', $months, 'month', array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $this->getState('filter.month'), 'option.key' => null));
     // Year Field
     $years = array();
     $years[] = JHtml::_('select.option', null, JText::_('JYEAR'));
     for ($i = 2000; $i <= 2020; $i++) {
         $years[] = JHtml::_('select.option', $i, $i);
     }
     $form->yearField = JHtml::_('select.genericlist', $years, 'year', array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $this->getState('filter.year')));
     $form->limitField = $pagination->getLimitBox();
     //Escape strings for HTML output
     $data->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $data->filter = $this->getState('list.filter');
     $data->form = $form;
     $data->items = $items;
     $data->params = $params;
     $data->pagination = $pagination;
     return $data;
 }
 /**
  * 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);
 }
Example #10
0
 public function installPaExtension()
 {
     $this->model = $this->getModel('installer');
     JSNFactory::import('components.com_installer.helpers.installer');
     $canDo = InstallerHelper::getActions();
     if ($canDo->get('core.manage')) {
         try {
             $rs = $this->model->download();
             $this->input->set('package', $rs);
             // Set extension parameters
             $_GET['package'] = $rs;
             $_GET['type'] = 'plugin';
             $_GET['folder'] = 'jsnpoweradmin';
             $_GET['publish'] = 1;
             $_GET['client'] = 'site';
             $_GET['name'] = str_ireplace(JSN_POWERADMIN_EXT_IDENTIFIED_NAME_PREFIX, '', $_GET['identified_name']);
             $this->model->install($rs);
             if ($this->model->install($rs)) {
                 require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extensions.php';
                 // Enable extension suport
                 $_GET['name'] = str_ireplace(JSN_POWERADMIN_EXT_IDENTIFIED_NAME_PREFIX, '', $_GET['identified_name']);
                 try {
                     JSNPaExtensionsHelper::enableExt($identifiedName);
                 } catch (Exception $ex) {
                     exit('notenabled');
                 }
             }
         } catch (Exception $ex) {
             exit($ex->getMessage());
         }
         exit('success');
     }
 }
Example #11
0
 /**
  *
  * Get data
  * @param Array $pk
  */
 public function prepareDisplayedData($pk)
 {
     $data = null;
     $params = $this->getState('params');
     // Get some data from the models
     $state = $this->getState();
     $items = $this->getItems();
     $pagination = $this->getPagination();
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $temp = new JRegistry();
         $temp->loadString($item->params);
         $item->params = clone $params;
         $item->params->merge($temp);
         if ($item->params->get('show_email', 0) == 1) {
             $item->email_to = trim($item->email_to);
             if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
                 $item->email_to = $item->email_to;
             } else {
                 $item->email_to = '';
             }
         }
     }
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
     $JSNConfig->megreGlobalParams('com_contact', $params, true);
     $maxLevel = $params->get('maxLevel', -1);
     $data->maxLevel = $maxLevel;
     $data->state = $state;
     $data->items = $items;
     $data->params = $params;
     $data->pagination = $pagination;
     return $data;
 }
 /**
  *
  * Disable JT3 infomode
  *
  * @return: Save setting to file params.ini
  */
 public function disableInfoMode()
 {
     JSNFactory::localimport('libraries.joomlashine.database');
     $template = JSNDatabase::getDefaultTemplate();
     $client = JApplicationHelper::getClientInfo($template->client_id);
     $file = $client->path . '/templates/' . $template->element . '/params.ini';
     $data = JFile::read($file);
     $data = explode("\n", $data);
     $params = array();
     $needChange = false;
     foreach ($data as $val) {
         $spos = strpos($val, "=");
         $key = substr($val, 0, $spos);
         $value = substr($val, $spos + 1, strlen($val) - $spos);
         if ($key == 'infomode') {
             if ($value == '"1"') {
                 $value = '"0"';
                 $needChange = true;
             }
         }
         $params[$key] = $value;
     }
     if ($needChange) {
         $data = array();
         foreach ($params as $key => $val) {
             $data[] = $key . '=' . $val;
         }
         $data = implode("\n", $data);
         if (JFile::exists($file)) {
             @chmod($file, 0777);
         }
         JFile::write($file, $data);
     }
 }
Example #13
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();
 }
Example #14
0
 /**
  *
  * Get ramode instanced
  *
  * @param Array $params
  */
 public static function getRawmode($params = array())
 {
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     if (!isset(self::$rawmode)) {
         self::$rawmode = JSNRawmode::getInstance($params);
     }
     return self::$rawmode;
 }
Example #15
0
 /**
  *
  * Get data
  *
  * @param Array $pk
  */
 public function prepareDisplayedData($pk)
 {
     $data = null;
     jimport('joomla.application.categories');
     $this->setState('category.id', $pk['id']);
     $params = $this->getState('params');
     // Get some data from the models
     $state = $this->getState();
     $items = $this->getItems();
     $category = $this->getCategory();
     $children = $this->getChildren();
     $parent = $this->getParent();
     $pagination = $this->getPagination();
     // Check for errors.
     if ($category == false) {
         echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
     }
     if ($parent == false) {
         echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
     }
     // Prepare the data.
     // Compute the contact slug.
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $temp = new JRegistry();
         $temp->loadString($item->params);
         $item->params = clone $params;
         $item->params->merge($temp);
         if ($item->params->get('show_email', 0) == 1) {
             $item->email_to = trim($item->email_to);
             if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
                 $item->email_to = JHtml::_('email.cloak', $item->email_to);
             } else {
                 $item->email_to = '';
             }
         }
     }
     // Setup the category parameters.
     $cparams = $category->getParams();
     $category->params = clone $params;
     $category->params->merge($cparams);
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
     $JSNConfig->megreGlobalParams('com_contact', $params, true);
     $children = array($category->id => $children);
     $maxLevel = $params->get('maxLevel', -1);
     $data->maxLevel = $maxLevel;
     $data->state = $state;
     $data->items = $items;
     $data->category = $category;
     $data->children = $children;
     $data->params = $params;
     $data->parent = $parent;
     $data->pagination = $pagination;
     return $data;
 }
Example #16
0
 /**
  *
  * Get data
  *
  * @param Array $pk
  */
 public function prepareDisplayedData($pk)
 {
     $data = null;
     $this->setState('category.id', $pk['id']);
     // Get some data from the models
     $state = $this->getState();
     $items = $this->getItems();
     $category = $this->getCategory();
     $children = $this->getChildren();
     $parent = $this->getParent();
     $pagination = $this->getPagination();
     $params = $this->getState('params');
     // Check for errors.
     if ($category == false) {
         echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
         return;
     }
     if ($parent == false) {
         echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
         return;
     }
     // Prepare the data.
     // Compute the weblink slug & link url.
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1) {
             $item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&&id=' . $item->id);
         } else {
             $item->link = $item->url;
         }
         $temp = new JRegistry();
         $temp->loadString($item->params);
         $item->params = clone $params;
         $item->params->merge($temp);
     }
     // Setup the category parameters.
     $cparams = $category->getParams();
     $category->params = clone $params;
     $category->params->merge($cparams);
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreMenuParams($pk['Itemid'], $params);
     $JSNConfig->megreGlobalParams('com_weblinks', $params, true);
     $children = array($category->id => $children);
     $maxLevel = $params->get('maxLevel', -1);
     $data->maxLevel = $maxLevel;
     $data->state = $state;
     $data->items = $items;
     $data->category = $category;
     $data->children = $children;
     $data->params = $params;
     $data->parent = $parent;
     $data->pagination = $pagination;
     return $data;
 }
Example #17
0
 /**
  * 
  * Rawmode load data json
  */
 public function loadModulesJsonData()
 {
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     $position = JRequest::getVar('position', '');
     $Itemid = JRequest::getVar('currItemid', 0);
     $jsnrawmode = JSNRawmode::getInstance();
     $jsnrawmode->setParam('Itemid', $Itemid);
     $jsnrawmode->renderPosition($position);
     echo $jsnrawmode->getScript('position', 'JSON', $position);
     jexit();
 }
 /**
  * 
  * Make array store all position in template
  */
 protected function makeArrayColumns()
 {
     //All position not defined in XML
     $this->_columns = array('user14', 'user15', 'user16', 'user17', 'user18', 'user19', 'user20', 'user21', 'user22', 'user23', 'user24', 'user25', 'user26', 'user27', 'bottom1', 'bottom2', 'bottom3', 'bottom4', 'bottom5');
     $template = JSNFactory::getTemplate();
     $positions = $template->loadXMLPositions();
     foreach ($positions as $position) {
         if (!in_array($position->name[0], $this->_columns)) {
             $this->_columns[] = (string) $position->name[0];
         }
     }
 }
Example #19
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();
 }
 /**
  * 
  * 
  */
 public function getParams($pks)
 {
     $app = JFactory::getApplication('site');
     $siteMenu = JMenu::getInstance('site');
     $menuParams = $siteMenu->getItem($pks['Itemid']);
     if (isset($menuParams->params)) {
         $params = $menuParams->params;
     } else {
         $params = $this->getState()->get('params');
     }
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreGlobalParams($pks['option'], $params);
     return $params;
 }
Example #21
0
 /**
  * Render menu
  */
 public function getMenuType()
 {
     $mid = trim(JRequest::getVar('mid', ''));
     //load libraries for the system rener modules mene
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     $menutype = $this->getModel('menuitem')->getMenuType($mid);
     if ($menutype) {
         $jsnmenuitems = JSNMenuitems::getInstance();
         $menutitle = $this->getModel('menuitem')->getMenuTitle($mid);
         echo $jsnmenuitems->renderMenuItem($mid, $menutype, $menutitle);
     } else {
         echo 'error';
     }
     jexit();
 }
Example #22
0
 /**
  * Display function
  */
 public function display($tpl = null)
 {
     if (function_exists('error_reporting')) {
         error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
     }
     /** load libraries for the system rener **/
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     /** Assignment variables **/
     $jsntemplate = JSNFactory::getTemplate();
     $jsnmenuitems = JSNMenuitems::getInstance();
     /** get url **/
     $render_url = JRequest::getVar('render_url', '');
     $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
     if ($render_url == '' && $session->get('rawmode_render_url')) {
         $render_url = $session->get('rawmode_render_url');
     }
     $urlRender = base64_decode($render_url);
     if ($render_url == '') {
         $urlRender = JSNDatabase::getDefaultPage()->link;
     }
     $currUri = new JURI($urlRender);
     if (!$currUri->hasVar('Itemid')) {
         $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
     }
     $urlString = $currUri->toString();
     $session->set('rawmode_render_url', base64_encode($urlString));
     $parts = JString::parse_url($urlString);
     if (!empty($parts['query'])) {
         parse_str($parts['query'], $params);
     } else {
         $params = array();
     }
     $jsnrawmode = JSNRawmode::getInstance($params);
     $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
     $jsnrawmode->renderAll();
     $this->assign('component', $jsnrawmode->getHTML('component'));
     $this->assign('modules', $jsnrawmode->getHTML('positions'));
     $this->assign('jsnmenuitems', $jsnmenuitems);
     $this->assign('urlRender', $urlRender);
     /** add toolbar buttons **/
     $this->addToolBar();
     /** add scripts and css **/
     //$this->addMedia( $currUri->getVar('Itemid'), $urlString, array());//$jsnrawmode->getScript('positions', 'Array'));
     $this->addMedia($currUri->getVar('Itemid'), $urlString, $jsnrawmode->getScript('positions', 'Array'));
     return parent::display();
 }
Example #23
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);
 }
Example #24
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();
 }
Example #25
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);
 }
Example #26
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();
 }
 /**
  *
  * Get item
  *
  * @param Array $pk
  */
 public function getItems($pk, $recursive = false)
 {
     if (!count($this->_items)) {
         // Process params
         $this->params = $params = $this->getState('params');
         $options = array();
         $options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0);
         $categories = JCategories::getInstance('Content', $options);
         $this->_parent = $categories->get($pk['id']);
         $JSNConfig = JSNFactory::getConfig();
         $JSNConfig->megreMenuParams($pk['Itemid'], $this->params);
         $JSNConfig->megreGlobalParams('com_content', $this->params, true);
         if (is_object($this->_parent)) {
             $this->_items = $this->_parent->getChildren(false);
         } else {
             $this->_items = false;
         }
     }
     return $this->_items;
 }
 /**
  * 
  * Redirect to position listing page
  */
 public function selectPosition()
 {
     if (!JSNFactory::_cURLCheckFunctions()) {
         $msg = JText::_('JSN_POWERADMIN_ERROR_CURL_NOT_ENABLED');
         $this->setRedirect('index.php?option=com_poweradmin&view=error&tmpl=component', $msg, 'error');
         $this->redirect();
     }
     global $templateAuthor, $notSupportedTemplateAuthors;
     if (in_array($templateAuthor, $notSupportedTemplateAuthors)) {
         $msg = JText::_('JSN_POWERADMIN_ERROR_TEMPLATE_NOT_SUPPORTED');
         $this->setRedirect('index.php?option=com_poweradmin&view=error&tmpl=component', $msg);
     } else {
         $app = JFactory::getApplication();
         $moduleid = JRequest::getVar('moduleid', array(), 'get', 'array');
         $appendRedirect = 'tmpl=component';
         $moduleid = explode(',', $moduleid[0]);
         $app->setUserState('com_poweradmin.changeposition.moduleid', $moduleid);
         $this->setRedirect('index.php?option=com_poweradmin&view=changeposition&' . $appendRedirect);
         $this->redirect();
     }
 }
Example #29
0
 /**
  *
  * Get item
  *
  * @param Array $pk
  */
 public function &getItem($pk = array())
 {
     $item = parent::getItem($pk['id']);
     // Add router helpers.
     $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
     $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
     $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
     // Merge article params. If this is single-article view, menu params override article params
     // Otherwise, article params override menu item params
     $this->params = $this->state->get('params');
     $temp = clone $this->params;
     // Merge so that article params take priority
     $temp->merge($item->params);
     $item->params = $temp;
     //Megre params
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreMenuParams($pk['Itemid'], $item->params);
     $JSNConfig->megreGlobalParams('com_content', $item->params, true);
     $offset = $this->state->get('list.offset');
     $item->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx'));
     return $item;
 }
 /**
  * Method for removing extension
  *
  * @return	void
  */
 function removeExtension()
 {
     $user = JFactory::getUser();
     $component = JRequest::getCmd('component');
     $coreComponents = array('com_content', 'com_admin', 'com_config', 'com_checkin', 'com_cache', 'com_login', 'com_users', 'com_menus', 'com_categories', 'com_media', 'com_messages', 'com_redirect', 'com_search');
     if ($user->get('id') && preg_match('/^com_/i', $component) && !in_array($component, $coreComponents)) {
         $dbo = JFactory::getDBO();
         $dbo->setQuery("SELECT extension_id FROM #__extensions WHERE element LIKE '{$component}' AND type LIKE 'component' LIMIT 1");
         $componentId = $dbo->loadResult();
         if (empty($componentId) || !is_numeric($componentId)) {
             $this->setRedirect('index.php');
             return;
         }
         JFactory::getLanguage()->load('com_installer');
         JSNFactory::import('components.com_installer.models.manage');
         $model = $this->getModel('manage', 'InstallerModel', array('ignore_request' => true));
         $result = $model->remove(array($componentId));
         $this->setRedirect('index.php?option=com_installer&view=manage');
         return;
     }
     $this->setRedirect('index.php');
 }