From 218777cb8b00ed801430613196d5af7134fcfc72 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sun, 13 Jun 2010 23:26:46 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B0=20trunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@332 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../components/com_jce/groups/controller.php | 330 +++++++++++ .../components/com_jce/groups/groups.php | 143 +++++ .../components/com_jce/groups/helper.php | 45 ++ .../components/com_jce/groups/index.html | 1 + .../com_jce/groups/views/group/index.html | 1 + .../com_jce/groups/views/group/tmpl/form.php | 511 ++++++++++++++++++ .../groups/views/group/tmpl/index.html | 1 + .../com_jce/groups/views/group/view.html.php | 192 +++++++ .../com_jce/groups/views/groups/index.html | 1 + .../groups/views/groups/tmpl/default.php | 148 +++++ .../groups/views/groups/tmpl/index.html | 1 + .../com_jce/groups/views/groups/view.html.php | 105 ++++ .../com_jce/groups/views/index.html | 1 + .../com_jce/groups/views/legend/index.html | 1 + .../groups/views/legend/tmpl/default.php | 39 ++ .../groups/views/legend/tmpl/index.html | 1 + .../com_jce/groups/views/legend/view.html.php | 48 ++ .../com_jce/groups/views/users/index.html | 1 + .../groups/views/users/tmpl/default.php | 142 +++++ .../groups/views/users/tmpl/index.html | 1 + .../com_jce/groups/views/users/view.html.php | 130 +++++ .../com_jce/installer/adapters/extension.php | 326 +++++++++++ .../com_jce/installer/adapters/index.html | 1 + .../com_jce/installer/adapters/language.php | 211 ++++++++ .../com_jce/installer/adapters/plugin.php | 505 +++++++++++++++++ .../com_jce/installer/controller.php | 21 + .../components/com_jce/installer/index.html | 1 + .../com_jce/installer/installer.php | 111 ++++ .../com_jce/installer/models/extension.php | 92 ++++ .../com_jce/installer/models/extensions.php | 147 +++++ .../com_jce/installer/models/index.html | 1 + .../com_jce/installer/models/install.php | 242 +++++++++ .../com_jce/installer/models/language.php | 162 ++++++ .../com_jce/installer/models/plugin.php | 96 ++++ .../installer/views/default/index.html | 1 + .../views/default/tmpl/default_ftp.php | 31 ++ .../views/default/tmpl/default_message.php | 19 + .../installer/views/default/tmpl/index.html | 1 + .../com_jce/installer/views/default/view.php | 75 +++ .../installer/views/extension/index.html | 1 + .../views/extension/tmpl/default.php | 41 ++ .../views/extension/tmpl/default_item.php | 13 + .../installer/views/extension/tmpl/index.html | 1 + .../installer/views/extension/view.php | 61 +++ .../com_jce/installer/views/index.html | 1 + .../installer/views/install/index.html | 1 + .../installer/views/install/tmpl/default.php | 4 + .../views/install/tmpl/default_form.php | 70 +++ .../installer/views/install/tmpl/index.html | 1 + .../com_jce/installer/views/install/view.php | 47 ++ .../installer/views/language/index.html | 1 + .../installer/views/language/tmpl/default.php | 49 ++ .../views/language/tmpl/default_item.php | 12 + .../installer/views/language/tmpl/index.html | 1 + .../com_jce/installer/views/language/view.php | 64 +++ .../com_jce/installer/views/plugin/index.html | 1 + .../installer/views/plugin/tmpl/default.php | 40 ++ .../views/plugin/tmpl/default_item.php | 12 + .../installer/views/plugin/tmpl/index.html | 1 + .../com_jce/installer/views/plugin/view.php | 61 +++ 60 files changed, 4369 insertions(+) create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/controller.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/groups.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/helper.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/group/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/form.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/group/view.html.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/view.html.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/view.html.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/users/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/groups/views/users/view.html.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/adapters/extension.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/adapters/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/adapters/language.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/adapters/plugin.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/controller.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/installer.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/models/extension.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/models/extensions.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/models/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/models/install.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/models/language.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/models/plugin.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/default/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_ftp.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_message.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/default/view.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default_item.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/view.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/install/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default_form.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/install/view.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/language/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default_item.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/language/view.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default_item.php create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/index.html create mode 100644 oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/view.php diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/controller.php b/oss/joomla/trunk/administrator/components/com_jce/groups/controller.php new file mode 100644 index 00000000..541cfaaf --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/controller.php @@ -0,0 +1,330 @@ +registerTask( 'apply', 'save'); + $this->registerTask( 'unpublish', 'publish'); + $this->registerTask( 'edit' , 'display' ); + $this->registerTask( 'add' , 'display' ); + $this->registerTask( 'remove' , 'remove' ); + $this->registerTask( 'addusers' , 'display' ); + $this->registerTask( 'removeusers' ,'display' ); + $this->registerTask( 'orderup' , 'order' ); + $this->registerTask( 'orderdown' , 'order' ); + $this->registerTask( 'legend' , 'display' ); + $this->registerTask( 'copy' , 'copy' ); + } + + function display( ) + { + switch($this->getTask()) + { + case 'add' : + case 'edit' : + { + JRequest::setVar( 'layout', 'form' ); + JRequest::setVar( 'view', 'group' ); + JRequest::setVar( 'hidemainmenu', 1 ); + } break; + case 'addusers' : + case 'removeusers' : + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'users' ); + } break; + case 'legend': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'legend' ); + } break; + } + + parent::display(); + } + + function remove() + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $user =& JFactory::getUser(); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select a Group to remove' ) ); + } + + $cids = implode( ',', $cid ); + + $query = 'DELETE FROM #__jce_groups' + . ' WHERE id IN ( '.$cids.' )' + ; + $db->setQuery( $query ); + if (!$db->query()) { + JError::raiseError(500, $db->getErrorMsg() ); + } + + $this->setRedirect( 'index.php?option=com_jce&type=group' ); + } + + function copy() + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $user =& JFactory::getUser(); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + $n = count( $cid ); + if ($n == 0) { + return JError::raiseWarning( 500, JText::_( 'No items selected' ) ); + } + + $row =& JTable::getInstance('groups', 'JCETable'); + + foreach ($cid as $id){ + // load the row from the db table + $row->load( (int) $id ); + $row->name = JText::sprintf( 'Copy of %s', $row->name ); + $row->id = 0; + $row->published = 0; + + if (!$row->check()) { + return JError::raiseWarning( 500, $row->getError() ); + } + if (!$row->store()) { + return JError::raiseWarning( 500, $row->getError() ); + } + $row->checkin(); + $row->reorder( 'ordering='.$db->Quote( $row->ordering ) ); + } + $msg = JText::sprintf( 'Items Copied', $n ); + $this->setRedirect( 'index.php?option=com_jce&type=group', $msg ); + } + + function save() + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + require_once( dirname( __FILE__ ) .DS. 'helper.php' ); + + $db =& JFactory::getDBO(); + $row =& JTable::getInstance('groups', 'JCETable'); + $task = $this->getTask(); + + $pid = JRequest::getVar( 'pid', array(), 'post', 'array' ); + $components = JRequest::getVar( 'components', array(), 'post', 'array' ); + $types = JRequest::getVar( 'types', array(), 'post', 'array' ); + $users = JRequest::getVar( 'users', array(), 'post', 'array' ); + + if (!$row->bind(JRequest::get('post'))) { + JError::raiseError(500, $row->getError() ); + } + + if( substr( $row->rows, -1, 1 ) == ';' ){ + $row->rows = substr( $row->rows, 0, -1 ); + } + + $row->types = implode( ',', $types ); + $row->components = implode( ',', $components ); + $row->users = implode( ',', $users ); + + $query = "SELECT id" + . " FROM #__jce_plugins" + . " WHERE published = 1" + . " AND type = 'plugin'" + . " AND id IN (". str_replace( ';', ',', $row->rows ) .")" + ; + $db->setQuery( $query ); + $ids = $db->loadResultArray(); + + if( !$ids ){ + $ids = array(); + } + + $row->plugins = implode( ',', array_merge( $pid, $ids ) ); + + if (!$row->check()) { + JError::raiseError(500, $row->getError() ); + } + if (!$row->store()) { + JError::raiseError(500, $row->getError() ); + } + $row->checkin(); + + switch ( $task ) + { + case 'apply': + $msg = JText::sprintf( 'Successfully Saved changes to Group', $row->name ); + $this->setRedirect( 'index.php?option=com_jce&type=group&view=group&task=edit&cid[]='. $row->id, $msg ); + break; + + case 'save': + default: + $msg = JText::sprintf( 'Successfully Saved Group', $row->name ); + $this->setRedirect( 'index.php?option=com_jce&type=group', $msg ); + break; + } + } + + function publish( ){ + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $user =& JFactory::getUser(); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + $publish = ( $this->getTask() == 'publish' ? 1 : 0 ); + + if (count( $cid ) < 1) { + $action = $publish ? JText::_( 'publish' ) : JText::_( 'unpublish' ); + JError::raiseError(500, JText::_( 'Select a Group to '.$action ) ); + } + + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__jce_groups SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ))' + ; + $db->setQuery( $query ); + if (!$db->query()) { + JError::raiseError(500, $db->getErrorMsg() ); + } + + if (count( $cid ) == 1) { + $row =& JTable::getInstance('groups', 'JCETable'); + $row->checkin( $cid[0] ); + } + + $this->setRedirect( 'index.php?option=com_jce&type=group' ); + } + + function order( ) + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + $uid = $cid[0]; + $inc = ( $this->getTask() == 'orderup' ? -1 : 1 ); + + $row =& JTable::getInstance('groups', 'JCETable'); + $row->load( $uid ); + //$row->move( $inc, ' AND ordering > -10000 AND ordering < 10000' ); + $row->move( $inc ); + + $this->setRedirect( 'index.php?option=com_jce&type=group' ); + } + + function saveorder( ) + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + $db =& JFactory::getDBO(); + $total = count( $cid ); + $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); + JArrayHelper::toInteger($order, array(0)); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + $row =& JTable::getInstance('groups', 'JCETable'); + $conditions = array(); + + // update ordering values + for ( $i=0; $i < $total; $i++ ) + { + $row->load( (int) $cid[$i] ); + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + JError::raiseError(500, $db->getErrorMsg() ); + } + // remember to updateOrder this group + $condition = ' AND ordering > -10000 AND ordering < 10000'; + $found = false; + foreach ( $conditions as $cond ) + { + if ($cond[1]==$condition) { + $found = true; + break; + } + } + if (!$found) $conditions[] = array($row->id, $condition); + } + } + + // execute updateOrder for each group + foreach ( $conditions as $cond ) { + $row->load( $cond[0] ); + $row->reorder( $cond[1] ); + } + + $msg = JText::_( 'New ordering saved' ); + $this->setRedirect( 'index.php?option=com_jce&type=group', $msg ); + } + + function cancel( ){ + $this->setRedirect( JRoute::_( 'index.php?option=com_jce', false ) ); + } + + function cancelEdit( ) + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $row =& JTable::getInstance('groups', 'JCETable'); + $row->bind(JRequest::get('post')); + $row->checkin(); + + $this->setRedirect( JRoute::_( 'index.php?option=com_jce&type=group', false ) ); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/groups.php b/oss/joomla/trunk/administrator/components/com_jce/groups/groups.php new file mode 100644 index 00000000..57efa7da --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/groups.php @@ -0,0 +1,143 @@ +loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} +?> \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/helper.php b/oss/joomla/trunk/administrator/components/com_jce/groups/helper.php new file mode 100644 index 00000000..34e0ce39 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/helper.php @@ -0,0 +1,45 @@ +setQuery( $query ); + $groups = $db->loadObjectList(); + return $groups[0]; + } + function getUserGroupFromType( $type ){ + $db =& JFactory::getDBO(); + + if(!is_int($type)){ + $query = 'SELECT id' + . ' FROM #__core_acl_aro_groups' + . ' WHERE name = "'.$type.'"' + ; + $db->setQuery( $query ); + $id = $db->loadResult(); + } + + $query = 'SELECT *' + . ' FROM #__jce_groups' + . ' WHERE '.$type.' IN (types)' + ; + $db->setQuery( $query ); + $groups = $db->loadObjectList(); + return $groups[0]; + } + function getRowArray($rows){ + $out = array(); + $rows = explode(';', $rows); + $i = 1; + foreach($rows as $row){ + $out[$i] = $row; + $i++; + } + return $out; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/form.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/form.php new file mode 100644 index 00000000..86684d5a --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/form.php @@ -0,0 +1,511 @@ +[' .JText::_('Edit'). ']', 'user.png' ); + JToolBarHelper::save(); + JToolBarHelper::apply(); + JToolBarHelper::cancel( 'cancelEdit', 'Close' ); + jceToolbarHelper::help( 'groups' ); + + // clean item data + JFilterOutput::objectHTMLSafe( $this->group, ENT_QUOTES, '' ); +?> + +
+ true ) ); +echo $pane->startPane("config-document"); +echo $pane->startPanel(JText :: _('Setup'), "page-setup"); +?> +
+
+ + + + + + + + + + + + + + + + + + +
+ + + group->name == 'Default' ){ + echo $this->group->name; + ?> + + + + +
+ + + +
+ : + + group->name == 'Default' ){ + echo JText::_('Enabled'); + ?> + + lists['published']; + }?> +
+ : + + lists['ordering']; ?> +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ : + + lists['components']; ?> +

