Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- testing and further code cleaning

Still
* pagination in backend missing on big table
  • Loading branch information...
commit 91c2810e51bc97cce295be7739144459c5ae187e 1 parent 20f038a
@cedricwalter authored
View
7 com_cedTag/admin/cedtag.php
@@ -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();
View
65 com_cedTag/admin/cedtag.xml
@@ -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>
View
3  com_cedTag/admin/controller.php
@@ -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');
}
View
5 com_cedTag/admin/controllers/css.php
@@ -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();
}
-
}
-
-?>
+?>
View
15 com_cedTag/admin/controllers/tag.php
@@ -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;
}
-
-
}
-?>
+?>
View
1  com_cedTag/admin/install.cedtags.sql
@@ -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',
View
42 com_cedTag/admin/models/tag.php
@@ -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;
+ }
}
View
8 com_cedTag/admin/views/css/tmpl/default.php
@@ -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>
View
2  com_cedTag/admin/views/frontpage/tmpl/default.php
@@ -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>
View
3  com_cedTag/admin/views/frontpage/view.html.php
@@ -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);
}
-
-
}
View
6 com_cedTag/admin/views/import/tmpl/default.php
@@ -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>
View
3  com_cedTag/admin/views/tag/tmpl/add.php
@@ -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();"/>
View
59 com_cedTag/admin/views/tag/tmpl/default.php
@@ -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>
View
13 com_cedTag/admin/views/tag/tmpl/warning.php
@@ -7,24 +7,25 @@
**/
defined('_JEXEC') or die('Restricted access');
-$firstWarning = JRequest::getVar('FirstWarning', true);
-$warning = JRequest::getVar('tagsWarning', 'FIRST_SAVE_WARNING');
+
+$firstWarning = JFactory::getApplication()->input->get('FirstWarning', true, 'boolean');
+$warning = JFactory::getApplication()->input->get('tagsWarning', 'FIRST_SAVE_WARNING', 'string');
+
if ($firstWarning) {
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::root() . '/media/com_cedtag/css/tag.css');
-
?>
<div class="warning">
- <h1><?php echo JText::_('WARNING');?></h1>
-
+ <h1>
+ <?php echo JText::_('WARNING');?>
+ </h1>
<h2>
<?php echo JText::_('FIRST_SAVE_WARNING');?>
</h2>
</div>
<?php
}
-;
JFactory::getApplication()->input->set('FirstWarning', false);
?>
View
11 com_cedTag/admin/views/tag/view.html.php
@@ -13,9 +13,12 @@
class CedTagViewTag extends JView
{
+ var $pagination = null;
+
function display($tpl = null)
{
+ $this->pagination = $this->get('Pagination');
$layout = JInput::get('layout', "default", 'STRING');
switch ($layout) {
case 'add':
@@ -27,8 +30,6 @@ function display($tpl = null)
default:
$this->defaultTpl($tpl);
}
-
-
}
function defaultTpl($tpl = null)
@@ -39,14 +40,18 @@ function defaultTpl($tpl = null)
JToolBarHelper::custom('clearall', 'delete', '', JText::_('CLEAR ALL'), false);
JToolBarHelper::spacer();
JToolBarHelper::back(JText::_('CONTROL PANEL'), 'index.php?option=com_cedtag');
+
//get params
$params = JComponentHelper::getParams('com_cedtag');
$this->assignRef('params', $params);
+
//get data
$tagList =& $this->get('tagList');
-
$this->assignRef('tagList', $tagList);
+ $this->pagination = $this->get('Pagination');
+
+
parent::display($tpl);
}
View
5 com_cedTag/site/helper/helper.php
@@ -165,9 +165,10 @@ static function tripChars($name)
static function isValidName($name)
{
$valid = true;
-
$name = CedTagsHelper::preHandle($name);
- if (empty($name)) $valid = false;
+ if (empty($name)) {
+ $valid = false;
+ }
if ($valid) {
return $name;
View
7 com_cedTag/site/models/tag.php
@@ -69,8 +69,7 @@ function _loadData()
{
$query = $this->_buildQuery();
if ($this->_termExist) {
- $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
-
+ $limitstart = JFactory::getApplication()->input->get('limitstart', 0 , 'int');
$this->_data = $this->_getList($query, $limitstart, $this->_defaultLimit);
}
}
@@ -80,11 +79,11 @@ function getTotal()
return $this->_total;
}
- function getPagination()
+ public function getPagination()
{
// Lets load the content if it doesn't already exist
if (empty($this->_pagination)) {
- $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
+ $limitstart = JFactory::getApplication()->input->get('limitstart', 0 , 'int');
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($this->getTotal(), $limitstart, $this->_defaultLimit);
}
View
28 com_cedTag/site/views/tag/tmpl/default.php
@@ -7,7 +7,8 @@
**/
defined('_JEXEC') or die('Restricted access');
-$tag = JRequest::getVar('tag', null);
+$tag = JFactory::getApplication()->input->get('tag', null, 'string');
+
$tagKeyword = JText::_('TAG:') . $tag;
$params = JComponentHelper::getParams('com_cedtag');
@@ -36,20 +37,21 @@
?>
<tr class="sectiontableentry<?php echo($odd + 1);?>">
<td>
- <div><span class="small"><?php echo (++$count) . '. ';?></span> <a
- href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($result->slug, $result->catslug)); ?>">
- <?php echo $this->escape($result->title);?> </a></div>
+ <div>
+ <span class="small">
+ <?php echo (++$count) . '. ';?>
+ </span>
+ <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($result->slug, $result->catslug)); ?>">
+ <?php echo $this->escape($result->title);?>
+ </a>
+ </div>
</td>
</tr>
<?php
$odd = 1 - $odd;
}
} ?>
- <tr>
- <td>
- <div class="pagination"><?php echo $this->pagination->getPagesLinks(); ?></div>
- </td>
- </tr>
+
<?php
if (isset($bottomAds) && $bottomAds) {
echo('<tr><td>' . $bottomAds . '</td></tr>');
@@ -57,6 +59,14 @@
?>
<!-- Tags for Joomla by www.waltercedric.com -->
</table>
+<div class="pagination">
+ <p class="counter">
+ <?php echo $this->pagination->getPagesCounter(); ?>
+ </p>
+ <?php echo $this->pagination->getPagesLinks(); ?>
+</div>
+
+
<?php
$document =& JFactory::getDocument();
Please sign in to comment.
Something went wrong with that request. Please try again.