Пример #1
0
 /**
  * Get or create the theme view
  * @access provate
  * @return object WFView
  */
 private function &getView()
 {
     static $view;
     if (!is_object($view)) {
         // create plugin view
         $view = new WFView(array('base_path' => WF_EDITOR_THEMES . DS . $this->get('theme'), 'template_path' => WF_EDITOR_THEMES . DS . $this->get('theme') . DS . 'tmpl', 'name' => $this->get('dialog'), 'layout' => $this->get('dialog')));
         $view->assign('theme', $this);
     }
     return $view;
 }
Пример #2
0
 /**
  * Get plugin View
  * @access public
  * @return WFView
  */
 public function &getView()
 {
     static $view;
     if (!is_object($view)) {
         // create plugin view
         $view = new WFView(array('base_path' => $this->get('_base_path'), 'template_path' => $this->get('_template_path'), 'name' => $this->get('_name'), 'layout' => $this->get('_layout')));
         $view->assign('plugin', $this);
     }
     return $view;
 }
Пример #3
0
 /**
  * Load a panel view
  * @access  private
  * @param object $layout Layout (panel) name
  * @return panel JView object
  */
 private function loadPanel($panel, $state)
 {
     $view = new WFView(array('name' => $panel, 'layout' => $panel));
     // add tab paths
     foreach ($this->_paths as $path) {
         $view->addTemplatePath($path);
     }
     // assign panel state to view
     $view->assign('state', (int) $state);
     return $view;
 }
Пример #4
0
 /**
  * Render the browser view
  * @access public
  */
 public function render()
 {
     $session = JFactory::getSession();
     $view = new WFView(array('name' => 'browser', 'layout' => 'file'));
     // assign session data
     $view->assign('session', $session);
     // assign form action
     $view->assign('action', $this->getFormAction());
     // return view output
     $view->display();
 }
Пример #5
0
 function addChild(WFView $view)
 {
     if (!$view instanceof WFPassword) {
         throw new WFException("Only WFPassword child views are accepted.");
     }
     if ($this->confirmPasswordId !== NULL) {
         throw new WFException("WFPassword accepts only one child.");
     }
     $this->confirmPasswordId = $view->id();
     $this->setValueForKey(false, 'autocomplete');
     $view->setValueForKey(false, 'autocomplete');
     return parent::addChild($view);
 }
Пример #6
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $client = JRequest::getWord('client', 'admin');
     $model = $this->getModel();
     $this->document->setTitle(WFText::_('WF_PREFERENCES_TITLE'));
     $this->document->addStyleSheet('templates/system/css/system.css');
     $component = WFExtensionHelper::getComponent();
     $xml = JPATH_COMPONENT . '/models/preferences.xml';
     // get params definitions
     $params = new WFParameter($component->params, $xml, 'preferences');
     $params->addElementPath(JPATH_COMPONENT . '/elements');
     if (WFModel::authorize('admin')) {
         $form = $model->getForm('permissions');
     } else {
         $form = null;
     }
     $this->assign('params', $params);
     $this->assign('permissons', $form);
     $this->addStyleSheet('components/com_jce/media/css/preferences.css');
     $this->addScript('components/com_jce/media/js/preferences.js');
     if (JRequest::getInt('close') == 1) {
         $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Preferences.close();});');
     } else {
         $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Preferences.init();});');
     }
     parent::display($tpl);
 }
Пример #7
0
 function display($tpl = null)
 {
     wfimport('admin.models.updates');
     $mainframe = JFactory::getApplication();
     $model = $this->getModel();
     $version = $model->getVersion();
     $component = WFExtensionHelper::getComponent();
     // get params definitions
     $params = new WFParameter($component->params, '', 'preferences');
     $canUpdate = WFModelUpdates::canUpdate() && WFModel::authorize('installer');
     $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE')));
     JHtml::_('behavior.modal');
     $this->addScript('components/com_jce/media/js/cpanel.js');
     $this->addScriptDeclaration('jQuery.jce.Cpanel.options = ' . json_encode($options) . ';');
     // load styles
     $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/cpanel.css');
     if (WFModel::authorize('preferences')) {
         WFToolbarHelper::preferences();
     }
     if (WFModel::authorize('installer')) {
         WFToolbarHelper::updates($canUpdate);
     }
     WFToolbarHelper::help('cpanel.about');
     $views = array('config', 'profiles', 'installer', 'browser', 'mediabox');
     $icons = array();
     foreach ($views as $view) {
         // check if its allowed...
         if (WFModel::authorize($view) === false) {
             continue;
         }
         $attribs = array('target="_self"');
         $title = 'WF_' . strtoupper($view);
         $description = 'WF_' . strtoupper($view) . '_DESC';
         $link = 'index.php?option=com_jce&view=' . $view;
         if ($view == 'browser') {
             $link = WFModel::getBrowserLink();
             $component = WFExtensionHelper::getComponent();
             // get params definitions
             $params = new WFParameter($component->params, '', 'preferences');
             $width = (int) $params->get('browser_width', 790);
             $height = (int) $params->get('browser_height', 560);
             if (empty($link)) {
                 continue;
             }
             $attribs = array('target="_blank"', 'class="browser"', 'onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;"');
             $title = 'WF_' . strtoupper($view) . '_TITLE';
             $description = 'WF_CPANEL_' . strtoupper($view);
         }
         // if its mediabox, check the plugin is installed and enabled
         if ($view == 'mediabox' && !JPluginHelper::isEnabled('system', 'jcemediabox')) {
             continue;
         }
         $icons[] = '<li class="cpanel-icon wf-tooltip" title="' . WFText::_($title) . '::' . WFText::_($description) . '"><a id="wf-browser-link" href="' . $link . '"' . implode(' ', $attribs) . '><span class="' . $view . '"></span>' . WFText::_($title) . '</a></li>';
     }
     $this->assign('icons', $icons);
     $this->assign('model', $model);
     $this->assign('params', $params);
     $this->assign('version', $version);
     parent::display($tpl);
 }