+ + +

+
+

+

:

+

:

+
+ : + + lists['types']; ?> +

+ + +

+
+

+

:

+

:

+
+ : + + lists['users']; ?> +

+

+
+

+

:

+

:

+
+
+
+endPanel();?> +startPanel(JText :: _('Editor Parameters'), "page-editor-params");?> +
+
+ + params->render('params', 'groups-editor')) : + echo $output; + else : + echo "
".JText::_('There are no parameters for this item')."
"; + endif; + ?> +
+
+ + params->render('params', 'groups-options')) : + echo $output; + else : + echo "
".JText::_('There are no parameters for this item')."
"; + endif; + ?> +
+
+ + params->render('params', 'groups-plugins')) : + echo $output; + else : + echo "
".JText::_('There are no parameters for this item')."
"; + endif; + ?> +
+
+endPanel();?> +startPanel(JText :: _('Layout'), "page-layout");?> +
+
+ + + + + + + +
+
+ +
+ group->rows ); + $spacer = file_exists( JPATH_PLUGINS .DS. 'editors' .DS. 'jce' .DS. 'tiny_mce' .DS. 'themes' .DS. 'advanced' .DS. 'img' .DS. 'spacer.gif' ); + for( $i=1; $i<=5; $i++ ){ + ?> +
+ +
    + +
  • <?php echo JText::_('Spacer');?>
  • + plugins as $icon ){ + if( !in_array( $icon->id, explode( ',', implode( ',', $rows ) ) ) ){ + if( $icon->layout && $icon->row == $i ){ + $n = "row_li_" .$icon->id; + $path = $icon->type == 'command' ? '../plugins/editors/jce/tiny_mce/themes/advanced/img/'. $icon->layout .'.gif' : '../plugins/editors/jce/tiny_mce/plugins/'. $icon->name .'/img/'. $icon->layout .'.gif'; + ?> +
  • <?php echo $icon->title;?>
  • + +
+
+
+ +
+
params->get('editor_width', '600');?>px
+
+ +
+ +
+ +
+ +
    + +
  • <?php echo JText::_('Spacer');?>
  • + plugins as $button ){ + if( $button->layout && $button->id == $icon ){ + $n = "group_li_". $button->id; + $path = $button->type == 'command' ? '../plugins/editors/jce/tiny_mce/themes/advanced/img/'. $button->layout .'.gif' : '../plugins/editors/jce/tiny_mce/plugins/'. $button->name .'/img/'. $button->layout .'.gif'; + ?> +
  • <?php echo $button->title;?>
  • + +
+
+
+ +
+
params->get('editor_width', '600');?>px
+
+
+
+
+ + + + + plugins as $plugin ){ + if( $plugin->layout == '' ){ + if( $plugin->editable ){?> + + + + + + + + + + + +
id, explode( ',', $this->group->plugins ) ) ? 'checked="checked"' : '';?>/>title;?>
id, explode( ',', $this->group->plugins ) ) ? 'checked="checked"' : '';?>/>title;?>
+
+
+endPanel();?> +startPanel(JText :: _('Plugin Parameters'), "page-plugin-params");?> +
+ 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 ? ''. $plugin->title .'' : ''; + ?> +
+
+ title ); ?> + true ) ); + echo $pane->startPane("group-pane-".$name); + if($params->getNumParams('standard')) { + if($output = $params->render('params', 'standard')){ + echo $pane->startPanel(JText :: _('STANDARD'), $name."-standard-page"); + echo $output; + echo $pane->endPanel(); + } + } + if($params->getNumParams('defaults')) { + if($output = $params->render('params', 'defaults')){ + echo $pane->startPanel(JText :: _('DEFAULTS'), $name."-defaults-page"); + echo $output; + echo $pane->endPanel(); + } + } + if($params->getNumParams('access')) { + if($output = $params->render('params', 'access')){ + echo $pane->startPanel(JText :: _('PERMISSIONS'), $name."-access-page"); + echo $output; + echo $pane->endPanel(); + } + } + if($params->getNumParams('advanced')) { + if($output = $params->render('params', 'advanced')){ + echo $pane->startPanel(JText :: _('ADVANCED'), $name."-advanced-page"); + echo $output; + echo $pane->endPanel(); + } + } + if( JFolder::exists( $path .DS. 'extensions' ) ){ + $db =& JFactory::getDBO(); + $query = 'SELECT *' + . ' FROM #__jce_extensions' + . ' WHERE published = 1' + . ' AND pid = '.(int) $plugin->id; + ; + + $db->setQuery( $query ); + $extensions = $db->loadObjectList(); + + foreach( $extensions as $extension ){ + // Load extension xml file + $file = $path .DS. 'extensions' .DS. $extension->folder .DS. $extension->extension . '.xml'; + // Load extension language file + $lang =& JFactory::getLanguage(); + $lang->load( 'com_jce_' . trim( $name ) . '_' . trim( $extension->extension ), JPATH_SITE ); + + if( JFile::exists( $file ) ){ + $params = new JParameter( $this->group->params, $file ); + if($params->getNumParams()) { + if($output = $params->render('params')){ + echo $pane->startPanel(JText :: _( $extension->name ), $extension->extension."-extension-page"); + echo $output; + echo $pane->endPanel(); + } + } + } + } + } + echo $pane->endPane(); + ?> +
+
+ +
+endPane();?> +
+ + + + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/view.html.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/view.html.php new file mode 100644 index 00000000..f1b80429 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/group/view.html.php @@ -0,0 +1,192 @@ +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" + . " ORDER BY name"; + $db->setQuery( $query ); + $components = $db->loadObjectList(); + + $options = array(); + $options[] = JHTML::_('select.option', '', JText::_( 'All Components' ) ); + foreach( $components as $component ){ + $options[] = JHTML::_('select.option', $component->option, JText::_( $component->name ) ); + } + $lists['components'] = JHTML::_('select.genericlist', $options, 'components[]', 'class="inputbox levels" size="10" multiple="multiple"', 'value', 'text', $row->components == '' ? '' : explode( ',', $row->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); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/default.php new file mode 100644 index 00000000..9168fc97 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/default.php @@ -0,0 +1,148 @@ + + + + + +items; + + JToolBarHelper::title( JText::_( 'JCE Group Manager' ), 'user.png' ); + + JToolBarHelper::editListX(); + JToolBarHelper::addNewX(); + JToolBarHelper::custom( 'copy', 'copy.png', 'copy_f2.png', JText::_('Copy'), true ); + if( count( $rows ) > 1 ){ + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::deleteList(); + } + JToolBarHelper::cancel( 'cancel', JText::_( 'Close' ) ); + jceToolbarHelper::help( 'groups' ); + + +?> + +
+ + + + +
+ : + + + +
+ + + + + + + + + + + + + + + + + + + +id ); + if( $n == 1){ + $published = JHTMLImage::administrator('tick.png'); + }else{ + $published = JHTML::_('grid.published', $row, $i ); + } + $checked = JHTML::_('grid.checkedout', $row, $i ); + $ordering = ($this->lists['order'] == 'g.ordering'); +?> + "> + + + + + + + + + + +
+ + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + 1 ){ echo JHTML::_('grid.order', $rows );}?> + + lists['order_Dir'], @$this->lists['order'] ); ?> +
+ pagination->getListFooter(); ?> +
+ pagination->getRowOffset( $i ); ?> + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->name; + } else { + ?> + + + name; ?> + + + description;?> + + + + pagination->orderUpIcon( $i, ($row->ordering > -10000 && $row->ordering < 10000), 'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, ($row->ordering > -10000 && $row->ordering < 10000), 'orderdown', 'Move Down', $ordering ); ?> + 1? '' : 'disabled="disabled"'; ?> + class="text_area" style="text-align: center" /> + + id;?> +
+ + + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/view.html.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/view.html.php new file mode 100644 index 00000000..c7de775f --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/groups/view.html.php @@ -0,0 +1,105 @@ +getUserStateFromRequest( "$option.$type.$task.$client.filter_order", 'filter_order', 'g.name', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_order_Dir", 'filter_order_Dir', '', 'word' ); + $filter_state = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_state", 'filter_state', '', 'word' ); + $search = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.search", 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( '$option.$type.$task.$client.limitstart', 'limitstart', 0, 'int' ); + + $limitstart = isset( $limitstart->group ) ? $limitstart->group : 0; + + $where = array(); + + if ( $search ) { + $where[] = 'LOWER( g.name ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + } + if ( $filter_state ) { + if ( $filter_state == 'P' ) { + $where[] = 'g.published = 1'; + } else if ($filter_state == 'U' ) { + $where[] = 'g.published = 0'; + } + } + $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); + $orderby = ' ORDER BY g.ordering ASC'; + + // get the total number of records + $query = 'SELECT COUNT(g.id)' + . ' FROM #__jce_groups AS g' + . $where + ; + $db->setQuery( $query ); + $total = $db->loadResult(); + + jimport('joomla.html.pagination'); + $pagination = new JPagination( $total, $limitstart, $limit ); + + $query = 'SELECT g.*, u.name AS editor' + . ' FROM #__jce_groups AS g' + . ' LEFT JOIN #__users AS u ON u.id = g.checked_out' + . $where + . ' GROUP BY g.id' + . $orderby + ; + $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', JFactory::getUser()); + $this->assignRef('lists', $lists); + $this->assignRef('items', $rows); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/default.php new file mode 100644 index 00000000..6413e88c --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/default.php @@ -0,0 +1,39 @@ + + + +
+
+
+ +
+
+
+ + + + + + + + icons as $icon ){ + $path = $icon->type == 'command' ? '../plugins/editors/jce/tiny_mce/themes/advanced/img/'. $icon->layout .'.gif' : '../plugins/editors/jce/tiny_mce/plugins/'. $icon->name .'/img/'. $icon->layout .'.gif'; + ?> + + + + + + +
+ : + + : +
title;?><?php echo $icon->title;?>
+
+ + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/view.html.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/view.html.php new file mode 100644 index 00000000..a30cafcc --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/legend/view.html.php @@ -0,0 +1,48 @@ + 0' + . ' ORDER BY title' + ; + $db->setQuery( $query ); + $icons = $db->loadObjectList(); + + $this->assignRef('icons', $icons); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/default.php new file mode 100644 index 00000000..8f19601b --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/default.php @@ -0,0 +1,142 @@ + + + + +
+
+
+ + +
+
+ +
+
+ + + + + +
+ : + + + + + lists['group'];?> +
+ + + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) + { + $row =& $this->items[$i]; + + $task = $row->block ? 'unblock' : 'block'; + $alt = $row->block ? JText::_( 'Enabled' ) : JText::_( 'Blocked' ); + + //$group = JCEGroupsHelper::getUserGroupFromId($row->id); + //$checked = $group->id ? '' : JHTML::_('grid.id', $i, $row->id ); + ?> + "> + + + + + + + + + + +
+ + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> +
+ pagination->getListFooter(); ?> +
+ pagination->limitstart;?> + + id );?> + + name; ?> + + username; ?> + + groupname ); ?> + email; ?> + id; ?> +
+ + + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/view.html.php b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/view.html.php new file mode 100644 index 00000000..725f4c54 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/groups/views/users/view.html.php @@ -0,0 +1,130 @@ +getUserStateFromRequest( "$option.$type.$task.$client.filter_order", 'filter_order', 'a.name', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_order_Dir", 'filter_order_Dir', '', 'word' ); + $filter_type = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_type", 'filter_type', 0, 'string' ); + $search = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.search", 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $where = array(); + if (isset( $search ) && $search!= '') + { + $searchEscaped = $db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + $where[] = 'a.username LIKE '.$searchEscaped.' OR a.email LIKE '.$searchEscaped.' OR a.name LIKE '.$searchEscaped; + } + if ( $filter_type ) + { + $where[] = 'a.usertype = LOWER( '.$db->Quote($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 = ' ORDER BY '. $filter_order .' '. $filter_order_Dir; + $where = ( count( $where ) ? ' WHERE (' . implode( ') AND (', $where ) . ')' : '' ); + + $query = 'SELECT COUNT(a.id)' + . ' FROM #__users AS a' + . $where + ; + $db->setQuery( $query ); + $total = $db->loadResult(); + + jimport('joomla.html.pagination'); + $pagination = new JPagination( $total, $limitstart, $limit ); + + $query = 'SELECT a.*, 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' + . $where + . ' GROUP BY a.id' + . $orderby + ; + $db->setQuery( $query, $pagination->limitstart, $pagination->limit ); + $rows = $db->loadObjectList(); + + // get list of Groups for dropdown filter + $query = 'SELECT name 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[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Group' ) .' -' ); + foreach( $db->loadObjectList() as $obj ) + { + $types[] = JHTML::_('select.option', $obj->value, JText::_( $obj->text ) ); + } + $lists['group'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_type" ); + + // table ordering + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + // search filter + $lists['search']= $search; + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('lists', $lists); + $this->assignRef('items', $rows); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/extension.php b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/extension.php new file mode 100644 index 00000000..8f05a561 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/extension.php @@ -0,0 +1,326 @@ +parent = & $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function install() + { + // Get a database connector object + $db = & $this->parent->getDBO(); + + // Get the extension manifest object + $manifest = & $this->parent->getManifest(); + $this->manifest = & $manifest->document; + + /** + * --------------------------------------------------------------------------------------------- + * Manifest Document Setup Section + * --------------------------------------------------------------------------------------------- + */ + + // Set the component name + $name = & $this->manifest->getElementByPath('name'); + $this->set('name', $name->data()); + + // Get the component description + $description = & $this->manifest->getElementByPath('description'); + if (is_a($description, 'JSimpleXMLElement')) { + $this->parent->set('message', $description->data()); + } + else { + $this->parent->set('message', ''); + } + + $element = & $this->manifest->getElementByPath('files'); + + $extension = $this->manifest->attributes('extension'); + $plugin = $this->manifest->attributes('plugin'); + $folder = $this->manifest->attributes('folder'); + + if (! empty($plugin)) { + $this->parent->setPath('extension_root', JPATH_PLUGINS.DS.'editors'.DS.'jce'.DS.'tiny_mce'.DS.'plugins'.DS.$plugin.DS.'extensions'.DS.$folder); + } + else { + $this->parent->abort('Extension Install: '.JText::_('No JCE Plugin file specified')); + return false; + } + + /** + * --------------------------------------------------------------------------------------------- + * Filesystem Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // Set overwrite flag if not set by Manifest + $this->parent->setOverwrite(true); + + // If the extension directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_root'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { + $this->parent->abort('Extension Install: '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); + return false; + } + } + + /* + * If we created the extension directory and will want to remove it if we + * have to roll back the installation, lets add it to the installation + * step stack + */ + if ($created) { + $this->parent->pushStep( array ('type'=>'folder', 'path'=>$this->parent->getPath('extension_root'))); + } + + // Copy all necessary files + if ($this->parent->parseFiles($element, -1) === false) { + // Install failed, roll back changes + $this->parent->abort(); + return false; + } + + // Parse optional tags -- language files for plugins + $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), 0); + + /** + * --------------------------------------------------------------------------------------------- + * Database Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // Check to see if an extension by the same name is already installed + $query = 'SELECT id' + .' FROM #__jce_extensions' + .' WHERE extension = '.$db->Quote($extension) + ; + $db->setQuery($query); + + + $row = & JTable::getInstance('extension', 'JCETable'); + + if (!$db->Query()) { + // Install failed, roll back changes + $this->parent->abort('Extension Install: '.$db->stderr(true)); + return false; + } + $id = $db->loadResult(); + + // Was there an extension already installed with the same name? + if ($id) { + + if (!$this->parent->getOverwrite()) + { + // Install failed, roll back changes + $this->parent->abort('Extension Install: '.JText::_('Extension').' "'.$ename.'" '.JText::_('already exists!')); + return false; + } + else { + $row->load($id); + } + } + // Get the associated plugin + $query = 'SELECT id' + .' FROM #__jce_plugins' + .' WHERE name = '.$db->Quote($plugin); + $db->setQuery($query); + + if (!$db->Query()) { + // Install failed, roll back changes + $this->parent->abort('Plugin not installed: '.$db->stderr(true)); + return false; + } + $id = $db->loadResult(); + + $row->pid = $id; + $row->name = $this->get('name'); + $row->extension = $this->manifest->attributes('extension'); + $row->folder = $this->manifest->attributes('folder'); + $row->published = 1; + + if (!$row->store()) { + // Install failed, roll back changes + $this->parent->abort('Extension Install: '.$db->stderr(true)); + return false; + } + + // Since we have created an extension item, we add it to the installation step stack + // so that if we have to rollback the changes we can undo it. + $this->parent->pushStep( array ('type'=>'extension', 'id'=>$row->id)); + + /** + * --------------------------------------------------------------------------------------------- + * Finalization and Cleanup Section + * --------------------------------------------------------------------------------------------- + */ + + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest(-1)) { + // Install failed, rollback changes + $this->parent->abort('Extension Install: '.JText::_('Could not copy setup file')); + return false; + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param int $cid The id of the plugin to uninstall + * @param int $clientId The id of the client (unused) + * @return boolean True on success + * @since 1.5 + */ + function uninstall($id, $clientId) + { + // Initialize variables + $row = null; + $retval = true; + $db = & $this->parent->getDBO(); + + // First order of business will be to load the module object table from the database. + // This should give us the necessary information to proceed. + + $row = & JTable::getInstance('extension', 'JCETable'); + $row->load((int)$id); + + $query = 'SELECT name' + .' FROM #__jce_plugins' + .' WHERE id = '.$row->pid + ; + + $db->setQuery($query); + if (!$db->Query()) { + // Install failed, roll back changes + $this->parent->abort('Plugin not installed: '.$db->stderr(true)); + return false; + } + $file = $db->loadResult(); + + // Get the extension folder so we can properly build the plugin path + if (trim($row->extension) == '') { + JError::raiseWarning(100, 'Extension Uninstall: '.JText::_('Extension field empty, cannot remove files')); + return false; + } + + // Set the plugin root path + $this->parent->setPath('extension_root', JPATH_PLUGINS.DS.'editors'.DS.'jce'.DS.'tiny_mce'.DS.'plugins'.DS.$file.DS.'extensions'.DS.$row->folder); + + $manifestFile = $this->parent->getPath('extension_root').DS.$row->extension.'.xml'; + + if (file_exists($manifestFile)) + { + $xml = & JFactory::getXMLParser('Simple'); + + // If we cannot load the xml file return null + if (!$xml->loadFile($manifestFile)) { + JError::raiseWarning(100, 'Extension Uninstall: '.JText::_('Could not load manifest file')); + return false; + } + + /* + * Check for a valid XML root tag. + */ + $root = & $xml->document; + if ($root->name() != 'install') { + JError::raiseWarning(100, 'Extension Uninstall: '.JText::_('Invalid manifest file')); + return false; + } + + // Remove the extension files + $this->parent->removeFiles($root->getElementByPath('files'), -1); + + // Remove all media and languages as well + $this->parent->removeFiles($root->getElementByPath('languages'), 0); + + + JFile::delete($manifestFile); + } + else { + JError::raiseWarning(100, 'Extension Uninstall: Manifest File invalid or not found. Extension entry removed from database.'); + + $row->delete($row->id); + unset ($row); + return false; + } + + // Now we will no longer need the extension object, so lets delete it + $row->delete($row->id); + unset ($row); + + // If the folder is empty, let's delete it + $files = JFolder::files($this->parent->getPath('extension_root')); + if (!count($files)) { + JFolder::delete($this->parent->getPath('extension_root')); + } + + return $retval; + } + + /** + * Custom rollback method + * - Roll back the plugin item + * + * @access public + * @param array $arg Installation step to rollback + * @return boolean True on success + * @since 1.5 + * Minor changes to the db query + */ + function _rollback_plugin($arg) + { + // Get database connector object + $db = & $this->parent->getDBO(); + + // Remove the entry from the #__jce_extensions table + $query = 'DELETE' + .' FROM #__jce_extensions' + .' WHERE id='.(int)$arg['id']; + + $db->setQuery($query); + + return ($db->query() !== false); + } +} diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/language.php b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/language.php new file mode 100644 index 00000000..a3baa851 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/language.php @@ -0,0 +1,211 @@ +parent = & $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function install() + { + // Get database connector object + $manifest = & $this->parent->getManifest(); + $this->manifest = & $manifest->document; + + // Get the language name + // Set the extensions name + $name = & $this->manifest->getElementByPath('name'); + $name = JFilterInput::clean($name->data(), 'cmd'); + $this->set('name', $name); + + // Get the Language tag [ISO tag, eg. en-GB] + $tag = & $this->manifest->getElementByPath('tag'); + + // Check if we found the tag - if we didn't, we may be trying to install from an older language package + if (!$tag) + { + $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('NO LANGUAGE TAG?')); + return false; + } + + $this->set('tag', $tag->data()); + $folder = $tag->data(); + + $sitePath = JPATH_SITE.DS."language".DS.$folder; + $adminPath = JPATH_ADMINISTRATOR.DS."language".DS.$folder; + $tinyPath = JPATH_PLUGINS.DS."editors".DS."jce".DS."tiny_mce"; + + // Set the installation target paths + $this->parent->setPath('extension_site', $sitePath); + $this->parent->setPath('extension_administrator', $adminPath); + + $this->adminElement = & $this->manifest->getElementByPath('administration'); + $this->siteElement = & $this->manifest->getElementByPath('site'); + $this->tinyElement = & $this->manifest->getElementByPath('tinymce'); + + // Set overwrite flag if not set by Manifest + if (!$this->parent->getOverwrite()) { + $this->parent->setOverwrite(true); + } + + // Copy site files + foreach ($this->siteElement->children() as $child) + { + if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') { + if ($this->parent->parseFiles($child) === false) { + // Install failed, rollback any changes + $this->parent->abort(); + return false; + } + } + } + // Copy admin files + foreach ($this->adminElement->children() as $child) + { + if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') { + if ($this->parent->parseFiles($child, 1) === false) { + // Install failed, rollback any changes + $this->parent->abort(); + return false; + } + } + } + // Copy tinymce files + $this->parent->setPath('extension_site', $tinyPath); + foreach ($this->tinyElement->children() as $child) + { + if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') { + if ($this->parent->parseFiles($child) === false) { + // Install failed, rollback any changes + $this->parent->abort(); + return false; + } + } + } + + // Set path back to site for manifest + $this->parent->setPath('extension_site', $sitePath); + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest(0)) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); + return false; + } + + // Get the language description + $description = & $this->manifest->getElementByPath('description'); + if (is_a($description, 'JSimpleXMLElement')) { + $this->parent->set('message', $description->data()); + } else { + $this->parent->set('message', ''); + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param string $tag The tag of the language to uninstall + * @param int $clientId The id of the client (unused) + * @return mixed Return value for uninstall method in component uninstall file + * @since 1.5 + */ + function uninstall($tag, $clientId) + { + $path = trim($tag); + if (!JFolder::exists($path)) { + JError::raiseWarning(100, 'Language Uninstall: '.JText::_('Language path is empty, cannot uninstall files')); + return false; + } + $tag = basename($path); + + // Because JCE languages don't have their own folders we cannot use the standard method of finding an installation manifest + $manifestFile = JPATH_ROOT.DS.'language'.DS.$tag.DS.$tag.'.com_jce.xml'; + if (file_exists($manifestFile)) + { + $xml = & JFactory::getXMLParser('Simple'); + + // If we cannot load the xml file return null + if (!$xml->loadFile($manifestFile)) { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Could not load manifest file')); + return false; + } + + /* + * Check for a valid XML root tag. + */ + $root = & $xml->document; + if ($root->name() != 'install' && $root->attributes('type') != 'language') { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Invalid manifest file')); + return false; + } + + // Get the admin and site paths for the component + $sitePath = JPATH_SITE.DS."language".DS.$tag; + $adminPath = JPATH_ADMINISTRATOR.DS."language".DS.$tag; + $tinyPath = JPATH_PLUGINS.DS."editors".DS."jce".DS."tiny_mce"; + + // Set the installation target paths + $this->parent->setPath('extension_site', $sitePath); + $this->parent->setPath('extension_administrator', $adminPath); + + if (!$this->parent->removeFiles($root->getElementByPath('site/files'))) { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to delete files')); + return false; + } + if (!$this->parent->removeFiles($root->getElementByPath('administration/files'), 1)) { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to delete files')); + return false; + } + + $this->parent->setPath('extension_site', $tinyPath); + if (!$this->parent->removeFiles($root->getElementByPath('tinymce/files'))) { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to delete files')); + return false; + } + JFile::delete($manifestFile); + } else { + JError::raiseWarning(100, 'Language Uninstall: Manifest File invalid or not found'); + return false; + } + return true; + } +} diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/plugin.php b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/plugin.php new file mode 100644 index 00000000..f5d60a61 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/adapters/plugin.php @@ -0,0 +1,505 @@ +parent = & $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + * Minor alteration - see below + */ + function install() + { + // Get a database connector object + $db = & $this->parent->getDBO(); + + // Get the extension manifest object + $manifest = & $this->parent->getManifest(); + $this->manifest = & $manifest->document; + + /** + * --------------------------------------------------------------------------------------------- + * Manifest Document Setup Section + * --------------------------------------------------------------------------------------------- + */ + + // Set the plugin name + $name = & $this->manifest->getElementByPath('name'); + $this->set('name', $name->data()); + + // Get the plugin description + $description = & $this->manifest->getElementByPath('description'); + if (is_a($description, 'JSimpleXMLElement')) { + $this->parent->set('message', $description->data()); + } + else { + $this->parent->set('message', ''); + } + + $element = & $this->manifest->getElementByPath('files'); + + // Plugin name is specified + $plugin = $this->manifest->attributes('plugin'); + + if (! empty($plugin)) { + $this->parent->setPath('extension_root', JPATH_PLUGINS.DS.'editors'.DS.'jce'.DS.'tiny_mce'.DS.'plugins'.DS.$plugin); + } + else { + $this->parent->abort('Extension Install: '.JText::_('No JCE Plugin file specified')); + return false; + } + + /** + * --------------------------------------------------------------------------------------------- + * Filesystem Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // If the extension directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_root'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { + $this->parent->abort('Plugin Install: '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); + return false; + } + } + // Set overwrite flag if not set by Manifest + $this->parent->setOverwrite(true); + + /* + * If we created the extension directory and will want to remove it if we + * have to roll back the installation, lets add it to the installation + * step stack + */ + if ($created) { + $this->parent->pushStep( array ('type'=>'folder', 'path'=>$this->parent->getPath('extension_root'))); + } + + // Copy all necessary files + if ($this->parent->parseFiles($element, -1) === false) { + // Install failed, roll back changes + $this->parent->abort(); + return false; + } + + // Parse optional tags -- language files for plugins + $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), 0); + + // If there is an install file, lets copy it. + $installScriptElement = & $this->manifest->getElementByPath('installfile'); + if (is_a($installScriptElement, 'JSimpleXMLElement')) { + // Make sure it hasn't already been copied (this would be an error in the xml install file) + if (!file_exists($this->parent->getPath('extension_root').DS.$installScriptElement->data())) + { + $path['src'] = $this->parent->getPath('source').DS.$installScriptElement->data(); + $path['dest'] = $this->parent->getPath('extension_root').DS.$installScriptElement->data(); + if (!$this->parent->copyFiles( array ($path))) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy PHP install file.')); + return false; + } + } + $this->set('install.script', $installScriptElement->data()); + } + + // If there is an uninstall file, lets copy it. + $uninstallScriptElement = & $this->manifest->getElementByPath('uninstallfile'); + if (is_a($uninstallScriptElement, 'JSimpleXMLElement')) { + // Make sure it hasn't already been copied (this would be an error in the xml install file) + if (!file_exists($this->parent->getPath('extension_root').DS.$uninstallScriptElement->data())) + { + $path['src'] = $this->parent->getPath('source').DS.$uninstallScriptElement->data(); + $path['dest'] = $this->parent->getPath('extension_root').DS.$uninstallScriptElement->data(); + if (!$this->parent->copyFiles( array ($path))) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy PHP uninstall file.')); + return false; + } + } + } + + /** + * --------------------------------------------------------------------------------------------- + * Database Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // Check to see if a plugin by the same name is already installed + $query = 'SELECT id'. + ' FROM #__jce_plugins'. + ' WHERE name = '.$db->Quote($plugin); + $db->setQuery($query); + if (!$db->Query()) { + // Install failed, roll back changes + $this->parent->abort('Plugin Install: '.$db->stderr(true)); + return false; + } + $id = $db->loadResult(); + + $row = & JTable::getInstance('plugin', 'JCETable'); + + if ($id) { + + if (!$this->parent->getOverwrite()) { + // Install failed, roll back changes + $this->parent->abort('Plugin Install: '.JText::_('Plugin').' "'.$plugin.'" '.JText::_('already exists!')); + return false; + } else { + $row->load($id); + } + + } + $icon = $this->manifest->getElementByPath('icon'); + $layout = $this->manifest->getElementByPath('layout'); + + $row->title = $this->get('name'); + $row->name = $this->manifest->attributes('plugin'); + $row->type = 'plugin'; + $row->row = 4; + $row->ordering = 1; + $row->published = 1; + $row->editable = 1; + $row->icon = $icon->data(); + $row->layout = $layout->data(); + $row->iscore = 0; + + if (!$row->store()) { + // Install failed, roll back changes + $this->parent->abort('Plugin Install: '.$db->stderr(true)); + return false; + } + + // Process default extension installation (files are assumed to have been copied!) + $element = & $this->manifest->getElementByPath('extensions'); + if (is_a($element, 'JSimpleXMLElement') && count($element->children())) { + $extensions = & $element->children(); + foreach ($extensions as $extension) { + if ($extension->attributes('name')) { + $query = 'INSERT INTO `#__jce_extensions` '. + ' VALUES ("", '.(int)$row->id.', '.$db->Quote($extension->attributes('title')).', '.$db->Quote($extension->attributes('name')).', '.$db->Quote($extension->attributes('folder')).', 1 )'; + + $db->setQuery($query); + if (!$db->query()) { + // Install failed, raise error + JError::raiseWarning(100, 'Plugin Install: Unable to install default extension '.$extension->attributes('title')); + return false; + } + } + } + } + + // Since we have created a plugin item, we add it to the installation step stack + // so that if we have to rollback the changes we can undo it. + $this->parent->pushStep( array ('type'=>'plugin', 'id'=>$row->id)); + + /** + * --------------------------------------------------------------------------------------------- + * Install plugin into Default Group + * --------------------------------------------------------------------------------------------- + */ + // Add to Default Group + if ($row->type == 'plugin') { + JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jce'.DS.'groups'); + $group = & JTable::getInstance('groups', 'JCETable'); + + $query = 'SELECT id' + .' FROM #__jce_groups' + .' WHERE name = '.$db->Quote('Default') + ; + $db->setQuery($query); + $gid = $db->loadResult(); + + $group->load($gid); + // Add to plugins list + $plugins = explode(',', $group->plugins); + if(!in_array($row->id, explode(',', $group->plugins))){ + $group->plugins .= ','.$row->id; + } + // Add to last row if plugin has a layout icon + if ($row->layout) { + if (!in_array($row->id, preg_split('/[;,]+/', $group->rows))) { + $group->rows .= ','.$row->id; + } + } + if (!$group->store()) { + JError::raiseWarning(100, 'Plugin Install: Unable to add plugin to Default group'); + } + } + + /** + * --------------------------------------------------------------------------------------------- + * Finalization and Cleanup Section + * --------------------------------------------------------------------------------------------- + */ + + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest(-1)) { + // Install failed, rollback changes + $this->parent->abort('Plugin Install: '.JText::_('Could not copy setup file')); + return false; + } + + /* + * If we have an install script, lets include it, execute the custom + * install method, and append the return value from the custom install + * method to the installation message. + */ + if ($this->get('install.script')) { + if (is_file($this->parent->getPath('extension_root').DS.$this->get('install.script'))) { + ob_start(); + ob_implicit_flush(false); + require_once ($this->parent->getPath('extension_root').DS.$this->get('install.script')); + if (function_exists('jce_install')) { + if (jce_install() === false) { + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Custom install routine failure')); + return false; + } + }else if (function_exists('com_install')) { + if (com_install() === false) { + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Custom install routine failure')); + return false; + } + } + $msg = ob_get_contents(); + ob_end_clean(); + if ($msg != '') { + $this->parent->set('extension.message', $msg); + } + } + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param int $cid The id of the plugin to uninstall + * @param int $clientId The id of the client (unused) + * @return boolean True on success + * @since 1.5 + */ + function uninstall($id, $clientId) + { + // Initialize variables + $row = null; + $retval = true; + $db = & $this->parent->getDBO(); + + // First order of business will be to load the module object table from the database. + // This should give us the necessary information to proceed. + + // ^ Changes to plugin parameters. Use JCEPluginsTable class. + $row = & JTable::getInstance('plugin', 'JCETable'); + $row->load((int)$id); + + // Is the plugin we are trying to uninstall a core one? + // Because that is not a good idea... + if ($row->iscore) { + JError::raiseWarning(100, 'Plugin Uninstall: '.JText::sprintf('WARNCOREPLUGIN', $row->title)."
".JText::_('WARNCOREPLUGIN2')); + return false; + } + + // Get the plugin folder so we can properly build the plugin path + if (trim($row->name) == '') { + JError::raiseWarning(100, 'Plugin Uninstall: '.JText::_('Plugin field empty, cannot remove files')); + return false; + } + + // Set the plugin root path + $this->parent->setPath('extension_root', JPATH_PLUGINS.DS.'editors'.DS.'jce'.DS.'tiny_mce'.DS.'plugins'.DS.$row->name); + + $manifestFile = $this->parent->getPath('extension_root').DS.$row->name.'.xml'; + + if (file_exists($manifestFile)) + { + $xml = & JFactory::getXMLParser('Simple'); + + // If we cannot load the xml file return null + if (!$xml->loadFile($manifestFile)) { + JError::raiseWarning(100, 'Plugin Uninstall: '.JText::_('Could not load manifest file')); + return false; + } + + /* + * Check for a valid XML root tag. + * @todo: Remove backwards compatability in a future version + * Should be 'install', but for backward compatability we will accept 'mosinstall'. + */ + $root = & $xml->document; + if ($root->name() != 'install' && $root->name() != 'mosinstall') { + JError::raiseWarning(100, 'Plugin Uninstall: '.JText::_('Invalid manifest file')); + return false; + } + + // Remove the plugin files + $this->parent->removeFiles($root->getElementByPath('files'), -1); + JFile::delete($manifestFile); + + // Remove all media and languages as well + $this->parent->removeFiles($root->getElementByPath('languages'), 0); + + /** + * --------------------------------------------------------------------------------------------- + * Custom Uninstallation Script Section + * --------------------------------------------------------------------------------------------- + */ + + // Now lets load the uninstall file if there is one and execute the uninstall function if it exists. + $uninstallfileElement = & $root->getElementByPath('uninstallfile'); + if (is_a($uninstallfileElement, 'JSimpleXMLElement')) { + // Element exists, does the file exist? + if (is_file($this->parent->getPath('extension_root').DS.$uninstallfileElement->data())) { + ob_start(); + ob_implicit_flush(false); + require_once ($this->parent->getPath('extension_root').DS.$uninstallfileElement->data()); + if (function_exists('com_uninstall')) { + if (com_uninstall() === false) { + JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Custom Uninstall script unsuccessful')); + $retval = false; + } + } + $msg = ob_get_contents(); + ob_end_clean(); + if ($msg != '') { + $this->parent->set('extension.message', $msg); + } + } + } + + // Remove extension installations from #__jce_extensions + $query = 'DELETE'. + ' FROM `#__jce_extensions`'. + ' WHERE pid='.(int)$id; + $db->setQuery($query); + if (!$db->query()) { + JError::raiseWarning(100, 'Plugin Uninstall: Unable to remove extension records.'); + } + + // Remove from Groups + if ($row->type == 'plugin') { + JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jce'.DS.'groups'); + $grow = & JTable::getInstance('groups', 'JCETable'); + + $query = 'SELECT id, name, plugins, rows' + .' FROM #__jce_groups' + ; + $db->setQuery($query); + $groups = $db->loadObjectList(); + + foreach ($groups as $group) { + $plugins = explode(',', $group->plugins); + // Existence check + if (in_array($row->id, $plugins)) { + // Load tables + $grow->load($group->id); + // Remove from plugins list + foreach ($plugins as $k=>$v) { + if ($row->id == $v) { + unset ($plugins[$k]); + } + } + $grow->plugins = implode(',', $plugins); + // Remove from rows + if ($row->layout) { + $lists = array (); + foreach (explode(';', $group->rows) as $list) { + $icons = explode(',', $list); + foreach ($icons as $k=>$v) { + if ($row->id == $v) { + unset ($icons[$k]); + } + } + $lists[] = implode(',', $icons); + } + $grow->rows = implode(';', $lists); + } + if (!$grow->store()) { + JError::raiseWarning(100, 'Plugin Install: Unable to remove plugin from Group: '.$grow->name); + } + } + } + } + + // Now we will no longer need the plugin object, so lets delete it + $row->delete($row->id); + unset ($row); + + } + else { + JError::raiseWarning(100, 'Plugin Uninstall: Manifest File invalid or not found. Plugin entry removed from database.'); + + $row->delete($row->id); + unset ($row); + $retval = false; + } + // If the folder is empty, let's delete it + $files = JFolder::files($this->parent->getPath('extension_root')); + if (!count($files)) { + JFolder::delete($this->parent->getPath('extension_root')); + } + + return $retval; + } + + /** + * Custom rollback method + * - Roll back the plugin item + * + * @access public + * @param array $arg Installation step to rollback + * @return boolean True on success + * @since 1.5 + * Minor changes to the db query + */ + function _rollback_plugin($arg) + { + // Get database connector object + $db = & $this->parent->getDBO(); + + // Remove the entry from the #__jce_plugins table + $query = 'DELETE'. + ' FROM `#__jce_plugins`'. + ' WHERE id='.(int)$arg['id']; + $db->setQuery($query); + return ($db->query() !== false); + } +} diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/controller.php b/oss/joomla/trunk/administrator/components/com_jce/installer/controller.php new file mode 100644 index 00000000..d7d93592 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/controller.php @@ -0,0 +1,21 @@ +load( 'com_installer', JPATH_ADMINISTRATOR ); +require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_installer' .DS. 'controller.php' ); +?> \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/installer.php b/oss/joomla/trunk/administrator/components/com_jce/installer/installer.php new file mode 100644 index 00000000..909126e3 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/installer.php @@ -0,0 +1,111 @@ +parent =& $this; + } + $this->_adapters[$name] =& $adapter; + return true; + }else{ + $this->abort(JText::_('Incorrect version!')); + } + } + /** + * Method to parse the variables of a plugin, build the INI + * string for it's default variables, and return the INI string. + * + * @access public + * @return string INI string of parameter values + * @since 1.5 + */ + function getVariables() + { + // Get the manifest document root element + $root = & $this->_manifest->document; + + // Get the element of the tag names + $element =& $root->getElementByPath('variables'); + if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return null; + } + + // Get the array of variable nodes to process + $vars = $element->children(); + if (count($vars) == 0) { + // No variables to process + return null; + } + + // Process each variable in the $vars array. + $ini = null; + foreach ($vars as $var) { + if (!$name = $var->attributes('name')) { + continue; + } + + if (!$value = $var->attributes('default')) { + continue; + } + + $ini .= $name."=".$value."\n"; + } + return $ini; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/models/extension.php b/oss/joomla/trunk/administrator/components/com_jce/installer/models/extension.php new file mode 100644 index 00000000..ea4a2e7a --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/models/extension.php @@ -0,0 +1,92 @@ +setQuery($query); + $rows = $db->loadObjectList(); + + $numRows = count($rows); + + for ($i = 0; $i < $numRows; $i ++) { + $row = & $rows[$i]; + + $plugin = $row->plugin; + $name = $row->name; + $folder = $row->folder; + + // Get the plugin base path + $baseDir = JPATH_PLUGINS.DS.'editors'.DS.'jce'.DS.'tiny_mce'.DS.'plugins'; + // Get the plugin xml file + $xmlfile = $baseDir .DS. $row->file .DS. 'extensions' .DS. $row->folder .DS. $row->extension .".xml"; + + if (file_exists($xmlfile)) { + if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) { + foreach($data as $key => $value) + { + $row->$key = $value; + } + } + } + $row->name = $name; + $row->plugin = $plugin; + } + + $this->setState('pagination.total', $numRows); + if($this->_state->get('pagination.limit') > 0) { + $this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') ); + } else { + $this->_items = $rows; + } + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/models/extensions.php b/oss/joomla/trunk/administrator/components/com_jce/installer/models/extensions.php new file mode 100644 index 00000000..b9bb747f --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/models/extensions.php @@ -0,0 +1,147 @@ +setState('pagination.limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int')); + $this->setState('pagination.offset',$mainframe->getUserStateFromRequest('$option.$type.$task.$client.limitstart.'.$this->_type, 'limitstart', 0, 'int')); + $this->setState('pagination.total', 0); + } + + function &getItems() + { + if (empty($this->_items)) { + // Load the items + $this->_loadItems(); + } + return $this->_items; + } + + function &getPagination() + { + if (empty($this->_pagination)) { + // Make sure items are loaded for a proper total + if (empty($this->_items)) { + // Load the items + $this->_loadItems(); + } + // Load the pagination object + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination($this->_state->get('pagination.total'), $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit')); + } + return $this->_pagination; + } + + /** + * Remove (uninstall) an extension + * + * @static + * @param array An array of identifiers + * @return boolean True on success + * @since 1.0 + */ + function remove($eid=array()) + { + global $mainframe; + + // Initialize variables + $failed = array (); + + /* + * Ensure eid is an array of extension ids in the form id => client_id + * TODO: If it isn't an array do we want to set an error and fail? + */ + if (!is_array($eid)) { + $eid = array($eid => 0); + } + + // Get a database connector + $db =& JFactory::getDBO(); + + // Get an installer object for the extension type + //jimport('joomla.installer.installer'); + require_once( JPATH_COMPONENT .DS. 'installer' .DS. 'installer.php' ); + $installer = & JCEInstaller::getInstance(); + + // Uninstall the chosen extensions + foreach ($eid as $id => $clientId) + { + $id = trim( $id ); + $result = $installer->uninstall($this->_type, $id, $clientId ); + + // Build an array of extensions that failed to uninstall + if ($result === false) { + $failed[] = $id; + } + } + + if (count($failed)) { + // There was an error in uninstalling the package + $msg = JText::sprintf('UNINSTALLEXT', JText::_($this->_type), JText::_('Error')); + $result = false; + } else { + // Package uninstalled sucessfully + $msg = JText::sprintf('UNINSTALLEXT', JText::_($this->_type), JText::_('Success')); + $result = true; + } + + $mainframe->enqueueMessage($msg); + $this->setState('action', 'remove'); + $this->setState('name', $installer->get('name')); + $this->setState('message', $installer->message); + $this->setState('extension.message', $installer->get('extension.message')); + + return $result; + } + + function _loadItems() + { + return JError::raiseError( 500, JText::_('Method Not Implemented')); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/models/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/models/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/models/install.php b/oss/joomla/trunk/administrator/components/com_jce/installer/models/install.php new file mode 100644 index 00000000..f420c627 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/models/install.php @@ -0,0 +1,242 @@ +setRedirect( JRoute::_( 'index.php?option=com_jce&client='. $client, false ) ); + } + + function install() + { + global $mainframe; + + $this->setState('action', 'install'); + + switch(JRequest::getWord('installtype')) + { + case 'folder': + $package = $this->_getPackageFromFolder(); + break; + + case 'upload': + $package = $this->_getPackageFromUpload(); + break; + + case 'url': + $package = $this->_getPackageFromUrl(); + break; + + default: + $this->setState('message', 'No Install Type Found'); + return false; + break; + } + + // Was the package unpacked? + if (!$package) { + $this->setState('message', 'Unable to find install package'); + return false; + } + + // Get a database connector + //$db = & JFactory::getDBO(); + + // Get an installer instance + require_once( JPATH_COMPONENT .DS. 'installer' .DS. 'installer.php' ); + $installer =& JCEInstaller::getInstance(); + + // Install the package + if (!$installer->install($package['dir'])) { + // There was an error installing the package + $msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Error')); + $result = false; + } else { + // Package installed sucessfully + $msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Success')); + $result = true; + } + + // Set some model state values + $mainframe->enqueueMessage($msg); + $this->setState('name', $installer->get('name')); + $this->setState('result', $result); + $this->setState('message', $installer->message); + $this->setState('extension.message', $installer->get('extension.message')); + + // Cleanup the install files + if (!is_file($package['packagefile'])) { + $config =& JFactory::getConfig(); + $package['packagefile'] = $config->getValue('config.tmp_path').DS.$package['packagefile']; + } + + JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); + + return $result; + } + + /** + * @param string The class name for the installer + */ + function _getPackageFromUpload() + { + // Get the uploaded file information + $userfile = JRequest::getVar('install_package', null, 'files', 'array' ); + + // Make sure that file uploads are enabled in php + if (!(bool) ini_get('file_uploads')) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('WARNINSTALLFILE')); + return false; + } + + // Make sure that zlib is loaded so that the package can be unpacked + if (!extension_loaded('zlib')) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('WARNINSTALLZLIB')); + return false; + } + + // If there is no uploaded file, we have a problem... + if (!is_array($userfile) ) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('No file selected')); + return false; + } + + // Check if there was a problem uploading the file. + if ( $userfile['error'] || $userfile['size'] < 1 ) + { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('WARNINSTALLUPLOADERROR')); + return false; + } + + // Build the appropriate paths + $config =& JFactory::getConfig(); + $tmp_dest = $config->getValue('config.tmp_path').DS.$userfile['name']; + $tmp_src = $userfile['tmp_name']; + + // Move uploaded file + jimport('joomla.filesystem.file'); + $uploaded = JFile::upload($tmp_src, $tmp_dest); + + // Unpack the downloaded package file + $package = JInstallerHelper::unpack($tmp_dest); + + return $package; + } + + /** + * Install an extension from a directory + * + * @static + * @return boolean True on success + * @since 1.0 + */ + function _getPackageFromFolder() + { + // Get the path to the package to install + $p_dir = JRequest::getString('install_directory'); + $p_dir = JPath::clean( $p_dir ); + + // Did you give us a valid directory? + if (!is_dir($p_dir)) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('Please enter a package directory')); + return false; + } + + // Detect the package type + $type = JInstallerHelper::detectType($p_dir); + + // Did you give us a valid package? + if (!$type) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('Path does not have a valid package')); + return false; + } + + $package['packagefile'] = null; + $package['extractdir'] = null; + $package['dir'] = $p_dir; + $package['type'] = $type; + + return $package; + } + + /** + * Install an extension from a URL + * + * @static + * @return boolean True on success + * @since 1.5 + */ + function _getPackageFromUrl() + { + // Get a database connector + $db = & JFactory::getDBO(); + + // Get the URL of the package to install + $url = JRequest::getString('install_url'); + + // Did you give us a URL? + if (!$url) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('Please enter a URL')); + return false; + } + + // Download the package at the URL given + $p_file = JInstallerHelper::downloadPackage($url); + + // Was the package downloaded? + if (!$p_file) { + JError::raiseWarning('SOME_ERROR_CODE', JText::_('Invalid URL')); + return false; + } + + $config =& JFactory::getConfig(); + $tmp_dest = $config->getValue('config.tmp_path'); + + // Unpack the downloaded package file + $package = JInstallerHelper::unpack($tmp_dest.DS.$p_file); + + return $package; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/models/language.php b/oss/joomla/trunk/administrator/components/com_jce/installer/models/language.php new file mode 100644 index 00000000..5f3b12e2 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/models/language.php @@ -0,0 +1,162 @@ +folder = $langDirs[$i]; + $lang->baseDir = $langBDir; + $languages[] = $lang; + } + $rows = array(); + $rowid = 0; + foreach ($languages as $language) + { + $files = JFolder::files( $language->baseDir.DS.$language->folder, '\.(com_jce)\.xml$' ); + foreach ($files as $file) + { + $data = JApplicationHelper::parseXMLInstallFile($language->baseDir.DS.$language->folder.DS.$file); + + $row = new StdClass(); + $row->id = $rowid; + $row->language = $language->baseDir.DS.$language->folder; + + // If we didn't get valid data from the xml file, move on... + if (!is_array($data)) { + continue; + } + + // Populate the row from the xml meta file + foreach($data as $key => $value) { + $row->$key = $value; + } + $row->jname = JString::strtolower( str_replace( " ", "_", $row->name ) ); + $rows[] = $row; + $rowid++; + } + } + $this->setState('pagination.total', count($rows)); + if($this->_state->get('pagination.limit') > 0) { + $this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') ); + } else { + $this->_items = $rows; + } + } + + /** + * Remove (uninstall) an extension + * + * @static + * @return boolean True on success + * @since 1.0 + */ + function remove($eid=array()) + { + global $mainframe; + + $lang =& JFactory::getLanguage(); + $lang->load('com_jce'); + + // Initialize variables + $failed = array (); + + /* + * Ensure eid is an array of extension ids + * TODO: If it isn't an array do we want to set an error and fail? + */ + if (!is_array($eid)) { + $eid = array ($eid); + } + // construct the list of all language + $this->_loadItems(); + + // Get a database connector + $db =& JFactory::getDBO(); + + // Get an installer object for the extension type + //jimport('joomla.installer.installer'); + require_once( JPATH_COMPONENT .DS. 'installer' .DS. 'installer.php' ); + $installer =& JCEInstaller::getInstance($db, $this->_type); + + // Uninstall the chosen extensions + foreach ($eid as $id) + { + $item = $this->_items[$id]; + $result = $installer->uninstall( 'language', $item->language ); + + // Build an array of extensions that failed to uninstall + if ($result === false) { + $failed[] = $id; + } + } + + if (count($failed)) { + // There was an error in uninstalling the package + $msg = JText::sprintf('UNINSTALLEXT', JText::_($this->_type), JText::_('Error')); + $result = false; + } else { + // Package uninstalled sucessfully + $msg = JText::sprintf('UNINSTALLEXT', JText::_($this->_type), JText::_('Success')); + $result = true; + } + + $mainframe->enqueueMessage($msg); + $this->setState('action', 'remove'); + $this->setState('message', $installer->message); + // re-construct the list of all language + $this->_loadItems(); + + return $result; + } + +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/models/plugin.php b/oss/joomla/trunk/administrator/components/com_jce/installer/models/plugin.php new file mode 100644 index 00000000..f4d3181b --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/models/plugin.php @@ -0,0 +1,96 @@ +setState('filter.string', $mainframe->getUserStateFromRequest( "com_jce.plugin.string", 'filter', '', 'string' )); + } + + function _loadItems() + { + global $mainframe, $option; + + // Get a database connector + $db = & JFactory::getDBO(); + + $where = null; + if ($search = $this->_state->get('filter.string')) { + $where .= ' AND title LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + } + + $query = 'SELECT id, title, type, name' . + ' FROM #__jce_plugins' . + ' WHERE type="plugin"' . + ' AND iscore=0' . + $where . + ' ORDER BY name'; + $db->setQuery($query); + $rows = $db->loadObjectList(); + + // Get the plugin base path + $baseDir = JPATH_PLUGINS .DS. 'editors' .DS. 'jce' .DS. 'tiny_mce' .DS. 'plugins'; + + $numRows = count($rows); + for ($i = 0; $i < $numRows; $i ++) { + $row = & $rows[$i]; + + // Get the plugin xml file + $xmlfile = $baseDir .DS. $row->name .DS. $row->name .".xml"; + + if (file_exists($xmlfile)) { + if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) { + foreach($data as $key => $value) + { + $row->$key = $value; + } + } + } + } + + $this->setState('pagination.total', $numRows); + if($this->_state->get('pagination.limit') > 0) { + $this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') ); + } else { + $this->_items = $rows; + } + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_ftp.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_ftp.php new file mode 100644 index 00000000..058ae1c4 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_ftp.php @@ -0,0 +1,31 @@ +
+ + + + + ftp)): ?> +

