Skip to content

Commit 636732c

Browse files
committed
Merge pull request #1 from mambax7/master
Adding Tag 2.32 Beta 1
2 parents 821d906 + 308e853 commit 636732c

80 files changed

Lines changed: 5167 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tag/admin/about.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Tag module
4+
*
5+
* You may not change or alter any portion of this comment or credits
6+
* of supporting developers from this source code or any supporting source code
7+
* which is considered copyrighted (c) material of the original comment or credit authors.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
*
12+
* @copyright The XOOPS Project (http://www.xoops.org)
13+
* @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html)
14+
* @package Tag
15+
* @since 2.5.0
16+
* @author Mage, Mamba
17+
* @version $Id $
18+
**/
19+
include_once dirname(__FILE__) . '/admin_header.php';
20+
21+
xoops_cp_header();
22+
23+
$aboutAdmin = new ModuleAdmin();
24+
25+
echo $aboutAdmin->addNavigation('about.php');
26+
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
27+
28+
include 'admin_footer.php';

tag/admin/admin.tag.php

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* XOOPS tag management module
14+
*
15+
* @copyright The XOOPS project http://sourceforge.net/projects/xoops/
16+
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
17+
* @since 1.0.0
18+
* @author Taiwen Jiang <phppp@users.sourceforge.net>
19+
* @version $Id: admin.tag.php 11906 2013-08-14 05:54:12Z beckmi $
20+
* @package tag
21+
*/
22+
23+
include_once 'admin_header.php';
24+
require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
25+
$indexAdmin = new ModuleAdmin();
26+
27+
xoops_cp_header();
28+
29+
include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
30+
//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(1) : "";
31+
echo $indexAdmin->addNavigation('admin.tag.php');
32+
33+
global $xoopsModuleConfig;
34+
35+
$limit = $xoopsModuleConfig['items_perpage'];
36+
$modid = intval( empty($_GET['modid']) ? @$_POST['modid'] : $_GET['modid'] );
37+
$start = intval( empty($_GET['start']) ? @$_POST['start'] : $_GET['start'] );
38+
//$status = intval( empty($_GET['status']) ? @$_POST['status'] : $_GET['status']);
39+
40+
$status = intval( (isset($_GET['status']) && $_GET['status'] >-1) ? $_GET['status'] : -1);
41+
42+
43+
$tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
44+
45+
if (!empty($_POST['tags'])) {
46+
$msgDBUpdated='';
47+
foreach ($_POST['tags'] as $tag => $tag_status) {
48+
$tag_obj =& $tag_handler->get($tag);
49+
if (!is_object($tag_obj) || !$tag_obj->getVar("tag_id")) continue;
50+
if ($tag_status < 0) {
51+
$tag_handler->delete($tag_obj);
52+
} elseif ($tag_status != $tag_obj->getVar("tag_status")) {
53+
$tag_obj->setVar("tag_status", $tag_status);
54+
$tag_handler->insert($tag_obj);
55+
$msgDBUpdated = _AM_TAG_DB_UPDATED;
56+
}
57+
}
58+
redirect_header("admin.tag.php?modid={$modid}&amp;start={$start}&amp;status={$status}", 2, $msgDBUpdated);
59+
exit();
60+
}
61+
62+
$sql = " SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
63+
$sql .= " FROM " . $xoopsDB->prefix("tag_link");
64+
$sql .= " GROUP BY tag_modid";
65+
$counts_module = array();
66+
$module_list = array();
67+
if ( ($result = $xoopsDB->query($sql)) == false) {
68+
xoops_error($xoopsDB->error());
69+
} else {
70+
while ($myrow = $xoopsDB->fetchArray($result)) {
71+
$counts_module[$myrow["tag_modid"]] = $myrow["count_tag"];
72+
}
73+
if (!empty($counts_module)) {
74+
$module_handler =& xoops_gethandler("module");
75+
$module_list = $module_handler->getList(new Criteria("mid", "(" . implode(", ", array_keys($counts_module)) . ")", "IN"));
76+
}
77+
}
78+
79+
$opform = new XoopsSimpleForm('', 'moduleform', xoops_getenv("PHP_SELF"), "get");
80+
$tray = new XoopsFormElementTray('');
81+
$mod_select = new XoopsFormSelect(_SELECT, 'modid', $modid);
82+
$mod_select->addOption(0, _ALL);
83+
foreach ($module_list as $module => $module_name) {
84+
$mod_select->addOption($module, $module_name." (" . $counts_module[$module] . ")");
85+
}
86+
$tray->addElement($mod_select);
87+
$status_select = new XoopsFormRadio("", 'status', $status);
88+
$status_select->addOption(-1, _ALL);
89+
$status_select->addOption(1, TAG_AM_ACTIVE);
90+
$status_select->addOption(0, TAG_AM_INACTIVE);
91+
$tray->addElement($status_select);
92+
$tray->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
93+
$opform->addElement($tray);
94+
$opform->display();
95+
96+
$criteria = new CriteriaCompo();
97+
$criteria->setSort("a");
98+
$criteria->setOrder("ASC");
99+
$criteria->setStart($start);
100+
$criteria->setLimit($limit);
101+
if ($status >= 0) {
102+
$criteria->add( new Criteria("o.tag_status", $status) );
103+
}
104+
if (!empty($modid)) {
105+
$criteria->add( new Criteria("l.tag_modid", $modid) );
106+
}
107+
$tags = $tag_handler->getByLimit($criteria, false);
108+
109+
$form_tags = "<form name='tags' method='post' action='" . xoops_getenv("PHP_SELF") . "'>";
110+
$form_tags .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
111+
$form_tags .= "<tr align='center'>";
112+
$form_tags .= "<th class='bg3'>" . TAG_AM_TERM . "</td>";
113+
$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_ACTIVE . "</td>";
114+
$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_INACTIVE . "</td>";
115+
$form_tags .= "<th class='bg3' width='10%'>" . _DELETE . "</td>";
116+
$form_tags .= "</tr>";
117+
if (empty($tags)) {
118+
$form_tags .= "<tr><td colspan='4'>" . _NONE . "</td></tr>";
119+
} else {
120+
$class_tr = array("odd", "even");
121+
$i = 0;
122+
foreach (array_keys($tags) as $key) {
123+
$form_tags .= "<tr class='" . $class_tr[(++$i) % 2] . "'>";
124+
$form_tags .= "<td>" . $tags[$key]["term"] . "</td>";
125+
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='1' " . ( $tags[$key]["status"] ? "checked" : " '' ") . "></td>";
126+
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='0' " . ( $tags[$key]["status"] ? " '' " : "checked") . "></td>";
127+
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='-1'></td>";
128+
$form_tags .= "</tr>";
129+
}
130+
if ( !empty($start) || count($tags) >= $limit ) {
131+
$count_tag = $tag_handler->getCount($criteria);
132+
133+
include XOOPS_ROOT_PATH . "/class/pagenav.php";
134+
$nav = new XoopsPageNav($count_tag, $limit, $start, "start", "modid={$modid}&amp;status={$status}");
135+
$form_tags .= "<tr><td colspan='4' align='right'>" . $nav->renderNav(4) . "</td></tr>";
136+
}
137+
$form_tags .= "<tr><td colspan='4' align='center'>";
138+
$form_tags .= "<input type='hidden' name='status' value='{$status}'> ";
139+
$form_tags .= "<input type='hidden' name='start' value='{$start}'> ";
140+
$form_tags .= "<input type='hidden' name='modid' value='{$modid}'> ";
141+
$form_tags .= "<input type='submit' name='submit' value='" . _SUBMIT . "'> ";
142+
$form_tags .= "<input type='reset' name='submit' value='" . _CANCEL . "'>";
143+
$form_tags .= "</td></tr>";
144+
}
145+
$form_tags .= "</table>";
146+
$form_tags .= "</form>";
147+
148+
echo $form_tags;
149+
include "admin_footer.php";

