Issue:Select discussion by category of talk page

From FollowTheScore
Revision as of 15:01, 8 November 2007 by Test (talk | contribs) (New page: {{Issue |Type = Feature |Extension = DPL |Version = ? |Description = |Status = open }} == Feature == Objective: show latest changes to discussions about articles h...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Description:
Extension / Version: DPL   /   ?
Type / Status: Feature   /   open

Feature

Objective: show latest changes to discussions about articles having a category. The discussion page should not need to have a category assigned. I made a quick hack to do that: (sametitlenamespace is unused)

diff -ru DynamicPageList-1.5.2/DynamicPageList2.php DynamicPageList-1.5.2-mjs/DynamicPageList2.php
--- DynamicPageList-1.5.2/DynamicPageList2.php	2007-11-02 19:58:06.000000000 +0100
+++ DynamicPageList-1.5.2-mjs/DynamicPageList2.php	2007-11-08 13:10:41.000000000 +0100
@@ -226,7 +226,7 @@
  *			offset and count are now implemented directly in SQL
  */
 
-define('DPL2_VERSION', '1.5.2');               // current version 
+define('DPL2_VERSION', '1.5.2+mjs');               // current version 
 
 
 
@@ -680,7 +680,15 @@
 	 * Empty value (default) means no limit.
 	 * Not applicable to mode=category.
 	 */
-	'titlemaxlength'       => array('default' => '', 'pattern' => '/^\d*$/')
+	'titlemaxlength'       => array('default' => '', 'pattern' => '/^\d*$/'),
+
+	/**
+	 * search for a page with the same title in another namespace (this is normally the article to a talk page)
+	 */
+	'sametitlecategory'    => NULL,
+	'sametitlenamespace'   => NULL
+
+
 );
 
 /**
@@ -1124,6 +1132,8 @@
 	$aNamespaces = array();
 	
 	$aExcludeNamespaces  = array();
+
+	$sSameTitleCategory = null;
 	
 	// Output
 	$output = '';
@@ -1867,6 +1877,9 @@
 			case 'oneresultfooter':
 				$sOneResultFooter = $sArg;
 				break;
+			case 'sametitlecategory':
+				$sSameTitleCategory = $sArg;
+				break;
 				
 			/**
 			 * DEBUG, RESET and CACHE PARAMETER
@@ -2549,6 +2562,15 @@
 	
 	// page_id=pl.pl_from (if pagelinks table required)
 	$sSqlWhere .= $sSqlCond_page_pl;
+
+	if ( isset($sSameTitleCategory) && $sSameTitleCategory !== null ) {
+		$sSqlWhere .= " AND $sPageTable.page_title IN (
+			select p2.page_title
+			from $sPageTable p2
+			inner join $sCategorylinksTable clstc ON (clstc.cl_from = p2.page_id AND clstc.cl_to = ".$dbr->addQuotes($sSameTitleCategory)." )
+			where p2.page_namespace = 0
+			) ";
+	}
 	
 	// GROUP BY ...
 	if ($sSqlGroupBy!='') {

--mjs 15:01, 8 November 2007 (CET)


Reply