Find me on Twitter.

"Bugfixing" Extensions

edit

Solution for empty Special:Tasklist-Page

edit

The basic issue is that the extension only displays Tasks assgined to the $fullname of a user. So I modified the code in TodoTasks_body.php around line 299 of the original file to:

$wgOut->addWikiText(sprintf(wfMsgTL('tasklistbyname'), $fullname));
/* Show Todo items assigned to full name */
$wgOut->addWikiText("<dpl> uses=Template:Todo\n notuses=Template:Status Legend\n include={Todo}.dpl\n includematch=/${fullname}/i\n </dpl>");
/* Show Todo items assgigned to username */
$wgOut->addWikiText("<dpl> uses=Template:Todo\n notuses=Template:Status Legend\n include={Todo}.dpl\n includematch=/${username}/i\n </dpl>");

/* Show tasks in progress */
$wgOut->addWikiText(sprintf(wfMsgTL('tasklistbynameinprogress'), $fullname));
/* Show in-progress items assigned to full name */
$wgOut->addWikiText("<dpl> uses=Template:InProgress\n notuses=Template:Status Legend\n include={InProgress}.dpl\n includematch=/${fullname}/i\n </dpl>"); 
/* Show in-progress items assgigned to username */
$wgOut->addWikiText("<dpl> uses=Template:InProgress\n notuses=Template:Status Legend\n include={InProgress}.dpl\n includematch=/${username}/i\n </dpl>");

I guess that could be handled prettier, if you would change somthing around line 289 ff., where the extension checks for the names.

        foreach ($u as $user) {
            if (!$user) {
                $user = $wgUser;
            }
            $username = $user->getName();
            $fullname = $user->getRealName();
            // FIXME: Notice Undefined offset: 1 in extensions\TodoTasks\SpecialTaskList_body.php on line 306
            // If GetRealName does not contain one or more spaces.
            list ($firstname, $lastname) = preg_split('/ /', $fullname);

But I am not that deep into PHP.

Solution for redirecting to homepage when displaying projects in Special:TaskListByProject

edit

The problem seems to be a wrong FORM-method call, which is changed as follows:

In the TodoTasks_body.php, you'll find at the end (around line 353 of the original file):

	function ValidProjectsForm() {
		global $wgOut;

		$titleObj = SpecialPage::getTitleFor( "TaskListByProject" );
		$kiaction = $titleObj->getLocalUrl();

		$validprojects = preg_split('/\s*\*\s*/', getValidProjects(), -1, PREG_SPLIT_NO_EMPTY);

		if( $validprojects ) {
			$wgOut->addHTML("<FORM ACTION=\"{$kiaction}\" METHOD=GET><LABEL FOR=project>" .
			wfMsgTL('tasklistchooseproj') . "</LABEL>");
			$wgOut->addHTML("<select name=project>");

			foreach ($validprojects as $vp) {
				$wgOut->addHTML("<option value=\"$vp\">$vp</option>");
			}
	
			$wgOut->addHTML("</select><INPUT TYPE=submit VALUE='" . wfMsgTL('tasklistprojdisp') . "'></FORM>");
		}
	}

Just change the form method from GET to POST in line 362 (highlighted above) to:

			$wgOut->addHTML("<FORM ACTION=\"{$kiaction}\" METHOD=POST><LABEL FOR=project>" .