tag/admin/admin_footer.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Tag module
4+
*
5+
* You may not change or alter any portion of this comment or credits
6+
* of supporting developers from this source code or any supporting source code
7+
* which is considered copyrighted (c) material of the original comment or credit authors.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
*
12+
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
13+
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
14+
* @package XOOPS Tag
15+
* @since 2.5.0
16+
* @author Mamba (www.xoops.org)
17+
* @version $Id $
18+
**/
19+
20+
echo "<div class='adminfooter'>\n"
21+
." <div style='text-align: center;'>\n"
22+
." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
23+
." </div>\n"
24+
." " . _AM_TAG_FOOTER . "\n"
25+
."</div>";
26+
27+
xoops_cp_footer();

tag/admin/admin_header.php

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* XOOPS tag management module
14+
*
15+
* @copyright The XOOPS project http://sourceforge.net/projects/xoops/
16+
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
17+
* @since 1.0.0
18+
* @author Taiwen Jiang <phppp@users.sourceforge.net>
19+
* @version $Id: admin_header.php 8564 2011-12-26 18:43:44Z beckmi $
20+
* @package tag
21+
*/
22+
23+
$path = dirname(dirname(dirname(dirname(__FILE__))));
24+
require_once $path . '/include/cp_header.php';
25+
26+
27+
require_once dirname(dirname(__FILE__)) . '/include/vars.php';
28+
require_once dirname(dirname(__FILE__)) . '/include/functions.php';
29+
30+
$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname');
31+
32+
// Load language files
33+
xoops_loadLanguage('admin', $thisModuleDir);
34+
xoops_loadLanguage('modinfo', $thisModuleDir);
35+
xoops_loadLanguage('main', $thisModuleDir);
36+
37+
$pathIcon16 = '../'.$xoopsModule->getInfo('icons16');
38+
$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
39+
$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
40+
41+
if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){
42+
include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php');
43+
}else{
44+
redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false);
45+
}
46+
47+
IF (!@ include_once XOOPS_ROOT_PATH . "/Frameworks/art/functions.admin.php"):
48+
49+
function loadModuleAdminMenu($currentoption, $breadcrumb = "")
50+
{
51+
if (!$adminmenu = $GLOBALS["xoopsModule"]->getAdminMenu()) {
52+
return false;
53+
}
54+
55+
$breadcrumb = empty($breadcrumb) ? $adminmenu[$currentoption]["title"] : $breadcrumb;
56+
$module_link = XOOPS_URL . "/modules/" . $GLOBALS["xoopsModule"]->getVar("dirname") . "/";
57+
$image_link = XOOPS_URL . "/modules/" . $GLOBALS["xoopsModule"]->getVar("dirname") . "/images";
58+
59+
$adminmenu_text ='
60+
<style type="text/css">
61+
<!--
62+
#buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0;}
63+
#buttonbar { float:left; width:100%; background: #e7e7e7 url("'.$image_link.'/modadminbg.gif") repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 12px;}
64+
#buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }
65+
#buttonbar li { display:inline; margin:0; padding:0; }
66+
#buttonbar a { float:left; background:url("'.$image_link.'/left_both.gif") no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; }
67+
#buttonbar a span { float:left; display:block; background:url("'.$image_link.'/right_both.gif") no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }
68+
/* Commented Backslash Hack hides rule from IE5-Mac \*/
69+
#buttonbar a span {float:none;}
70+
/* End IE5-Mac hack */
71+
#buttonbar a:hover span { color:#333; }
72+
#buttonbar .current a { background-position:0 -150px; border-width:0; }
73+
#buttonbar .current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }
74+
#buttonbar a:hover { background-position:0% -150px; }
75+
#buttonbar a:hover span { background-position:100% -150px; }
76+
//-->
77+
</style>
78+
<div id="buttontop">
79+
<table style="width: 100%; padding: 0; " cellspacing="0">
80+
<tr>
81+
<td style="width: 70%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;">
82+
<a href="../index.php">' . $GLOBALS["xoopsModule"]->getVar("name") . '</a>
83+
</td>
84+
<td style="width: 30%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;">
85+
<strong>' . $GLOBALS["xoopsModule"]->getVar("name") . '</strong>&nbsp;' . $breadcrumb . '
86+
</td>
87+
</tr>
88+
</table>
89+
</div>
90+
<div id="buttonbar">
91+
<ul>
92+
';
93+
foreach (array_keys($adminmenu) as $key) {
94+
$adminmenu_text .= (($currentoption == $key) ? '<li class="current">' : '<li>') . '<a href="' . $module_link . $adminmenu[$key]["link"] . '"><span>' . $adminmenu[$key]["title"] . '</span></a></li>';
95+
}
96+
$adminmenu_text .= '<li><a href="' . XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $GLOBALS["xoopsModule"]->getVar("mid") . '"><span>' . _PREFERENCES . '</span></a></li>';
97+
$adminmenu_text .= '
98+
</ul>
99+
</div>
100+
<br style="clear:both;" />';
101+
102+
echo $adminmenu_text;
103+
}
104+
105+
ENDIF;
106+
?>