Пример #8
0
 function display($tpl = null)
 {
     $language = JFactory::getLanguage();
     $language->load('plg_editors_jce', JPATH_ADMINISTRATOR);
     $client = JRequest::getWord('client', 'site');
     $model = $this->getModel();
     $plugin = WFExtensionHelper::getPlugin();
     $xml = WF_EDITOR_LIBRARIES . '/xml/config/editor.xml';
     $data = null;
     // get params from editor plugin
     if ($plugin->params && $plugin->params !== "{}") {
         $data = json_decode($plugin->params);
     } else {
         $component = WFExtensionHelper::getComponent();
         // get params from component "params" field (legacy)
         if ($component->params) {
             $data = json_decode($component->params);
         }
     }
     // get params definitions
     $params = new WFParameter($data, $xml, 'editor');
     $params->addElementPath(JPATH_COMPONENT . '/elements');
     $this->assign('model', $model);
     $this->assign('params', $params);
     $this->assign('client', $client);
     WFToolbarHelper::apply();
     WFToolbarHelper::save();
     WFToolbarHelper::help('config.about');
     parent::display($tpl);
 }
Пример #9
0
 function display($tpl = null)
 {
     $model = $this->getModel();
     $this->addScript('components/com_jce/media/js/update.js');
     $options = array('language' => array('check' => WFText::_('WF_UPDATES_CHECK'), 'install' => WFText::_('WF_UPDATES_INSTALL'), 'installed' => WFText::_('WF_UPDATES_INSTALLED'), 'no_updates' => WFText::_('WF_UPDATES_NONE'), 'high' => WFText::_('WF_UPDATES_HIGH'), 'medium' => WFText::_('WF_UPDATES_MEDIUM'), 'low' => WFText::_('WF_UPDATES_LOW'), 'full' => WFText::_('WF_UPDATES_FULL'), 'patch' => WFText::_('WF_UPDATES_PATCH'), 'auth_failed' => WFText::_('WF_UPDATES_AUTH_FAIL'), 'update_info' => WFText::_('WF_UPDATES_INFO'), 'install_info' => WFText::_('WF_UPDATES_INSTALL_INFO'), 'check_updates' => WFText::_('WF_UPDATES_CHECKING'), 'read_more' => WFText::_('WF_UPDATES_READMORE'), 'read_less' => WFText::_('WF_UPDATES_READLESS')));
     $options = json_encode($options);
     $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Update.init(' . $options . ');});');
     // load styles
     $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/updates.css');
     parent::display($tpl);
 }
Пример #10
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $lang = JFactory::getLanguage();
     $lang->load('plg_system_jcemediabox');
     $client = JRequest::getWord('client', 'site');
     $model = $this->getModel();
     $plugin = JPluginHelper::getPlugin('system', 'jcemediabox');
     $params = $this->getParams($plugin->params);
     $this->assign('params', $params);
     $this->assign('client', $client);
     wfimport('admin.models.editor');
     $options = array('stylesheets' => (array) WFModelEditor::getStyleSheets(), 'labels' => array('picker' => WFText::_('WF_COLORPICKER_PICKER'), 'palette' => WFText::_('WF_COLORPICKER_PALETTE'), 'named' => WFText::_('WF_COLORPICKER_NAMED'), 'template' => WFText::_('WF_COLORPICKER_TEMPLATE'), 'color' => WFText::_('WF_COLORPICKER_COLOR'), 'apply' => WFText::_('WF_COLORPICKER_APPLY'), 'name' => WFText::_('WF_COLORPICKER_NAME')), 'parent' => '#jce');
     $this->addScriptDeclaration('jQuery(document).ready(function($){$("input.color").colorpicker(' . json_encode($options) . ');});');
     WFToolbarHelper::apply();
     WFToolbarHelper::save();
     WFToolbarHelper::help('mediabox.config');
     parent::display($tpl);
 }
