Default dates

Tarjei Huse <[email protected]> Fri, 14 May 2004 17:26:33 +0200
Newsgroups gmane.comp.horde.hermes
Message-ID <[email protected]>
Hi,

Attached are two patches:
1. The patch to provide the exportform in search.php. 
2. A patch that sets suggested dates in the searchform. 

Tarjei

Tarjei

-- 
hermes mailing list - Join the hunt: http://horde.org/bounties/#hermes
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
search.php.export (text/x-patch, 656 B)
Index: search.php
===================================================================
RCS file: /repository/hermes/search.php,v
retrieving revision 1.11
diff -u -r1.11 search.php
--- search.php	2 May 2004 21:25:56 -0000	1.11
+++ search.php	14 May 2004 14:36:24 -0000
@@ -67,7 +67,6 @@
 
 $title = _("Search for Time");
 require HERMES_TEMPLATES . '/common-header.inc';
-
 Hermes::menu();
 
 if ($vars->exists('id')) {
@@ -109,4 +108,7 @@
     }
 }
 
+$exportForm = &Horde_Form::singleton('ExportForm', $vars);
+$exportForm->renderActive($r, $vars, 'search.php', 'post');
+        
 require $registry->getParam('templates', 'horde') . '/common-footer.inc';
search_defaultdate.pacth (text/x-patch, 1.5 KB)
Index: lib/Search.php
===================================================================
RCS file: /repository/hermes/lib/Search.php,v
retrieving revision 1.11
diff -u -r1.11 Search.php
--- lib/Search.php	2 May 2004 21:25:56 -0000	1.11
+++ lib/Search.php	14 May 2004 15:22:42 -0000
@@ -28,11 +28,16 @@
         $this->addVariable(_("Job Types"), 'jobtypes', $type[0], false, false,
                            null, $type[1]);
 
-        $this->addVariable(_("Do not include entries before"), 'start',
+        $start = &$this->addVariable(_("Do not include entries before"), 'start',
                            'monthdayyear', false);
-        $this->addVariable(_("Do not include entries after"), 'end',
+        $end = &$this->addVariable(_("Do not include entries after"), 'end',
                            'monthdayyear', false);
-
+        $month = date('m');
+        $year  = date('Y');
+        $start->setDefault(strtotime("$year-$month-1"));
+        $month = $month+1;
+        $end->setDefault(strtotime("$year-$month-1"));
+        
         $states = array(''      => "",
                         '1'     => _("Yes"),
                         '0'     => _("No"));
@@ -132,6 +137,7 @@
 
         $formats = array('csv' => _("Comma-Separated Variable (.csv)"),
                          'tsv' => _("Tab-Separated Variable (.tsv,.txt)"),
+                         'excel' => _("Excel spreadsheet"),
                          'iif' => _("QuickBooks (.iif)"));
 
         $this->addVariable(_("Select the export format"), 'format', 'enum',