[evolvis-commits] r17736: make [#1754] datepicker actually useful↵ [#2214] javascript-control-datepicker pending merges:↵ Thorsten Glaser 2011-11-30 datepicker account prefs↵ Thorsten Glaser 2011-11-30 example conversion to datepicker, just as PoC and test

mirabilos at evolvis.org mirabilos at evolvis.org
Wed Nov 30 15:02:38 CET 2011


Author: mirabilos
Date: 2011-11-30 15:02:38 +0100 (Wed, 30 Nov 2011)
New Revision: 17736

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/www/account/index.php
   trunk/gforge_base/evolvisforge-5.1/src/www/pm/calendar.php
Log:
make [#1754] datepicker actually useful
[#2214] javascript-control-datepicker pending merges:
  Thorsten Glaser 2011-11-30 datepicker account prefs
    Thorsten Glaser 2011-11-30 example conversion to datepicker, just as PoC and test


Modified: trunk/gforge_base/evolvisforge-5.1/src/www/account/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/account/index.php	2011-11-30 14:02:34 UTC (rev 17735)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/account/index.php	2011-11-30 14:02:38 UTC (rev 17736)
@@ -25,6 +25,7 @@
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfcommon.'include/timezones.php';
+require_once $gfcommon.'include/datepick.php';
 
 $feedback = htmlspecialchars(getStringFromRequest('feedback'));
 $error_msg = htmlspecialchars(getStringFromRequest('error_msg'));
@@ -39,6 +40,8 @@
     exit_error($u->getErrorMessage(),'my');
 }
 
+$datefrmt = $u->getPreference('datepick_format');
+
 if (getStringFromRequest('submit')) {
 	if (!form_key_is_valid(getStringFromRequest('form_key'))) {
 		exit_form_double_submit('my');
@@ -49,6 +52,7 @@
 	$lastname = getStringFromRequest('lastname');
 	$language = getIntFromRequest('language');
 	$timezone = getStringFromRequest('timezone');
+	$datefrmt = getStringFromRequest('datefrmt');
 	$theme_id = getIntFromRequest('theme_id');
 	$ccode = getStringFromRequest('ccode');
 	$address = getStringFromRequest('address');
@@ -81,6 +85,9 @@
 		form_release_key(getStringFromRequest('form_key'));
 		$error_msg = $u->getErrorMessage();
 		$refresh_url = '/account/?error_msg='.urlencode($error_msg);
+	} else if (!$u->setPreference('datepick_format', $datefrmt)) {
+		$feedback .= _('Couldn’t set datepicker format: ') .
+		    htmlentities(db_error()) . '<br />';
 	} else {
 		$feedback = _('Updated');
 		$refresh_url = '/account/?feedback='.urlencode($feedback);
@@ -159,6 +166,12 @@
 </tr>
 
 <tr valign="top">
+<td><?php echo _('Datepicker Format:'); ?> </td>
+<td><?php echo html_build_select_box_from_assoc($datepick_locales, 'datefrmt', $datefrmt); ?>
+</td>
+</tr>
+
+<tr valign="top">
 <td><?php echo _('Theme:'); ?> </td>
 <td><?php echo html_get_theme_popup('theme_id', $u->getThemeID()); ?>
 </td>

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/pm/calendar.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/pm/calendar.php	2011-11-30 14:02:34 UTC (rev 17735)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/pm/calendar.php	2011-11-30 14:02:38 UTC (rev 17736)
@@ -33,13 +33,22 @@
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'pm/include/ProjectGroupHTML.class.php';
+require_once $gfcommon.'include/datepick.php';
 
 $group_id = getIntFromRequest('group_id');
 $group_project_id = getIntFromRequest('group_project_id');
-$year = getIntFromRequest('year');
-$month = getIntFromRequest('month');
-$day = getIntFromRequest('day');
 $type = getStringFromRequest('type');
+$timet = datepick_parse(getStringFromRequest('dpick'));
+if ($timet === false) {
+	$timet = time();
+	$year = 0;
+	$month = 0;
+	$day = 0;
+} else {
+	$year = (int)strftime('%Y', $timet);
+	$month = (int)strftime('%m', $timet);
+	$day = (int)strftime('%d', $timet);
+}
 
 // Some sanity checks first.
 if ($year && ($year < 1990 || $year > 2020)) {
@@ -124,6 +133,7 @@
 	}
 }
 
+datepick_prepare();
 pm_header(array('title'=>_('Calendar'),'group'=>$group_id));
 
 /**
@@ -266,28 +276,7 @@
 				</select>
 			</td>
 			<td><?php echo _('Date'); ?><br />
-				<select name="year">
-<?php
-
-	for ($i = 1990; $i < 2020; $i++) {
-		print "\t\t\t\t<option value=\"$i\"" . ($year == $i ? ' selected="selected"' : '') . ">$i</option>\n";
-	}
-?>
-				</select>
-				<select name="month">
-<?php
-	for ($i = 1; $i <= 12; $i++) {
-		print "\t\t\t\t<option value=\"$i\"" . ($month == $i ? ' selected="selected"' : '') . ">" . $months[$i] . "</option>\n";
-	}
-?>
-				</select>
-				<select name="day">
-<?php
-	for ($i = 1; $i <= 31; $i++) {
-		print "\t\t\t\t<option value=\"$i\"" . ($day == $i ? ' selected="selected"' : '') . ">$i</option>\n";
-	}
-?>
-				</select>
+				<?php datepick_emit('dpick', datepick_format($timet)); ?>
 			</td>
 			<td>
 				<input type="submit" value="<?php echo _('Update') ?>" />



More information about the evolvis-commits mailing list