tag/admin/index.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* XOOPS tag management module
14+
*
15+
* @copyright The XOOPS project http://sourceforge.net/projects/xoops/
16+
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
17+
* @since 1.0.0
18+
* @author Taiwen Jiang <phppp@users.sourceforge.net>
19+
* @version $Id: index.php 10505 2012-12-23 03:33:54Z beckmi $
20+
* @package tag
21+
*/
22+
include_once 'admin_header.php';
23+
xoops_cp_header();
24+
25+
include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
26+
//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(0) : "";
27+
28+
$indexAdmin = new ModuleAdmin();
29+
30+
$tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
31+
$count_tag = $tag_handler->getCount();
32+
33+
$count_item = 0;
34+
$sql = " SELECT COUNT(DISTINCT tl_id) FROM " . $xoopsDB->prefix("tag_link");
35+
if ( ($result = $xoopsDB->query($sql)) == false) {
36+
xoops_error($xoopsDB->error());
37+
} else {
38+
list($count_item) = $xoopsDB->fetchRow($result);
39+
}
40+
41+
$sql = " SELECT tag_modid, SUM(tag_count) AS count_item, COUNT(DISTINCT tag_id) AS count_tag";
42+
$sql .= " FROM " . $xoopsDB->prefix("tag_stats");
43+
$sql .= " GROUP BY tag_modid";
44+
$counts_module = array();
45+
if( ($result = $xoopsDB->query($sql)) == false) {
46+
xoops_error($xoopsDB->error());
47+
} else {
48+
while ($myrow = $xoopsDB->fetchArray($result)) {
49+
$counts_module[$myrow["tag_modid"]] = array("count_item" => $myrow["count_item"], "count_tag" => $myrow["count_tag"]);
50+
}
51+
if (!empty($counts_module)) {
52+
$module_handler =& xoops_gethandler("module");
53+
$module_list = $module_handler->getList(new Criteria("mid", "(" . implode(", ", array_keys($counts_module)) . ")", "IN"));
54+
}
55+
}
56+
57+
$indexAdmin->addInfoBox(TAG_AM_STATS) ;
58+
$indexAdmin->addInfoBoxLine(TAG_AM_STATS, "<infolabel>" .TAG_AM_COUNT_TAG. "</infolabel>" , $count_tag) ;
59+
$indexAdmin->addInfoBoxLine(TAG_AM_STATS, "<infolabel>" .TAG_AM_COUNT_ITEM. "</infolabel>" , $count_item ."<br /><br />") ;
60+
$indexAdmin->addInfoBoxLine(TAG_AM_STATS, "<infolabel>" . TAG_AM_COUNT_MODULE. "</infolabel><infotext>" .TAG_AM_COUNT_MODULE_TITLE."</infotext>") ;
61+
62+
foreach ($counts_module as $module => $count) {
63+
$indexAdmin->addInfoBoxLine( TAG_AM_STATS,("<infolabel>" . $module_list[$module] . ":</infolabel><infotext>" . $count["count_tag"] . " / " . $count["count_item"] . " [<a href=\"" . XOOPS_URL . "/modules/tag/admin/admin.tag.php?modid={$module}\">" . TAG_AM_EDIT . "</a>] [<a href=\"" . XOOPS_URL . "/modules/tag/admin/syn.tag.php?modid={$module}\">" . TAG_AM_SYNCHRONIZATION . "</a>]</infotext> "));
64+
}
65+
66+
echo $indexAdmin->addNavigation('index.php');
67+
echo $indexAdmin->renderIndex();
68+
69+
include "admin_footer.php";
70+
//xoops_cp_footer();

0 commit comments

Comments
 (0)