DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:avtaskbox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:avtaskbox [2015-03-26 16:38] 89.245.244.41plugin:avtaskbox [2022-08-08 20:46] (current) – [Changelog] sherri
Line 1: Line 1:
-====== DokuWiki Plugin : AV Task Box ======+====== AV Task Box Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Generates nicely formatted boxes for describing project tasks or user stories. +description: Generates nicely formatted boxes for describing project tasks or user stories 
-author     : Sherri W. (http://SyntaxSeed.com) +author     : Sherri W. (http://SyntaxSeed.com/
-email      : (use my website to contact me)+email      : 
 type       : syntax type       : syntax
-lastupdate : 2013-02-25 +lastupdate : 2022-08-08 
-compatible : 2012-10-132008-05-05++compatible : 2018-04-22b+2020-07-29+, 2022-07-31+
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
 tags       : task, pm, projects, userstory, boxes, GTD, todo tags       : task, pm, projects, userstory, boxes, GTD, todo
- +downloadurl: https://github.com/syntaxseed/avtaskbox/archive/master.zip 
-downloadurl: http://syntaxseed.com/downloads/plugin-avtaskbox.zip +bugtracker : https://github.com/syntaxseed/avtaskbox/issues 
-bugtracker :  +sourcerepo : https://github.com/syntaxseed/avtaskbox
-sourcerepo : +
 donationurl:  donationurl: 
 +
 +screenshot_img: https://raw.githubusercontent.com/syntaxseed/avtaskbox/master/example.png
 ---- ----
  
 ===== Description ===== ===== Description =====
-With this plugin you can format task or userstory information into nice tables for doing project management or keeping a todolist. 
  
-Screenshot and info available here: [[http://syntaxseed.com/project/avtaskbox/|AV Task Box]]+With this plugin you can format task or user-story information into nice tables for doing project management or keeping a todolist.
  
-Updated Feb 25, 2013 to support latest version of Dokuwiki. Fixed image bug.  --- [[user>sherri|Sherri]] //2013/02/25 21:23//+===== Syntax and Usage =====
  
-===== Syntax and Usage ===== 
 <code> <code>
 <task> <task>
Line 44: Line 43:
   * You can leave out any of the items(attributes), or leave them blank, and it will still look okay.   * You can leave out any of the items(attributes), or leave them blank, and it will still look okay.
   * The entire thing is wrapped in a span with the CSS class "avtaskbox" so you can style it in your CSS.   * The entire thing is wrapped in a span with the CSS class "avtaskbox" so you can style it in your CSS.
 +
 ===== Output ===== ===== Output =====
-{{http://syntaxseed.com/assets/screenshots/avtaskbox.png?nolink}} 
  
 +{{https://raw.githubusercontent.com/syntaxseed/avtaskbox/master/example.png?nolink}}
  
 ===== Installation ===== ===== Installation =====
  
-  * **Plugin Manager:** Paste this URL into the Plugin Manager to install AVTaskBox automatically: [[http://syntaxseed.com/downloads/plugin-avtaskbox.zip]] +  * **Plugin Manager:** Paste this URL into the Plugin Manager to install AVTaskBox automatically: [[https://github.com/syntaxseed/avtaskbox/archive/master.zip]]
-  * **Manually:** To get the plugin to work, manually install the plugin: +
-    - Make a new directory ''avtaskbox/'' in your plugins directory. +
-    - Add the source code below to a file ''syntax.php'' in the avtaskbox directory. +
  
 ===== Known Bugs ===== ===== Known Bugs =====
Line 62: Line 58:
 ===== To Do ===== ===== To Do =====
  
-  * Nothing.+  * Make priorities colored. 
 +  * Support Dokuwiki syntax inside description box. 
 +  * Use a div instead of a table?
  
 ===== Changelog ===== ===== Changelog =====
  
-  * ** 2009-11-19 **+  * **2009-11-19**
     * created plugin.     * created plugin.
-  * ** 2013-02-25 **+  * **2013-02-25**
     * Fixed image url and minor layout bugs.     * Fixed image url and minor layout bugs.
     * Image fix by user monoceros84.     * Image fix by user monoceros84.
     * Updated this wiki page to remove comments that have been fixed.     * Updated this wiki page to remove comments that have been fixed.
 +  * **2020-02-07** 
 +    * Update for PHP v 7+ 
 +    * Add to GitHub repo. 
 +  * **2022-08-08** 
 +    * Fix broken blank image in progress bar. 
 +    * Confirmed support for 2022-07-31 "Igor".
  
 ===== Source ===== ===== Source =====
  
-==== syntax.php ==== +https://github.com/syntaxseed/avtaskbox
-<code php> +
-<?php +
-/* +
- * DokuWiki task box plugin +
- * Copyright (C) 2013 Sherri Wheeler +
- * Usage: +
- * +
- * <task> +
- * TITLE: A test task +
- * PRIORITY: High +
- * ESTIMATE: 4h +
- * PROGRESS: 10% +
- * ASSIGNED: Sherri +
- * DESCRIPTION: Some stuff for you. You can have newlines in this part. Description must be the last item. +
- * </task> +
- *  +
- * This program is free software; you can redistribute it and/or modify +
- * it under the terms of the GNU General Public License as published by +
- * the Free Software Foundation; either version 2 of the License, or +
- * (at your option) any later version. +
- *  +
- * This program is distributed in the hope that it will be useful, +
- * but WITHOUT ANY WARRANTY; without even the implied warranty of +
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +
- * GNU General Public License for more details. +
- *  +
- * You should have received a copy of the GNU General Public License +
- * along with this program; if not, write to the Free Software +
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA +
- */ +
-  +
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +
-require_once(DOKU_PLUGIN.'syntax.php'); +
-  +
-class syntax_plugin_avtaskbox extends DokuWiki_Syntax_Plugin +
-+
-  +
- /** +
- * return some info +
- */ +
- function getInfo() +
-+
- return array +
-+
- 'author' => 'Sherri Wheeler', +
- 'email'  => 'Use my website: http://syntaxseed.com', +
- 'date'   => '2013-02-25', +
- 'name'   => 'AV Task Box', +
- 'desc'   => 'Creates task/user story table boxes.', +
- 'url' => 'http://syntaxseed.com/project/avtaskbox/', +
- ); +
-+
-  +
- /** +
- * What kind of syntax are we? +
- */ +
- function getType() +
-+
- return 'substition'; +
-+
-  +
- /** +
- * Where to sort in? +
- */  +
- function getSort() +
-+
- return 999; +
-+
-  +
-  +
- /** +
-     * Connect pattern to lexer +
-     */ +
-    function connectTo($mode) { +
-      $this->Lexer->addEntryPattern('\<task\>',$mode,'plugin_avtaskbox'); +
-    } +
-  +
-    function postConnect() { +
-      $this->Lexer->addExitPattern('\</task\>','plugin_avtaskbox'); +
-    } +
-  +
-  +
-    /** +
-     * Handle the match +
-     */ +
-    function handle($match, $state, $pos, &$handler){ +
-        switch ($state) { +
-          case DOKU_LEXER_ENTER :  +
-            return array($state, ''); +
-          case DOKU_LEXER_MATCHED : +
-            break; +
-          case DOKU_LEXER_UNMATCHED :+
  
- $resultStr '<table class="inline" width="500">'; +==== Contributing ====
-  +
- preg_match('/^Title:(.*?)$/isxm', $match, $matches); +
- $title (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; +
-  +
- preg_match('/^Priority:(.*?)$/isxm', $match, $matches); +
- $priority =(!empty($matches[1]) && strlen(trim($matches[1]))>0) ? 'Priority: '.trim($matches[1]) : '&nbsp;'; +
-  +
- preg_match('/^Estimate:(.*?)$/isxm', $match, $matches); +
- $estimate (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? ' of '.trim($matches[1]) : '&nbsp;'; +
-  +
- preg_match('/^Assigned:(.*?)$/isxm', $match, $matches); +
- $assigned (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? '('.trim($matches[1]).')' : '&nbsp;'; +
-  +
- preg_match('/^Progress:(.*?)$/isxm', $match, $matches); +
- $progress (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? intval(preg_replace('[^0-9]','',$matches[1])) : '0'; +
-  +
- preg_match('/Description:(.*)/isx', $match, $matches); +
- $description = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; +
- +
- if($progress<0){$progress=0;+
- if($progress>100){$progress=100;+
- $sizeLeft = 100-$progress; +
-             +
- $progbar .= '<span style="margin-top:3px;padding:0;height:8px;width: 100px;">'.($progress<=0 ? '' : '<span style="margin:0;padding:0;background-color:#74a6c9; height:8px; width:'.$progress.'"><img src="'.dirname($_SERVER['PHP_SELF']).'/lib/images/blank.gif" height="8" width="'.$progress.'" border="0" title="'.$progress.'%" alt="'.$progress.'%" hspace="0" vspace="0" style="height:8px;" /></span>') . ($progress>=100 ? '' : '<span style="margin:0;padding:0;background-color: #dee7ec;height:8px;width:'.$sizeLeft.'"><img src="'.dirname($_SERVER['PHP_SELF']).'/lib/images/blank.gif" height="8" width="'.$sizeLeft.'" border="0" title="'.$progress.'%" alt="'.$progress.'%" hspace="0" vspace="0" style="height:8px;" /></span>') .'</span>'; +
-             +
- $resultStr .= '<tr class="row0"><th><b>'.$title.'</b><span style="float:right;font-weight:normal;">'.$assigned.'</span></th></tr>'; +
- $resultStr .= '<tr><td>'.nl2br($description).'</td></tr>'; +
-     $resultStr .= '<tr><td><span style="float:right;font-size:0.9em;">('.$progress.'%'.$estimate.') '.$progbar.'</span>'.$priority.'</td></tr>'; +
-  +
-  +
- $resultStr .= '</table>'; +
- +
-            $match = $resultStr; +
-            return array($state, $match); +
- +
- +
-          case DOKU_LEXER_EXIT : +
-            return array($state, ''); +
-          case DOKU_LEXER_SPECIAL : +
-            break; +
-        } +
-        return array(); +
-    } +
-  +
- +
-    /** +
-     * Create output +
-     */ +
-    function render($mode, &$renderer, $data) { +
-      if($mode == 'xhtml'){ +
-        list($state, $match) = $data; +
-           +
-        switch ($state) { +
-          case DOKU_LEXER_ENTER :  +
-            $renderer->doc .= "<span class='avtaskbox'>";  +
-            break; +
- +
-          case DOKU_LEXER_MATCHED : +
-            break; +
- +
-          case DOKU_LEXER_UNMATCHED : +
- +
-            $renderer->doc .= $match; break;           +
- +
-          case DOKU_LEXER_EXIT : +
-            $renderer->doc .= "</span>";  +
-            break; +
- +
-          case DOKU_LEXER_SPECIAL : +
-            break; +
-        } +
-        return true;  +
-      } +
- return false; +
-+
-+
- +
-?> +
-</code>+
  
 +Please submit a PR to the GitHub repo.
  
 ===== Comments / Discussion ===== ===== Comments / Discussion =====
Line 262: Line 94:
 //peter 2010/05/20 17:25//. //peter 2010/05/20 17:25//.
  
-Hi everybody, I think it's an ice plugin. However, what I'm passionately missing is support of dokuwikis formatting options within the DESCRIPTION Field. This unfortunately limits the usability of this (and many other similar) plugin(s) for me. 
-//jan 2010/09/30 17:52//. 
---- 
- 
-==== Coloured Priority Task List ==== 
- 
-Having changed quite some stuff in the plug-in code a coloured list was created. The task tables are coloured in yellow by default. If a task is completed it appears green. If a high priority ('high', 'critical', 'h', 'hoch', 'kritisch') is set, the deadline comes within the next 4 weeks or the task is already created since over one year is will be marked in red and the relevant criterion is written in bold font. 
- 
-For this reason, two dates are to be given for each task: the deadline and the creation date. Format: month/day/year. 
- 
-<code> 
-<task> 
-TITLE: A test task 
-PRIORITY: High 
-DEADLINE: 12/10/2010 
-OPENED: 10/29/2010 
-ESTIMATE: 4h 
-PROGRESS: 10% 
-ASSIGNED: Sherri 
-DESCRIPTION: Some stuff for you. You can have newlines in this part. Description must be the last item. 
-</task> 
-</code> 
- 
- 
-Copy the following and replace **syntax.php** to use it **(Warning: this code based on older version of this plugin)**: 
- 
-<file php> 
-<?php 
-/* 
- * DokuWiki task box plugin 
- * Copyright (C) 2009 Sherri Wheeler 
- * Usage: 
- * 
- * <task> 
- * TITLE: A test task 
- * PRIORITY: High 
- * DEADLINE: 12/10/2010 
- * OPENED: 10/29/2010 
- * ESTIMATE: 4h 
- * PROGRESS: 10% 
- * ASSIGNED: Sherri 
- * DESCRIPTION: Some stuff for you. You can have newlines in this part. Description must be the last item. 
- * </task> 
-  
- * This program is free software; you can redistribute it and/or modify 
- * it under the terms of the GNU General Public License as published by 
- * the Free Software Foundation; either version 2 of the License, or 
- * (at your option) any later version. 
-  
- * This program is distributed in the hope that it will be useful, 
- * but WITHOUT ANY WARRANTY; without even the implied warranty of 
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
- * GNU General Public License for more details. 
-  
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
- */ 
-  
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
-require_once(DOKU_PLUGIN.'syntax.php'); 
-  
-class syntax_plugin_avtaskbox extends DokuWiki_Syntax_Plugin 
-{ 
-  
- /** 
- * return some info 
- */ 
- function getInfo() 
- { 
- return array 
- ( 
- 'author' => 'Sherri Wheeler', 
- 'email'  => 'Use my website: www.start.ofitall.com', 
- 'date'   => '2009-11-19', 
- 'name'   => 'AV Task Box', 
- 'desc'   => 'Creates task/user story table boxes.', 
- 'url' => 'http://www.source.ofitall.com', 
- ); 
- } 
-  
- /** 
- * What kind of syntax are we? 
- */ 
- function getType() 
- { 
- return 'substition'; 
- } 
-  
- /** 
- * Where to sort in? 
- */  
- function getSort() 
- { 
- return 999; 
- } 
-  
-  
- /** 
-     * Connect pattern to lexer 
-     */ 
-    function connectTo($mode) { 
-      $this->Lexer->addEntryPattern('\<task\>',$mode,'plugin_avtaskbox'); 
-    } 
-  
-    function postConnect() { 
-      $this->Lexer->addExitPattern('\</task\>','plugin_avtaskbox'); 
-    } 
-  
-  
-    /** 
-     * Handle the match 
-     */ 
-    function handle($match, $state, $pos, &$handler){ 
-        switch ($state) { 
-          case DOKU_LEXER_ENTER :  
-            return array($state, ''); 
-          case DOKU_LEXER_MATCHED : 
-            break; 
-          case DOKU_LEXER_UNMATCHED : 
- 
- preg_match('/^Title:(.*?)$/isxm', $match, $matches); 
- $title = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Priority:(.*?)$/isxm', $match, $matches); 
- $priority =(!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Deadline:(.*?)$/isxm', $match, $matches); 
- $deadline = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Opened:(.*?)$/isxm', $match, $matches); 
- $opened = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Estimate:(.*?)$/isxm', $match, $matches); 
- $estimate = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? ' von '.trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Assigned:(.*?)$/isxm', $match, $matches); 
- $assigned = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? '('.trim($matches[1]).')' : '&nbsp;'; 
-  
- preg_match('/^Progress:(.*?)$/isxm', $match, $matches); 
- $progress = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? intval(preg_replace('[^0-9]','',$matches[1])) : '0'; 
-  
- preg_match('/Description:(.*)/isx', $match, $matches); 
- $description = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
- 
- if($progress<0){$progress=0;} 
- if($progress>100){$progress=100;} 
- $sizeLeft = 100-$progress; 
- $progbar .= '<span style="margin-top:3px;padding:0;height:8px;width: 100px;">'.($progress<=0 ? '' : '<span style="margin:0;padding:0;background-color:#74a6c9; height:8px; width:'.$progress.'"><img src="'.dirname($_SERVER['PHP_SELF']).'/lib/images/blank.gif" height="8" width="'.$progress.'" border="0" title="'.$progress.'%" alt="'.$progress.'%" hspace="0" vspace="0" style="" /></span>') . ($progress>=100 ? '' : '<span style="margin:0;padding:0;background-color: #dee7ec;height:8px;width:'.$sizeLeft.'"><img src="'.dirname($_SERVER['PHP_SELF']).'/lib/images/blank.gif" height="8" width="'.$sizeLeft.'" border="0" title="'.$progress.'%" alt="'.$progress.'%" hspace="0" vspace="0" style="" /></span>') .'</span>'; 
-  
-  
-  
- #mark yellow as standard 
- $priority_color = '#f8ffab'; 
- $priority_color_dark = '#7a672f'; 
- $priority_reason_priority = false; 
- $priority_reason_opened = false; 
- $priority_reason_deadline = false; 
- #mark red if high priority 
- if  ($priority=='Hoch' || $priority=='High' || $priority=='H' || $priority=='Kritisch' || $priority=='Critical') { 
- $priority_color = '#ffa3ae'; 
- $priority_color_dark = '#ab0014'; 
- $priority_reason_priority = true; 
- } 
- #mark red if topic opened for over one year 
- if (strtotime($opened)+31536000<=time()) { 
- $priority_color = '#ffa3ae'; 
- $priority_color_dark = '#ab0014'; 
- $priority_reason_opened = true; 
- } 
- #mark red if deadline within 4 weeks 
- if (strtotime($deadline)-2419200<=time()) { 
- $priority_color = '#ffa3ae'; 
- $priority_color_dark = '#ab0014'; 
- $priority_reason_deadline = true; 
- } 
- #mark green if done 
- if ($progress==100){ 
- $priority_color = '#ccffcc'; 
- $priority_color_dark = '#669966'; 
- $priority_reason_priority = false; 
- $priority_reason_opened = false; 
- $priority_reason_deadline = false; 
- } 
-  
-  
- $resultStr = '<table class="inline" width="500">'; 
-  
-  
- $resultStr .= '<tr class="row0"><th style="background-color:'.$priority_color_dark.'; color:#ffffff;"><b>'.$title.'</b><span style="float:right;font-weight:normal;">'.$assigned.'</span></th></tr>'; 
- $resultStr .= '<tr style="background-color:'.$priority_color.'"><td>'.nl2br($description).'</td></tr>'; 
- $resultStr .= '<tr style="background-color:'.$priority_color.'"><td><span'.($priority_reason_deadline ? ' style="font-weight:bold;"' : '').'>Termin: '.date("d.m.Y", strtotime($deadline)).'</span><span style="float:right;"><span'.($priority_reason_opened ? ' style="font-weight:bold;"' : '').'>Eingestellt: '.date("d.m.Y", strtotime($opened)).'</span></span></td></tr>'; 
- $resultStr .= '<tr style="background-color:'.$priority_color.'"><td valign="middle"><span'.($priority_reason_priority ? ' style="font-weight:bold;"' : '').'>Priorit&auml;t: '.$priority.'</span><span style="float:right;font-size:-1;">('.$progress.'%'.$estimate.') '.$progbar.'</span></td></tr>'; 
-  
-  
- $resultStr .= '</table>'; 
-  
-            $match = $resultStr; 
-            return array($state, $match); 
- 
- 
-          case DOKU_LEXER_EXIT : 
-            return array($state, ''); 
-          case DOKU_LEXER_SPECIAL : 
-            break; 
-        } 
-        return array(); 
-    } 
-  
- 
-    /** 
-     * Create output 
-     */ 
-    function render($mode, &$renderer, $data) { 
-      if($mode == 'xhtml'){ 
-        list($state, $match) = $data; 
-           
-        switch ($state) { 
-          case DOKU_LEXER_ENTER :  
-            $renderer->doc .= "<span class='avtaskbox'>";  
-            break; 
- 
-          case DOKU_LEXER_MATCHED : 
-            break; 
- 
-          case DOKU_LEXER_UNMATCHED : 
- 
-            $renderer->doc .= $match; break;           
- 
-          case DOKU_LEXER_EXIT : 
-            $renderer->doc .= "</span>";  
-            break; 
- 
-          case DOKU_LEXER_SPECIAL : 
-            break; 
-        } 
-        return true;  
-      } 
- return false; 
- } 
-} 
  
-?> +wonderful plugin, thank you! \\ 
-</file>+i'd like to link pages within the text. \\ 
 +//dominique 2022/08/05//
  
-//monoceros84 2010/10/28 15:40// 
  
-01/06/2011 - Thank you monoceros80 for adding the colors!  Some of the words were in German and the date format was d.m.Y.  I have converted the words into English and converted the date format to m.d.Y.  Copy code below and replace the code in syntax.php 
-<file php> 
-<?php 
-/* 
- * DokuWiki task box plugin 
- * Copyright (C) 2009 Sherri Wheeler 
- * Usage: 
- * 
- * <task> 
- * TITLE: A test task 
- * PRIORITY: High 
- * DEADLINE: 12/10/2010 
- * OPENED: 10/29/2010 
- * ESTIMATE: 4h 
- * PROGRESS: 10% 
- * ASSIGNED: Sherri 
- * DESCRIPTION: Some stuff for you. You can have newlines in this part. Description must be the last item. 
- * </task> 
-  
- * This program is free software; you can redistribute it and/or modify 
- * it under the terms of the GNU General Public License as published by 
- * the Free Software Foundation; either version 2 of the License, or 
- * (at your option) any later version. 
-  
- * This program is distributed in the hope that it will be useful, 
- * but WITHOUT ANY WARRANTY; without even the implied warranty of 
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
- * GNU General Public License for more details. 
-  
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
- */ 
-  
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
-require_once(DOKU_PLUGIN.'syntax.php'); 
-  
-class syntax_plugin_avtaskbox extends DokuWiki_Syntax_Plugin 
-{ 
-  
- /** 
- * return some info 
- */ 
- function getInfo() 
- { 
- return array 
- ( 
- 'author' => 'Sherri Wheeler', 
- 'email'  => 'Use my website: www.start.ofitall.com', 
- 'date'   => '2009-11-19', 
- 'name'   => 'AV Task Box', 
- 'desc'   => 'Creates task/user story table boxes.', 
- 'url' => 'http://www.source.ofitall.com', 
- ); 
- } 
-  
- /** 
- * What kind of syntax are we? 
- */ 
- function getType() 
- { 
- return 'substition'; 
- } 
-  
- /** 
- * Where to sort in? 
- */  
- function getSort() 
- { 
- return 999; 
- } 
-  
-  
- /** 
-     * Connect pattern to lexer 
-     */ 
-    function connectTo($mode) { 
-      $this->Lexer->addEntryPattern('\<task\>',$mode,'plugin_avtaskbox'); 
-    } 
-  
-    function postConnect() { 
-      $this->Lexer->addExitPattern('\</task\>','plugin_avtaskbox'); 
-    } 
-  
-  
-    /** 
-     * Handle the match 
-     */ 
-    function handle($match, $state, $pos, &$handler){ 
-        switch ($state) { 
-          case DOKU_LEXER_ENTER :  
-            return array($state, ''); 
-          case DOKU_LEXER_MATCHED : 
-            break; 
-          case DOKU_LEXER_UNMATCHED : 
-  
- preg_match('/^Title:(.*?)$/isxm', $match, $matches); 
- $title = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Priority:(.*?)$/isxm', $match, $matches); 
- $priority =(!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Deadline:(.*?)$/isxm', $match, $matches); 
- $deadline = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Opened:(.*?)$/isxm', $match, $matches); 
- $opened = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Estimate:(.*?)$/isxm', $match, $matches); 
- $estimate = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? ' of '.trim($matches[1]) : '&nbsp;'; 
-  
- preg_match('/^Assigned:(.*?)$/isxm', $match, $matches); 
- $assigned = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? '('.trim($matches[1]).')' : '&nbsp;'; 
-  
- preg_match('/^Progress:(.*?)$/isxm', $match, $matches); 
- $progress = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? intval(preg_replace('[^0-9]','',$matches[1])) : '0'; 
-  
- preg_match('/Description:(.*)/isx', $match, $matches); 
- $description = (!empty($matches[1]) && strlen(trim($matches[1]))>0) ? trim($matches[1]) : '&nbsp;'; 
-  
- if($progress<0){$progress=0;} 
- if($progress>100){$progress=100;} 
- $sizeLeft = 100-$progress; 
- $progbar .= '<span style="margin-top:3px;padding:0;height:8px;width: 100px;">'.($progress<=0 ? '' : '<span style="margin:0;padding:0;background-color:#74a6c9; height:8px; width:'.$progress.'"><img src="'.dirname($_SERVER['PHP_SELF']).'/lib/images/blank.gif" height="8" width="'.$progress.'" border="0" title="'.$progress.'%" alt="'.$progress.'%" hspace="0" vspace="0" style="" /></span>') . ($progress>=100 ? '' : '<span style="margin:0;padding:0;background-color: #dee7ec;height:8px;width:'.$sizeLeft.'"><img src="'.dirname($_SERVER['PHP_SELF']).'/lib/images/blank.gif" height="8" width="'.$sizeLeft.'" border="0" title="'.$progress.'%" alt="'.$progress.'%" hspace="0" vspace="0" style="" /></span>') .'</span>'; 
-  
-  
-  
- #mark yellow as standard 
- $priority_color = '#f8ffab'; 
- $priority_color_dark = '#7a672f'; 
- $priority_reason_priority = false; 
- $priority_reason_opened = false; 
- $priority_reason_deadline = false; 
- #mark red if high priority 
- if  ($priority=='High' || $priority=='H' || $priority=='Critical') { 
- $priority_color = '#ffa3ae'; 
- $priority_color_dark = '#ab0014'; 
- $priority_reason_priority = true; 
- } 
- #mark red if topic opened for over one year 
- if (strtotime($opened)+31536000<=time()) { 
- $priority_color = '#ffa3ae'; 
- $priority_color_dark = '#ab0014'; 
- $priority_reason_opened = true; 
- } 
- #mark red if deadline within 4 weeks 
- if (strtotime($deadline)-2419200<=time()) { 
- $priority_color = '#ffa3ae'; 
- $priority_color_dark = '#ab0014'; 
- $priority_reason_deadline = true; 
- } 
- #mark green if done 
- if ($progress==100){ 
- $priority_color = '#ccffcc'; 
- $priority_color_dark = '#669966'; 
- $priority_reason_priority = false; 
- $priority_reason_opened = false; 
- $priority_reason_deadline = false; 
- } 
-  
-  
- $resultStr = '<table class="inline" width="500">'; 
-  
-  
- $resultStr .= '<tr class="row0"><th style="background-color:'.$priority_color_dark.'; color:#ffffff;"><b>'.$title.'</b><span style="float:right;font-weight:normal;">'.$assigned.'</span></th></tr>'; 
- $resultStr .= '<tr style="background-color:'.$priority_color.'"><td>'.nl2br($description).'</td></tr>'; 
- $resultStr .= '<tr style="background-color:'.$priority_color.'"><td><span'.($priority_reason_deadline ? ' style="font-weight:bold;"' : '').'>Deadline: '.date("m.d.Y", strtotime($deadline)).'</span><span style="float:right;"><span'.($priority_reason_opened ? ' style="font-weight:bold;"' : '').'>Start: '.date("m.d.Y", strtotime($opened)).'</span></span></td></tr>'; 
- $resultStr .= '<tr style="background-color:'.$priority_color.'"><td valign="middle"><span'.($priority_reason_priority ? ' style="font-weight:bold;"' : '').'>Priority: '.$priority.'</span><span style="float:right;font-size:-1;">('.$progress.'%'.$estimate.') '.$progbar.'</span></td></tr>'; 
-  
-  
- $resultStr .= '</table>'; 
-  
-            $match = $resultStr; 
-            return array($state, $match); 
-  
-  
-          case DOKU_LEXER_EXIT : 
-            return array($state, ''); 
-          case DOKU_LEXER_SPECIAL : 
-            break; 
-        } 
-        return array(); 
-    } 
-  
-  
-    /** 
-     * Create output 
-     */ 
-    function render($mode, &$renderer, $data) { 
-      if($mode == 'xhtml'){ 
-        list($state, $match) = $data; 
-  
-        switch ($state) { 
-          case DOKU_LEXER_ENTER :  
-            $renderer->doc .= "<span class='avtaskbox'>";  
-            break; 
-  
-          case DOKU_LEXER_MATCHED : 
-            break; 
-  
-          case DOKU_LEXER_UNMATCHED : 
-  
-            $renderer->doc .= $match; break;           
-  
-          case DOKU_LEXER_EXIT : 
-            $renderer->doc .= "</span>";  
-            break; 
-  
-          case DOKU_LEXER_SPECIAL : 
-            break; 
-        } 
-        return true;  
-      } 
- return false; 
- } 
-} 
-  
-?> 
-</file> 
  
-01/06/2011 - Zmartant  
plugin/avtaskbox.1427384306.txt.gz · Last modified: 2015-03-26 16:38 by 89.245.244.41

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki