From: Jonny B. <jo...@ti...> - 2010-07-29 19:32:31
|
On 29 Jul 2010, at 19:43, Sylvie Greverend wrote: > It is a little bit redundant with the export param in trackerlist but I > suppose why not: > you give the option to export without having a preview of the first > items... Yes, i know - the main point was to avoid scaring people with the tracker export page. I did ponder making a new plugin, but then i'd either have to refactor (a lot) or copy/paste lots - both bad! Seem to work so far, hope it's useful for others jonny > > On Thu, 2010-07-29 at 18:25 +0000, jon...@us... > wrote: >> Revision: 28200 >> http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=28200&view=rev >> Author: jonnybradley >> Date: 2010-07-29 18:25:29 +0000 (Thu, 29 Jul 2010) >> >> Log Message: >> ----------- >> [ENH] Trackerfilter plugin: New export facility. >> Export CVS of filtered items directly from trackerfilter plugin. Set export button label to activate (can only filter _or_ export currently). >> Also uses export_itemid, export_status, export_created, export_modif and export_charset params - not exposed to plugin editor by default. >> >> Modified Paths: >> -------------- >> trunk/lib/wiki-plugins/wikiplugin_trackerfilter.php >> trunk/templates/wiki-plugins/wikiplugin_trackerfilter.tpl >> >> Modified: trunk/lib/wiki-plugins/wikiplugin_trackerfilter.php >> =================================================================== >> --- trunk/lib/wiki-plugins/wikiplugin_trackerfilter.php 2010-07-29 18:18:23 UTC (rev 28199) >> +++ trunk/lib/wiki-plugins/wikiplugin_trackerfilter.php 2010-07-29 18:25:29 UTC (rev 28200) >> @@ -46,6 +46,11 @@ >> 'description' => tra('List of colon separated tracker id\'s to also POST data for so multiple trackerfilers can be used on one page.' . >> ' Each trackerfilter is assigned an id, e.g. "#iTrackerFilter1" onwards, as the page is rendered. (requires javascript)'), >> ), >> + 'export_action' => array( >> + 'required' => false, >> + 'name' => tra('Export CSV.'), >> + 'description' => 'Label for an export button. Leave blank to show the usual "Filter" button instead.', >> + ), >> ) ); >> >> return array( >> @@ -65,7 +70,8 @@ >> if ($prefs['feature_trackers'] != 'y') { >> return $smarty->fetch("wiki-plugins/error_tracker.tpl"); >> } >> - $default = array('noflipflop'=>'n', 'action'=>'Filter', 'line' => 'n', 'displayList' => 'n', 'other_filters' => ''); //tra('Filter') >> + $default = array('noflipflop'=>'n', 'action'=>'Filter', 'line' => 'n', 'displayList' => 'n', 'other_filters' => '', 'export_action' => '', >> + 'export_itemid' => 'y', 'export_status' => 'n', 'export_created' => 'n', 'export_modif' => 'n', 'export_charset' => 'UTF-8'); >> $params = array_merge($default, $params); >> extract($params, EXTR_SKIP); >> $dataRes = ''; >> @@ -119,7 +125,7 @@ >> if (empty($trackerId) && !empty($_REQUEST['trackerId'])) { >> $trackerId = $_REQUEST['trackerId']; >> } >> - if (empty($_REQUEST['filter'])) { // look if not coming from an initial >> + if (empty($_REQUEST['filter']) && empty($export_action)) { // look if not coming from an initial and not exporting >> foreach ($_REQUEST as $key =>$val) { >> if (substr($key, 0, 2) == 'f_') { >> $_REQUEST['filter'] = 'y'; >> @@ -179,6 +185,15 @@ >> $smarty->assign_by_ref('trackerId', $trackerId); >> $smarty->assign_by_ref('line', $line); >> $smarty->assign('iTrackerFilter', $iTrackerFilter); >> + if (!empty($export_action)) { >> + $smarty->assign('export_action', $export_action); >> + $smarty->assign('export_fields', implode(':', $fields)); >> + $smarty->assign('export_itemid', $export_itemid == 'y' ? 'on' : ''); >> + $smarty->assign('export_status', $export_status == 'y' ? 'on' : ''); >> + $smarty->assign('export_created', $export_created == 'y' ? 'on' : ''); >> + $smarty->assign('export_modif', $export_modif == 'y' ? 'on' : ''); >> + $smarty->assign('export_charset', $export_charset); >> + } >> if ($displayList == 'n' || !empty($_REQUEST['filter']) || $noflipflop == 'y') { >> $open = 'y'; >> } else { >> >> Modified: trunk/templates/wiki-plugins/wikiplugin_trackerfilter.tpl >> =================================================================== >> --- trunk/templates/wiki-plugins/wikiplugin_trackerfilter.tpl 2010-07-29 18:18:23 UTC (rev 28199) >> +++ trunk/templates/wiki-plugins/wikiplugin_trackerfilter.tpl 2010-07-29 18:25:29 UTC (rev 28200) >> @@ -7,7 +7,14 @@ >> {button _text="{tr}Filters{/tr}" _flip_id="trackerFilter$iTrackerFilter"} >> {/if} >> <div id="trackerFilter{$iTrackerFilter}" style="display:{if $open eq 'y' or $line eq 'y' or $prefs.javascript_enabled ne 'y' and $noflipflop ne 'y'}block{else}none{/if}"> >> -{if empty($inForm)}<form action="{$smarty.server.PHP_SELF}?{query}" method="post">{/if} >> +{if empty($inForm)} >> + {if empty($export_action)} >> + <form action="{$smarty.server.PHP_SELF}?{query}" method="post"> >> + {else} >> + <form action="tiki-export_tracker.php" method="post"> >> + {query _type='form_input' listfields=$export_fields showItemId=$export_itemid showStatus=$export_status showCreated=$export_created showLastModif=$export_modif encoding=$export_charset} >> + {/if} >> +{/if} >> <input type="hidden" name="trackerId" value="{$trackerId}" /> >> <input type="hidden" name="iTrackerFilter" value="{$iTrackerFilter}" /> >> {if !empty($count_item)}<input type="hidden" name="count_item" value="{$count_item}" />{/if} >> @@ -84,8 +91,17 @@ >> {if $line ne 'y'}</tr>{else} {/if} >> {/foreach} >> {if $line ne 'y' and $action and $action neq " "}<tr>{/if} >> -{if $action and $action neq " "} >> -<td> </td><td><input class="button submit" type="submit" name="filter" value="{if empty($action)}{tr}Filter{/tr}{else}{tr}{$action}{/tr}{/if}" /></td> >> +{if ($action and $action neq " ") or !empty($export_action)} >> +<td> </td> >> +<td> >> + {if !empty($export_action)} >> + <input class="button submit" type="submit" name="export_filter" value="{tr}{$export_action}{/tr}" /> >> + {elseif $action and $action neq " "} >> + <input class="button submit" type="submit" name="filter" value="{if empty($action)}{tr}Filter{/tr}{else}{tr}{$action}{/tr}{/if}" /> >> + {else} >> + >> + {/if} >> +</td> >> {/if} >> {if !empty($sortchoice)} >> {if $line ne 'y'}<tr>{/if} >> >> >> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. >> >> ------------------------------------------------------------------------------ >> The Palm PDK Hot Apps Program offers developers who use the >> Plug-In Development Kit to bring their C/C++ apps to Palm for a share >> of $1 Million in cash or HP Products. Visit us here for more details: >> http://p.sf.net/sfu/dev2dev-palm >> _______________________________________________ >> Tikiwiki-cvs mailing list >> Tik...@li... >> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs > > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Tikiwiki-cvs mailing list > Tik...@li... > https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs |