From: <ir...@us...> - 2013-02-05 06:47:47
|
Revision: 10987 http://sourceforge.net/p/xoops/svn/10987 Author: irmtfan Date: 2013-02-05 06:47:41 +0000 (Tue, 05 Feb 2013) Log Message: ----------- New topic list block using NewbbTopicRenderer class, fix topic type and prune system Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/class/type.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/footer.php XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_viewall.html XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php Added Paths: ----------- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/js/language/english/newbb_validation.js Modified: XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -43,8 +43,8 @@ $topics_number = 0; $posts_number = 0; $selected_forums = ''; - - if (empty($_POST["forums"])) { + // irmtfan fix if it is array + if (empty($_POST["forums"]) || empty($_POST["forums"][0])) { redirect_header("./admin_forum_prune.php", 1, _AM_NEWBB_PRUNE_FORUMSELERROR); } elseif (is_array($_POST["forums"])) { $selected_forums = implode(",", $_POST["forums"]); @@ -59,6 +59,7 @@ $digest = $myts->addSlashes($_POST["digest"]); $lock = $myts->addSlashes($_POST["lock"]); $hot = $myts->addSlashes($_POST["hot"]); + $store = null; //irmtfan define to fix if (!empty($_POST["store"])) { $store = $myts->addSlashes($_POST["store"]); } @@ -184,7 +185,17 @@ ) ); $sform->addElement($days); - + // START irmtfan remove hardcode db access + include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/footer.php"; // to include js files + mod_loadFunctions("forum", "newbb"); + $forumSelMulti = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories + $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories + $forumSelBox ="<option value = 0 >-- "._AM_NEWBB_PERM_FORUMS." --</option>"; + $forumSelBox .= newbb_forumSelectBox(null, "access", false); //$access_forums = nothing, $permission = "access", $delimitor_category = false + $forumSelBox .= "</select>"; + $forumEle = new XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); + $storeEle = new XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); + /* irmtfan remove hardcode $checkbox = new XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); $radiobox = new XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); // PUAJJ I HATE IT, please tidy up @@ -201,9 +212,11 @@ } else { echo "DB ERROR"; } + */ + // END irmtfan remove hardcode db access + + $sform->addElement(/*$checkbox*/ $forumEle); // irmtfan - $sform->addElement($checkbox); - $sticky_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1); $sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); $sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); @@ -233,7 +246,7 @@ ); $sform->addElement($hot_confirmation); - $sform->addElement($radiobox); + $sform->addElement(/*$radiobox*/$storeEle); // irmtfan $archive_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); $archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); Added: XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -0,0 +1,192 @@ +<?php +/** + * CBB 4.0, or newbb, the forum module for XOOPS project + * + * @copyright The XOOPS Project http://xoops.sf.net + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author Taiwen Jiang (phppp or D.J.) <ph...@us...>, irmtfan <ir...@us...> + * @author The Persian Xoops Support Site <www.xoops.ir> + * @since 4.3 + * @version $Id $ + * @package module::newbb + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +if (defined('LIST_TOPIC_DEFINED')) return; +define('LIST_TOPIC_DEFINED',true); + +include_once dirname(dirname(__FILE__)) . "/include/functions.ini.php"; +require_once dirname(dirname(__FILE__)) . "/class/topic.renderer.php"; +include_once dirname(dirname(__FILE__)) . "/footer.php"; // to include js/style files like validate function + +xoops_loadLanguage("main","newbb"); + +mod_loadFunctions("time", "newbb"); +mod_loadFunctions("session", "newbb"); +mod_loadFunctions("render", "newbb"); +mod_loadFunctions("user", "newbb"); + +// options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) +// options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) +// options[2] - Type in WHERE claus: topic type in the forum : 0 - none (by default) +// options[3] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default),ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) +// options[4] - Order in ORDER claus: Descending(by default), Ascending +// options[5] - NumberToDisplay: any positive integer +// options[6] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days +// options[7] - DisplayMode: all fields same as sort +// options[8] - Display Navigator: 1 (by default), 0 (No) +// options[9] - Title Length : 0 - no limit and show complete title +// options[10] - Post text Length: 0 - dont show post text +// options[11] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) + +function newbb_list_topic_show($options) +{ + $newbbConfig = newbb_load_config(); // load all newbb configs + + $topicRenderer = new NewbbTopicRenderer(); + $topicRenderer->userlevel = $GLOBALS["xoopsUserIsAdmin"] ? 2 : is_object($GLOBALS["xoopsUser"]); // Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin + + $topicRenderer->force = true; // force against static vars for parse + + $topicRenderer->is_multiple = true; // is it for multiple forums + $topicRenderer->config =& $newbbConfig; // get all configs + if (!empty($options[5])) { + $topicRenderer->config['topics_per_page'] = intval($options[5]); // number of topics (items) to display + } + $topicRenderer->config['topic_title_excerpt'] = intval($options[9]); // topic title length 0 = dont excerpt + $topicRenderer->config['post_excerpt'] = intval($options[10]); // post text excerpt 0 = no post text + + $options_status = explode(',', $options[0]); // status in where claus + $options_forum = explode(',', $options[11]); + + // set and parse values: + // forum: parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums + $topicRenderer->setVars(array( + 'status' => $options_status, + 'uid' => $options[1], + 'type' => $options[2], + 'sort' => $options[3], + 'order' => $options[4], + 'since' => $options[6], + 'forum' => $options_forum, + )); + $block = array(); + $options_headers = explode(',', $options[7]);// headers to display in block + // get the title for each header + foreach ($options_headers as $header) { + $block['headers'][$header] = $topicRenderer->getSort($header, "title"); + } + // render a list of topics using all above criterias + list($block['topics'], $block['sticky']) = $topicRenderer->renderTopics(); + + // show index navigation + $block['indexNav'] = !empty($options[8]); + + return $block; +} + + +function newbb_list_topic_edit($options) +{ + // include_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6 + xoops_load('XoopsFormLoader'); + // $form = new XoopsBlockForm(); //reserve for 2.6 + $form = new XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC,'list_topic',''); + + $topicRenderer = new NewbbTopicRenderer(); + $topicRenderer->userlevel = 2; // 2 - moderator or admin + + // status element + $options_status = explode(',', $options[0]); + $statusEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA, 'options[0]', $options_status, 5, true); + $status = $topicRenderer -> getStatus( $topicRenderer->userlevel ); // get all public status + admin status (admin mode, pending deleted) + $statusEle->addOptionArray($status); + $statusEle->setExtra("onchange = \"validate('options[0][]','select', true)\""); // if user dont select any option it select "all" + $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); + + // topic_poster element + $topicPosterEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, $options[1], 1, false); + + // type element + $types = $topicRenderer -> getTypes(); // get all available types in all forums + $typeEle = new XoopsFormSelect(_MD_NEWBB_TYPE, 'options[2]', $options[2]); + $typeEle->addOption(0, _NONE); + if (!empty($types)) { + foreach ($types as $type_id => $type) { + $typeEle->addOption($type_id, $type["type_name"]); + } + } + + // sort element + $sortEle = new XoopsFormSelect(_MD_SORTBY, 'options[3]', $options[3]); + $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); + $sorts = $topicRenderer -> getSort("", "title"); + $sortEle->addOptionArray($sorts); + + // order element + $orderEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[4]', $options[4]); + $orderEle->addOption(0, _DESCENDING); + $orderEle->addOption(1, _ASCENDING); + + // number of topics to display element + $numdispEle = new XoopsFormText(_MB_NEWBB_DISPLAY, 'options[5]', 10, 255, intval($options[5])); + + $timeEle = new XoopsFormText(_MB_NEWBB_TIME, 'options[6]', 10, 255, $options[6]); + $timeEle->setDescription(_MB_NEWBB_TIME_DESC); + + // mode disp element + $options_headers = explode(',', $options[7]); + $modeEle = new XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[7][]', $options_headers); + $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); + $modeEle->columns = 4; + $modeEle->addOptionArray($sorts); + $modeEle->addOption("attachment",_MD_TOPICSHASATT); //add attachment hardcoded in NewbbTopicRenderer + $modeEle->setExtra("onchange = \"validate('options[7][]','checkbox', true)\""); // prevent user select no option + // Index navigation element + $navEle = new XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[8]', !empty($options[8])); + + // Topic title element + $lengthEle = new XoopsFormText( _MB_NEWBB_TITLE_LENGTH, 'options[9]', 10, 255, intval($options[9])); + $lengthEle->setDescription(_MB_NEWBB_TITLE_LENGTH_DESC); + + // Post text element + $postExcerptEle = new XoopsFormText( _MB_NEWBB_POST_EXCERPT, 'options[10]', 10, 255, intval($options[10])); + $postExcerptEle->setDescription(_MB_NEWBB_POST_EXCERPT_DESC); + + // forum element + $options_forum = explode(',', $options[11]); + mod_loadFunctions("forum", "newbb"); + $forum_handler = xoops_getmodulehandler('forum', 'newbb'); + //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums + // Get accessible forums + $access_forums = $forum_handler->getIdsByValues(array_map("intval", $options_forum)); + $isAll = (count($options_forum) == 0 || empty($options_forum[0])); + $forumSel = "<select name=\"options[11][]\" multiple=\"multiple\" onchange = \"validate('options[11][]','select', true)\">";// if user dont select any it select "0" + $forumSel .= "<option value=\"0\" "; + if ($isAll) { + $forumSel .= " selected"; + $access_forums = null; // just select _ALL option + } + $forumSel .= ">"._ALL."</option>"; + $forumSel .= newbb_forumSelectBox($access_forums, "access", false); //$access_forums, $permission = "access", $delimitor_category = false + $forumSel .= "</select>"; + $forumEle = new XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); + + // add all elements to form + $form->addElement($statusEle); + $form->addElement($topicPosterEle); + $form->addElement($typeEle); + $form->addElement($sortEle); + $form->addElement($orderEle); + $form->addElement($numdispEle); + $form->addElement($timeEle); + $form->addElement($modeEle,true); // required: user should select at least one otherwise it will select the first one + $form->addElement($navEle); + $form->addElement($lengthEle); + $form->addElement($postExcerptEle); + $form->addElement($forumEle); + + return $form->render(); +} +?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -142,10 +142,8 @@ foreach ($rows as $arr) { - // irmtfan add lastposticon - if(!defined('_MD_NEWBB_GOTOLASTPOST')) { - define("_MD_NEWBB_GOTOLASTPOST", _MB_NEWBB_LPOST); - } + // irmtfan add lastposticon - load main lang + xoops_loadLanguage("main","newbb"); $topic_page_jump = newbb_displayImage('lastposticon',_MD_NEWBB_GOTOLASTPOST); $topic['topic_subject'] = empty($type_list[$arr["type_id"]])? "" : "[".$type_list[$arr["type_id"]]."]"; Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-05 06:47:41 UTC (rev 10987) @@ -1,3 +1,49 @@ +date 2013-02-05 +=================================== +1- bug fix: when update the type for a specific forum it delete other forum's types too.(important) +in newbb/class/type.php + +2- bug fix: t.topic_rating to t.rating in viewforum and topic renderer pages +in newbb/viewforum.php, newbb/topic.renderer.php + +3- bug fix: dont add sort to criteria if sort=null eg: /list.topic.php?sort= will cause db error +in newbb/topic.renderer.php + +4- bug fix: if user set post_excerpt = 0 in preferences, there is no join in criteria and Undefined index: join error occured. +in newbb/topic.renderer.php + +5- feature add: NewbbTopicRenderer class can accept multiple status. more status and sort is added. + status supproted: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) +in newbb/topic.renderer.php + +6- feature add: add "topic_title_excerpt" setting. render topics with the specific title length. 0 = dont excerpt and show the whole topic title. +in newbb/plugin.php, newbb/topic.renderer.php + +7- feature add: a new block for topics using NewbbTopicRenderer class. + users can drop old "Recent Topics" and "Recent Replied Topics" block and use this block instead. +in newbb/xoops_version.php, newbb/language/LANG/main.php, newbb/language/LANG/blocks.php, newbb/language/LANG/modinfo.php +newbb/list.topic.php, +add: newbb/blocks/list_topic.php, newbb/templates/blocks/newbb_block_list_topic.html, newbb/templates/js/language/english/newbb_validation.js + newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html, newbb/templates_fulldiv_opacity/js/language/english/newbb_validation.js + +8- fix: remove hardcoded items from topic_icon and topic_folder smarty and add sticky, digest, poll, lock, publish time and rating smarty +in newbb/templates_fulldiv_opacity/viewall.html, in newbb/templates/viewall.html + +9- bug fix: remove hardcoded access to database for creating forum selection box (multiple and single) in admin prune. +in newbb/admin/admin_forum_prune.php + +10- fix: change $xoopsUser to $GLOBALS["xoopsUser"] because $xoopsUser is not defined in admin side +in newbb/include/vars.php + +11- bug fix: Undefined variable: forumCookie +in newbb/footer.php + +12- fix: _MD_NEWBB_GOTOLASTPOST already defined +in newbb/blocks/newbb_block.php + +13- change the status to RC5 +in newbb/xoops_version.php + date 2012-12-26 =================================== 1- bug fix: Warning: xoopsOption[template_main] should be defined before including header.php in file /footer.php line 59 Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -52,6 +52,11 @@ var $is_multiple = false; /** + * force to parse vars (run against static vars) irmtfan + */ + var $force = false; + + /** * Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin */ var $userlevel = 0; @@ -120,8 +125,12 @@ break; case "status": - $val = ( !empty($val) && in_array($val, array_keys($this->getStatus( $this->userlevel ))) ) ? $val : "all"; - if ($val == "all" && !$this->is_multiple) $val = ""; + // START irmtfan to accept multiple status + $val = is_array($val) ? $val : array($val); + $val = implode(",", $val); + //$val = (in_array($val, array_keys($this->getStatus( $this->userlevel ))) ) ? $val : "all"; //irmtfan no need to check if status is empty or not + //if ($val == "all" && !$this->is_multiple) $val = ""; irmtfan commented because it is done in sort + // END irmtfan to accept multiple status break; default: @@ -144,18 +153,101 @@ function _parseStatus($status = null) { switch ($status) { + // START irmtfan to accept multiple status and add more status case 'digest': - $this->query["where"][] = 't.approved = 1'; $this->query["where"][] = 't.topic_digest = 1'; break; + + case 'undigest': + $this->query["where"][] = 't.topic_digest = 0'; + break; + + case 'sticky': + $this->query["where"][] = 't.topic_sticky = 1'; + break; + + case 'unsticky': + $this->query["where"][] = 't.topic_sticky = 0'; + break; + + case 'lock': + $this->query["where"][] = 't.topic_status = 1'; + break; + + case 'unlock': + $this->query["where"][] = 't.topic_status = 0'; + break; + + case 'poll': + $this->query["where"][] = 't.topic_haspoll = 1'; + break; + + case 'unpoll': + $this->query["where"][] = 't.topic_haspoll = 0'; + break; + + case 'voted': + $this->query["where"][] = 't.votes > 0'; + break; + + case 'unvoted': + $this->query["where"][] = 't.votes < 1'; + break; + + case 'replied': + $this->query["where"][] = 't.topic_replies > 0'; + break; case 'unreplied': - $this->query["where"][] = 't.approved = 1'; $this->query["where"][] = 't.topic_replies < 1'; break; + + case 'viewed': + $this->query["where"][] = 't.topic_views > 0'; + break; + case 'unviewed': + $this->query["where"][] = 't.topic_views < 1'; + break; + + case 'read': + // Skip + if (empty($this->config["read_mode"])) { + // Use database + } elseif ($this->config["read_mode"] == 2) { + // START irmtfan use read_uid to find the unread posts when the user is logged in + global $xoopsUser; + $read_uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0; + if (!empty($read_uid)) { + $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_reads_topic') . ' AS r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; + $this->query["where"][] = 'r.post_id = t.topic_last_post_id'; + } else { + } + // END irmtfan change criteria to get from uid p.uid = last post submit user id + // User cookie + } elseif ($this->config["read_mode"] == 1) { + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) + $startdate = !empty($this->vars["since"]) ? (time() - newbb_getSinceTime($this->vars["since"])) : 0; + if ( $lastvisit = max($GLOBALS['last_visit'], $startdate) ) { + if ( $lastvisit > $startdate ) { + $this->query["where"][] = 'p.post_time < ' . $lastvisit; + } + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $lastvisit) $topics[] = $id; + } + } + if (count($topics)>0) { + $this->query["where"][] = ' t.topic_id IN (' . implode(",", $topics) . ')'; + } + } + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) + } + break; + case 'unread': - $this->query["where"][] = 't.approved = 1'; // Skip if (empty($this->config["read_mode"])) { // Use database @@ -213,10 +305,9 @@ $this->query["where"][] = 't.approved = 1'; break; - default: - $this->query["where"][] = 't.approved = 1'; - $this->query["sort"][] = 't.topic_sticky DESC'; + default: // irmtfan do nothing break; + // END irmtfan to accept multiple status and add more status } } @@ -257,6 +348,10 @@ $startdate = time() - newbb_getSinceTime($val); if ( $this->vars["status"] == "unread" && $this->config["read_mode"] == 1 && $GLOBALS['last_visit'] > $startdate ) break; + // irmtfan digest_time + if ($this->vars["status"] == "digest") { + $this->query["where"][] = "t.digest_time > ". $startdate; + } // irmtfan - should be >= instead of = $this->query["where"][] = "p.post_time >= ". $startdate; // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query @@ -270,12 +365,23 @@ break; case "status": - $this->_parseStatus($val); + // START irmtfan to accept multiple status + $val = explode(",", $val); + // irmtfan - add "all" to always parse t.approved = 1 + if (count(array_intersect($val, array("all","active","pending","deleted"))) == 0) { + $val[] = "all"; + } + foreach ($val as $key => $status){ + $this->_parseStatus($status); + } + // END irmtfan to accept multiple status break; case "sort": if ($sort = $this->getSort($val, "sort")) { $this->query["sort"][] = $sort.(empty($this->vars["order"]) ? " DESC" : " ASC"); + } else { // irmtfan if sort is not in the list + $this->query["sort"][] = "t.topic_last_post_id".(empty($this->vars["order"]) ? " DESC" : " ASC"); } break; @@ -287,12 +393,15 @@ function parseVars() { static $parsed; - if (isset($parsed)) return true; + // irmtfan - force to parse vars (run against static vars) + if (isset($parsed) && !$this->force) return true; if (!isset($this->vars["forum"])) $this->vars["forum"] = null; //irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. "all" instead of all if (!isset($this->vars["status"])) $this->vars["status"] = "all"; - + // irmtfan if sort is not set or is empty get a default sort- if empty($_GET(sort)) | if sort=null eg: /list.topic.php?sort= + if (empty($this->vars["sort"])) $this->vars["sort"] = in_array("sticky", explode(",",$this->vars["status"])) ? "lastpost" : "sticky"; + foreach ($this->vars as $var => $val) { $this->parseVar($var, $val); if (empty($val)) unset($this->vars[$var]); @@ -331,14 +440,48 @@ ), "ratings" => array( "title" => _MD_RATINGS, - "sort" => "t.topic_ratings", + "sort" => "t.rating", // irmtfan t.topic_rating to t.rating ), + // START irmtfan add more sorts + "votes" => array( + "title" => _MD_VOTES, + "sort" => "t.votes", + ), "publish" => array( "title" => _MD_TOPICTIME, "sort" => "t.topic_id", ), + "digest" => array( + "title" => _MD_DIGEST, + "sort" => "t.digest_time", + ), + "sticky" => array( + "title" => _MD_STICKY, + "sort" => "t.topic_sticky", + ), + "lock" => array( + "title" => _MD_LOCK, + "sort" => "t.topic_status", + ), + "poll" => array( + "title" => _MD_POLL_POLL, + "sort" => "t.poll_id", + ), ); - + $types = $this->getTypes(); + if (!empty($types)) { + $headers["type"] = array( + "title" => _MD_NEWBB_TYPE, + "sort" => "t.type_id", + ); + } + if ($this->userlevel == 2) { + $headers["approve"] = array( + "title" => _MD_APPROVE, + "sort" => "t.approved", + ); + } + // END irmtfan add more sorts if (empty($header) && empty($var)) { return $headers; } @@ -361,7 +504,20 @@ //"" => "", /* irmtfan remove empty array */ "all" => _ALL, "digest" => _MD_DIGEST, + "undigest" => _MD_UNDIGEST, // irmtfan add + "sticky" => _MD_STICKY, // irmtfan add + "unsticky" => _MD_UNSTICKY, // irmtfan add + "lock" => _MD_LOCK, // irmtfan add + "unlock" => _MD_UNLOCK, // irmtfan add + "poll" => _MD_TOPICHASPOLL, // irmtfan add + "unpoll" => _MD_TOPICHASNOTPOLL, // irmtfan add + "voted" => _MD_VOTED, // irmtfan add + "unvoted" => _MD_UNVOTED, // irmtfan add + "viewed" => _MD_VIEWED, // irmtfan add + "unviewed" => _MD_UNVIEWED, // irmtfan add + "replied" => _MD_REPLIED, // irmtfan add "unreplied" => _MD_UNREPLIED, + "read" => _MD_READ, // irmtfan add "unread" => _MD_UNREAD, ); $links_admin = array( @@ -405,7 +561,7 @@ $selection["forum"] .= '</select>'; // END irmtfan add forum selection box - $sort_selected = empty($this->vars["sort"]) ? "lastpost" : $this->vars["sort"]; + $sort_selected = $this->vars["sort"]; // irmtfan no need to check $sorts = $this->getSort("", "title"); $selection["sort"] = "<select name='sort'>"; foreach ($sorts as $sort => $title) { @@ -569,7 +725,7 @@ $sql = ' SELECT '.implode(", ", $selects). ' FROM '.implode(", ", $froms). ' '.implode(" ", $joins). - ' '.implode(" ", $this->query["join"]). + (!empty($this->query["join"]) ? ' '.implode(" ", $this->query["join"]) : ''). // irmtfan bug fix: Undefined index: join when post_excerpt = 0 ' WHERE '.implode(" AND ", $wheres). ' AND '.@implode(" AND ", @$this->query["where"]); @@ -582,7 +738,7 @@ function renderTopics($xoopsTpl = null) { - global $myts; + $myts = MyTextSanitizer::getInstance(); // irmtfan Instanciate $ret = array(); //$this->parseVars(); @@ -613,13 +769,12 @@ $selects[] = 'p.post_karma, p.require_reply, pt.post_text'; $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; } - if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; + //if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; // irmtfan commented no need - $sql = ' SELECT '.implode(", ", $selects). ' FROM '.implode(", ", $froms). ' '.implode(" ", $joins). - ' '.implode(" ", $this->query["join"]). + (!empty($this->query["join"]) ? ' '.implode(" ", $this->query["join"]) : ''). // irmtfan bug fix: Undefined index join when post_excerpt = 0 ' WHERE '.implode(" AND ", $wheres). ' AND '.@implode(" AND ", @$this->query["where"]). ' ORDER BY '.implode(", ", $this->query["sort"]); @@ -652,21 +807,14 @@ } // ------------------------------------------------------ - // topic_icon: priority: sticky -> digest -> regular - - if ($myrow['topic_haspoll']) { - if ($myrow['topic_sticky']) { - $topic_icon = newbb_displayImage("topic_sticky", _MD_TOPICSTICKY) . '<br />' . newbb_displayImage("poll", _MD_TOPICHASPOLL); - } else { - $topic_icon = newbb_displayImage('poll', _MD_TOPICHASPOLL); - } - } elseif ($myrow['topic_sticky']) { - $topic_icon = newbb_displayImage('topic_sticky', _MD_TOPICSTICKY); - } elseif (!empty($myrow['icon'])) { - $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; + // START irmtfan remove topic_icon hardcode smarty + // topic_icon: just regular topic_icon + if (!empty($myrow['icon'])) { + $topic_icon = '<img align="middle" src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; } else { - $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; + $topic_icon = '<img align="middle" src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; } + // END irmtfan remove topic_icon hardcode smarty // ------------------------------------------------------ // rating_img @@ -706,9 +854,16 @@ // => topic array $topic_title = $myts->htmlSpecialChars( $myrow['topic_title'] ); - if ($myrow['topic_digest']) { - $topic_title = "<span class='digest'>" . $topic_title . "</span>"; - } + // irmtfan use topic_title_excerpt for block topic title length + if (!empty($this->config['topic_title_excerpt'])) { + $topic_title_excerpt = xoops_substr($topic_title, 0, $this->config['topic_title_excerpt']); + } else { + $topic_title_excerpt = $topic_title; + } + // irmtfan hardcode class commented + //if ($myrow['topic_digest']) { + // $topic_title = "<span class='digest'>" . $topic_title . "</span>"; + //} if ( empty($this->config["post_excerpt"]) ) { $topic_excerpt = ""; @@ -723,10 +878,11 @@ 'topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], - 'topic_title' => $topic_title, + 'topic_title_excerpt' => $topic_title_excerpt, //irmtfan use topic_title_excerpt //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], // . '&forum=' . $myrow['forum_id'], // irmtfan comment 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], // irmtfan remove hardcode link 'rating_img' => $rating_img, + 'votes' => $myrow['votes'], //irmtfan added 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], @@ -739,8 +895,11 @@ 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars( $myrow['last_poster_name'] ) : $anonymous, 'topic_forum' => $myrow['forum_id'], 'topic_excerpt' => $topic_excerpt, - 'stick' => empty($myrow['topic_sticky']), - "stats" => array($myrow['topic_status'], $myrow['topic_digest'], $myrow['topic_replies']), + 'sticky' => $myrow['topic_sticky'] ? newbb_displayImage('topic_sticky', _MD_TOPICSTICKY) : '', // irmtfan bug fixed + 'lock' => $myrow['topic_status'] ? newbb_displayImage('topic_locked', _MD_TOPICLOCK) : '', //irmtfan added + 'digest' => $myrow['topic_digest'] ? newbb_displayImage('topic_digest', _MD_TOPICDIGEST) : '', //irmtfan added + 'poll' => $myrow['topic_haspoll'] ? newbb_displayImage('poll', _MD_TOPICHASPOLL) : '', //irmtfan added + 'approve' => $myrow['approved'], //irmtfan added ); /* users */ @@ -778,8 +937,9 @@ $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable $topics[$id]["topic_forum_link"] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]["topic_forum"] . '">' . $forum_list[$topics[$id]["topic_forum"]]["forum_name"] . '</a>'; + //irmtfan use topic_title_excerpt if (!empty($topics[$id]["type_id"]) && isset($type_list[$topics[$id]["type_id"]])) { - $topics[$id]["topic_title"] = getTopicTitle($topics[$id]["topic_title"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); + $topics[$id]["topic_title"] = getTopicTitle($topics[$id]["topic_title_excerpt"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); } $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]]) ? $posters_name[$topics[$id]["topic_poster_uid"]] @@ -788,28 +948,30 @@ ? $posters_name[$topics[$id]["topic_last_poster_uid"]] : $topics[$id]["topic_last_poster_name"]; // ------------------------------------------------------ + // START irmtfan remove hardcodes from topic_folder smarty // topic_folder: priority: newhot -> hot/new -> regular - list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; + //list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; irmtfan // START irmtfan - add topic_folder_text for alt - if ($topic_status == 1) { - $topic_folder = 'topic_locked'; - $topic_folder_text = _MD_TOPICLOCKED; - } else { - if ($topic_digest) { - $topic_folder = 'topic_digest'; - $topic_folder_text = _MD_TOPICDIGEST; - } elseif ($topic_replies >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) { + //if ($topics[$id]["lock"] == 1) { + // $topic_folder = 'topic_locked'; + // $topic_folder_text = _MD_TOPICLOCKED; + //} else { + //if ($topic_digest) { + // $topic_folder = 'topic_digest'; + // $topic_folder_text = _MD_TOPICDIGEST; + if ($topics[$id]["topic_replies"] >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) { $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot'; $topic_folder_text = empty($topic_isRead[$id]) ? _MD_MORETHAN : _MD_MORETHAN2; } else { $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic'; $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWPOSTS : _MD_NONEWPOSTS; } - } + //} + // END irmtfan remove hardcodes from topic_folder smarty $topics[$id]['topic_folder'] = newbb_displayImage($topic_folder, $topic_folder_text); // END irmtfan - add topic_folder_text for alt - unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"], $topics[$id]["stats"]); + unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"]);// irmtfan remove $topics[$id]["stats"] because it is not exist now } if ( count($topics) > 0) { Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/type.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/type.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/type.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -142,6 +142,7 @@ if (!empty($types_valid)) { $sql = "DELETE FROM " . $this->db->prefix("bb_type_forum"). " WHERE ". + " forum_id = " . $forum_id . " AND ". // irmtfan bug fix: delete other forums types when update the type for a specific forum " {$this->keyName} NOT IN (".implode(", ", $types_valid).")"; if ( ($result = $this->db->queryF($sql)) == false) { } Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2013-02-05 06:47:41 UTC (rev 10987) @@ -74,6 +74,14 @@ define("_MD_CANNOT_PRINT","You <strong>cannot</strong> get print page.<br />"); define('_MD_NORIGHTTOPDF','You don\'t have the right to create pdf in this forum.'); define('_MD_NORIGHTTOPRINT','You don\'t have the right to get print in this forum.'); +define('_MD_TOPICHASNOTPOLL','Topic hasnot poll'); +define('_MD_VOTED','Voted topics'); +define('_MD_UNVOTED','Unvoted topics'); +define('_MD_VIEWED','Viewed topics'); +define('_MD_UNVIEWED','Unviewed topics'); +define('_MD_REPLIED','Replied topics'); +define('_MD_READ','Read topics'); +define('_MD_POLL_POLL','Poll'); admin.php --------- @@ -84,3 +92,24 @@ define("_AM_NEWBB_DATABASEUPDATED","Database Updated Successfully!"); define("_AM_NEWBB_CAN_PDF","Can create pdf files"); define("_AM_NEWBB_CAN_PRINT","Can get print page"); + +modinfo.php +----------- +revise: +define("_MI_NEWBB_BLOCK_TOPIC_POST","Recent Replied Topics. It Will drop (use advance topic renderer block)"); // irmtfan +define("_MI_NEWBB_BLOCK_TOPIC","Recent Topics. It Will drop (use advance topic renderer block)"); // irmtfan + +add: +define("_MI_NEWBB_BLOCK_LIST_TOPIC","Render a list of topics"); + + +blocks.php +----------- +add: +define("_MB_NEWBB_CRITERIA_DESC","you can select multiple criterias and they parsed in WHERE claus by AND. eg: sticky AND unreplied topics. null = all "); +define("_MB_NEWBB_CRITERIA_SORT_DESC","Note: Newest/Oldest Most/Least should be set in Order by"); +define("_MB_NEWBB_DISPLAYMODE_DESC","Display selected items of topic in block IF topic has them AND user has the right access"); +define("_MB_NEWBB_CRITERIA_ORDER","Order by"); +define("_MB_NEWBB_TITLE_LENGTH_DESC","Length of topic title excerpt in block. 0 for show the whole title and no excerpt."); +define("_MB_NEWBB_POST_EXCERPT","Post text excerpt in block"); +define("_MB_NEWBB_POST_EXCERPT_DESC","Length of post text excerpt by mouse over on topic title in block. 0 for dont show post text."); \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/footer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -40,6 +40,7 @@ $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } +include_once dirname(__FILE__) . "/include/vars.php"; // for $forumCookie["prefix"] // add toggle script $toggle_script="var toggle_cookie=\"" . $forumCookie["prefix"] . "G" . "\";"; $xoTheme->addScript( null, array ('type' => 'text/javascript'), $toggle_script); Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -101,6 +101,8 @@ // change the read_mode = 2 (db) to read_mode = 1 (cookie) for anonymous users // Note: if set to true only change read_mode for anonymous users if read_mode = 2 (db), set to false to no action. $customConfig["read_mode_db_to_cookie_for_anon"] = true; +// render topics with the specific title length. 0 = dont excerpt +$customConfig["topic_title_excerpt"] = 0; // END hacked by irmtfan return $customConfig; Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -38,7 +38,7 @@ $forumCookie['path'] = "/"; $forumCookie['secure'] = false; $forumCookie['expire'] = time() + 3600 * 24 * 30; // one month -$forumCookie['prefix'] = 'newbb_'.((is_object($xoopsUser)) ? $xoopsUser->getVar('uid') : '0IP' . newbb_getIP()); // irmtfan IP for anons +$forumCookie['prefix'] = 'newbb_'.((is_object($GLOBALS["xoopsUser"])) ? $GLOBALS["xoopsUser"]->getVar('uid') : '0IP' . newbb_getIP()); // irmtfan IP for anons - use $GLOBALS["xoopsUser"] // set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet // otherwise, it gets the time from the LastVisitTemp cookie Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -37,4 +37,13 @@ define("_MB_NEWBB_COUNT","Count"); define("_MB_NEWBB_INDEXNAV","Display Navigator"); define("_MB_NEWBB_TITLE_LENGTH","Title/Post length"); +// 4.3 +// added by irmtfan +define("_MB_NEWBB_CRITERIA_DESC","you can select multiple criterias and they parsed in WHERE claus by AND. eg: sticky AND unreplied topics. null = all "); +define("_MB_NEWBB_CRITERIA_SORT_DESC","Note: Newest/Oldest Most/Least should be set in Order by"); +define("_MB_NEWBB_DISPLAYMODE_DESC","Display selected items of topic in block IF topic has them AND user has the right access"); +define("_MB_NEWBB_CRITERIA_ORDER","Order by"); +define("_MB_NEWBB_TITLE_LENGTH_DESC","Length of topic title excerpt in block. 0 for show the whole title and no excerpt."); +define("_MB_NEWBB_POST_EXCERPT","Post text excerpt in block"); +define("_MB_NEWBB_POST_EXCERPT_DESC","Length of post text excerpt by mouse over on topic title in block. 0 for dont show post text."); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -513,5 +513,13 @@ define("_MD_CANNOT_PRINT","You <strong>cannot</strong> get print page.<br />"); define('_MD_NORIGHTTOPDF','You don\'t have the right to create pdf in this forum.'); define('_MD_NORIGHTTOPRINT','You don\'t have the right to get print in this forum.'); - +// irmtfan for new block system +define('_MD_TOPICHASNOTPOLL','Topic hasnot poll'); +define('_MD_VOTED','Voted topics'); +define('_MD_UNVOTED','Unvoted topics'); +define('_MD_VIEWED','Viewed topics'); +define('_MD_UNVIEWED','Unviewed topics'); +define('_MD_REPLIED','Replied topics'); +define('_MD_READ','Read topics'); +define('_MD_POLL_POLL','Poll'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -14,8 +14,8 @@ define("_MI_NEWBB_DESC","XOOPS Community Bulletin Board"); // Names of blocks for this module (Not all module has blocks) -define("_MI_NEWBB_BLOCK_TOPIC_POST","Recent Replied Topics"); -define("_MI_NEWBB_BLOCK_TOPIC","Recent Topics"); +define("_MI_NEWBB_BLOCK_TOPIC_POST","Recent Replied Topics. It Will drop (use advance topic renderer block)"); // irmtfan +define("_MI_NEWBB_BLOCK_TOPIC","Recent Topics. It Will drop (use advance topic renderer block)"); // irmtfan define("_MI_NEWBB_BLOCK_POST","Recent Posts"); define("_MI_NEWBB_BLOCK_AUTHOR","Authors"); define("_MI_NEWBB_BLOCK_TAG_CLOUD","Tag Cloud"); @@ -257,5 +257,7 @@ define("_MI_ADVERTISING_DESC","shows a commercial break after the 2nd Thread"); define("_MI_USERATTACH_ENABLE","Display attachments only for registered users"); define("_MI_USERATTACH_DESC","shows attachments in the forum only after logging in."); +// 4.3 +define("_MI_NEWBB_BLOCK_LIST_TOPIC","Render a list of topics");// irmtfan ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -1,4 +1,4 @@ -<?php +<?php // $Id: blocks.php,v 1.3 2005/10/19 17:20:33 phppp Exp $ // Blocks if(defined('_MB_NEWBB_DEFINED')) return; @@ -36,5 +36,14 @@ define("_MB_NEWBB_AUTHOR","نویسنده"); define("_MB_NEWBB_COUNT","تعداد"); define("_MB_NEWBB_INDEXNAV","هدایت گر را نشان بده"); -define("_MB_NEWBB_TITLE_LENGTH","طول عنوان/پیام"); +define("_MB_NEWBB_TITLE_LENGTH","طول عنوان تاپیک ها"); +// 4.3 +// added by irmtfan +define("_MB_NEWBB_CRITERIA_DESC","شما میتوانید چندین شرط را انتخاب کنید و تمامی آنها در فراخوانی از پایگاه داده با AND و در قسمت WHERE آورده میشوند. مثلا: چسبان AND بدون پاسخ. بدون انتخاب = همه"); +define("_MB_NEWBB_CRITERIA_SORT_DESC","توجه: جدیدترین/قدیمیترین بیشترین/کمترین را باید در قسمت صعودی نزولی انتخاب کنید."); +define("_MB_NEWBB_DISPLAYMODE_DESC","آیتم های مختلفی از تاپیک را بر حسب اینکه آیا تاپیک آنها را دارد و آیا بیننده دسترسی دیدن دارد یا نه در بلاک نمایش میدهد."); +define("_MB_NEWBB_CRITERIA_ORDER","مرتب سازی"); +define("_MB_NEWBB_TITLE_LENGTH_DESC","حداکثر تعداد کاراکتر هایی از عنوان تاپیک که در بلاک نمایش داده میشود. اگر 0 باشد کل عنوان نمایش داده میشود."); +define("_MB_NEWBB_POST_EXCERPT","طول متن پیام"); +define("_MB_NEWBB_POST_EXCERPT_DESC","حداکثر تعداد کاراکتر هایی که از متن پیام با بردن موس روی عنوان تاپیک نمایش داده میشود. اگر 0 را بنویسید هیچ متنی نمایش داده نمیشود."); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -1,4 +1,4 @@ -<?php +<?php // $Id: main.php 17 2007-11-18 14:22:36Z LupusC $ if(defined('MAIN_DEFINED')) return; define('MAIN_DEFINED',true); @@ -300,12 +300,12 @@ define('_MD_DELETE','حذف کن'); define('_MD_MOVE','منتقلکن'); define('_MD_MERGE','ادغام کن'); -define('_MD_LOCK','قفل کن'); -define('_MD_UNLOCK','قفل را باز کن'); -define('_MD_STICKY','مهم (چسبان) کن'); -define('_MD_UNSTICKY','غیر مهم (عادی) کن'); -define('_MD_DIGEST','خلاصه کن'); -define('_MD_UNDIGEST','غیر خلاصه کن'); +define('_MD_LOCK','عنوان های قفل شده'); +define('_MD_UNLOCK','عنوان های قفل نشده (باز)'); +define('_MD_STICKY','عنوان های مهم (چسبان)'); +define('_MD_UNSTICKY','عنوان های غیر مهم (عادی)'); +define('_MD_DIGEST','عنوان های خلاصه'); +define('_MD_UNDIGEST','عنوان های غیر خلاصه'); define('_MD_DESC_DELETE','وقتی شما دکمه حذف کن را در پایین میزنید؛ این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن <strong>کاملاً</strong>حذف خواهند شد.'); define('_MD_DESC_RESTORE','وقتی شما دکمه بازیابی کن را در پایین میزنید؛ این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن بازیابی خواهند شد.'); define('_MD_DESC_MOVE','وقتی شما دکمه منتقل کن در پایین را میزنید، این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن به انجمنی که انتخاب کرده اید منتقل میشود.'); @@ -511,5 +511,13 @@ define("_MD_CANNOT_PRINT","شما <strong>نمی توانید</strong> پرینت بگیرید.<br />"); define('_MD_NORIGHTTOPDF','شما در این فروم دسترسی برای ساختن فایل pdf ندارید.'); define('_MD_NORIGHTTOPRINT','شما در این فروم دسترسی برای گرفتن پرینت ندارید.'); - +// irmtfan for new block system +define('_MD_TOPICHASNOTPOLL','عنوان بدون نظر سنجی'); +define('_MD_VOTED','عنوان های ارزشیابی شده'); +define('_MD_UNVOTED','عنوان های ارزشیابی نشده'); +define('_MD_VIEWED','عنوان های بازدید شده'); +define('_MD_UNVIEWED','عنوان های بازدید نشده'); +define('_MD_REPLIED','عنوان های دارای پاسخ'); +define('_MD_READ','عنوان های خوانده شده'); +define('_MD_POLL_POLL','نظرسنجی'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -262,4 +262,7 @@ define("_MI_ADVERTISING_DESC","بعد از پست دوم هر تاپیک یک تبلیغ را نمایش میدهد"); define("_MI_USERATTACH_ENABLE","نمایش فایل های پیوست به پست فقط به کابران عضو"); define("_MI_USERATTACH_DESC","فقط بعد از ورود به سایت فایل های الصاق شده را نمایش میدهد."); +// 4.3 +define("_MI_NEWBB_BLOCK_LIST_TOPIC","نمایش فهرستی از تاپیک ها");// irmtfan + ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -27,9 +27,15 @@ mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); -require "./class/topic.renderer.php"; +// irmtfan use require_once because it will redeclared in newbb/blocks/list_topic.php +require_once "./class/topic.renderer.php"; $topic_renderer = NewbbTopicRenderer::instance(); $topic_renderer->userlevel = $GLOBALS["xoopsUserIsAdmin"] ? 2 : is_object($xoopsUser); +// irmtfan if list topic block is in the page then force to parse +if (defined('LIST_TOPIC_DEFINED')) { + $topic_renderer->force = true; // force against static vars +} + $topic_renderer->is_multiple = true; $topic_renderer->config =& $xoopsModuleConfig; $topic_renderer->setVars( @$_GET ); Added: XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html 2013-02-05 06:47:41 UTC (rev 10987) @@ -0,0 +1,121 @@ +<!-- a new block template for newbb --> +<!-- all classes can be found in xoops.css --> +<!-- define your desired width here --> +<{assign var=minwidth value=300}> <!-- minimum block minwidth property --> +<{assign var=topicwidth value=100}> <!-- maximum topic width property --> + +<{if $block.headers.forum}> + <{assign var=minwidth value=$minwidth+50}> + <{assign var=topicwidth value=$topicwidth-20}> + <{assign var=block_forum value="width20"}> +<{/if}> +<{if $block.headers.views}> + <{assign var=minwidth value=$minwidth+25}> + <{assign var=topicwidth value=$topicwidth-10}> + <{assign var=block_view value="width10"}> +<{/if}> +<{if $block.headers.replies}> + <{assign var=minwidth value=$minwidth+25}> + <{assign var=topicwidth value=$topicwidth-10}> + <{assign var=block_reply value="width10"}> +<{/if}> +<{if $block.headers.lastpost}> + <{assign var=minwidth value=$minwidth+100}> + <{assign var=topicwidth value=$topicwidth-30}> +<{/if}> +<{assign var=block_topic value=width$topicwidth}> <!-- block topic width after reduction above --> +<div class="outer" style="min-width: <{$minwidth}>px;"> + <div class="head border x-small center"> + <div class="<{$block_topic}> floatleft"><{$block.headers.topic}></div> + <{if $block.headers.forum}> + <div class="<{$block_forum}> floatleft"><{$block.headers.forum}></div> + <{/if}> + <{if $block.headers.replies}> + <div class="<{$block_reply}> floatleft"><{$block.headers.replies}></div> + <{/if}> + <{if $block.headers.views}> + <div class="<{$block_view}> floatleft"><{$block.headers.views}></div> + <{/if}> + <div style="overflow: hidden;"><{$block.headers.lastpost}></div> + <div class="clear"></div> + </div> + <!-- start forum topic --> + <{foreachq name=loop item=topic from=$block.topics}> + <div class="<{cycle values="even,odd"}> border"> + <div class="<{$block_topic}> floatleft left"> + <{if $block.headers.approve}> + <{if $topic.approve eq 1}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=active#admin" target="_self" title="<{$smarty.const._MD_TYPE_ADMIN}>"><{$smarty.const._MD_TYPE_ADMIN}></a><{/if}> + <{if $topic.approve eq 0}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=pending#admin" target="_self" title="<{$smarty.const._MD_TYPE_PENDING}>"><{$smarty.const._MD_TYPE_PENDING}></a><{/if}> + <{if $topic.approve eq -1}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=deleted#admin" target="_self" title="<{$smarty.const._MD_TYPE_DELETED}>"><{$smarty.const._MD_TYPE_DELETED}></a><{/if}> + <br /> + <{/if}> + <{if $block.headers.topic}> + <{$topic.topic_folder}> + <a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> + <{if $block.headers.type && $topic.topic_title}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> + </a> + <{if $block.headers.attachment}><{$topic.attachment}><{/if}><{$topic.topic_page_jump}> + <br /> + <{/if}> + <{if $block.headers.lock}><{$topic.lock}><{/if}> + <{if $block.headers.sticky}><{$topic.sticky}><{/if}> + <{if $block.headers.digest}><{$topic.digest}><{/if}> + <{if $block.headers.poll}><{$topic.poll}><{/if}> + <{if $block.headers.publish }> + <br /> + <span class="xx-small"> + <{$block.headers.publish}>: <{$topic.topic_time}> + </span> + <{/if}> + <{if $block.headers.votes && $topic.votes}> + <br /> + <span class="xx-small"> + <{$block.headers.votes}>: <{$topic.votes}><{if $block.headers.ratings}> <{$topic.rating_img}><{/if}> + </span> + <{/if}> + <{if $block.headers.poster}> + <br /> + <span class="xx-small"> + <{$block.headers.poster}>: <{$topic.topic_poster}> + </span> + <{/if}> + </div> + <{if $block.headers.forum}> + <div class="<{$block_forum}> floatleft left"><{$topic.topic_forum_link}></div> + <{/if}> + <{if $block.headers.replies}> + <div class="<{$block_reply}> floatleft center"><{$topic.topic_replies}></div> + <{/if}> + <{if $block.headers.views}> + <div class="<{$block_view}> floatleft center"><{$topic.topic_views}></div> + <{/if}> + <div style="overflow: hidden;" class="right"> + <{if $block.headers.lastpost}> + <{$topic.topic_last_posttime}><br /> + <{$topic.topic_last_poster}> <{$topic.topic_page_jump_icon}> + <{/if}> + </div> + <div class="clear"></div> + </div> + <{/foreach}> + <!-- end forum topic --> +</div> +<div class="clear"></div> +<{if $block.indexNav}> + <!-- a sample of pagenav. you can create your own! --> + <div class="floatright right"> + <a href="<{$xoops_url}>/modules/newbb/viewpost.php"><{$smarty.const._MB_NEWBB_ALLPOSTS}></a> | + <a href="<{$xoops_url}>/modules/newbb/list.topic.php"><{$smarty.const._MB_NEWBB_ALLTOPICS}></a> | + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=unread"><{$smarty.const._MD_UNREAD}></a> | + <{if $block.headers.replies}> + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=unreplied"><{$smarty.const._MD_UNREPLIED}></a> | + <{/if}> + <{if $block.headers.votes}> + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=voted"><{$smarty.const._MD_VOTED}></a> | + <{/if}> + <{if $block.headers.poll}> + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=poll"><{$smarty.const._MD_POLL_POLL}></a> | + <{/if}> + <a href="<{$xoops_url}>/modules/newbb"><{$smarty.const._MB_NEWBB_VSTFRMS}></a> + </div> +<{/if}> \ No newline at end of file Added: XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js 2013-02-05 06:47:41 UTC (rev 10987) @@ -0,0 +1,78 @@ +/** + * Newbb Javascript Validation functions + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @module newbb + * @since 4.3 + * @author irmtfan + * @version $Id$ + */ + +/** +* Function for validation of xoops forms: prevent... [truncated message content] |