Extension talk:Tasks Extension

Difficulty
Great extension, lots of possibilities...Unfortunately, the parser removes the namespace when creating links on the task list. Is there a way to fix this so that the links work for pages in namespaces other than (main)? 154.20.86.196 05:01, 10 November 2005 (UTC)
 * Seconded.
 * 71.67.100.211 04:32, 13 December 2005 (UTC)
 * This is now fixed Iubito 16:03, 10 February 2006 (UTC)

--132.183.202.242 19:11, 14 February 2006 (UTC) : Great Extension, but the script doesn't extract the owner correctly, if you edit a dot (.) at the end of a task line. Can you please fix this, or provide a corrected example.

A Couple of Things
Great extension. Very handy, I especially like the special page. I have two comments / requests:


 * 1) Call me the ugly American, but a way to change the date format to American month-day-year would be nice.
 * 2) Expand it a bit with due date, and then connect it with your - equally good - Events extension

Thanks


 * Aran Deltac no longer maintain/support his extensions :( I upgraded this one to version 0.4 for my needs. Not sure I'll need events extension... Iubito 16:03, 10 February 2006 (UTC)

How to get this working with MediaWiki 1.5.6?
Is there a small Tutorial or something like that? Thanks in advance

Carsten
 * Thanks to google cache, I found the instructions written by Aran Deltac before he changed his website. I've just written them to Tasks Extension with some fixes. Hope this help ! Iubito 16:05, 10 February 2006 (UTC)

How assigned a task ?
How to assign a task to a given user ? I've understand it's possible, but haven't understand how to do it.

It's probably basic, but i can't find the way....

(french) Comment faire pour assigner une tâche à un utilisateur. J'ai cru comprendre que cela était possible, mais je ne trouve pas la bonne façon de saisir....

Paul FABING


 * Add "(User)" at the end of a task line
 * Ajoute « (Utilisateur) » à la fin d'une ligne
 * --82.255.247.96 06:11, 27 February 2006 (UTC)

Mais bon sang mais c'est bien sûr !! Merci 82.227.68.218 21:51, 2 March 2006 (UTC)

Kudos
--Metasim 14:09, 3 March 2006 (UTC)

Thanks a bunch for bringing this to MediaWiki!! Great work!

How do I put a tag in a template?
I'd like to create a template that creates tasks but it does not work. []  Thanks! -David

Compatibility with Calendar Extension:
Nice extension, Iubito! I added a little code to savetasks, specifically:

...	# Rebuild the $tasks_buffer array (in case we're on a page) clearTasks; $content = array; $tags = array; $params = array;

Parser::extractTagsAndParams( 'tasks', $text, $content, $tags, $params ); foreach($tags as $marker => $markerVal) tasksHook( $content[$marker], $params[$marker] ); ...

and added the $user and $text incoming parameters to saveTasks. This was to solve a problem where the "Calendar" extension is rendering (and parsing) text from other pages (which may contain tasks). saveTasks was then saving repeats of the tasks in the 'tasks' table, attributing them to the page that contained the "calendar" call. This modification maintains attribution to just the page being edited. martin - at - ac6rm.net

Error
--68.186.119.215 08:51, 3 April 2006 (UTC)

I am getting the following error thrown at me once for each task listed on a page:

Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

So for example, if I have [ ] Regular task (Owner User) [1] High priority task. [2] Medium priority task. [3] Low priority task (Owner User) [!] Urgent task. [x] Closed task. I will have the following php errors: Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

Notice: Undefined index: hidden in /var/www/vhosts/forgestudios.com/httpdocs/dev/extensions/Tasks.php on line 44

I am using the tabbed menu mod, but it is not in a template, nor am I using it on any page with the tasks. Other than that, it is a completely clean install. Any help would be appreciated. Thank you.

I've fixed that - I added an isset to the Tasks.php. 88.108.59.121

Fixed with isset
Could you show me an example of how you were able to fix that?

Error
When i include Tasks i got an error message

UNIQ63....

All my are replaced by this error

I am suffering from the same thing - using this extension would 'scrap' all other extensions relying on which is a shame because it is such a valuable extension 82.31.216.212 02:07, 5 July 2006 (UTC)

MediaWiki 1.6.7 support
I replaced some functions with this code to make the extension work with MediaWiki 1.6.7 :

extensions/Tasks.php ---# function formatTask( $status, $summary, $owner=, $page= ) { global $wgOut, $wgScriptPath; $imgTitle = 'Regular task'; $alt = '[ ]'; $output = '<img src="'.$wgScriptPath.'/images/task';       switch ($status) {                case 'x': $output .= '_done'; $alt = '[x]'; $imgTitle = 'Closed task'; break;                case '!': $output .= '_alert'; $alt = '[!]'; $imgTitle = 'Urgent task'; break;                case '1': $output .= '_1'; $alt = '[1]'; $imgTitle = 'High priority task'; break;                case '2': $output .= '_2'; $alt = '[2]'; $imgTitle = 'Medium priority task'; break;                case '3': $output .= '_3'; $alt = '[3]'; $imgTitle = 'Low priority task'; break;        }        $output .= '.png" width="13" height="13" alt="'.$alt.'" title="'.$imgTitle.'" /> ';
 * 1) Purpose   : HTML format a task.

