Diffstat (limited to 'frontend/gamma/js/Clipperz/Date.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Date.js | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/frontend/gamma/js/Clipperz/Date.js b/frontend/gamma/js/Clipperz/Date.js index 020d77b..163790e 100644 --- a/frontend/gamma/js/Clipperz/Date.js +++ b/frontend/gamma/js/Clipperz/Date.js | |||
@@ -1,46 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Date) == 'undefined') { Clipperz.Date = {}; } | 25 | if (typeof(Clipperz.Date) == 'undefined') { Clipperz.Date = {}; } |
28 | 26 | ||
29 | Clipperz.Date.VERSION = "0.1"; | 27 | Clipperz.Date.VERSION = "0.1"; |
30 | Clipperz.Date.NAME = "Clipperz.Date"; | 28 | Clipperz.Date.NAME = "Clipperz.Date"; |
31 | 29 | ||
32 | MochiKit.Base.update(Clipperz.Date, { | 30 | MochiKit.Base.update(Clipperz.Date, { |
33 | 31 | ||
34 | //------------------------------------------------------------------------- | 32 | //------------------------------------------------------------------------- |
35 | 33 | ||
36 | '__repr__': function () { | 34 | '__repr__': function () { |
37 | return "[" + this.NAME + " " + this.VERSION + "]"; | 35 | return "[" + this.NAME + " " + this.VERSION + "]"; |
38 | }, | 36 | }, |
39 | 37 | ||
40 | //------------------------------------------------------------------------- | 38 | //------------------------------------------------------------------------- |
41 | 39 | ||
42 | 'toString': function () { | 40 | 'toString': function () { |
43 | return this.__repr__(); | 41 | return this.__repr__(); |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
@@ -218,76 +216,73 @@ MochiKit.Base.update(Clipperz.Date, { | |||
218 | result = " + aDate.getGMTOffset()"; | 216 | result = " + aDate.getGMTOffset()"; |
219 | break; | 217 | break; |
220 | case "T": | 218 | case "T": |
221 | result = " + Clipperz.Date.getTimezone(aDate)"; | 219 | result = " + Clipperz.Date.getTimezone(aDate)"; |
222 | break; | 220 | break; |
223 | case "Z": | 221 | case "Z": |
224 | result = " + ( + aDate.getTimezoneOffset() * -60)"; | 222 | result = " + ( + aDate.getTimezoneOffset() * -60)"; |
225 | break; | 223 | break; |
226 | default: | 224 | default: |
227 | result = " + '" + aCharacter + "'"; | 225 | result = " + '" + aCharacter + "'"; |
228 | break; | 226 | break; |
229 | }; | 227 | }; |
230 | 228 | ||
231 | return result; | 229 | return result; |
232 | }, | 230 | }, |
233 | 231 | ||
234 | //========================================================================= | 232 | //========================================================================= |
235 | 233 | ||
236 | 'formatDateWithPHPLikeTemplateAndLocale': function(aDate, aFormat, aLocale) { | 234 | 'formatDateWithPHPLikeTemplateAndLocale': function(aDate, aFormat, aLocale) { |
237 | var result; | 235 | var result; |
238 | var formatterCode; | 236 | var formatterCode; |
239 | var formatter; | 237 | var formatter; |
240 | var i,c; | 238 | var i,c; |
241 | 239 | ||
242 | //MochiKit.Logging.logDebug(">>> Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale"); | ||
243 | formatterCode = "Clipperz.Date.__scratchFormatter = function(aDate, aLocale){return ''"; | 240 | formatterCode = "Clipperz.Date.__scratchFormatter = function(aDate, aLocale){return ''"; |
244 | 241 | ||
245 | c = aFormat.length; | 242 | c = aFormat.length; |
246 | i = 0; | 243 | i = 0; |
247 | 244 | ||
248 | while (i<c) { | 245 | while (i<c) { |
249 | var character; | 246 | var character; |
250 | 247 | ||
251 | character = aFormat.charAt(i); | 248 | character = aFormat.charAt(i); |
252 | if (character == "\\") { | 249 | if (character == "\\") { |
253 | i++; | 250 | i++; |
254 | character = aFormat.charAt(i); | 251 | character = aFormat.charAt(i); |
255 | formatterCode += " + '" + character + "'" | 252 | formatterCode += " + '" + character + "'" |
256 | } else { | 253 | } else { |
257 | formatterCode += Clipperz.Date.getPHPLikeFormatCode(character); | 254 | formatterCode += Clipperz.Date.getPHPLikeFormatCode(character); |
258 | } | 255 | } |
259 | 256 | ||
260 | i++; | 257 | i++; |
261 | } | 258 | } |
262 | 259 | ||
263 | formatterCode += ";}"; | 260 | formatterCode += ";}"; |
264 | //MochiKit.Logging.logDebug("--- Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale - formatterCode: " + formatterCode); | ||
265 | eval(formatterCode); | 261 | eval(formatterCode); |
266 | 262 | ||
267 | result = Clipperz.Date.__scratchFormatter.call(this, aDate, aLocale); | 263 | result = Clipperz.Date.__scratchFormatter.call(this, aDate, aLocale); |
268 | delete Clipperz.Date.__scratchFormatter; | 264 | delete Clipperz.Date.__scratchFormatter; |
269 | //MochiKit.Logging.logDebug("<<< Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale"); | ||
270 | 265 | ||
271 | return result; | 266 | return result; |
272 | }, | 267 | }, |
273 | 268 | ||
274 | //------------------------------------------------------------------------- | 269 | //------------------------------------------------------------------------- |
275 | 270 | ||
276 | 'parseDateWithPHPLikeTemplateAndLocale': function(aString, aFormat, aLocale) { | 271 | 'parseDateWithPHPLikeTemplateAndLocale': function(aString, aFormat, aLocale) { |
277 | return new Date(); | 272 | return new Date(); |
278 | }, | 273 | }, |
279 | 274 | ||
280 | //========================================================================= | 275 | //========================================================================= |
281 | 276 | ||
282 | 'formatDateWithUTCFormatAndLocale': function(aDate, aLocale) { | 277 | 'formatDateWithUTCFormatAndLocale': function(aDate, aLocale) { |
283 | // return Clipperz.Date.formatWithJavaLikeTemplateAndLocale(aDate, "EEE, dd MMMM yyyy HH:mm:ss zzz", aLocale); | 278 | // return Clipperz.Date.formatWithJavaLikeTemplateAndLocale(aDate, "EEE, dd MMMM yyyy HH:mm:ss zzz", aLocale); |
284 | return aDate.toString(); | 279 | return aDate.toString(); |
285 | }, | 280 | }, |
286 | 281 | ||
287 | 'parseDateWithUTCFormatAndLocale': function(aValue, aLocale) { | 282 | 'parseDateWithUTCFormatAndLocale': function(aValue, aLocale) { |
288 | return new Date(Date.parse(aValue)); | 283 | return new Date(Date.parse(aValue)); |
289 | }, | 284 | }, |
290 | 285 | ||
291 | //========================================================================= | 286 | //========================================================================= |
292 | 287 | ||
293 | 'exception': { | 288 | 'exception': { |