Example #1
0
 function display($tpl = null)
 {
     $task = JRequest::getVar('task');
     if ($task == "save" || $task == "apply") {
         return $this->save($task);
     }
     if ($task == "cancel") {
         return $this->cancel();
     }
     FSS_Helper::IncludeModal();
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     $model = $this->getModel();
     $this->item = $this->get('Item');
     $this->section = $this->get('Section');
     $this->formid = $this->get('FormID');
     if ($this->section == "com_fss.support_admin" && JRequest::getVar('nojs') != 1) {
         $document = JFactory::getDocument();
         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/perm.group.support_admin.js');
     }
     $this->getTexts();
     $this->form = $model->getForm($this->formid);
     JToolBarHelper::title(JText::_("Permissions") . ': <small><small>[ ' . $this->title . ' ]</small></small>', 'fss_prods');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::cancel();
     JToolBarHelper::custom("nojs", "", "", "Old Version", false);
     FSSAdminHelper::DoSubToolbar(true);
     parent::display($tpl);
 }
Example #2
0
 function display($tpl = null)
 {
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     if (JRequest::getVar('hide_template_warning')) {
         $db = JFactory::getDBO();
         $sql = "REPLACE INTO #__fss_settings (setting, value) VALUES ('bootstrap_template', '" . $db->escape(FSS_Helper::GetTemplate()) . "')";
         $db->setQuery($sql);
         $db->Query();
         JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_fss&view=fsss', false));
     }
     JToolBarHelper::title(JText::_('FREESTYLE_SUPPORT_PORTAL'), 'fss.png');
     FSSAdminHelper::DoSubToolbar();
     parent::display($tpl);
 }
Example #3
0
 function display($tpl = null)
 {
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     JToolBarHelper::title(JText::_("Permissions"), 'fss_users');
     JToolBarHelper::deleteList();
     JToolBarHelper::editList();
     //JToolBarHelper::addNew("OK");
     $bar = JToolbar::getInstance('toolbar');
     $bar->appendButton('Standard', 'new', "FSS_Add_User", "add", false);
     JToolBarHelper::cancel('cancellist');
     FSSAdminHelper::DoSubToolbar();
     $this->lists = $this->get('Lists');
     $this->data = $this->get('Data');
     $this->pagination = $this->get('Pagination');
     parent::display($tpl);
 }
Example #4
0
 function display($tpl = null)
 {
     $task = JRequest::getVar('task');
     if ($task == "save" || $task == "apply" || $task == "save2new") {
         return $this->save($task);
     }
     if ($task == "cancel") {
         return $this->cancel();
     }
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     $model = $this->getModel();
     $user = $this->get('Data');
     $isNew = $user->id < 1;
     $model->user = $user;
     $db = JFactory::getDBO();
     $text = $isNew ? JText::_("NEW") : JText::_("EDIT");
     JToolBarHelper::title(JText::_("USER") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fss_users');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::save2new();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSSAdminHelper::DoSubToolbar();
     $username = !empty($user->name) ? $user->name : "";
     $userid = !empty($user->user_id) ? $user->user_id : 0;
     $input = "<input type='hidden' name='user_id' id='user_id' value='" . $userid . "' class='input-mini' />";
     $input .= "<input type='text' name='user_name' id='user_name' value='" . $username . "' class='input-xlarge' disabled='disabled' />";
     $newLink = JRoute::_('index.php?option=com_fss&view=listusers&tmpl=component&tpl=fuser');
     if ($isNew) {
         $input .= "&nbsp;<a href='{$newLink}' class='btn btn-default show_modal_iframe'>Choose User</a>";
     }
     $this->users = $input;
     $this->user = $user;
     $this->sort_load_data();
     $this->form = $model->getForm();
     FSS_Helper::IncludeModal();
     parent::display($tpl);
 }
Example #5
0
 static function Bootstrap()
 {
     // deal with bootstrap css
     $option = FSS_Settings::get('bootstrap_css');
     if (FSSJ3Helper::IsJ3()) {
         JHtml::_('bootstrap.framework');
     } else {
         // include bootstrap js
         if (FSS_Settings::get('bootstrap_js') == "yes" || JFactory::getApplication()->isAdmin()) {
             $document = JFactory::getDocument();
             $document->addScript(JURI::root(true) . "/components/com_fss/assets/js/bootstrap/bootstrap.js");
             //$option = "fssonly";
         }
     }
     if ($option == "fssonly") {
         FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     } else {
         if ($option == "partial") {
             FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_missing.parsed.less');
         } else {
             if ($option == "yes") {
                 FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap.less');
             }
         }
     }
 }
Example #6
0
 function display($tpl = null)
 {
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("\nvar fss_settings_url = '" . JRoute::_('index.php?option=com_fss&view=settings', false) . "';\n");
     $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/settings.js');
     FSS_Helper::StylesAndJS(array('csstest'));
     JHTML::_('behavior.modal');
     $what = JRequest::getString('what', '');
     $this->tab = JRequest::getVar('tab');
     if (JRequest::getVar('task') == "cancellist") {
         $mainframe = JFactory::getApplication();
         $link = FSSRoute::_('index.php?option=com_fss&view=fsss', false);
         $mainframe->redirect($link);
         return;
     }
     $settings = FSS_Settings::GetAllSettings();
     $db = JFactory::getDBO();
     if ($what == "testref") {
         return $this->TestRef();
     } else {
         if ($what == "testdates") {
             return $this->testdates();
         } else {
             if ($what == "send_test_email") {
                 return $this->test_email_send();
             } else {
                 if ($what == "save") {
                     $support_autoclose = JRequest::getInt('support_autoclose');
                     $support_autoclose_duration = JRequest::getInt('support_autoclose_duration');
                     $support_autoclose_audit = JRequest::getInt('support_autoclose_audit');
                     $support_autoclose_email = JRequest::getInt('support_autoclose_email');
                     $aparams = "addaudit:{$support_autoclose_audit};emailuser:{$support_autoclose_email};closeinterval:{$support_autoclose_duration};";
                     $qry = "UPDATE #__fss_cron SET params = '" . FSSJ3Helper::getEscaped($db, $aparams) . "', published = {$support_autoclose}, `interval` = 5 WHERE class = 'AutoClose'";
                     $db->setQuery($qry);
                     //echo $qry."<br>";
                     $db->Query();
                     unset($_POST['support_autoclose']);
                     unset($_POST['support_autoclose_duration']);
                     unset($_POST['support_autoclose_audit']);
                     unset($_POST['support_autoclose_email']);
                     $large = FSS_Settings::GetLargeList();
                     $templates = FSS_Settings::GetTemplateList();
                     // save any large settings that arent in the templates list
                     foreach ($large as $setting) {
                         // skip any setting that is in the templates list
                         if (array_key_exists($setting, $templates)) {
                             continue;
                         }
                         //
                         $value = JRequest::getVar($setting, '', 'post', 'string', JREQUEST_ALLOWRAW);
                         $qry = "REPLACE INTO #__fss_settings_big (setting, value) VALUES ('";
                         $qry .= FSSJ3Helper::getEscaped($db, $setting) . "','";
                         $qry .= FSSJ3Helper::getEscaped($db, $value) . "')";
                         $db->setQuery($qry);
                         $db->Query();
                         $qry = "DELETE FROM #__fss_settings WHERE setting = '" . FSSJ3Helper::getEscaped($db, $setting) . "'";
                         $db->setQuery($qry);
                         $db->Query();
                         unset($_POST[$setting]);
                     }
                     $data = JRequest::get('POST', JREQUEST_ALLOWRAW);
                     foreach ($data as $setting => $value) {
                         if (array_key_exists($setting, $settings)) {
                             $settings[$setting] = $value;
                         }
                     }
                     foreach ($settings as $setting => $value) {
                         if (!array_key_exists($setting, $data)) {
                             $settings[$setting] = 0;
                             $value = 0;
                         }
                         // skip any setting that is in the templates list
                         if (array_key_exists($setting, $templates)) {
                             continue;
                         }
                         if (array_key_exists($setting, $large)) {
                             continue;
                         }
                         $qry = "REPLACE INTO #__fss_settings (setting, value) VALUES ('";
                         $qry .= FSSJ3Helper::getEscaped($db, $setting) . "','";
                         $qry .= FSSJ3Helper::getEscaped($db, $value) . "')";
                         $db->setQuery($qry);
                         $db->Query();
                         //echo $qry."<br>";
                     }
                     FSS_Settings::reload();
                     $msg = JText::_("Settings_Saved");
                     $msgtytpe = "message";
                     if (!FSS_CSSParse::ParseStaticFiles()) {
                         $msg = "<p>Freestyle Support Portal cannot write to the following files:</p>";
                         $msg .= "<ul>";
                         foreach (FSS_CSSParse::$failed as $file) {
                             $msg .= "<li>" . $file . "</li>";
                         }
                         $msg .= "</ul>";
                         $msg .= "<p>Without this it may not display correctly on your site.</p>";
                         $msgtytpe = "error";
                     }
                     $link = 'index.php?option=com_fss&view=settings#' . $this->tab;
                     if (JRequest::getVar('task') == "save") {
                         $link = 'index.php?option=com_fss';
                     }
                     //exit;
                     $mainframe = JFactory::getApplication();
                     $mainframe->redirect($link, $msg, $msgtytpe);
                     return;
                 } else {
                     if ($what == "customtemplate") {
                         $this->CustomTemplate();
                         exit;
                     } else {
                         $qry = "SELECT * FROM #__fss_templates WHERE template = 'custom'";
                         $db->setQuery($qry);
                         $rows = $db->loadAssocList();
                         if (count($rows) > 0) {
                             foreach ($rows as $row) {
                                 if ($row['tpltype']) {
                                     $settings['support_list_head'] = $row['value'];
                                 } else {
                                     $settings['support_list_row'] = $row['value'];
                                 }
                             }
                         } else {
                             $settings['support_list_head'] = '';
                             $settings['support_list_row'] = '';
                         }
                         $qry = "SELECT * FROM #__fss_templates WHERE template = 'usercustom'";
                         $db->setQuery($qry);
                         $rows = $db->loadAssocList();
                         if (count($rows) > 0) {
                             foreach ($rows as $row) {
                                 if ($row['tpltype']) {
                                     $settings['support_user_head'] = $row['value'];
                                 } else {
                                     $settings['support_user_row'] = $row['value'];
                                 }
                             }
                         } else {
                             $settings['support_user_head'] = '';
                             $settings['support_user_row'] = '';
                         }
                         // ##NOT_EXT_START##
                         $qry = "SELECT * FROM #__fss_cron WHERE class = 'AutoClose' LIMIT 1";
                         $db->setQuery($qry);
                         $row = $db->loadAssoc();
                         if ($row) {
                             $settings['support_autoclose'] = $row['published'];
                             $aparams = $this->ParseParams($row['params']);
                             $settings['support_autoclose_duration'] = $aparams['closeinterval'];
                             $settings['support_autoclose_audit'] = $aparams['addaudit'];
                             $settings['support_autoclose_email'] = $aparams['emailuser'];
                         }
                         // ##NOT_EXT_END##
                         $document = JFactory::getDocument();
                         $document->addStyleSheet(JURI::root() . 'administrator/components/com_fss/assets/css/js_color_picker_v2.css');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/color_functions.js');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/js_color_picker_v2.js');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/codemirror/codemirror.js');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/codemirror/modes/css/css.js');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/codemirror/modes/javascript/javascript.js');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/codemirror/modes/xml/xml.js');
                         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/codemirror/modes/htmlmixed/htmlmixed.js');
                         $document->addStyleSheet(JURI::root() . 'administrator/components/com_fss/assets/css/codemirror/codemirror.css');
                         $this->settings = $settings;
                         // load languages
                         $lang = JFactory::getLanguage();
                         $lang->load("com_config");
                         JToolBarHelper::title(JText::_("FREESTYLE_SUPPORT_PORTAL") . ' - ' . JText::_("SETTINGS"), 'fss_settings');
                         JToolBarHelper::apply();
                         JToolBarHelper::save();
                         JToolBarHelper::cancel('cancellist');
                         FSSAdminHelper::DoSubToolbar();
                         parent::display($tpl);
                     }
                 }
             }
         }
     }
 }