if ($owner) { $summary .= ' ('.$owner.')'; } if ($page) { $summary = "$page: ".$summary; }

// parse cannot be called recursively, so we need to create a new Parser global $wgTitle; $localParser = new Parser; $options = ParserOptions::newFromUser( $wgUser ); $out = $localParser->parse($summary, $wgTitle, $options, false); $output .= $out->getText.' ';

return $output; }

function saveTasks( $article, $user, $text ) {
 * 1) Purpose   : Used after a page is saved to first delete
 * 2)             all tasks and then save the new ones created
 * 3)             in the tasks buffer.
 * 4) Parameters: article, The article object.
 * 5) rev: 2006-03-12: extension will cause double-logging of
 * 6) tasks rendered on a sub-page.  "Rebuild" section prevents this.
 * 1) tasks rendered on a sub-page.  "Rebuild" section prevents this.

global $tasks_buffer; global $wgOut; $page_id = $article->getID; $dbr =& wfGetDB( DB_MASTER ); # Delete all tasks for this page. $dbr->delete(               'tasks',                array( 'page_id' => $page_id )        );

# Rebuild the $tasks_buffer array (in case we're on a page) clearTasks; $matches = array; $elements[] = 'tasks';

$text = Parser::extractTagsAndParams( $elements, $text, $matches ); foreach( $matches as $marker => $data ) { list( $element, $content, $params, $tag ) = $data; tasksHook( $content, $params ); }

# Re-insert all tasks that were created when parsing this page. foreach ($tasks_buffer as $task) { $task['page_id'] = $page_id; $dbr->insert(                       'tasks',                        $task                ); }       return 1; }

It doesn't work for me
I don't remember the error message, 'cause I've tried a lot of things, but this didn't work for me.

