BUGFIX: move some text into the message box
[e-DoKo.git] / include / preferences.php
index 0485d9ec0f9b6a611c8d254664893cfdd0d9ef71..d3cbf925466f46a560ba738a0bb0bffa30d0660c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
+/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 Arun Persaud <arun@nubati.net>
  *
  *   This file is part of e-DoKo.
  *
@@ -49,6 +49,8 @@ display_user_menu($myid);
 
 /* get old infos */
 $PREF = DB_get_PREF($myid);
+/* set language chosen in preferences, will become active on the next reload (see index.php)*/
+$_SESSION['language'] = $PREF['language'];
 $timezone =  DB_get_user_timezone($myid);
 
 DB_update_user_timestamp($myid);
@@ -86,7 +88,7 @@ if(myisset('vacation_start','vacation_stop','vacation_comment') &&
       $changed_vacation = -1;
 
     /* test if we should delete the entry */
-    if($vacation_start == '- 00:00:00')
+    if($_REQUEST['vacation_start'] == $_REQUEST['vacation_stop'])
       {
        $result = DB_query("DELETE FROM User_Prefs".
                           " WHERE user_id='$myid' AND pref_key='vacation start'" );
@@ -337,12 +339,12 @@ if($PREF['vacation_start'])
   $value = substr($PREF['vacation_start'],0,10);
  else
    $value = '';
-echo "            <td>"._('start').":<input type=\"text\" id=\"vacation_start\" name=\"vacation_start\" size=\"10\" maxlength=\"10\" value=\"$value\" /></td>\n";
+echo "            <td>"._('start').":<input type=\"date\" class=\"date\" name=\"vacation_start\" value=\"$value\" /></td>\n";
 if($PREF['vacation_stop'])
   $value = substr($PREF['vacation_stop'],0,10);
  else
    $value = '';
-echo "            <td>"._('stop').":<input type=\"text\" id=\"vacation_stop\" name=\"vacation_stop\" size=\"10\" maxlength=\"10\" value=\"$value\" /></td>\n";
+echo "            <td>"._('stop').":<input type=\"date\" class=\"date\" name=\"vacation_stop\" value=\"$value\" /></td>\n";
 if($PREF['vacation_comment'])
   $value = $PREF['vacation_comment'];
 else
@@ -351,7 +353,7 @@ echo '            <td>'._('comment:')."<input type=\"text\" id=\"vacation_commen
 if($changed_vacation == 1) echo _('changed');
 if($changed_vacation == -1) echo _('wrong date format');
 echo "</td></tr>\n";
-echo '<tr><td></td><td>'._('use YYYY-MM-DD').'</td><td>'._("use '-'  in start field to unset vacation")."</td></tr>\n";
+echo '<tr><td></td><td colspan="2">'._("set both dates to the same day to end vacation")."</td></tr>\n";
 echo '        <tr><td>'._('Notification').":          </td><td>\n";
 echo "          <select id=\"notify\" name=\"notify\" size=\"1\">\n";
 if($PREF['email']=="emailaddict")
@@ -538,8 +540,23 @@ if($changed_openid)
 echo "    </fieldset>\n";
 echo '    <fieldset><legend>'._('Submit')."</legend><input type=\"submit\"  name=\"passwd\" value=\"set\" /></fieldset>\n";
 echo "  </form>\n";
-echo ' <p>'._('E-DoKo uses <a href=\"http://www.gravatar.org\">gravatars</a> as icons.').'</p>';
+echo ' <p>'._('E-DoKo uses <a href="http://www.gravatar.org">gravatars</a> as icons.').'</p>';
 echo "</div>\n";
 
+// add jquery date picker if html5 is not available
+?>
+<script>
+  var i = document.createElement("input");
+  i.setAttribute("type", "date");
+  if (i.type == "text") {
+    $(":date").dateinput({
+
+        format: 'yyyy-mm-dd',
+      });
+  }
+</script>
+<?php
+
+
 return;
 ?>
\ No newline at end of file