summaryrefslogtreecommitdiffstats
path: root/install/ui/src/freeipa/ipa.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-01-10 17:28:27 +0100
committerPetr Viktorin <pviktori@redhat.com>2014-03-13 15:59:44 +0100
commit870a5daf24c165069fe6f546bb3710f9b3880538 (patch)
treeb21a65cc0291e15c0fde84c5b61d6ac024260750 /install/ui/src/freeipa/ipa.js
parent05f612e58a4954162dcaa724585869819ca77672 (diff)
downloadfreeipa-870a5daf24c165069fe6f546bb3710f9b3880538.tar.gz
freeipa-870a5daf24c165069fe6f546bb3710f9b3880538.tar.xz
freeipa-870a5daf24c165069fe6f546bb3710f9b3880538.zip
webui: Datetime parsing and formatting
this patch implements: - output_formatter in field. It should be used in par with formatter. Formatter serves for datasource->widget conversion, output_formatter for widget->datasource format conversion. - datetime module which parses/format strings in subset of ISO 8601 and LDAP generalized time format to Date. - utc formatter replaced with new datetime formatter - datetime_validator introduced - new datetime field, extension of text field, which by default uses datetime formatter and validator Dojo was regenerated to include dojo/string module https://fedorahosted.org/freeipa/ticket/4194 Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa/ipa.js')
-rw-r--r--install/ui/src/freeipa/ipa.js39
1 files changed, 3 insertions, 36 deletions
diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
index e6f10d8a2..1d58712de 100644
--- a/install/ui/src/freeipa/ipa.js
+++ b/install/ui/src/freeipa/ipa.js
@@ -27,11 +27,12 @@ define([
'./jquery',
'./json2',
'./_base/i18n',
+ './datetime',
'./metadata',
'./builder',
'./reg',
'./text'],
- function(keys, $, JSON, i18n, metadata_provider, builder, reg, text) {
+ function(keys, $, JSON, i18n, datetime, metadata_provider, builder, reg, text) {
/**
* @class
@@ -573,7 +574,7 @@ IPA.update_password_expiration = function() {
var now, expires, notify_days, diff, message, container;
expires = IPA.whoami.krbpasswordexpiration;
- expires = expires ? IPA.parse_utc_date(expires[0]) : null;
+ expires = expires ? datetime.parse(expires[0]) : null;
notify_days = IPA.server_config.ipapwdexpadvnotify;
notify_days = notify_days ? notify_days[0] : 0;
@@ -621,40 +622,6 @@ IPA.password_selfservice = function() {
};
/**
- * Parse value as UTC date
- * @member IPA
- * @return Data
- */
-IPA.parse_utc_date = function(value) {
-
- if (!value) return null;
-
- // verify length
- if (value.length != 'YYYYmmddHHMMSSZ'.length) {
- return null;
- }
-
- // We only handle GMT
- if (value.charAt(value.length -1) !== 'Z') {
- return null;
- }
-
- var date = new Date();
-
- date.setUTCFullYear(
- value.substring(0, 4), // YYYY
- value.substring(4, 6)-1, // mm (0-11)
- value.substring(6, 8)); // dd (1-31)
-
- date.setUTCHours(
- value.substring(8, 10), // HH (0-23)
- value.substring(10, 12), // MM (0-59)
- value.substring(12, 14)); // SS (0-59)
-
- return date;
-};
-
-/**
* Call an IPA command over JSON-RPC.
*
* @class IPA.command