Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

[patch] field_separator for html_select_time
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Wed Apr 18, 2007 12:32 pm    Post subject: [patch] field_separator for html_select_time Reply with quote

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

patch/diff against CVS head:
Code:

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]);


Last edited by cybot on Thu Apr 19, 2007 7:04 am; edited 1 time in total
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Apr 18, 2007 6:45 pm    Post subject: Reply with quote

You could just make $field_separator = '' (empty) by default, and always catenate it (instead of testing for $field_separator_add)
Back to top
View user's profile Send private message Visit poster's website
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Thu Apr 19, 2007 7:02 am    Post subject: Reply with quote

no,

- $field_separator is empty by default, i just used "\n" to be in sync with html_select_date

- $field_separator_add is used to check if there is really a field before so not end up in

HH:MM:SS
:MM:SS
::SS

but

HH:MM:SS
MM:SS
SS

$field_separator_add is not an user option, only $field_separator like with html_select_date, $field_separator_add is only used to ensure display $field_separator ONLY BETWEEN fields even if not all fields displayed
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Thu Apr 19, 2007 7:03 am    Post subject: Reply with quote

btw. is this the right place to post patches?
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Apr 19, 2007 4:04 pm    Post subject: Reply with quote

You can post patches here, if for no other reason to get some initial feedback. The best place to post patches is probably the smarty-dev mailing list. Include your patches as plain text attachments and for best results, makes sure the file is using unix line endings.
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Thu Apr 19, 2007 4:12 pm    Post subject: Reply with quote

i have to subscribe to the dev mailinglist just for submitting one patch?

... complicated ...
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Apr 19, 2007 4:24 pm    Post subject: Reply with quote

No, like I said, you can submit patches here; however, the smarty-dev mailing list is low volume and if you are submitting patches, it wouldn't (shouldn't!) hurt for you to be subscribed. Finally, it really isn't complicated. I don't really know why you would say that it is. AFAIK, it is fairly standard for FLOSS projects. Its not like you need an developer account or have to pass some sort of vetting process.

Anyways, we are here and we are listening Smile
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Fri Apr 20, 2007 7:37 am    Post subject: Reply with quote

oh, thats fine, i missread your post somehow.

i know about lists, dev and all that stuff ... Wink (phpMyAdmin dev team)

i was just get your last post wrong.
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Tue Apr 24, 2007 8:38 am    Post subject: Reply with quote

will this be accepted, or does it require some work to be accepted?
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 24, 2007 2:23 pm    Post subject: Reply with quote

Seems okay to me. I've been too busy to test recently -- if no one else gets to it, I will try get it committed in the next few days.

Thanks for the patch, cybot!
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Tue Jun 12, 2007 7:56 am    Post subject: Reply with quote

any chance to get this patch applied?

any changes required?

patch for doc required too?

i just ask if it is a time problem so i can save my time too providing new patches ...
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Tue Jun 12, 2007 8:18 am    Post subject: Reply with quote

patch for the doc:

Code:
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>

Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Jun 12, 2007 5:48 pm    Post subject: Reply with quote

Monte, Messju, can you take a look and commit? Seems okay to me -- I'm just swamped and can't get to this for now.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Jun 12, 2007 6:33 pm    Post subject: Reply with quote

Send your patches to the dev list, phpbb doesn't seem to like them.

Thanks
Back to top
View user's profile Send private message Visit poster's website
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Tue Jun 12, 2007 10:19 pm    Post subject: Reply with quote

why not enable file uploads in forum?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP