diff --git a/administrator/components/com_categories/views/categories/tmpl/default.php b/administrator/components/com_categories/views/categories/tmpl/default.php index 617a577382581..29fa24b50aae3 100644 --- a/administrator/components/com_categories/views/categories/tmpl/default.php +++ b/administrator/components/com_categories/views/categories/tmpl/default.php @@ -57,109 +57,10 @@
- - - - - - - - - - - - - - - - - - - items as $i => $item) : - $orderkey = array_search($item->id, $this->ordering[$item->parent_id]); - $canEdit = $user->authorise('core.edit', $extension.'.category.'.$item->id); - $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; - $canEditOwn = $user->authorise('core.edit.own', $extension.'.category.'.$item->id) && $item->created_user_id == $userId; - $canChange = $user->authorise('core.edit.state', $extension.'.category.'.$item->id) && $canCheckin; - ?> - - - - - - - - - - - -
- - - - - - - - - items, 'filesave.png', 'categories.saveorder'); ?> - - - - - state->get('list.direction'), $this->state->get('list.ordering')); ?> - - -
- pagination->getListFooter(); ?> -
- id); ?> - - |—', $item->level-1) ?> - checked_out) : ?> - editor, $item->checked_out_time, 'categories.', $canCheckin); ?> - - - - escape($item->title); ?> - - escape($item->title); ?> - -

- |—', $item->level-1) ?> - note)) : ?> - escape($item->alias));?> - - escape($item->alias), $this->escape($item->note));?> -

-
- published, $i, 'categories.', $canChange);?> - - - - pagination->orderUpIcon($i, isset($this->ordering[$item->parent_id][$orderkey - 1]), 'categories.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?> - pagination->orderDownIcon($i, $this->pagination->total, isset($this->ordering[$item->parent_id][$orderkey + 1]), 'categories.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> - - - class="text-area-order" /> - - - - - - escape($item->access_level); ?> - - language=='*'):?> - - - language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> - - - - id; ?> -
+table; +?> + loadTemplate('batch'); ?> @@ -169,7 +70,7 @@ - + diff --git a/administrator/components/com_categories/views/categories/view.html.php b/administrator/components/com_categories/views/categories/view.html.php index 138d7b7690db6..065ad601a7ac3 100644 --- a/administrator/components/com_categories/views/categories/view.html.php +++ b/administrator/components/com_categories/views/categories/view.html.php @@ -57,11 +57,110 @@ public function display($tpl = null) $options[] = JHtml::_('select.option', '10', JText::_('J10')); $this->assign('f_levels', $options); + + $this->prepareTable(); $this->addToolbar(); parent::display($tpl); } + /** + * Prepare the table of the view + * + * @since 2.5 + */ + protected function prepareTable() + { + $user = JFactory::getUser(); + $userId = $user->get('id'); + $extension = $this->escape($this->state->get('filter.extension')); + $listOrder = $this->escape($this->state->get('list.ordering')); + $listDirn = $this->escape($this->state->get('list.direction')); + $ordering = ($listOrder == 'a.lft'); + $saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc'); + + jimport('joomla.html.grid'); + $table = new JGrid(array('class' => 'adminlist')); + + $table->addColumn('checkbox') + ->addColumn('title') + ->addColumn('status') + ->addColumn('ordering') + ->addColumn('access') + ->addColumn('language') + ->addColumn('id') + ; + + $table->addRow(array(), 1) + ->setRowCell('checkbox', '', array('width' => '1%')) + ->setRowCell('title', JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder)) + ->setRowCell('status', JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder), array('width' => '5%')) + ->setRowCell('ordering', JHtml::_('grid.sort', 'JGRID_HEADING_ORDERING', 'a.lft', $listDirn, $listOrder). + ($saveOrder ? JHtml::_('grid.order', $this->items, 'filesave.png', 'categories.saveorder') : ''), array('width' => '10%')) + ->setRowCell('access', JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder), array('width' => '10%')) + ->setRowCell('language', JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $this->state->get('list.direction'), $this->state->get('list.ordering')), array('width' => '5%', 'class' => 'nowrap')) + ->setRowCell('id', JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder), array('width' => '1%', 'class' => 'nowrap')) + ; + + $table->addRow(array(), 2) + ->setRowCell('checkbox', $this->pagination->getListFooter(), array('colspan' => 15)) + ; + $originalOrders = array(); + + foreach ($this->items as $i => $item) { + $orderkey = array_search($item->id, $this->ordering[$item->parent_id]); + $canEdit = $user->authorise('core.edit', $extension.'.category.'.$item->id); + $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; + $canEditOwn = $user->authorise('core.edit.own', $extension.'.category.'.$item->id) && $item->created_user_id == $userId; + $canChange = $user->authorise('core.edit.state', $extension.'.category.'.$item->id) && $canCheckin; + + $table->addRow(array('class' => 'row'.($i % 2))) + ->setRowCell('checkbox', JHtml::_('grid.id', $i, $item->id), array('class' => 'center')); + $table->setRowCell('title', str_repeat('|—', $item->level-1)); + if ($item->checked_out) { + $table->setRowCell('title', JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'categories.', $canCheckin), array(), false); + } else { + if ($canEdit || $canEditOwn) { + $table->setRowCell('title', ' + '.$this->escape($item->title).'', array(), false); + } else { + $table->setRowCell('title', $this->escape($item->title), array(), false); + } + $table->setRowCell('title', '

+ '.str_repeat('|—', $item->level-1), array(), false); + if (empty($item->note)) { + $table->setRowCell('title', JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)), array(), false); + } else { + $table->setRowCell('title', JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)), array(), false); + } + $table->setRowCell('title', '

', array(), false); + } + + $table->setRowCell('status', JHtml::_('jgrid.published', $item->published, $i, 'categories.', $canChange), array('class' => 'center')); + + if ($canChange) { + if ($saveOrder) { + $table->setRowCell('ordering', ''.$this->pagination->orderUpIcon($i, isset($this->ordering[$item->parent_id][$orderkey - 1]), 'categories.orderup', 'JLIB_HTML_MOVE_UP', $ordering).'', array(), false); + $table->setRowCell('ordering', ''.$this->pagination->orderDownIcon($i, $this->pagination->total, isset($this->ordering[$item->parent_id][$orderkey + 1]), 'categories.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering).'', array(), false); + } + $disabled = $saveOrder ? '' : 'disabled="disabled"'; + $table->setRowCell('ordering', '', array(), false); + $originalOrders[] = $orderkey + 1; + } else { + $table->setRowCell('ordering', $orderkey + 1, array(), false); + } + + $table->setRowCell('ordering', '', array('class' => 'order'), false); + + $table->setRowCell('access', $this->escape($item->access_level), array('class' => 'center nowrap')) + ->setRowCell('language', ($item->language == '*') ? JText::alt('JALL','language') : ($item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED')), array('class' => 'center nowrap')) + ->setRowCell('id', ''.(int) $item->id.'', array('class' => 'center')); + } + + $this->originalOrders = $originalOrders; + $this->table = $table; + } + /** * Add the page title and toolbar. * @@ -135,7 +234,7 @@ protected function addToolbar() if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete', $component)) { JToolBarHelper::deleteList('', 'categories.delete', 'JTOOLBAR_EMPTY_TRASH'); } - elseif ($canDo->get('core.edit.state')) { + else if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('categories.trash'); JToolBarHelper::divider(); } diff --git a/administrator/components/com_users/views/users/tmpl/default.php b/administrator/components/com_users/views/users/tmpl/default.php index 409efe7c776eb..f21b515f57bb1 100644 --- a/administrator/components/com_users/views/users/tmpl/default.php +++ b/administrator/components/com_users/views/users/tmpl/default.php @@ -54,120 +54,9 @@
- - - - - - - - - - - - - - - - - - - - - - items as $i => $item) : - $canEdit = $canDo->get('core.edit'); - $canChange = $loggeduser->authorise('core.edit.state', 'com_users'); - // If this group is super admin and this user is not super admin, $canEdit is false - if ((!$loggeduser->authorise('core.admin')) && JAccess::check($item->id, 'core.admin')) { - $canEdit = false; - $canChange = false; - } - ?> - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- pagination->getListFooter(); ?> -
- - id); ?> - - - - - escape($item->name); ?> - - escape($item->name); ?> - - - - - - escape($item->username); ?> - - - id != $item->id) : ?> - block, 'users.unblock', 'users.block'); ?> - - block, 'users.block', null); ?> - - - block ? 'JNO' : 'JYES'); ?> - - - activation, 'users.activate', null); ?> - - group_names,"\n") > 1) : ?> - - - group_names); ?> - - - escape($item->email); ?> - - lastvisitDate!='0000-00-00 00:00:00'):?> - lastvisitDate, 'Y-m-d H:i:s'); ?> - - - - - registerDate, 'Y-m-d H:i:s'); ?> - - id; ?> -
+ table; + ?>
diff --git a/administrator/components/com_users/views/users/tmpl/modal.php b/administrator/components/com_users/views/users/tmpl/modal.php index 76da7f32862c5..ed5fa1eb534a4 100644 --- a/administrator/components/com_users/views/users/tmpl/modal.php +++ b/administrator/components/com_users/views/users/tmpl/modal.php @@ -38,46 +38,7 @@
- - - - - - - - - - - - - - - items as $item) : ?> - - - - - - - -
- - - - - -
- pagination->getListFooter(); ?> -
- - name; ?> - - username; ?> - - group_names); ?> -
+ table; ?>
diff --git a/administrator/components/com_users/views/users/view.html.php b/administrator/components/com_users/views/users/view.html.php index 18d0d99400d11..a52cf4885aa2b 100644 --- a/administrator/components/com_users/views/users/view.html.php +++ b/administrator/components/com_users/views/users/view.html.php @@ -37,10 +37,159 @@ public function display($tpl = null) JError::raiseError(500, implode("\n", $errors)); return false; } + + $this->prepareTable(); $this->addToolbar(); parent::display($tpl); } + + /** + * Prepare the table of the view + * + * @since 2.5 + */ + protected function prepareTable() + { + $canDo = UsersHelper::getActions(); + $listOrder = $this->escape($this->state->get('list.ordering')); + $listDirn = $this->escape($this->state->get('list.direction')); + $loggeduser = JFactory::getUser(); + + jimport('joomla.html.grid'); + $table = new JGrid(array('class' => 'adminlist')); + + if(JRequest::getCmd('layout') == 'modal') { + $field = JRequest::getCmd('field'); + $function = 'jSelectUser_'.$field; + + $table->addColumn('name')->addColumn('username')->addColumn('groups'); + $table->addRow(array(), 1) + ->setRowCell('name', JHtml::_('grid.sort', 'COM_USERS_HEADING_NAME', 'a.name', $listDirn, $listOrder), array('class' => 'left')) + ->setRowCell('username', JHtml::_('grid.sort', 'JGLOBAL_USERNAME', 'a.username', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '25%')) + ->setRowCell('groups', JHtml::_('grid.sort', 'COM_USERS_HEADING_GROUPS', 'group_names', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '25%')); + $table->addRow(array(), 2) + ->setRowCell('name', $this->pagination->getListFooter(), array('colspan' => 3)); + + $i = 0; + foreach ($this->items as $i => $item) { + $table->addRow(array('class' => 'row'.($i % 2))) + ->setRowCell('name', ' + '.$item->name.'') + ->setRowCell('username', $item->username, array('align' => 'center')) + ->setRowCell('groups', nl2br($item->group_names), array('align' => 'left')); + } + + $this->table = $table; + return; + } + + // Create columns + $table->addColumn('checkbox') + ->addColumn('name') + ->addColumn('username') + ->addColumn('enabled') + ->addColumn('activated') + ->addColumn('usergroups') + ->addColumn('email') + ->addColumn('lastvisit') + ->addColumn('registerdate') + ->addColumn('id'); + + // Create header row + $table->addRow(array(), 1) + ->setRowCell('checkbox', '', array('width' => '1%')) + ->setRowCell('name', JHtml::_('grid.sort', 'COM_USERS_HEADING_NAME', 'a.name', $listDirn, $listOrder), array('class' => 'left')) + ->setRowCell('username', JHtml::_('grid.sort', 'JGLOBAL_USERNAME', 'a.username', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '10%')) + ->setRowCell('enabled', JHtml::_('grid.sort', 'COM_USERS_HEADING_ENABLED', 'a.block', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '5%')) + ->setRowCell('activated', JHtml::_('grid.sort', 'COM_USERS_HEADING_ACTIVATED', 'a.activation', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '5%')) + ->setRowCell('usergroups', JText::_('COM_USERS_HEADING_GROUPS'), array('class' => 'nowrap', 'width' => '10%')) + ->setRowCell('email', JHtml::_('grid.sort', 'JGLOBAL_EMAIL', 'a.email', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '15%')) + ->setRowCell('lastvisit', JHtml::_('grid.sort', 'COM_USERS_HEADING_LAST_VISIT_DATE', 'a.lastvisitDate', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '10%')) + ->setRowCell('registerdate', JHtml::_('grid.sort', 'COM_USERS_HEADING_REGISTRATION_DATE', 'a.registerDate', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '10%')) + ->setRowCell('id', JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder), array('class' => 'nowrap', 'width' => '3%')) + ; + + // Create footer row + $table->addRow(array(), 2) + ->setRowCell('checkbox', $this->pagination->getListFooter(), array('colspan' => '15')) + ; + + //Create body rows + foreach ($this->items as $i => $item) + { + $canEdit = $canDo->get('core.edit'); + $canChange = $loggeduser->authorise('core.edit.state', 'com_users'); + // If this group is super admin and this user is not super admin, $canEdit is false + if ((!$loggeduser->authorise('core.admin')) && JAccess::check($item->id, 'core.admin')) + { + $canEdit = false; + $canChange = false; + } + $table->addRow(array('class' => 'row'.($i % 2))); + if ($canEdit) + { + $table->setRowCell('checkbox', JHtml::_('grid.id', $i, $item->id), array('class' => 'center')); + } + else + { + $table->setRowCell('checkbox', '', array('class' => 'center')); + } + if ($canEdit) + { + $table->setRowCell('name', ' + '.$this->escape($item->name).''); + } + else + { + $table->setRowCell('name', $this->escape($item->name)); + } + if (JDEBUG) + { + $table->setRowCell('name', '
', array(), false); + } + $table->setRowCell('username', $this->escape($item->username), array('class' => 'center')); + if ($canChange) + { + if ($loggeduser->id != $item->id) + { + $table->setRowCell('enabled', JHtml::_('grid.boolean', $i, !$item->block, 'users.unblock', 'users.block'), array('class' => 'center')); + } + else + { + $table->setRowCell('enabled', JHtml::_('grid.boolean', $i, !$item->block, 'users.block', null), array('class' => 'center')); + } + } + else + { + $table->setRowCell('enabled', JText::_($item->block ? 'JNO' : 'JYES'), array('class' => 'center')); + } + $table->setRowCell('activated', JHtml::_('grid.boolean', $i, !$item->activation, 'users.activate', null), array('class' => 'center')); + if (substr_count($item->group_names,"\n") > 1) + { + $table->setRowCell('usergroups', ''.JText::_('COM_USERS_USERS_MULTIPLE_GROUPS').'', array('class' => 'center')); + } + else + { + $table->setRowCell('usergroups', nl2br($item->group_names), array('class' => 'center')); + } + $table->setRowCell('email', $this->escape($item->email), array('class' => 'center')); + if ($item->lastvisitDate!='0000-00-00 00:00:00') + { + $table->setRowCell('lastvisit', JHtml::_('date',$item->lastvisitDate, 'Y-m-d H:i:s'), array('class' => 'center')); + } + else + { + $table->setRowCell('lastvisit', JText::_('JNEVER'), array('class' => 'center')); + } + $table->setRowCell('registerdate', JHtml::_('date',$item->registerDate, 'Y-m-d H:i:s'), array('class' => 'center')); + $table->setRowCell('id', (int) $item->id, array('class' => 'center')); + + } + + $this->table = $table; + } /** * Add the page title and toolbar. diff --git a/administrator/templates/hathor/html/com_categories/categories/default.php b/administrator/templates/hathor/html/com_categories/categories/default.php index fbb290240a98f..6c1de13d7332a 100644 --- a/administrator/templates/hathor/html/com_categories/categories/default.php +++ b/administrator/templates/hathor/html/com_categories/categories/default.php @@ -68,105 +68,20 @@
- - - - - - - - - - - - +table->setActiveRow(0) + ->setRowCell('checkbox', '', array('class' => 'checkmark-col'), false) + ->setRowCell('title', '', array('class' => 'title'), false) + ->setRowCell('status', '', array('class' => 'nowrap state-col'), false) + ->setRowCell('ordering', '', array('class' => 'nowrap ordering-col'), false) + ->setRowCell('access', '', array('class' => 'access-col'), false) + ->setRowCell('language', '', array('class' => 'language-col'), false) + ->setRowCell('id', '', array('class' => 'nowrap id-col'), false) +; - - items as $i => $item) : - $orderkey = array_search($item->id, $this->ordering[$item->parent_id]); - $canEdit = $user->authorise('core.edit', $extension.'.category.'.$item->id); - $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; - $canEditOwn = $user->authorise('core.edit.own', $extension.'.category.'.$item->id) && $item->created_user_id == $userId; - $canChange = $user->authorise('core.edit.state', $extension.'.category.'.$item->id) && $canCheckin; - ?> - - - - - - - - - - - -
- - - - - - - - - items, 'filesave.png', 'categories.saveorder'); ?> - - - - - state->get('list.direction'), $this->state->get('list.ordering')); ?> - - -
- id); ?> - - |—', $item->level-1) ?> - checked_out) : ?> - editor, $item->checked_out_time, 'categories.', $canCheckin); ?> - - - - escape($item->title); ?> - - escape($item->title); ?> - -

- |—', $item->level-1) ?> - note)) : ?> - escape($item->alias));?> - - escape($item->alias), $this->escape($item->note));?> -

-
- published, $i, 'categories.', $canChange);?> - - - - pagination->orderUpIcon($i, isset($this->ordering[$item->parent_id][$orderkey - 1]), 'categories.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?> - pagination->orderDownIcon($i, $this->pagination->total, isset($this->ordering[$item->parent_id][$orderkey + 1]), 'categories.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> - - - class="text-area-order" title="title; ?> order" /> - - - - - - escape($item->access_level); ?> - - language=='*'):?> - - - language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> - - - - id; ?> -
+echo $this->table; +?> -pagination->getListFooter(); ?>
@@ -177,7 +92,7 @@ - +
diff --git a/administrator/templates/hathor/html/com_users/users/default.php b/administrator/templates/hathor/html/com_users/users/default.php index 910fe0aad263a..1c2871bb69086 100644 --- a/administrator/templates/hathor/html/com_users/users/default.php +++ b/administrator/templates/hathor/html/com_users/users/default.php @@ -66,117 +66,22 @@
+table->getRows(1); +$this->table->setActiveRow(array_shift($headerrows)); +$this->table->setRowCell('checkbox', '', array('class' => 'checkmark-col'), false) + ->setRowCell('name', '', array('class' => 'title'), false) + ->setRowCell('username', '', array('class' => 'nowrap width-10'), false) + ->setRowCell('enabled', '', array('class' => 'nowrap width-5'), false) + ->setRowCell('activated', '', array('class' => 'nowrap width-5'), false) + ->setRowCell('usergroups', '', array('class' => 'nowrap width-10'), false) + ->setRowCell('email', '', array('class' => 'nowrap width-15'), false) + ->setRowCell('lastvisit', '', array('class' => 'nowrap width-15'), false) + ->setRowCell('registerdate', '', array('class' => 'nowrap width-15'), false) + ->setRowCell('id', '', array('class' => 'nowrap id-col'), false); - - - - - - - - - - - - - - - - - - items as $i => $item) : - $canEdit = $canDo->get('core.edit'); - $canChange = $loggeduser->authorise('core.edit.state', 'com_users'); - // If this group is super admin and this user is not super admin, $canEdit is false - if ((!$loggeduser->authorise('core.admin')) && JAccess::check($item->id, 'core.admin')) { - $canEdit = false; - $canChange = false; - } - ?> - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - id); ?> - - - - - escape($item->name); ?> - - escape($item->name); ?> - - - - - - escape($item->username); ?> - - - id != $item->id) : ?> - block, 'users.unblock', 'users.block'); ?> - - block, 'users.block', null); ?> - - - block ? 'JNO' : 'JYES'); ?> - - - activation, 'users.activate', null); ?> - - group_names,"\n") > 1) : ?> - - - group_names); ?> - - - escape($item->email); ?> - - lastvisitDate!='0000-00-00 00:00:00'):?> - lastvisitDate, 'Y-m-d H:i:s'); ?> - - - - - registerDate, 'Y-m-d H:i:s'); ?> - - id; ?> -
- - pagination->getListFooter(); ?> +echo $this->table; +?> diff --git a/administrator/templates/hathor/html/com_users/users/modal.php b/administrator/templates/hathor/html/com_users/users/modal.php index e85422a51c23a..084f2b55f5d68 100644 --- a/administrator/templates/hathor/html/com_users/users/modal.php +++ b/administrator/templates/hathor/html/com_users/users/modal.php @@ -39,43 +39,22 @@ +table->setTableOptions(array('class' => 'adminlist modal')); - - - - - - - - +$headerrows = $this->table->getRows(1); +$this->table->setActiveRow(array_shift($headerrows)); +$this->table->setRowCell('name', '', array('class' => 'title'), false) + ->setRowCell('username', '', array('class' => 'nowrap width-25'), false) + ->setRowCell('groups', '', array('class' => 'nowrap width-25'), false); - - items as $item) : ?> - - - - - - - - - - pagination->getListFooter(); ?> +$bodyrows = $this->table->getRows(); +foreach($bodyrows as $id) { + $this->table->setActiveRow($id) + ->setRowCell('groups', '', array('class' => 'title'), false); +} +echo $this->table; +?>