Пример #11
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $lang = JFactory::getLanguage();
     $lang->load('plg_system_jcemediabox');
     $client = JRequest::getWord('client', 'site');
     $model = $this->getModel();
     $plugin = JPluginHelper::getPlugin('system', 'jcemediabox');
     $params = $this->getParams($plugin->params);
     $this->assignRef('params', $params);
     $this->assignRef('client', $client);
     $this->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/colorpicker.js?version=' . $model->getVersion());
     $this->addStyleSheet('components/com_jce/media/css/colorpicker.css?version=' . $model->getVersion());
     $options = array('template_colors' => WFToolsHelper::getTemplateColors(), 'custom_colors' => '', 'labels' => array('picker' => WFText::_('WF_COLORPICKER_PICKER'), 'palette' => WFText::_('WF_COLORPICKER_PALETTE'), 'named' => WFText::_('WF_COLORPICKER_NAMED'), 'template' => WFText::_('WF_COLORPICKER_TEMPLATE'), 'custom' => WFText::_('WF_COLORPICKER_CUSTOM'), 'color' => WFText::_('WF_COLORPICKER_COLOR'), 'apply' => WFText::_('WF_COLORPICKER_APPLY'), 'name' => WFText::_('WF_COLORPICKER_NAME')));
     $this->addScriptDeclaration('jQuery(document).ready(function($){$("input.color").colorpicker(' . json_encode($options) . ');});');
     WFToolbarHelper::apply();
     WFToolbarHelper::save();
     WFToolbarHelper::help('mediabox.config');
     parent::display($tpl);
 }
Пример #12
0
 function display($tpl = null)
 {
     $model = $this->getModel();
     $language = $model->getLanguage();
     $lang = JFactory::getLanguage();
     $section = JRequest::getWord('section');
     $category = JRequest::getWord('category');
     $article = JRequest::getWord('article');
     $component = JComponentHelper::getComponent('com_jce');
     require_once WF_ADMINISTRATOR . '/classes/parameter.php';
     $params = new WFParameter($component->params);
     $url = $params->get('preferences.help.url', 'http://www.joomlacontenteditor.net');
     $method = $params->get('preferences.help.method', 'reference');
     $pattern = $params->get('preferences.help.pattern', '');
     switch ($method) {
         default:
         case 'reference':
             $url .= '/index.php?option=com_content&view=article&tmpl=component&print=1&mode=inline&task=findkey&lang=' . $language . '&keyref=';
             break;
         case 'xml':
             break;
         case 'sef':
             break;
     }
     $this->assignRef('model', $model);
     $this->assign('orientation', $lang->isRTL() ? 'east' : 'west');
     $key = array();
     if ($section) {
         $key[] = $section;
         if ($category) {
             $key[] = $category;
             if ($article) {
                 $key[] = $article;
             }
         }
     }
     $options = array('url' => $url, 'key' => $key, 'pattern' => $pattern);
     $this->addStyleSheet(JURI::root(true) . '/components/com_jce/editor/libraries/css/help.css');
     $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Help.init(' . json_encode($options) . ');});');
     parent::display($tpl);
 }
Пример #13
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $language = JFactory::getLanguage();
     $language->load('plg_editors_jce', JPATH_ADMINISTRATOR);
     $client = JRequest::getWord('client', 'site');
     $model = $this->getModel();
     $lists = array();
     $component = WFExtensionHelper::getComponent();
     $xml = WF_EDITOR_LIBRARIES . '/xml/config/editor.xml';
     // get params definitions
     $params = new WFParameter($component->params, $xml, 'editor');
     $params->addElementPath(JPATH_COMPONENT . '/elements');
     $this->assignRef('model', $model);
     $this->assignRef('params', $params);
     $this->assignRef('client', $client);
     WFToolbarHelper::apply();
     WFToolbarHelper::save();
     WFToolbarHelper::help('config.about');
     parent::display($tpl);
 }
Пример #14
0
 function display($tpl = null)
 {
     wfimport('admin.models.updates');
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $state = $model->getState();
     $layout = JRequest::getWord('layout', 'install');
     $plugins = '';
     $extensions = '';
     $languages = '';
     JHtml::_('behavior.modal');
     if (WFModel::authorize('uninstall')) {
         WFToolbarHelper::deleteList('', 'remove', 'WF_INSTALLER_UNINSTALL');
     }
     WFToolbarHelper::updates(WFModelUpdates::canUpdate());
     WFToolbarHelper::help('installer.about');
     $options = array('extensions' => array('zip', 'tar', 'gz', 'gzip', 'tgz', 'tbz2', 'bz2', 'bzip2'), 'width' => 300, 'button' => 'install_button', 'task' => 'install', 'iframe' => false, 'labels' => array('browse' => WFText::_('WF_LABEL_BROWSE'), 'alert' => WFText::_('WF_INSTALLER_FILETYPE_ERROR')));
     $this->addScript('components/com_jce/media/js/installer.js');
     $this->addScript('components/com_jce/media/js/uploads.js');
     $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Installer.init(' . json_encode($options) . ');});');
     // load styles
     $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/installer.css');
     $state->set('install.directory', $app->getCfg('tmp_path'));
     $plugins = $model->getPlugins();
     $extensions = $model->getExtensions();
     $languages = $model->getLanguages();
     $related = $model->getRelated();
     $this->assign('plugins', $plugins);
     $this->assign('extensions', $extensions);
     $this->assign('languages', $languages);
     $this->assign('related', $related);
     $result = $state->get('install.result');
     $this->assign('showMessage', count($result));
     $this->assign('model', $model);
     $this->assign('state', $state);
     $ftp = JClientHelper::setCredentialsFromRequest('ftp');
     $this->assign('ftp', $ftp);
     $this->setLayout($layout);
     parent::display($tpl);
 }
Пример #15
0
 public static function exposedProperties()
 {
     $items = parent::exposedProperties();
     return array_merge($items, array('paginator'));
 }
Пример #16
0
 public function getPopupTemplates()
 {
     $output = '';
     $path = WF_EDITOR_EXTENSIONS . '/popups';
     $file = 'default.php';
     foreach ($this->getTemplates() as $template) {
         $wf = WFEditorPlugin::getInstance();
         $view = $wf->getView();
         $output .= $view->loadTemplate($template);
     }
     foreach ($this->getPopups() as $popup) {
         $view = new WFView(array('name' => $popup, 'base_path' => WF_EDITOR_EXTENSIONS . '/popups/' . $popup, 'template_path' => WF_EDITOR_EXTENSIONS . '/popups/' . $popup . '/tmpl'));
         $instance = $this->getPopupExtension($popup);
         $view->assign('popup', $instance);
         if (file_exists($path . '/' . $popup . '/tmpl/' . $file)) {
             ob_start();
             $output .= '<div id="popup_extension_' . $popup . '" style="display:none;">';
             $view->display();
             $output .= ob_get_contents();
             $output .= '</div>';
             ob_end_clean();
         }
     }
     return $output;
 }
Пример #17
0
 function execute()
 {
     if (JRequest::getVar('json', '', 'POST', 'STRING', 2) || JRequest::getCmd('action') == 'upload') {
         $this->processXHR();
     } else {
         $this->display();
         $document =& WFDocument::getInstance();
         $document->pack();
         // create plugin view
         $view = new WFView(array('base_path' => $this->get('base_path'), 'template_path' => $this->get('template_path'), 'name' => 'link', 'layout' => $this->get('layout')));
         $view->assign('plugin', $this);
         // set body output
         $document->setBody($view->loadTemplate());
         $document->render();
     }
 }
Пример #18
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $client = 'admin';
     $view = JRequest::getWord('view');
     $db = JFactory::getDBO();
     $currentUser = JFactory::getUser();
     $acl = JFactory::getACL();
     $model = $this->getModel();
     $this->addScript('components/com_jce/media/js/users.js');
     $filter_order = $app->getUserStateFromRequest("{$option}.{$view}.filter_order", 'filter_order', 'a.name', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest("{$option}.{$view}.filter_order_Dir", 'filter_order_Dir', '', 'word');
     $filter_type = $app->getUserStateFromRequest("{$option}.{$view}.filter_type", 'filter_type', '', 'int');
     $search = $app->getUserStateFromRequest("{$option}.{$view}.search", 'search', '', 'cmd');
     $search = JString::strtolower($search);
     $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = $app->getUserStateFromRequest("{$option}.{$view}.limitstart", 'limitstart', 0, 'int');
     $where = array();
     if (!empty($search)) {
         if (defined('JPATH_PLATFORM')) {
             $quoted = $db->quote('%' . $search . '%', false);
         } else {
             $quoted = $db->Quote('%' . $search . '%', false);
         }
         $where[] = 'a.username LIKE ' . $quoted . ' OR a.email LIKE ' . $quoted . ' OR a.name LIKE ' . $quoted;
     }
     if (defined('JPATH_PLATFORM')) {
         if ($filter_type) {
             $where[] = 'map.group_id = LOWER(' . $db->Quote($filter_type) . ') ';
         }
     } else {
         if ($filter_type) {
             $where[] = 'a.gid =' . (int) $filter_type;
         }
         // exclude any child group id's for this user
         $pgids = $acl->get_group_children($currentUser->get('gid'), 'ARO', 'RECURSE');
         if (is_array($pgids) && count($pgids) > 0) {
             JArrayHelper::toInteger($pgids);
             $where[] = 'a.gid NOT IN (' . implode(',', $pgids) . ')';
         }
         // Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
         $where[] = 'a.gid NOT IN (17,28,29,30)';
     }
     // Only unblocked users
     $where[] = 'a.block = 0';
     $orderby = array($filter_order, $filter_order_Dir);
     jimport('joomla.html.pagination');
     if (defined('JPATH_PLATFORM')) {
         $query = $db->getQuery(true);
         $query->select('COUNT(a.id)')->from('#__users AS a')->join('LEFT', '#__user_usergroup_map AS map ON map.user_id = a.id');
         if (count($where)) {
             $query->where($where);
         }
         $db->setQuery($query);
         $total = $db->loadResult();
         $pagination = new JPagination($total, $limitstart, $limit);
         $query = $db->getQuery(true);
         $query->select('a.id, a.name, a.username, g.title AS groupname');
         $query->from('#__users AS a');
         $query->join('LEFT', '#__user_usergroup_map AS map ON map.user_id = a.id');
         $query->join('LEFT', '#__usergroups AS g ON g.id = map.group_id');
         if (count($where)) {
             $query->where($where);
         }
         $query->group('a.id, a.name, a.username, g.title');
         $query->order(trim(implode(' ', $orderby)));
     } else {
         $query = 'SELECT COUNT(a.id)' . ' FROM #__users AS a' . $where;
         $db->setQuery($query);
         $total = $db->loadResult();
         $pagination = new JPagination($total, $limitstart, $limit);
         $query = 'SELECT a.id, a.name, a.username, g.name AS groupname' . ' FROM #__users AS a' . ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id' . ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' . ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id' . (count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '') . ' GROUP BY a.id, a.name, a.username, g.name' . ' ORDER BY ' . trim(implode(' ', $orderby));
     }
     $db->setQuery($query, $pagination->limitstart, $pagination->limit);
     $rows = $db->loadObjectList();
     $options = array(JHTML::_('select.option', '', '- ' . WFText::_('WF_USERS_GROUP_SELECT') . ' -'));
     if (defined('JPATH_PLATFORM')) {
         $query = $db->getQuery(true);
         $query->select('a.id AS value, a.title AS text')->from('#__usergroups AS a');
         // Add the level in the tree.
         $query->select('COUNT(DISTINCT b.id) AS level');
         $query->join('LEFT OUTER', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt');
         $query->group('a.id, a.lft, a.rgt, a.parent_id, a.title');
         $query->order('a.lft ASC');
         // Get the options.
         $db->setQuery($query);
         $items = $db->loadObjectList() or die($db->stdErr());
         // Pad the option text with spaces using depth level as a multiplier.
         for ($i = 0, $n = count($items); $i < $n; $i++) {
             $options[] = JHTML::_('select.option', $items[$i]->value, str_repeat('- ', $items[$i]->level) . $items[$i]->text);
         }
     } else {
         // get list of Groups for dropdown filter
         $query = 'SELECT id AS value, name AS text' . ' FROM #__core_acl_aro_groups' . ' WHERE id NOT IN (17,28,29,30)';
         $db->setQuery($query);
         $items = $db->loadObjectList();
         $i = '-';
         //$options[] = JHTML::_('select.option', '0', WFText::_('Guest'));
         foreach ($items as $item) {
             $options[] = JHTML::_('select.option', $item->value, $i . WFText::_($item->text));
             $i .= '-';
         }
     }
     $lists['group'] = JHTML::_('select.genericlist', $options, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', (int) $filter_type);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assign('user', JFactory::getUser());
     $this->assign('lists', $lists);
     $this->assign('items', $rows);
     $this->assign('pagination', $pagination);
     $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/users.css');
     parent::display($tpl);
 }
Пример #19
0
 /**
  * Add a child view to this view.
  *
  * @param object A WFView object to add.
  */
 function addChild(WFView $view)
 {
     $this->children[$view->id()] = $view;
     $view->setParent($this);
 }
Пример #20
0
 /**
  *  To implement our prototype functionality, we need to detect when a child object named "<id>Prototype" has been added.
  *
  *  If a prototype object is detected, we set up the prototype for the WFDynamic.
  *
  *  @param object WFView The object being added.
  */
 function addChild(WFView $view)
 {
     if ($view->id() == "{$this->id}Prototype") {
         $this->setPrototype($view);
     } else {
         // add new view to the "parentView" object
         $parentView = $this->calculateParent();
         if ($parentView) {
             $parentView->addChild($view);
         } else {
             parent::addChild($view);
         }
     }
 }
Пример #21
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $acl = JFactory::getACL();
     $client = 'admin';
     $view = JRequest::getWord('view');
     $task = JRequest::getWord('task');
     $option = JRequest::getWord('option');
     $lists = array();
     $model = $this->getModel();
     switch ($task) {
         default:
         case 'publish':
         case 'unpublish':
         case 'remove':
         case 'save':
         case 'copy':
             $filter_order = $app->getUserStateFromRequest("{$option}.{$view}.filter_order", 'filter_order', 'p.ordering', 'cmd');
             $filter_order_Dir = $app->getUserStateFromRequest("{$option}.{$view}.filter_order_Dir", 'filter_order_Dir', '', 'word');
             $filter_state = $app->getUserStateFromRequest("{$option}.{$view}.filter_state", 'filter_state', '', 'word');
             $search = $app->getUserStateFromRequest("{$option}.{$view}.search", 'search', '', 'cmd');
             $search = JString::strtolower($search);
             $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
             $limitstart = $app->getUserStateFromRequest("{$option}.{$view}.limitstart", 'limitstart', 0, 'int');
             $where = array();
             if ($search) {
                 $where[] = 'LOWER( p.name ) LIKE ' . $db->Quote('%' . method_exists($db, 'escape') ? $db->escape($search, true) : $db->getEscaped($search, true) . '%', false);
             }
             if ($filter_state) {
                 if ($filter_state == 'P') {
                     $where[] = 'p.published = 1';
                 } else {
                     if ($filter_state == 'U') {
                         $where[] = 'p.published = 0';
                     }
                 }
             }
             $order = array($filter_order, $filter_order_Dir);
             // get the total number of records
             $query = $db->getQuery(true);
             if (is_object($query)) {
                 $query->select('COUNT(p.id)')->from('#__wf_profiles AS p');
                 if (count($where)) {
                     $query->where($where);
                 }
             } else {
                 $query = 'SELECT COUNT(p.id)' . ' FROM #__wf_profiles AS p' . (count($where) ? ' WHERE ' . implode(' AND ', $where) : '');
             }
             $db->setQuery($query);
             $total = $db->loadResult();
             jimport('joomla.html.pagination');
             $pagination = new JPagination($total, $limitstart, $limit);
             $query = $db->getQuery(true);
             if (is_object($query)) {
                 $query->select('p.*, u.name AS editor')->from('#__wf_profiles AS p')->join('LEFT', '#__users AS u ON u.id = p.checked_out');
                 if (count($where)) {
                     $query->where($where);
                 }
                 $query->order(trim(implode(' ', $order)));
             } else {
                 $query = 'SELECT p.*, u.name AS editor' . ' FROM #__wf_profiles AS p' . ' LEFT JOIN #__users AS u ON u.id = p.checked_out' . (count($where) ? ' WHERE ' . implode(' AND ', $where) : '') . ' ORDER BY ' . trim(implode(' ', $order));
             }
             $db->setQuery($query, $pagination->limitstart, $pagination->limit);
             $rows = $db->loadObjectList();
             if ($db->getErrorNum()) {
                 echo $db->stderr();
                 return false;
             }
             // table ordering
             $lists['order_Dir'] = $filter_order_Dir;
             $lists['order'] = $filter_order;
             // search filter
             $lists['search'] = $search;
             $this->assignRef('user', $user);
             $this->assignRef('lists', $lists);
             $this->assignRef('rows', $rows);
             $this->assignRef('pagination', $pagination);
             //JToolBarHelper::title(WFText::_('WF_PROFILES_TITLE').' : '.WFText::_('WF_PROFILES_LIST'), 'profiles.png' );
             WFToolbarHelper::addNewX();
             WFToolbarHelper::editListX();
             WFToolbarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'WF_PROFILES_COPY', true);
             WFToolbarHelper::export();
             if (count($rows) > 1) {
                 WFToolbarHelper::publishList();
                 WFToolbarHelper::unpublishList();
                 WFToolbarHelper::deleteList('', 'remove', 'WF_PROFILES_DELETE');
             }
             WFToolbarHelper::help('profiles.about');
             $options = array('button' => '#upload_button', 'task' => 'import', 'labels' => array('browse' => WFText::_('WF_LABEL_BROWSE'), 'alert' => WFText::_('WF_PROFILES_IMPORT_BROWSE_ERROR')));
             $this->addScript(JURI::root(true) . '/administrator/components/com_jce/media/js/uploads.js?version=' . $model->getVersion());
             $this->addScriptDeclaration('jQuery(document).ready(function($){$(\'input[type="file"]\').upload(' . json_encode($options) . ')});');
             // load styles
             $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/upload.css');
             $this->setLayout('default');
             break;
         case 'apply':
         case 'add':
         case 'edit':
             JHtml::_('behavior.modal');
             // Load media
             $scripts = array('profiles.js', 'extensions.js', 'checklist.js', 'parameter.js');
             // Load scripts
             foreach ($scripts as $script) {
                 $this->addScript(JURI::root(true) . '/administrator/components/com_jce/media/js/' . $script . '?version=' . $model->getVersion());
             }
             $this->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/colorpicker.js?version=' . $model->getVersion());
             $this->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/select.js?version=' . $model->getVersion());
             // load styles
             $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/profiles.css');
             $cid = JRequest::getVar('cid', array(0), '', 'array');
             JArrayHelper::toInteger($cid, array(0));
             $lists = array();
             $row = JTable::getInstance('profiles', 'WFTable');
             // load the row from the db table
             $row->load($cid[0]);
             // fail if checked out not by 'me'
             if ($row->isCheckedOut($user->get('id'))) {
                 $msg = JText::sprintf('WF_PROFILES_CHECKED_OUT', $row->name);
                 $this->setRedirect('index.php?option=' . $option . '&view=profiles', $msg, 'error');
                 return false;
             }
             // Load editor params
             $component = JComponentHelper::getComponent('com_jce');
             // Load Language
             $language = JFactory::getLanguage();
             $language->load('com_jce', JPATH_ADMINISTRATOR);
             $language->load('com_jce', JPATH_SITE);
             $language->load('plg_editors_jce', JPATH_ADMINISTRATOR);
             $plugins = $model->getPlugins();
             // load plugin languages
             foreach ($plugins as $plugin) {
                 if ($plugin->core == 0) {
                     // Load Language for plugin
                     $language->load('com_jce_' . $plugin->name, JPATH_SITE);
                 }
             }
             // load the row from the db table
             if ($cid[0]) {
                 $row->checkout($user->get('id'));
             } else {
                 $query = $db->getQuery(true);
                 if (is_object($query)) {
                     $query->select('COUNT(id)')->from('#__wf_profiles');
                 } else {
                     $query = 'SELECT COUNT(id)' . ' FROM #__wf_profiles';
                 }
                 $db->setQuery($query);
                 $total = $db->loadResult();
                 // get the defaults from xml
                 $row = $model->getDefaultProfile();
                 if (!is_object($row)) {
                     $row->name = '';
                     $row->description = '';
                     $row->types = '';
                     $row->components = '';
                     $row->area = 0;
                     $row->types = '';
                     $row->rows = '';
                     $row->plugins = '';
                     $row->published = 1;
                     $row->ordering = 0;
                     $row->params = '{}';
                 }
                 $row->params = json_decode($row->params . ',' . $component->params);
             }
             $row->area = isset($row->area) ? $row->area : 0;
             $query = $db->getQuery(true);
             if (is_object($query)) {
                 $query->select('ordering AS value, name AS text')->from('#__wf_profiles')->where(array('published = 1', 'ordering > -10000', 'ordering < 10000'))->order('ordering');
             } else {
                 // build the html select list for ordering
                 $query = 'SELECT ordering AS value, name AS text' . ' FROM #__wf_profiles' . ' WHERE published = 1' . ' AND ordering > -10000' . ' AND ordering < 10000' . ' ORDER BY ordering';
             }
             $order = JHTML::_('list.genericordering', $query);
             $lists['ordering'] = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
             $lists['published'] = '';
             $options = array(1 => WFText::_('WF_OPTION_YES'), 0 => WFTEXT::_('WF_OPTION_NO'));
             foreach ($options as $value => $text) {
                 $checked = '';
                 if ($value == $row->published) {
                     $checked = ' checked="checked"';
                 }
                 $lists['published'] .= '<label class="radio inline"><input type="radio" id="published-' . $value . '" name="published" value="' . $value . '"' . $checked . ' />' . $text . '</label>';
             }
             $exclude = array('com_admin', 'com_cache', 'com_checkin', 'com_config', 'com_cpanel', 'com_finder', 'com_installer', 'com_languages', 'com_jce', 'com_login', 'com_menus', 'com_media', 'com_messages', 'com_newsfeeds', 'com_plugins', 'com_redirect', 'com_templates', 'com_users', 'com_wrapper', 'com_search', 'com_user', 'com_updates');
             $query = $db->getQuery(true);
             if (is_object($query)) {
                 $query->select('element AS value, name AS text')->from('#__extensions')->where(array('type = ' . $db->Quote('component'), 'client_id = 1', 'enabled = 1'))->order('name');
             } else {
                 $query = "SELECT `option` AS value, name AS text" . " FROM #__components" . " WHERE parent = 0" . " AND enabled = 1" . " ORDER BY name";
             }
             $db->setQuery($query);
             $components = $db->loadObjectList();
             $options = array();
             // load component languages
             for ($i = 0; $i < count($components); $i++) {
                 if (!in_array($components[$i]->value, $exclude)) {
                     $options[] = $components[$i];
                     // load system language file
                     $language->load($components[$i]->value . '.sys', JPATH_ADMINISTRATOR);
                 }
             }
             // set disabled attribute
             $disabled = !$row->components ? ' disabled="disabled"' : '';
             // components list
             $lists['components'] = '<ul id="components" class="checkbox-list">';
             foreach ($options as $option) {
                 $checked = in_array($option->value, explode(',', $row->components)) ? ' checked="checked"' : '';
                 $lists['components'] .= '<li><input type="checkbox" name="components[]" value="' . $option->value . '"' . $checked . $disabled . ' /><label class="checkbox">' . JText::_($option->text) . '</label></li>';
             }
             $lists['components'] .= '</ul>';
             // components select
             $options = array('all' => WFText::_('WF_PROFILES_COMPONENTS_ALL'), 'select' => WFText::_('WF_PROFILES_COMPONENTS_SELECT'));
             $lists['components-select'] = '';
             foreach ($options as $value => $text) {
                 $checked = '';
                 if ($row->components) {
                     if ($value == 'select') {
                         $checked = ' checked="checked"';
                     }
                 } else {
                     if ($value == 'all') {
                         $checked = ' checked="checked"';
                     }
                 }
                 $lists['components-select'] .= '<label class="radio inline"><input type="radio" id="components-select-' . $value . '" name="components-select" value="' . $value . '"' . $checked . ' />' . $text . '</label>';
             }
             // area
             $options = array(1 => WFText::_('WF_PROFILES_AREA_FRONTEND'), 2 => WFText::_('WF_PROFILES_AREA_BACKEND'));
             $lists['area'] = '';
             foreach ($options as $value => $text) {
                 $checked = '';
                 if (!isset($row->area) || empty($row->area) || in_array($value, explode(',', $row->area))) {
                     $checked = ' checked="checked"';
                 }
                 $lists['area'] .= '<label class="checkbox inline"><input type="checkbox" name="area[]" value="' . $value . '"' . $checked . ' />' . $text . '</label>';
             }
             // device
             $options = array('desktop' => WFText::_('WF_PROFILES_DEVICE_DESKTOP'), 'tablet' => WFText::_('WF_PROFILES_DEVICE_TABLET'), 'phone' => WFText::_('WF_PROFILES_DEVICE_PHONE'));
             $lists['device'] = '<div class="">';
             foreach ($options as $value => $text) {
                 $checked = '';
                 if (!isset($row->device) || empty($row->device) || in_array($value, explode(',', $row->device))) {
                     $checked = ' checked="checked"';
                 }
                 $lists['device'] .= '<label class="checkbox inline"><input type="checkbox" name="device[]" value="' . $value . '"' . $checked . ' />' . $text . '</label>';
             }
             $lists['device'] .= '</div>';
             // user types from profile
             $query = $db->getQuery(true);
             if (is_object($query)) {
                 $query->select('types')->from('#__wf_profiles')->where('id NOT IN (17,28,29,30)');
             } else {
                 $query = 'SELECT types' . ' FROM #__wf_profiles' . ' WHERE id NOT IN (17,28,29,30)';
             }
             $db->setQuery($query);
             $types = $db->loadResultArray();
             if (defined('JPATH_PLATFORM')) {
                 $options = array();
                 $query = $db->getQuery(true);
                 $query->select('a.id AS value, a.title AS text')->from('#__usergroups AS a');
                 // Add the level in the tree.
                 $query->select('COUNT(DISTINCT b.id) AS level');
                 $query->join('LEFT OUTER', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt');
                 $query->group('a.id, a.lft, a.rgt, a.parent_id, a.title');
                 $query->order('a.lft ASC');
                 // Get the options.
                 $db->setQuery($query);
                 $options = $db->loadObjectList() or die($db->stdErr());
                 // Pad the option text with spaces using depth level as a multiplier.
                 for ($i = 0, $n = count($options); $i < $n; $i++) {
                     $options[$i]->text = str_repeat('<span class="gi">|&mdash;</span>', $options[$i]->level) . $options[$i]->text;
                 }
             } else {
                 // get list of Groups for dropdown filter
                 $query = 'SELECT id AS value, name AS text' . ' FROM #__core_acl_aro_groups' . ' WHERE id NOT IN (17,28,29,30)';
                 $db->setQuery($query);
                 $types = $db->loadObjectList();
                 $i = '-';
                 $options = array(JHTML::_('select.option', '0', WFText::_('Guest')));
                 foreach ($types as $type) {
                     $options[] = JHTML::_('select.option', $type->value, $i . WFText::_($type->text));
                     $i .= '|&mdash;';
                 }
             }
             $lists['usergroups'] = '<ul id="user-groups" class="checkbox-list">';
             foreach ($options as $option) {
                 $checked = in_array($option->value, explode(',', $row->types)) ? ' checked="checked"' : '';
                 $lists['usergroups'] .= '<li><input type="checkbox" name="usergroups[]" value="' . $option->value . '"' . $checked . ' /><label class="checkbox">' . $option->text . '</label></li>';
             }
             $lists['usergroups'] .= '</ul>';
             // users
             $options = array();
             if ($row->id && $row->users) {
                 $query = $db->getQuery(true);
                 if (is_object($query)) {
                     $query->select('id AS value, username AS text')->from('#__users')->where('id IN (' . $row->users . ')');
                 } else {
                     $query = 'SELECT id as value, username as text' . ' FROM #__users' . ' WHERE id IN (' . $row->users . ')';
                 }
                 $db->setQuery($query);
                 $gusers = $db->loadObjectList();
                 if ($gusers) {
                     foreach ($gusers as $guser) {
                         $options[] = JHTML::_('select.option', $guser->value, $guser->text);
                     }
                 }
             }
             $lists['users'] = '<ul id="users" class="users-list">';
             foreach ($options as $option) {
                 $lists['users'] .= '<li><input type="hidden" name="users[]" value="' . $option->value . '" /><label><span class="users-list-delete"></span>' . $option->text . '</label></li>';
             }
             $lists['users'] .= '</ul>';
             // Get layout rows
             $rows = $model->getRowArray($row->rows);
             // assign params to row
             $model->getEditorParams($row);
             $model->getLayoutParams($row);
             // create $params object for "editor"
             $params = new WFParameter($row->params, '', 'editor');
             // load other theme css
             foreach ($model->getThemes() as $theme) {
                 $files = JFolder::files($theme, 'ui([\\w\\.]*)\\.css$');
                 foreach ($files as $file) {
                     $this->addStyleSheet(JURI::root(true) . '/components/com_jce/editor/tiny_mce/themes/advanced/skins/' . basename($theme) . '/' . $file);
                 }
             }
             // assign references
             $this->assignRef('lists', $lists);
             $this->assignRef('profile', $row);
             $this->assignRef('rows', $rows);
             $this->assignRef('params', $params);
             $this->assignRef('plugins', $plugins);
             $options = WFToolsHelper::getOptions($params);
             //$this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Profiles.init(' . json_encode($options) . ')});');
             $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Profiles.init(' . json_encode($options) . ')});');
             // set toolbar
             if ($row->id) {
                 JToolBarHelper::title(WFText::_('WF_ADMINISTRATION') . ' :: ' . WFText::_('WF_PROFILES_EDIT') . ' - [' . $row->name . ']', 'logo.png');
             } else {
                 JToolBarHelper::title(WFText::_('WF_ADMINISTRATION') . ' :: ' . WFText::_('WF_PROFILES_NEW'), 'logo.png');
             }
             // set buttons
             WFToolbarHelper::apply();
             WFToolbarHelper::save();
             WFToolbarHelper::cancel('cancelEdit', 'Close');
             WFToolbarHelper::help('profiles.edit');
             JRequest::setVar('hidemainmenu', 1);
             $this->setLayout('form');
             break;
     }
     $this->assignRef('model', $model);
     parent::display($tpl);
 }
Пример #22
0
 public static function exposedProperties()
 {
     $items = parent::exposedProperties();
     return array_merge($items, array('value', 'formatter', 'hidden', 'class'));
 }