|
From: <be...@us...> - 2013-08-14 05:54:15
|
Revision: 11906
http://sourceforge.net/p/xoops/svn/11906
Author: beckmi
Date: 2013-08-14 05:54:12 +0000 (Wed, 14 Aug 2013)
Log Message:
-----------
fixing some minor issues (see changelog.txt), updating to 2.32 Beta 1
Modified Paths:
--------------
XoopsModules/tag/trunk/tag/admin/about.php
XoopsModules/tag/trunk/tag/admin/admin.tag.php
XoopsModules/tag/trunk/tag/class/tag.php
XoopsModules/tag/trunk/tag/docs/changelog.txt
XoopsModules/tag/trunk/tag/docs/lang_diff.txt
XoopsModules/tag/trunk/tag/language/english/admin.php
XoopsModules/tag/trunk/tag/view.tag.php
XoopsModules/tag/trunk/tag/xoops_version.php
Added Paths:
-----------
XoopsModules/tag/trunk/tag/include/index.html
XoopsModules/tag/trunk/tag/plugin/index.html
XoopsModules/tag/trunk/tag/plugin/myalbum.php
XoopsModules/tag/trunk/tag/plugin/myalbum0.php
XoopsModules/tag/trunk/tag/plugin/myalbum1.php
XoopsModules/tag/trunk/tag/plugin/myalbum2.php
XoopsModules/tag/trunk/tag/templates/blocks/index.html
Modified: XoopsModules/tag/trunk/tag/admin/about.php
===================================================================
--- XoopsModules/tag/trunk/tag/admin/about.php 2013-08-14 05:25:33 UTC (rev 11905)
+++ XoopsModules/tag/trunk/tag/admin/about.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright The XOOPS Project (http://www.xoops.org)
- * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/)
+ * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Tag
* @since 2.5.0
* @author Mage, Mamba
Modified: XoopsModules/tag/trunk/tag/admin/admin.tag.php
===================================================================
--- XoopsModules/tag/trunk/tag/admin/admin.tag.php 2013-08-14 05:25:33 UTC (rev 11905)
+++ XoopsModules/tag/trunk/tag/admin/admin.tag.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -30,14 +30,20 @@
//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(1) : "";
echo $indexAdmin->addNavigation('admin.tag.php');
-$limit = 10;
+global $xoopsModuleConfig;
+
+$limit = $xoopsModuleConfig['items_perpage'];
$modid = intval( empty($_GET['modid']) ? @$_POST['modid'] : $_GET['modid'] );
$start = intval( empty($_GET['start']) ? @$_POST['start'] : $_GET['start'] );
-$status = intval( empty($_GET['status']) ? @$_POST['status'] : $_GET['status'] );
+//$status = intval( empty($_GET['status']) ? @$_POST['status'] : $_GET['status']);
+$status = intval( (isset($_GET['status']) && $_GET['status'] >-1) ? $_GET['status'] : -1);
+
+
$tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
if (!empty($_POST['tags'])) {
+ $msgDBUpdated='';
foreach ($_POST['tags'] as $tag => $tag_status) {
$tag_obj =& $tag_handler->get($tag);
if (!is_object($tag_obj) || !$tag_obj->getVar("tag_id")) continue;
@@ -46,9 +52,10 @@
} elseif ($tag_status != $tag_obj->getVar("tag_status")) {
$tag_obj->setVar("tag_status", $tag_status);
$tag_handler->insert($tag_obj);
+ $msgDBUpdated = _AM_TAG_DB_UPDATED;
}
}
- redirect_header("admin.tag.php?modid={$modid}&start={$start}&status={$status}", 2);
+ redirect_header("admin.tag.php?modid={$modid}&start={$start}&status={$status}", 2, $msgDBUpdated);
exit();
}
@@ -79,8 +86,8 @@
$tray->addElement($mod_select);
$status_select = new XoopsFormRadio("", 'status', $status);
$status_select->addOption(-1, _ALL);
-$status_select->addOption(0, TAG_AM_ACTIVE);
-$status_select->addOption(1, TAG_AM_INACTIVE);
+$status_select->addOption(1, TAG_AM_ACTIVE);
+$status_select->addOption(0, TAG_AM_INACTIVE);
$tray->addElement($status_select);
$tray->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$opform->addElement($tray);
@@ -102,10 +109,10 @@
$form_tags = "<form name='tags' method='post' action='" . xoops_getenv("PHP_SELF") . "'>";
$form_tags .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
$form_tags .= "<tr align='center'>";
-$form_tags .= "<td class='bg3'>" . TAG_AM_TERM . "</td>";
-$form_tags .= "<td class='bg3' width='10%'>" . TAG_AM_ACTIVE . "</td>";
-$form_tags .= "<td class='bg3' width='10%'>" . TAG_AM_INACTIVE . "</td>";
-$form_tags .= "<td class='bg3' width='10%'>" . _DELETE . "</td>";
+$form_tags .= "<th class='bg3'>" . TAG_AM_TERM . "</td>";
+$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_ACTIVE . "</td>";
+$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_INACTIVE . "</td>";
+$form_tags .= "<th class='bg3' width='10%'>" . _DELETE . "</td>";
$form_tags .= "</tr>";
if (empty($tags)) {
$form_tags .= "<tr><td colspan='4'>" . _NONE . "</td></tr>";
@@ -115,8 +122,8 @@
foreach (array_keys($tags) as $key) {
$form_tags .= "<tr class='" . $class_tr[(++$i) % 2] . "'>";
$form_tags .= "<td>" . $tags[$key]["term"] . "</td>";
- $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='0' " . ( $tags[$key]["status"] ? "" : " 'checked' ") . "></td>";
- $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='1' " . ( $tags[$key]["status"] ? " 'checked' " : "") . "></td>";
+ $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='1' " . ( $tags[$key]["status"] ? "checked" : " '' ") . "></td>";
+ $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='0' " . ( $tags[$key]["status"] ? " '' " : "checked") . "></td>";
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='-1'></td>";
$form_tags .= "</tr>";
}
@@ -140,4 +147,3 @@
echo $form_tags;
include "admin_footer.php";
-//xoops_cp_footer();
\ No newline at end of file
Modified: XoopsModules/tag/trunk/tag/class/tag.php
===================================================================
--- XoopsModules/tag/trunk/tag/class/tag.php 2013-08-14 05:25:33 UTC (rev 11905)
+++ XoopsModules/tag/trunk/tag/class/tag.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -316,39 +316,36 @@
$order = strtoupper($order);
$sort = strtolower($sort);
- switch($sort) {
- case "a":
- case "alphabet":
- $order = ("DESC" != $order) ? "ASC" : "DESC";
- $sql .= " ORDER BY o.tag_term {$order}";
- break;
- case "id":
- case "time":
- $order = ("ASC" != $order) ? "DESC" : "ASC";
- $sql .= " ORDER BY o.{$this->keyName} {$order}";
- break;
- case "c":
- case "count":
- default:
- $order = ("ASC" != $order) ? "DESC" : "ASC";
- $sql .= " ORDER BY count {$order}";
- break;
+ switch ($sort) {
+ case "a":
+ case "alphabet":
+ $order = ("DESC" != $order) ? "ASC" : "DESC";
+ $sql .= " ORDER BY o.tag_term {$order}";
+ break;
+ case "id":
+ case "time":
+ $order = ("ASC" != $order) ? "DESC" : "ASC";
+ $sql .= " ORDER BY o.{$this->keyName} {$order}";
+ break;
+ case "c":
+ case "count":
+ default:
+ $order = ("ASC" != $order) ? "DESC" : "ASC";
+ $sql .= " ORDER BY count {$order}";
+ break;
}
-
- if ( ($result = $this->db->query($sql, $limit, $start)) == false) {
+
+ if (($result = $this->db->query($sql, $limit, $start)) == false) {
//xoops_error($this->db->error());
return null;
}
- while($myrow = $this->db->fetchArray($result)) {
- $ret[$myrow[$this->keyName]] = array(
- "id" => $myrow[$this->keyName],
- "term" => htmlspecialchars($myrow["tag_term"]),
- "status"=> $myrow["tag_status"],
- "modid" => $myrow["tag_modid"],
- "count" => intval($myrow["count"]),
- );
+ while ($myrow = $this->db->fetchArray($result)) {
+ $ret[$myrow[$this->keyName]] = array("id" => $myrow[$this->keyName],
+ "term" => htmlspecialchars($myrow["tag_term"]),
+ "status" => $myrow["tag_status"], "modid" => $myrow["tag_modid"],
+ "count" => intval($myrow["count"]),);
}
-
+
return $ret;
}
Modified: XoopsModules/tag/trunk/tag/docs/changelog.txt
===================================================================
--- XoopsModules/tag/trunk/tag/docs/changelog.txt 2013-08-14 05:25:33 UTC (rev 11905)
+++ XoopsModules/tag/trunk/tag/docs/changelog.txt 2013-08-14 05:54:12 UTC (rev 11906)
@@ -1,8 +1,15 @@
-2.31 Final (Dec. 12, 2011)
+2.32 Beta 1 (2013-08-12)
=========================
++ fixed pagination (mamba)
++ fixed updates and refresh of links in admin (mamba)
++ Items per page taken now from Preferences (mamba)
++ standardized look of the table in Tag Admin
+
+
+2.31 Final (Dec. 12, 2012)
+=========================
+ small code adjustments
-
2.31 Beta (July 10, 2011)
=================================
- removed all icon files and point them to /Frameworks/moduleclasses (Mamba)
Modified: XoopsModules/tag/trunk/tag/docs/lang_diff.txt
===================================================================
--- XoopsModules/tag/trunk/tag/docs/lang_diff.txt 2013-08-14 05:25:33 UTC (rev 11905)
+++ XoopsModules/tag/trunk/tag/docs/lang_diff.txt 2013-08-14 05:54:12 UTC (rev 11906)
@@ -1,4 +1,16 @@
LANGUAGE DIFFERENCES
=====================
-Below are language differences from a version to next version.
\ No newline at end of file
+Below are language differences from a version to next version.
+
+Legend :
++ Added
+- Removed
+* Modified
+
+2.32
+==============
+
+main.php:
+
++ define('_AM_TAG_DB_UPDATED', 'Database Updated Successfully');
Added: XoopsModules/tag/trunk/tag/include/index.html
===================================================================
--- XoopsModules/tag/trunk/tag/include/index.html (rev 0)
+++ XoopsModules/tag/trunk/tag/include/index.html 2013-08-14 05:54:12 UTC (rev 11906)
@@ -0,0 +1 @@
+<script>history.go(-1);</script>
\ No newline at end of file
Modified: XoopsModules/tag/trunk/tag/language/english/admin.php
===================================================================
--- XoopsModules/tag/trunk/tag/language/english/admin.php 2013-08-14 05:25:33 UTC (rev 11905)
+++ XoopsModules/tag/trunk/tag/language/english/admin.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -55,4 +55,8 @@
//define('_AM_TAG_MISSING','Error: The ModuleAdmin class is missing. Please install the ModuleAdmin Class into /Frameworks (see /docs/readme.txt)');
// Text for Admin footer
-define("_AM_TAG_FOOTER","<div class='center smallsmall italic pad5'>Tag Module is maintained by the <a class='tooltip' rel='external' href='http://xoops.org/' title='Visit XOOPS Community'>XOOPS Community</a></div>");
\ No newline at end of file
+define("_AM_TAG_FOOTER","<div class='center smallsmall italic pad5'>Tag Module is maintained by the <a class='tooltip' rel='external' href='http://xoops.org/' title='Visit XOOPS Community'>XOOPS Community</a></div>");
+
+//2.32
+define('_AM_TAG_DB_UPDATED', 'Database Updated Successfully');
+
Added: XoopsModules/tag/trunk/tag/plugin/index.html
===================================================================
--- XoopsModules/tag/trunk/tag/plugin/index.html (rev 0)
+++ XoopsModules/tag/trunk/tag/plugin/index.html 2013-08-14 05:54:12 UTC (rev 11906)
@@ -0,0 +1 @@
+<script>history.go(-1);</script>
\ No newline at end of file
Added: XoopsModules/tag/trunk/tag/plugin/myalbum.php
===================================================================
--- XoopsModules/tag/trunk/tag/plugin/myalbum.php (rev 0)
+++ XoopsModules/tag/trunk/tag/plugin/myalbum.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -0,0 +1,112 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/**
+ * XOOPS tag management module
+ *
+ * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @since 1.0.0
+ * @author Taiwen Jiang <ph...@us...>
+ * @version $Id$
+ * @package tag
+ */
+if (!defined('XOOPS_ROOT_PATH')) { exit(); }
+
+/**
+ * Get item fields:
+ * title
+ * content
+ * time
+ * link
+ * uid
+ * uname
+ * tags
+ *
+ * @var array $items associative array of items: [modid][catid][itemid]
+ *
+ * @return boolean
+ *
+ */
+function myalbum_tag_iteminfo(&$items)
+{
+ if (empty($items) || !is_array($items)) {
+ return false;
+ }
+
+ $items_id = array();
+ foreach (array_keys($items) as $cat_id) {
+ // Some handling here to build the link upon catid
+ // catid is not used in myalbum, so just skip it
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ // In myalbum, the item_id is "topic_id"
+ $items_id[] = intval($item_id);
+ }
+ }
+ $item_handler =& xoops_getmodulehandler('photos', 'myalbum');
+ $text_handler =& xoops_getmodulehandler('text', 'myalbum');
+ $items_obj = $item_handler->getObjects(new Criteria("lid", "(" . implode(", ", $items_id) . ")", "IN"), true);
+
+ foreach (array_keys($items) as $cat_id) {
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ $item_obj =& $items_obj[$item_id];
+ $text = $text_handler->get($item_id);
+ $items[$cat_id][$item_id] = array(
+ "title" => $item_obj->getVar("title"),
+ "uid" => $item_obj->getVar("submitter"),
+ "link" => "photo.php?lid={$item_id}&cid=".$item_obj->getVar("cid"),
+ "time" => $item_obj->getVar("date"),
+ "tags" => tag_parse_tag($item_obj->getVar("tags", "n")),
+ "content" => $GLOBALS['myts']->displayTarea($text->getVar('description'),1,1,1,1,1,1),
+ );
+ }
+ }
+ unset($items_obj);
+}
+
+/**
+ * Remove orphan tag-item links
+ *
+ * @return boolean
+ *
+ */
+function myalbum_tag_synchronization($mid)
+{
+ $item_handler =& xoops_getmodulehandler("photos", "myalbum");
+ $link_handler =& xoops_getmodulehandler("link", "tag");
+
+ /* clear tag-item links */
+ if (version_compare( mysql_get_server_info(), "4.1.0", "ge" )):
+ $sql = " DELETE FROM {$link_handler->table}" .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( tag_itemid NOT IN " .
+ " ( SELECT DISTINCT {$item_handler->keyName} " .
+ " FROM {$item_handler->table} " .
+ " WHERE {$item_handler->table}.approved > 0" .
+ " ) " .
+ " )";
+ else:
+ $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" .
+ " LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( aa.{$item_handler->keyName} IS NULL" .
+ " OR aa.approved < 1" .
+ " )";
+ endif;
+ if (!$result = $link_handler->db->queryF($sql)) {
+ //xoops_error($link_handler->db->error());
+ }
+}
+?>
\ No newline at end of file
Property changes on: XoopsModules/tag/trunk/tag/plugin/myalbum.php
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev URL
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: XoopsModules/tag/trunk/tag/plugin/myalbum0.php
===================================================================
--- XoopsModules/tag/trunk/tag/plugin/myalbum0.php (rev 0)
+++ XoopsModules/tag/trunk/tag/plugin/myalbum0.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -0,0 +1,112 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/**
+ * XOOPS tag management module
+ *
+ * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @since 1.0.0
+ * @author Taiwen Jiang <ph...@us...>
+ * @version $Id$
+ * @package tag
+ */
+if (!defined('XOOPS_ROOT_PATH')) { exit(); }
+
+/**
+ * Get item fields:
+ * title
+ * content
+ * time
+ * link
+ * uid
+ * uname
+ * tags
+ *
+ * @var array $items associative array of items: [modid][catid][itemid]
+ *
+ * @return boolean
+ *
+ */
+function myalbum0_tag_iteminfo(&$items)
+{
+ if (empty($items) || !is_array($items)) {
+ return false;
+ }
+
+ $items_id = array();
+ foreach (array_keys($items) as $cat_id) {
+ // Some handling here to build the link upon catid
+ // catid is not used in myalbum0, so just skip it
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ // In myalbum0, the item_id is "topic_id"
+ $items_id[] = intval($item_id);
+ }
+ }
+ $item_handler =& xoops_getmodulehandler('photos', 'myalbum0');
+ $text_handler =& xoops_getmodulehandler('text', 'myalbum0');
+ $items_obj = $item_handler->getObjects(new Criteria("lid", "(" . implode(", ", $items_id) . ")", "IN"), true);
+
+ foreach (array_keys($items) as $cat_id) {
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ $item_obj =& $items_obj[$item_id];
+ $text = $text_handler->get($item_id);
+ $items[$cat_id][$item_id] = array(
+ "title" => $item_obj->getVar("title"),
+ "uid" => $item_obj->getVar("submitter"),
+ "link" => "photo.php?lid={$item_id}&cid=".$item_obj->getVar("cid"),
+ "time" => $item_obj->getVar("date"),
+ "tags" => tag_parse_tag($item_obj->getVar("tags", "n")),
+ "content" => $GLOBALS['myts']->displayTarea($text->getVar('description'),1,1,1,1,1,1),
+ );
+ }
+ }
+ unset($items_obj);
+}
+
+/**
+ * Remove orphan tag-item links
+ *
+ * @return boolean
+ *
+ */
+function myalbum0_tag_synchronization($mid)
+{
+ $item_handler =& xoops_getmodulehandler("photos", "myalbum0");
+ $link_handler =& xoops_getmodulehandler("link", "tag");
+
+ /* clear tag-item links */
+ if (version_compare( mysql_get_server_info(), "4.1.0", "ge" )):
+ $sql = " DELETE FROM {$link_handler->table}" .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( tag_itemid NOT IN " .
+ " ( SELECT DISTINCT {$item_handler->keyName} " .
+ " FROM {$item_handler->table} " .
+ " WHERE {$item_handler->table}.approved > 0" .
+ " ) " .
+ " )";
+ else:
+ $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" .
+ " LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( aa.{$item_handler->keyName} IS NULL" .
+ " OR aa.approved < 1" .
+ " )";
+ endif;
+ if (!$result = $link_handler->db->queryF($sql)) {
+ //xoops_error($link_handler->db->error());
+ }
+}
+?>
\ No newline at end of file
Property changes on: XoopsModules/tag/trunk/tag/plugin/myalbum0.php
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev URL
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: XoopsModules/tag/trunk/tag/plugin/myalbum1.php
===================================================================
--- XoopsModules/tag/trunk/tag/plugin/myalbum1.php (rev 0)
+++ XoopsModules/tag/trunk/tag/plugin/myalbum1.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -0,0 +1,112 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/**
+ * XOOPS tag management module
+ *
+ * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @since 1.0.0
+ * @author Taiwen Jiang <ph...@us...>
+ * @version $Id$
+ * @package tag
+ */
+if (!defined('XOOPS_ROOT_PATH')) { exit(); }
+
+/**
+ * Get item fields:
+ * title
+ * content
+ * time
+ * link
+ * uid
+ * uname
+ * tags
+ *
+ * @var array $items associative array of items: [modid][catid][itemid]
+ *
+ * @return boolean
+ *
+ */
+function myalbum1_tag_iteminfo(&$items)
+{
+ if (empty($items) || !is_array($items)) {
+ return false;
+ }
+
+ $items_id = array();
+ foreach (array_keys($items) as $cat_id) {
+ // Some handling here to build the link upon catid
+ // catid is not used in myalbum1, so just skip it
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ // In myalbum1, the item_id is "topic_id"
+ $items_id[] = intval($item_id);
+ }
+ }
+ $item_handler =& xoops_getmodulehandler('photos', 'myalbum1');
+ $text_handler =& xoops_getmodulehandler('text', 'myalbum1');
+ $items_obj = $item_handler->getObjects(new Criteria("lid", "(" . implode(", ", $items_id) . ")", "IN"), true);
+
+ foreach (array_keys($items) as $cat_id) {
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ $item_obj =& $items_obj[$item_id];
+ $text = $text_handler->get($item_id);
+ $items[$cat_id][$item_id] = array(
+ "title" => $item_obj->getVar("title"),
+ "uid" => $item_obj->getVar("submitter"),
+ "link" => "photo.php?lid={$item_id}&cid=".$item_obj->getVar("cid"),
+ "time" => $item_obj->getVar("date"),
+ "tags" => tag_parse_tag($item_obj->getVar("tags", "n")),
+ "content" => $GLOBALS['myts']->displayTarea($text->getVar('description'),1,1,1,1,1,1),
+ );
+ }
+ }
+ unset($items_obj);
+}
+
+/**
+ * Remove orphan tag-item links
+ *
+ * @return boolean
+ *
+ */
+function myalbum1_tag_synchronization($mid)
+{
+ $item_handler =& xoops_getmodulehandler("photos", "myalbum1");
+ $link_handler =& xoops_getmodulehandler("link", "tag");
+
+ /* clear tag-item links */
+ if (version_compare( mysql_get_server_info(), "4.1.0", "ge" )):
+ $sql = " DELETE FROM {$link_handler->table}" .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( tag_itemid NOT IN " .
+ " ( SELECT DISTINCT {$item_handler->keyName} " .
+ " FROM {$item_handler->table} " .
+ " WHERE {$item_handler->table}.approved > 0" .
+ " ) " .
+ " )";
+ else:
+ $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" .
+ " LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( aa.{$item_handler->keyName} IS NULL" .
+ " OR aa.approved < 1" .
+ " )";
+ endif;
+ if (!$result = $link_handler->db->queryF($sql)) {
+ //xoops_error($link_handler->db->error());
+ }
+}
+?>
\ No newline at end of file
Property changes on: XoopsModules/tag/trunk/tag/plugin/myalbum1.php
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev URL
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: XoopsModules/tag/trunk/tag/plugin/myalbum2.php
===================================================================
--- XoopsModules/tag/trunk/tag/plugin/myalbum2.php (rev 0)
+++ XoopsModules/tag/trunk/tag/plugin/myalbum2.php 2013-08-14 05:54:12 UTC (rev 11906)
@@ -0,0 +1,112 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/**
+ * XOOPS tag management module
+ *
+ * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @since 1.0.0
+ * @author Taiwen Jiang <ph...@us...>
+ * @version $Id$
+ * @package tag
+ */
+if (!defined('XOOPS_ROOT_PATH')) { exit(); }
+
+/**
+ * Get item fields:
+ * title
+ * content
+ * time
+ * link
+ * uid
+ * uname
+ * tags
+ *
+ * @var array $items associative array of items: [modid][catid][itemid]
+ *
+ * @return boolean
+ *
+ */
+function myalbum2_tag_iteminfo(&$items)
+{
+ if (empty($items) || !is_array($items)) {
+ return false;
+ }
+
+ $items_id = array();
+ foreach (array_keys($items) as $cat_id) {
+ // Some handling here to build the link upon catid
+ // catid is not used in myalbum2, so just skip it
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ // In myalbum2, the item_id is "topic_id"
+ $items_id[] = intval($item_id);
+ }
+ }
+ $item_handler =& xoops_getmodulehandler('photos', 'myalbum2');
+ $text_handler =& xoops_getmodulehandler('text', 'myalbum2');
+ $items_obj = $item_handler->getObjects(new Criteria("lid", "(" . implode(", ", $items_id) . ")", "IN"), true);
+
+ foreach (array_keys($items) as $cat_id) {
+ foreach (array_keys($items[$cat_id]) as $item_id) {
+ $item_obj =& $items_obj[$item_id];
+ $text = $text_handler->get($item_id);
+ $items[$cat_id][$item_id] = array(
+ "title" => $item_obj->getVar("title"),
+ "uid" => $item_obj->getVar("submitter"),
+ "link" => "photo.php?lid={$item_id}&cid=".$item_obj->getVar("cid"),
+ "time" => $item_obj->getVar("date"),
+ "tags" => tag_parse_tag($item_obj->getVar("tags", "n")),
+ "content" => $GLOBALS['myts']->displayTarea($text->getVar('description'),1,1,1,1,1,1),
+ );
+ }
+ }
+ unset($items_obj);
+}
+
+/**
+ * Remove orphan tag-item links
+ *
+ * @return boolean
+ *
+ */
+function myalbum2_tag_synchronization($mid)
+{
+ $item_handler =& xoops_getmodulehandler("photos", "myalbum2");
+ $link_handler =& xoops_getmodulehandler("link", "tag");
+
+ /* clear tag-item links */
+ if (version_compare( mysql_get_server_info(), "4.1.0", "ge" )):
+ $sql = " DELETE FROM {$link_handler->table}" .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( tag_itemid NOT IN " .
+ " ( SELECT DISTINCT {$item_handler->keyName} " .
+ " FROM {$item_handler->table} " .
+ " WHERE {$item_handler->table}.approved > 0" .
+ " ) " .
+ " )";
+ else:
+ $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" .
+ " LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " .
+ " WHERE " .
+ " tag_modid = {$mid}" .
+ " AND " .
+ " ( aa.{$item_handler->keyName} IS NULL" .
+ " OR aa.approved < 1" .
+ " )";
+ endif;
+ if (!$result = $link_handler->db->queryF($sql)) {
+ //xoops_error($link_handler->db->error());
+ }
+}
+?>
\ No newline at end of file
Property changes on: XoopsModules/tag/trunk/tag/plugin/myalbum2.p...
[truncated message content] |