ftp->message); ?>

+ + + + + + + + + + + + + +
+ + + +
+ + + +
+ +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_message.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_message.php new file mode 100644 index 00000000..0d47df06 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/default_message.php @@ -0,0 +1,19 @@ +get('state'); + $message1 = $state->get('message'); + $message2 = $state->get('extension.message'); +?> + + + + + + + + + + + + + +
diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/view.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/view.php new file mode 100644 index 00000000..9a782dc2 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/default/view.php @@ -0,0 +1,75 @@ + JPATH_COMPONENT .DS. 'installer' + ) ); + $this->_addPath('template', dirname(__FILE__).DS.'tmpl'); + } + + function display($tpl=null) + { + /* + * Set toolbar items for the page + */ + JToolBarHelper::title( JText::_( 'JCE Installer'), 'install.png' ); + + // Document + $document = & JFactory::getDocument(); + $document->setTitle(JText::_('JCE Installer').' : '.JText::_( $this->getName() )); + + // Get data from the model + $state = &$this->get('State'); + + // Are there messages to display ? + $showMessage = false; + if ( is_object($state) ) + { + $message1 = $state->get('message'); + $message2 = $state->get('extension.message'); + $showMessage = ( $message1 || $message2 ); + } + + $this->assign('showMessage', $showMessage); + $this->assignRef('state', $state); + + JHTML::_('behavior.tooltip'); + parent::display($tpl); + } + + /** + * Should be overloaded by extending view + * + * @param int $index + */ + function loadItem($index=0) + { + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default.php new file mode 100644 index 00000000..786345aa --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default.php @@ -0,0 +1,41 @@ +
+ ftp) : ?> + loadTemplate('ftp'); ?> + + items)) : ?> + + + + + + + + + + + + + + + + + + + items), $rc=0; $i < $n; $i++, $rc = 1 - $rc) : ?> + loadItem($i); + echo $this->loadTemplate('item'); + ?> + + +
 
