4 * This plugin extracts todo items(@@TODO, @@DONE, @@CANCELLED ) from the
5 * page it is run on. A change to ewiki_control_links submitted with
6 * this plugin adds a link back to the 'normal' view.
8 * This plugin is designed to work with the EWikiCSS plugins but they are
10 * Load this plugin _after_ the core ewiki.php script.
12 * Defining a new set of $ewiki_config["extracttypes"] will allow you to
13 * extract other one line items once an $ewiki_plugins["action"]["exXXXX"]
16 * See http://erfurtwiki.sourceforge.net/?id=TodoExtractorPlugin for more
19 * AndyFundinger(Andy@burgiss.com)
21 * Add this text to your WikiMarkup page to explain this plugin to your users:
25 * Start a todo item with @@ followed by a todo item type, item types are:
28 ** @@cancelled AF: cancelled
29 ** @@dEaDlInE AF: dEaDlInE
31 * Case of the class names does not matter.
32 * DO NOT use a colon ":" after the class name, this may seem logical but it will cause problems for EWikiCSS
33 * The ErfurtWiki:ToDoExtractorPlugin will extract todos and headlines from pages on which it is used.
34 * See our ToDoListConvention for more information and guidelines.
38 $ewiki_t["en"]["EXTODOFROM"] = "Todos extracted from ";
39 $ewiki_t["en"]["EXTTODO"] = "Extract todo List";
40 $ewiki_t["en"]["VIEWCOMPL"] = "View complete page";
41 $ewiki_t["en"]["EXTODOPOSTSCRIPT"] = "\n\nplease follow our [ToDoListConvention]";
42 $ewiki_t["de"]["EXTODOFROM"] = "ToDos aus ";
43 $ewiki_t["de"]["EXTTODO"] = "Zeige ToDo-Liste";
44 $ewiki_t["de"]["VIEWCOMPL"] = "Zeige komplette Seite";
45 $ewiki_t["de"]["EXTODOPOSTSCRIPT"] = "\n\nBitte folge unserer [ToDoListConvention]";
47 $ewiki_plugins["action"]["extodo"] = "ewiki_extract";
48 $ewiki_config["action_links"]["extodo"]=$ewiki_config["action_links"]["view"];
49 $ewiki_config["action_links"]["extodo"]["view"] = ewiki_t("VIEWCOMPL");
50 $ewiki_config["action_links"]["view"]["extodo"] = ewiki_t("EXTTODO");
52 $ewiki_config["extracttypes"]["extodo"]=array("TODO","DONE","CANCELLED","SUBJECT","DEADLINE");
54 function ewiki_extract($id, $data, $action){
55 global $ewiki_links,$ewiki_config, $ewiki_plugins, $ewiki_ring, $ewiki_title;
57 $extracttypes = $ewiki_config["extracttypes"][$action];
59 $o = ewiki_make_title($id, ewiki_t(strtoupper($action)."FROM").$ewiki_title, 2, $action, "", "_MAY_SPLIT=1");
61 //ignore any number of list markup tags in front of an @@{todotype},
62 //extract only the @@, the types, and their message
64 //extract any header line
66 preg_match_all("/^(([-;:#\* ]*)(@@(".implode("|",$extracttypes).")(.*))|(!+.*))$/im",$data["content"],$matches);
67 for($index=0;$index<sizeof($matches[0]);$index++){
68 //a line will be either header or todo, concatenate the two sub expressions
69 $extractedContent.=$matches[3][$index].$matches[6][$index]."\n\n";
72 //Render extracted lines as a wiki page, this code extracted from ewiki_page
74 #-- render requested wiki page <-- goal !!!
75 $o .= "<div class='ewiki_page_todolist'>".$ewiki_plugins["render"][0] ( $extractedContent.ewiki_t(strtoupper($action)."POSTSCRIPT") , 1,
76 EWIKI_ALLOW_HTML || (@$data["flags"]&EWIKI_DB_F_HTML) )."</div>";
78 #-- control line + other per-page info stuff
79 if ($pf_a = $ewiki_plugins["view_append"]) {
81 foreach ($pf_a as $n => $pf) {
83 $o .= $pf($id, $data, $action);
86 if ($pf_a = $ewiki_plugins["view_final"]) {
88 foreach ($pf_a as $n => $pf) {
89 if(!preg_match('/_title/',$pf)){
90 $pf($o, $id, $data, $action);