Ejemplo n.º 1
0
    function display($tpl = null)
    {
        $db = & JFactory::getDBO();

        $lang = & JFactory::getLanguage();
        $lang->load('plg_editors_jce', JPATH_SITE);

        $client = JRequest::getWord('client', 'site');

        $lists = array ();
        $row = & JTable::getInstance('plugin');

        $query = 'SELECT id'
        .' FROM #__plugins'
        .' WHERE element = "jce"'
        ;
        $db->setQuery($query);
        $id = $db->loadResult();

        // load the row from the db table
        $row->load(intval($id));

        $xml = JCE_LIBRARIES.DS.'xml'.DS.'config'.DS.'config.xml';
        if (!file_exists($xml)) {
        	$xml = JPATH_PLUGINS.DS.'editors'.DS.'jce.xml';
        }

        // get params definitions
        $params = new JParameter($row->params, $xml);
        $params->addElementPath(JPATH_COMPONENT.DS.'elements');
        $this->assignRef('params', $params);
        $this->assignRef('client', $client);

        parent::display($tpl);
    }
Ejemplo n.º 2
0
 /**
  * Renders a form using an xml path
  *
  * @param  array $config
  * @return void
  */
 public function getParameters($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('data' => array(), 'element_paths' => array(dirname(__FILE__) . '/forms')));
     $content = file_exists($config->path) ? file_get_contents($config->path) : '';
     $paths = array();
     //replace all the addpath="{KServiceIdentifier}" with real path
     if (preg_match_all('/addpath="([^"]+)"/', $content, $paths)) {
         $replaces = array();
         foreach ($paths[1] as $path) {
             if (strpos($path, '.')) {
                 $replaces[] = str_replace(JPATH_ROOT . '/', '', dirname(KLoader::path($path . '.dummy')));
             } else {
                 $replaces[] = $path;
             }
         }
         $content = str_replace($paths[1], $replaces, $content);
     }
     $xml =& JFactory::getXMLParser('Simple');
     $parameter = new JParameter('');
     $data = KConfig::unbox($config->data);
     if ($data instanceof JParameter) {
         $data = $data->toArray();
     }
     if (is_array($data)) {
         $parameter->loadArray($data);
     } else {
         $parameter->loadINI($data);
     }
     $parameter->template_data = $config->template_data;
     foreach ($config->element_paths as $path) {
         $parameter->addElementPath($path);
     }
     if ($xml->loadString($content)) {
         if ($params =& $xml->document->params) {
             foreach ($params as $param) {
                 $parameter->setXML($param);
             }
         }
     }
     return $parameter;
 }
Ejemplo n.º 3
0
 function getGeneralForm($workflow)
 {
     $form = new JParameter('');
     $form->addElementPath(JWF_BACKEND_PATH . DS . 'elements');
     $form->loadSetupFile(JPATH_COMPONENT . DS . 'models' . DS . 'workflow.xml');
     $jsOutput = '';
     if ($workflow != null) {
         $form->bind($workflow);
         $jsOutput = JHTML::_('jwf.startJSBlock', 2);
         $jsOutput .= JHTML::_('jwf.indentedLine', 'adminGroupId =' . $workflow->admin_gid . ';', 2);
         $jsOutput .= JHTML::_('jwf.indentedLine', 'window.addEvent("load",function(){', 3);
         $jsOutput .= JHTML::_('jwf.indentedLine', 'var s;', 4);
         $jsOutput .= JHTML::_('jwf.indentedLine', 'var tempHook;', 4);
         foreach ($workflow->stations as $s) {
             $s->activeHooks = unserialize(base64_decode($s->activeHooks));
             $jsOutput .= JHTML::_('jwf.indentedLine', "s = new Object();", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.id    = {$s->id};", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.title = '{$s->title}';", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.task  = '{$s->task}';", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.allocatedTime = {$s->allocatedTime};", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.acl   =  {id:{$s->group},name:aclLists['" . $workflow->acl . "'][{$s->group}]};", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.fields= '{$s->fields}';", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.activeValidations= '{$s->activeValidations}';", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "s.activeHooks = new Array();", 4);
             $jsOutput .= JHTML::_('jwf.indentedLine', "tempHook = new Object();", 4);
             foreach ($s->activeHooks as $hookName => $hookData) {
                 $parameters = JArrayHelper::fromObject($hookData);
                 foreach ($parameters as $key => $value) {
                     $value = addslashes($value);
                     $value = str_replace("\r\n", "\n", $value);
                     $value = str_replace("\n", '\\n', $value);
                     $jsOutput .= JHTML::_('jwf.indentedLine', "tempHook.{$key} = '{$value}';", 4);
                 }
                 $jsOutput .= JHTML::_('jwf.indentedLine', "s.activeHooks['{$hookName}'] = tempHook;", 4);
             }
             $jsOutput .= JHTML::_('jwf.indentedLine', "addElement(s);", 4);
         }
         $jsOutput .= JHTML::_('jwf.indentedLine', '});', 3);
         $jsOutput .= JHTML::_('jwf.endJSBlock', 2);
     }
     return $jsOutput . $form->render('params');
 }
Ejemplo n.º 4
0
	function fetchElement($name, $value, &$node, $control_name)
	{
		$parent =& $this->_parent;

		$childParameter = new JParameter($parent->_raw);
		$paths = $parent->_elementPath;
		if (is_array($paths))
			foreach ($paths as $path)
				$childParameter->addElementPath($path);
		$childParameter->setXML($node);

		$visible = $node->attributes('visible');
		$prefix = $node->attributes('prefix');
		$id = 'group_' . $prefix . '_' . $node->attributes('group_id');

		return sprintf('<div id="%s" class="el-group" style="display: %s;"><div class="el-group-header"><h4>%s</h4></div><div>%s</div></div>',
			$id,
			$visible ? 'block' : 'none',
			JText::_($node->attributes('label')),
			$childParameter->render($control_name));
	}
Ejemplo n.º 5
0
</div>
<?php 
echo $pane->endPanel();
echo $pane->startPanel(JText::_('Plugin Parameters'), "page-plugin-params");
?>
        <div id="plugin_params" style="padding-left:-30px;">
            <?php 
foreach ($this->plugins as $plugin) {
    if ($plugin->editable) {
        jimport('joomla.filesystem.folder');
        jimport('joomla.filesystem.file');
        $path = JPATH_PLUGINS . DS . 'editors' . DS . 'jce' . DS . 'tiny_mce' . DS . 'plugins' . DS . $plugin->name;
        $xmlPath = $path . DS . $plugin->name . '.xml';
        $name = trim($plugin->name);
        $params = new JParameter($this->group->params, $xmlPath);
        $params->addElementPath(JPATH_COMPONENT . DS . 'elements');
        // Load Language for plugin
        $lang =& JFactory::getLanguage();
        $lang->load('com_jce_' . trim($name), JPATH_SITE);
        $display = in_array($plugin->id, explode(',', $this->group->plugins)) ? 'block' : 'none';
        if ($params->getNumParams('standard') || $params->getNumParams('defaults') || $params->getNumParams('access') || $params->getNumParams('advanced')) {
            $icon = $plugin->layout ? '<img style="vertical-align:middle;margin:0px 3px 3px; 0px;" src="../plugins/editors/jce/tiny_mce/plugins/' . $plugin->name . '/img/' . $plugin->layout . '.gif" alt="' . $plugin->title . '" />' : '';
            ?>
                            <div id="plugin_params_<?php 
            echo $plugin->id;
            ?>
" style="display:<?php 
            echo $display;
            ?>
;">
                            <fieldset class="adminform">
Ejemplo n.º 6
0
	function display( $tpl = null )
	{
		global $option;

		require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_jce' .DS. 'groups' .DS. 'helper.php' );
		
		$db		=& JFactory::getDBO();
		$user 	=& JFactory::getUser();
		
		JHTML::_('behavior.tooltip');
		JHTML::_('behavior.modal');

		$cid 	= JRequest::getVar( 'cid', array(0), '', 'array' );
		JArrayHelper::toInteger( $cid, array(0) );

		$lists 	= array();		
		$row 	=& JTable::getInstance('groups', 'JCETable');
		
		// 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( 'DESCBEINGEDITTED', JText::_( 'The Group' ), $row->name );
			$this->setRedirect( 'index.php?option='. $option .'&type=group', $msg, 'error' );
			return false;
		}
		// Load editor
		$editor =& JPluginHelper::getPlugin('editors', 'jce');
		
		// Load Language
		$lang =& JFactory::getLanguage();
        $lang->load( 'com_jce', JPATH_SITE );
		
		// Get all plugins/commands
		$query = 'SELECT *'
		. ' FROM #__jce_plugins'
		. ' WHERE published = 1'
		;
		
		$db->setQuery( $query );
		$plugins = $db->loadObjectList();

		// load the row from the db table
		if( $cid[0] ){
			$row->checkout( $user->get('id') );			
		}else{
			$query = 'SELECT COUNT(id)'
			. ' FROM #__jce_groups'
			;
			$db->setQuery( $query );
			$total = $db->loadResult();			
			
			$row->name 			= '';
			$row->description 	= '';
			$row->types			= '';
			$row->components	= '';
			$row->types			= '';
			$row->rows			= '';
			$row->plugins		= '';
			$row->published 	= 1;
			$row->ordering		= 0;
			$row->params 		= '';
			
			$row->params .= $editor->params;
			
			/*foreach( $plugins as $plugin ){
				if( $plugin->type == 'plugin' ){
					$row->params .= $plugin->params;
				}
			}*/
		}	
		
		// build the html select list for ordering
		$query = 'SELECT ordering AS value, name AS text'
			. ' FROM #__jce_groups'
			. ' 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'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published );
		
		// Get components list
		$query = "SELECT *"
		. " FROM #__components"
		. " WHERE link <> ''"
		. " AND parent = 0"
		. " AND enabled = 1"
		//. " AND option NOT IN ('com_jce','com_wrapper','com_search','com_polls','com_newsfeeds')"
		. " ORDER BY name";
		$db->setQuery( $query );
		$components = $db->loadObjectList();
		
		$options 	= array();
		foreach( $components as $component ){
			if (!in_array($component->option, array('com_jce','com_wrapper','com_search','com_polls','com_newsfeeds'))) {
				$options[] = JHTML::_('select.option', $component->option, JText::_( $component->name ), 'value', 'text', $row->components == '');
			}
		}
		
		$disabled 	= $row->components == '' ? ' disabled="disabled"' : '';
		
		$lists['components'] = JHTML::_('select.genericlist', $options, 'components[]', 'class="inputbox levels" size="10" multiple="multiple"'.$disabled, 'value', 'text', $row->components == '' ? '' : explode( ',', $row->components ) );	
		
		$options = array(
			JHTML::_('select.option', 'all', JText::_( 'All Components' ), 'value', 'text'),
			JHTML::_('select.option', 'select', JText::_( 'Select From List' ), 'value', 'text')
		);
		$lists['components_radio'] = JHTML::_('select.radiolist', $options, 'components-select', 'class="inputbox"', 'value', 'text', $row->components ? 'select' : 'all', 'components-');	
		
			
		$query = 'SELECT types'
		. ' FROM #__jce_groups'
		// Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
		. ' WHERE id NOT IN (17,28,29,30)'
		;
		$db->setQuery( $query );
		$types = $db->loadResultArray();
		
		// get list of Groups for dropdown filter
		$query = 'SELECT id AS value, name AS text'
		. ' FROM #__core_acl_aro_groups'
		// Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
		. ' WHERE id NOT IN (17,28,29,30)'
		;
		$db->setQuery( $query );
		$types = $db->loadObjectList();
		
		$i = '-';
		$options = array( JHTML::_('select.option', '0', JText::_( 'Guest' ) ) );
		foreach( $types as $type ){
			$options[] = JHTML::_('select.option', $type->value, $i . JText::_( $type->text ) );
			$i .= '-';
		}
		$lists['types'] = JHTML::_('select.genericlist', $options, 'types[]', 'class="inputbox levels" size="8" multiple="multiple"', 'value', 'text', $row->types == '' ? '' : explode( ',', $row->types ) );
		
		$options = array();
		if( $row->id && $row->users ){
			$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'] = JHTML::_('select.genericlist', $options, 'users[]', 'class="inputbox users" size="10" multiple="multiple"', 'value', 'text', '' );
				
		// get params definitions
		$xml = JCE_LIBRARIES.DS.'xml'.DS.'config'.DS.'config.xml';
        if (!file_exists($xml)) {
        	$xml = JPATH_PLUGINS.DS.'editors'.DS.'jce.xml';
        }

		$params = new JParameter( $row->params, $xml );
		
		$params->addElementPath( JPATH_COMPONENT . DS . 'elements' );
		
		$rows = str_replace( ';', ',', $row->rows );
		
		$this->assignRef('lists',		$lists);
		$this->assignRef('group',		$row);
		$this->assignRef('params',		$params);
		$this->assignRef('plugins',		$plugins);

		parent::display($tpl);
	}