author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/Date.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
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,70 +1,68 @@ | |||
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 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'daysInMonth': [31,28,31,30,31,30,31,31,30,31,30,31], | 46 | 'daysInMonth': [31,28,31,30,31,30,31,31,30,31,30,31], |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'englishOrdinalDaySuffixForDate': function(aDate) { | 50 | 'englishOrdinalDaySuffixForDate': function(aDate) { |
53 | var result; | 51 | var result; |
54 | 52 | ||
55 | switch (aDate.getDate()) { | 53 | switch (aDate.getDate()) { |
56 | case 1: | 54 | case 1: |
57 | case 21: | 55 | case 21: |
58 | case 31: | 56 | case 31: |
59 | result = "st"; | 57 | result = "st"; |
60 | break; | 58 | break; |
61 | case 2: | 59 | case 2: |
62 | case 22: | 60 | case 22: |
63 | result = "nd"; | 61 | result = "nd"; |
64 | break; | 62 | break; |
65 | case 3: | 63 | case 3: |
66 | case 23: | 64 | case 23: |
67 | result = "rd"; | 65 | result = "rd"; |
68 | break; | 66 | break; |
69 | default: | 67 | default: |
70 | result = "th"; | 68 | result = "th"; |
@@ -194,109 +192,106 @@ MochiKit.Base.update(Clipperz.Date, { | |||
194 | result = " + (aDate.getHours() < 12 ? aLocale['amDesignation'] : aLocale['pmDesignation'])"; | 192 | result = " + (aDate.getHours() < 12 ? aLocale['amDesignation'] : aLocale['pmDesignation'])"; |
195 | break; | 193 | break; |
196 | case "A": | 194 | case "A": |
197 | result = " + (aDate.getHours() < 12 ? aLocale['amDesignation'].toUpperCase() : aLocale['pmDesignation'].toUpperCase())"; | 195 | result = " + (aDate.getHours() < 12 ? aLocale['amDesignation'].toUpperCase() : aLocale['pmDesignation'].toUpperCase())"; |
198 | break; | 196 | break; |
199 | case "g": | 197 | case "g": |
200 | result = " + ((aDate.getHours() %12) ? aDate.getHours() % 12 : 12)"; | 198 | result = " + ((aDate.getHours() %12) ? aDate.getHours() % 12 : 12)"; |
201 | break; | 199 | break; |
202 | case "G": | 200 | case "G": |
203 | result = " + aDate.getHours()"; | 201 | result = " + aDate.getHours()"; |
204 | break; | 202 | break; |
205 | case "h": | 203 | case "h": |
206 | result = " + MochiKit.Format.numberFormatter('00')((aDate.getHours() %12) ? aDate.getHours() % 12 : 12)"; | 204 | result = " + MochiKit.Format.numberFormatter('00')((aDate.getHours() %12) ? aDate.getHours() % 12 : 12)"; |
207 | break; | 205 | break; |
208 | case "H": | 206 | case "H": |
209 | result = " + MochiKit.Format.numberFormatter('00')(aDate.getHours())"; | 207 | result = " + MochiKit.Format.numberFormatter('00')(aDate.getHours())"; |
210 | break; | 208 | break; |
211 | case "i": | 209 | case "i": |
212 | result = " + MochiKit.Format.numberFormatter('00')(aDate.getMinutes())"; | 210 | result = " + MochiKit.Format.numberFormatter('00')(aDate.getMinutes())"; |
213 | break; | 211 | break; |
214 | case "s": | 212 | case "s": |
215 | result = " + MochiKit.Format.numberFormatter('00')(aDate.getSeconds())"; | 213 | result = " + MochiKit.Format.numberFormatter('00')(aDate.getSeconds())"; |
216 | break; | 214 | break; |
217 | case "O": | 215 | case "O": |
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': { |
294 | // 'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"), | 289 | // 'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"), |
295 | // 'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType") | 290 | // 'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType") |
296 | }, | 291 | }, |
297 | 292 | ||
298 | //------------------------------------------------------------------------- | 293 | //------------------------------------------------------------------------- |
299 | __syntaxFix__: "syntax fix" | 294 | __syntaxFix__: "syntax fix" |
300 | 295 | ||
301 | }); | 296 | }); |
302 | 297 | ||