pagination->getListFooter(); ?>
+ + + + + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default_item.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default_item.php new file mode 100644 index 00000000..217b5ac6 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/default_item.php @@ -0,0 +1,13 @@ +item->index % 2; ?>" item->style; ?>> + pagination->getRowOffset( $this->item->index ); ?> + item->cbd; ?> /> + item->name; ?> + item->plugin; ?> + item->version != '' ? $this->item->version : ' '; ?> + item->creationdate != '' ? $this->item->creationdate : ' '; ?> + + + item->author != '' ? $this->item->author : ' '; ?> + + + diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/view.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/view.php new file mode 100644 index 00000000..4e1ecfe4 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/extension/view.php @@ -0,0 +1,61 @@ +get('Items'); + $pagination = &$this->get('Pagination'); + + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + + function loadItem($index=0) + { + $item =& $this->items[$index]; + $item->index = $index; + + $item->cbd = null; + $item->style = null; + + $item->author_info = @$item->authorEmail .'
'. @$item->authorUrl; + + $this->assignRef('item', $item); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default.php new file mode 100644 index 00000000..8ee99231 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default.php @@ -0,0 +1,4 @@ +showMessage) : ?> +loadTemplate('message'); ?> + +loadTemplate('form'); ?> diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default_form.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default_form.php new file mode 100644 index 00000000..66340726 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/default_form.php @@ -0,0 +1,70 @@ + + +
+ + ftp) : ?> + loadTemplate('ftp'); ?> + + + + + + + + + + +
+ + + + +
+ + + + + + + + + +
+ + + + +
+ + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/view.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/view.php new file mode 100644 index 00000000..66a97ec0 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/install/view.php @@ -0,0 +1,47 @@ +first = ''; + + $this->assignRef('paths', $paths); + $this->assignRef('state', $this->get('state')); + + parent::display($tpl); + } + +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default.php new file mode 100644 index 00000000..8af989d7 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default.php @@ -0,0 +1,49 @@ +
+ ftp) : ?> + loadTemplate('ftp'); ?> + + + + + + + + +
+ + items)) : ?> + + + + + + + + + + + + + + + + + + items), $rc=0; $i < $n; $i++, $rc = 1 - $rc) : ?> + loadItem($i); + echo $this->loadTemplate('item'); + ?> + + +
 
