Permalink
Browse files

- testing and further code cleaning

Still
* pagination in backend missing on big table
  • Loading branch information...
1 parent 20f038a commit 91c2810e51bc97cce295be7739144459c5ae187e @cedricwalter committed Apr 10, 2012
@@ -20,15 +20,16 @@
$jinput = JFactory::getApplication()->input;
-$controller = JRequest::getVar('controller');
-// Require specific controller if requested
+$controller = JFactory::getApplication()->input->get('controller');
+$task = JFactory::getApplication()->input->get('task');
+
// Create the controller
$classname = 'CedTagController' . $controller;
$controller = new $classname();
// Perform the Request task
-$controller->execute(JRequest::getVar('task'));
+$controller->execute($task);
// Redirect if set by the controller
$controller->redirect();
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<extension type="component" version="2.5" method="upgrade">
- <name>cedTag</name>
- <element>com_cedtag</element>
- <creationDate>01.12.2011</creationDate>
- <author>Cedric Walter</author>
- <authorEmail>www.waltercedric.com</authorEmail>
- <authorUrl>www.waltercedric.com</authorUrl>
- <copyright>(c) 2011 Cedric Walter www.waltercedric.com</copyright>
- <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
- <version>2.5.0</version>
- <description><![CDATA[<h2>A real free tag system for joomla!</h2>]]></description>
-
- <install> <!-- Runs on install -->
- <sql>
- <file driver="mysql" charset="utf8">install.cedtags.sql</file>
- </sql>
- </install>
- <uninstall> <!-- Runs on uninstall -->
- <sql>
- <file driver="mysql" charset="utf8">uninstall.cedtags.sql</file>
- </sql>
- </uninstall>
-
- <languages folder="site">
- <language tag="en-GB">language/en-GB.com_cedtag.ini</language>
- <language tag="zh-CN">language/zh-CN.com_cedtag.ini</language>
- </languages>
-
- <media destination="com_cedtag">
- <folder>css</folder>
- <folder>images</folder>
- <folder>js</folder>
- </media>
-
- <files folder="site">
- <filename>controller.php</filename>
- <filename>index.html</filename>
- <filename>router.php</filename>
- <filename>cedtag.php</filename>
- <folder>views</folder>
- <folder>models</folder>
- <folder>helper</folder>
- <folder>images</folder>
- </files>
- <administration>
- <menu link="option=com_cedtag" img="class:cedtag">cedTag</menu>
-
- <files folder="admin">
- <filename>controller.php</filename>
- <filename>cedtag.php</filename>
- <filename>config.xml</filename>
- <filename>index.html</filename>
- <filename>install.cedtags.sql</filename>
- <filename>uninstall.cedtags.sql</filename>
- <folder>views</folder>
- <folder>models</folder>
- <folder>controllers</folder>
- </files>
- <languages folder="admin">
- <language tag="en-GB">language/en-GB.com_cedtag.ini</language>
- <language tag="zh-CN">language/zh-CN.com_cedtag.ini</language>
- </languages>
- </administration>
-</extension>
@@ -16,10 +16,9 @@ class CedTagController extends JController
{
protected $default_view = 'frontpage';
-
function display()
{
- $view = JRequest::getVar('view');
+ $view = JFactory::getApplication()->input->get('view');
if (!isset($view)) {
JFactory::getApplication()->input->set('view', 'frontpage');
}
@@ -35,7 +35,6 @@ function display()
parent::display();
}
-
function save()
{
$updatedCss = JFactory::getApplication()->input->get('csscontent', '', 'STRING');
@@ -58,7 +57,5 @@ function restore()
JFactory::getApplication()->input->set('view', 'css');
parent::display();
}
-
}
-
-?>
+?>
@@ -10,7 +10,7 @@
jimport('joomla.application.input');
-class CedTagControllerCedTag extends JController
+class CedTagControllerTag extends JController
{
function execute($task)
@@ -77,12 +77,14 @@ function clearAll()
function save()
{
- $id = JRequest::getVar('cid');
- $tags = JRequest::getVar('tags');
+ $id = JFactory::getApplication()->input->get('cid');
+ $tags = JFactory::getApplication()->input->get('tags');
+ //$id = JRequest::getVar('cid');
+ //$tags = JRequest::getVar('tags');
+
$combined = array();
$combined[$id] = $tags;
-
$model = $this->getModel('tag');
$msg = "";
$ok = $model->batchUpdate($combined);
@@ -91,7 +93,6 @@ function save()
} else {
$msg = JText::_('TAGS SUCCESSFULLY SAVED');
}
-
// echo('<script> alert("'.$msg.'"); window.history.go(-1); </script>');
echo "<script>window.parent.document.getElementById('sbox-window').close()</script>";
@@ -123,8 +124,6 @@ function array_combine($keys, $values)
}
return $result;
}
-
-
}
-?>
+?>
@@ -1,6 +1,7 @@
CREATE TABLE IF NOT EXISTS `#__cedtag_term` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
+ `alias` varchar(255) NOT NULL default '',
`description` text,
`weight` tinyint(4) NOT NULL default '0',
`hits` int(10) NOT NULL default '0',
@@ -14,6 +14,17 @@
class CedTagModelTag extends JModel
{
+ var $_pagination = null;
+ var $_total = null;
+ var $_defaultLimit = 10;
+
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->_defaultLimit = CedTagsHelper::param('page_limit', 10);
+ //$this->_loadData();
+ }
function clearAll()
{
@@ -46,16 +57,20 @@ function getTagList()
$db->query();
$total = $db->loadResult();
- $jinput = JFactory::getApplication()->input;
- $limitstart = $jinput->get('limitstart', 0, '', 'int');
+ $limitstart = JFactory::getApplication()->input->get('limitstart', 0, '', 'int');
$params = JComponentHelper::getParams('com_cedtag');
- $limit = $params->get('tag_page_limit', 30);
+ $defaultLimit = $params->get('tag_page_limit', 30);
$contentQuery = 'select id from #__content as c where 1=1' . $where;
- $db->setQuery($contentQuery, $limitstart, $limit);
+ $db->setQuery($contentQuery, $limitstart, $defaultLimit);
+
jimport('joomla.html.pagination');
$result = null;
- $result->page = new JPagination($total, $limitstart, $limit);
+
+ $this->_total = $total;
+ //pagination = new JPagination($total, $limitstart, $limit);
+
+
$contentIdsArray = $db->loadColumn();
$contentIds = implode(',', $contentIdsArray);
@@ -211,4 +226,21 @@ function isContentHasTags($cid)
function format()
{
}
+
+ function getTotal()
+ {
+ return $this->_total;
+ }
+
+ public function getPagination()
+ {
+ // Lets load the content if it doesn't already exist
+ if (empty($this->_pagination)) {
+ $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
+ jimport('joomla.html.pagination');
+ $this->_pagination = new JPagination($this->getTotal(), $limitstart, $this->_defaultLimit);
+ }
+
+ return $this->_pagination;
+ }
}
@@ -41,9 +41,7 @@
</tr>
</table>
-
- <input type="hidden" name="task" value="save"> <input type="hidden"
- name="controller"
- value="css"> <?php echo JHTML::_('form.token'); ?>
-
+ <input type="hidden" name="task" value="save">
+ <input type="hidden" name="controller" value="css">
+ <?php echo JHTML::_('form.token'); ?>
</form>
@@ -17,7 +17,7 @@
<div class="tagpanel">
<div style="float: left;">
- <div class="icon"><a href="index.php?option=com_cedtag&controller=cedtag"
+ <div class="icon"><a href="index.php?option=com_cedtag&controller=tag"
title="<?php echo JText::_('TAG MANAGER');?>"> <img
src="<? echo JURI::root() ?>/media/com_cedtag/images/tag.png"
alt="<?php echo JText::_('TAG MANAGER');?>"/> <span><?php echo JText::_('TAG MANAGER');?></span></a>
@@ -10,7 +10,6 @@
class CedTagViewFrontpage extends JView
{
-
function display($tpl = null)
{
$this->defaultTpl($tpl);
@@ -21,6 +20,4 @@ function defaultTpl($tpl = null)
JToolBarHelper::title(JText::_('JOOMLA TAGS'), 'tag.png');
parent::display($tpl);
}
-
-
}
@@ -19,7 +19,6 @@
<option value="jtags">JTags</option>
<option value="joomlatags">Joomla tags</option>
</select></td>
-
</tr>
<tr>
<td>&nbsp;</td>
@@ -28,9 +27,8 @@
</tr>
</table>
- <input type="hidden" name="task" value="import"> <input
- type="hidden" name="controller" value="import">
-
+ <input type="hidden" name="task" value="import">
+ <input type="hidden" name="controller" value="import">
<?php echo JHTML::_('form.token'); ?>
</form>
@@ -24,7 +24,8 @@
<td><textarea id="tags" name="tags" rows="5" cols="60"><?php echo($this->tags);?></textarea></td>
</tr>
<tr>
- <td><input type="submit" value="<?php echo JText::_('SAVE');?>"/>
+ <td>
+ <input type="submit" value="<?php echo JText::_('SAVE');?>"/>
<input type="button" name="cancel" value="<?php echo JText::_('CANCEL'); ?>"
onClick="document.getElementById('sbox-window').close();"/>
@@ -39,9 +39,12 @@ function autofill(tag) {
//alert(tag.style);
}
</script>
-<form action="index.php?controller=tag&option=com_cedtag" method="post"
- name="adminForm" id="adminForm" class="adminForm" autocomplete="off">
-
+<form action="index.php?controller=tag&option=com_cedtag"
+ method="post"
+ name="adminForm"
+ id="adminForm"
+ class="adminForm"
+ autocomplete="off">
<table>
<tr>
@@ -64,14 +67,9 @@ class="text_area" onchange="document.adminForm.submit();"/>
<th class="title" width="20%"><?php echo JText::_('ARTICLE');?></th>
<th class="title" width="10%"><?php echo JText::_('CATEGORY');?></th>
<th><?php echo JText::_('TAGS');?></th>
-
</tr>
</thead>
- <tfoot>
- <tr>
- <td colspan="13"><?php echo $this->tagList->page->getPagesLinks(); ?></td>
- </tr>
- </tfoot>
+
<tbody>
<?php
$k = 0;
@@ -107,13 +105,17 @@ class="text_area" onchange="document.adminForm.submit();"/>
<td><?php echo $row->category; ?></td>
<!-- TODO cedric size 400px css driven -->
- <td class="order"><span><input type="hidden" name="id[]"
- value="<?php echo $row->id;?>"/><input name="tag[]"
- value="<?php echo $row->tag; ?>"
- id="<?php echo 'tag_' . $row->id;?>"
- type="text" size="100"
- style="width: 400px;"
- onclick="autofill(<?php echo 'tag_' . $row->id;?>)"/></span>
+ <td class="order">
+ <span>
+ <input type="hidden" name="id[]"
+ value="<?php echo $row->id;?>"/>
+ <input name="tag[]"
+ value="<?php echo $row->tag; ?>"
+ id="<?php echo 'tag_' . $row->id;?>"
+ type="text" size="100"
+ style="width: 400px;"
+ onclick="autofill(<?php echo 'tag_' . $row->id;?>)"/>
+ </span>
</td>
<?php
}
@@ -132,11 +134,26 @@ class="text_area" onchange="document.adminForm.submit();"/>
?>
</tbody>
+
+ <tfoot>
+ <tr>
+ <td colspan="13">
+ <p class="counter">
+ <?php echo $this->pagination->getPagesCounter(); ?>
+ </p>
+ <?php echo $this->pagination->getListFooter(); ?>
+ </td>
+ </tr>
+ </tfoot>
+
</table>
- <input type="hidden" name="currenttag" id="currenttag"/><input
- type="hidden" name="boxchecked" value="0"/> <input type="hidden"
- name="task" value=""> <input type="hidden" name="controller"
- value="tag">
+
+
+ <input type="hidden" name="currenttag" id="currenttag"/>
+ <input type="hidden" name="boxchecked" value="0"/>
+ <input type="hidden" name="task" value="">
+ <input type="hidden" name="controller" value="tag">
<?php echo JHTML::_('form.token'); ?>
- <input type="hidden" name="limitstart"/></form>
+ <input type="hidden" name="limitstart"/>
+</form>
Oops, something went wrong.

0 comments on commit 91c2810

Please sign in to comment.