As it's a parser extension, there is a 3rd parameter &$parser I add to tasksHook (and then to formatTask). It work in the articles. But the special page doesn't work anymore, 'cause it doesn't know this $parser. It only knows $wgParser which doesn't have mOptions and then fails... :'(

--Iubito 21:20, 6 July 2006 (UTC)

A local parser
It's not a good idea the local parser, because it has not the other extension registered (my summary contain and it costs some ms each time to create it.

After a big headache and a lot of help from TimStarling on IRC, I've the solution. I update the article.

--Iubito 07:03, 7 July 2006 (UTC)

Multiple tasks in one page
I got a problem when putting in more than one place on my page. i.e:

[x] foo == foo == * [1] bar * [2] foo === bar === [x] foo [1] foo [2] foo [3] foo

Someone could please help me?
 * Ponsfrilus 13:49, 10 July 2006 (UTC)
 * What output do you get? I get the same tasks repeating below, which is not the desired output.
 * Same problem here. Add clearTasks; after the global $tasks_buffer; statement in the tasksHook function.
 * Hackerssidekick 08:11, 19 July 2006 (UTC)
 * I'm getting the same behavior, every time I enter a new tasks block it displays all the tasks up to that point from the whole page.--TheChin! 18:11, 4 August 2006 (UTC)

where to find older versions
where can i find older versions of the script, so i can use it with older mediawiki versions?
 * Look at the history of the page --82.248.126.211 19:04, 16 July 2006 (UTC)

screenshot request
This is better before spending time to install .... mailto:sancelot@free.fr

Yes, please post a screenshot or running demo on a wiki.

A few comments
The version numbers should be the same for Tasks.php and Special:Tasks.php, since an overall version # is listed at the top of the page.

In MW 1.6.7 the parameters don't seem to have any effect because arg_string passed to execute is empty. Try using wgRequest instead of this parameter, it's more inline with what MW does.

--Tderouin 20:51, 21 August 2006 (UTC)

Works for MediaWiki 1.7.1 - with a couple mods
A few things I needed to do a few things to get it working in MediaWiki 1.7.1.

First, I followed the comments above in MediaWiki 1.6.7 support comment above. Copying and pasteing the revised functions.

Second, in extensions/Tasks.php I modified the function as below:

function saveTasks( $article, $user, $text ) {

global $tasks_buffer; global $wgOut; $page_id = $article->getID;

$dbr =& wfGetDB( DB_MASTER ); # Delete all tasks for this page. $dbr->delete(               'tasks',                array( 'page_id' => $page_id )        );

# Rebuild the $tasks_buffer array (in case we're on a page) # Updated parameter values and return values for extractTagsAndParams function. # The lines below work with Wiki 1.7.1 clearTasks; $matches = array; $tags = array; $params = array; $element = 'tasks'; $text = Parser::extractTagsAndParams( $element, $text, $matches, $tags, $params ); foreach( $matches as $marker => $data ) { $content = $data; addToTaskBuffer($content); }

# Re-insert all tasks that were created when parsing this page. foreach ($tasks_buffer as $task) { $task['page_id'] = $page_id; $dbr->insert(                       'tasks',                        $task                ); }       return 1; }

As mentioned in my code comments, I am not sure at what version MediaWiki cahnged the extractTagsAndParams function. I do know that I need to update this section to get the information for saving to the database in MediaWiki 1.7.1.

Now it seems to work fine. Please comment if anyone finds a better solution. I suppose one should do a little error checking here for MediaWiki version number and return the correct value no matter what version, but who has the time. :)

Robin

Use of Special:Tasks as a template
I would like to use lists of tasks as a template:

But it do not work. It work for me on Newpages:

Could not make it work with version 1.67
I have used the latest Tasks.php and SpecialTasks.php and the versions 0.51 with MediaWiki. I cannot save the tasks. I just get usual text and no formatted out put when I try to save anything with the tasks tag. The database is not getting populated either. The special page comes out empty as a result. Any ideas?

In addition following the modifications through the history and discussions is kind of confusing. Please post separately working versions for various versions of MediaWiki.

Duplicated tasks
I ran into an small bug where a page with multiple tasks would have task duplication.

The following code [ ] a [ ] b

[ ] c [ ] d [ ] e would produce the output [ ] a [ ] b

[ ] a [ ] b [ ] c [ ] d [ ] e To fix it I clear the task buffer by inserting $tasks_buffer = array; to line 30 which is just before the call to addToTaskBuffer($content) in the tasksHook function.

--Superjodash 19:15, 11 January 2007 (UTC)

Hidden Attribute ignored
working with MW 1.6.9, the extesnsion works except for the hidden parameter which seems to be ingnored (Aran originally put it at my request), the system doesn't seem to update the the hidden field in the database correctly, it is always 'n', if you set the value in the database to 'y' then it is ignored and the tasks still appear on the article page. (The idea was that hidden tasks don't appear on the article page but do in the special:tsks page), any help ?

