[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-dev
Subject:    [SMARTY-DEV] field_separator for html_select_time
From:       Sebastian Mendel <lists () sebastianmendel ! de>
Date:       2007-06-13 6:23:57
Message-ID: 466F8D7D.8050807 () sebastianmendel ! de
[Download RAW message or body]

Hi,

here is a patch to add field_separator option to html_select_time, like it
is for html_select_date

the separator is only added between hours, minutes and seconds - not before
display_meridian

-- 
Sebastian Mendel

www.sebastianmendel.de

["smarty_html_select_time_separator.patch" (text/plain)]

Index: libs/plugins/function.html_select_time.php
===================================================================
RCS file: /repository/smarty/libs/plugins/function.html_select_time.php,v
retrieving revision 1.14
diff -u -r1.14 function.html_select_time.php
--- libs/plugins/function.html_select_time.php	11 Oct 2005 16:22:56 -0000	1.14
+++ libs/plugins/function.html_select_time.php	18 Apr 2007 12:17:16 -0000
@@ -45,6 +45,8 @@
     $minute_extra       = null;
     $second_extra       = null;
     $meridian_extra     = null;
+    /* String printed between the different fields. */
+    $field_separator    = "\n";
 
     foreach ($params as $_key=>$_value) {
         switch ($_key) {
@@ -56,6 +58,7 @@
             case 'minute_extra':
             case 'second_extra':
             case 'meridian_extra':
+            case 'field_separator':
                 $$_key = (string)$_value;
                 break;
 
@@ -81,7 +84,9 @@
 
     $html_result = '';
 
+    $field_separator_add = false;
     if ($display_hours) {
+        $field_separator_add = true;
         $hours       = $use_24_hours ? range(0, 23) : range(1, 12);
         $hour_fmt = $use_24_hours ? '%H' : '%I';
         for ($i = 0, $for_max = count($hours); $i < $for_max; $i++)
@@ -108,6 +113,10 @@
     }
 
     if ($display_minutes) {
+        if ($field_separator_add) {
+            $html_result .= $field_separator;
+        }
+        $field_separator_add = true;
         $all_minutes = range(0, 59);
         for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval)
             $minutes[] = sprintf('%02d', $all_minutes[$i]);
@@ -135,6 +144,9 @@
     }
 
     if ($display_seconds) {
+        if ($field_separator_add) {
+            $html_result .= $field_separator;
+        }
         $all_seconds = range(0, 59);
         for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval)
             $seconds[] = sprintf('%02d', $all_seconds[$i]);


["smarty_html_select_time_separator_doc.patch" (text/plain)]

Index: docs/de/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/de/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.2
diff -u -r1.2 language-function-html-select-time.xml
--- docs/de/designers/language-custom-functions/language-function-html-select-time.xml	16 \
                Jul 2004 14:32:28 -0000	1.2
+++ docs/de/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:06:04 -0000 @@ -125,6 +125,13 @@
                         <entry>null</entry>
                         <entry>F&uuml;gt dem Meridian-'select'-Tag zus&auml;tzliche \
Attribute hinzu.</entry>  </row>
+                    <row>
+                        <entry>field_separator</entry>
+                        <entry>string</entry>
+                        <entry>Nein</entry>
+                        <entry>\n</entry>
+                        <entry>Zeichenkette die zwischen den Feldern ausgegeben \
werden soll.</entry> +                    </row>
                 </tbody>
                 </tgroup>
             </informaltable>
Index: docs/en/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/en/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.9
diff -u -r1.9 language-function-html-select-time.xml
--- docs/en/designers/language-custom-functions/language-function-html-select-time.xml	27 \
                Sep 2006 08:47:37 -0000	1.9
+++ docs/en/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:05:13 -0000 @@ -141,6 +141,13 @@
      <entry>Adds extra attributes to select/input tags if
       given</entry>
     </row>
+    <row>
+     <entry>field_separator</entry>
+     <entry>string</entry>
+     <entry>No</entry>
+     <entry>\n</entry>
+     <entry>String printed between different fields</entry>
+    </row>
    </tbody>
   </tgroup>
  </informaltable>
Index: docs/es/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/es/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.2
diff -u -r1.2 language-function-html-select-time.xml
--- docs/es/designers/language-custom-functions/language-function-html-select-time.xml	8 \
                Nov 2005 23:37:10 -0000	1.2
+++ docs/es/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:10:07 -0000 @@ -129,6 +129,13 @@
      <entry>adiciona atributos extras a las etiquetas select/input
         si fueron proporcionados</entry>
     </row>
+    <row>
+     <entry>field_separator</entry>
+     <entry>string</entry>
+     <entry>No</entry>
+     <entry>\n</entry>
+     <entry>Cadena a mostrar entre los diferentes campos</entry>
+    </row>
    </tbody>
   </tgroup>
  </informaltable>
Index: docs/fr/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/fr/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.8
diff -u -r1.8 language-function-html-select-time.xml
--- docs/fr/designers/language-custom-functions/language-function-html-select-time.xml	3 \
                Oct 2006 18:55:36 -0000	1.8
+++ docs/fr/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:10:05 -0000 @@ -147,6 +147,14 @@
      <entry>Ajoute des attributs supplmentaires aux balises
      select / input du mridian.</entry>
     </row>
+    <row>
+     <entry>field_separator</entry>
+     <entry>chane de caractres</entry>
+     <entry>Non</entry>
+     <entry>\n</entry>
+     <entry>la chane de caractres affiche entre les
+     diffrents champs.</entry>
+    </row>
    </tbody>
   </tgroup>
  </informaltable>
Index: docs/it/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/it/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.1
diff -u -r1.1 language-function-html-select-time.xml
--- docs/it/designers/language-custom-functions/language-function-html-select-time.xml	1 \
                Dec 2004 18:55:24 -0000	1.1
+++ docs/it/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:10:02 -0000 @@ -126,6 +126,13 @@
      <entry>null</entry>
      <entry>se presente aggiunge attributi extra al tag select/input</entry>
     </row>
+    <row>
+     <entry>field_separator</entry>
+     <entry>stringa</entry>
+     <entry>no</entry>
+     <entry>\n</entry>
+     <entry>stringa di separazione fra i campi</entry>
+    </row>
    </tbody>
   </tgroup>
  </informaltable>
Index: docs/ja/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/ja/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.1
diff -u -r1.1 language-function-html-select-time.xml
--- docs/ja/designers/language-custom-functions/language-function-html-select-time.xml	21 \
                Apr 2007 12:13:33 -0000	1.1
+++ docs/ja/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:08:54 -0000 @@ -138,6 +138,13 @@
      <entry>null</entry>
      <entry>am/pmのselect/inputタグに拡張属性を追 </entry>
     </row>
+    <row>
+     <entry>field_separator</entry>
+     <entry>string</entry>
+     <entry>No</entry>
+     <entry>\n</entry>
+     <entry>フィールド間に表示する文字列</entry>
+    </row>
    </tbody>
   </tgroup>
  </informaltable>
Index: docs/pt_BR/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/pt_BR/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.3
diff -u -r1.3 language-function-html-select-time.xml
--- docs/pt_BR/designers/language-custom-functions/language-function-html-select-time.xml	2 \
                Oct 2004 12:49:28 -0000	1.3
+++ docs/pt_BR/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:09:16 -0000 @@ -130,6 +130,13 @@
                         <entry>adiciona atributos
                         extras para tags select/input se fornecidas</entry>
                     </row>
+                    <row>
+                        <entry>field_separator</entry>
+                        <entry>string</entry>
+                        <entry>No</entry>
+                        <entry>\n</entry>
+                        <entry>string exibida entre os diferentes campos</entry>
+                    </row>
                 </tbody>
                 </tgroup>
             </informaltable>
Index: docs/ru/designers/language-custom-functions/language-function-html-select-time.xml
 ===================================================================
RCS file: /repository/smarty/docs/ru/designers/language-custom-functions/language-function-html-select-time.xml,v
 retrieving revision 1.8
diff -u -r1.8 language-function-html-select-time.xml
--- docs/ru/designers/language-custom-functions/language-function-html-select-time.xml	30 \
                Dec 2005 15:43:38 -0000	1.8
+++ docs/ru/designers/language-custom-functions/language-function-html-select-time.xml	12 \
Jun 2007 08:09:53 -0000 @@ -132,6 +132,13 @@
      <entry>null</entry>
      <entry>     select </entry>
     </row>
+    <row>
+     <entry>field_separator</entry>
+     <entry>string</entry>
+     <entry></entry>
+     <entry>\n</entry>
+     <entry>,  </entry>
+    </row>
    </tbody>
   </tgroup>
  </informaltable>



-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic