Example #1
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);
 }
Example #2
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $attributes = array();
     foreach ($node->attributes() as $k => $v) {
         if ($v != '') {
             $attributes[$k] = (string) $v;
         }
     }
     /*
      * Required to avoid a cycle of encoding &
      * html_entity_decode was used in place of htmlspecialchars_decode because
      * htmlspecialchars_decode is not compatible with PHP 4
      */
     $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES);
     $attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area';
     $control = $control_name . '[' . $name . ']';
     $html = '';
     $attributes['value'] = $value;
     $attributes['type'] = 'text';
     $attributes['name'] = $control;
     $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name);
     // pattern data attribute for editable select input box
     if ((string) $node->attributes()->parent) {
         $prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name);
         $items = array();
         foreach (explode(';', (string) $node->attributes()->parent) as $item) {
             $items[] = $prefix . $item;
         }
         $attributes['data-parent'] = implode(';', $items);
     }
     $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : '';
     $html .= '<input';
     foreach ($attributes as $k => $v) {
         if (!in_array($k, array('default', 'label', 'description'))) {
             $html .= ' ' . $k . ' = "' . $v . '"';
         }
     }
     $html .= ' />';
     $component = WFExtensionHelper::getComponent();
     // get params definitions
     $params = new WFParameter($component->params, '', 'preferences');
     $width = (int) $params->get('browser_width', 780);
     $height = (int) $params->get('browser_height', 560);
     wfimport('admin.models.model');
     $model = new WFModel();
     $link = $model->getBrowserLink($attributes['id'], $filter);
     $html .= '<a href="' . $link . '" id="' . $attributes['id'] . '_browser' . '" class="browser" target="_blank" onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>';
     return $html;
 }
Example #3
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $attributes = array();
     foreach ($node->attributes() as $k => $v) {
         if ($v != '') {
             $attributes[$k] = (string) $v;
         }
     }
     /*
      * Required to avoid a cycle of encoding &
      * html_entity_decode was used in place of htmlspecialchars_decode because
      * htmlspecialchars_decode is not compatible with PHP 4
      */
     $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES);
     $attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area';
     $control = $control_name . '[' . $name . ']';
     $html = '';
     $attributes['value'] = $value;
     $attributes['type'] = 'text';
     $attributes['name'] = $control;
     $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name);
     // pattern data attribute for editable select input box
     if ((string) $node->attributes()->parent) {
         $prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name);
         $items = array();
         foreach (explode(';', (string) $node->attributes()->parent) as $item) {
             $items[] = $prefix . $item;
         }
         $attributes['data-parent'] = implode(';', $items);
     }
     $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : '';
     $html .= '<input';
     foreach ($attributes as $k => $v) {
         if (!in_array($k, array('default', 'label', 'description'))) {
             $html .= ' ' . $k . ' = "' . $v . '"';
         }
     }
     $html .= ' />';
     $options = array('width' => 780, 'height' => 560, 'modal' => true, 'id' => $attributes['id'] . '_browser');
     wfimport('admin.models.model');
     $model = new WFModel();
     $html .= '<a href="' . $model->getBrowserLink($attributes['id'], $filter) . '" class="dialog browser" target="_blank" data-options="' . str_replace('"', "'", json_encode($options)) . '" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>';
     return $html;
 }
Example #4
0
 public static function getBrowserLink($element = null, $filter = '')
 {
     require_once dirname(dirname(__FILE__)) . '/models/model.php';
     $model = new WFModel();
     return $model->getBrowserLink($element, $filter);
 }