Notice: Undefined offset
At the Special:Tasks page the following error is thrown in the header of the page:

Notice: Undefined offset: 1 in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 48 Notice: Undefined index: limit in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 53 Notice: Undefined index: owner in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 56 Notice: Undefined index: status in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 62 Notice: Undefined index: owner in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 65 Notice: Undefined index: hidden in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 68 Notice: Undefined index: owner in /home/httpd/vhosts/lalal.nl/httpsdocs/wiki/includes/SpecialTasks.php on line 82

I followed the instructions carefully, so I have no idea of what went wrong. Any ideas? Thnx in advance! --83.85.174.37 13:18, 11 February 2007 (UTC)
 * I discovered I've the problem too. I think it's due to a recent version of MW. I'll check what happen.
 * --Iubito 07:17, 13 February 2007 (UTC)


 * Solved !
 * In SpecialTasks.php, when there is if ($args['...']), replace by if (isset($args['...']))
 * and also, line 44 :

# Parse arguments. $args = array; if ($args_string != '') { foreach (explode('&',$args_string) as $pair) { $pair = explode('=',$pair); $args[$pair[0]] = $pair[1]; }	}
 * (I encapsulate the foreach in the if)
 * --Iubito 04:17, 22 February 2007 (UTC)

"My Tasks"-link in personal toolbar
Just wanted to throw in that we have edited ./includes/SkinTemplate.php ~ line 523 on our wiki, like this: $href = self::makeSpecialUrl( 'Tasks' ); $personal_urls['mytasks'] = array( 'text' => wfMsg( 'mytasks' ), 'href' => $href."/owner=".$this->username, 'active' => ( $href == $pageurl ) ); in order to get a "My Tasks" link for every user in their personal toolbar, which links to Special:Tasks/owner=Username. I thought some of you might like that too. Mutante 10:21, 20 May 2007 (UTC)
 * 1) "My Tasks"

Oh, and you need to put something like "my tasks" into MediaWiki:mytasks, too.

Can't sign tasks
As we work on Customer-related pages, we'd like to sign & date each task with ~ to keep track of WHO/WHEN a task was assigned... But we just get plain signature signs.

[ ] Do something ~(fredt34)

will do nothing.

TIA, --FredT34 13:19, 25 September 2007 (UTC)

Don't work with MediaWiki v1.11.0
The instructions don't parse in article... --201.52.31.55 00:27, 30 September 2007 (UTC)

Should work. Made a few changes : http://www.mediawiki.org/w/index.php?title=Extension%3ATasks_Extension&diff=173913&oldid=147662 --210.212.194.165 23:10, 13 March 2008 (UTC)

Hidden Attribute not effective
The 'hidden' attribute doesn't seem to hide the tasks on the article page.

Tarlachmoorhouse 12:49, 20 December 2007 (UTC)

MW1.12 Saving page with task causes Fatal error in Parser.php
Hello, On my mediawiki 1.12, when I save a page with a tasks, I get this error : Fatal error: Using $this when not in object context in /home/.../includes/Parser.php on line 563

The page is saved. I didn't tried to modify the task to see if it is changed or not.

The line 563 in Parser.php : $marker = "$uniq_prefix-$element-". sprintf('%08X', $n++). $this->mMarkerSuffix; --Iubito 16:38, 26 March 2008 (UTC)


 * Bug opened :13522:--Iubito 16:58, 26 March 2008 (UTC)


 * I get this for the PageProtectionPlus extension. I changed the class definition of the extensions' Parser to extend MW's Parser class. It didn't work, but at least the error went away.

require_once('Parser.php'); class XXXXxxxParser extends Parser { where XXXXxxxx is the name of the Extension's parser definition. --Otheus 15:44, 10 July 2008 (UTC)

Using the extension on templates don't work correct
if you use on a template, the link to the article is wrong (Namespace is ignored). --87.174.143.147 20:55, 3 May 2008 (UTC)

referring a deleted article crashes the special page
If you delete an article and run rebuild all, the specialpage:tasks crashes with the following error: 'Call to a member function getText on a non-object in extensions\ToDo\SpecialTasks.php on line 100 Check against tab. page. Sorry i can't fix it, but a different sql solve the problem. select p.* from page p, tasks t where p.page_id=t.Page_id .....

--87.174.143.147 20:55, 3 May 2008 (UTC)

image location / rewrite rules
hi, As my wiki uses short/nice urls, I use rewrite rules which only dont rewrite for urls starting with "/skins/". As i dont want to modifiy them I put the images in /skins/tasks/... I think this is generally a better place for system images. The images folder is only for wiki user uploaded stuff IMO. florian groovehunter 05:12, 1 July 2008 (UTC)

MW 1.12 Error
I am using MediaWiki 1.12 and after following the install instructions I am seeing the following error: 'Cannot modify header information - headers already sent by (output started at /var/www/mediawiki-1.12.0/extensions/Tasks.php:154) in /var/www/mediawiki-1.12.0/includes/WebResponse.php on line 10'. I am also using the following extensions: BreadCrumbs,ParserFunctions (Version 1.1.1), DiscussionThreading, New User Email Notification (Version 1.5.1) and NewUserMessage (Version 1.0.1, 2008-02-10). Any help would be greatly appreciated. --Timvaverchak 13:00, 22 July 2008 (UTC)


 * The problem is probably that you have an empty line at the end of Tasks.php ans SpecialTasks.php.
 * --Sébastien Grenier 16:20, 23 December 2008 (UTC)

In MW 1.13.3 some tasks not show
I have a list of 15 tasks like this:

[ ] 1 [ ] 2 [x] 3 [x] 4 [ ] 5 ... [ ] 14 [ ] 15

and I have only 12 tasks that show. Any ideas?


 * When I move some tasks, change the order, they appear.
 * I use a old version of Task.php (version 0.41.2), I've updated, but I got the Warning : cannot modify header information - headers already sent by (output started at /var/www/wiki/extensions/Tasks.php:154) in /var/www/wiki/includes/WebResponse.php on line 10
 * Everything is fine! I have empty line at the end of Tasks.php and SpecialTasks.php that cause the warning.
 * --Sébastien Grenier 16:21, 23 December 2008 (UTC)

To come back with my first problem, when someone type a NO-BREAK SPACE between [], like this [ ], Tasks extension will hide the line just like when you put a X like this [X]. Is there any way to avoid that? --Sébastien Grenier 18:07, 23 December 2008 (UTC)

Tidy + Tasks = too many paragraph tags!
I am using Tidy to to fix a different problem but not the Tasks Exctension os acting up. I get a bunch of extra paragraph tags around the task images. Anyone else have this issue? Can I get Tidy to ignore the Tasks? Can I turn off the tidy parsing inside the Tasks extension?

MW 1.11.0 Tasks 0.5.4

Thanks, Pete. --Mulciber 13:36, 19 February 2009 (UTC)

Is it possible to have the tasks show on the page you're creating them on?
The extension is working perfectly - however I would like to know if it's possible to have the tasks show up on the actual page I'm putting them on in addition to the Special:Tasks page. What I'm doing now is putting a To Do section at the bottom on multiple pages, and having to duplicate my tasks like this:

Task 1

Task 2

[ ]Task 1

[ ]Task 2

so I can see them on the regular page as well as the Special:Tasks page. Any way to avoid unnecessary duplication?

Thanks! 69.113.219.231 07:20, 1 November 2009 (UTC)


 * I am also having this issue on 1.15. (to the original poster, the extension would appear not to be working if you have to manually duplicate your tasks).  Tasks are created and entered into the database fine and show on the Special page.  But there is no output on the original article page.  Any suggestions?  I prefer this lightweight extension to the cumbersome Todo_Tasks, and would like to get it working!   Seems like it might be a quick fix for someone who knows the code... 216.158.20.138 21:54, 9 December 2009 (UTC)
 * Bump --SomaticJourney 16:03, 8 March 2010 (UTC)
 * I have 2 MediaWiki installations. The one on Win2K3 with IIS 6, PHP 5.2.9-2, and MySQL 5.1 works fine with this extension.  The install on Ubuntu 10.04LTS with MySQL 5.1.41-3ubuntu12.1 and PHP 5.3.2-lubuntu4.2 and Apache 2.2.14-5ubuntu8, installed with this guide, does not work with this extension.  Tasks do not show on the page with the  tags but do show on the special tasks page.  I have since upgraded both sites from MediaWiki 1.15 to 1.17alpha and get the same results.  --64.102.254.33 16:41, 7 June 2010 (UTC)

SQL statement is not postgres compatible
the sql statment that has to be executed does not work on a postgres based installation. it doesn't like at least the unsigned and the enum part.

Special page doesn't create link to correct wikipage
Extension seem to work nicely except that special page doesn't create links to correct wikipages. Instead of link to wikipage there is a broken link containing something like: Object #432 (page does not exist)

I checked that correct page_id is stored in database. It just doesn't seem to generate link properly.

I am using MediaWiki 1.15.3, PHP 5.1.6 (apache2handler) and MySQL 5.0.22

Any ideas?

--JuhaV 10:42, 25 May 2010 (UTC)

All-in-One-Directory and a Few Tips
First thing I saw is that this extension needs many files spread all over your wiki's root directory. And also, it suggest to run a query on your database to create the table it need. With all these things in my mind, I decided to install it in my work's wiki, but, to follow my work's standarts, I touched a few things and moved it's files to one directory called Tasks inside $IP/extensions/. These are the steps I walked: Create a directory called $IP/extensions/Tasks. Create a new file called $IP/extensions/Tasks/include.me.php using this content:  Create a new file called $IP/extensions/Tasks/Tasks.php using the content specified for the extensioncode. Here we have to touch some lines:<ol> Find a line with this: And replace it by: Note: Maybe this is not necessary, but I had to do it in order to make work on MediaWiki 1.17</li> Find a line with this: And replace it by: This will point every image request to a directory inside $IP/extensions/Tasks/Tasks.php</tt>.</li> </ol></li> Create a new file called $IP/extensions/Tasks/SpecialTasks.php</tt> using the content specified for the extensioncode. Here we have to touch some lines too:<ol> Find a line with this: And replace it by: On some versions of PHP, in order to call a super constructor, you need to do something like the second piece of code. Note: I hope I'm not sending fruit saying this about PHP, but it worked out for me.</li> </ol></li> Create a directory called $IP/extensions/Tasks/images</tt> and download all images suggested for the extension into itimages.</li> Last step is just add this line at the end of your LocalSettings.php: </li></ol> All this stuff may be a little bit strange, but now, I have this extension isolated in it's own directory, and if I need to remove it, I just remove it from LocalSettings.php and delete it from $IP/extensions</tt>.

I hope this will help any of you, and thanks for loosing your time reading this section.

--Daemonraco 01:43, 25 September 2010 (UTC)
 * --Daemonraco 01:49, 25 September 2010 (UTC): I'm sorry if I repeated a tip already told, It wasn't my intension

Working in 1.18
I've only been working with this extension for a couple of months, but I like it's simplicity. Does what I need and easy to use. When I updated to 1.18 it stopped working. After a fair bit of fiddling I was able to make it work. Instead of posting the changes to the code, I'm just going to post the code that worked for me. Fair warning; I'm an amateur developer at best, so no guarantees.


 * 1) Create folder extensions/Tasks
 * 2) Create folder extensions/Tasks/images
 * 3) Copy the images from Tasks_Extension (image file names should all start with 'Task_')
 * 4) Copy/paste the code below to respective files.
 * 5) Add  to LocalSettings.php.
 * 6) Create _tasks Table inside your database by running the mySQL code on the Extension Page

working in 1.18.1
The above code works like a charm, out of the box. Opfeifer 22:26, 26 January 2012 (UTC)