pagination->getListFooter(); ?>
+ + + + + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default_item.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default_item.php new file mode 100644 index 00000000..51e898f7 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/default_item.php @@ -0,0 +1,12 @@ +item->index % 2; ?>" item->style; ?>> + pagination->getRowOffset( $this->item->index ); ?> + item->cbd; ?> /> + item->name; ?> + item->version != '' ? $this->item->version : ' '; ?> + item->creationdate != '' ? $this->item->creationdate : ' '; ?> + + + item->author != '' ? $this->item->author : ' '; ?> + + + diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/view.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/view.php new file mode 100644 index 00000000..b9ee8342 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/language/view.php @@ -0,0 +1,64 @@ +get('Items'); + $pagination = &$this->get('Pagination'); + + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + function loadItem($index=0) + { + $item =& $this->items[$index]; + $item->index = $index; + + if ( basename( $item->language ) == 'en-GB') { + $item->cbd = 'disabled'; + $item->style = 'style="color:#999999;"'; + } else { + $item->cbd = null; + $item->style = null; + } + $item->author_info = @$item->authorEmail .'
'. @$item->authorUrl; + + $this->assignRef('item', $item); + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default.php new file mode 100644 index 00000000..6634c3b6 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default.php @@ -0,0 +1,40 @@ +
+ ftp) : ?> + loadTemplate('ftp'); ?> + + items)) : ?> + + + + + + + + + + + + + + + + + + items), $rc=0; $i < $n; $i++, $rc = 1 - $rc) : ?> + loadItem($i); + echo $this->loadTemplate('item'); + ?> + + +
 
pagination->getListFooter(); ?>
+ + + + + + + + + +
\ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default_item.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default_item.php new file mode 100644 index 00000000..ca1aaa1c --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/default_item.php @@ -0,0 +1,12 @@ +item->index % 2; ?>" item->style; ?>> + pagination->getRowOffset( $this->item->index ); ?> + item->cbd; ?> /> + item->name; ?> + item->version != '' ? $this->item->version : ' '; ?> + item->creationdate != '' ? $this->item->creationdate : ' '; ?> + + + item->author != '' ? $this->item->author : ' '; ?> + + + diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/index.html b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/view.php b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/view.php new file mode 100644 index 00000000..50e8a176 --- /dev/null +++ b/oss/joomla/trunk/administrator/components/com_jce/installer/views/plugin/view.php @@ -0,0 +1,61 @@ +get('Items'); + $pagination = &$this->get('Pagination'); + + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + + function loadItem($index=0) + { + $item =& $this->items[$index]; + $item->index = $index; + + $item->cbd = null; + $item->style = null; + + $item->author_info = @$item->authorEmail .'
'. @$item->authorUrl; + + $this->assignRef('item', $item); + } +} \ No newline at end of file