[whups] CSV Template

Mike Baptiste mike@msbnetworks.net
Thu Nov 21 18:26:05 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Out of necessity after struggling to get Query Builder to query :)  I've
added a CSV Template to import data into Excel, etc.

See attached diffs if we want this to be a stock report.

You'll note in my data patch I commented about using an existing data
mapping to trip a strformat.  Maybe we add a config array that maps the
template variable name to a type of string format which would allow for
a simple array existance check and contains data check.

Mike
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE93SU8tbf8BjvL+3ERAmFGAJ9piSZibfX/d+CO4f03EQuBRpVMfgCfTHoM
8tGILGtWYHnxCQuXATgrmxQ=
=zliy
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: data.php
===================================================================
RCS file: /repository/whups/data.php,v
retrieving revision 1.5
diff -u -r1.5 data.php
--- data.php    18 Nov 2002 19:11:48 -0000      1.5
+++ data.php    21 Nov 2002 18:23:37 -0000
@@ -33,6 +33,13 @@
 $tickets = $backend->getTicketsByProperties($info);
 foreach ($tickets as $id => $info) {
     $tickets[$id]['_date'] = strftime('%x', $info['timestamp']);
+    // There has to be a way to do this in a loop by using an existing field mapping
+    if ($info['_date_assigned']) {
+        $tickets[$id]['_date_assigned'] = strftime('%x', $info['_date_assigned']);
+    }
+    if ($info['_date_resolved']) {
+        $tickets[$id]['_date_resolved'] = strftime('%x', $info['_date_resolved']);
+    }
     $tickets[$id]['_owner_name'] = Whups::formatUser($info['user_id_owner'], false);
 }
-------------- next part --------------
Index: templates.php.dist
===================================================================
RCS file: /repository/whups/config/templates.php.dist,v
retrieving revision 1.1
diff -u -r1.1 templates.php.dist
--- templates.php.dist  18 Nov 2002 03:49:59 -0000      1.1
+++ templates.php.dist  21 Nov 2002 18:21:53 -0000
@@ -34,3 +34,13 @@

 </table>'
 );
+
+$_templates['csv'] = array(
+    'type' => 'searchresults',
+    'name' => _("Comma Separated Values"),
+    'template' => 'ID,Summary,State,Type,Priority,Module,Version,Owner,Created,Assigned,Resolved
+<loop:tickets>
+<tag:tickets.id />,<tag:tickets.summary />,<tag:tickets._state_name />,<tag:tickets._type_name />,<tag:tickets._priority_name />,<tag:tickets._module_name />,<tag:tickets._version_name />,<tag:tickets._owner_name />,<tag:tickets._date />,<tag:tickets._date_assigned />,<tag:tickets._date_resolved />
+</loop:tickets>
+'
+);


More information about the whups mailing list