From a26b080d30d1358623ad57c4eea1b3118a3edd27 Mon Sep 17 00:00:00 2001 From: Quanquan Liu Date: Mon, 13 Jan 2014 18:05:31 -0500 Subject: [PATCH 01/43] first commit --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3bc9b6e --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +New upgraded timegrid From a7fb3be06e3c164266d78380ba9346f52bc127a1 Mon Sep 17 00:00:00 2001 From: Quanquan Liu Date: Mon, 13 Jan 2014 18:09:36 -0500 Subject: [PATCH 02/43] initial commit --- images/.svn/all-wcprops | 23 + images/.svn/entries | 130 ++++ images/.svn/prop-base/go-next.png.svn-base | 5 + .../.svn/prop-base/go-previous.png.svn-base | 5 + .../prop-base/progress-running.gif.svn-base | 5 + images/.svn/text-base/go-next.png.svn-base | Bin 0 -> 676 bytes .../.svn/text-base/go-previous.png.svn-base | Bin 0 -> 655 bytes .../text-base/progress-running.gif.svn-base | Bin 0 -> 1002 bytes images/go-next.png | Bin 0 -> 676 bytes images/go-previous.png | Bin 0 -> 655 bytes images/progress-running.gif | Bin 0 -> 1002 bytes locales/.svn/all-wcprops | 5 + locales/.svn/entries | 34 ++ locales/en/.svn/all-wcprops | 11 + locales/en/.svn/entries | 65 ++ locales/en/.svn/text-base/locale.js.svn-base | 31 + locales/en/locale.js | 31 + locales/en/scripts/.svn/all-wcprops | 11 + locales/en/scripts/.svn/entries | 68 +++ .../.svn/text-base/timegrid-l10n.js.svn-base | 13 + locales/en/scripts/layouts/.svn/all-wcprops | 35 ++ locales/en/scripts/layouts/.svn/entries | 198 ++++++ .../.svn/text-base/monthly-l10n.js.svn-base | 10 + .../.svn/text-base/nday-l10n.js.svn-base | 31 + .../.svn/text-base/nmonth-l10n.js.svn-base | 31 + .../.svn/text-base/property-l10n.js.svn-base | 15 + .../.svn/text-base/weekly-l10n.js.svn-base | 10 + locales/en/scripts/layouts/monthly-l10n.js | 10 + locales/en/scripts/layouts/nday-l10n.js | 31 + locales/en/scripts/layouts/nmonth-l10n.js | 31 + locales/en/scripts/layouts/property-l10n.js | 15 + locales/en/scripts/layouts/weekly-l10n.js | 10 + locales/en/scripts/timegrid-l10n.js | 13 + locales/en/scripts/util/.svn/all-wcprops | 11 + locales/en/scripts/util/.svn/entries | 62 ++ .../util/.svn/text-base/date-l10n.js.svn-base | 29 + locales/en/scripts/util/date-l10n.js | 29 + locales/fr/.svn/all-wcprops | 11 + locales/fr/.svn/entries | 65 ++ locales/fr/.svn/text-base/locale.js.svn-base | 30 + locales/fr/locale.js | 30 + locales/fr/scripts/.svn/all-wcprops | 11 + locales/fr/scripts/.svn/entries | 68 +++ .../.svn/text-base/timegrid-l10n.js.svn-base | 13 + locales/fr/scripts/layouts/.svn/all-wcprops | 29 + locales/fr/scripts/layouts/.svn/entries | 164 +++++ .../.svn/text-base/monthly-l10n.js.svn-base | 10 + .../.svn/text-base/nday-l10n.js.svn-base | 29 + .../.svn/text-base/nmonth-l10n.js.svn-base | 28 + .../.svn/text-base/weekly-l10n.js.svn-base | 10 + locales/fr/scripts/layouts/monthly-l10n.js | 10 + locales/fr/scripts/layouts/nday-l10n.js | 29 + locales/fr/scripts/layouts/nmonth-l10n.js | 28 + locales/fr/scripts/layouts/weekly-l10n.js | 10 + locales/fr/scripts/timegrid-l10n.js | 13 + locales/fr/scripts/util/.svn/all-wcprops | 11 + locales/fr/scripts/util/.svn/entries | 62 ++ .../util/.svn/text-base/date-l10n.js.svn-base | 29 + locales/fr/scripts/util/date-l10n.js | 29 + scripts/.svn/all-wcprops | 47 ++ scripts/.svn/entries | 275 +++++++++ scripts/.svn/text-base/controls.js.svn-base | 148 +++++ scripts/.svn/text-base/create.js.svn-base | 8 + scripts/.svn/text-base/grid.js.svn-base | 56 ++ scripts/.svn/text-base/labellers.js.svn-base | 91 +++ scripts/.svn/text-base/listeners.js.svn-base | 29 + scripts/.svn/text-base/themes.js.svn-base | 127 ++++ scripts/.svn/text-base/timegrid.js.svn-base | 198 ++++++ scripts/controls.js | 148 +++++ scripts/create.js | 8 + scripts/grid.js | 57 ++ scripts/labellers.js | 91 +++ scripts/layouts/.svn/all-wcprops | 41 ++ scripts/layouts/.svn/entries | 232 +++++++ .../layouts/.svn/text-base/layout.js.svn-base | 385 ++++++++++++ .../.svn/text-base/monthly.js.svn-base | 16 + .../layouts/.svn/text-base/nday.js.svn-base | 242 ++++++++ .../layouts/.svn/text-base/nmonth.js.svn-base | 259 ++++++++ .../.svn/text-base/property.js.svn-base | 150 +++++ .../layouts/.svn/text-base/weekly.js.svn-base | 40 ++ scripts/layouts/layout.js | 385 ++++++++++++ scripts/layouts/monthly.js | 16 + scripts/layouts/nday.js | 242 ++++++++ scripts/layouts/nmonth.js | 259 ++++++++ scripts/layouts/property.js | 150 +++++ scripts/layouts/weekly.js | 40 ++ scripts/listeners.js | 29 + scripts/sources/.svn/all-wcprops | 17 + scripts/sources/.svn/entries | 96 +++ .../.svn/text-base/default.js.svn-base | 407 +++++++++++++ .../.svn/text-base/recurring.js.svn-base | 136 +++++ scripts/sources/default.js | 407 +++++++++++++ scripts/sources/recurring.js | 136 +++++ scripts/themes.js | 127 ++++ scripts/timegrid.js | 198 ++++++ scripts/util/.svn/all-wcprops | 53 ++ scripts/util/.svn/entries | 303 ++++++++++ scripts/util/.svn/text-base/date.js.svn-base | 567 ++++++++++++++++++ scripts/util/.svn/text-base/debug.js.svn-base | 16 + .../.svn/text-base/excanvas.pack.js.svn-base | 19 + .../.svn/text-base/jquery.corner.js.svn-base | 253 ++++++++ .../text-base/jquery.dimensions.js.svn-base | 10 + .../text-base/jquery.prettybox.js.svn-base | 171 ++++++ .../.svn/text-base/jquery.simile.js.svn-base | 118 ++++ scripts/util/.svn/text-base/util.js.svn-base | 47 ++ scripts/util/date.js | 567 ++++++++++++++++++ scripts/util/debug.js | 16 + scripts/util/dstructs/.svn/all-wcprops | 11 + scripts/util/dstructs/.svn/entries | 68 +++ .../.svn/text-base/dstructs.js.svn-base | 199 ++++++ scripts/util/dstructs/docs/.svn/all-wcprops | 5 + scripts/util/dstructs/docs/.svn/entries | 28 + scripts/util/dstructs/dstructs.js | 199 ++++++ scripts/util/dstructs/tests/.svn/all-wcprops | 29 + scripts/util/dstructs/tests/.svn/entries | 164 +++++ .../.svn/text-base/array-tests.html.svn-base | 13 + .../.svn/text-base/array-tests.js.svn-base | 29 + .../.svn/text-base/hash-tests.html.svn-base | 0 .../.svn/text-base/testpage.html.svn-base | 8 + scripts/util/dstructs/tests/array-tests.html | 13 + scripts/util/dstructs/tests/array-tests.js | 29 + scripts/util/dstructs/tests/hash-tests.html | 0 scripts/util/dstructs/tests/testpage.html | 8 + scripts/util/excanvas.pack.js | 19 + scripts/util/jquery.corner.js | 253 ++++++++ scripts/util/jquery.dimensions.js | 10 + scripts/util/jquery.prettybox.js | 171 ++++++ scripts/util/jquery.simile.js | 118 ++++ scripts/util/util.js | 47 ++ styles/.svn/all-wcprops | 11 + styles/.svn/entries | 65 ++ styles/.svn/text-base/timegrid.css.svn-base | 192 ++++++ styles/themes/.svn/all-wcprops | 11 + styles/themes/.svn/entries | 62 ++ ...sandy-stone-beach-ocean-diver.css.svn-base | 79 +++ .../theme-sandy-stone-beach-ocean-diver.css | 79 +++ styles/timegrid.css | 192 ++++++ timegrid-api.js | 131 ++++ 138 files changed, 11403 insertions(+) create mode 100644 images/.svn/all-wcprops create mode 100644 images/.svn/entries create mode 100644 images/.svn/prop-base/go-next.png.svn-base create mode 100644 images/.svn/prop-base/go-previous.png.svn-base create mode 100644 images/.svn/prop-base/progress-running.gif.svn-base create mode 100644 images/.svn/text-base/go-next.png.svn-base create mode 100644 images/.svn/text-base/go-previous.png.svn-base create mode 100644 images/.svn/text-base/progress-running.gif.svn-base create mode 100644 images/go-next.png create mode 100644 images/go-previous.png create mode 100644 images/progress-running.gif create mode 100644 locales/.svn/all-wcprops create mode 100644 locales/.svn/entries create mode 100644 locales/en/.svn/all-wcprops create mode 100644 locales/en/.svn/entries create mode 100644 locales/en/.svn/text-base/locale.js.svn-base create mode 100644 locales/en/locale.js create mode 100644 locales/en/scripts/.svn/all-wcprops create mode 100644 locales/en/scripts/.svn/entries create mode 100644 locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base create mode 100644 locales/en/scripts/layouts/.svn/all-wcprops create mode 100644 locales/en/scripts/layouts/.svn/entries create mode 100644 locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base create mode 100644 locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base create mode 100644 locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base create mode 100644 locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base create mode 100644 locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base create mode 100644 locales/en/scripts/layouts/monthly-l10n.js create mode 100644 locales/en/scripts/layouts/nday-l10n.js create mode 100644 locales/en/scripts/layouts/nmonth-l10n.js create mode 100644 locales/en/scripts/layouts/property-l10n.js create mode 100644 locales/en/scripts/layouts/weekly-l10n.js create mode 100644 locales/en/scripts/timegrid-l10n.js create mode 100644 locales/en/scripts/util/.svn/all-wcprops create mode 100644 locales/en/scripts/util/.svn/entries create mode 100644 locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base create mode 100644 locales/en/scripts/util/date-l10n.js create mode 100644 locales/fr/.svn/all-wcprops create mode 100644 locales/fr/.svn/entries create mode 100644 locales/fr/.svn/text-base/locale.js.svn-base create mode 100644 locales/fr/locale.js create mode 100644 locales/fr/scripts/.svn/all-wcprops create mode 100644 locales/fr/scripts/.svn/entries create mode 100644 locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base create mode 100644 locales/fr/scripts/layouts/.svn/all-wcprops create mode 100644 locales/fr/scripts/layouts/.svn/entries create mode 100644 locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base create mode 100644 locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base create mode 100644 locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base create mode 100644 locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base create mode 100644 locales/fr/scripts/layouts/monthly-l10n.js create mode 100644 locales/fr/scripts/layouts/nday-l10n.js create mode 100644 locales/fr/scripts/layouts/nmonth-l10n.js create mode 100644 locales/fr/scripts/layouts/weekly-l10n.js create mode 100644 locales/fr/scripts/timegrid-l10n.js create mode 100644 locales/fr/scripts/util/.svn/all-wcprops create mode 100644 locales/fr/scripts/util/.svn/entries create mode 100644 locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base create mode 100644 locales/fr/scripts/util/date-l10n.js create mode 100644 scripts/.svn/all-wcprops create mode 100644 scripts/.svn/entries create mode 100644 scripts/.svn/text-base/controls.js.svn-base create mode 100644 scripts/.svn/text-base/create.js.svn-base create mode 100644 scripts/.svn/text-base/grid.js.svn-base create mode 100644 scripts/.svn/text-base/labellers.js.svn-base create mode 100644 scripts/.svn/text-base/listeners.js.svn-base create mode 100644 scripts/.svn/text-base/themes.js.svn-base create mode 100644 scripts/.svn/text-base/timegrid.js.svn-base create mode 100644 scripts/controls.js create mode 100644 scripts/create.js create mode 100644 scripts/grid.js create mode 100644 scripts/labellers.js create mode 100644 scripts/layouts/.svn/all-wcprops create mode 100644 scripts/layouts/.svn/entries create mode 100644 scripts/layouts/.svn/text-base/layout.js.svn-base create mode 100644 scripts/layouts/.svn/text-base/monthly.js.svn-base create mode 100644 scripts/layouts/.svn/text-base/nday.js.svn-base create mode 100644 scripts/layouts/.svn/text-base/nmonth.js.svn-base create mode 100644 scripts/layouts/.svn/text-base/property.js.svn-base create mode 100644 scripts/layouts/.svn/text-base/weekly.js.svn-base create mode 100644 scripts/layouts/layout.js create mode 100644 scripts/layouts/monthly.js create mode 100644 scripts/layouts/nday.js create mode 100644 scripts/layouts/nmonth.js create mode 100644 scripts/layouts/property.js create mode 100644 scripts/layouts/weekly.js create mode 100644 scripts/listeners.js create mode 100644 scripts/sources/.svn/all-wcprops create mode 100644 scripts/sources/.svn/entries create mode 100644 scripts/sources/.svn/text-base/default.js.svn-base create mode 100644 scripts/sources/.svn/text-base/recurring.js.svn-base create mode 100644 scripts/sources/default.js create mode 100644 scripts/sources/recurring.js create mode 100644 scripts/themes.js create mode 100644 scripts/timegrid.js create mode 100644 scripts/util/.svn/all-wcprops create mode 100644 scripts/util/.svn/entries create mode 100644 scripts/util/.svn/text-base/date.js.svn-base create mode 100644 scripts/util/.svn/text-base/debug.js.svn-base create mode 100644 scripts/util/.svn/text-base/excanvas.pack.js.svn-base create mode 100644 scripts/util/.svn/text-base/jquery.corner.js.svn-base create mode 100644 scripts/util/.svn/text-base/jquery.dimensions.js.svn-base create mode 100644 scripts/util/.svn/text-base/jquery.prettybox.js.svn-base create mode 100644 scripts/util/.svn/text-base/jquery.simile.js.svn-base create mode 100644 scripts/util/.svn/text-base/util.js.svn-base create mode 100644 scripts/util/date.js create mode 100644 scripts/util/debug.js create mode 100644 scripts/util/dstructs/.svn/all-wcprops create mode 100644 scripts/util/dstructs/.svn/entries create mode 100644 scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base create mode 100644 scripts/util/dstructs/docs/.svn/all-wcprops create mode 100644 scripts/util/dstructs/docs/.svn/entries create mode 100644 scripts/util/dstructs/dstructs.js create mode 100644 scripts/util/dstructs/tests/.svn/all-wcprops create mode 100644 scripts/util/dstructs/tests/.svn/entries create mode 100644 scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base create mode 100644 scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base create mode 100644 scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base create mode 100644 scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base create mode 100644 scripts/util/dstructs/tests/array-tests.html create mode 100644 scripts/util/dstructs/tests/array-tests.js create mode 100644 scripts/util/dstructs/tests/hash-tests.html create mode 100644 scripts/util/dstructs/tests/testpage.html create mode 100644 scripts/util/excanvas.pack.js create mode 100644 scripts/util/jquery.corner.js create mode 100644 scripts/util/jquery.dimensions.js create mode 100644 scripts/util/jquery.prettybox.js create mode 100644 scripts/util/jquery.simile.js create mode 100644 scripts/util/util.js create mode 100644 styles/.svn/all-wcprops create mode 100644 styles/.svn/entries create mode 100644 styles/.svn/text-base/timegrid.css.svn-base create mode 100644 styles/themes/.svn/all-wcprops create mode 100644 styles/themes/.svn/entries create mode 100644 styles/themes/.svn/text-base/theme-sandy-stone-beach-ocean-diver.css.svn-base create mode 100644 styles/themes/theme-sandy-stone-beach-ocean-diver.css create mode 100644 styles/timegrid.css create mode 100644 timegrid-api.js diff --git a/images/.svn/all-wcprops b/images/.svn/all-wcprops new file mode 100644 index 0000000..49a8f2d --- /dev/null +++ b/images/.svn/all-wcprops @@ -0,0 +1,23 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/images +END +go-previous.png +K 25 +svn:wc:ra_dav:version-url +V 88 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/images/go-previous.png +END +go-next.png +K 25 +svn:wc:ra_dav:version-url +V 84 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/images/go-next.png +END +progress-running.gif +K 25 +svn:wc:ra_dav:version-url +V 93 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/images/progress-running.gif +END diff --git a/images/.svn/entries b/images/.svn/entries new file mode 100644 index 0000000..e9c9da6 --- /dev/null +++ b/images/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/images +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +go-previous.png +file + + + + +2012-02-03T21:55:33.000000Z +370c740ede43e123c4d0df6c6e0ec9e9 +2012-02-03T21:54:55.669466Z +9624 +lizs +has-props + + + + + + + + + + + + + + + + + + + + +655 + +go-next.png +file + + + + +2012-02-03T21:55:33.000000Z +c71b163127145cf4b318f8d569f46162 +2012-02-03T21:54:55.669466Z +9624 +lizs +has-props + + + + + + + + + + + + + + + + + + + + +676 + +progress-running.gif +file + + + + +2012-02-03T21:55:33.000000Z +98470c2428a824fda5948178235fce48 +2012-02-03T21:54:55.669466Z +9624 +lizs +has-props + + + + + + + + + + + + + + + + + + + + +1002 + diff --git a/images/.svn/prop-base/go-next.png.svn-base b/images/.svn/prop-base/go-next.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/images/.svn/prop-base/go-next.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/images/.svn/prop-base/go-previous.png.svn-base b/images/.svn/prop-base/go-previous.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/images/.svn/prop-base/go-previous.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/images/.svn/prop-base/progress-running.gif.svn-base b/images/.svn/prop-base/progress-running.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/images/.svn/prop-base/progress-running.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/images/.svn/text-base/go-next.png.svn-base b/images/.svn/text-base/go-next.png.svn-base new file mode 100644 index 0000000000000000000000000000000000000000..6ef8de76e0f5bf01c09da24a07c61cfe558d7a4b GIT binary patch literal 676 zcmV;V0$crwP)5 zl1oTbVI0MO-{a21M#B_R#9l-oXcPp6(?)2~B7y{4Mu9@O$#RS~LMu0okc%jC6BNCq zMPfd15iMrWDWnuP(IPA}ow0!)<9P4f`?UyPGZWN-v-$pq!}*{8hcSkHhP!mEu~WAd zo8?nd1jeIrclCk3aF;a@j#!~$nl%(P0Jzf98$5aR>}dqE;fU4n-v&x*nhu}wwKrd{ z4f;b9;fU2%OeY#6`YVQ=TOJkJo9%;vsn26nmF>ePxAA!V*2;(ZnPFo%AB#FaHw-$p z>A83xDHKX5gpddX0EtgSc(|1Lcd)Cxp7`{*Gd4M}fH9|HQD+7~1Grv}*vDrmsZm0K z5C{Q60m5V1o+G_9&%wGQR!!BO+NWc8C&Ce{BNlb~H9*c=C7oHocC*-S7Ns<$C1sQZ zLijB|M!48sj(1C=)P(9pYjao0(5pv%$FEw)G{Dl2Io>Bnm(2P=eF~WywGEfv2*dEE+1BNH1p0gO_(!va6Ym6#!ZeU0XL$ zmOyFA$XqYlC#eqYr*8WRCf~&E#M}5+`DMhod1o}n6nu_w#4?v#yZPlMNv2Zf#pvLQ?bsc$8%}?|wxEMGI60fdRAO~{ zc52bv6uF?Yza^+BugrY=o*FhT7dA)!rvyS0Urwj)#iE6g^YI%&-U+mBcICDJ0000< KMNUMnLSTZVNH5j^ literal 0 HcmV?d00001 diff --git a/images/.svn/text-base/go-previous.png.svn-base b/images/.svn/text-base/go-previous.png.svn-base new file mode 100644 index 0000000000000000000000000000000000000000..659cd90d7f80488a8a6a2c12f6f9e5ad98720461 GIT binary patch literal 655 zcmV;A0&x9_P)_fWZPlDqB9?#%D^>oA$FjP8SXdVl!5?|TnYO4RbBH?=GA zTUy2|reO<?=@r%h} zW6#cJQfPC~s>mwxzQ}>D!BbZalds_8_h}r7_JCAa@f4F))r6lUrCf(hQ;9=;jU5L& z+1FnmP_XjQREAhnABYqX00}@!0U-tMq%XJx@e~^h8rvWApSa|&uWz9Di?6_?1E%N@ zl4EB68Hfl3f`qGnd$iXb;n;2VsHt)P`R?O`My|Agci-NCF&}hI2Ui3vQGjU{P_$N1 zwo6b*g`Wk{x;wF^0p~U>`wvX#H%c-OZ~=##s0b5Wa!4-09SO%4;Ep?Tu9$V#I5TQr z&Mtkq{`h6ugzb~9dlQg)8A30C1pt3Qg&t7B3bbY+H`>YWThbX9oF#2!=nK7F-=6arTX3U&+XWy2~<%(BYwFX|c pI#R>7P%^)q3wROKeC1m2{1 ze&PK2_wU|4KXc~Bs#U+geS3W5$YwLMBNY`_7cJTu6!i7=>pf9XTkP#`Z`#Dbz{tQb zMbRFN1sE6@6hZhux1VcBu(M-;tC5}oGf)MC;y(?i#Js%JqT-DF0tI(ZHwDMM%-qD1 z{30EN^73-M;?$gy)Z~1<fYSUPB-!x2sgUvb5-pwzqYY`=UVF1k zUE_r!-PC68%*>IsKK1#(vLZHXLeQ-Vny2}ikL}P4eWA4p(!AZu^ZJ*h94RnhNC{$O zSlsJzgvr89_7?X7$yyJM8R}khvsqok6W^N6Hms6pHAX7RiKN>sCE&+4!M7tw1B z6Fi@udSfUxv7?o{_=x_+E6z>_pZwRvYE2+2B8dGb5$+kY(m%kgZCpT~^FbPfZG7C&u zsZyxoSIt;737Eodgt*$CdvjKCU)nf9g_nn;O;}6zX~H7yz{a~w(|koGKJ+A=zWPR| bRJGFm{Y4A&d2ZV?-iWW5 zl1oTbVI0MO-{a21M#B_R#9l-oXcPp6(?)2~B7y{4Mu9@O$#RS~LMu0okc%jC6BNCq zMPfd15iMrWDWnuP(IPA}ow0!)<9P4f`?UyPGZWN-v-$pq!}*{8hcSkHhP!mEu~WAd zo8?nd1jeIrclCk3aF;a@j#!~$nl%(P0Jzf98$5aR>}dqE;fU4n-v&x*nhu}wwKrd{ z4f;b9;fU2%OeY#6`YVQ=TOJkJo9%;vsn26nmF>ePxAA!V*2;(ZnPFo%AB#FaHw-$p z>A83xDHKX5gpddX0EtgSc(|1Lcd)Cxp7`{*Gd4M}fH9|HQD+7~1Grv}*vDrmsZm0K z5C{Q60m5V1o+G_9&%wGQR!!BO+NWc8C&Ce{BNlb~H9*c=C7oHocC*-S7Ns<$C1sQZ zLijB|M!48sj(1C=)P(9pYjao0(5pv%$FEw)G{Dl2Io>Bnm(2P=eF~WywGEfv2*dEE+1BNH1p0gO_(!va6Ym6#!ZeU0XL$ zmOyFA$XqYlC#eqYr*8WRCf~&E#M}5+`DMhod1o}n6nu_w#4?v#yZPlMNv2Zf#pvLQ?bsc$8%}?|wxEMGI60fdRAO~{ zc52bv6uF?Yza^+BugrY=o*FhT7dA)!rvyS0Urwj)#iE6g^YI%&-U+mBcICDJ0000< KMNUMnLSTZVNH5j^ literal 0 HcmV?d00001 diff --git a/images/go-previous.png b/images/go-previous.png new file mode 100644 index 0000000000000000000000000000000000000000..659cd90d7f80488a8a6a2c12f6f9e5ad98720461 GIT binary patch literal 655 zcmV;A0&x9_P)_fWZPlDqB9?#%D^>oA$FjP8SXdVl!5?|TnYO4RbBH?=GA zTUy2|reO<?=@r%h} zW6#cJQfPC~s>mwxzQ}>D!BbZalds_8_h}r7_JCAa@f4F))r6lUrCf(hQ;9=;jU5L& z+1FnmP_XjQREAhnABYqX00}@!0U-tMq%XJx@e~^h8rvWApSa|&uWz9Di?6_?1E%N@ zl4EB68Hfl3f`qGnd$iXb;n;2VsHt)P`R?O`My|Agci-NCF&}hI2Ui3vQGjU{P_$N1 zwo6b*g`Wk{x;wF^0p~U>`wvX#H%c-OZ~=##s0b5Wa!4-09SO%4;Ep?Tu9$V#I5TQr z&Mtkq{`h6ugzb~9dlQg)8A30C1pt3Qg&t7B3bbY+H`>YWThbX9oF#2!=nK7F-=6arTX3U&+XWy2~<%(BYwFX|c pI#R>7P%^)q3wROKeC1m2{1 ze&PK2_wU|4KXc~Bs#U+geS3W5$YwLMBNY`_7cJTu6!i7=>pf9XTkP#`Z`#Dbz{tQb zMbRFN1sE6@6hZhux1VcBu(M-;tC5}oGf)MC;y(?i#Js%JqT-DF0tI(ZHwDMM%-qD1 z{30EN^73-M;?$gy)Z~1<fYSUPB-!x2sgUvb5-pwzqYY`=UVF1k zUE_r!-PC68%*>IsKK1#(vLZHXLeQ-Vny2}ikL}P4eWA4p(!AZu^ZJ*h94RnhNC{$O zSlsJzgvr89_7?X7$yyJM8R}khvsqok6W^N6Hms6pHAX7RiKN>sCE&+4!M7tw1B z6Fi@udSfUxv7?o{_=x_+E6z>_pZwRvYE2+2B8dGb5$+kY(m%kgZCpT~^FbPfZG7C&u zsZyxoSIt;737Eodgt*$CdvjKCU)nf9g_nn;O;}6zX~H7yz{a~w(|koGKJ+A=zWPR| bRJGFm{Y4A&d2ZV?-iWW 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/locales/en/locale.js b/locales/en/locale.js new file mode 100644 index 0000000..6e5c6c1 --- /dev/null +++ b/locales/en/locale.js @@ -0,0 +1,31 @@ +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/monthly-l10n.js", + "layouts/weekly-l10n.js", + "layouts/property-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/en/"; + if (Timegrid.params.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/locales/en/scripts/.svn/all-wcprops b/locales/en/scripts/.svn/all-wcprops new file mode 100644 index 0000000..54b92e1 --- /dev/null +++ b/locales/en/scripts/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 84 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts +END +timegrid-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 101 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/timegrid-l10n.js +END diff --git a/locales/en/scripts/.svn/entries b/locales/en/scripts/.svn/entries new file mode 100644 index 0000000..c8e6e8e --- /dev/null +++ b/locales/en/scripts/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en/scripts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +layouts +dir + +timegrid-l10n.js +file + + + + +2012-02-03T21:55:30.000000Z +b43a7808daa5b512b0c5cfd9f757a73c +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +440 + +util +dir + diff --git a/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base b/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base new file mode 100644 index 0000000..b2acaf0 --- /dev/null +++ b/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base @@ -0,0 +1,13 @@ +/****************************************************************************** + * Timegrid English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Loading..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; \ No newline at end of file diff --git a/locales/en/scripts/layouts/.svn/all-wcprops b/locales/en/scripts/layouts/.svn/all-wcprops new file mode 100644 index 0000000..47537cf --- /dev/null +++ b/locales/en/scripts/layouts/.svn/all-wcprops @@ -0,0 +1,35 @@ +K 25 +svn:wc:ra_dav:version-url +V 92 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts +END +weekly-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/weekly-l10n.js +END +nmonth-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/nmonth-l10n.js +END +property-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 109 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/property-l10n.js +END +monthly-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 108 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/monthly-l10n.js +END +nday-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 105 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/nday-l10n.js +END diff --git a/locales/en/scripts/layouts/.svn/entries b/locales/en/scripts/layouts/.svn/entries new file mode 100644 index 0000000..e67887c --- /dev/null +++ b/locales/en/scripts/layouts/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +weekly-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +a7a3b6aa63b261508a187ebbb2d6f0c1 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +402 + +nmonth-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +51a272559d94f92a3da2abe7fe95c4de +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1243 + +property-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +d3efa75c65a5ca7bdb6a263e814d74a5 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +527 + +monthly-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +b7d4d0d399abd57491910eb01a5f7b0c +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +407 + +nday-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +b93e6abb258f574e9ca0ee798a8b4611 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1263 + diff --git a/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base b/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base new file mode 100644 index 0000000..3fe6b5a --- /dev/null +++ b/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Month"; } \ No newline at end of file diff --git a/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base b/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base new file mode 100644 index 0000000..09a89b2 --- /dev/null +++ b/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NDayLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = { mini: {} }; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 5/24" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; + +/** Format for vertical "12am" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; + diff --git a/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base b/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base new file mode 100644 index 0000000..b62292b --- /dev/null +++ b/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NMonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); + if (d2) { + string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); + } + return string; +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "MMM yyyy"; \ No newline at end of file diff --git a/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base b/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base new file mode 100644 index 0000000..6c2f763 --- /dev/null +++ b/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base @@ -0,0 +1,15 @@ +/****************************************************************************** + * Timegrid PropertyLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.PropertyLayout)) { + Timegrid.PropertyLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } + +/** Format for vertical "12am" style labels */ +Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; + + diff --git a/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base b/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base new file mode 100644 index 0000000..105a0e1 --- /dev/null +++ b/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Week"; } \ No newline at end of file diff --git a/locales/en/scripts/layouts/monthly-l10n.js b/locales/en/scripts/layouts/monthly-l10n.js new file mode 100644 index 0000000..635eea9 --- /dev/null +++ b/locales/en/scripts/layouts/monthly-l10n.js @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Month"; } \ No newline at end of file diff --git a/locales/en/scripts/layouts/nday-l10n.js b/locales/en/scripts/layouts/nday-l10n.js new file mode 100644 index 0000000..1d3f099 --- /dev/null +++ b/locales/en/scripts/layouts/nday-l10n.js @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NDayLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = { mini: {} }; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 5/24" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; + +/** Format for vertical "12am" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; + diff --git a/locales/en/scripts/layouts/nmonth-l10n.js b/locales/en/scripts/layouts/nmonth-l10n.js new file mode 100644 index 0000000..eda5778 --- /dev/null +++ b/locales/en/scripts/layouts/nmonth-l10n.js @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NMonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); + if (d2) { + string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); + } + return string; +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "MMM yyyy"; \ No newline at end of file diff --git a/locales/en/scripts/layouts/property-l10n.js b/locales/en/scripts/layouts/property-l10n.js new file mode 100644 index 0000000..d7dd304 --- /dev/null +++ b/locales/en/scripts/layouts/property-l10n.js @@ -0,0 +1,15 @@ +/****************************************************************************** + * Timegrid PropertyLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.PropertyLayout)) { + Timegrid.PropertyLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } + +/** Format for vertical "12am" style labels */ +Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; + + diff --git a/locales/en/scripts/layouts/weekly-l10n.js b/locales/en/scripts/layouts/weekly-l10n.js new file mode 100644 index 0000000..72157b9 --- /dev/null +++ b/locales/en/scripts/layouts/weekly-l10n.js @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Week"; } \ No newline at end of file diff --git a/locales/en/scripts/timegrid-l10n.js b/locales/en/scripts/timegrid-l10n.js new file mode 100644 index 0000000..0e558d0 --- /dev/null +++ b/locales/en/scripts/timegrid-l10n.js @@ -0,0 +1,13 @@ +/****************************************************************************** + * Timegrid English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Loading..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; \ No newline at end of file diff --git a/locales/en/scripts/util/.svn/all-wcprops b/locales/en/scripts/util/.svn/all-wcprops new file mode 100644 index 0000000..27b0aea --- /dev/null +++ b/locales/en/scripts/util/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 89 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/util +END +date-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 102 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/util/date-l10n.js +END diff --git a/locales/en/scripts/util/.svn/entries b/locales/en/scripts/util/.svn/entries new file mode 100644 index 0000000..685c483 --- /dev/null +++ b/locales/en/scripts/util/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/util +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +date-l10n.js +file + + + + +2012-02-03T21:55:30.000000Z +450afb8d48472a4804896b1ab9178304 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1255 + diff --git a/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base b/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base new file mode 100644 index 0000000..d9fcaac --- /dev/null +++ b/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid Date English localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; + +/** Month abbreviations. Change this for local month names */ +Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + +/** Full day names. Change this for local month names */ +Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + +/** Day abbreviations. Change this for local month names */ +Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = true; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 0; diff --git a/locales/en/scripts/util/date-l10n.js b/locales/en/scripts/util/date-l10n.js new file mode 100644 index 0000000..e53fb8b --- /dev/null +++ b/locales/en/scripts/util/date-l10n.js @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid Date English localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; + +/** Month abbreviations. Change this for local month names */ +Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + +/** Full day names. Change this for local month names */ +Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + +/** Day abbreviations. Change this for local month names */ +Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = true; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 0; diff --git a/locales/fr/.svn/all-wcprops b/locales/fr/.svn/all-wcprops new file mode 100644 index 0000000..09f2112 --- /dev/null +++ b/locales/fr/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 76 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr +END +locale.js +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/locale.js +END diff --git a/locales/fr/.svn/entries b/locales/fr/.svn/entries new file mode 100644 index 0000000..68f0567 --- /dev/null +++ b/locales/fr/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/fr +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +scripts +dir + +locale.js +file + + + + +2012-02-03T21:55:32.000000Z +97c9791831e1c26d20b932b85c42f1e5 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1004 + diff --git a/locales/fr/.svn/text-base/locale.js.svn-base b/locales/fr/.svn/text-base/locale.js.svn-base new file mode 100644 index 0000000..619dacb --- /dev/null +++ b/locales/fr/.svn/text-base/locale.js.svn-base @@ -0,0 +1,30 @@ +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/weekly-l10n.js", + "layouts/monthly-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; + if (Timegrid.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/locales/fr/locale.js b/locales/fr/locale.js new file mode 100644 index 0000000..ff834d3 --- /dev/null +++ b/locales/fr/locale.js @@ -0,0 +1,30 @@ +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/weekly-l10n.js", + "layouts/monthly-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; + if (Timegrid.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/locales/fr/scripts/.svn/all-wcprops b/locales/fr/scripts/.svn/all-wcprops new file mode 100644 index 0000000..ba2b2b5 --- /dev/null +++ b/locales/fr/scripts/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 84 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts +END +timegrid-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 101 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/timegrid-l10n.js +END diff --git a/locales/fr/scripts/.svn/entries b/locales/fr/scripts/.svn/entries new file mode 100644 index 0000000..1368e87 --- /dev/null +++ b/locales/fr/scripts/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +layouts +dir + +timegrid-l10n.js +file + + + + +2012-02-03T21:55:31.000000Z +2187b2474c528505ffcece3ec27d0675 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +444 + +util +dir + diff --git a/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base b/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base new file mode 100644 index 0000000..041c4b8 --- /dev/null +++ b/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base @@ -0,0 +1,13 @@ +/****************************************************************************** + * Timegrid French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Chargement..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; diff --git a/locales/fr/scripts/layouts/.svn/all-wcprops b/locales/fr/scripts/layouts/.svn/all-wcprops new file mode 100644 index 0000000..1cd734d --- /dev/null +++ b/locales/fr/scripts/layouts/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 92 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/layouts +END +weekly-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/layouts/weekly-l10n.js +END +nmonth-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/layouts/nmonth-l10n.js +END +monthly-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 108 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/layouts/monthly-l10n.js +END +nday-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 105 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/layouts/nday-l10n.js +END diff --git a/locales/fr/scripts/layouts/.svn/entries b/locales/fr/scripts/layouts/.svn/entries new file mode 100644 index 0000000..98c4ec3 --- /dev/null +++ b/locales/fr/scripts/layouts/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/layouts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +weekly-l10n.js +file + + + + +2012-02-03T21:55:31.000000Z +f62c9aab3046cb3e9533edf7a574f3c0 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +405 + +nmonth-l10n.js +file + + + + +2012-02-03T21:55:31.000000Z +56c4702e460cebe8ebe26ae2ea724579 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1188 + +monthly-l10n.js +file + + + + +2012-02-03T21:55:31.000000Z +7c8ea7d18f17ca67db847086c561b4f0 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +406 + +nday-l10n.js +file + + + + +2012-02-03T21:55:31.000000Z +c5976502282f9adce3850abdc3059034 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1149 + diff --git a/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base b/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base new file mode 100644 index 0000000..36d6413 --- /dev/null +++ b/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Mois"; } \ No newline at end of file diff --git a/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base b/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base new file mode 100644 index 0000000..a3ad936 --- /dev/null +++ b/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid NDayLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Jour"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 24/5" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E d/M"; + +/** Format for vertical "13h" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "H"; + +/** Format for displaying the grid's starting date, e.g. "16/6/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "17/6/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "d/M/yyyy"; + diff --git a/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base b/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base new file mode 100644 index 0000000..e89a0ca --- /dev/null +++ b/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base @@ -0,0 +1,28 @@ +/****************************************************************************** + * Timegrid NMonthLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Mois"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NMonthLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NMonthLayout.l10n.endFormat); +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "d/M/yyyy"; diff --git a/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base b/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base new file mode 100644 index 0000000..bbb08c9 --- /dev/null +++ b/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Semaine"; } \ No newline at end of file diff --git a/locales/fr/scripts/layouts/monthly-l10n.js b/locales/fr/scripts/layouts/monthly-l10n.js new file mode 100644 index 0000000..18f28c9 --- /dev/null +++ b/locales/fr/scripts/layouts/monthly-l10n.js @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Mois"; } \ No newline at end of file diff --git a/locales/fr/scripts/layouts/nday-l10n.js b/locales/fr/scripts/layouts/nday-l10n.js new file mode 100644 index 0000000..dd6caad --- /dev/null +++ b/locales/fr/scripts/layouts/nday-l10n.js @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid NDayLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Jour"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 24/5" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E d/M"; + +/** Format for vertical "13h" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "H"; + +/** Format for displaying the grid's starting date, e.g. "16/6/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "17/6/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "d/M/yyyy"; + diff --git a/locales/fr/scripts/layouts/nmonth-l10n.js b/locales/fr/scripts/layouts/nmonth-l10n.js new file mode 100644 index 0000000..3d3cb70 --- /dev/null +++ b/locales/fr/scripts/layouts/nmonth-l10n.js @@ -0,0 +1,28 @@ +/****************************************************************************** + * Timegrid NMonthLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Mois"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NMonthLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NMonthLayout.l10n.endFormat); +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "d/M/yyyy"; diff --git a/locales/fr/scripts/layouts/weekly-l10n.js b/locales/fr/scripts/layouts/weekly-l10n.js new file mode 100644 index 0000000..9114028 --- /dev/null +++ b/locales/fr/scripts/layouts/weekly-l10n.js @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Semaine"; } \ No newline at end of file diff --git a/locales/fr/scripts/timegrid-l10n.js b/locales/fr/scripts/timegrid-l10n.js new file mode 100644 index 0000000..773ecb5 --- /dev/null +++ b/locales/fr/scripts/timegrid-l10n.js @@ -0,0 +1,13 @@ +/****************************************************************************** + * Timegrid French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Chargement..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; diff --git a/locales/fr/scripts/util/.svn/all-wcprops b/locales/fr/scripts/util/.svn/all-wcprops new file mode 100644 index 0000000..eca2e9c --- /dev/null +++ b/locales/fr/scripts/util/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 89 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/util +END +date-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 102 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/util/date-l10n.js +END diff --git a/locales/fr/scripts/util/.svn/entries b/locales/fr/scripts/util/.svn/entries new file mode 100644 index 0000000..fb8de2d --- /dev/null +++ b/locales/fr/scripts/util/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/fr/scripts/util +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +date-l10n.js +file + + + + +2012-02-03T21:55:31.000000Z +fdf4eff1fca04754549a38685346d702 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1292 + diff --git a/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base b/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base new file mode 100644 index 0000000..e6e8221 --- /dev/null +++ b/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid Date French localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; + +/** Month abbreviations. Change this for local month abbreviations */ +Date.l10n.monthAbbreviations = [ 'janv', 'fevr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'dec' ]; + +/** Full day names. Change this for local day names. */ +Date.l10n.dayNames = [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ]; + +/** Day abbreviations. Change this for local day abbreviations */ +Date.l10n.dayAbbreviations = ['dim','lun','mar','mer','jeu','ven','sam']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = false; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 1; diff --git a/locales/fr/scripts/util/date-l10n.js b/locales/fr/scripts/util/date-l10n.js new file mode 100644 index 0000000..710dc10 --- /dev/null +++ b/locales/fr/scripts/util/date-l10n.js @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid Date French localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; + +/** Month abbreviations. Change this for local month abbreviations */ +Date.l10n.monthAbbreviations = [ 'janv', 'fevr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'dec' ]; + +/** Full day names. Change this for local day names. */ +Date.l10n.dayNames = [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ]; + +/** Day abbreviations. Change this for local day abbreviations */ +Date.l10n.dayAbbreviations = ['dim','lun','mar','mer','jeu','ven','sam']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = false; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 1; diff --git a/scripts/.svn/all-wcprops b/scripts/.svn/all-wcprops new file mode 100644 index 0000000..758903b --- /dev/null +++ b/scripts/.svn/all-wcprops @@ -0,0 +1,47 @@ +K 25 +svn:wc:ra_dav:version-url +V 73 +/repository/!svn/ver/9626/course-picker/trunk/src/webapp/timegrid/scripts +END +timegrid.js +K 25 +svn:wc:ra_dav:version-url +V 85 +/repository/!svn/ver/9626/course-picker/trunk/src/webapp/timegrid/scripts/timegrid.js +END +grid.js +K 25 +svn:wc:ra_dav:version-url +V 81 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/grid.js +END +labellers.js +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/labellers.js +END +themes.js +K 25 +svn:wc:ra_dav:version-url +V 83 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/themes.js +END +listeners.js +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/listeners.js +END +controls.js +K 25 +svn:wc:ra_dav:version-url +V 85 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/controls.js +END +create.js +K 25 +svn:wc:ra_dav:version-url +V 83 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/create.js +END diff --git a/scripts/.svn/entries b/scripts/.svn/entries new file mode 100644 index 0000000..b79eb42 --- /dev/null +++ b/scripts/.svn/entries @@ -0,0 +1,275 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts +http://simile.mit.edu/repository + + + +2012-02-03T22:02:39.069198Z +9626 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +timegrid.js +file + + + + +2012-02-18T18:09:00.000000Z +2cdcc31463c49af6e524056528311454 +2012-02-03T22:02:39.069198Z +9626 +lizs + + + + + + + + + + + + + + + + + + + + + +6515 + +layouts +dir + +grid.js +file + + + + +2012-02-03T21:55:34.000000Z +2b67b384269818b7f404282a77485119 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1536 + +labellers.js +file + + + + +2012-02-03T21:55:34.000000Z +07acc909849ad27cb384e0c88bb61697 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +3119 + +themes.js +file + + + + +2012-02-03T21:55:34.000000Z +a3e36a2e070c5a2f668826084650c287 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +3943 + +sources +dir + +listeners.js +file + + + + +2012-02-03T21:55:34.000000Z +fa702c833d7a46c2fb3a058d9b1c30c5 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +847 + +util +dir + +controls.js +file + + + + +2012-02-03T21:55:34.000000Z +0a0c31f04c1d77d51ba66a2916eddd04 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +5608 + +create.js +file + + + + +2012-02-03T21:55:34.000000Z +73e463920d1e34b8ba3b2f1aecf26d5b +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +276 + diff --git a/scripts/.svn/text-base/controls.js.svn-base b/scripts/.svn/text-base/controls.js.svn-base new file mode 100644 index 0000000..3b4ba36 --- /dev/null +++ b/scripts/.svn/text-base/controls.js.svn-base @@ -0,0 +1,148 @@ +/** + * Controls + */ + +Timegrid.Controls = {}; + +/* + * A panel will render controls around a set of layouts. This should be the + * only entrypoint into this code, in addition to the render method. + * Possible controls include: + * Switching between the layouts (tabs) + * Iterating through time, different weeks/months, etc (arrows) + * Switching between data sources + * The style and selection of which types of controls to render in the panel + * should be easily configurable through the params hash passed in. + */ +Timegrid.Controls.Panel = function(layouts, params) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet.setLayouts(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.render = function(container) { + this._tabSet.render(container); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +Timegrid.Controls.Panel.prototype.renderChanged = function() { + this._tabSet.renderChanged(); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +/* + * TabSet is a style of control that generates a set of tabs. These tabs can + * be configured to switch between different views, time slices, or data + * sources. + */ +Timegrid.Controls.TabSet = function(titles, layouts) { + this.setLayouts(titles, layouts); + this.current = ""; +}; + +Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { + this._tabs = {}; + this._renderedLayouts = {}; + this._iterators = {}; + this._layoutMap = {}; + for (var i = 0; i < titles.length; i++) { + this._layoutMap[titles[i]] = layouts[i]; + } +}; + +Timegrid.Controls.TabSet.prototype.render = function(container) { + this._container = container; + var self = this; + var tabDiv = $('
').addClass('timegrid-tabs'); + $(container).prepend(tabDiv); + var makeCallback = function(title) { + return function() { self.switchTo(title); }; + }; + for (var lTitle in this._layoutMap) { + var tab = $('') + .height(this._layoutMap[lTitle].tabHeight + "px") + .click(makeCallback(lTitle)) + .addClass('timegrid-tab').addClass('timegrid-rounded'); + tabDiv.prepend(tab); + this._tabs[lTitle] = tab; + } + if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } +}; + +Timegrid.Controls.TabSet.prototype.renderChanged = function() { + var layout = this._layoutMap[this.current]; + layout.renderChanged(); +}; + +Timegrid.Controls.TabSet.prototype.switchTo = function(title) { + if (this.current && this._renderedLayouts[this.current]) { + this._renderedLayouts[this.current].hide(); + this._tabs[this.current].removeClass('timegrid-tab-active'); + } + if (this._renderedLayouts[title]) { + this._renderedLayouts[title].show(); + } else if (this._layoutMap[title]) { + this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); + } + if (this._iDiv) { $(this._iDiv).empty(); } + if (this._layoutMap[title].iterable) { + if (!this._iterators[title]) { + this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); + this._iDiv = $(this._iterators[title].render(this._container)); + } else { + this._iDiv = $(this._iterators[title].render()); + } + } + this.current = title; + this._tabs[this.current].addClass('timegrid-tab-active'); +}; + +/* + * Iterator is a style of control that generates a textual label for the + * current selection and a set of arrows for moving to either the previous + * or next selection. Can be used for views, time, or sources. + */ +Timegrid.Controls.Iterator = function(layout) { + this._layout = layout; +}; + +Timegrid.Controls.Iterator.prototype.render = function(container) { + if (container) { + this._container = container; + this._div = $('
').addClass('timegrid-iterator'); + $(this._container).prepend(this._div); + } else { + this._div.empty(); + } + var self = this; + var makePrevCallback = function(layout) { + return function() { + layout.goPrevious(); + self.render(); + }; + }; + var makeNextCallback = function(layout) { + return function() { + layout.goNext(); + self.render(); + }; + }; + var prevLink = $('Previous') + .wrap('').parent() + .addClass('timegrid-iterator-prev') + .click(makePrevCallback(this._layout)); + var nextLink = $('Next') + .wrap('').parent() + .addClass('timegrid-iterator-next') + .click(makeNextCallback(this._layout)); + this._div.append(prevLink); + this._div.append(nextLink); + this._div.append('' + this._layout.getCurrent() + ''); + return this._div; +}; diff --git a/scripts/.svn/text-base/create.js.svn-base b/scripts/.svn/text-base/create.js.svn-base new file mode 100644 index 0000000..d0484ee --- /dev/null +++ b/scripts/.svn/text-base/create.js.svn-base @@ -0,0 +1,8 @@ +$(document).ready(function() { + $('div').each(function() { + if ($(this).attrs('tg').role == "grid") { + if (!window.timegrids) { window.timegrids = new Array(); } + window.timegrids.push(Timegrid.createFromDOM(this)); + } + }); +}); \ No newline at end of file diff --git a/scripts/.svn/text-base/grid.js.svn-base b/scripts/.svn/text-base/grid.js.svn-base new file mode 100644 index 0000000..a73db88 --- /dev/null +++ b/scripts/.svn/text-base/grid.js.svn-base @@ -0,0 +1,56 @@ +/****************************************************************************** + * Grid + * Grid is the primary data structure that stores events for Timegrid to + * process and render out to the client. + *****************************************************************************/ + +Timegrid.Grid = function(objs, xSize, ySize, xMapper, yMapper) { + Timegrid.Grid.superclass.call(this); + // Construct the actual array container for objects + this.grid = new Array(xSize); + for (i = 0; i < xSize; i++) { + this.grid[i] = new Array(ySize); + for (j = 0; j < ySize; j++) { + this.grid[i][j] = []; + } + } + this.xMapper = xMapper; + this.yMapper = yMapper; + this.size = 0; + + this.addAll(objs); +}; +$.inherit(Timegrid.Grid, Timegrid.ListenerAware); + +Timegrid.Grid.prototype.add = function(obj) { + var x = this.xMapper(obj); + var y = this.yMapper(obj); + this.get(x,y).push(obj); + this.size++; +}; + +Timegrid.Grid.prototype.addAll = function(objs) { + for (i in objs) { this.add(objs[i]); } +}; + +Timegrid.Grid.prototype.remove = function(obj) { + var x = this.xMapper(obj); + var y = this.yMapper(obj); + var objs = this.get(x,y); + for (i = 0; i < objs.length; i++) { + if (obj == objs[i]) { + objs.splice(i, 1); + this.size--; + return true; + } + } + return false; +}; + +Timegrid.Grid.prototype.get = function(x, y) { + return this.grid[x][y]; +}; + +Timegrid.Grid.prototype.getSize = function() { + return this.size; +}; diff --git a/scripts/.svn/text-base/labellers.js.svn-base b/scripts/.svn/text-base/labellers.js.svn-base new file mode 100644 index 0000000..e4590a6 --- /dev/null +++ b/scripts/.svn/text-base/labellers.js.svn-base @@ -0,0 +1,91 @@ +/*================================================== + * Gregorian Date Labeller + *================================================== + */ + +Timegrid.GregorianDateLabeller = function(locale, timeZone) { + this._locale = locale; + this._timeZone = timeZone; +}; + +Timegrid.GregorianDateLabeller.monthNames = []; +Timegrid.GregorianDateLabeller.dayNames = []; +Timegrid.GregorianDateLabeller.labelIntervalFunctions = []; + +Timegrid.GregorianDateLabeller.getMonthName = function(month, locale) { + return Timegrid.GregorianDateLabeller.monthNames[locale][month]; +}; + +Timegrid.GregorianDateLabeller.prototype.labelInterval = function(date, intervalUnit) { + var f = Timegrid.GregorianDateLabeller.labelIntervalFunctions[this._locale]; + if (f == null) { + f = Timegrid.GregorianDateLabeller.prototype.defaultLabelInterval; + } + return f.call(this, date, intervalUnit); +}; + +Timegrid.GregorianDateLabeller.prototype.labelPrecise = function(date) { + return SimileAjax.DateTime.removeTimeZoneOffset( + date, + this._timeZone //+ (new Date().getTimezoneOffset() / 60) + ).toUTCString(); +}; + +Timegrid.GregorianDateLabeller.prototype.defaultLabelInterval = function(date, intervalUnit) { + var text; + var emphasized = false; + + date = SimileAjax.DateTime.removeTimeZoneOffset(date, this._timeZone); + + switch(intervalUnit) { + case SimileAjax.DateTime.MILLISECOND: + text = date.getUTCMilliseconds(); + break; + case SimileAjax.DateTime.SECOND: + text = date.getUTCSeconds(); + break; + case SimileAjax.DateTime.MINUTE: + var m = date.getUTCMinutes(); + if (m == 0) { + text = date.getUTCHours() + ":00"; + emphasized = true; + } else { + text = m; + } + break; + case SimileAjax.DateTime.HOUR: + text = date.getUTCHours() + "hr"; + break; + case SimileAjax.DateTime.DAY: + text = Timegrid.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate(); + break; + case SimileAjax.DateTime.WEEK: + text = Timegrid.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate(); + break; + case SimileAjax.DateTime.MONTH: + var m = date.getUTCMonth(); + if (m != 0) { + text = Timegrid.GregorianDateLabeller.getMonthName(m, this._locale); + break; + } // else, fall through + case SimileAjax.DateTime.YEAR: + case SimileAjax.DateTime.DECADE: + case SimileAjax.DateTime.CENTURY: + case SimileAjax.DateTime.MILLENNIUM: + var y = date.getUTCFullYear(); + if (y > 0) { + text = date.getUTCFullYear(); + } else { + text = (1 - y) + "BC"; + } + emphasized = + (intervalUnit == SimileAjax.DateTime.MONTH) || + (intervalUnit == SimileAjax.DateTime.DECADE && y % 100 == 0) || + (intervalUnit == SimileAjax.DateTime.CENTURY && y % 1000 == 0); + break; + default: + text = date.toUTCString(); + } + return { text: text, emphasized: emphasized }; +} + diff --git a/scripts/.svn/text-base/listeners.js.svn-base b/scripts/.svn/text-base/listeners.js.svn-base new file mode 100644 index 0000000..f1d161d --- /dev/null +++ b/scripts/.svn/text-base/listeners.js.svn-base @@ -0,0 +1,29 @@ +Timegrid.ListenerAware = function() { + this._listeners = []; +}; + +Timegrid.ListenerAware.prototype.addListener = function(listener) { + this._listeners.push(listener); +}; + +Timegrid.ListenerAware.prototype.removeListener = function(listener) { + for (var i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] == listener) { + this._listeners.splice(i, 1); + break; + } + } +}; + +Timegrid.ListenerAware.prototype._fire = function(handlerName, args) { + for (var i = 0; i < this._listeners.length; i++) { + var listener = this._listeners[i]; + if (handlerName in listener) { + try { + listener[handlerName].apply(listener, args); + } catch (e) { + Timegrid.Debug.exception(e); + } + } + } +}; \ No newline at end of file diff --git a/scripts/.svn/text-base/themes.js.svn-base b/scripts/.svn/text-base/themes.js.svn-base new file mode 100644 index 0000000..383efd5 --- /dev/null +++ b/scripts/.svn/text-base/themes.js.svn-base @@ -0,0 +1,127 @@ +/*================================================== + * Classic Theme + *================================================== + */ + + +Timegrid.ClassicTheme = new Object(); + +Timegrid.ClassicTheme.implementations = []; + +Timegrid.ClassicTheme.create = function(locale) { + if (locale == null) { + locale = Timegrid.Platform.getDefaultLocale(); + } + + var f = Timegrid.ClassicTheme.implementations[locale]; + if (f == null) { + f = Timegrid.ClassicTheme._Impl; + } + return new f(); +}; + +Timegrid.ClassicTheme._Impl = function() { + this.firstDayOfWeek = 0; // Sunday + + this.ether = { + backgroundColors: [ + "#EEE", + "#DDD", + "#CCC", + "#AAA" + ], + highlightColor: "white", + highlightOpacity: 50, + interval: { + line: { + show: true, + color: "#aaa", + opacity: 25 + }, + weekend: { + color: "#FFFFE0", + opacity: 30 + }, + marker: { + hAlign: "Bottom", + hBottomStyler: function(elmt) { + elmt.className = "timeline-ether-marker-bottom"; + }, + hBottomEmphasizedStyler: function(elmt) { + elmt.className = "timeline-ether-marker-bottom-emphasized"; + }, + hTopStyler: function(elmt) { + elmt.className = "timeline-ether-marker-top"; + }, + hTopEmphasizedStyler: function(elmt) { + elmt.className = "timeline-ether-marker-top-emphasized"; + }, + + vAlign: "Right", + vRightStyler: function(elmt) { + elmt.className = "timeline-ether-marker-right"; + }, + vRightEmphasizedStyler: function(elmt) { + elmt.className = "timeline-ether-marker-right-emphasized"; + }, + vLeftStyler: function(elmt) { + elmt.className = "timeline-ether-marker-left"; + }, + vLeftEmphasizedStyler:function(elmt) { + elmt.className = "timeline-ether-marker-left-emphasized"; + } + } + } + }; + + this.event = { + track: { + offset: 0.5, // em + height: 1.5, // em + gap: 0.5 // em + }, + instant: { + icon: Timegrid.urlPrefix + "images/dull-blue-circle.png", + lineColor: "#58A0DC", + impreciseColor: "#58A0DC", + impreciseOpacity: 20, + showLineForNoText: true + }, + duration: { + color: "#58A0DC", + opacity: 100, + impreciseColor: "#58A0DC", + impreciseOpacity: 20 + }, + label: { + insideColor: "white", + outsideColor: "black", + width: 200 // px + }, + highlightColors: [ + "#FFFF00", + "#FFC000", + "#FF0000", + "#0000FF" + ], + bubble: { + width: 250, // px + height: 125, // px + titleStyler: function(elmt) { + elmt.className = "timeline-event-bubble-title"; + }, + bodyStyler: function(elmt) { + elmt.className = "timeline-event-bubble-body"; + }, + imageStyler: function(elmt) { + elmt.className = "timeline-event-bubble-image"; + }, + wikiStyler: function(elmt) { + elmt.className = "timeline-event-bubble-wiki"; + }, + timeStyler: function(elmt) { + elmt.className = "timeline-event-bubble-time"; + } + } + }; +}; \ No newline at end of file diff --git a/scripts/.svn/text-base/timegrid.js.svn-base b/scripts/.svn/text-base/timegrid.js.svn-base new file mode 100644 index 0000000..c92e843 --- /dev/null +++ b/scripts/.svn/text-base/timegrid.js.svn-base @@ -0,0 +1,198 @@ +/****************************************************************************** + * Timegrid + *****************************************************************************/ + +Timegrid.create = function(node, eventSource, layoutName, layoutParams) { + return new Timegrid._Impl(node, eventSource, layoutName, layoutParams); +}; + +Timegrid.resize = function() { + for (var i = 0; i < window.timegrids.length; i++) { + window.timegrids[i]._resize(); + } + return false; +}; + +Timegrid.createFromDOM = function(elmt) { + var config = Timegrid.getConfigFromDOM(elmt); + var layoutNames = config.views.split(","); + var getExtension = function(s) { + return s.split('.').pop().toLowerCase(); + }; + if (config.eventsource) { + var eventSource = eval(config.eventsource); + var tg = Timegrid.create(elmt, eventSource, layoutNames, config); + return tg; + } else if (config.src) { + var eventSource = new Timegrid.DefaultEventSource(); + var tg = Timegrid.create(elmt, eventSource, layoutNames, config); + switch (getExtension(config.src)) { + case 'xml': + tg.loadXML(config.src, function(xml, url) { + eventSource.loadXML(xml, url); + }); + break; + case 'js': + tg.loadJSON(config.src, function(json, url) { + eventSource.loadJSON(json, url); + }); + break; + } + return tg; + } +}; + +Timegrid.getConfigFromDOM = function(elmt) { + var config = $(elmt).attrs('tg'); + config.scrollwidth = $.scrollWidth(); + for (var k in config) { + config[k.toLowerCase()] = config[k]; + } + return config; +}; + +Timegrid.loadXML = function(url, f) { + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + }; + var fDone = function(xmlhttp) { + var xml = xmlhttp.responseXML; + if (!xml.documentElement && xmlhttp.responseStream) { + xml.load(xmlhttp.responseStream); + } + f(xml, url); + }; + SimileAjax.XmlHttp.get(url, fError, fDone); +}; + +Timegrid.loadJSON = function(url, f) { + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + }; + var fDone = function(xmlhttp) { + f(eval('(' + xmlhttp.responseText + ')'), url); + }; + SimileAjax.XmlHttp.get(url, fError, fDone); +}; + +Timegrid._Impl = function(node, eventSource, layoutNames, layoutParams) { + var tg = this; + this._container = node; + this._eventSource = eventSource; + this._layoutNames = layoutNames; + this._layoutParams = layoutParams; + + if (this._eventSource) { + this._eventListener = { + onAddMany: function() { tg._onAddMany(); }, + onClear: function() { tg._onClear(); } + } + this._eventSource.addListener(this._eventListener); + } + + this._construct(); +}; + +Timegrid._Impl.prototype.loadXML = function(url, f) { + var tg = this; + + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + tg.hideLoadingMessage(); + }; + var fDone = function(xmlhttp) { + try { + var xml = xmlhttp.responseXML; + if (!xml.documentElement && xmlhttp.responseStream) { + xml.load(xmlhttp.responseStream); + } + f(xml, url); + } finally { + tg.hideLoadingMessage(); + } + }; + this.showLoadingMessage(); + window.setTimeout(function() { + SimileAjax.XmlHttp.get(url, fError, fDone); + }, 0); +}; + +Timegrid._Impl.prototype.loadJSON = function(url, f) { + var tg = this; + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + tg.hideLoadingMessage(); + }; + var fDone = function(xmlhttp) { + try { + f(eval('(' + xmlhttp.responseText + ')'), url); + } finally { + tg.hideLoadingMessage(); + } + }; + this.showLoadingMessage(); + window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0); +}; + +Timegrid._Impl.prototype._construct = function() { + this.rendering = true; + var self = this; + this._layouts = $.map(this._layoutNames, function(s) { + return Timegrid.LayoutFactory.createLayout(s, self._eventSource, + self._layoutParams); + }); + if (this._panel) { + this._panel.setLayouts(this._layouts); + } else { + this._panel = new Timegrid.Controls.Panel(this._layouts); + } + var container = this._container; + var doc = container.ownerDocument; + + while (container.firstChild) { + container.removeChild(container.firstChild); + } + $(container).addClass('timegrid-default'); + + var message = SimileAjax.Graphics.createMessageBubble(doc); + message.containerDiv.className = "timegrid-message-container"; + container.appendChild(message.containerDiv); + + message.contentDiv.className = "timegrid-message"; + message.contentDiv.innerHTML = " " + Timegrid.l10n.loadingMessage; + + this.showLoadingMessage = function() { $(message.containerDiv).show(); }; + this.hideLoadingMessage = function() { $(message.containerDiv).hide(); }; + + this._panel.render(container); + this.rendering = false; +}; + +Timegrid._Impl.prototype._update = function() { + this._panel.renderChanged(); +}; + +Timegrid._Impl.prototype._resize = function() { + var newHeight = $(this._container).height(); + var newWidth = $(this._container).width(); + + if (!(newHeight == this._oldHeight && newWidth == this._oldWidth)) { + if (!this.rendering) { this._construct(); } + this._oldHeight = newHeight; + this._oldWidth = newWidth; + } +}; + +Timegrid._Impl.prototype._onAddMany = function() { + this._update(); +}; + +Timegrid._Impl.prototype._onClear = function() { + this._update(); +}; + diff --git a/scripts/controls.js b/scripts/controls.js new file mode 100644 index 0000000..6e9a40a --- /dev/null +++ b/scripts/controls.js @@ -0,0 +1,148 @@ +/** + * Controls + */ + +Timegrid.Controls = {}; + +/* + * A panel will render controls around a set of layouts. This should be the + * only entrypoint into this code, in addition to the render method. + * Possible controls include: + * Switching between the layouts (tabs) + * Iterating through time, different weeks/months, etc (arrows) + * Switching between data sources + * The style and selection of which types of controls to render in the panel + * should be easily configurable through the params hash passed in. + */ +Timegrid.Controls.Panel = function(layouts, params) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet.setLayouts(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.render = function(container) { + this._tabSet.render(container); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +Timegrid.Controls.Panel.prototype.renderChanged = function() { + this._tabSet.renderChanged(); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +/* + * TabSet is a style of control that generates a set of tabs. These tabs can + * be configured to switch between different views, time slices, or data + * sources. + */ +Timegrid.Controls.TabSet = function(titles, layouts) { + this.setLayouts(titles, layouts); + this.current = ""; +}; + +Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { + this._tabs = {}; + this._renderedLayouts = {}; + this._iterators = {}; + this._layoutMap = {}; + for (var i = 0; i < titles.length; i++) { + this._layoutMap[titles[i]] = layouts[i]; + } +}; + +Timegrid.Controls.TabSet.prototype.render = function(container) { + this._container = container; + var self = this; + var tabDiv = $('
').addClass('timegrid-tabs'); + $(container).prepend(tabDiv); + var makeCallback = function(title) { + return function() { self.switchTo(title); }; + }; + for (var lTitle in this._layoutMap) { + var tab = $('') + .height(this._layoutMap[lTitle].tabHeight + "px") + .click(makeCallback(lTitle)) + .addClass('timegrid-tab').addClass('timegrid-rounded'); + tabDiv.prepend(tab); + this._tabs[lTitle] = tab; + } + if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } +}; + +Timegrid.Controls.TabSet.prototype.renderChanged = function() { + var layout = this._layoutMap[this.current]; + layout.renderChanged(); +}; + +Timegrid.Controls.TabSet.prototype.switchTo = function(title) { + if (this.current && this._renderedLayouts[this.current]) { + this._renderedLayouts[this.current].hide(); + this._tabs[this.current].removeClass('timegrid-tab-active'); + } + if (this._renderedLayouts[title]) { + this._renderedLayouts[title].show(); + } else if (this._layoutMap[title]) { + this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); + } + if (this._iDiv) { $(this._iDiv).empty(); } + if (this._layoutMap[title].iterable) { + if (!this._iterators[title]) { + this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); + this._iDiv = $(this._iterators[title].render(this._container)); + } else { + this._iDiv = $(this._iterators[title].render()); + } + } + this.current = title; + this._tabs[this.current].addClass('timegrid-tab-active'); +}; + +/* + * Iterator is a style of control that generates a textual label for the + * current selection and a set of arrows for moving to either the previous + * or next selection. Can be used for views, time, or sources. + */ +Timegrid.Controls.Iterator = function(layout) { + this._layout = layout; +}; + +Timegrid.Controls.Iterator.prototype.render = function(container) { + if (container) { + this._container = container; + this._div = $('
').addClass('timegrid-iterator'); + $(this._container).prepend(this._div); + } else { + this._div.empty(); + } + var self = this; + var makePrevCallback = function(layout) { + return function() { + layout.goPrevious(); + self.render(); + }; + }; + var makeNextCallback = function(layout) { + return function() { + layout.goNext(); + self.render(); + }; + }; + var prevLink = $('Previous') + .wrap('').parent() + .addClass('timegrid-iterator-prev') + .click(makePrevCallback(this._layout)); + var nextLink = $('Next') + .wrap('').parent() + .addClass('timegrid-iterator-next') + .click(makeNextCallback(this._layout)); + this._div.append(prevLink); + this._div.append(nextLink); + this._div.append('' + this._layout.getCurrent() + ''); + return this._div; +}; diff --git a/scripts/create.js b/scripts/create.js new file mode 100644 index 0000000..fcd95ec --- /dev/null +++ b/scripts/create.js @@ -0,0 +1,8 @@ +$(document).ready(function() { + $('div').each(function() { + if ($(this).attrs('tg').role == "grid") { + if (!window.timegrids) { window.timegrids = new Array(); } + window.timegrids.push(Timegrid.createFromDOM(this)); + } + }); +}); \ No newline at end of file diff --git a/scripts/grid.js b/scripts/grid.js new file mode 100644 index 0000000..3bff36f --- /dev/null +++ b/scripts/grid.js @@ -0,0 +1,57 @@ +/****************************************************************************** + * Grid + * Grid is the primary data structure that stores events for Timegrid to + * process and render out to the client. + *****************************************************************************/ + +Timegrid.Grid = function(objs, xSize, ySize, xMapper, yMapper) { + Timegrid.Grid.superclass.call(this); + // Construct the actual array container for objects + this.grid = new Array(xSize); + for (i = 0; i < xSize; i++) { + this.grid[i] = new Array(ySize); + for (j = 0; j < ySize; j++) { + this.grid[i][j] = []; + } + } + this.xMapper = xMapper; + this.yMapper = yMapper; + this.size = 0; + + this.addAll(objs); +}; +debugger; +$.inherit(Timegrid.Grid, Timegrid.ListenerAware); + +Timegrid.Grid.prototype.add = function(obj) { + var x = this.xMapper(obj); + var y = this.yMapper(obj); + this.get(x,y).push(obj); + this.size++; +}; + +Timegrid.Grid.prototype.addAll = function(objs) { + for (i in objs) { this.add(objs[i]); } +}; + +Timegrid.Grid.prototype.remove = function(obj) { + var x = this.xMapper(obj); + var y = this.yMapper(obj); + var objs = this.get(x,y); + for (i = 0; i < objs.length; i++) { + if (obj == objs[i]) { + objs.splice(i, 1); + this.size--; + return true; + } + } + return false; +}; + +Timegrid.Grid.prototype.get = function(x, y) { + return this.grid[x][y]; +}; + +Timegrid.Grid.prototype.getSize = function() { + return this.size; +}; diff --git a/scripts/labellers.js b/scripts/labellers.js new file mode 100644 index 0000000..e4590a6 --- /dev/null +++ b/scripts/labellers.js @@ -0,0 +1,91 @@ +/*================================================== + * Gregorian Date Labeller + *================================================== + */ + +Timegrid.GregorianDateLabeller = function(locale, timeZone) { + this._locale = locale; + this._timeZone = timeZone; +}; + +Timegrid.GregorianDateLabeller.monthNames = []; +Timegrid.GregorianDateLabeller.dayNames = []; +Timegrid.GregorianDateLabeller.labelIntervalFunctions = []; + +Timegrid.GregorianDateLabeller.getMonthName = function(month, locale) { + return Timegrid.GregorianDateLabeller.monthNames[locale][month]; +}; + +Timegrid.GregorianDateLabeller.prototype.labelInterval = function(date, intervalUnit) { + var f = Timegrid.GregorianDateLabeller.labelIntervalFunctions[this._locale]; + if (f == null) { + f = Timegrid.GregorianDateLabeller.prototype.defaultLabelInterval; + } + return f.call(this, date, intervalUnit); +}; + +Timegrid.GregorianDateLabeller.prototype.labelPrecise = function(date) { + return SimileAjax.DateTime.removeTimeZoneOffset( + date, + this._timeZone //+ (new Date().getTimezoneOffset() / 60) + ).toUTCString(); +}; + +Timegrid.GregorianDateLabeller.prototype.defaultLabelInterval = function(date, intervalUnit) { + var text; + var emphasized = false; + + date = SimileAjax.DateTime.removeTimeZoneOffset(date, this._timeZone); + + switch(intervalUnit) { + case SimileAjax.DateTime.MILLISECOND: + text = date.getUTCMilliseconds(); + break; + case SimileAjax.DateTime.SECOND: + text = date.getUTCSeconds(); + break; + case SimileAjax.DateTime.MINUTE: + var m = date.getUTCMinutes(); + if (m == 0) { + text = date.getUTCHours() + ":00"; + emphasized = true; + } else { + text = m; + } + break; + case SimileAjax.DateTime.HOUR: + text = date.getUTCHours() + "hr"; + break; + case SimileAjax.DateTime.DAY: + text = Timegrid.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate(); + break; + case SimileAjax.DateTime.WEEK: + text = Timegrid.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate(); + break; + case SimileAjax.DateTime.MONTH: + var m = date.getUTCMonth(); + if (m != 0) { + text = Timegrid.GregorianDateLabeller.getMonthName(m, this._locale); + break; + } // else, fall through + case SimileAjax.DateTime.YEAR: + case SimileAjax.DateTime.DECADE: + case SimileAjax.DateTime.CENTURY: + case SimileAjax.DateTime.MILLENNIUM: + var y = date.getUTCFullYear(); + if (y > 0) { + text = date.getUTCFullYear(); + } else { + text = (1 - y) + "BC"; + } + emphasized = + (intervalUnit == SimileAjax.DateTime.MONTH) || + (intervalUnit == SimileAjax.DateTime.DECADE && y % 100 == 0) || + (intervalUnit == SimileAjax.DateTime.CENTURY && y % 1000 == 0); + break; + default: + text = date.toUTCString(); + } + return { text: text, emphasized: emphasized }; +} + diff --git a/scripts/layouts/.svn/all-wcprops b/scripts/layouts/.svn/all-wcprops new file mode 100644 index 0000000..68e466c --- /dev/null +++ b/scripts/layouts/.svn/all-wcprops @@ -0,0 +1,41 @@ +K 25 +svn:wc:ra_dav:version-url +V 81 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts +END +property.js +K 25 +svn:wc:ra_dav:version-url +V 93 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts/property.js +END +monthly.js +K 25 +svn:wc:ra_dav:version-url +V 92 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts/monthly.js +END +nday.js +K 25 +svn:wc:ra_dav:version-url +V 89 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts/nday.js +END +layout.js +K 25 +svn:wc:ra_dav:version-url +V 91 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts/layout.js +END +weekly.js +K 25 +svn:wc:ra_dav:version-url +V 91 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts/weekly.js +END +nmonth.js +K 25 +svn:wc:ra_dav:version-url +V 91 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/layouts/nmonth.js +END diff --git a/scripts/layouts/.svn/entries b/scripts/layouts/.svn/entries new file mode 100644 index 0000000..6783ea4 --- /dev/null +++ b/scripts/layouts/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts/layouts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +property.js +file + + + + +2012-02-03T21:55:33.000000Z +f90ab8769a7c52a5b1f0de1a95dfc406 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +5715 + +monthly.js +file + + + + +2012-02-03T21:55:33.000000Z +95d7bd98a9cf2ca663eb583af5f5c0a8 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +686 + +nday.js +file + + + + +2012-02-03T21:55:33.000000Z +4adc3b2623ed64a3311608fc01b1f3c1 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +8661 + +layout.js +file + + + + +2012-02-03T21:55:33.000000Z +718e982a24fdc2965c10c2f63936ae8e +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +14083 + +weekly.js +file + + + + +2012-02-03T21:55:33.000000Z +aebdd5f89849cf6d49d3359840af983a +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1605 + +nmonth.js +file + + + + +2012-02-03T21:55:33.000000Z +17d730b1e1adf0c3577d7b5def9e7731 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +9348 + diff --git a/scripts/layouts/.svn/text-base/layout.js.svn-base b/scripts/layouts/.svn/text-base/layout.js.svn-base new file mode 100644 index 0000000..41604af --- /dev/null +++ b/scripts/layouts/.svn/text-base/layout.js.svn-base @@ -0,0 +1,385 @@ +/** + * @fileOverview + * This is where we define the entrypoint for all of the different default + * layouts that Timegrid is capable of, e.g. month, week, n-day, etc. Both + * LayoutFactory and the common Layout superclass are defined in this file. + * @author masont + */ + +/** + * Constructs a LayoutFactory object. + * + * @class LayoutFactory is a simple factory class that abstracts the process of + * selecting and instantiating Layout objects. + * @constructor + */ +Timegrid.LayoutFactory = function() {}; + +Timegrid.LayoutFactory._constructors = {}; + +/** + * Registers a layout class with this layout factory. Automatically places the + * given layout under the common Layout superclass, and binds the name string + * to the constructor. + * + * @param {String} name the name to bind to the given constructor + * @param {Function} constructor the constructor to a layout class + */ +Timegrid.LayoutFactory.registerLayout = function(name, constructor) { + $.inherit(constructor, Timegrid.Layout); + Timegrid.LayoutFactory._constructors[name] = constructor; +}; + +/** + * Instantiates a Timegrid layout with the given parameter hash. + * + * @param {String} name the name of the layout + * @param {EventSource} eventSource an EventSource object to layout and render + * @param params a hash of parameters to be passed into the desired layout + * @return {Timegrid.Layout} a Timegrid.Layout instance of the specified subclass + */ +Timegrid.LayoutFactory.createLayout = function(name, eventSource, params) { + var constructor = Timegrid.LayoutFactory._constructors[name]; + if (typeof constructor == 'function') { + layout = new constructor(eventSource, $.clone(params)); + return layout; + } else { + throw "No such layout!"; + }; + return; +}; + +/** + * Instantiates a Layout object. This constructor should always be overridden. + * + * @class Layout is the base class for all layouts that Timegrid supports. + * @constructor + * @param {EventSource} eventSource the eventSource to pull events from + * @param {Object} params a parameter hash + */ +Timegrid.Layout = function(eventSource, params) { + var self = this; + /** + * An object containing a parameter hash + * @type Object + */ + this.params = params; + /** + * The number of columns in the grid + * @type Number + */ + this.xSize = 0; + /** + * The number of rows in the grid + * @type Number + */ + this.ySize = 0; + /** + * A function to map date objects to a custom timezone + * @type Function + */ + this.timezoneMapper = function(date) { + if (typeof self.timezoneoffset != "undefined") { + return date.toTimezone(self.timezoneoffset); + } + return date; + }; + /** + * A function to map endpoints to an integer x-coordinate + * @type Function + */ + this.xMapper = function(obj) { return self.timezoneMapper(obj.time); }; + /** + * A function to map endpoints to an integer y-coordinate + * @type Function + */ + this.yMapper = function(obj) { return self.timezoneMapper(obj.time); }; + /** + * The height of the horizontal labels in pixels + * @type Number + */ + this.xLabelHeight = 24; + /** + * The width of the vertical labels in pixels + * @type Number + */ + this.yLabelWidth = 48; + /** + * The height of the tabs that page between views in pixels + * @type Number + */ + this.tabHeight = 18; +}; + +/** + * Takes a parameter hash and extends this layout with it, flattening key names + * to lowercase as it goes. This is done to eliminate browser-specific + * attribute case sensitivity. + * + * @param {Object} params a parameter hash + */ +Timegrid.Layout.prototype.configure = function(params) { + for (var attr in params) { + this[attr] = params[attr.toLowerCase()]; + } +}; + +/** + * Computes the grid dimensions (gridheight, gridwidth, ycell, xcell) for this + * layout. This is relatively complex since any of the above values can be + * either user-specified or computed. + */ +Timegrid.Layout.prototype.computeCellSizes = function() { + // Compute the cell sizes for the grid + this.xCell = this.params.xCell || this.params.xcell || + (this.gridwidth - 1) / this.xSize; + this.yCell = this.params.yCell || this.params.ycell || + (this.gridheight - 1) / this.ySize; + if (this.params.yCell || this.params.ycell) { + this.gridheight = this.yCell * this.ySize; + } + if (this.params.xCell || this.params.xcell) { + this.gridwidth = this.xCell * this.xSize; + } +}; + +/** + * Renders out this layout into a DOM object with a wrapping div element as its + * parent, returning the div. + * + * @param {Element} container the parent element + * @return {Element} a rendered DOM tree descended from a div element + */ +Timegrid.Layout.prototype.render = function(container) { + if (this.mini) { + this.scrollwidth = 0; + this.tabHeight = 0; + this.xLabelHeight = 24; + this.yLabelWidth = 24; + } + if (!(this.params.height && this.params.gridheight)) { + this.scrollwidth = 0; + } + if (container) { + this._container = container; + this._viewDiv = $("
").addClass('timegrid-view') + .css('top', this.tabHeight + "px"); + $(this._container).append(this._viewDiv); + } else { + this._viewDiv.empty(); + } + var gridDiv = $('
').addClass('timegrid-grid'); + var gridWindowDiv = $('
').addClass('timegrid-grid-window'); + if (!this.scrollwidth) { gridWindowDiv.css('overflow', 'visible'); } + + if (!this.params.height) { + this.height = this._container.style.height ? + $(this._container).height() : 3 + this.scrollwidth + this.tabHeight + + this.xLabelHeight + + (this.gridheight || 500); + } + $(this._container).height(this.height + "px"); + if (!this.params.width) { + this.width = this.params.gridwidth || $(this._container).width(); + } else { + $(this._container).width(this.width + "px"); + } + $(this._container).css('position', 'relative'); + this._viewDiv.height(this.height - this.tabHeight + "px"); + + gridWindowDiv.css("top", this.xLabelHeight).css("left", this.yLabelWidth) + .css("right", "0px").css("bottom", "0px"); + this._viewDiv.append(gridWindowDiv.append(gridDiv)); + + var windowHeight = this._viewDiv.height() - gridWindowDiv.position().top - 2; + var windowWidth = this._viewDiv.width() - gridWindowDiv.position().left - 2; + gridWindowDiv.height(windowHeight).width(windowWidth); + + this.gridwidth = this.gridwidth || gridWindowDiv.width() - this.scrollwidth; + this.gridheight = this.gridheight || gridWindowDiv.height() - this.scrollwidth; + gridDiv.height(this.gridheight + "px").width(this.gridwidth + "px"); + this.computeCellSizes(); + this._gridDiv = gridDiv; + gridDiv.append(this.renderEvents(document)); + gridDiv.append(this.renderGridlines(document)); + var xLabels = this.renderXLabels(); + var yLabels = this.renderYLabels(); + var syncHorizontalScroll = function(a, b) { + $(a).scroll(function() { b.scrollLeft = a.scrollLeft; }); + $(b).scroll(function() { a.scrollLeft = b.scrollLeft; }); + }; + var syncVerticalScroll = function(a, b) { + $(a).scroll(function() { b.scrollTop = a.scrollTop; }); + $(b).scroll(function() { a.scrollTop = b.scrollTop; }); + }; + syncVerticalScroll(yLabels, gridWindowDiv.get(0)); + syncHorizontalScroll(xLabels, gridWindowDiv.get(0)); + this._viewDiv.append(xLabels).append(yLabels); + + if (!this.mini) { + if ($.browser.msie) { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,0,0,1); + } else { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,7,1,0.7); + } + } + + return this._viewDiv.get(0); +}; + +Timegrid.Layout.prototype.renderChanged = function() { + this.initializeGrid(); + this._gridDiv.empty(); + this._gridDiv.append(this.renderEvents(document)); + this._gridDiv.append(this.renderGridlines(document)); + this.renderXLabels(); + this.renderYLabels(); + if (!this.mini) { + if ($.browser.msie) { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,0,0,1); + } else { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,7,1,0.7); + } + } +}; + +/** + * An abstract method to render events for this layout. This method is where + * specific layout implementations hook into the main rendering loop. While + * generally used to render events, this method can return any valid input to + * the jQuery append method, which is then appended under the grid + * div element. + * + * @function + * @param {Document} doc the document to create elements from + * @return {Content} any valid argument to jQuery's append, to be appended under + * the grid div + */ +Timegrid.Layout.prototype.renderEvents = Timegrid.abstract("renderEvents"); + +/** + * Renders the gridlines for this layout. Gridlines are represented in the DOM + * as absolutely positioned div elements with one dimension set to + * one pixel. + * + * @return {Element} a DOM element containing this layout's gridlines + */ +Timegrid.Layout.prototype.renderGridlines = function() { + var gridlineContainer = document.createElement("div"); + gridlineContainer.className = 'timegrid-gridlines'; + + for (var x = 0; x < this.xSize; x++) { // Vertical lines + var vlineDiv = document.createElement('div'); + vlineDiv.className = 'timegrid-vline'; + vlineDiv.style.height = this.gridheight + "px"; + vlineDiv.style.left = x * this.xCell + "px"; + gridlineContainer.appendChild(vlineDiv); + } + for (var y = 0; y <= this.ySize; y++) { // Horizontal lines + var hlineDiv = document.createElement('div'); + hlineDiv.className = 'timegrid-hline'; + hlineDiv.style.width = "100%"; + hlineDiv.style.top = y * this.yCell + "px"; + gridlineContainer.appendChild(hlineDiv); + } + return gridlineContainer; +}; + +/** + * Renders the horizontal column labels that run above the grid. The labels + * themselves are provided by the implementing layout subclasses by + * getXLabels() + * + * @return {Element} a DOM element containing the horizontal labels + */ +Timegrid.Layout.prototype.renderXLabels = function() { + this._xLabelContainer = this._xLabelContainer || + document.createElement("div"); + var xLabelContainer = this._xLabelContainer; + xLabelContainer.innerHTML = ""; + xLabelContainer.className = 'timegrid-xlabels-window'; + xLabelContainer.style.height = this.xLabelHeight + "px"; + xLabelContainer.style.width = this.width - this.yLabelWidth - + this.scrollwidth - 2 + "px"; + xLabelContainer.style.left = this.yLabelWidth - 1 + "px"; + + var xLabelsDiv = document.createElement("div"); + xLabelsDiv.className = 'timegrid-xlabels'; + xLabelsDiv.style.height = this.xLabelHeight + "px" + xLabelsDiv.style.width = this.gridwidth + "px"; + xLabelsDiv.style.top = "0px"; + xLabelContainer.appendChild(xLabelsDiv); + + var labels = this.getXLabels(); + for (var i = 0; i < labels.length; i++) { + var label = document.createElement("div"); + label.className = 'timegrid-label'; + label.innerHTML = labels[i]; + label.style.width = this.xCell + 'px'; + label.style.left = (i * this.xCell) + 'px'; + xLabelsDiv.appendChild(label); + } + return xLabelContainer; +}; + +/** + * Renders the vertical row labels that run along the side of the grid. The + * labels themselves are provided by the implementing layout subclasses by + * getYLabels() + * + * @return {Element} a DOM element containing the vertical labels + */ +Timegrid.Layout.prototype.renderYLabels = function() { + this._yLabelContainer = this._yLabelContainer || + document.createElement("div"); + var yLabelContainer = this._yLabelContainer; + yLabelContainer.innerHTML = ""; + yLabelContainer.className = 'timegrid-ylabels-window'; + yLabelContainer.style.width = this.yLabelWidth + "px"; + yLabelContainer.style.height = this.height - this.xLabelHeight - + this.scrollwidth - this.tabHeight - 2 + "px"; + yLabelContainer.style.top = this.xLabelHeight - 1 + "px"; + + var yLabelsDiv = document.createElement("div"); + yLabelsDiv.className = 'timegrid-ylabels'; + yLabelsDiv.style.height = this.gridheight + "px"; + yLabelsDiv.style.width = this.yLabelWidth + "px"; + yLabelsDiv.style.left = "0px"; + yLabelContainer.appendChild(yLabelsDiv); + + var labels = this.getYLabels(); + var labelDivs = []; + for (var i = 0; i < labels.length; i++) { + var label = document.createElement('div'); + label.className = 'timegrid-label'; + label.innerHTML = labels[i]; + label.style.height = this.yCell + 'px'; + label.style.top = i * this.yCell + 'px'; + + yLabelsDiv.appendChild(label); + } + + return yLabelContainer; +}; + +/** + * An abstract method to get the horizontal column labels for this layout. This + * method must be implemented by all layout types subclassing Layout. + * + * @function + * @return {Array} an array of strings to use as column labels + */ +Timegrid.Layout.prototype.getXLabels = Timegrid.abstract("getXLabels"); + +/** + * An abstract method to get the vertical row labels for this layout. This + * method must be implemented by all layout types subclassing Layout. + * + * @function + * @return {Array} an array of strings to use as row labels + */ +Timegrid.Layout.prototype.getYLabels = Timegrid.abstract("getYLabels"); diff --git a/scripts/layouts/.svn/text-base/monthly.js.svn-base b/scripts/layouts/.svn/text-base/monthly.js.svn-base new file mode 100644 index 0000000..a56b785 --- /dev/null +++ b/scripts/layouts/.svn/text-base/monthly.js.svn-base @@ -0,0 +1,16 @@ +/****************************************************************************** + * MonthLayout + * @fileoverview + * This is where the monthly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + +Timegrid.MonthLayout = function(eventSource, params) { + params.n = 1; + params.title = params.title || Timegrid.MonthLayout.l10n.makeTitle(); + Timegrid.MonthLayout.superclass.call(this, eventSource, params); +}; +Timegrid.LayoutFactory.registerLayout("month", Timegrid.MonthLayout); +$.inherit(Timegrid.MonthLayout, Timegrid.NMonthLayout); + diff --git a/scripts/layouts/.svn/text-base/nday.js.svn-base b/scripts/layouts/.svn/text-base/nday.js.svn-base new file mode 100644 index 0000000..9804d0d --- /dev/null +++ b/scripts/layouts/.svn/text-base/nday.js.svn-base @@ -0,0 +1,242 @@ +/****************************************************************************** + * NDayLayout + * @fileoverview + * This is where the n-day layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + + /** + * Constructs an NDayLayout object. + * @class NDayLayout is a subclass of Layout that implements an n-day event + * calendar, modeled off of the weekly view found in Google Calendar. + * @extends Timegrid.Layout + * @constructor + */ +Timegrid.NDayLayout = function(eventSource, params) { + Timegrid.NDayLayout.superclass.call(this, eventSource, params); + var self = this; + + // Specifications for a week layout + this.xSize = 7; + this.ySize = 24; + this.iterable = true; + + // These are default values that can be overridden in configure + this.n = 3; + + this.xMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + var ivl = new SimileAjax.DateTime.Interval(time - start); + return ivl.days; + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); + this.xSize = this.n; + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + this.computeCellSizes(); + + this.eventSource = eventSource; + this.initializeGrid(eventSource); +}; +Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); + +Timegrid.NDayLayout.prototype.initializeGrid = function() { + this.startTime = this.computeStartTime(); + this.startTime.setHours(0); + this.endTime = this.computeEndTime(this.startTime); + + this.updateGrid(); +}; + +Timegrid.NDayLayout.prototype.updateGrid = function() { + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + + this.endpoints = []; + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); + this.endpoints.push(ends[0]); + this.endpoints.push(ends[1]); + } + } + this.endpoints.sort(function(a, b) { + var diff = a.time - b.time; + if (!diff) { + return a.type == "start" ? 1 : -1; + } else { + return diff; + } + }); +}; + +Timegrid.NDayLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (var i = 0; i < this.endpoints.length; i++) { + var endpoint = this.endpoints[i]; + var x = this.xMapper(endpoint); + var y = this.yMapper(endpoint); + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (var id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + var newLeft = this.xCell * x + newWidth * hIndex; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", newLeft + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + var nowDiv = this.renderNow(); + if (nowDiv) { + return $([eventContainer, nowDiv]); + } else { + return eventContainer; + } +}; + +Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { + var ediv = document.createElement('div'); + var tediv = document.createElement('div'); + if (!this.mini) { tediv.innerHTML = evt.getText(); } + ediv.appendChild(tediv); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + var className = "timegrid-event"; + if (!this.mini) { + className += ' timegrid-rounded-shadow'; + } + ediv.className = className; + ediv.style.height = this.yCell * length + "px"; + ediv.style.top = this.yCell * y + "px"; + ediv.style.left = this.xCell * x + 'px'; + if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } + if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } + return ediv; // Return the actual DOM element +}; + +Timegrid.NDayLayout.prototype.renderNow = function() { + // If we aren't looking at the current time, return + if (!this.now) { return; } + + var nowX = this.xMapper({ time: this.now }); + var nowY = Math.floor(this.yMapper({ time: this.now })); + + var rectDiv = $('
').addClass('timegrid-week-highlights'); + var yRect = $('
').height(this.yCell + "px") + .width(this.xCell * this.xSize + "px") + .css('top', nowY * this.yCell + "px") + .addClass('timegrid-week-highlight'); + var xRect = $('
').height(this.yCell * this.ySize + "px") + .width(this.xCell + "px") + .css('left', nowX * this.xCell + "px") + .addClass('timegrid-week-highlight'); + rectDiv.append(xRect).append(yRect); + return rectDiv.get(0); +}; + +Timegrid.NDayLayout.prototype.getXLabels = function() { + var date = new Date(this.startTime); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : + Timegrid.NDayLayout.l10n.xLabelFormat; + while (date < this.endTime) { + labels.push(date.format(format)); + date.setHours(24); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : + Timegrid.NDayLayout.l10n.yLabelFormat; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(format)); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.goPrevious = function() { + this.endTime = this.startTime; + this.startTime = this.computeStartTime(this.endTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.goNext = function() { + this.startTime = this.endTime; + this.endTime = this.computeEndTime(this.startTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.getCurrent = function() { + this.endTime.add('s', -1); + var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, + this.endTime); + this.endTime.add('s', 1); + return result; +}; + +Timegrid.NDayLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.add('d', 0 - this.n); + startTime.setHours(0); + return startTime; + } else { + var startTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + startTime.clearTime(); + return startTime; + } +}; + +Timegrid.NDayLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.n); + endTime.setHours(0); + return endTime; + } + return false; +}; + +Timegrid.NDayLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/scripts/layouts/.svn/text-base/nmonth.js.svn-base b/scripts/layouts/.svn/text-base/nmonth.js.svn-base new file mode 100644 index 0000000..0238403 --- /dev/null +++ b/scripts/layouts/.svn/text-base/nmonth.js.svn-base @@ -0,0 +1,259 @@ +/** + * NMonthLayout + * @fileoverview + * This is where the monthly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + */ + +Timegrid.NMonthLayout = function(eventSource, params) { + Timegrid.NMonthLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 7; + this.ySize = 0; // This is re-calculated later based on n + this.n = 3; + this.iterable = true; + + this.configure(params); + // We put title here because it depends on this.n + this.title = this.title || Timegrid.NMonthLayout.l10n.makeTitle(this.n); + + // Initialize our eventSource + this.eventSource = eventSource; + + // Configure our mappers + this.xMapper = function(obj) { + return self.timezoneMapper(obj.time).getDay(); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + // Simply divide by the number of milliseconds in a week + return Math.floor((time - start) / (1000 * 60 * 60 * 24 * 7.0)); + }; + + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("n-month", Timegrid.NMonthLayout); + +Timegrid.NMonthLayout.prototype.initializeGrid = function() { + this.startTime = this.eventSource.getEarliestDate() || new Date(); + this.dataStartTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + this.updateGrid(); +}; +Timegrid.NMonthLayout.prototype.updateGrid = function() { + this.computeDimensions(); + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var endpoints = Timegrid.NMonthLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(endpoints); + } + } +}; + +Timegrid.NMonthLayout.prototype.computeDimensions = function() { + this.startTime = this.computeStartTime(this.startTime); + + // Use a method to compute cell and y-labels (non-trivial). This method + // will also compute ySize based on n, an unfortunate grouping. + this.computeYSize(this.startTime); + this.computeLabels(this.startTime); + + this.endTime = this.computeEndTime(this.startTime); + + // Compute the cell sizes for the grid + this.computeCellSizes(); +}; + +Timegrid.NMonthLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + var labelContainer = doc.createElement("div"); + var colorContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + $(labelContainer).addClass("timegrid-month-labels"); + $(colorContainer).addClass("timegrid-month-colors"); + var i = 0; + var dates = this.cellLabels; + for (y = 0; y < this.ySize; y++) { + for (x = 0; x < this.xSize; x++) { + var endpoints = this.eventGrid.get(x,y); + var events = $.map(endpoints, function(e) { + return e.type == "start" ? e.event : null; + }); + var n = dates[i]; + var m = this.months[i]; + eventContainer.appendChild(this.renderEventList(events, x, y, + n, m)); + colorContainer.appendChild(this.renderCellColor(x, y, m)); + i++; + } + } + $(labelContainer).append($(this.renderMonthLabels())); + return $([eventContainer, labelContainer, colorContainer]); +}; + +Timegrid.NMonthLayout.prototype.renderEventList = function(evts, x, y, n, m) { + var jediv = $("
").addClass("timegrid-month-cell"); + var eList = $("
    ").addClass("timegrid-event-list"); + for (var i = 0; i < evts.length; i++) { + eList.append('
  • ' + evts[i].getText() + '
  • '); + } + jediv.append(eList); + jediv.append('' + n + ''); + jediv.css("height", this.yCell).css("width", this.xCell + "px"); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.NMonthLayout.prototype.renderCellColor = function(x, y, m) { + var jcdiv = $("
    ").addClass("timegrid-month-cell"); + jcdiv.addClass("timegrid-month-cell-" + (m % 2 ? "odd" : "even")); + jcdiv.css("height", this.yCell).css("width", this.xCell + "px"); + jcdiv.css("top", this.yCell * y); + jcdiv.css("left", this.xCell * x + "px"); + + if (this.now) { + var nowX = this.xMapper({ time: this.now }); + var nowY = this.yMapper({ time: this.now }); + if (x == nowX && y == nowY) { + jcdiv.addClass("timegrid-month-cell-now"); + } + } + + return jcdiv.get()[0]; + +}; + +Timegrid.NMonthLayout.prototype.renderMonthLabels = function() { + var self = this; + return $.map(this.monthStarts, function(monthStart) { + var monthString = monthStart.date.getMonthName(); + var mDiv = $('
    ' + monthString + '
    '); + mDiv.addClass('timegrid-month-label'); + mDiv.css('top', self.yCell * monthStart.i + "px"); + var height = monthStart.height * self.yCell; + mDiv.height(height + "px"); + mDiv.children().css('line-height', height + "px"); + return mDiv.get(0); + }); +}; + +Timegrid.NMonthLayout.prototype.highlightNow = function() { + var now = new Date(); + var x = this.xMapper({ time: now }); + var y = this.yMapper({ time: now }); +}; + +Timegrid.NMonthLayout.prototype.getXLabels = function() { + return Date.l10n.dayNames; +}; + +Timegrid.NMonthLayout.prototype.getYLabels = function() { + return this.yLabels; +}; + +Timegrid.NMonthLayout.prototype.goPrevious = function() { + this.dataStartTime.add('M', 0 - this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.goNext = function() { + this.dataStartTime.add('M', this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.getCurrent = function() { + var start = this.monthStarts[0].date; + var end = this.monthStarts[this.monthStarts.length - 1].date; + if (this.n > 1) { + return Timegrid.NMonthLayout.l10n.makeRange(start, end); + } else { + return Timegrid.NMonthLayout.l10n.makeRange(start); + } +}; + +Timegrid.NMonthLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.setDate(1); + startTime.setHours(0); + // Roll back to the first day on the grid + while (this.xMapper({ time: startTime }) > 0) { + startTime.setHours(-24); + } + return startTime; + } +}; + +Timegrid.NMonthLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.ySize * 7); + return endTime; + } + return false; +}; + +Timegrid.NMonthLayout.prototype.computeYSize = function(date) { + var gridStart = { time: new Date(date) }; + var month = this.dataStartTime.getMonth(); + this.ySize = 0; + this.monthStarts = [{ i: this.ySize, date: new Date(this.dataStartTime) }]; + while (this.xMapper(gridStart) > 0 && this.yMapper(gridStart) >= 0) { + gridStart.time.setHours(-24); + } + gridStart.time.add('d', 7); + for (; this.monthStarts.length <= this.n; gridStart.time.add('d', 7)) { + if (gridStart.time.getMonth() != month) { + month = gridStart.time.getMonth(); + var year = gridStart.time.getFullYear(); + this.monthStarts.push({i: this.ySize, date: new Date(gridStart.time)}); + var old = this.monthStarts[this.monthStarts.length - 2]; + old.height = this.ySize - old.i + 1; + } + this.ySize++; + } + this.monthStarts.pop(); +}; + +Timegrid.NMonthLayout.prototype.computeLabels = function(date) { + var gridStart = { time: new Date(date) }; + this.cellLabels = []; + this.months = []; + this.yLabels = []; + + // Iterate through and collect the tasty data + while (this.xMapper(gridStart) < this.xSize && + this.yMapper(gridStart) < this.ySize) { + var d = gridStart.time; + this.cellLabels.push(d.getDate()); + this.months.push(d.getMonth()); + if (d.getDay() == 0) { + this.yLabels.push(d.format(Timegrid.NMonthLayout.l10n.yLabelFormat)); + } + d.setHours(24); + } +}; + +Timegrid.NMonthLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/scripts/layouts/.svn/text-base/property.js.svn-base b/scripts/layouts/.svn/text-base/property.js.svn-base new file mode 100644 index 0000000..1488fcf --- /dev/null +++ b/scripts/layouts/.svn/text-base/property.js.svn-base @@ -0,0 +1,150 @@ +/** + * @name Timegrid.PropertyLayout + * @author masont + */ + +/** + * PropertyLayout is a subclass of Layout that provides Timegrid with layouts + * that place events into rows and columns based on arbitrary properties, in + * addition to temporal values (hour, day, week, etc.). + * + * @constructor + */ +Timegrid.PropertyLayout = function(eventSource, params) { + Timegrid.PropertyLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 0; + this.ySize = 0; + this.iterable = false; + this.title = Timegrid.PropertyLayout.l10n.makeTitle(); + this.property = "title"; + + this.xMapper = function(obj) { + return self.values.indexOf(obj.event.getProperty(self.property)); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + + this.eventSource = eventSource; + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("property", Timegrid.PropertyLayout); + +Timegrid.PropertyLayout.prototype.initializeGrid = function() { + this.startTime = new Date(this.eventSource.getEarliestDate()) || new Date(); + this.endTime = new Date(this.eventSource.getLatestDate()) || new Date(); + this.values = new DStructs.Array(); + this.updateGrid(); +}; + +Timegrid.PropertyLayout.prototype.updateGrid = function() { + this.computeDimensions(); + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var eps = Timegrid.PropertyLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(eps); + } + } +}; + +Timegrid.PropertyLayout.prototype.computeDimensions = function() { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + this.values.clear(); + while (iterator.hasNext()) { + this.values.push(iterator.next().getProperty(this.property)); + } + this.values = this.values.uniq(); + this.xSize = this.values.length; +}; + +Timegrid.PropertyLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (x = 0; x < this.xSize; x++) { + for (y = 0; y < this.ySize; y++) { + var endpoints = this.eventGrid.get(x,y).sort(function(a, b) { + return a.time - b.time; + }); + for (var i = 0; i < endpoints.length; i++) { + var endpoint = endpoints[i]; + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", this.xCell * x + newWidth * hIndex + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + } + } + return eventContainer; +}; + +Timegrid.PropertyLayout.prototype.renderEvent = function(evt, x, y) { + var jediv = this.mini ? $("
    ") : + $("
    " + evt.getText() + "
    "); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + jediv.addClass("timegrid-event"); + if (!this.mini) { + jediv.addClass('timegrid-rounded-shadow'); + } + jediv.css("height", this.yCell * length); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + if (evt.getColor()) { jediv.css('background-color', evt.getColor()); } + if (evt.getTextColor()) { jediv.css('color', evt.getTextColor()); } + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.PropertyLayout.prototype.getXLabels = function() { + return this.values; +}; + +Timegrid.PropertyLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); + } + return labels; +}; + +Timegrid.PropertyLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; diff --git a/scripts/layouts/.svn/text-base/weekly.js.svn-base b/scripts/layouts/.svn/text-base/weekly.js.svn-base new file mode 100644 index 0000000..71fc1b0 --- /dev/null +++ b/scripts/layouts/.svn/text-base/weekly.js.svn-base @@ -0,0 +1,40 @@ +/****************************************************************************** + * WeekLayout + * @fileoverview + * This is where the weekly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + + /** + * Constructs a WeekLayout object. + * @class WeekLayout is a subclass of Layout that implements a weekly event + * calendar, modeled off of the weekly view found in Google Calendar. + * @extends Timegrid.Layout + * @constructor + */ +Timegrid.WeekLayout = function(eventSource, params) { + params.n = 7; + params.title = params.title || Timegrid.WeekLayout.l10n.makeTitle(); + Timegrid.WeekLayout.superclass.call(this, eventSource, params); +}; +Timegrid.LayoutFactory.registerLayout("week", Timegrid.WeekLayout); +$.inherit(Timegrid.WeekLayout, Timegrid.NDayLayout); + +Timegrid.WeekLayout.prototype.computeStartTime = function(date) { + if (date) { + // We don't need to make sure it's the start of the week, once it's + // been set properly already. + var startTime = new Date(date); + startTime.add('d', 0 - this.n); + return startTime; + } else { + var startTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + var newStartTime = new Date(startTime); + newStartTime.clearTime().setDay(Date.l10n.firstDayOfWeek); + return newStartTime > startTime ? this.computeStartTime(newStartTime) : + newStartTime; + } +}; + diff --git a/scripts/layouts/layout.js b/scripts/layouts/layout.js new file mode 100644 index 0000000..41604af --- /dev/null +++ b/scripts/layouts/layout.js @@ -0,0 +1,385 @@ +/** + * @fileOverview + * This is where we define the entrypoint for all of the different default + * layouts that Timegrid is capable of, e.g. month, week, n-day, etc. Both + * LayoutFactory and the common Layout superclass are defined in this file. + * @author masont + */ + +/** + * Constructs a LayoutFactory object. + * + * @class LayoutFactory is a simple factory class that abstracts the process of + * selecting and instantiating Layout objects. + * @constructor + */ +Timegrid.LayoutFactory = function() {}; + +Timegrid.LayoutFactory._constructors = {}; + +/** + * Registers a layout class with this layout factory. Automatically places the + * given layout under the common Layout superclass, and binds the name string + * to the constructor. + * + * @param {String} name the name to bind to the given constructor + * @param {Function} constructor the constructor to a layout class + */ +Timegrid.LayoutFactory.registerLayout = function(name, constructor) { + $.inherit(constructor, Timegrid.Layout); + Timegrid.LayoutFactory._constructors[name] = constructor; +}; + +/** + * Instantiates a Timegrid layout with the given parameter hash. + * + * @param {String} name the name of the layout + * @param {EventSource} eventSource an EventSource object to layout and render + * @param params a hash of parameters to be passed into the desired layout + * @return {Timegrid.Layout} a Timegrid.Layout instance of the specified subclass + */ +Timegrid.LayoutFactory.createLayout = function(name, eventSource, params) { + var constructor = Timegrid.LayoutFactory._constructors[name]; + if (typeof constructor == 'function') { + layout = new constructor(eventSource, $.clone(params)); + return layout; + } else { + throw "No such layout!"; + }; + return; +}; + +/** + * Instantiates a Layout object. This constructor should always be overridden. + * + * @class Layout is the base class for all layouts that Timegrid supports. + * @constructor + * @param {EventSource} eventSource the eventSource to pull events from + * @param {Object} params a parameter hash + */ +Timegrid.Layout = function(eventSource, params) { + var self = this; + /** + * An object containing a parameter hash + * @type Object + */ + this.params = params; + /** + * The number of columns in the grid + * @type Number + */ + this.xSize = 0; + /** + * The number of rows in the grid + * @type Number + */ + this.ySize = 0; + /** + * A function to map date objects to a custom timezone + * @type Function + */ + this.timezoneMapper = function(date) { + if (typeof self.timezoneoffset != "undefined") { + return date.toTimezone(self.timezoneoffset); + } + return date; + }; + /** + * A function to map endpoints to an integer x-coordinate + * @type Function + */ + this.xMapper = function(obj) { return self.timezoneMapper(obj.time); }; + /** + * A function to map endpoints to an integer y-coordinate + * @type Function + */ + this.yMapper = function(obj) { return self.timezoneMapper(obj.time); }; + /** + * The height of the horizontal labels in pixels + * @type Number + */ + this.xLabelHeight = 24; + /** + * The width of the vertical labels in pixels + * @type Number + */ + this.yLabelWidth = 48; + /** + * The height of the tabs that page between views in pixels + * @type Number + */ + this.tabHeight = 18; +}; + +/** + * Takes a parameter hash and extends this layout with it, flattening key names + * to lowercase as it goes. This is done to eliminate browser-specific + * attribute case sensitivity. + * + * @param {Object} params a parameter hash + */ +Timegrid.Layout.prototype.configure = function(params) { + for (var attr in params) { + this[attr] = params[attr.toLowerCase()]; + } +}; + +/** + * Computes the grid dimensions (gridheight, gridwidth, ycell, xcell) for this + * layout. This is relatively complex since any of the above values can be + * either user-specified or computed. + */ +Timegrid.Layout.prototype.computeCellSizes = function() { + // Compute the cell sizes for the grid + this.xCell = this.params.xCell || this.params.xcell || + (this.gridwidth - 1) / this.xSize; + this.yCell = this.params.yCell || this.params.ycell || + (this.gridheight - 1) / this.ySize; + if (this.params.yCell || this.params.ycell) { + this.gridheight = this.yCell * this.ySize; + } + if (this.params.xCell || this.params.xcell) { + this.gridwidth = this.xCell * this.xSize; + } +}; + +/** + * Renders out this layout into a DOM object with a wrapping div element as its + * parent, returning the div. + * + * @param {Element} container the parent element + * @return {Element} a rendered DOM tree descended from a div element + */ +Timegrid.Layout.prototype.render = function(container) { + if (this.mini) { + this.scrollwidth = 0; + this.tabHeight = 0; + this.xLabelHeight = 24; + this.yLabelWidth = 24; + } + if (!(this.params.height && this.params.gridheight)) { + this.scrollwidth = 0; + } + if (container) { + this._container = container; + this._viewDiv = $("
    ").addClass('timegrid-view') + .css('top', this.tabHeight + "px"); + $(this._container).append(this._viewDiv); + } else { + this._viewDiv.empty(); + } + var gridDiv = $('
    ').addClass('timegrid-grid'); + var gridWindowDiv = $('
    ').addClass('timegrid-grid-window'); + if (!this.scrollwidth) { gridWindowDiv.css('overflow', 'visible'); } + + if (!this.params.height) { + this.height = this._container.style.height ? + $(this._container).height() : 3 + this.scrollwidth + this.tabHeight + + this.xLabelHeight + + (this.gridheight || 500); + } + $(this._container).height(this.height + "px"); + if (!this.params.width) { + this.width = this.params.gridwidth || $(this._container).width(); + } else { + $(this._container).width(this.width + "px"); + } + $(this._container).css('position', 'relative'); + this._viewDiv.height(this.height - this.tabHeight + "px"); + + gridWindowDiv.css("top", this.xLabelHeight).css("left", this.yLabelWidth) + .css("right", "0px").css("bottom", "0px"); + this._viewDiv.append(gridWindowDiv.append(gridDiv)); + + var windowHeight = this._viewDiv.height() - gridWindowDiv.position().top - 2; + var windowWidth = this._viewDiv.width() - gridWindowDiv.position().left - 2; + gridWindowDiv.height(windowHeight).width(windowWidth); + + this.gridwidth = this.gridwidth || gridWindowDiv.width() - this.scrollwidth; + this.gridheight = this.gridheight || gridWindowDiv.height() - this.scrollwidth; + gridDiv.height(this.gridheight + "px").width(this.gridwidth + "px"); + this.computeCellSizes(); + this._gridDiv = gridDiv; + gridDiv.append(this.renderEvents(document)); + gridDiv.append(this.renderGridlines(document)); + var xLabels = this.renderXLabels(); + var yLabels = this.renderYLabels(); + var syncHorizontalScroll = function(a, b) { + $(a).scroll(function() { b.scrollLeft = a.scrollLeft; }); + $(b).scroll(function() { a.scrollLeft = b.scrollLeft; }); + }; + var syncVerticalScroll = function(a, b) { + $(a).scroll(function() { b.scrollTop = a.scrollTop; }); + $(b).scroll(function() { a.scrollTop = b.scrollTop; }); + }; + syncVerticalScroll(yLabels, gridWindowDiv.get(0)); + syncHorizontalScroll(xLabels, gridWindowDiv.get(0)); + this._viewDiv.append(xLabels).append(yLabels); + + if (!this.mini) { + if ($.browser.msie) { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,0,0,1); + } else { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,7,1,0.7); + } + } + + return this._viewDiv.get(0); +}; + +Timegrid.Layout.prototype.renderChanged = function() { + this.initializeGrid(); + this._gridDiv.empty(); + this._gridDiv.append(this.renderEvents(document)); + this._gridDiv.append(this.renderGridlines(document)); + this.renderXLabels(); + this.renderYLabels(); + if (!this.mini) { + if ($.browser.msie) { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,0,0,1); + } else { + $('.timegrid-view:visible .timegrid-rounded-shadow', + this._container).prettybox(4,7,1,0.7); + } + } +}; + +/** + * An abstract method to render events for this layout. This method is where + * specific layout implementations hook into the main rendering loop. While + * generally used to render events, this method can return any valid input to + * the jQuery append method, which is then appended under the grid + * div element. + * + * @function + * @param {Document} doc the document to create elements from + * @return {Content} any valid argument to jQuery's append, to be appended under + * the grid div + */ +Timegrid.Layout.prototype.renderEvents = Timegrid.abstract("renderEvents"); + +/** + * Renders the gridlines for this layout. Gridlines are represented in the DOM + * as absolutely positioned div elements with one dimension set to + * one pixel. + * + * @return {Element} a DOM element containing this layout's gridlines + */ +Timegrid.Layout.prototype.renderGridlines = function() { + var gridlineContainer = document.createElement("div"); + gridlineContainer.className = 'timegrid-gridlines'; + + for (var x = 0; x < this.xSize; x++) { // Vertical lines + var vlineDiv = document.createElement('div'); + vlineDiv.className = 'timegrid-vline'; + vlineDiv.style.height = this.gridheight + "px"; + vlineDiv.style.left = x * this.xCell + "px"; + gridlineContainer.appendChild(vlineDiv); + } + for (var y = 0; y <= this.ySize; y++) { // Horizontal lines + var hlineDiv = document.createElement('div'); + hlineDiv.className = 'timegrid-hline'; + hlineDiv.style.width = "100%"; + hlineDiv.style.top = y * this.yCell + "px"; + gridlineContainer.appendChild(hlineDiv); + } + return gridlineContainer; +}; + +/** + * Renders the horizontal column labels that run above the grid. The labels + * themselves are provided by the implementing layout subclasses by + * getXLabels() + * + * @return {Element} a DOM element containing the horizontal labels + */ +Timegrid.Layout.prototype.renderXLabels = function() { + this._xLabelContainer = this._xLabelContainer || + document.createElement("div"); + var xLabelContainer = this._xLabelContainer; + xLabelContainer.innerHTML = ""; + xLabelContainer.className = 'timegrid-xlabels-window'; + xLabelContainer.style.height = this.xLabelHeight + "px"; + xLabelContainer.style.width = this.width - this.yLabelWidth - + this.scrollwidth - 2 + "px"; + xLabelContainer.style.left = this.yLabelWidth - 1 + "px"; + + var xLabelsDiv = document.createElement("div"); + xLabelsDiv.className = 'timegrid-xlabels'; + xLabelsDiv.style.height = this.xLabelHeight + "px" + xLabelsDiv.style.width = this.gridwidth + "px"; + xLabelsDiv.style.top = "0px"; + xLabelContainer.appendChild(xLabelsDiv); + + var labels = this.getXLabels(); + for (var i = 0; i < labels.length; i++) { + var label = document.createElement("div"); + label.className = 'timegrid-label'; + label.innerHTML = labels[i]; + label.style.width = this.xCell + 'px'; + label.style.left = (i * this.xCell) + 'px'; + xLabelsDiv.appendChild(label); + } + return xLabelContainer; +}; + +/** + * Renders the vertical row labels that run along the side of the grid. The + * labels themselves are provided by the implementing layout subclasses by + * getYLabels() + * + * @return {Element} a DOM element containing the vertical labels + */ +Timegrid.Layout.prototype.renderYLabels = function() { + this._yLabelContainer = this._yLabelContainer || + document.createElement("div"); + var yLabelContainer = this._yLabelContainer; + yLabelContainer.innerHTML = ""; + yLabelContainer.className = 'timegrid-ylabels-window'; + yLabelContainer.style.width = this.yLabelWidth + "px"; + yLabelContainer.style.height = this.height - this.xLabelHeight - + this.scrollwidth - this.tabHeight - 2 + "px"; + yLabelContainer.style.top = this.xLabelHeight - 1 + "px"; + + var yLabelsDiv = document.createElement("div"); + yLabelsDiv.className = 'timegrid-ylabels'; + yLabelsDiv.style.height = this.gridheight + "px"; + yLabelsDiv.style.width = this.yLabelWidth + "px"; + yLabelsDiv.style.left = "0px"; + yLabelContainer.appendChild(yLabelsDiv); + + var labels = this.getYLabels(); + var labelDivs = []; + for (var i = 0; i < labels.length; i++) { + var label = document.createElement('div'); + label.className = 'timegrid-label'; + label.innerHTML = labels[i]; + label.style.height = this.yCell + 'px'; + label.style.top = i * this.yCell + 'px'; + + yLabelsDiv.appendChild(label); + } + + return yLabelContainer; +}; + +/** + * An abstract method to get the horizontal column labels for this layout. This + * method must be implemented by all layout types subclassing Layout. + * + * @function + * @return {Array} an array of strings to use as column labels + */ +Timegrid.Layout.prototype.getXLabels = Timegrid.abstract("getXLabels"); + +/** + * An abstract method to get the vertical row labels for this layout. This + * method must be implemented by all layout types subclassing Layout. + * + * @function + * @return {Array} an array of strings to use as row labels + */ +Timegrid.Layout.prototype.getYLabels = Timegrid.abstract("getYLabels"); diff --git a/scripts/layouts/monthly.js b/scripts/layouts/monthly.js new file mode 100644 index 0000000..a56b785 --- /dev/null +++ b/scripts/layouts/monthly.js @@ -0,0 +1,16 @@ +/****************************************************************************** + * MonthLayout + * @fileoverview + * This is where the monthly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + +Timegrid.MonthLayout = function(eventSource, params) { + params.n = 1; + params.title = params.title || Timegrid.MonthLayout.l10n.makeTitle(); + Timegrid.MonthLayout.superclass.call(this, eventSource, params); +}; +Timegrid.LayoutFactory.registerLayout("month", Timegrid.MonthLayout); +$.inherit(Timegrid.MonthLayout, Timegrid.NMonthLayout); + diff --git a/scripts/layouts/nday.js b/scripts/layouts/nday.js new file mode 100644 index 0000000..bf68f9e --- /dev/null +++ b/scripts/layouts/nday.js @@ -0,0 +1,242 @@ +/****************************************************************************** + * NDayLayout + * @fileoverview + * This is where the n-day layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + + /** + * Constructs an NDayLayout object. + * @class NDayLayout is a subclass of Layout that implements an n-day event + * calendar, modeled off of the weekly view found in Google Calendar. + * @extends Timegrid.Layout + * @constructor + */ +Timegrid.NDayLayout = function(eventSource, params) { + Timegrid.NDayLayout.superclass.call(this, eventSource, params); + var self = this; + + // Specifications for a week layout + this.xSize = 7; + this.ySize = 24; + this.iterable = true; + + // These are default values that can be overridden in configure + this.n = 3; + + this.xMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + var ivl = new SimileAjax.DateTime.Interval(time - start); + return ivl.days; + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); + this.xSize = this.n; + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + this.computeCellSizes(); + + this.eventSource = eventSource; + this.initializeGrid(eventSource); +}; +Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); + +Timegrid.NDayLayout.prototype.initializeGrid = function() { + this.startTime = this.computeStartTime(); + this.startTime.setHours(0); + this.endTime = this.computeEndTime(this.startTime); + + this.updateGrid(); +}; + +Timegrid.NDayLayout.prototype.updateGrid = function() { + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + + this.endpoints = []; + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); + this.endpoints.push(ends[0]); + this.endpoints.push(ends[1]); + } + } + this.endpoints.sort(function(a, b) { + var diff = a.time - b.time; + if (!diff) { + return a.type == "start" ? 1 : -1; + } else { + return diff; + } + }); +}; + +Timegrid.NDayLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (var i = 0; i < this.endpoints.length; i++) { + var endpoint = this.endpoints[i]; + var x = this.xMapper(endpoint); + var y = this.yMapper(endpoint); + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (var id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + var newLeft = this.xCell * x + newWidth * hIndex; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", newLeft + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + var nowDiv = this.renderNow(); + if (nowDiv) { + return $([eventContainer, nowDiv]); + } else { + return eventContainer; + } +}; + +Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { + var ediv = document.createElement('div'); + var tediv = document.createElement('div'); + if (!this.mini) { tediv.innerHTML = evt.getText(); } + ediv.appendChild(tediv); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + var className = "timegrid-event"; + if (!this.mini) { + className += ' timegrid-rounded-shadow'; + } + ediv.className = className; + ediv.style.height = this.yCell * length + "px"; + ediv.style.top = this.yCell * y + "px"; + ediv.style.left = this.xCell * x + 'px'; + if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } + if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } + return ediv; // Return the actual DOM element +}; + +Timegrid.NDayLayout.prototype.renderNow = function() { + // If we aren't looking at the current time, return + if (!this.now) { return; } + + var nowX = this.xMapper({ time: this.now }); + var nowY = Math.floor(this.yMapper({ time: this.now })); + + var rectDiv = $('
    ').addClass('timegrid-week-highlights'); + var yRect = $('
    ').height(this.yCell + "px") + .width(this.xCell * this.xSize + "px") + .css('top', nowY * this.yCell + "px") + .addClass('timegrid-week-highlight'); + var xRect = $('
    ').height(this.yCell * this.ySize + "px") + .width(this.xCell + "px") + .css('left', nowX * this.xCell + "px") + .addClass('timegrid-week-highlight'); + rectDiv.append(xRect).append(yRect); + return rectDiv.get(0); +}; + +Timegrid.NDayLayout.prototype.getXLabels = function() { + var date = new Date(this.startTime); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : + Timegrid.NDayLayout.l10n.xLabelFormat; + while (date < this.endTime) { + labels.push(date.format(format)); + date.setHours(24); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : + Timegrid.NDayLayout.l10n.yLabelFormat; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(format)); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.goPrevious = function() { + this.endTime = this.startTime; + this.startTime = this.computeStartTime(this.endTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.goNext = function() { + this.startTime = this.endTime; + this.endTime = this.computeEndTime(this.startTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.getCurrent = function() { + this.endTime.add('s', -1); + var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, + this.endTime); + this.endTime.add('s', 1); + return result; +}; + +Timegrid.NDayLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.add('d', 0 - this.n); + startTime.setHours(0); + return startTime; + } else { + var startTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + startTime.clearTime(); + return startTime; + } +}; + +Timegrid.NDayLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.n); + endTime.setHours(0); + return endTime; + } + return false; +}; + +Timegrid.NDayLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/scripts/layouts/nmonth.js b/scripts/layouts/nmonth.js new file mode 100644 index 0000000..074581f --- /dev/null +++ b/scripts/layouts/nmonth.js @@ -0,0 +1,259 @@ +/** + * NMonthLayout + * @fileoverview + * This is where the monthly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + */ + +Timegrid.NMonthLayout = function(eventSource, params) { + Timegrid.NMonthLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 7; + this.ySize = 0; // This is re-calculated later based on n + this.n = 3; + this.iterable = true; + + this.configure(params); + // We put title here because it depends on this.n + this.title = this.title || Timegrid.NMonthLayout.l10n.makeTitle(this.n); + + // Initialize our eventSource + this.eventSource = eventSource; + + // Configure our mappers + this.xMapper = function(obj) { + return self.timezoneMapper(obj.time).getDay(); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + // Simply divide by the number of milliseconds in a week + return Math.floor((time - start) / (1000 * 60 * 60 * 24 * 7.0)); + }; + + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("n-month", Timegrid.NMonthLayout); + +Timegrid.NMonthLayout.prototype.initializeGrid = function() { + this.startTime = this.eventSource.getEarliestDate() || new Date(); + this.dataStartTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + this.updateGrid(); +}; +Timegrid.NMonthLayout.prototype.updateGrid = function() { + this.computeDimensions(); + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var endpoints = Timegrid.NMonthLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(endpoints); + } + } +}; + +Timegrid.NMonthLayout.prototype.computeDimensions = function() { + this.startTime = this.computeStartTime(this.startTime); + + // Use a method to compute cell and y-labels (non-trivial). This method + // will also compute ySize based on n, an unfortunate grouping. + this.computeYSize(this.startTime); + this.computeLabels(this.startTime); + + this.endTime = this.computeEndTime(this.startTime); + + // Compute the cell sizes for the grid + this.computeCellSizes(); +}; + +Timegrid.NMonthLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + var labelContainer = doc.createElement("div"); + var colorContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + $(labelContainer).addClass("timegrid-month-labels"); + $(colorContainer).addClass("timegrid-month-colors"); + var i = 0; + var dates = this.cellLabels; + for (y = 0; y < this.ySize; y++) { + for (x = 0; x < this.xSize; x++) { + var endpoints = this.eventGrid.get(x,y); + var events = $.map(endpoints, function(e) { + return e.type == "start" ? e.event : null; + }); + var n = dates[i]; + var m = this.months[i]; + eventContainer.appendChild(this.renderEventList(events, x, y, + n, m)); + colorContainer.appendChild(this.renderCellColor(x, y, m)); + i++; + } + } + $(labelContainer).append($(this.renderMonthLabels())); + return $([eventContainer, labelContainer, colorContainer]); +}; + +Timegrid.NMonthLayout.prototype.renderEventList = function(evts, x, y, n, m) { + var jediv = $("
    ").addClass("timegrid-month-cell"); + var eList = $("
      ").addClass("timegrid-event-list"); + for (var i = 0; i < evts.length; i++) { + eList.append('
    • ' + evts[i].getText() + '
    • '); + } + jediv.append(eList); + jediv.append('' + n + ''); + jediv.css("height", this.yCell).css("width", this.xCell + "px"); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.NMonthLayout.prototype.renderCellColor = function(x, y, m) { + var jcdiv = $("
      ").addClass("timegrid-month-cell"); + jcdiv.addClass("timegrid-month-cell-" + (m % 2 ? "odd" : "even")); + jcdiv.css("height", this.yCell).css("width", this.xCell + "px"); + jcdiv.css("top", this.yCell * y); + jcdiv.css("left", this.xCell * x + "px"); + + if (this.now) { + var nowX = this.xMapper({ time: this.now }); + var nowY = this.yMapper({ time: this.now }); + if (x == nowX && y == nowY) { + jcdiv.addClass("timegrid-month-cell-now"); + } + } + + return jcdiv.get()[0]; + +}; + +Timegrid.NMonthLayout.prototype.renderMonthLabels = function() { + var self = this; + return $.map(this.monthStarts, function(monthStart) { + var monthString = monthStart.date.getMonthName(); + var mDiv = $('
      ' + monthString + '
      '); + mDiv.addClass('timegrid-month-label'); + mDiv.css('top', self.yCell * monthStart.i + "px"); + var height = monthStart.height * self.yCell; + mDiv.height(height + "px"); + mDiv.children().css('line-height', height + "px"); + return mDiv.get(0); + }); +}; + +Timegrid.NMonthLayout.prototype.highlightNow = function() { + var now = new Date(); + var x = this.xMapper({ time: now }); + var y = this.yMapper({ time: now }); +}; + +Timegrid.NMonthLayout.prototype.getXLabels = function() { + return Date.l10n.dayNames; +}; + +Timegrid.NMonthLayout.prototype.getYLabels = function() { + return this.yLabels; +}; + +Timegrid.NMonthLayout.prototype.goPrevious = function() { + this.dataStartTime.add('M', 0 - this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.goNext = function() { + this.dataStartTime.add('M', this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.getCurrent = function() { + var start = this.monthStarts[0].date; + var end = this.monthStarts[this.monthStarts.length - 1].date; + if (this.n > 1) { + return Timegrid.NMonthLayout.l10n.makeRange(start, end); + } else { + return Timegrid.NMonthLayout.l10n.makeRange(start); + } +}; + +Timegrid.NMonthLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.setDate(1); + startTime.setHours(0); + // Roll back to the first day on the grid + while (this.xMapper({ time: startTime }) > 0) { + startTime.setHours(-24); + } + return startTime; + } +}; + +Timegrid.NMonthLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.ySize * 7); + return endTime; + } + return false; +}; + +Timegrid.NMonthLayout.prototype.computeYSize = function(date) { + var gridStart = { time: new Date(date) }; + var month = this.dataStartTime.getMonth(); + this.ySize = 0; + this.monthStarts = [{ i: this.ySize, date: new Date(this.dataStartTime) }]; + while (this.xMapper(gridStart) > 0 && this.yMapper(gridStart) >= 0) { + gridStart.time.setHours(-24); + } + gridStart.time.add('d', 7); + for (; this.monthStarts.length <= this.n; gridStart.time.add('d', 7)) { + if (gridStart.time.getMonth() != month) { + month = gridStart.time.getMonth(); + var year = gridStart.time.getFullYear(); + this.monthStarts.push({i: this.ySize, date: new Date(gridStart.time)}); + var old = this.monthStarts[this.monthStarts.length - 2]; + old.height = this.ySize - old.i + 1; + } + this.ySize++; + } + this.monthStarts.pop(); +}; + +Timegrid.NMonthLayout.prototype.computeLabels = function(date) { + var gridStart = { time: new Date(date) }; + this.cellLabels = []; + this.months = []; + this.yLabels = []; + + // Iterate through and collect the tasty data + while (this.xMapper(gridStart) < this.xSize && + this.yMapper(gridStart) < this.ySize) { + var d = gridStart.time; + this.cellLabels.push(d.getDate()); + this.months.push(d.getMonth()); + if (d.getDay() == 0) { + this.yLabels.push(d.format(Timegrid.NMonthLayout.l10n.yLabelFormat)); + } + d.setHours(24); + } +}; + +Timegrid.NMonthLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/scripts/layouts/property.js b/scripts/layouts/property.js new file mode 100644 index 0000000..72307b8 --- /dev/null +++ b/scripts/layouts/property.js @@ -0,0 +1,150 @@ +/** + * @name Timegrid.PropertyLayout + * @author masont + */ + +/** + * PropertyLayout is a subclass of Layout that provides Timegrid with layouts + * that place events into rows and columns based on arbitrary properties, in + * addition to temporal values (hour, day, week, etc.). + * + * @constructor + */ +Timegrid.PropertyLayout = function(eventSource, params) { + Timegrid.PropertyLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 0; + this.ySize = 0; + this.iterable = false; + this.title = Timegrid.PropertyLayout.l10n.makeTitle(); + this.property = "title"; + + this.xMapper = function(obj) { + return self.values.indexOf(obj.event.getProperty(self.property)); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + + this.eventSource = eventSource; + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("property", Timegrid.PropertyLayout); + +Timegrid.PropertyLayout.prototype.initializeGrid = function() { + this.startTime = new Date(this.eventSource.getEarliestDate()) || new Date(); + this.endTime = new Date(this.eventSource.getLatestDate()) || new Date(); + this.values = new DStructs.Array(); + this.updateGrid(); +}; + +Timegrid.PropertyLayout.prototype.updateGrid = function() { + this.computeDimensions(); + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var eps = Timegrid.PropertyLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(eps); + } + } +}; + +Timegrid.PropertyLayout.prototype.computeDimensions = function() { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + this.values.clear(); + while (iterator.hasNext()) { + this.values.push(iterator.next().getProperty(this.property)); + } + this.values = this.values.uniq(); + this.xSize = this.values.length; +}; + +Timegrid.PropertyLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (x = 0; x < this.xSize; x++) { + for (y = 0; y < this.ySize; y++) { + var endpoints = this.eventGrid.get(x,y).sort(function(a, b) { + return a.time - b.time; + }); + for (var i = 0; i < endpoints.length; i++) { + var endpoint = endpoints[i]; + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", this.xCell * x + newWidth * hIndex + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + } + } + return eventContainer; +}; + +Timegrid.PropertyLayout.prototype.renderEvent = function(evt, x, y) { + var jediv = this.mini ? $("
      ") : + $("
      " + evt.getText() + "
      "); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + jediv.addClass("timegrid-event"); + if (!this.mini) { + jediv.addClass('timegrid-rounded-shadow'); + } + jediv.css("height", this.yCell * length); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + if (evt.getColor()) { jediv.css('background-color', evt.getColor()); } + if (evt.getTextColor()) { jediv.css('color', evt.getTextColor()); } + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.PropertyLayout.prototype.getXLabels = function() { + return this.values; +}; + +Timegrid.PropertyLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); + } + return labels; +}; + +Timegrid.PropertyLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; diff --git a/scripts/layouts/weekly.js b/scripts/layouts/weekly.js new file mode 100644 index 0000000..71fc1b0 --- /dev/null +++ b/scripts/layouts/weekly.js @@ -0,0 +1,40 @@ +/****************************************************************************** + * WeekLayout + * @fileoverview + * This is where the weekly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + + /** + * Constructs a WeekLayout object. + * @class WeekLayout is a subclass of Layout that implements a weekly event + * calendar, modeled off of the weekly view found in Google Calendar. + * @extends Timegrid.Layout + * @constructor + */ +Timegrid.WeekLayout = function(eventSource, params) { + params.n = 7; + params.title = params.title || Timegrid.WeekLayout.l10n.makeTitle(); + Timegrid.WeekLayout.superclass.call(this, eventSource, params); +}; +Timegrid.LayoutFactory.registerLayout("week", Timegrid.WeekLayout); +$.inherit(Timegrid.WeekLayout, Timegrid.NDayLayout); + +Timegrid.WeekLayout.prototype.computeStartTime = function(date) { + if (date) { + // We don't need to make sure it's the start of the week, once it's + // been set properly already. + var startTime = new Date(date); + startTime.add('d', 0 - this.n); + return startTime; + } else { + var startTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + var newStartTime = new Date(startTime); + newStartTime.clearTime().setDay(Date.l10n.firstDayOfWeek); + return newStartTime > startTime ? this.computeStartTime(newStartTime) : + newStartTime; + } +}; + diff --git a/scripts/listeners.js b/scripts/listeners.js new file mode 100644 index 0000000..0c63df8 --- /dev/null +++ b/scripts/listeners.js @@ -0,0 +1,29 @@ +Timegrid.ListenerAware = function() { + this._listeners = []; +}; + +Timegrid.ListenerAware.prototype.addListener = function(listener) { + this._listeners.push(listener); +}; + +Timegrid.ListenerAware.prototype.removeListener = function(listener) { + for (var i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] == listener) { + this._listeners.splice(i, 1); + break; + } + } +}; + +Timegrid.ListenerAware.prototype._fire = function(handlerName, args) { + for (var i = 0; i < this._listeners.length; i++) { + var listener = this._listeners[i]; + if (handlerName in listener) { + try { + listener[handlerName].apply(listener, args); + } catch (e) { + Timegrid.Debug.exception(e); + } + } + } +}; \ No newline at end of file diff --git a/scripts/sources/.svn/all-wcprops b/scripts/sources/.svn/all-wcprops new file mode 100644 index 0000000..743af4e --- /dev/null +++ b/scripts/sources/.svn/all-wcprops @@ -0,0 +1,17 @@ +K 25 +svn:wc:ra_dav:version-url +V 81 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/sources +END +default.js +K 25 +svn:wc:ra_dav:version-url +V 92 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/sources/default.js +END +recurring.js +K 25 +svn:wc:ra_dav:version-url +V 94 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/sources/recurring.js +END diff --git a/scripts/sources/.svn/entries b/scripts/sources/.svn/entries new file mode 100644 index 0000000..9f353bd --- /dev/null +++ b/scripts/sources/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts/sources +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +default.js +file + + + + +2012-02-03T21:55:33.000000Z +a69def8d143a9e51ce94b5784366cb1b +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +14834 + +recurring.js +file + + + + +2012-02-03T21:55:33.000000Z +460ad29cbc9225cd8be407345b96169c +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +4918 + diff --git a/scripts/sources/.svn/text-base/default.js.svn-base b/scripts/sources/.svn/text-base/default.js.svn-base new file mode 100644 index 0000000..8192a45 --- /dev/null +++ b/scripts/sources/.svn/text-base/default.js.svn-base @@ -0,0 +1,407 @@ +/****************************************************************************** + * Default Event Source + *****************************************************************************/ + + +Timegrid.DefaultEventSource = function(eventIndex) { + Timegrid.DefaultEventSource.superclass.call(this); + this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex(); +}; +$.inherit(Timegrid.DefaultEventSource, Timegrid.ListenerAware); + +Timegrid.DefaultEventSource.prototype.loadXML = function(xml, url) { + var base = this._getBaseURL(url); + + var wikiURL = xml.documentElement.getAttribute("wiki-url"); + var wikiSection = xml.documentElement.getAttribute("wiki-section"); + + var dateTimeFormat = xml.documentElement.getAttribute("date-time-format"); + var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); + + var node = xml.documentElement.firstChild; + var added = false; + while (node != null) { + if (node.nodeType == 1) { + var description = ""; + if (node.firstChild != null && node.firstChild.nodeType == 3) { + description = node.firstChild.nodeValue; + } + var evt = new Timegrid.DefaultEventSource.Event( + parseDateTimeFunction(node.getAttribute("start")), + parseDateTimeFunction(node.getAttribute("end")), + parseDateTimeFunction(node.getAttribute("latestStart")), + parseDateTimeFunction(node.getAttribute("earliestEnd")), + node.getAttribute("isDuration") != "true", + node.getAttribute("title"), + description, + this._resolveRelativeURL(node.getAttribute("image"), base), + this._resolveRelativeURL(node.getAttribute("link"), base), + this._resolveRelativeURL(node.getAttribute("icon"), base), + node.getAttribute("color"), + node.getAttribute("textColor") + ); + evt._node = node; + evt.getProperty = function(name) { + return this._node.getAttribute(name); + }; + evt.setWikiInfo(wikiURL, wikiSection); + + this._events.add(evt); + + added = true; + } + node = node.nextSibling; + } + + if (added) { + this._fire("onAddMany", []); + } +}; + + +Timegrid.DefaultEventSource.prototype.loadJSON = function(data, url) { + var base = this._getBaseURL(url); + var added = false; + if (data && data.events){ + var wikiURL = ("wikiURL" in data) ? data.wikiURL : null; + var wikiSection = ("wikiSection" in data) ? data.wikiSection : null; + + var dateTimeFormat = ("dateTimeFormat" in data) ? data.dateTimeFormat : null; + var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); + + for (var i=0; i < data.events.length; i++){ + var event = data.events[i]; + if (!(event.start || event.end || + event.latestStart || event.earliestEnd)) { + continue; + } + var evt = new Timegrid.DefaultEventSource.Event( + parseDateTimeFunction(event.start), + parseDateTimeFunction(event.end), + parseDateTimeFunction(event.latestStart), + parseDateTimeFunction(event.earliestEnd), + event.isDuration || false, + event.title, + event.description, + this._resolveRelativeURL(event.image, base), + this._resolveRelativeURL(event.link, base), + this._resolveRelativeURL(event.icon, base), + event.color, + event.textColor + ); + evt._obj = event; + evt.getProperty = function(name) { + return this._obj[name]; + }; + evt.setWikiInfo(wikiURL, wikiSection); + this._events.add(evt); + added = true; + } + } + if (added) { + this._fire("onAddMany", []); + } +}; + +/* + * Contributed by Morten Frederiksen, http://www.wasab.dk/morten/ + */ +Timegrid.DefaultEventSource.prototype.loadSPARQL = function(xml, url) { + var base = this._getBaseURL(url); + + var dateTimeFormat = 'iso8601'; + var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); + + if (xml == null) { + return; + } + + /* + * Find tag + */ + var node = xml.documentElement.firstChild; + while (node != null && (node.nodeType != 1 || node.nodeName != 'results')) { + node = node.nextSibling; + } + + var wikiURL = null; + var wikiSection = null; + if (node != null) { + wikiURL = node.getAttribute("wiki-url"); + wikiSection = node.getAttribute("wiki-section"); + + node = node.firstChild; + } + + var added = false; + while (node != null) { + if (node.nodeType == 1) { + var bindings = { }; + var binding = node.firstChild; + while (binding != null) { + if (binding.nodeType == 1 && + binding.firstChild != null && + binding.firstChild.nodeType == 1 && + binding.firstChild.firstChild != null && + binding.firstChild.firstChild.nodeType == 3) { + bindings[binding.getAttribute('name')] = binding.firstChild.firstChild.nodeValue; + } + binding = binding.nextSibling; + } + + if (bindings["start"] == null && bindings["date"] != null) { + bindings["start"] = bindings["date"]; + } + + var evt = new Timegrid.DefaultEventSource.Event( + parseDateTimeFunction(bindings["start"]), + parseDateTimeFunction(bindings["end"]), + parseDateTimeFunction(bindings["latestStart"]), + parseDateTimeFunction(bindings["earliestEnd"]), + bindings["isDuration"] != "true", + bindings["title"], + bindings["description"], + this._resolveRelativeURL(bindings["image"], base), + this._resolveRelativeURL(bindings["link"], base), + this._resolveRelativeURL(bindings["icon"], base), + bindings["color"], + bindings["textColor"] + ); + evt._bindings = bindings; + evt.getProperty = function(name) { + return this._bindings[name]; + }; + evt.setWikiInfo(wikiURL, wikiSection); + + this._events.add(evt); + added = true; + } + node = node.nextSibling; + } + + if (added) { + this._fire("onAddMany", []); + } +}; + +Timegrid.DefaultEventSource.prototype.add = function(evt) { + this._events.add(evt); + this._fire("onAddOne", [evt]); +}; + +Timegrid.DefaultEventSource.prototype.addMany = function(events) { + for (var i = 0; i < events.length; i++) { + this._events.add(events[i]); + } + this._fire("onAddMany", []); +}; + +Timegrid.DefaultEventSource.prototype.clear = function() { + this._events.removeAll(); + this._fire("onClear", []); +}; + +Timegrid.DefaultEventSource.prototype.getEventIterator = function(startDate, endDate) { + return this._events.getIterator(startDate, endDate); +}; + +Timegrid.DefaultEventSource.prototype.getAllEventIterator = function() { + return this._events.getAllIterator(); +}; + +Timegrid.DefaultEventSource.prototype.getCount = function() { + return this._events.getCount(); +}; + +Timegrid.DefaultEventSource.prototype.getEarliestDate = function() { + return this._events.getEarliestDate(); +}; + +Timegrid.DefaultEventSource.prototype.getLatestDate = function() { + return this._events.getLatestDate(); +}; + +Timegrid.DefaultEventSource.prototype._getBaseURL = function(url) { + if (url.indexOf("://") < 0) { + var url2 = this._getBaseURL(document.location.href); + if (url.substr(0,1) == "/") { + url = url2.substr(0, url2.indexOf("/", url2.indexOf("://") + 3)) + url; + } else { + url = url2 + url; + } + } + + var i = url.lastIndexOf("/"); + if (i < 0) { + return ""; + } else { + return url.substr(0, i+1); + } +}; + +Timegrid.DefaultEventSource.prototype._resolveRelativeURL = function(url, base) { + if (url == null || url == "") { + return url; + } else if (url.indexOf("://") > 0) { + return url; + } else if (url.substr(0,1) == "/") { + return base.substr(0, base.indexOf("/", base.indexOf("://") + 3)) + url; + } else { + return base + url; + } +}; + + +Timegrid.DefaultEventSource.Event = function( + start, end, latestStart, earliestEnd, instant, + text, description, image, link, + icon, color, textColor) { + + this._id = "e" + Math.floor(Math.random() * 1000000); + + this._instant = instant || (end == null); + + this._start = start; + this._end = (end != null) ? end : start; + + this._latestStart = (latestStart != null) ? latestStart : (instant ? this._end : this._start); + this._earliestEnd = (earliestEnd != null) ? earliestEnd : (instant ? this._start : this._end); + + this._text = SimileAjax.HTML.deEntify(text); + this._description = SimileAjax.HTML.deEntify(description); + this._image = (image != null && image != "") ? image : null; + this._link = (link != null && link != "") ? link : null; + + this._icon = (icon != null && icon != "") ? icon : null; + this._color = (color != null && color != "") ? color : null; + this._textColor = (textColor != null && textColor != "") ? textColor : null; + + this._wikiURL = null; + this._wikiSection = null; +}; + +Timegrid.DefaultEventSource.Event.prototype = { + getID: function() { return this._id; }, + + isInstant: function() { return this._instant; }, + isImprecise: function() { return this._start != this._latestStart || this._end != this._earliestEnd; }, + + getStart: function() { return this._start; }, + getEnd: function() { return this._end; }, + getLatestStart: function() { return this._latestStart; }, + getEarliestEnd: function() { return this._earliestEnd; }, + + getText: function() { return this._text; }, + getDescription: function() { return this._description; }, + getImage: function() { return this._image; }, + getLink: function() { return this._link; }, + + getIcon: function() { return this._icon; }, + getColor: function() { return this._color; }, + getTextColor: function() { return this._textColor; }, + + getInterval: function() { + return new SimileAjax.DateTime.Interval(this.getEnd() - + this.getStart()); + }, + + getProperty: function(name) { return null; }, + + getWikiURL: function() { return this._wikiURL; }, + getWikiSection: function() { return this._wikiSection; }, + setWikiInfo: function(wikiURL, wikiSection) { + this._wikiURL = wikiURL; + this._wikiSection = wikiSection; + }, + + fillDescription: function(elmt) { + elmt.innerHTML = this._description; + }, + fillWikiInfo: function(elmt) { + if (this._wikiURL != null && this._wikiSection != null) { + var wikiID = this.getProperty("wikiID"); + if (wikiID == null || wikiID.length == 0) { + wikiID = this.getText(); + } + wikiID = wikiID.replace(/\s/g, "_"); + + var url = this._wikiURL + this._wikiSection.replace(/\s/g, "_") + "/" + wikiID; + var a = document.createElement("a"); + a.href = url; + a.target = "new"; + a.innerHTML = "Discuss"; + + elmt.appendChild(document.createTextNode("[")); + elmt.appendChild(a); + elmt.appendChild(document.createTextNode("]")); + } else { + elmt.style.display = "none"; + } + }, + fillTime: function(elmt, labeller) { + if (this._instant) { + if (this.isImprecise()) { + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); + elmt.appendChild(elmt.ownerDocument.createElement("br")); + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); + } else { + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); + } + } else { + if (this.isImprecise()) { + elmt.appendChild(elmt.ownerDocument.createTextNode( + labeller.labelPrecise(this._start) + " ~ " + labeller.labelPrecise(this._latestStart))); + elmt.appendChild(elmt.ownerDocument.createElement("br")); + elmt.appendChild(elmt.ownerDocument.createTextNode( + labeller.labelPrecise(this._earliestEnd) + " ~ " + labeller.labelPrecise(this._end))); + } else { + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); + elmt.appendChild(elmt.ownerDocument.createElement("br")); + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); + } + } + }, + fillInfoBubble: function(elmt, theme, labeller) { + var doc = elmt.ownerDocument; + + var title = this.getText(); + var link = this.getLink(); + var image = this.getImage(); + + if (image != null) { + var img = doc.createElement("img"); + img.src = image; + + theme.event.bubble.imageStyler(img); + elmt.appendChild(img); + } + + var divTitle = doc.createElement("div"); + var textTitle = doc.createTextNode(title); + if (link != null) { + var a = doc.createElement("a"); + a.href = link; + a.appendChild(textTitle); + divTitle.appendChild(a); + } else { + divTitle.appendChild(textTitle); + } + theme.event.bubble.titleStyler(divTitle); + elmt.appendChild(divTitle); + + var divBody = doc.createElement("div"); + this.fillDescription(divBody); + theme.event.bubble.bodyStyler(divBody); + elmt.appendChild(divBody); + + var divTime = doc.createElement("div"); + this.fillTime(divTime, labeller); + theme.event.bubble.timeStyler(divTime); + elmt.appendChild(divTime); + + var divWiki = doc.createElement("div"); + this.fillWikiInfo(divWiki); + theme.event.bubble.wikiStyler(divWiki); + elmt.appendChild(divWiki); + } +}; diff --git a/scripts/sources/.svn/text-base/recurring.js.svn-base b/scripts/sources/.svn/text-base/recurring.js.svn-base new file mode 100644 index 0000000..8f456ff --- /dev/null +++ b/scripts/sources/.svn/text-base/recurring.js.svn-base @@ -0,0 +1,136 @@ +/** + * @name Timegrid.RecurringEventSource + * @author masont + */ + +/** + * A type of EventSource that allows the creation and display of recurring + * events that are not tied to a specific date, e.g. 8am on MWF. + * + * @constructor + */ +Timegrid.RecurringEventSource = function() { + Timegrid.RecurringEventSource.superclass.call(this); + + /* + * The actual array containing event prototypes is kept private, and only + * accessed/modified through priviledged methods created here, in the + * constructor. + */ + var eventPrototypes = new DStructs.Array(); + + //========================= Privileged Methods ==========================// + + /** Sets this source's event prototypes to the given prototypes */ + this.setEventPrototypes = function(a) { + eventPrototypes.clear(); + this.addAllEventPrototypes(a); + }; + + /** Adds the given event prototype to this event source */ + this.addEventPrototype = function(eventPrototype) { + eventPrototypes.push(eventPrototype); + this._fire("onAddMany", []); + }; + + /** Adds all of the event prototypes from the given array */ + this.addAllEventPrototypes = function(a) { + eventPrototypes.addAll(a); + this._fire("onAddMany", []); + }; + + /** Removes the given event prototype from this source's prototypes */ + this.removeEventPrototype = function(eventPrototype) { + return eventPrototypes.remove(eventPrototype); + }; + + /** Removes all of the event prototypes from this source */ + this.clearEventPrototypes = function() { + eventPrototypes.clear(); + this._fire("onClear", []); + }; + + /** Generates events from event prototypes */ + this.generateEvents = function(startDate, endDate) { + var result = new DStructs.Array(); + eventPrototypes.each(function(ep) { + result.addAll(ep.generateEvents(startDate, endDate)); + }); + return result; + }; +}; +$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); + +Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { + +}; +Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { + +}; +Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { + return this.generateEvents(startDate, endDate).iterator(); +}; +Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { + return (new Date()).clearTime().setDay(0); +}; +Timegrid.RecurringEventSource.prototype.getLatestDate = function() { + return (new Date()).clearTime().setDay(7); +}; + +Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, + text, description, image, link, icon, color, textColor) { + var id = "e" + Math.floor(Math.random() * 1000000); + var days = new DStructs.Array(); days.addAll(dayArray); + + this.getDays = function() { return days; }; + this.getStart = function() { return start; }; + this.getEnd = function() { return end; }; + + this.getID = function() { return id; } + this.getText = function() { + return SimileAjax.HTML.deEntify(text); + }; + this.getDescription = function() { + return SimileAjax.HTML.deEntify(description); + }; + this.getImage = function() { + return (image != null && image != "") ? image : null; + }; + this.getLink = function() { + return (link != null && link != "") ? link : null; + }; + this.getIcon = function() { + return (icon != null && icon != "") ? icon : null; + }; + this.getColor = function() { + return (color != null && color != "") ? color : null; + }; + this.getTextColor = function() { + return (textColor != null && textColor != "") ? textColor : null; + } + this.generateFrom = function(date) { + if (!this.getDays().contains(date.getDay())) { return false; } + var startTime = new Date(this.getStart()); + var endTime = new Date(this.getEnd()); + startTime.setDate(date.getDate()); + startTime.setMonth(date.getMonth()); + startTime.setFullYear(date.getFullYear()); + endTime.setDate(date.getDate()); + endTime.setMonth(date.getMonth()); + endTime.setFullYear(date.getFullYear()); + return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, + null, false, text, description, image, link, icon, color, + textColor); + }; +}; + +Timegrid.RecurringEventSource.EventPrototype.prototype = { + generateEvents: function(start, end) { + var events = new DStructs.Array(); + for (var date = new Date(start); date < end; date.add('d', 1)) { + var event = this.generateFrom(date); + if (event) { events.push(event); } + } + return events; + } +}; diff --git a/scripts/sources/default.js b/scripts/sources/default.js new file mode 100644 index 0000000..8192a45 --- /dev/null +++ b/scripts/sources/default.js @@ -0,0 +1,407 @@ +/****************************************************************************** + * Default Event Source + *****************************************************************************/ + + +Timegrid.DefaultEventSource = function(eventIndex) { + Timegrid.DefaultEventSource.superclass.call(this); + this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex(); +}; +$.inherit(Timegrid.DefaultEventSource, Timegrid.ListenerAware); + +Timegrid.DefaultEventSource.prototype.loadXML = function(xml, url) { + var base = this._getBaseURL(url); + + var wikiURL = xml.documentElement.getAttribute("wiki-url"); + var wikiSection = xml.documentElement.getAttribute("wiki-section"); + + var dateTimeFormat = xml.documentElement.getAttribute("date-time-format"); + var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); + + var node = xml.documentElement.firstChild; + var added = false; + while (node != null) { + if (node.nodeType == 1) { + var description = ""; + if (node.firstChild != null && node.firstChild.nodeType == 3) { + description = node.firstChild.nodeValue; + } + var evt = new Timegrid.DefaultEventSource.Event( + parseDateTimeFunction(node.getAttribute("start")), + parseDateTimeFunction(node.getAttribute("end")), + parseDateTimeFunction(node.getAttribute("latestStart")), + parseDateTimeFunction(node.getAttribute("earliestEnd")), + node.getAttribute("isDuration") != "true", + node.getAttribute("title"), + description, + this._resolveRelativeURL(node.getAttribute("image"), base), + this._resolveRelativeURL(node.getAttribute("link"), base), + this._resolveRelativeURL(node.getAttribute("icon"), base), + node.getAttribute("color"), + node.getAttribute("textColor") + ); + evt._node = node; + evt.getProperty = function(name) { + return this._node.getAttribute(name); + }; + evt.setWikiInfo(wikiURL, wikiSection); + + this._events.add(evt); + + added = true; + } + node = node.nextSibling; + } + + if (added) { + this._fire("onAddMany", []); + } +}; + + +Timegrid.DefaultEventSource.prototype.loadJSON = function(data, url) { + var base = this._getBaseURL(url); + var added = false; + if (data && data.events){ + var wikiURL = ("wikiURL" in data) ? data.wikiURL : null; + var wikiSection = ("wikiSection" in data) ? data.wikiSection : null; + + var dateTimeFormat = ("dateTimeFormat" in data) ? data.dateTimeFormat : null; + var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); + + for (var i=0; i < data.events.length; i++){ + var event = data.events[i]; + if (!(event.start || event.end || + event.latestStart || event.earliestEnd)) { + continue; + } + var evt = new Timegrid.DefaultEventSource.Event( + parseDateTimeFunction(event.start), + parseDateTimeFunction(event.end), + parseDateTimeFunction(event.latestStart), + parseDateTimeFunction(event.earliestEnd), + event.isDuration || false, + event.title, + event.description, + this._resolveRelativeURL(event.image, base), + this._resolveRelativeURL(event.link, base), + this._resolveRelativeURL(event.icon, base), + event.color, + event.textColor + ); + evt._obj = event; + evt.getProperty = function(name) { + return this._obj[name]; + }; + evt.setWikiInfo(wikiURL, wikiSection); + this._events.add(evt); + added = true; + } + } + if (added) { + this._fire("onAddMany", []); + } +}; + +/* + * Contributed by Morten Frederiksen, http://www.wasab.dk/morten/ + */ +Timegrid.DefaultEventSource.prototype.loadSPARQL = function(xml, url) { + var base = this._getBaseURL(url); + + var dateTimeFormat = 'iso8601'; + var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); + + if (xml == null) { + return; + } + + /* + * Find tag + */ + var node = xml.documentElement.firstChild; + while (node != null && (node.nodeType != 1 || node.nodeName != 'results')) { + node = node.nextSibling; + } + + var wikiURL = null; + var wikiSection = null; + if (node != null) { + wikiURL = node.getAttribute("wiki-url"); + wikiSection = node.getAttribute("wiki-section"); + + node = node.firstChild; + } + + var added = false; + while (node != null) { + if (node.nodeType == 1) { + var bindings = { }; + var binding = node.firstChild; + while (binding != null) { + if (binding.nodeType == 1 && + binding.firstChild != null && + binding.firstChild.nodeType == 1 && + binding.firstChild.firstChild != null && + binding.firstChild.firstChild.nodeType == 3) { + bindings[binding.getAttribute('name')] = binding.firstChild.firstChild.nodeValue; + } + binding = binding.nextSibling; + } + + if (bindings["start"] == null && bindings["date"] != null) { + bindings["start"] = bindings["date"]; + } + + var evt = new Timegrid.DefaultEventSource.Event( + parseDateTimeFunction(bindings["start"]), + parseDateTimeFunction(bindings["end"]), + parseDateTimeFunction(bindings["latestStart"]), + parseDateTimeFunction(bindings["earliestEnd"]), + bindings["isDuration"] != "true", + bindings["title"], + bindings["description"], + this._resolveRelativeURL(bindings["image"], base), + this._resolveRelativeURL(bindings["link"], base), + this._resolveRelativeURL(bindings["icon"], base), + bindings["color"], + bindings["textColor"] + ); + evt._bindings = bindings; + evt.getProperty = function(name) { + return this._bindings[name]; + }; + evt.setWikiInfo(wikiURL, wikiSection); + + this._events.add(evt); + added = true; + } + node = node.nextSibling; + } + + if (added) { + this._fire("onAddMany", []); + } +}; + +Timegrid.DefaultEventSource.prototype.add = function(evt) { + this._events.add(evt); + this._fire("onAddOne", [evt]); +}; + +Timegrid.DefaultEventSource.prototype.addMany = function(events) { + for (var i = 0; i < events.length; i++) { + this._events.add(events[i]); + } + this._fire("onAddMany", []); +}; + +Timegrid.DefaultEventSource.prototype.clear = function() { + this._events.removeAll(); + this._fire("onClear", []); +}; + +Timegrid.DefaultEventSource.prototype.getEventIterator = function(startDate, endDate) { + return this._events.getIterator(startDate, endDate); +}; + +Timegrid.DefaultEventSource.prototype.getAllEventIterator = function() { + return this._events.getAllIterator(); +}; + +Timegrid.DefaultEventSource.prototype.getCount = function() { + return this._events.getCount(); +}; + +Timegrid.DefaultEventSource.prototype.getEarliestDate = function() { + return this._events.getEarliestDate(); +}; + +Timegrid.DefaultEventSource.prototype.getLatestDate = function() { + return this._events.getLatestDate(); +}; + +Timegrid.DefaultEventSource.prototype._getBaseURL = function(url) { + if (url.indexOf("://") < 0) { + var url2 = this._getBaseURL(document.location.href); + if (url.substr(0,1) == "/") { + url = url2.substr(0, url2.indexOf("/", url2.indexOf("://") + 3)) + url; + } else { + url = url2 + url; + } + } + + var i = url.lastIndexOf("/"); + if (i < 0) { + return ""; + } else { + return url.substr(0, i+1); + } +}; + +Timegrid.DefaultEventSource.prototype._resolveRelativeURL = function(url, base) { + if (url == null || url == "") { + return url; + } else if (url.indexOf("://") > 0) { + return url; + } else if (url.substr(0,1) == "/") { + return base.substr(0, base.indexOf("/", base.indexOf("://") + 3)) + url; + } else { + return base + url; + } +}; + + +Timegrid.DefaultEventSource.Event = function( + start, end, latestStart, earliestEnd, instant, + text, description, image, link, + icon, color, textColor) { + + this._id = "e" + Math.floor(Math.random() * 1000000); + + this._instant = instant || (end == null); + + this._start = start; + this._end = (end != null) ? end : start; + + this._latestStart = (latestStart != null) ? latestStart : (instant ? this._end : this._start); + this._earliestEnd = (earliestEnd != null) ? earliestEnd : (instant ? this._start : this._end); + + this._text = SimileAjax.HTML.deEntify(text); + this._description = SimileAjax.HTML.deEntify(description); + this._image = (image != null && image != "") ? image : null; + this._link = (link != null && link != "") ? link : null; + + this._icon = (icon != null && icon != "") ? icon : null; + this._color = (color != null && color != "") ? color : null; + this._textColor = (textColor != null && textColor != "") ? textColor : null; + + this._wikiURL = null; + this._wikiSection = null; +}; + +Timegrid.DefaultEventSource.Event.prototype = { + getID: function() { return this._id; }, + + isInstant: function() { return this._instant; }, + isImprecise: function() { return this._start != this._latestStart || this._end != this._earliestEnd; }, + + getStart: function() { return this._start; }, + getEnd: function() { return this._end; }, + getLatestStart: function() { return this._latestStart; }, + getEarliestEnd: function() { return this._earliestEnd; }, + + getText: function() { return this._text; }, + getDescription: function() { return this._description; }, + getImage: function() { return this._image; }, + getLink: function() { return this._link; }, + + getIcon: function() { return this._icon; }, + getColor: function() { return this._color; }, + getTextColor: function() { return this._textColor; }, + + getInterval: function() { + return new SimileAjax.DateTime.Interval(this.getEnd() - + this.getStart()); + }, + + getProperty: function(name) { return null; }, + + getWikiURL: function() { return this._wikiURL; }, + getWikiSection: function() { return this._wikiSection; }, + setWikiInfo: function(wikiURL, wikiSection) { + this._wikiURL = wikiURL; + this._wikiSection = wikiSection; + }, + + fillDescription: function(elmt) { + elmt.innerHTML = this._description; + }, + fillWikiInfo: function(elmt) { + if (this._wikiURL != null && this._wikiSection != null) { + var wikiID = this.getProperty("wikiID"); + if (wikiID == null || wikiID.length == 0) { + wikiID = this.getText(); + } + wikiID = wikiID.replace(/\s/g, "_"); + + var url = this._wikiURL + this._wikiSection.replace(/\s/g, "_") + "/" + wikiID; + var a = document.createElement("a"); + a.href = url; + a.target = "new"; + a.innerHTML = "Discuss"; + + elmt.appendChild(document.createTextNode("[")); + elmt.appendChild(a); + elmt.appendChild(document.createTextNode("]")); + } else { + elmt.style.display = "none"; + } + }, + fillTime: function(elmt, labeller) { + if (this._instant) { + if (this.isImprecise()) { + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); + elmt.appendChild(elmt.ownerDocument.createElement("br")); + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); + } else { + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); + } + } else { + if (this.isImprecise()) { + elmt.appendChild(elmt.ownerDocument.createTextNode( + labeller.labelPrecise(this._start) + " ~ " + labeller.labelPrecise(this._latestStart))); + elmt.appendChild(elmt.ownerDocument.createElement("br")); + elmt.appendChild(elmt.ownerDocument.createTextNode( + labeller.labelPrecise(this._earliestEnd) + " ~ " + labeller.labelPrecise(this._end))); + } else { + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); + elmt.appendChild(elmt.ownerDocument.createElement("br")); + elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); + } + } + }, + fillInfoBubble: function(elmt, theme, labeller) { + var doc = elmt.ownerDocument; + + var title = this.getText(); + var link = this.getLink(); + var image = this.getImage(); + + if (image != null) { + var img = doc.createElement("img"); + img.src = image; + + theme.event.bubble.imageStyler(img); + elmt.appendChild(img); + } + + var divTitle = doc.createElement("div"); + var textTitle = doc.createTextNode(title); + if (link != null) { + var a = doc.createElement("a"); + a.href = link; + a.appendChild(textTitle); + divTitle.appendChild(a); + } else { + divTitle.appendChild(textTitle); + } + theme.event.bubble.titleStyler(divTitle); + elmt.appendChild(divTitle); + + var divBody = doc.createElement("div"); + this.fillDescription(divBody); + theme.event.bubble.bodyStyler(divBody); + elmt.appendChild(divBody); + + var divTime = doc.createElement("div"); + this.fillTime(divTime, labeller); + theme.event.bubble.timeStyler(divTime); + elmt.appendChild(divTime); + + var divWiki = doc.createElement("div"); + this.fillWikiInfo(divWiki); + theme.event.bubble.wikiStyler(divWiki); + elmt.appendChild(divWiki); + } +}; diff --git a/scripts/sources/recurring.js b/scripts/sources/recurring.js new file mode 100644 index 0000000..d881baf --- /dev/null +++ b/scripts/sources/recurring.js @@ -0,0 +1,136 @@ +/** + * @name Timegrid.RecurringEventSource + * @author masont + */ + +/** + * A type of EventSource that allows the creation and display of recurring + * events that are not tied to a specific date, e.g. 8am on MWF. + * + * @constructor + */ +Timegrid.RecurringEventSource = function() { + Timegrid.RecurringEventSource.superclass.call(this); + + /* + * The actual array containing event prototypes is kept private, and only + * accessed/modified through priviledged methods created here, in the + * constructor. + */ + var eventPrototypes = new DStructs.Array(); + + //========================= Privileged Methods ==========================// + + /** Sets this source's event prototypes to the given prototypes */ + this.setEventPrototypes = function(a) { + eventPrototypes.clear(); + this.addAllEventPrototypes(a); + }; + + /** Adds the given event prototype to this event source */ + this.addEventPrototype = function(eventPrototype) { + eventPrototypes.push(eventPrototype); + this._fire("onAddMany", []); + }; + + /** Adds all of the event prototypes from the given array */ + this.addAllEventPrototypes = function(a) { + eventPrototypes.addAll(a); + this._fire("onAddMany", []); + }; + + /** Removes the given event prototype from this source's prototypes */ + this.removeEventPrototype = function(eventPrototype) { + return eventPrototypes.remove(eventPrototype); + }; + + /** Removes all of the event prototypes from this source */ + this.clearEventPrototypes = function() { + eventPrototypes.clear(); + this._fire("onClear", []); + }; + + /** Generates events from event prototypes */ + this.generateEvents = function(startDate, endDate) { + var result = new DStructs.Array(); + eventPrototypes.each(function(ep) { + result.addAll(ep.generateEvents(startDate, endDate)); + }); + return result; + }; +}; +$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); + +Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { + +}; +Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { + +}; +Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { + return this.generateEvents(startDate, endDate).iterator(); +}; +Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { + return (new Date()).clearTime().setDay(0); +}; +Timegrid.RecurringEventSource.prototype.getLatestDate = function() { + return (new Date()).clearTime().setDay(7); +}; + +Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, + text, description, image, link, icon, color, textColor) { + var id = "e" + Math.floor(Math.random() * 1000000); + var days = new DStructs.Array(); days.addAll(dayArray); + + this.getDays = function() { return days; }; + this.getStart = function() { return start; }; + this.getEnd = function() { return end; }; + + this.getID = function() { return id; } + this.getText = function() { + return SimileAjax.HTML.deEntify(text); + }; + this.getDescription = function() { + return SimileAjax.HTML.deEntify(description); + }; + this.getImage = function() { + return (image != null && image != "") ? image : null; + }; + this.getLink = function() { + return (link != null && link != "") ? link : null; + }; + this.getIcon = function() { + return (icon != null && icon != "") ? icon : null; + }; + this.getColor = function() { + return (color != null && color != "") ? color : null; + }; + this.getTextColor = function() { + return (textColor != null && textColor != "") ? textColor : null; + } + this.generateFrom = function(date) { + if (!this.getDays().contains(date.getDay())) { return false; } + var startTime = new Date(this.getStart()); + var endTime = new Date(this.getEnd()); + startTime.setDate(date.getDate()); + startTime.setMonth(date.getMonth()); + startTime.setFullYear(date.getFullYear()); + endTime.setDate(date.getDate()); + endTime.setMonth(date.getMonth()); + endTime.setFullYear(date.getFullYear()); + return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, + null, false, text, description, image, link, icon, color, + textColor); + }; +}; + +Timegrid.RecurringEventSource.EventPrototype.prototype = { + generateEvents: function(start, end) { + var events = new DStructs.Array(); + for (var date = new Date(start); date < end; date.add('d', 1)) { + var event = this.generateFrom(date); + if (event) { events.push(event); } + } + return events; + } +}; diff --git a/scripts/themes.js b/scripts/themes.js new file mode 100644 index 0000000..383efd5 --- /dev/null +++ b/scripts/themes.js @@ -0,0 +1,127 @@ +/*================================================== + * Classic Theme + *================================================== + */ + + +Timegrid.ClassicTheme = new Object(); + +Timegrid.ClassicTheme.implementations = []; + +Timegrid.ClassicTheme.create = function(locale) { + if (locale == null) { + locale = Timegrid.Platform.getDefaultLocale(); + } + + var f = Timegrid.ClassicTheme.implementations[locale]; + if (f == null) { + f = Timegrid.ClassicTheme._Impl; + } + return new f(); +}; + +Timegrid.ClassicTheme._Impl = function() { + this.firstDayOfWeek = 0; // Sunday + + this.ether = { + backgroundColors: [ + "#EEE", + "#DDD", + "#CCC", + "#AAA" + ], + highlightColor: "white", + highlightOpacity: 50, + interval: { + line: { + show: true, + color: "#aaa", + opacity: 25 + }, + weekend: { + color: "#FFFFE0", + opacity: 30 + }, + marker: { + hAlign: "Bottom", + hBottomStyler: function(elmt) { + elmt.className = "timeline-ether-marker-bottom"; + }, + hBottomEmphasizedStyler: function(elmt) { + elmt.className = "timeline-ether-marker-bottom-emphasized"; + }, + hTopStyler: function(elmt) { + elmt.className = "timeline-ether-marker-top"; + }, + hTopEmphasizedStyler: function(elmt) { + elmt.className = "timeline-ether-marker-top-emphasized"; + }, + + vAlign: "Right", + vRightStyler: function(elmt) { + elmt.className = "timeline-ether-marker-right"; + }, + vRightEmphasizedStyler: function(elmt) { + elmt.className = "timeline-ether-marker-right-emphasized"; + }, + vLeftStyler: function(elmt) { + elmt.className = "timeline-ether-marker-left"; + }, + vLeftEmphasizedStyler:function(elmt) { + elmt.className = "timeline-ether-marker-left-emphasized"; + } + } + } + }; + + this.event = { + track: { + offset: 0.5, // em + height: 1.5, // em + gap: 0.5 // em + }, + instant: { + icon: Timegrid.urlPrefix + "images/dull-blue-circle.png", + lineColor: "#58A0DC", + impreciseColor: "#58A0DC", + impreciseOpacity: 20, + showLineForNoText: true + }, + duration: { + color: "#58A0DC", + opacity: 100, + impreciseColor: "#58A0DC", + impreciseOpacity: 20 + }, + label: { + insideColor: "white", + outsideColor: "black", + width: 200 // px + }, + highlightColors: [ + "#FFFF00", + "#FFC000", + "#FF0000", + "#0000FF" + ], + bubble: { + width: 250, // px + height: 125, // px + titleStyler: function(elmt) { + elmt.className = "timeline-event-bubble-title"; + }, + bodyStyler: function(elmt) { + elmt.className = "timeline-event-bubble-body"; + }, + imageStyler: function(elmt) { + elmt.className = "timeline-event-bubble-image"; + }, + wikiStyler: function(elmt) { + elmt.className = "timeline-event-bubble-wiki"; + }, + timeStyler: function(elmt) { + elmt.className = "timeline-event-bubble-time"; + } + } + }; +}; \ No newline at end of file diff --git a/scripts/timegrid.js b/scripts/timegrid.js new file mode 100644 index 0000000..c92e843 --- /dev/null +++ b/scripts/timegrid.js @@ -0,0 +1,198 @@ +/****************************************************************************** + * Timegrid + *****************************************************************************/ + +Timegrid.create = function(node, eventSource, layoutName, layoutParams) { + return new Timegrid._Impl(node, eventSource, layoutName, layoutParams); +}; + +Timegrid.resize = function() { + for (var i = 0; i < window.timegrids.length; i++) { + window.timegrids[i]._resize(); + } + return false; +}; + +Timegrid.createFromDOM = function(elmt) { + var config = Timegrid.getConfigFromDOM(elmt); + var layoutNames = config.views.split(","); + var getExtension = function(s) { + return s.split('.').pop().toLowerCase(); + }; + if (config.eventsource) { + var eventSource = eval(config.eventsource); + var tg = Timegrid.create(elmt, eventSource, layoutNames, config); + return tg; + } else if (config.src) { + var eventSource = new Timegrid.DefaultEventSource(); + var tg = Timegrid.create(elmt, eventSource, layoutNames, config); + switch (getExtension(config.src)) { + case 'xml': + tg.loadXML(config.src, function(xml, url) { + eventSource.loadXML(xml, url); + }); + break; + case 'js': + tg.loadJSON(config.src, function(json, url) { + eventSource.loadJSON(json, url); + }); + break; + } + return tg; + } +}; + +Timegrid.getConfigFromDOM = function(elmt) { + var config = $(elmt).attrs('tg'); + config.scrollwidth = $.scrollWidth(); + for (var k in config) { + config[k.toLowerCase()] = config[k]; + } + return config; +}; + +Timegrid.loadXML = function(url, f) { + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + }; + var fDone = function(xmlhttp) { + var xml = xmlhttp.responseXML; + if (!xml.documentElement && xmlhttp.responseStream) { + xml.load(xmlhttp.responseStream); + } + f(xml, url); + }; + SimileAjax.XmlHttp.get(url, fError, fDone); +}; + +Timegrid.loadJSON = function(url, f) { + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + }; + var fDone = function(xmlhttp) { + f(eval('(' + xmlhttp.responseText + ')'), url); + }; + SimileAjax.XmlHttp.get(url, fError, fDone); +}; + +Timegrid._Impl = function(node, eventSource, layoutNames, layoutParams) { + var tg = this; + this._container = node; + this._eventSource = eventSource; + this._layoutNames = layoutNames; + this._layoutParams = layoutParams; + + if (this._eventSource) { + this._eventListener = { + onAddMany: function() { tg._onAddMany(); }, + onClear: function() { tg._onClear(); } + } + this._eventSource.addListener(this._eventListener); + } + + this._construct(); +}; + +Timegrid._Impl.prototype.loadXML = function(url, f) { + var tg = this; + + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + tg.hideLoadingMessage(); + }; + var fDone = function(xmlhttp) { + try { + var xml = xmlhttp.responseXML; + if (!xml.documentElement && xmlhttp.responseStream) { + xml.load(xmlhttp.responseStream); + } + f(xml, url); + } finally { + tg.hideLoadingMessage(); + } + }; + this.showLoadingMessage(); + window.setTimeout(function() { + SimileAjax.XmlHttp.get(url, fError, fDone); + }, 0); +}; + +Timegrid._Impl.prototype.loadJSON = function(url, f) { + var tg = this; + var fError = function(statusText, status, xmlhttp) { + //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + tg.hideLoadingMessage(); + }; + var fDone = function(xmlhttp) { + try { + f(eval('(' + xmlhttp.responseText + ')'), url); + } finally { + tg.hideLoadingMessage(); + } + }; + this.showLoadingMessage(); + window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0); +}; + +Timegrid._Impl.prototype._construct = function() { + this.rendering = true; + var self = this; + this._layouts = $.map(this._layoutNames, function(s) { + return Timegrid.LayoutFactory.createLayout(s, self._eventSource, + self._layoutParams); + }); + if (this._panel) { + this._panel.setLayouts(this._layouts); + } else { + this._panel = new Timegrid.Controls.Panel(this._layouts); + } + var container = this._container; + var doc = container.ownerDocument; + + while (container.firstChild) { + container.removeChild(container.firstChild); + } + $(container).addClass('timegrid-default'); + + var message = SimileAjax.Graphics.createMessageBubble(doc); + message.containerDiv.className = "timegrid-message-container"; + container.appendChild(message.containerDiv); + + message.contentDiv.className = "timegrid-message"; + message.contentDiv.innerHTML = " " + Timegrid.l10n.loadingMessage; + + this.showLoadingMessage = function() { $(message.containerDiv).show(); }; + this.hideLoadingMessage = function() { $(message.containerDiv).hide(); }; + + this._panel.render(container); + this.rendering = false; +}; + +Timegrid._Impl.prototype._update = function() { + this._panel.renderChanged(); +}; + +Timegrid._Impl.prototype._resize = function() { + var newHeight = $(this._container).height(); + var newWidth = $(this._container).width(); + + if (!(newHeight == this._oldHeight && newWidth == this._oldWidth)) { + if (!this.rendering) { this._construct(); } + this._oldHeight = newHeight; + this._oldWidth = newWidth; + } +}; + +Timegrid._Impl.prototype._onAddMany = function() { + this._update(); +}; + +Timegrid._Impl.prototype._onClear = function() { + this._update(); +}; + diff --git a/scripts/util/.svn/all-wcprops b/scripts/util/.svn/all-wcprops new file mode 100644 index 0000000..f237a7c --- /dev/null +++ b/scripts/util/.svn/all-wcprops @@ -0,0 +1,53 @@ +K 25 +svn:wc:ra_dav:version-url +V 78 +/repository/!svn/ver/9626/course-picker/trunk/src/webapp/timegrid/scripts/util +END +excanvas.pack.js +K 25 +svn:wc:ra_dav:version-url +V 95 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/excanvas.pack.js +END +debug.js +K 25 +svn:wc:ra_dav:version-url +V 87 +/repository/!svn/ver/9626/course-picker/trunk/src/webapp/timegrid/scripts/util/debug.js +END +jquery.corner.js +K 25 +svn:wc:ra_dav:version-url +V 95 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/jquery.corner.js +END +jquery.dimensions.js +K 25 +svn:wc:ra_dav:version-url +V 99 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/jquery.dimensions.js +END +date.js +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/date.js +END +util.js +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/util.js +END +jquery.prettybox.js +K 25 +svn:wc:ra_dav:version-url +V 98 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/jquery.prettybox.js +END +jquery.simile.js +K 25 +svn:wc:ra_dav:version-url +V 95 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/jquery.simile.js +END diff --git a/scripts/util/.svn/entries b/scripts/util/.svn/entries new file mode 100644 index 0000000..4eeea9c --- /dev/null +++ b/scripts/util/.svn/entries @@ -0,0 +1,303 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts/util +http://simile.mit.edu/repository + + + +2012-02-03T22:02:39.069198Z +9626 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +excanvas.pack.js +file + + + + +2012-02-03T21:55:34.000000Z +4df688df53eb2d0c1bedcdca73fff165 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +9464 + +debug.js +file + + + + +2012-02-18T18:09:00.000000Z +1580753faaa5ee82808b536826ae5875 +2012-02-03T22:02:39.069198Z +9626 +lizs + + + + + + + + + + + + + + + + + + + + + +442 + +jquery.corner.js +file + + + + +2012-02-03T21:55:34.000000Z +bc31db1829618c2a2178fa0e0ef05737 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +9202 + +jquery.dimensions.js +file + + + + +2012-02-03T21:55:34.000000Z +2e579cc57a2de1d577a2f9d949d8ca94 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +4230 + +date.js +file + + + + +2012-02-03T21:55:34.000000Z +3985b21beb339d7dfbede5719fcd23bf +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +16742 + +util.js +file + + + + +2012-02-03T21:55:34.000000Z +810e97ad59ed7e4a5ad55ae1c2c9f0b7 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1946 + +jquery.prettybox.js +file + + + + +2012-02-03T21:55:34.000000Z +271f2c03e20a7f421ef90183609a2d76 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +7769 + +dstructs +dir + +jquery.simile.js +file + + + + +2012-02-03T21:55:34.000000Z +6b0d9f0d4e2bd86f3e37ef9382332607 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +3985 + diff --git a/scripts/util/.svn/text-base/date.js.svn-base b/scripts/util/.svn/text-base/date.js.svn-base new file mode 100644 index 0000000..1c156c1 --- /dev/null +++ b/scripts/util/.svn/text-base/date.js.svn-base @@ -0,0 +1,567 @@ +/** + * Copyright (c)2005-2007 Matt Kruse (javascripttoolbox.com) + * + * Dual licensed under the MIT and GPL licenses. + * This basically means you can use this code however you want for + * free, but don't claim to have written it yourself! + * Donations always accepted: http://www.JavascriptToolbox.com/donate/ + * + * Please do not link to the .js files on javascripttoolbox.com from + * your site. Copy the files locally to your server instead. + * + * Modified by Mason Tang, SIMILE Project, 2007 + * - Changed behavior of format and parse for AM/PM, behavior of 'a' is now + * bound to 'A', while 'a' will print a lowercase 'am/pm'. + */ +/* +Date functions + +These functions are used to parse, format, and manipulate Date objects. +See documentation and examples at http://www.JavascriptToolbox.com/lib/date/ + +*/ +Date.$VERSION = 1.02; + +// Utility function to append a 0 to single-digit numbers +Date.LZ = function(x) {return(x<0||x>9?"":"0")+x}; + +/** + * Parse a string and convert it to a Date object. + * If no format is passed, try a list of common formats. + * If string cannot be parsed, return null. + * Avoids regular expressions to be more portable. + */ +Date.parseString = function(val, format) { + // If no format is specified, try a few common formats + if (typeof(format)=="undefined" || format==null || format=="") { + var generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d','MMM-d','d-MMM'); + var monthFirst=new Array('M/d/y','M-d-y','M.d.y','M/d','M-d'); + var dateFirst =new Array('d/M/y','d-M-y','d.M.y','d/M','d-M'); + var checkList=new Array(generalFormats,Date.preferAmericanFormat?monthFirst:dateFirst,Date.preferAmericanFormat?dateFirst:monthFirst); + for (var i=0; i=minlength; x--) { + var token=str.substring(i,i+x); + if (token.length < minlength) { + return null; + } + if (this.isInteger(token)) { + return token; + } + } + return null; + }; + val=val+""; + format=format+""; + var i_val=0; + var i_format=0; + var c=""; + var token=""; + var token2=""; + var x,y; + var year=new Date().getFullYear(); + var month=1; + var date=1; + var hh=0; + var mm=0; + var ss=0; + var ampm=""; + while (i_format < format.length) { + // Get next token from format string + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + // Extract contents of value based on format token + if (token=="yyyy" || token=="yy" || token=="y") { + if (token=="yyyy") { + x=4;y=4; + } + if (token=="yy") { + x=2;y=2; + } + if (token=="y") { + x=2;y=4; + } + year=this.getInt(val,i_val,x,y); + if (year==null) { + return null; + } + i_val += year.length; + if (year.length==2) { + if (year > 70) { + year=1900+(year-0); + } + else { + year=2000+(year-0); + } + } + } + else if (token=="MMM" || token=="NNN"){ + month=0; + var names = (token=="MMM"?(Date.l10n.monthNames.concat(Date.l10n.monthAbbreviations)):Date.l10n.monthAbbreviations); + for (var i=0; i12)){ + return null; + } + } + else if (token=="EE"||token=="E"){ + var names = (token=="EE"?Date.l10n.dayNames:Date.l10n.dayAbbreviations); + for (var i=0; i12)){ + return null; + } + i_val+=month.length; + } + else if (token=="dd"||token=="d") { + date=this.getInt(val,i_val,token.length,2); + if(date==null||(date<1)||(date>31)){ + return null; + } + i_val+=date.length; + } + else if (token=="hh"||token=="h") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>12)){ + return null; + } + i_val+=hh.length; + } + else if (token=="HH"||token=="H") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>23)){ + return null; + } + i_val+=hh.length; + } + else if (token=="KK"||token=="K") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>11)){ + return null; + } + i_val+=hh.length; + hh++; + } + else if (token=="kk"||token=="k") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>24)){ + return null; + } + i_val+=hh.length; + hh--; + } + else if (token=="mm"||token=="m") { + mm=this.getInt(val,i_val,token.length,2); + if(mm==null||(mm<0)||(mm>59)){ + return null; + } + i_val+=mm.length; + } + else if (token=="ss"||token=="s") { + ss=this.getInt(val,i_val,token.length,2); + if(ss==null||(ss<0)||(ss>59)){ + return null; + } + i_val+=ss.length; + } + else if (token=="A") { + if (val.substring(i_val,i_val+2).toLowerCase()=="am") { + ampm="AM"; + } + else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") { + ampm="PM"; + } + else { + return null; + } + i_val+=2; + } + else { + if (val.substring(i_val,i_val+token.length)!=token) { + return null; + } + else { + i_val+=token.length; + } + } + } + // If there are any trailing characters left in the value, it doesn't match + if (i_val != val.length) { + return null; + } + // Is date valid for month? + if (month==2) { + // Check for leap year + if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year + if (date > 29){ + return null; + } + } + else { + if (date > 28) { + return null; + } + } + } + if ((month==4)||(month==6)||(month==9)||(month==11)) { + if (date > 30) { + return null; + } + } + // Correct hours value + if (hh<12 && ampm=="PM") { + hh=hh-0+12; + } + else if (hh>11 && ampm=="AM") { + hh-=12; + } + return new Date(year,month-1,date,hh,mm,ss); +}; + +(function() { + /** + * Adds a given method under the given name + * to the Date prototype if it doesn't + * currently exist. + * + * @private + */ + function add(name, method) { + if( !Date.prototype[name] ) { + Date.prototype[name] = method; + } + }; + + add('getFullYear', function() { + var yy=this.getYear(); + return (yy<1900?yy+1900:yy); + }); + + /** + * Check if a date string is valid + */ + add('isValid', function(val, format) { + return (Date.parseString(val,format) != null); + }); + + /** + * Check if a date object is before another date object + */ + add('isBefore', function(date2) { + if (date2==null) { + return false; + } + return (this.getTime()date2.getTime()); + }); + + /** + * Check if a date object is between two dates + */ + add('isBetween', function(date1, date2) { + return this.isAfter(date1) && this.isBefore(date2); + }); + + /** + * Check if two date objects have equal dates and times + */ + add('equals', function(date2) { + if (date2==null) { + return false; + } + return (this.getTime()==date2.getTime()); + }); + + /** + * Check if two date objects have equal dates, disregarding times + */ + add('equalsIgnoreTime', function(date2) { + if (date2==null) { + return false; + } + var d1 = new Date(this.getTime()).clearTime(); + var d2 = new Date(date2.getTime()).clearTime(); + return (d1.getTime()==d2.getTime()); + }); + + /** + * Format a date into a string using a given format string + */ + add('format', function(format) { + format=format+""; + var result=""; + var i_format=0; + var c=""; + var token=""; + var y=this.getYear()+""; + var M=this.getMonth()+1; + var d=this.getDate(); + var E=this.getDay(); + var H=this.getHours(); + var m=this.getMinutes(); + var s=this.getSeconds(); + var w=this.getWeekOfYear(); + var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; + // Convert real date parts into formatted versions + var value=new Object(); + if (y.length < 4) { + y=""+(+y+1900); + } + value["y"]=""+y; + value["yyyy"]=y; + value["yy"]=y.substring(2,4); + value["M"]=M; + value["MM"]=Date.LZ(M); + value["MMM"]=Date.l10n.monthNames[M-1]; + value["NNN"]=Date.l10n.monthAbbreviations[M-1]; + value["d"]=d; + value["dd"]=Date.LZ(d); + value["E"]=Date.l10n.dayAbbreviations[E]; + value["EE"]=Date.l10n.dayNames[E]; + value["e"]=value["E"].substr(0,1); + value["H"]=H; + value["HH"]=Date.LZ(H); + if (H==0){ + value["h"]=12; + } + else if (H>12){ + value["h"]=H-12; + } + else { + value["h"]=H; + } + value["hh"]=Date.LZ(value["h"]); + value["K"]=value["h"]-1; + value["k"]=value["H"]+1; + value["KK"]=Date.LZ(value["K"]); + value["kk"]=Date.LZ(value["k"]); + if (H > 11) { + value["A"]="PM"; + value["a"]="pm"; + } + else { + value["A"]="AM"; + value["a"]="am"; + } + value["m"]=m; + value["mm"]=Date.LZ(m); + value["s"]=s; + value["ss"]=Date.LZ(s); + value["w"]=w; + while (i_format < format.length) { + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + if (typeof(value[token])!="undefined") { + result=result + value[token]; + } + else { + result=result + token; + } + } + return result; + }); + + /** + * Get the full name of the day for a date + */ + add('getDayName', function() { + return Date.l10n.dayNames[this.getDay()]; + }); + + /** + * Get the abbreviation of the day for a date + */ + add('getDayAbbreviation', function() { + return Date.l10n.dayAbbreviations[this.getDay()]; + }); + + /** + * Get the full name of the month for a date + */ + add('getMonthName', function() { + return Date.l10n.monthNames[this.getMonth()]; + }); + + /** + * Get the abbreviation of the month for a date + */ + add('getMonthAbbreviation', function() { + return Date.l10n.monthAbbreviations[this.getMonth()]; + }); + + /** + * Get the number of the week of the year. + * + * @example var dtm = new Date("01/12/2008"); + * dtm.getWeekOfYear(); + * @result 2 + * + * @name getWeekOfYear + * @type Number + * @cat Plugins/Methods/Date + */ + add("getWeekOfYear", function() { + dowOffset = Date.l10n.firstDayOfWeek; + var newYear = new Date(this.getFullYear(),0,1); + var day = newYear.getDay() - dowOffset; //the day of week the year begins on + day = (day >= 0 ? day : day + 7); + var daynum = Math.floor((this.getTime() - newYear.getTime() - + (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1; + var weeknum; + //if the year starts before the middle of a week + if(day < 4) { + weeknum = Math.floor((daynum+day-1)/7) + 1; + if(weeknum > 52) { + nYear = new Date(this.getFullYear() + 1,0,1); + nday = nYear.getDay() - dowOffset; + nday = nday >= 0 ? nday : nday + 7; + /*if the next year starts before the middle of + the week, it is week #1 of that year*/ + weeknum = nday < 4 ? 1 : 53; + } + } else { + weeknum = Math.floor((daynum+day-1)/7); + } + return weeknum; + }); + + /** + * Given a timezone offset in hours, returns a new Date object that has + * been adjusted to that timezone. + * + * @function + * @memberOf Date + * @param {Number} timezoneOffset the timezone offset in hours + * @return {Date} a new Date object + */ + add('toTimezone', function(timezoneOffset) { + var minutesToMs = 60000; var hoursToMs = 60 * minutesToMs; + var utcMs = this.getTime() + (this.getTimezoneOffset() * minutesToMs); + var offsetMs = hoursToMs * timezoneOffset; + return new Date(utcMs + offsetMs); + }); + + /** + * Clear all time information in a date object + */ + add('clearTime', function() { + this.setHours(0); + this.setMinutes(0); + this.setSeconds(0); + this.setMilliseconds(0); + return this; + }); + + /** + * Clones this date into a new object, optionally modifying the provided + * instance instead. + */ + add('clone', function(date) { + if (date && date instanceof Date) { + date.setTime(this.getTime()); + return date; + } else { + return new Date(this); + } + }); + + /** + * Set the day of the week of the date within this same week + */ + add('setDay', function(n) { + var day = this.getDay(); + if (day == n) { return this; } + if (n == 7) { this.add('d', 7); return this.setDay(0); } + if (day < n) { this.add('d', 1); return this.setDay(n); } + if (day > n) { this.add('d', -1); return this.setDay(n); } + }); + + /** + * Add an amount of time to a date. Negative numbers can be passed to + * subtract time. + */ + add('add', function(interval, number) { + if (typeof(interval)=="undefined" || interval==null || typeof(number)=="undefined" || number==null) { + return this; + } + number = +number; + if (interval=='y') { // year + this.setFullYear(this.getFullYear()+number); + } + else if (interval=='M') { // Month + this.setMonth(this.getMonth()+number); + } + else if (interval=='d') { // Day + this.setDate(this.getDate()+number); + } + else if (interval=='w') { // Weekday + var step = (number>0)?1:-1; + while (number!=0) { + this.add('d',step); + while(this.getDay()==0 || this.getDay()==6) { + this.add('d',step); + } + number -= step; + } + } + else if (interval=='h') { // Hour + this.setHours(this.getHours() + number); + } + else if (interval=='m') { // Minute + this.setMinutes(this.getMinutes() + number); + } + else if (interval=='s') { // Second + this.setSeconds(this.getSeconds() + number); + } + return this; + }); + +})(); diff --git a/scripts/util/.svn/text-base/debug.js.svn-base b/scripts/util/.svn/text-base/debug.js.svn-base new file mode 100644 index 0000000..ce569f6 --- /dev/null +++ b/scripts/util/.svn/text-base/debug.js.svn-base @@ -0,0 +1,16 @@ +/*================================================== + * Debug Utility Functions + *================================================== + */ + +Timegrid.Debug = new Object(); + +Timegrid.Debug.log = function(msg) { +}; + +Timegrid.Debug.exception = function(e) { + e = SimileAjax.Platform.isIE ? e.message : e; + SimileAjax.Debug.exception(e, "Caught exception"); + //alert("Caught exception: " + (SimileAjax.Platform.isIE ? e.message : e)); +}; + diff --git a/scripts/util/.svn/text-base/excanvas.pack.js.svn-base b/scripts/util/.svn/text-base/excanvas.pack.js.svn-base new file mode 100644 index 0000000..9d71658 --- /dev/null +++ b/scripts/util/.svn/text-base/excanvas.pack.js.svn-base @@ -0,0 +1,19 @@ +if(!window.CanvasRenderingContext2D){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}"; +var c=a.getElementsByTagName("canvas");for(var d=0;d"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize", +W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case "width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case "height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement; +if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit= +a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.d=a.d;b.e=a.e}function O(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){var d=a.indexOf("(",3),e=a.indexOf(")",d+1),g=a.substring(d+1,e).split(",");b="#";for(var h=0;h<3;h++){b+=R[Number(g[h])]}if(g.length==4&&a.substr(3,1)=="a"){c=g[3]}}else{b=a}return[b,c]}function S(a){switch(a){case "butt":return"flat";case "round":return"round"; +case "square":default:return"square"}}function K(a){this.a=J();this.m=[];this.k=[];this.c=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=m*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.j=b;this.d=1;this.e=1}var j=K.prototype;j.clearRect=function(){this.j.innerHTML= +"";this.c=[]};j.beginPath=function(){this.c=[]};j.moveTo=function(a,b){this.c.push({type:"moveTo",x:a,y:b});this.f=a;this.g=b};j.lineTo=function(a,b){this.c.push({type:"lineTo",x:a,y:b});this.f=a;this.g=b};j.bezierCurveTo=function(a,b,c,d,e,g){this.c.push({type:"bezierCurveTo",cp1x:a,cp1y:b,cp2x:c,cp2y:d,x:e,y:g});this.f=e;this.g=g};j.quadraticCurveTo=function(a,b,c,d){var e=this.f+0.6666666666666666*(a-this.f),g=this.g+0.6666666666666666*(b-this.g),h=e+(c-this.f)/3,l=g+(d-this.g)/3;this.bezierCurveTo(e, +g,h,l,c,d)};j.arc=function(a,b,c,d,e,g){c*=m;var h=g?"at":"wa",l=a+M(d)*c-A,n=b+L(d)*c-A,o=a+M(e)*c-A,f=b+L(e)*c-A;if(l==o&&!g){l+=0.125}this.c.push({type:h,x:a,y:b,radius:c,xStart:l,yStart:n,xEnd:o,yEnd:f})};j.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};j.strokeRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke()};j.fillRect=function(a, +b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill()};j.createLinearGradient=function(a,b,c,d){var e=new H("gradient");return e};j.createRadialGradient=function(a,b,c,d,e,g){var h=new H("gradientradial");h.n=c;h.o=g;h.i.x=a;h.i.y=b;return h};j.drawImage=function(a,b){var c,d,e,g,h,l,n,o,f=a.runtimeStyle.width,k=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var q=a.width,r=a.height;a.runtimeStyle.width= +f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}else if(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}else if(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}var s=this.b(c,d),t=[],v=10,w=10;t.push(" ','","");this.j.insertAdjacentHTML("BeforeEnd",t.join(""))};j.stroke=function(a){var b=[],c=O(a?this.fillStyle:this.strokeStyle),d=c[0],e=c[1]*this.globalAlpha,g=10,h=10;b.push("n.x){n.x=k.x}if(l.y== +null||k.yn.y){n.y=k.y}}}b.push(' ">');if(typeof this.fillStyle=="object"){var v={x:"50%",y:"50%"},w=n.x-l.x,x=n.y-l.y,p=w>x?w:x;v.x=i(this.fillStyle.i.x/w*100+50)+"%";v.y=i(this.fillStyle.i.y/x*100+50)+"%";var y=[];if(this.fillStyle.p=="gradientradial"){var z=this.fillStyle.n/p*100,B=this.fillStyle.o/p*100-z}else{var z=0,B=100}var C={offset:null,color:null},D={offset:null,color:null};this.fillStyle.h.sort(function(T,U){return T.offset-U.offset});for(var o=0;oC.offset||C.offset==null){C.offset=u.offset;C.color=u.color}if(u.offset')}else if(a){b.push('')}else{b.push("')}b.push("");this.j.insertAdjacentHTML("beforeEnd",b.join(""));this.c=[]};j.fill=function(){this.stroke(true)};j.closePath=function(){this.c.push({type:"close"})};j.b=function(a,b){return{x:m*(a*this.a[0][0]+b*this.a[1][0]+this.a[2][0])-A,y:m*(a*this.a[0][1]+b*this.a[1][1]+this.a[2][1])-A}};j.save=function(){var a={};N(this,a); +this.k.push(a);this.m.push(this.a);this.a=G(J(),this.a)};j.restore=function(){N(this.k.pop(),this);this.a=this.m.pop()};j.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];this.a=G(c,this.a)};j.rotate=function(a){var b=M(a),c=L(a),d=[[b,c,0],[-c,b,0],[0,0,1]];this.a=G(d,this.a)};j.scale=function(a,b){this.d*=a;this.e*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];this.a=G(c,this.a)};j.clip=function(){};j.arcTo=function(){};j.createPattern=function(){return new P};function H(a){this.p=a;this.n=0;this.o= +0;this.h=[];this.i={x:0,y:0}}H.prototype.addColorStop=function(a,b){b=O(b);this.h.push({offset:1-a,color:b})};function P(){}G_vmlCanvasManager=Q;CanvasRenderingContext2D=K;CanvasGradient=H;CanvasPattern=P})()}; diff --git a/scripts/util/.svn/text-base/jquery.corner.js.svn-base b/scripts/util/.svn/text-base/jquery.corner.js.svn-base new file mode 100644 index 0000000..a7397c8 --- /dev/null +++ b/scripts/util/.svn/text-base/jquery.corner.js.svn-base @@ -0,0 +1,253 @@ + // jquery-roundcorners-canvas + // www.meerbox.nl + +(function($){ + + var _corner = function(options) { + + // no native canvas support, or its msie and excanvas.js not loaded + var testcanvas = document.createElement("canvas"); + if (typeof G_vmlCanvasManager == 'undefined' && $.browser.msie) { + return this.each(function() {}); + } + + // get lowest number from array + var asNum = function(a, b) { return a-b; }; + var getMin = function(a) { + var b = a.concat(); + return b.sort(asNum)[0]; + }; + + // get CSS value as integer + var getCSSint = function(el, prop) { + return parseInt($.css(el.jquery?el[0]:el,prop))||0; + }; + + // draw the round corner in Canvas object + var drawRoundCornerCanvasShape = function(canvas,radius,r_type,bg_color,border_width,border_color) { + + // change rgba(1,2,3,0.9) to rgb(1,2,3) + var reg = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/; + var bits = reg.exec(bg_color); + if (bits) { + channels = new Array(parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])); + bg_color = 'rgb('+channels[0]+', '+channels[1]+', '+channels[2]+')'; + } + + var border_width = parseInt(border_width); + + var ctx = canvas.getContext('2d'); + + if (radius == 1) { + ctx.fillStyle = bg_color; + ctx.fillRect(0,0,1,1); + return; + } + + if (r_type == 'tl') { + var steps = new Array(0,0,radius,0,radius,0,0,radius,0,0); + } else if (r_type == 'tr') { + var steps = new Array(radius,0,radius,radius,radius,0,0,0,0,0); + } else if (r_type == 'bl') { + var steps = new Array(0,radius,radius,radius,0,radius,0,0,0,radius); + } else if (r_type == 'br') { + var steps = new Array(radius,radius,radius,0,radius,0,0,radius,radius,radius); + } + + ctx.fillStyle = bg_color; + ctx.beginPath(); + ctx.moveTo(steps[0],steps[1]); + ctx.lineTo(steps[2], steps[3]); + if(r_type == 'br') ctx.bezierCurveTo(steps[4], steps[5], radius, radius, steps[6], steps[7]); + else ctx.bezierCurveTo(steps[4], steps[5], 0, 0, steps[6], steps[7]); + ctx.lineTo(steps[8], steps[9]); + ctx.fill(); + + // draw border + if (border_width > 0 && border_width < radius) { + + // offset caused by border + var offset = border_width/2; + + if (r_type == 'tl') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'tr') { + var steps = new Array(radius-offset,radius-offset,radius-offset,offset,offset,offset); + var curve_to = new Array(0,0); + } else if (r_type == 'bl') { + var steps = new Array(radius-offset,radius-offset,offset,radius-offset,offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'br') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset,radius-offset,radius-offset); + var curve_to = new Array(radius, radius); + } + + ctx.strokeStyle = border_color; + ctx.lineWidth = border_width; + ctx.beginPath(); + // go to corner to begin curve + ctx.moveTo(steps[0], steps[1]); + // curve from righttop to leftbottom (for the tl canvas) + ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); + ctx.stroke(); + + } + }; + + var creatCanvas = function(p,radius) { + var elm = document.createElement('canvas'); + elm.setAttribute("height", radius); + elm.setAttribute("width", radius); + elm.style.display = "block"; + elm.style.position = "absolute"; + elm.className = "cornercanvas"; + elm = p.appendChild(elm); + // if G_vmlCanvasManager in defined the browser (ie only) has loaded excanvas.js + if (!elm.getContext && typeof G_vmlCanvasManager != 'undefined') { + var elm = G_vmlCanvasManager.initElement(elm); + } + return elm; + }; + + // interpret the (string) argument + var o = (options || "").toLowerCase(); + var radius = parseInt((o.match(/(\d+)px/)||[])[1]) || null; // corner width + var bg_color = ((o.match(/(#[0-9a-f]+)/)||[])[1]); // strip color + if (radius == null) { radius = "auto"; } + + var edges = { T:0, B:1 }; + var opts = { + tl: /top|tl/.test(o), + tr: /top|tr/.test(o), + bl: /bottom|bl/.test(o), + br: /bottom|br/.test(o) + }; + if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) { + opts = { tl:1, tr:1, bl:1, br:1 }; + } + + return this.each(function() { + + var elm = $(this); + + // give the element 'haslayout' + if ($.browser.msie) { this.style.zoom = 1; } + + // the size of the corner is not defined... + var widthheight_smallest = getMin(new Array(getCSSint(this,'height'),getCSSint(this,'width'))); + if (radius == "auto") { + radius = widthheight_smallest/4; + if (radius > 10) { radius = 10; } + } + + // the size of the corner can't be to high + if (widthheight_smallest < radius) { + radius = (widthheight_smallest/2); + } + + // remove old canvas objects + elm.children("canvas.cornercanvas").remove(); + + // some css thats required in order to position the canvas elements + if (elm.css('position') == 'static') { + elm.css('position','relative'); + // only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode + } else if (elm.css('position') == 'fixed' && $.browser.msie && !(document.compatMode == 'CSS1Compat' && typeof document.body.style.maxHeight != "undefined")) { + elm.css('position','absolute'); + } + elm.css('overflow','visible'); + + // get border width + var border_t = getCSSint(this, 'borderTopWidth'); + var border_r = getCSSint(this, 'borderRightWidth'); + var border_b = getCSSint(this, 'borderBottomWidth'); + var border_l = getCSSint(this, 'borderLeftWidth'); + + // get the lowest borderwidth of the corners in use + var bordersWidth = new Array(); + if (opts.tl || opts.tr) { bordersWidth.push(border_t); } + if (opts.br || opts.tr) { bordersWidth.push(border_r); } + if (opts.br || opts.bl) { bordersWidth.push(border_b); } + if (opts.bl || opts.tl) { bordersWidth.push(border_l); } + + borderswidth_smallest = getMin(bordersWidth); + + // creat the canvas elements and position them + var p_top = 0-border_t; + var p_right = 0-border_r; + var p_bottom = 0-border_b; + var p_left = 0-border_l; + + if (opts.tl) { var tl = $(creatCanvas(this,radius)).css({left:p_left,top:p_top}).get(0); } + if (opts.tr) { var tr = $(creatCanvas(this,radius)).css({right:p_right,top:p_top}).get(0); } + if (opts.bl) { var bl = $(creatCanvas(this,radius)).css({left:p_left,bottom:p_bottom}).get(0); } + if (opts.br) { var br = $(creatCanvas(this,radius)).css({right:p_right,bottom:p_bottom}).get(0); } + + // get the background color of parent element + + if (bg_color == undefined) { + + var current_p = elm.parent(); + var bg = current_p.css('background-color'); + while((bg == "transparent" || bg == "rgba(0, 0, 0, 0)") && current_p.get(0).tagName.toLowerCase() != "html") { + bg = current_p.css('background-color'); + current_p = current_p.parent(); + } + } else { + bg = bg_color; + } + + if (bg == "transparent" || bg == "rgba(0, 0, 0, 0)") { bg = "#ffffff"; } + + if (opts.tl) { drawRoundCornerCanvasShape(tl,radius,'tl',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.tr) { drawRoundCornerCanvasShape(tr,radius,'tr',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.bl) { drawRoundCornerCanvasShape(bl,radius,'bl',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + if (opts.br) { drawRoundCornerCanvasShape(br,radius,'br',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + + elm.addClass('roundCornersParent'); + + }); + }; + + if ($.browser.msie && typeof G_vmlCanvasManager == 'undefined') { + + var corner_buffer = new Array(); + var corner_buffer_args = new Array(); + + $.fn.corner = function(options){ + corner_buffer[corner_buffer.length] = this; + corner_buffer_args[corner_buffer_args.length] = options; + return this.each(function(){}); + }; + + // load excanvas.pack.js + document.execCommand("BackgroundImageCache", false, true); + var elm = $("script[@src*=jquery.corner.]"); + if (elm.length == 1) { + var jc_src = elm.attr('src'); + var pathArray = jc_src.split('/'); + pathArray.pop(); + var base = pathArray.join('/') || '.'; + var excanvasjs = base+'/excanvas.pack.js'; + $.getScript(excanvasjs,function(){ + execbuffer(); + }); + } + + var execbuffer = function() { + // set back function + $.fn.corner = _corner; + // execute buffer and set back function + for(var i=0;i35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(8($){p g=$.19.D,w=$.19.w;$.19.z({D:8(){4(1[0]==h)5 Z.1a||$.I&&7.10.1z||7.q.1z;4(1[0]==7)5 1t.1s(7.q.1H,7.q.13);5 g.1k(1,1h)},w:8(){4(1[0]==h)5 Z.1d||$.I&&7.10.1c||7.q.1c;4(1[0]==7)5 1t.1s(7.q.1B,7.q.11);5 w.1k(1,1h)},1a:8(){5 1[0]==h||1[0]==7?1.D():1.P(\':J\')?1[0].13-f(1,\'k\')-f(1,\'1A\'):1.D()+f(1,\'18\')+f(1,\'1y\')},1d:8(){5 1[0]==h||1[0]==7?1.w():1.P(\':J\')?1[0].11-f(1,\'j\')-f(1,\'1x\'):1.w()+f(1,\'15\')+f(1,\'1u\')},1K:8(){5 1[0]==h||1[0]==7?1.D():1.P(\':J\')?1[0].13:1.D()+f(1,\'k\')+f(1,\'1A\')+f(1,\'18\')+f(1,\'1y\')},1J:8(){5 1[0]==h||1[0]==7?1.w():1.P(\':J\')?1[0].11:1.w()+f(1,\'j\')+f(1,\'1x\')+f(1,\'15\')+f(1,\'1u\')},l:8(a){4(a!=1q)5 1.1o(8(){4(1==h||1==7)h.1m(a,$(h).n());o 1.l=a});4(1[0]==h||1[0]==7)5 Z.1G||$.I&&7.10.l||7.q.l;5 1[0].l},n:8(a){4(a!=1q)5 1.1o(8(){4(1==h||1==7)h.1m($(h).l(),a);o 1.n=a});4(1[0]==h||1[0]==7)5 Z.1F||$.I&&7.10.n||7.q.n;5 1[0].n},C:8(c,d){p a=1[0],3=a.S,6=a.R,c=$.z({Q:m,K:m,O:m,t:m},c||{}),x=a.N,y=a.M,v=a.l,u=a.n;4($.i.17||$.i.16){x+=f(a,\'j\');y+=f(a,\'k\')}4(($.i.Y||$.i.X)&&$.r(6,\'C\')!=\'W\'){x-=f(6,\'j\');y-=f(6,\'k\')}4($.i.17){B{4(3!=a&&$.r(3,\'1w\')!=\'J\'){x+=f(3,\'j\');y+=f(3,\'k\')}4(3==6)1v}H((3=3.S)&&3.s!=\'G\')}4($.i.16&&(6.s!=\'G\'&&$.r(6,\'C\')==\'W\')){B{x+=6.N;y+=6.M;x+=f(6,\'j\');y+=f(6,\'k\')}H((6=6.R)&&(6.s!=\'G\'&&$.r(6,\'C\')==\'W\'))}p b=e(a,c,x,y,v,u);4(d){$.z(d,b);5 1}o{5 b}},1I:8(b,c){p x=0,y=0,v=0,u=0,9=1[0],3=1[0],6,U,L=$.r(9,\'C\'),A=$.i.17,E=$.i.16,1p=$.i.Y,1n=$.i.X,12=m,14=m,b=$.z({Q:F,K:m,O:m,t:F,1j:m},b||{});4(b.1j)5 1.1i(b,c);4(9.s==\'G\'){x=9.N;y=9.M;4(A){x+=f(9,\'V\')+(f(9,\'j\')*2);y+=f(9,\'T\')+(f(9,\'k\')*2)}o 4(1n){x+=f(9,\'V\');y+=f(9,\'T\')}o 4(E&&1l.I){x+=f(9,\'j\');y+=f(9,\'k\')}}o{B{U=$.r(3,\'C\');x+=3.N;y+=3.M;4(A||E){x+=f(3,\'j\');y+=f(3,\'k\');4(A&&U==\'1g\')12=F;4(E&&U==\'1E\')14=F}6=3.R;4(b.t||A){B{4(b.t){v+=3.l;u+=3.n}4(A&&3!=9&&$.r(3,\'1w\')!=\'J\'){x+=f(3,\'j\');y+=f(3,\'k\')}3=3.S}H(3!=6)}3=6;4(3.s==\'G\'||3.s==\'1e\'){4((1p||(E&&$.I))&&L!=\'1g\'&&L!=\'1f\'){x+=f(3,\'V\');y+=f(3,\'T\')}4((A&&!12&&L!=\'1f\')||(E&&L==\'W\'&&!14)){x+=f(3,\'j\');y+=f(3,\'k\')}1v}}H(3)}p a=e(9,b,x,y,v,u);4(c){$.z(c,a);5 1}o{5 a}},1i:8(b,c){p x=0,y=0,v=0,u=0,3=1[0],6,b=$.z({Q:F,K:m,O:m,t:F},b||{});B{x+=3.N;y+=3.M;6=3.R;4(b.t){B{v+=3.l;u+=3.n;3=3.S}H(3!=6)}3=6}H(3&&3.s!=\'G\'&&3.s!=\'1e\');p a=e(1[0],b,x,y,v,u);4(c){$.z(c,a);5 1}o{5 a}}});p f=8(b,a){5 1D($.r(b.1C?b[0]:b,a))||0};p e=8(b,c,x,y,a,d){4(!c.Q){x-=f(b,\'V\');y-=f(b,\'T\')}4(c.K&&($.i.Y||$.i.X)){x+=f(b,\'j\');y+=f(b,\'k\')}o 4(!c.K&&!($.i.Y||$.i.X)){x-=f(b,\'j\');y-=f(b,\'k\')}4(c.O){x+=f(b,\'15\');y+=f(b,\'18\')}4(c.t){a-=b.l;d-=b.n}5 c.t?{1b:y-d,1r:x-a,n:d,l:a}:{1b:y,1r:x}}})(1l);',62,109,'|this||parent|if|return|op|document|function|elem||||||||window|browser|borderLeftWidth|borderTopWidth|scrollLeft|false|scrollTop|else|var|body|css|tagName|scroll|st|sl|width|||extend|mo|do|position|height|ie|true|BODY|while|boxModel|visible|border|elemPos|offsetTop|offsetLeft|padding|is|margin|offsetParent|parentNode|marginTop|parPos|marginLeft|static|opera|safari|self|documentElement|offsetWidth|absparent|offsetHeight|relparent|paddingLeft|msie|mozilla|paddingTop|fn|innerHeight|top|clientWidth|innerWidth|HTML|fixed|absolute|arguments|offsetLite|lite|apply|jQuery|scrollTo|oa|each|sf|undefined|left|max|Math|paddingRight|break|overflow|borderRightWidth|paddingBottom|clientHeight|borderBottomWidth|scrollWidth|jquery|parseInt|relative|pageYOffset|pageXOffset|scrollHeight|offset|outerWidth|outerHeight'.split('|'),0,{})) \ No newline at end of file diff --git a/scripts/util/.svn/text-base/jquery.prettybox.js.svn-base b/scripts/util/.svn/text-base/jquery.prettybox.js.svn-base new file mode 100644 index 0000000..df44a95 --- /dev/null +++ b/scripts/util/.svn/text-base/jquery.prettybox.js.svn-base @@ -0,0 +1,171 @@ +(function($) { + var createCanvas = function() { + var canvas = document.createElement("canvas"); + if ("G_vmlCanvasManager" in window) { + document.body.appendChild(canvas); + canvas = G_vmlCanvasManager.initElement(canvas); + } + return canvas; + }; + var DropShadow = function(backgroundColor, cornerRadius, shadowRadius, shadowOffset, shadowAlpha) { + this.backgroundColor = backgroundColor; + this.cornerRadius = cornerRadius; + this.shadowRadius = Math.max(cornerRadius, shadowRadius); + this.shadowOffset = shadowOffset; + this.shadowAlpha = shadowAlpha; + + this.elmt = createCanvas();//document.createElement("canvas"); + this.elmt.style.position = "absolute"; + }; + + DropShadow.prototype = { + draw: function() { + var darkColor = "rgba(128,128,128," + this.shadowAlpha + ")"; + var lightColor = "rgba(128,128,128,0)"; + + var cornerRadius = this.cornerRadius; + var shadowRadius = this.shadowRadius; + var radiusDiff = shadowRadius - cornerRadius; + var innerWidth = this.width - 2 * cornerRadius; + var innerHeight = this.height - 2 * cornerRadius; + + var ctx = this.elmt.getContext("2d"); + ctx.translate(this.shadowRadius, this.shadowRadius); + ctx.globalCompositeOperation = "copy"; + + /* + * Inside + */ + ctx.fillStyle = darkColor; + ctx.fillRect(-cornerRadius, -cornerRadius, this.width, this.height); + + /* + * Corners + */ + if (true) { + // top left + ctx.fillStyle = this._createRadialGradient(ctx, 0, 0, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(-shadowRadius, -shadowRadius, shadowRadius, shadowRadius); + + // top right + ctx.fillStyle = this._createRadialGradient(ctx, innerWidth, 0, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(innerWidth, -shadowRadius, shadowRadius, shadowRadius); + + // bottom right + ctx.fillStyle = this._createRadialGradient(ctx, innerWidth, innerHeight, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(innerWidth, innerHeight, shadowRadius, shadowRadius); + + // bottom left + ctx.fillStyle = this._createRadialGradient(ctx, 0, innerHeight, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(-shadowRadius, innerHeight, shadowRadius, shadowRadius); + } + + /* + * Edges + */ + if (true) { + // top + ctx.fillStyle = this._createLinearGradient(ctx, 0, -cornerRadius, 0, -shadowRadius, darkColor, lightColor); + ctx.fillRect(0, -shadowRadius, innerWidth, radiusDiff); + + // right + ctx.fillStyle = this._createLinearGradient(ctx, innerWidth + cornerRadius, 0, innerWidth + shadowRadius, 0, darkColor, lightColor); + ctx.fillRect(innerWidth + cornerRadius, 0, radiusDiff, innerHeight); + + // bottom + ctx.fillStyle = this._createLinearGradient(ctx, 0, innerHeight + cornerRadius, 0, innerHeight + shadowRadius, darkColor, lightColor); + ctx.fillRect(0, innerHeight + cornerRadius, innerWidth, radiusDiff); + + // left + ctx.fillStyle = this._createLinearGradient(ctx, -radiusDiff, 0, -shadowRadius, 0, darkColor, lightColor); + ctx.fillRect(-shadowRadius, 0, radiusDiff, innerHeight); + } + + /* + * Foreground + */ + if (true) { + ctx.translate(-this.shadowOffset, -this.shadowOffset); + + var curvy = 0.5; + + ctx.moveTo(-cornerRadius, 0); + ctx.bezierCurveTo( + -cornerRadius, -cornerRadius * (1 - curvy), + -cornerRadius * (1 - curvy), -cornerRadius, + 0, -cornerRadius); + + ctx.lineTo(innerWidth, -cornerRadius); + ctx.bezierCurveTo( + innerWidth + cornerRadius * (1 - curvy), -cornerRadius, + innerWidth + cornerRadius, -cornerRadius * (1 - curvy), + innerWidth + cornerRadius, 0); + + ctx.lineTo(innerWidth + cornerRadius, innerHeight); + ctx.bezierCurveTo( + innerWidth + cornerRadius, innerHeight + cornerRadius * (1 - curvy), + innerWidth + cornerRadius * (1 - curvy), innerHeight + cornerRadius, + innerWidth, innerHeight + cornerRadius); + + ctx.lineTo(0, innerHeight + cornerRadius); + ctx.bezierCurveTo( + -cornerRadius * (1 - curvy), innerHeight + cornerRadius, + -cornerRadius, innerHeight + cornerRadius * (1 - curvy), + -cornerRadius, innerHeight); + + ctx.closePath(); + + ctx.fillStyle = this.backgroundColor; + ctx.fill(); + } + }, + move: function(left, top, width, height) { + this.left = left; + this.top = top; + this.width = width; + this.height = height; + + var radiusDiff = this.shadowRadius - this.cornerRadius; + var elmt = this.elmt; + elmt.style.top = (this.top - radiusDiff + this.shadowOffset) + "px"; + elmt.style.left = (this.left - radiusDiff + this.shadowOffset) + "px"; + elmt.style.width = (this.width + 2 * radiusDiff) + "px"; + elmt.style.height = (this.height + 2 * radiusDiff) + "px"; + elmt.width = this.width + 2 * radiusDiff; + elmt.height = this.height + 2 * radiusDiff; + + this.draw(); + }, + _createRadialGradient: function(ctx, x, y, r1, r2, darkColor, lightColor) { + var g = ctx.createRadialGradient(x, y, r1, x, y, r2); + g.addColorStop(0, darkColor); + g.addColorStop(1, lightColor); + return g; + }, + _createLinearGradient: function(ctx, x1, y1, x2, y2, darkColor, lightColor) { + var g = ctx.createLinearGradient(x1, y1, x2, y2); + g.addColorStop(0, darkColor); + g.addColorStop(1, lightColor); + return g; + } + }; + + $.fn.extend({ + prettybox: function(cornerRadius, shadowRadius, shadowOffset, shadowAlpha) { + this.each(function() { + var elem = $(this); + var bgColor = elem.css('background-color'); + var positions = elem.position(); + var pbox = new DropShadow(bgColor, cornerRadius, shadowRadius, + shadowOffset, shadowAlpha); + elem.parent().append(pbox.elmt); + pbox.move(positions.left, positions.top, + elem.outerWidth(), elem.outerHeight()); + elem.css('background', 'transparent'); + elem.css('border', '0px'); + }); + return this; + } + }); + +}) (jQuery); diff --git a/scripts/util/.svn/text-base/jquery.simile.js.svn-base b/scripts/util/.svn/text-base/jquery.simile.js.svn-base new file mode 100644 index 0000000..19c196c --- /dev/null +++ b/scripts/util/.svn/text-base/jquery.simile.js.svn-base @@ -0,0 +1,118 @@ +/** + * This code implements the Simile jQuery plugin, which in turns simply + * provides several convenient and useful functions for manipulating the + * DOM, etc. + * @overview Simile jQuery plugin + */ + +jQuery.extend({ + /** + * Simply capitalizes the first letter of each word in its argument. + */ + capitalize: function(s) { + return s.charAt(0).toUpperCase() + s.substring(1).toLowerCase(); + }, + /** + * Provides a basic mechanism for Javascript inheritance. + */ + inherit: function(subclass, superclass) { + function Dummy() {}; + Dummy.prototype = superclass.prototype; + subclass.prototype = new Dummy(); + subclass.prototype.constructor = subclass; + subclass.superclass = superclass; + subclass.superproto = superclass.prototype; + }, + /** + * Recursively deep-copies the given object. + */ + clone: function(obj, deep) { + if (deep == null) { deep = true; } + var objectClone = new obj.constructor(); + for (var property in obj) { + if (!deep) { + objectClone[property] = obj[property]; + } else if (typeof obj[property] == 'object') { + objectClone[property] = obj[property].clone(deep); + } else { + objectClone[property] = obj[property]; + } + } + return objectClone; + }, + /** + * Returns the width of the scrollbar. + */ + scrollWidth: function() { + var scr = null; + var inn = null; + var wNoScroll = 0; + var wScroll = 0; + + // Outer scrolling div + scr = document.createElement('div'); + scr.style.position = 'absolute'; + scr.style.top = '-1000px'; + scr.style.left = '-1000px'; + scr.style.width = '100px'; + scr.style.height = '50px'; + // Start with no scrollbar + scr.style.overflow = 'hidden'; + + // Inner content div + inn = document.createElement('div'); + inn.style.width = '100%'; + inn.style.height = '200px'; + + // Put the inner div in the scrolling div + scr.appendChild(inn); + // Append the scrolling div to the doc + document.body.appendChild(scr); + + // Width of the inner div sans scrollbar + wNoScroll = inn.offsetWidth; + // Add the scrollbar + scr.style.overflow = 'auto'; + // Width of the inner div width scrollbar + wScroll = inn.offsetWidth; + + // Remove the scrolling div from the doc + document.body.removeChild( + document.body.lastChild); + + // Pixel width of the scroller, with an awful, awful hack + // FIXME: Fix hardcoded scrollwidth + return (wNoScroll - wScroll) || 17; + } +}); + +jQuery.fn.extend({ + /** + * The attrs method extends jQuery to allow for aggregating attributes of + * all matched elements in a $('..') expression into a nice hash. It also + * supports only returning attributes within a certain namespace, e.g. + * ex:role, when provided with the namespace prefix as an argument. + */ + attrs: function(ns) { + // Caching the compiled regex speeds this up a bit + if (!this.__namespaceRegexps) { + this.__namespaceRegexps = {}; + } + var regexp = this.__namespaceRegexps[ns]; + if (!regexp) { + this.__namespaceRegexps[ns] = regexp = + ns ? eval("/^" + ns + ":(.+)/") : /^([^:]*)$/; + } + var result = {}; + this.each(function() { + // Within this loop, 'this' refers to each matched DOM element + var atts = this.attributes; + var l = atts.length; + for (var i = 0; i < l; i++) { + var m = atts[i].name.match(regexp); + if (m) { result[m[1]] = atts[i].value; } + } + }); + return result; + } +}); diff --git a/scripts/util/.svn/text-base/util.js.svn-base b/scripts/util/.svn/text-base/util.js.svn-base new file mode 100644 index 0000000..4c319c7 --- /dev/null +++ b/scripts/util/.svn/text-base/util.js.svn-base @@ -0,0 +1,47 @@ +/****************************************************************************** + * Utility Functions + *****************************************************************************/ + +Timegrid.abstract = function(name) { + return function() { + throw "A " + name + " method has not been implemented!"; + return; + }; +}; + +SimileAjax.DateTime.Interval = function(ms) { + // Conversion factors as varants to eliminate all the multiplication + var SECONDS_CF = 1000; + var MINUTES_CF = 60000; + var HOURS_CF = 3600000; + var DAYS_CF = 86400000; + var WEEKS_CF = 604800000; + var FORTNIGHTS_CF = 1209600000; + var MONTHS_CF = 2592000000; + var QUARTERS_CF = 7776000000; + var YEARS_CF = 31557600000; + var DECADES_CF = 315576000000; + var CENTURIES_CF = 3155760000000; + + this.milliseconds = Math.abs(ms); + this.seconds = Math.round(this.milliseconds / SECONDS_CF); + this.minutes = Math.round(this.milliseconds / MINUTES_CF); + this.hours = Math.round(this.milliseconds / HOURS_CF); + this.days = Math.floor(this.milliseconds / DAYS_CF); + this.weeks = Math.round(this.milliseconds / WEEKS_CF); + this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); + this.months = Math.round(this.milliseconds / MONTHS_CF); + // rounding errors! + this.quarters = Math.round(this.milliseconds / QUARTERS_CF); + // rounding errors! + this.years = Math.round(this.milliseconds / YEARS_CF); + // rounding errors! + this.decades = Math.round(this.milliseconds / DECADES_CF); + // rounding errors! + this.centuries = Math.round(this.milliseconds / CENTURIES_CF); + // rounding errors! +}; + +SimileAjax.DateTime.Interval.prototype.toString = function() { + return this.milliseconds.toString(); +}; diff --git a/scripts/util/date.js b/scripts/util/date.js new file mode 100644 index 0000000..1c156c1 --- /dev/null +++ b/scripts/util/date.js @@ -0,0 +1,567 @@ +/** + * Copyright (c)2005-2007 Matt Kruse (javascripttoolbox.com) + * + * Dual licensed under the MIT and GPL licenses. + * This basically means you can use this code however you want for + * free, but don't claim to have written it yourself! + * Donations always accepted: http://www.JavascriptToolbox.com/donate/ + * + * Please do not link to the .js files on javascripttoolbox.com from + * your site. Copy the files locally to your server instead. + * + * Modified by Mason Tang, SIMILE Project, 2007 + * - Changed behavior of format and parse for AM/PM, behavior of 'a' is now + * bound to 'A', while 'a' will print a lowercase 'am/pm'. + */ +/* +Date functions + +These functions are used to parse, format, and manipulate Date objects. +See documentation and examples at http://www.JavascriptToolbox.com/lib/date/ + +*/ +Date.$VERSION = 1.02; + +// Utility function to append a 0 to single-digit numbers +Date.LZ = function(x) {return(x<0||x>9?"":"0")+x}; + +/** + * Parse a string and convert it to a Date object. + * If no format is passed, try a list of common formats. + * If string cannot be parsed, return null. + * Avoids regular expressions to be more portable. + */ +Date.parseString = function(val, format) { + // If no format is specified, try a few common formats + if (typeof(format)=="undefined" || format==null || format=="") { + var generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d','MMM-d','d-MMM'); + var monthFirst=new Array('M/d/y','M-d-y','M.d.y','M/d','M-d'); + var dateFirst =new Array('d/M/y','d-M-y','d.M.y','d/M','d-M'); + var checkList=new Array(generalFormats,Date.preferAmericanFormat?monthFirst:dateFirst,Date.preferAmericanFormat?dateFirst:monthFirst); + for (var i=0; i=minlength; x--) { + var token=str.substring(i,i+x); + if (token.length < minlength) { + return null; + } + if (this.isInteger(token)) { + return token; + } + } + return null; + }; + val=val+""; + format=format+""; + var i_val=0; + var i_format=0; + var c=""; + var token=""; + var token2=""; + var x,y; + var year=new Date().getFullYear(); + var month=1; + var date=1; + var hh=0; + var mm=0; + var ss=0; + var ampm=""; + while (i_format < format.length) { + // Get next token from format string + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + // Extract contents of value based on format token + if (token=="yyyy" || token=="yy" || token=="y") { + if (token=="yyyy") { + x=4;y=4; + } + if (token=="yy") { + x=2;y=2; + } + if (token=="y") { + x=2;y=4; + } + year=this.getInt(val,i_val,x,y); + if (year==null) { + return null; + } + i_val += year.length; + if (year.length==2) { + if (year > 70) { + year=1900+(year-0); + } + else { + year=2000+(year-0); + } + } + } + else if (token=="MMM" || token=="NNN"){ + month=0; + var names = (token=="MMM"?(Date.l10n.monthNames.concat(Date.l10n.monthAbbreviations)):Date.l10n.monthAbbreviations); + for (var i=0; i12)){ + return null; + } + } + else if (token=="EE"||token=="E"){ + var names = (token=="EE"?Date.l10n.dayNames:Date.l10n.dayAbbreviations); + for (var i=0; i12)){ + return null; + } + i_val+=month.length; + } + else if (token=="dd"||token=="d") { + date=this.getInt(val,i_val,token.length,2); + if(date==null||(date<1)||(date>31)){ + return null; + } + i_val+=date.length; + } + else if (token=="hh"||token=="h") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>12)){ + return null; + } + i_val+=hh.length; + } + else if (token=="HH"||token=="H") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>23)){ + return null; + } + i_val+=hh.length; + } + else if (token=="KK"||token=="K") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>11)){ + return null; + } + i_val+=hh.length; + hh++; + } + else if (token=="kk"||token=="k") { + hh=this.getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>24)){ + return null; + } + i_val+=hh.length; + hh--; + } + else if (token=="mm"||token=="m") { + mm=this.getInt(val,i_val,token.length,2); + if(mm==null||(mm<0)||(mm>59)){ + return null; + } + i_val+=mm.length; + } + else if (token=="ss"||token=="s") { + ss=this.getInt(val,i_val,token.length,2); + if(ss==null||(ss<0)||(ss>59)){ + return null; + } + i_val+=ss.length; + } + else if (token=="A") { + if (val.substring(i_val,i_val+2).toLowerCase()=="am") { + ampm="AM"; + } + else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") { + ampm="PM"; + } + else { + return null; + } + i_val+=2; + } + else { + if (val.substring(i_val,i_val+token.length)!=token) { + return null; + } + else { + i_val+=token.length; + } + } + } + // If there are any trailing characters left in the value, it doesn't match + if (i_val != val.length) { + return null; + } + // Is date valid for month? + if (month==2) { + // Check for leap year + if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year + if (date > 29){ + return null; + } + } + else { + if (date > 28) { + return null; + } + } + } + if ((month==4)||(month==6)||(month==9)||(month==11)) { + if (date > 30) { + return null; + } + } + // Correct hours value + if (hh<12 && ampm=="PM") { + hh=hh-0+12; + } + else if (hh>11 && ampm=="AM") { + hh-=12; + } + return new Date(year,month-1,date,hh,mm,ss); +}; + +(function() { + /** + * Adds a given method under the given name + * to the Date prototype if it doesn't + * currently exist. + * + * @private + */ + function add(name, method) { + if( !Date.prototype[name] ) { + Date.prototype[name] = method; + } + }; + + add('getFullYear', function() { + var yy=this.getYear(); + return (yy<1900?yy+1900:yy); + }); + + /** + * Check if a date string is valid + */ + add('isValid', function(val, format) { + return (Date.parseString(val,format) != null); + }); + + /** + * Check if a date object is before another date object + */ + add('isBefore', function(date2) { + if (date2==null) { + return false; + } + return (this.getTime()date2.getTime()); + }); + + /** + * Check if a date object is between two dates + */ + add('isBetween', function(date1, date2) { + return this.isAfter(date1) && this.isBefore(date2); + }); + + /** + * Check if two date objects have equal dates and times + */ + add('equals', function(date2) { + if (date2==null) { + return false; + } + return (this.getTime()==date2.getTime()); + }); + + /** + * Check if two date objects have equal dates, disregarding times + */ + add('equalsIgnoreTime', function(date2) { + if (date2==null) { + return false; + } + var d1 = new Date(this.getTime()).clearTime(); + var d2 = new Date(date2.getTime()).clearTime(); + return (d1.getTime()==d2.getTime()); + }); + + /** + * Format a date into a string using a given format string + */ + add('format', function(format) { + format=format+""; + var result=""; + var i_format=0; + var c=""; + var token=""; + var y=this.getYear()+""; + var M=this.getMonth()+1; + var d=this.getDate(); + var E=this.getDay(); + var H=this.getHours(); + var m=this.getMinutes(); + var s=this.getSeconds(); + var w=this.getWeekOfYear(); + var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; + // Convert real date parts into formatted versions + var value=new Object(); + if (y.length < 4) { + y=""+(+y+1900); + } + value["y"]=""+y; + value["yyyy"]=y; + value["yy"]=y.substring(2,4); + value["M"]=M; + value["MM"]=Date.LZ(M); + value["MMM"]=Date.l10n.monthNames[M-1]; + value["NNN"]=Date.l10n.monthAbbreviations[M-1]; + value["d"]=d; + value["dd"]=Date.LZ(d); + value["E"]=Date.l10n.dayAbbreviations[E]; + value["EE"]=Date.l10n.dayNames[E]; + value["e"]=value["E"].substr(0,1); + value["H"]=H; + value["HH"]=Date.LZ(H); + if (H==0){ + value["h"]=12; + } + else if (H>12){ + value["h"]=H-12; + } + else { + value["h"]=H; + } + value["hh"]=Date.LZ(value["h"]); + value["K"]=value["h"]-1; + value["k"]=value["H"]+1; + value["KK"]=Date.LZ(value["K"]); + value["kk"]=Date.LZ(value["k"]); + if (H > 11) { + value["A"]="PM"; + value["a"]="pm"; + } + else { + value["A"]="AM"; + value["a"]="am"; + } + value["m"]=m; + value["mm"]=Date.LZ(m); + value["s"]=s; + value["ss"]=Date.LZ(s); + value["w"]=w; + while (i_format < format.length) { + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + if (typeof(value[token])!="undefined") { + result=result + value[token]; + } + else { + result=result + token; + } + } + return result; + }); + + /** + * Get the full name of the day for a date + */ + add('getDayName', function() { + return Date.l10n.dayNames[this.getDay()]; + }); + + /** + * Get the abbreviation of the day for a date + */ + add('getDayAbbreviation', function() { + return Date.l10n.dayAbbreviations[this.getDay()]; + }); + + /** + * Get the full name of the month for a date + */ + add('getMonthName', function() { + return Date.l10n.monthNames[this.getMonth()]; + }); + + /** + * Get the abbreviation of the month for a date + */ + add('getMonthAbbreviation', function() { + return Date.l10n.monthAbbreviations[this.getMonth()]; + }); + + /** + * Get the number of the week of the year. + * + * @example var dtm = new Date("01/12/2008"); + * dtm.getWeekOfYear(); + * @result 2 + * + * @name getWeekOfYear + * @type Number + * @cat Plugins/Methods/Date + */ + add("getWeekOfYear", function() { + dowOffset = Date.l10n.firstDayOfWeek; + var newYear = new Date(this.getFullYear(),0,1); + var day = newYear.getDay() - dowOffset; //the day of week the year begins on + day = (day >= 0 ? day : day + 7); + var daynum = Math.floor((this.getTime() - newYear.getTime() - + (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1; + var weeknum; + //if the year starts before the middle of a week + if(day < 4) { + weeknum = Math.floor((daynum+day-1)/7) + 1; + if(weeknum > 52) { + nYear = new Date(this.getFullYear() + 1,0,1); + nday = nYear.getDay() - dowOffset; + nday = nday >= 0 ? nday : nday + 7; + /*if the next year starts before the middle of + the week, it is week #1 of that year*/ + weeknum = nday < 4 ? 1 : 53; + } + } else { + weeknum = Math.floor((daynum+day-1)/7); + } + return weeknum; + }); + + /** + * Given a timezone offset in hours, returns a new Date object that has + * been adjusted to that timezone. + * + * @function + * @memberOf Date + * @param {Number} timezoneOffset the timezone offset in hours + * @return {Date} a new Date object + */ + add('toTimezone', function(timezoneOffset) { + var minutesToMs = 60000; var hoursToMs = 60 * minutesToMs; + var utcMs = this.getTime() + (this.getTimezoneOffset() * minutesToMs); + var offsetMs = hoursToMs * timezoneOffset; + return new Date(utcMs + offsetMs); + }); + + /** + * Clear all time information in a date object + */ + add('clearTime', function() { + this.setHours(0); + this.setMinutes(0); + this.setSeconds(0); + this.setMilliseconds(0); + return this; + }); + + /** + * Clones this date into a new object, optionally modifying the provided + * instance instead. + */ + add('clone', function(date) { + if (date && date instanceof Date) { + date.setTime(this.getTime()); + return date; + } else { + return new Date(this); + } + }); + + /** + * Set the day of the week of the date within this same week + */ + add('setDay', function(n) { + var day = this.getDay(); + if (day == n) { return this; } + if (n == 7) { this.add('d', 7); return this.setDay(0); } + if (day < n) { this.add('d', 1); return this.setDay(n); } + if (day > n) { this.add('d', -1); return this.setDay(n); } + }); + + /** + * Add an amount of time to a date. Negative numbers can be passed to + * subtract time. + */ + add('add', function(interval, number) { + if (typeof(interval)=="undefined" || interval==null || typeof(number)=="undefined" || number==null) { + return this; + } + number = +number; + if (interval=='y') { // year + this.setFullYear(this.getFullYear()+number); + } + else if (interval=='M') { // Month + this.setMonth(this.getMonth()+number); + } + else if (interval=='d') { // Day + this.setDate(this.getDate()+number); + } + else if (interval=='w') { // Weekday + var step = (number>0)?1:-1; + while (number!=0) { + this.add('d',step); + while(this.getDay()==0 || this.getDay()==6) { + this.add('d',step); + } + number -= step; + } + } + else if (interval=='h') { // Hour + this.setHours(this.getHours() + number); + } + else if (interval=='m') { // Minute + this.setMinutes(this.getMinutes() + number); + } + else if (interval=='s') { // Second + this.setSeconds(this.getSeconds() + number); + } + return this; + }); + +})(); diff --git a/scripts/util/debug.js b/scripts/util/debug.js new file mode 100644 index 0000000..ce569f6 --- /dev/null +++ b/scripts/util/debug.js @@ -0,0 +1,16 @@ +/*================================================== + * Debug Utility Functions + *================================================== + */ + +Timegrid.Debug = new Object(); + +Timegrid.Debug.log = function(msg) { +}; + +Timegrid.Debug.exception = function(e) { + e = SimileAjax.Platform.isIE ? e.message : e; + SimileAjax.Debug.exception(e, "Caught exception"); + //alert("Caught exception: " + (SimileAjax.Platform.isIE ? e.message : e)); +}; + diff --git a/scripts/util/dstructs/.svn/all-wcprops b/scripts/util/dstructs/.svn/all-wcprops new file mode 100644 index 0000000..74e7805 --- /dev/null +++ b/scripts/util/dstructs/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 87 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs +END +dstructs.js +K 25 +svn:wc:ra_dav:version-url +V 99 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/dstructs.js +END diff --git a/scripts/util/dstructs/.svn/entries b/scripts/util/dstructs/.svn/entries new file mode 100644 index 0000000..d7ace33 --- /dev/null +++ b/scripts/util/dstructs/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +tests +dir + +dstructs.js +file + + + + +2012-02-03T21:55:34.000000Z +4f728ed935ccb3eed4902183c0bdff3d +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +5724 + +docs +dir + diff --git a/scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base b/scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base new file mode 100644 index 0000000..71c2b7e --- /dev/null +++ b/scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2007 Mason Tang + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +DStructs = {}; + +DStructs.Array = function() { + // Clean, slightly slow method of extending Array + var x = [], a = arguments; + for (var i = 0; i < a.length; i++) { + if (a[i] instanceof Array) { + + } else { + x.push(a[i]); + } + } + for (var i in this) { x[i] = this[i]; } + return x; +}; +DStructs.Array.prototype = new Array(); + +// We need to rewrite a few Array methods to return DStructs.Array objects +DStructs.Array.prototype.slice = function(start, end) { + if (start < 0) { start = this.length + start; } + if (end == null) { end = this.length; } + else if (end < 0) { end = this.length + end; } + var a = new DStructs.Array(); + for (var i = start; i < end; i++) { a.push(this[i]); } + return a; +}; +DStructs.Array.prototype.concat = function() { + var arrays = arguments; + var result = this.clone(); + for (var i = 0; i < arrays.length; i++) { + if (arrays[i] instanceof Array) { + result.addAll(arrays[i]); + } + } + return result; +}; +DStructs.Array.prototype.addAll = function(a) { + for (var i = 0; i < a.length; i++) { + this.push(a[i]); + } + return this; +}; +DStructs.Array.prototype.map_i = function(f) { + var self = this; + return this.each(function(e, i) { self[i] = f(e, i); }); +}; +DStructs.Array.prototype.map = function(f) { + var clone = new DStructs.Array(); + this.each(function(e, i) { clone.push(f(e, i)); }); + return clone; +}; +DStructs.Array.prototype.filter = function(f) { + var clone = new DStructs.Array(); + this.each(function(e, i) { if (f(e, i)) { clone.push(e); } }); + return clone; +}; +DStructs.Array.prototype.filter_i = function(f) { + +}; +DStructs.Array.prototype.each = function(f) { + for (var i = 0; i < this.length; i++) { + f(this[i], i); + } + return this; +}; +DStructs.Array.prototype.reduce = function(init, f) { + for (var i = 0, len = this.length, result = init; i < len; i++) { + result = f.call(this, result, this[i]); + } + return result; +}; +DStructs.Array.prototype.zip = function() { + +}; +DStructs.Array.prototype.indexOf = function(obj) { + var indices = this.indicesOf(obj); + if (!indices.empty()) { return indices[0]; } + return -1; +}; +DStructs.Array.prototype.indicesOf = function(obj) { + var indices = new DStructs.Array(); + this.each(function(e, i) { if (obj == e) { indices.push(i); } }); + return indices; +}; +DStructs.Array.prototype.remove = function(obj) { + var removed = 0; + while (this.contains(obj)) { + } + return removed; +}; +DStructs.Array.prototype.contains = function(obj) { + return this.indexOf(obj) >= 0; +}; +DStructs.Array.prototype.uniq_i = function() { + var hash = new DStructs.Hash(); + var indices = new DStructs.Array(); + var self = this; + this.each(function(e, i) { + if (hash.contains(e)) { + indices.push(i); + } else { + hash.put(e, i); + } + }); + return this; +}; +DStructs.Array.prototype.uniq = function() { + var hash = new DStructs.Hash(); + this.each(function(e) { hash.put(e, e); }); + return hash.values(); +}; +DStructs.Array.prototype.empty = function() { + return this.length == 0; +}; +DStructs.Array.prototype.clear = function() { + this.length = 0; +}; +DStructs.Array.prototype.clone = function() { + var clone = new DStructs.Array(); + this.each(function(e) { clone.push(e); }); + return clone; +}; +DStructs.Array.prototype.iterator = function() { + return new DStructs.Iterator(this); +}; + +DStructs.Iterator = function(items) { + var index = 0; + this.hasNext = function() { + return index < items.length; + }; + this.next = function() { + index++; + return items[index - 1]; + }; +}; + + +DStructs.Hash = function() { + var dataStore = {}; + var count; + + this.put = function(key, value) { + var success = !(key in dataStore); + dataStore[key] = value; + if (success) { count++; } + return success; + }; + + this.contains = function(key) { + return key in dataStore; + }; + + this.size = function() { + return count; + }; + + this.each = function(f) { + for (var key in dataStore) { + f(dataStore[key], key); + } + return this; + }; + + this.values = function() { + var values = new DStructs.Array(); + this.each(function(v, k) { values.push(v); }); + return values; + }; + + this.keys = function() { + var keys = new DStructs.Array(); + this.each(function(v, k) { keys.push(k); }); + return keys; + }; + +}; diff --git a/scripts/util/dstructs/docs/.svn/all-wcprops b/scripts/util/dstructs/docs/.svn/all-wcprops new file mode 100644 index 0000000..43b02ff --- /dev/null +++ b/scripts/util/dstructs/docs/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 92 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/docs +END diff --git a/scripts/util/dstructs/docs/.svn/entries b/scripts/util/dstructs/docs/.svn/entries new file mode 100644 index 0000000..304d2f1 --- /dev/null +++ b/scripts/util/dstructs/docs/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/docs +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + diff --git a/scripts/util/dstructs/dstructs.js b/scripts/util/dstructs/dstructs.js new file mode 100644 index 0000000..71c2b7e --- /dev/null +++ b/scripts/util/dstructs/dstructs.js @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2007 Mason Tang + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +DStructs = {}; + +DStructs.Array = function() { + // Clean, slightly slow method of extending Array + var x = [], a = arguments; + for (var i = 0; i < a.length; i++) { + if (a[i] instanceof Array) { + + } else { + x.push(a[i]); + } + } + for (var i in this) { x[i] = this[i]; } + return x; +}; +DStructs.Array.prototype = new Array(); + +// We need to rewrite a few Array methods to return DStructs.Array objects +DStructs.Array.prototype.slice = function(start, end) { + if (start < 0) { start = this.length + start; } + if (end == null) { end = this.length; } + else if (end < 0) { end = this.length + end; } + var a = new DStructs.Array(); + for (var i = start; i < end; i++) { a.push(this[i]); } + return a; +}; +DStructs.Array.prototype.concat = function() { + var arrays = arguments; + var result = this.clone(); + for (var i = 0; i < arrays.length; i++) { + if (arrays[i] instanceof Array) { + result.addAll(arrays[i]); + } + } + return result; +}; +DStructs.Array.prototype.addAll = function(a) { + for (var i = 0; i < a.length; i++) { + this.push(a[i]); + } + return this; +}; +DStructs.Array.prototype.map_i = function(f) { + var self = this; + return this.each(function(e, i) { self[i] = f(e, i); }); +}; +DStructs.Array.prototype.map = function(f) { + var clone = new DStructs.Array(); + this.each(function(e, i) { clone.push(f(e, i)); }); + return clone; +}; +DStructs.Array.prototype.filter = function(f) { + var clone = new DStructs.Array(); + this.each(function(e, i) { if (f(e, i)) { clone.push(e); } }); + return clone; +}; +DStructs.Array.prototype.filter_i = function(f) { + +}; +DStructs.Array.prototype.each = function(f) { + for (var i = 0; i < this.length; i++) { + f(this[i], i); + } + return this; +}; +DStructs.Array.prototype.reduce = function(init, f) { + for (var i = 0, len = this.length, result = init; i < len; i++) { + result = f.call(this, result, this[i]); + } + return result; +}; +DStructs.Array.prototype.zip = function() { + +}; +DStructs.Array.prototype.indexOf = function(obj) { + var indices = this.indicesOf(obj); + if (!indices.empty()) { return indices[0]; } + return -1; +}; +DStructs.Array.prototype.indicesOf = function(obj) { + var indices = new DStructs.Array(); + this.each(function(e, i) { if (obj == e) { indices.push(i); } }); + return indices; +}; +DStructs.Array.prototype.remove = function(obj) { + var removed = 0; + while (this.contains(obj)) { + } + return removed; +}; +DStructs.Array.prototype.contains = function(obj) { + return this.indexOf(obj) >= 0; +}; +DStructs.Array.prototype.uniq_i = function() { + var hash = new DStructs.Hash(); + var indices = new DStructs.Array(); + var self = this; + this.each(function(e, i) { + if (hash.contains(e)) { + indices.push(i); + } else { + hash.put(e, i); + } + }); + return this; +}; +DStructs.Array.prototype.uniq = function() { + var hash = new DStructs.Hash(); + this.each(function(e) { hash.put(e, e); }); + return hash.values(); +}; +DStructs.Array.prototype.empty = function() { + return this.length == 0; +}; +DStructs.Array.prototype.clear = function() { + this.length = 0; +}; +DStructs.Array.prototype.clone = function() { + var clone = new DStructs.Array(); + this.each(function(e) { clone.push(e); }); + return clone; +}; +DStructs.Array.prototype.iterator = function() { + return new DStructs.Iterator(this); +}; + +DStructs.Iterator = function(items) { + var index = 0; + this.hasNext = function() { + return index < items.length; + }; + this.next = function() { + index++; + return items[index - 1]; + }; +}; + + +DStructs.Hash = function() { + var dataStore = {}; + var count; + + this.put = function(key, value) { + var success = !(key in dataStore); + dataStore[key] = value; + if (success) { count++; } + return success; + }; + + this.contains = function(key) { + return key in dataStore; + }; + + this.size = function() { + return count; + }; + + this.each = function(f) { + for (var key in dataStore) { + f(dataStore[key], key); + } + return this; + }; + + this.values = function() { + var values = new DStructs.Array(); + this.each(function(v, k) { values.push(v); }); + return values; + }; + + this.keys = function() { + var keys = new DStructs.Array(); + this.each(function(v, k) { keys.push(k); }); + return keys; + }; + +}; diff --git a/scripts/util/dstructs/tests/.svn/all-wcprops b/scripts/util/dstructs/tests/.svn/all-wcprops new file mode 100644 index 0000000..09d219f --- /dev/null +++ b/scripts/util/dstructs/tests/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 93 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/tests +END +testpage.html +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/tests/testpage.html +END +array-tests.html +K 25 +svn:wc:ra_dav:version-url +V 110 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/tests/array-tests.html +END +hash-tests.html +K 25 +svn:wc:ra_dav:version-url +V 109 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/tests/hash-tests.html +END +array-tests.js +K 25 +svn:wc:ra_dav:version-url +V 108 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/tests/array-tests.js +END diff --git a/scripts/util/dstructs/tests/.svn/entries b/scripts/util/dstructs/tests/.svn/entries new file mode 100644 index 0000000..0b92c89 --- /dev/null +++ b/scripts/util/dstructs/tests/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/scripts/util/dstructs/tests +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +testpage.html +file + + + + +2012-02-03T21:55:34.000000Z +22f4877164a266064da4750ef2042456 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +174 + +array-tests.html +file + + + + +2012-02-03T21:55:34.000000Z +cfc730ca8fd0b61896c6f2b256765c86 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +512 + +hash-tests.html +file + + + + +2012-02-03T21:55:34.000000Z +d41d8cd98f00b204e9800998ecf8427e +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +0 + +array-tests.js +file + + + + +2012-02-03T21:55:34.000000Z +37c8aefdb10a7bcea02f4e8465de8585 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +907 + diff --git a/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base b/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base new file mode 100644 index 0000000..333cc54 --- /dev/null +++ b/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base @@ -0,0 +1,13 @@ + + + + + DStructs Array Tests + + + + + + + diff --git a/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base b/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base new file mode 100644 index 0000000..5800710 --- /dev/null +++ b/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base @@ -0,0 +1,29 @@ +function setUp() { + testArray = new DStructs.Array(1, 2, 3, 1); +} + +function testSlice() { + assertEquals("Wrong length!", testArray.slice(0, 1).length, 1); +} + +function testConcat() { + testArray.concat([4, 5, 6]); + assertEquals("Wrong length!", testArray.length, 7); +} + +function testReduce() { + var add = function(a, b) { return a + b; }; + var acc = function(a, b) { a.push(b); return a; }; + assertEquals("Incorrect sum!", testArray.reduce(0, add), 7); + assertEquals("Incorrect array!", testArray.reduce([], acc).length, 4); +} + +function testIndexOf() { + assertEquals("Incorrect index!", testArray.indexOf(2), 1); + assertEquals("Incorrect index!", testArray.indexOf(1), 0); + assertEquals("Incorrect index!", testArray.indexOf(22), -1); +} + +function testIndicesOf() { + assertEquals("Wrong number of indices!", testArray.indicesOf(1).length, 2); +} diff --git a/scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base b/scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base new file mode 100644 index 0000000..e69de29 diff --git a/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base b/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base new file mode 100644 index 0000000..91a3066 --- /dev/null +++ b/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base @@ -0,0 +1,8 @@ + + + DStructs Javascript Library + + + + + diff --git a/scripts/util/dstructs/tests/array-tests.html b/scripts/util/dstructs/tests/array-tests.html new file mode 100644 index 0000000..0a2693a --- /dev/null +++ b/scripts/util/dstructs/tests/array-tests.html @@ -0,0 +1,13 @@ + + + + + DStructs Array Tests + + + + + + + diff --git a/scripts/util/dstructs/tests/array-tests.js b/scripts/util/dstructs/tests/array-tests.js new file mode 100644 index 0000000..ea22b1f --- /dev/null +++ b/scripts/util/dstructs/tests/array-tests.js @@ -0,0 +1,29 @@ +function setUp() { + testArray = new DStructs.Array(1, 2, 3, 1); +} + +function testSlice() { + assertEquals("Wrong length!", testArray.slice(0, 1).length, 1); +} + +function testConcat() { + testArray.concat([4, 5, 6]); + assertEquals("Wrong length!", testArray.length, 7); +} + +function testReduce() { + var add = function(a, b) { return a + b; }; + var acc = function(a, b) { a.push(b); return a; }; + assertEquals("Incorrect sum!", testArray.reduce(0, add), 7); + assertEquals("Incorrect array!", testArray.reduce([], acc).length, 4); +} + +function testIndexOf() { + assertEquals("Incorrect index!", testArray.indexOf(2), 1); + assertEquals("Incorrect index!", testArray.indexOf(1), 0); + assertEquals("Incorrect index!", testArray.indexOf(22), -1); +} + +function testIndicesOf() { + assertEquals("Wrong number of indices!", testArray.indicesOf(1).length, 2); +} diff --git a/scripts/util/dstructs/tests/hash-tests.html b/scripts/util/dstructs/tests/hash-tests.html new file mode 100644 index 0000000..e69de29 diff --git a/scripts/util/dstructs/tests/testpage.html b/scripts/util/dstructs/tests/testpage.html new file mode 100644 index 0000000..80299cc --- /dev/null +++ b/scripts/util/dstructs/tests/testpage.html @@ -0,0 +1,8 @@ + + + DStructs Javascript Library + + + + + diff --git a/scripts/util/excanvas.pack.js b/scripts/util/excanvas.pack.js new file mode 100644 index 0000000..9d71658 --- /dev/null +++ b/scripts/util/excanvas.pack.js @@ -0,0 +1,19 @@ +if(!window.CanvasRenderingContext2D){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}"; +var c=a.getElementsByTagName("canvas");for(var d=0;d"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize", +W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case "width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case "height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement; +if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit= +a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.d=a.d;b.e=a.e}function O(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){var d=a.indexOf("(",3),e=a.indexOf(")",d+1),g=a.substring(d+1,e).split(",");b="#";for(var h=0;h<3;h++){b+=R[Number(g[h])]}if(g.length==4&&a.substr(3,1)=="a"){c=g[3]}}else{b=a}return[b,c]}function S(a){switch(a){case "butt":return"flat";case "round":return"round"; +case "square":default:return"square"}}function K(a){this.a=J();this.m=[];this.k=[];this.c=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=m*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.j=b;this.d=1;this.e=1}var j=K.prototype;j.clearRect=function(){this.j.innerHTML= +"";this.c=[]};j.beginPath=function(){this.c=[]};j.moveTo=function(a,b){this.c.push({type:"moveTo",x:a,y:b});this.f=a;this.g=b};j.lineTo=function(a,b){this.c.push({type:"lineTo",x:a,y:b});this.f=a;this.g=b};j.bezierCurveTo=function(a,b,c,d,e,g){this.c.push({type:"bezierCurveTo",cp1x:a,cp1y:b,cp2x:c,cp2y:d,x:e,y:g});this.f=e;this.g=g};j.quadraticCurveTo=function(a,b,c,d){var e=this.f+0.6666666666666666*(a-this.f),g=this.g+0.6666666666666666*(b-this.g),h=e+(c-this.f)/3,l=g+(d-this.g)/3;this.bezierCurveTo(e, +g,h,l,c,d)};j.arc=function(a,b,c,d,e,g){c*=m;var h=g?"at":"wa",l=a+M(d)*c-A,n=b+L(d)*c-A,o=a+M(e)*c-A,f=b+L(e)*c-A;if(l==o&&!g){l+=0.125}this.c.push({type:h,x:a,y:b,radius:c,xStart:l,yStart:n,xEnd:o,yEnd:f})};j.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};j.strokeRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke()};j.fillRect=function(a, +b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill()};j.createLinearGradient=function(a,b,c,d){var e=new H("gradient");return e};j.createRadialGradient=function(a,b,c,d,e,g){var h=new H("gradientradial");h.n=c;h.o=g;h.i.x=a;h.i.y=b;return h};j.drawImage=function(a,b){var c,d,e,g,h,l,n,o,f=a.runtimeStyle.width,k=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var q=a.width,r=a.height;a.runtimeStyle.width= +f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}else if(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}else if(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}var s=this.b(c,d),t=[],v=10,w=10;t.push(" ','","");this.j.insertAdjacentHTML("BeforeEnd",t.join(""))};j.stroke=function(a){var b=[],c=O(a?this.fillStyle:this.strokeStyle),d=c[0],e=c[1]*this.globalAlpha,g=10,h=10;b.push("n.x){n.x=k.x}if(l.y== +null||k.yn.y){n.y=k.y}}}b.push(' ">');if(typeof this.fillStyle=="object"){var v={x:"50%",y:"50%"},w=n.x-l.x,x=n.y-l.y,p=w>x?w:x;v.x=i(this.fillStyle.i.x/w*100+50)+"%";v.y=i(this.fillStyle.i.y/x*100+50)+"%";var y=[];if(this.fillStyle.p=="gradientradial"){var z=this.fillStyle.n/p*100,B=this.fillStyle.o/p*100-z}else{var z=0,B=100}var C={offset:null,color:null},D={offset:null,color:null};this.fillStyle.h.sort(function(T,U){return T.offset-U.offset});for(var o=0;oC.offset||C.offset==null){C.offset=u.offset;C.color=u.color}if(u.offset')}else if(a){b.push('')}else{b.push("')}b.push("");this.j.insertAdjacentHTML("beforeEnd",b.join(""));this.c=[]};j.fill=function(){this.stroke(true)};j.closePath=function(){this.c.push({type:"close"})};j.b=function(a,b){return{x:m*(a*this.a[0][0]+b*this.a[1][0]+this.a[2][0])-A,y:m*(a*this.a[0][1]+b*this.a[1][1]+this.a[2][1])-A}};j.save=function(){var a={};N(this,a); +this.k.push(a);this.m.push(this.a);this.a=G(J(),this.a)};j.restore=function(){N(this.k.pop(),this);this.a=this.m.pop()};j.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];this.a=G(c,this.a)};j.rotate=function(a){var b=M(a),c=L(a),d=[[b,c,0],[-c,b,0],[0,0,1]];this.a=G(d,this.a)};j.scale=function(a,b){this.d*=a;this.e*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];this.a=G(c,this.a)};j.clip=function(){};j.arcTo=function(){};j.createPattern=function(){return new P};function H(a){this.p=a;this.n=0;this.o= +0;this.h=[];this.i={x:0,y:0}}H.prototype.addColorStop=function(a,b){b=O(b);this.h.push({offset:1-a,color:b})};function P(){}G_vmlCanvasManager=Q;CanvasRenderingContext2D=K;CanvasGradient=H;CanvasPattern=P})()}; diff --git a/scripts/util/jquery.corner.js b/scripts/util/jquery.corner.js new file mode 100644 index 0000000..57771b6 --- /dev/null +++ b/scripts/util/jquery.corner.js @@ -0,0 +1,253 @@ + // jquery-roundcorners-canvas + // www.meerbox.nl + +(function($){ + + var _corner = function(options) { + + // no native canvas support, or its msie and excanvas.js not loaded + var testcanvas = document.createElement("canvas"); + if (typeof G_vmlCanvasManager == 'undefined' && $.browser.msie) { + return this.each(function() {}); + } + + // get lowest number from array + var asNum = function(a, b) { return a-b; }; + var getMin = function(a) { + var b = a.concat(); + return b.sort(asNum)[0]; + }; + + // get CSS value as integer + var getCSSint = function(el, prop) { + return parseInt($.css(el.jquery?el[0]:el,prop))||0; + }; + + // draw the round corner in Canvas object + var drawRoundCornerCanvasShape = function(canvas,radius,r_type,bg_color,border_width,border_color) { + + // change rgba(1,2,3,0.9) to rgb(1,2,3) + var reg = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/; + var bits = reg.exec(bg_color); + if (bits) { + channels = new Array(parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])); + bg_color = 'rgb('+channels[0]+', '+channels[1]+', '+channels[2]+')'; + } + + var border_width = parseInt(border_width); + + var ctx = canvas.getContext('2d'); + + if (radius == 1) { + ctx.fillStyle = bg_color; + ctx.fillRect(0,0,1,1); + return; + } + + if (r_type == 'tl') { + var steps = new Array(0,0,radius,0,radius,0,0,radius,0,0); + } else if (r_type == 'tr') { + var steps = new Array(radius,0,radius,radius,radius,0,0,0,0,0); + } else if (r_type == 'bl') { + var steps = new Array(0,radius,radius,radius,0,radius,0,0,0,radius); + } else if (r_type == 'br') { + var steps = new Array(radius,radius,radius,0,radius,0,0,radius,radius,radius); + } + + ctx.fillStyle = bg_color; + ctx.beginPath(); + ctx.moveTo(steps[0],steps[1]); + ctx.lineTo(steps[2], steps[3]); + if(r_type == 'br') ctx.bezierCurveTo(steps[4], steps[5], radius, radius, steps[6], steps[7]); + else ctx.bezierCurveTo(steps[4], steps[5], 0, 0, steps[6], steps[7]); + ctx.lineTo(steps[8], steps[9]); + ctx.fill(); + + // draw border + if (border_width > 0 && border_width < radius) { + + // offset caused by border + var offset = border_width/2; + + if (r_type == 'tl') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'tr') { + var steps = new Array(radius-offset,radius-offset,radius-offset,offset,offset,offset); + var curve_to = new Array(0,0); + } else if (r_type == 'bl') { + var steps = new Array(radius-offset,radius-offset,offset,radius-offset,offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'br') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset,radius-offset,radius-offset); + var curve_to = new Array(radius, radius); + } + + ctx.strokeStyle = border_color; + ctx.lineWidth = border_width; + ctx.beginPath(); + // go to corner to begin curve + ctx.moveTo(steps[0], steps[1]); + // curve from righttop to leftbottom (for the tl canvas) + ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); + ctx.stroke(); + + } + }; + + var creatCanvas = function(p,radius) { + var elm = document.createElement('canvas'); + elm.setAttribute("height", radius); + elm.setAttribute("width", radius); + elm.style.display = "block"; + elm.style.position = "absolute"; + elm.className = "cornercanvas"; + elm = p.appendChild(elm); + // if G_vmlCanvasManager in defined the browser (ie only) has loaded excanvas.js + if (!elm.getContext && typeof G_vmlCanvasManager != 'undefined') { + var elm = G_vmlCanvasManager.initElement(elm); + } + return elm; + }; + + // interpret the (string) argument + var o = (options || "").toLowerCase(); + var radius = parseInt((o.match(/(\d+)px/)||[])[1]) || null; // corner width + var bg_color = ((o.match(/(#[0-9a-f]+)/)||[])[1]); // strip color + if (radius == null) { radius = "auto"; } + + var edges = { T:0, B:1 }; + var opts = { + tl: /top|tl/.test(o), + tr: /top|tr/.test(o), + bl: /bottom|bl/.test(o), + br: /bottom|br/.test(o) + }; + if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) { + opts = { tl:1, tr:1, bl:1, br:1 }; + } + + return this.each(function() { + + var elm = $(this); + + // give the element 'haslayout' + if ($.browser.msie) { this.style.zoom = 1; } + + // the size of the corner is not defined... + var widthheight_smallest = getMin(new Array(getCSSint(this,'height'),getCSSint(this,'width'))); + if (radius == "auto") { + radius = widthheight_smallest/4; + if (radius > 10) { radius = 10; } + } + + // the size of the corner can't be to high + if (widthheight_smallest < radius) { + radius = (widthheight_smallest/2); + } + + // remove old canvas objects + elm.children("canvas.cornercanvas").remove(); + + // some css thats required in order to position the canvas elements + if (elm.css('position') == 'static') { + elm.css('position','relative'); + // only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode + } else if (elm.css('position') == 'fixed' && $.browser.msie && !(document.compatMode == 'CSS1Compat' && typeof document.body.style.maxHeight != "undefined")) { + elm.css('position','absolute'); + } + elm.css('overflow','visible'); + + // get border width + var border_t = getCSSint(this, 'borderTopWidth'); + var border_r = getCSSint(this, 'borderRightWidth'); + var border_b = getCSSint(this, 'borderBottomWidth'); + var border_l = getCSSint(this, 'borderLeftWidth'); + + // get the lowest borderwidth of the corners in use + var bordersWidth = new Array(); + if (opts.tl || opts.tr) { bordersWidth.push(border_t); } + if (opts.br || opts.tr) { bordersWidth.push(border_r); } + if (opts.br || opts.bl) { bordersWidth.push(border_b); } + if (opts.bl || opts.tl) { bordersWidth.push(border_l); } + + borderswidth_smallest = getMin(bordersWidth); + + // creat the canvas elements and position them + var p_top = 0-border_t; + var p_right = 0-border_r; + var p_bottom = 0-border_b; + var p_left = 0-border_l; + + if (opts.tl) { var tl = $(creatCanvas(this,radius)).css({left:p_left,top:p_top}).get(0); } + if (opts.tr) { var tr = $(creatCanvas(this,radius)).css({right:p_right,top:p_top}).get(0); } + if (opts.bl) { var bl = $(creatCanvas(this,radius)).css({left:p_left,bottom:p_bottom}).get(0); } + if (opts.br) { var br = $(creatCanvas(this,radius)).css({right:p_right,bottom:p_bottom}).get(0); } + + // get the background color of parent element + + if (bg_color == undefined) { + + var current_p = elm.parent(); + var bg = current_p.css('background-color'); + while((bg == "transparent" || bg == "rgba(0, 0, 0, 0)") && current_p.get(0).tagName.toLowerCase() != "html") { + bg = current_p.css('background-color'); + current_p = current_p.parent(); + } + } else { + bg = bg_color; + } + + if (bg == "transparent" || bg == "rgba(0, 0, 0, 0)") { bg = "#ffffff"; } + + if (opts.tl) { drawRoundCornerCanvasShape(tl,radius,'tl',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.tr) { drawRoundCornerCanvasShape(tr,radius,'tr',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.bl) { drawRoundCornerCanvasShape(bl,radius,'bl',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + if (opts.br) { drawRoundCornerCanvasShape(br,radius,'br',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + + elm.addClass('roundCornersParent'); + + }); + }; + + if ($.browser.msie && typeof G_vmlCanvasManager == 'undefined') { + + var corner_buffer = new Array(); + var corner_buffer_args = new Array(); + + $.fn.corner = function(options){ + corner_buffer[corner_buffer.length] = this; + corner_buffer_args[corner_buffer_args.length] = options; + return this.each(function(){}); + }; + + // load excanvas.pack.js + document.execCommand("BackgroundImageCache", false, true); + var elm = $("script[@src*=jquery.corner.]"); + if (elm.length == 1) { + var jc_src = elm.attr('src'); + var pathArray = jc_src.split('/'); + pathArray.pop(); + var base = pathArray.join('/') || '.'; + var excanvasjs = base+'/excanvas.pack.js'; + $.getScript(excanvasjs,function(){ + execbuffer(); + }); + } + + var execbuffer = function() { + // set back function + $.fn.corner = _corner; + // execute buffer and set back function + for(var i=0;i35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(8($){p g=$.19.D,w=$.19.w;$.19.z({D:8(){4(1[0]==h)5 Z.1a||$.I&&7.10.1z||7.q.1z;4(1[0]==7)5 1t.1s(7.q.1H,7.q.13);5 g.1k(1,1h)},w:8(){4(1[0]==h)5 Z.1d||$.I&&7.10.1c||7.q.1c;4(1[0]==7)5 1t.1s(7.q.1B,7.q.11);5 w.1k(1,1h)},1a:8(){5 1[0]==h||1[0]==7?1.D():1.P(\':J\')?1[0].13-f(1,\'k\')-f(1,\'1A\'):1.D()+f(1,\'18\')+f(1,\'1y\')},1d:8(){5 1[0]==h||1[0]==7?1.w():1.P(\':J\')?1[0].11-f(1,\'j\')-f(1,\'1x\'):1.w()+f(1,\'15\')+f(1,\'1u\')},1K:8(){5 1[0]==h||1[0]==7?1.D():1.P(\':J\')?1[0].13:1.D()+f(1,\'k\')+f(1,\'1A\')+f(1,\'18\')+f(1,\'1y\')},1J:8(){5 1[0]==h||1[0]==7?1.w():1.P(\':J\')?1[0].11:1.w()+f(1,\'j\')+f(1,\'1x\')+f(1,\'15\')+f(1,\'1u\')},l:8(a){4(a!=1q)5 1.1o(8(){4(1==h||1==7)h.1m(a,$(h).n());o 1.l=a});4(1[0]==h||1[0]==7)5 Z.1G||$.I&&7.10.l||7.q.l;5 1[0].l},n:8(a){4(a!=1q)5 1.1o(8(){4(1==h||1==7)h.1m($(h).l(),a);o 1.n=a});4(1[0]==h||1[0]==7)5 Z.1F||$.I&&7.10.n||7.q.n;5 1[0].n},C:8(c,d){p a=1[0],3=a.S,6=a.R,c=$.z({Q:m,K:m,O:m,t:m},c||{}),x=a.N,y=a.M,v=a.l,u=a.n;4($.i.17||$.i.16){x+=f(a,\'j\');y+=f(a,\'k\')}4(($.i.Y||$.i.X)&&$.r(6,\'C\')!=\'W\'){x-=f(6,\'j\');y-=f(6,\'k\')}4($.i.17){B{4(3!=a&&$.r(3,\'1w\')!=\'J\'){x+=f(3,\'j\');y+=f(3,\'k\')}4(3==6)1v}H((3=3.S)&&3.s!=\'G\')}4($.i.16&&(6.s!=\'G\'&&$.r(6,\'C\')==\'W\')){B{x+=6.N;y+=6.M;x+=f(6,\'j\');y+=f(6,\'k\')}H((6=6.R)&&(6.s!=\'G\'&&$.r(6,\'C\')==\'W\'))}p b=e(a,c,x,y,v,u);4(d){$.z(d,b);5 1}o{5 b}},1I:8(b,c){p x=0,y=0,v=0,u=0,9=1[0],3=1[0],6,U,L=$.r(9,\'C\'),A=$.i.17,E=$.i.16,1p=$.i.Y,1n=$.i.X,12=m,14=m,b=$.z({Q:F,K:m,O:m,t:F,1j:m},b||{});4(b.1j)5 1.1i(b,c);4(9.s==\'G\'){x=9.N;y=9.M;4(A){x+=f(9,\'V\')+(f(9,\'j\')*2);y+=f(9,\'T\')+(f(9,\'k\')*2)}o 4(1n){x+=f(9,\'V\');y+=f(9,\'T\')}o 4(E&&1l.I){x+=f(9,\'j\');y+=f(9,\'k\')}}o{B{U=$.r(3,\'C\');x+=3.N;y+=3.M;4(A||E){x+=f(3,\'j\');y+=f(3,\'k\');4(A&&U==\'1g\')12=F;4(E&&U==\'1E\')14=F}6=3.R;4(b.t||A){B{4(b.t){v+=3.l;u+=3.n}4(A&&3!=9&&$.r(3,\'1w\')!=\'J\'){x+=f(3,\'j\');y+=f(3,\'k\')}3=3.S}H(3!=6)}3=6;4(3.s==\'G\'||3.s==\'1e\'){4((1p||(E&&$.I))&&L!=\'1g\'&&L!=\'1f\'){x+=f(3,\'V\');y+=f(3,\'T\')}4((A&&!12&&L!=\'1f\')||(E&&L==\'W\'&&!14)){x+=f(3,\'j\');y+=f(3,\'k\')}1v}}H(3)}p a=e(9,b,x,y,v,u);4(c){$.z(c,a);5 1}o{5 a}},1i:8(b,c){p x=0,y=0,v=0,u=0,3=1[0],6,b=$.z({Q:F,K:m,O:m,t:F},b||{});B{x+=3.N;y+=3.M;6=3.R;4(b.t){B{v+=3.l;u+=3.n;3=3.S}H(3!=6)}3=6}H(3&&3.s!=\'G\'&&3.s!=\'1e\');p a=e(1[0],b,x,y,v,u);4(c){$.z(c,a);5 1}o{5 a}}});p f=8(b,a){5 1D($.r(b.1C?b[0]:b,a))||0};p e=8(b,c,x,y,a,d){4(!c.Q){x-=f(b,\'V\');y-=f(b,\'T\')}4(c.K&&($.i.Y||$.i.X)){x+=f(b,\'j\');y+=f(b,\'k\')}o 4(!c.K&&!($.i.Y||$.i.X)){x-=f(b,\'j\');y-=f(b,\'k\')}4(c.O){x+=f(b,\'15\');y+=f(b,\'18\')}4(c.t){a-=b.l;d-=b.n}5 c.t?{1b:y-d,1r:x-a,n:d,l:a}:{1b:y,1r:x}}})(1l);',62,109,'|this||parent|if|return|op|document|function|elem||||||||window|browser|borderLeftWidth|borderTopWidth|scrollLeft|false|scrollTop|else|var|body|css|tagName|scroll|st|sl|width|||extend|mo|do|position|height|ie|true|BODY|while|boxModel|visible|border|elemPos|offsetTop|offsetLeft|padding|is|margin|offsetParent|parentNode|marginTop|parPos|marginLeft|static|opera|safari|self|documentElement|offsetWidth|absparent|offsetHeight|relparent|paddingLeft|msie|mozilla|paddingTop|fn|innerHeight|top|clientWidth|innerWidth|HTML|fixed|absolute|arguments|offsetLite|lite|apply|jQuery|scrollTo|oa|each|sf|undefined|left|max|Math|paddingRight|break|overflow|borderRightWidth|paddingBottom|clientHeight|borderBottomWidth|scrollWidth|jquery|parseInt|relative|pageYOffset|pageXOffset|scrollHeight|offset|outerWidth|outerHeight'.split('|'),0,{})) \ No newline at end of file diff --git a/scripts/util/jquery.prettybox.js b/scripts/util/jquery.prettybox.js new file mode 100644 index 0000000..06c3dd1 --- /dev/null +++ b/scripts/util/jquery.prettybox.js @@ -0,0 +1,171 @@ +(function($) { + var createCanvas = function() { + var canvas = document.createElement("canvas"); + if ("G_vmlCanvasManager" in window) { + document.body.appendChild(canvas); + canvas = G_vmlCanvasManager.initElement(canvas); + } + return canvas; + }; + var DropShadow = function(backgroundColor, cornerRadius, shadowRadius, shadowOffset, shadowAlpha) { + this.backgroundColor = backgroundColor; + this.cornerRadius = cornerRadius; + this.shadowRadius = Math.max(cornerRadius, shadowRadius); + this.shadowOffset = shadowOffset; + this.shadowAlpha = shadowAlpha; + + this.elmt = createCanvas();//document.createElement("canvas"); + this.elmt.style.position = "absolute"; + }; + + DropShadow.prototype = { + draw: function() { + var darkColor = "rgba(128,128,128," + this.shadowAlpha + ")"; + var lightColor = "rgba(128,128,128,0)"; + + var cornerRadius = this.cornerRadius; + var shadowRadius = this.shadowRadius; + var radiusDiff = shadowRadius - cornerRadius; + var innerWidth = this.width - 2 * cornerRadius; + var innerHeight = this.height - 2 * cornerRadius; + + var ctx = this.elmt.getContext("2d"); + ctx.translate(this.shadowRadius, this.shadowRadius); + ctx.globalCompositeOperation = "copy"; + + /* + * Inside + */ + ctx.fillStyle = darkColor; + ctx.fillRect(-cornerRadius, -cornerRadius, this.width, this.height); + + /* + * Corners + */ + if (true) { + // top left + ctx.fillStyle = this._createRadialGradient(ctx, 0, 0, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(-shadowRadius, -shadowRadius, shadowRadius, shadowRadius); + + // top right + ctx.fillStyle = this._createRadialGradient(ctx, innerWidth, 0, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(innerWidth, -shadowRadius, shadowRadius, shadowRadius); + + // bottom right + ctx.fillStyle = this._createRadialGradient(ctx, innerWidth, innerHeight, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(innerWidth, innerHeight, shadowRadius, shadowRadius); + + // bottom left + ctx.fillStyle = this._createRadialGradient(ctx, 0, innerHeight, cornerRadius, shadowRadius, darkColor, lightColor); + ctx.fillRect(-shadowRadius, innerHeight, shadowRadius, shadowRadius); + } + + /* + * Edges + */ + if (true) { + // top + ctx.fillStyle = this._createLinearGradient(ctx, 0, -cornerRadius, 0, -shadowRadius, darkColor, lightColor); + ctx.fillRect(0, -shadowRadius, innerWidth, radiusDiff); + + // right + ctx.fillStyle = this._createLinearGradient(ctx, innerWidth + cornerRadius, 0, innerWidth + shadowRadius, 0, darkColor, lightColor); + ctx.fillRect(innerWidth + cornerRadius, 0, radiusDiff, innerHeight); + + // bottom + ctx.fillStyle = this._createLinearGradient(ctx, 0, innerHeight + cornerRadius, 0, innerHeight + shadowRadius, darkColor, lightColor); + ctx.fillRect(0, innerHeight + cornerRadius, innerWidth, radiusDiff); + + // left + ctx.fillStyle = this._createLinearGradient(ctx, -radiusDiff, 0, -shadowRadius, 0, darkColor, lightColor); + ctx.fillRect(-shadowRadius, 0, radiusDiff, innerHeight); + } + + /* + * Foreground + */ + if (true) { + ctx.translate(-this.shadowOffset, -this.shadowOffset); + + var curvy = 0.5; + + ctx.moveTo(-cornerRadius, 0); + ctx.bezierCurveTo( + -cornerRadius, -cornerRadius * (1 - curvy), + -cornerRadius * (1 - curvy), -cornerRadius, + 0, -cornerRadius); + + ctx.lineTo(innerWidth, -cornerRadius); + ctx.bezierCurveTo( + innerWidth + cornerRadius * (1 - curvy), -cornerRadius, + innerWidth + cornerRadius, -cornerRadius * (1 - curvy), + innerWidth + cornerRadius, 0); + + ctx.lineTo(innerWidth + cornerRadius, innerHeight); + ctx.bezierCurveTo( + innerWidth + cornerRadius, innerHeight + cornerRadius * (1 - curvy), + innerWidth + cornerRadius * (1 - curvy), innerHeight + cornerRadius, + innerWidth, innerHeight + cornerRadius); + + ctx.lineTo(0, innerHeight + cornerRadius); + ctx.bezierCurveTo( + -cornerRadius * (1 - curvy), innerHeight + cornerRadius, + -cornerRadius, innerHeight + cornerRadius * (1 - curvy), + -cornerRadius, innerHeight); + + ctx.closePath(); + + ctx.fillStyle = this.backgroundColor; + ctx.fill(); + } + }, + move: function(left, top, width, height) { + this.left = left; + this.top = top; + this.width = width; + this.height = height; + + var radiusDiff = this.shadowRadius - this.cornerRadius; + var elmt = this.elmt; + elmt.style.top = (this.top - radiusDiff + this.shadowOffset) + "px"; + elmt.style.left = (this.left - radiusDiff + this.shadowOffset) + "px"; + elmt.style.width = (this.width + 2 * radiusDiff) + "px"; + elmt.style.height = (this.height + 2 * radiusDiff) + "px"; + elmt.width = this.width + 2 * radiusDiff; + elmt.height = this.height + 2 * radiusDiff; + + this.draw(); + }, + _createRadialGradient: function(ctx, x, y, r1, r2, darkColor, lightColor) { + var g = ctx.createRadialGradient(x, y, r1, x, y, r2); + g.addColorStop(0, darkColor); + g.addColorStop(1, lightColor); + return g; + }, + _createLinearGradient: function(ctx, x1, y1, x2, y2, darkColor, lightColor) { + var g = ctx.createLinearGradient(x1, y1, x2, y2); + g.addColorStop(0, darkColor); + g.addColorStop(1, lightColor); + return g; + } + }; + + $.fn.extend({ + prettybox: function(cornerRadius, shadowRadius, shadowOffset, shadowAlpha) { + this.each(function() { + var elem = $(this); + var bgColor = elem.css('background-color'); + var positions = elem.position(); + var pbox = new DropShadow(bgColor, cornerRadius, shadowRadius, + shadowOffset, shadowAlpha); + elem.parent().append(pbox.elmt); + pbox.move(positions.left, positions.top, + elem.outerWidth(), elem.outerHeight()); + elem.css('background', 'transparent'); + elem.css('border', '0px'); + }); + return this; + } + }); + +}) (jQuery); diff --git a/scripts/util/jquery.simile.js b/scripts/util/jquery.simile.js new file mode 100644 index 0000000..cf0c4e5 --- /dev/null +++ b/scripts/util/jquery.simile.js @@ -0,0 +1,118 @@ +/** + * This code implements the Simile jQuery plugin, which in turns simply + * provides several convenient and useful functions for manipulating the + * DOM, etc. + * @overview Simile jQuery plugin + */ + +jQuery.extend({ + /** + * Simply capitalizes the first letter of each word in its argument. + */ + capitalize: function(s) { + return s.charAt(0).toUpperCase() + s.substring(1).toLowerCase(); + }, + /** + * Provides a basic mechanism for Javascript inheritance. + */ + inherit: function(subclass, superclass) { + function Dummy() {}; + Dummy.prototype = superclass.prototype; + subclass.prototype = new Dummy(); + subclass.prototype.constructor = subclass; + subclass.superclass = superclass; + subclass.superproto = superclass.prototype; + }, + /** + * Recursively deep-copies the given object. + */ + clone: function(obj, deep) { + if (deep == null) { deep = true; } + var objectClone = new obj.constructor(); + for (var property in obj) { + if (!deep) { + objectClone[property] = obj[property]; + } else if (typeof obj[property] == 'object') { + objectClone[property] = obj[property].clone(deep); + } else { + objectClone[property] = obj[property]; + } + } + return objectClone; + }, + /** + * Returns the width of the scrollbar. + */ + scrollWidth: function() { + var scr = null; + var inn = null; + var wNoScroll = 0; + var wScroll = 0; + + // Outer scrolling div + scr = document.createElement('div'); + scr.style.position = 'absolute'; + scr.style.top = '-1000px'; + scr.style.left = '-1000px'; + scr.style.width = '100px'; + scr.style.height = '50px'; + // Start with no scrollbar + scr.style.overflow = 'hidden'; + + // Inner content div + inn = document.createElement('div'); + inn.style.width = '100%'; + inn.style.height = '200px'; + + // Put the inner div in the scrolling div + scr.appendChild(inn); + // Append the scrolling div to the doc + document.body.appendChild(scr); + + // Width of the inner div sans scrollbar + wNoScroll = inn.offsetWidth; + // Add the scrollbar + scr.style.overflow = 'auto'; + // Width of the inner div width scrollbar + wScroll = inn.offsetWidth; + + // Remove the scrolling div from the doc + document.body.removeChild( + document.body.lastChild); + + // Pixel width of the scroller, with an awful, awful hack + // FIXME: Fix hardcoded scrollwidth + return (wNoScroll - wScroll) || 17; + } +}); + +jQuery.fn.extend({ + /** + * The attrs method extends jQuery to allow for aggregating attributes of + * all matched elements in a $('..') expression into a nice hash. It also + * supports only returning attributes within a certain namespace, e.g. + * ex:role, when provided with the namespace prefix as an argument. + */ + attrs: function(ns) { + // Caching the compiled regex speeds this up a bit + if (!this.__namespaceRegexps) { + this.__namespaceRegexps = {}; + } + var regexp = this.__namespaceRegexps[ns]; + if (!regexp) { + this.__namespaceRegexps[ns] = regexp = + ns ? eval("/^" + ns + ":(.+)/") : /^([^:]*)$/; + } + var result = {}; + this.each(function() { + // Within this loop, 'this' refers to each matched DOM element + var atts = this.attributes; + var l = atts.length; + for (var i = 0; i < l; i++) { + var m = atts[i].name.match(regexp); + if (m) { result[m[1]] = atts[i].value; } + } + }); + return result; + } +}); diff --git a/scripts/util/util.js b/scripts/util/util.js new file mode 100644 index 0000000..f325e96 --- /dev/null +++ b/scripts/util/util.js @@ -0,0 +1,47 @@ +/****************************************************************************** + * Utility Functions + *****************************************************************************/ + +Timegrid.abstract = function(name) { + return function() { + throw "A " + name + " method has not been implemented!"; + return; + }; +}; + +SimileAjax.DateTime.Interval = function(ms) { + // Conversion factors as varants to eliminate all the multiplication + var SECONDS_CF = 1000; + var MINUTES_CF = 60000; + var HOURS_CF = 3600000; + var DAYS_CF = 86400000; + var WEEKS_CF = 604800000; + var FORTNIGHTS_CF = 1209600000; + var MONTHS_CF = 2592000000; + var QUARTERS_CF = 7776000000; + var YEARS_CF = 31557600000; + var DECADES_CF = 315576000000; + var CENTURIES_CF = 3155760000000; + + this.milliseconds = Math.abs(ms); + this.seconds = Math.round(this.milliseconds / SECONDS_CF); + this.minutes = Math.round(this.milliseconds / MINUTES_CF); + this.hours = Math.round(this.milliseconds / HOURS_CF); + this.days = Math.floor(this.milliseconds / DAYS_CF); + this.weeks = Math.round(this.milliseconds / WEEKS_CF); + this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); + this.months = Math.round(this.milliseconds / MONTHS_CF); + // rounding errors! + this.quarters = Math.round(this.milliseconds / QUARTERS_CF); + // rounding errors! + this.years = Math.round(this.milliseconds / YEARS_CF); + // rounding errors! + this.decades = Math.round(this.milliseconds / DECADES_CF); + // rounding errors! + this.centuries = Math.round(this.milliseconds / CENTURIES_CF); + // rounding errors! +}; + +SimileAjax.DateTime.Interval.prototype.toString = function() { + return this.milliseconds.toString(); +}; diff --git a/styles/.svn/all-wcprops b/styles/.svn/all-wcprops new file mode 100644 index 0000000..24753a5 --- /dev/null +++ b/styles/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/styles +END +timegrid.css +K 25 +svn:wc:ra_dav:version-url +V 85 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/styles/timegrid.css +END diff --git a/styles/.svn/entries b/styles/.svn/entries new file mode 100644 index 0000000..4bc3ecf --- /dev/null +++ b/styles/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/styles +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +themes +dir + +timegrid.css +file + + + + +2012-02-03T21:55:32.000000Z +aae15a933f71741d2eef8e20f46c3390 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +3275 + diff --git a/styles/.svn/text-base/timegrid.css.svn-base b/styles/.svn/text-base/timegrid.css.svn-base new file mode 100644 index 0000000..786c2ab --- /dev/null +++ b/styles/.svn/text-base/timegrid.css.svn-base @@ -0,0 +1,192 @@ +div.timegrid-default { + font-family: Helvetica, Arial, sans-serif; + font-size: 9pt; + overflow: hidden; +} + +div.timegrid-default * { + margin: 0; + padding: 0; +} + +div.timegrid-default ul, div.timegrid-default li { + font-size: 9pt; +} + +div.timegrid-iterator { + float: left; + font-weight: bold; + height: 1.5em; +} + +.timegrid-iterator-prev, .timegrid-iterator-next { + margin: .5em; +} + +.timegrid-iterator img { + border: none; +} + +div.timegrid-tab { + padding-left: 1em; + padding-right: 1em; + margin: 0px; + float: right; + background-color: #bbb; +} + +div.timegrid-tab-active { + font-weight: bold; +} + +div.timegrid-view { + position: absolute; + top: 1.5em; + bottom: 0px; + width: 100%; + left: 0px; + border: 1px white solid; +} + +div.timegrid-grid-window { + position: absolute; + overflow: scroll; + border: 1px inset black; +} + +div.timegrid-hline { + position: absolute; + height: 1px; + overflow: hidden; + background-color: #999; +} + +div.timegrid-vline { + position: absolute; + width: 1px; + background-color: #444; +} + +div.timegrid-events { + position: relative; + z-index: 2; +} + +div.timegrid-gridlines { + position: relative; + z-index: 1; +} + +div.timegrid-xlabels { + position: absolute; + left: 0px; +} + +.timegrid-xlabels div.timegrid-label { + top: 0px; + bottom: 0px; + text-align: center; + padding: 3px; +} + +div.timegrid-ylabels { + position: absolute; +} + +.timegrid-ylabels div.timegrid-label { + left: 0px; + right: 0px; + text-align: right; + padding: 3px; +} + +div.timegrid-xlabels-window { + position: absolute; + overflow: hidden; + text-align: center; +} + +div.timegrid-ylabels-window { + position: absolute; + overflow: hidden; +} + +div.timegrid-label { + position: absolute; + padding: 2px; + color: #aaa; +} + +/* Weekly View */ +div.timegrid-event { + position: absolute; + width: 100px; + background-color: #aaf; + padding: 0; + overflow: hidden; + z-index: 5; +} + +.timegrid-week-highlight { + position: absolute; + background-color: #eee; +} + +.timegrid-event div { + padding: 2px; +} + +/* Monthly View */ +div.timegrid-month-cell { + position: absolute; + padding: 0; + overflow: hidden; +} + +div.timegrid-month-cell-odd { + background-color: #eee; +} + +div.timegrid-month-cell-now { + background-color: #aaa; +} + +ul.timegrid-event-list { + list-style-position: inside; + padding-left: .5em; +} + +div.timegrid-month-label { + position: absolute; + text-align: center; + width: 100%; + z-index: 1; +} + +div.timegrid-month-label span { + display: block; + font-size: 12em; + font-weight: bold; + color: #ccc; +} + +span.timegrid-month-date-label { + position: absolute; + right: 5px; + top: 5px; +} + +/* Message */ +.timegrid-message-container { + position: absolute; + top: 30%; + left: 35%; + right: 35%; + z-index: 1000; + display: none; +} +.timegrid-message { + font-size: 120%; + font-weight: bold; + text-align: center; +} diff --git a/styles/themes/.svn/all-wcprops b/styles/themes/.svn/all-wcprops new file mode 100644 index 0000000..54fc7f0 --- /dev/null +++ b/styles/themes/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 79 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/styles/themes +END +theme-sandy-stone-beach-ocean-diver.css +K 25 +svn:wc:ra_dav:version-url +V 119 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/styles/themes/theme-sandy-stone-beach-ocean-diver.css +END diff --git a/styles/themes/.svn/entries b/styles/themes/.svn/entries new file mode 100644 index 0000000..9a9e0b5 --- /dev/null +++ b/styles/themes/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/styles/themes +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +theme-sandy-stone-beach-ocean-diver.css +file + + + + +2012-02-03T21:55:32.000000Z +d95d43169de069ac9f95e8798c07482b +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1332 + diff --git a/styles/themes/.svn/text-base/theme-sandy-stone-beach-ocean-diver.css.svn-base b/styles/themes/.svn/text-base/theme-sandy-stone-beach-ocean-diver.css.svn-base new file mode 100644 index 0000000..56760ba --- /dev/null +++ b/styles/themes/.svn/text-base/theme-sandy-stone-beach-ocean-diver.css.svn-base @@ -0,0 +1,79 @@ +/* + From Kuler, http://kuler.adobe.com/ + + #e6e2af + #a7a37e + #efecca + #046380 + #002f2f + */ + +div.timegrid-tab { + background-color: #efecca; +} + +div.timegrid-tab-active { + background-color: #a7a37e; + font-weight: bold; +} + +div.timegrid-tab a { + text-decoration: none; +} + +div.timegrid-view { + background: #a7a37e; + border: 1px solid #a7a37e; +} + +div.timegrid-grid-window { + border: none; + background: white; +} + +div.timegrid-xlabels-window { + border-left: 1px solid #a7a37e; + border-right: 1px solid #a7a37e; + border-bottom: 1px solid #a7a37e; +} +div.timegrid-ylabels-window { + border-top: 1px solid #a7a37e; + border-bottom: 1px solid #a7a37e; + border-right: 1px solid #a7a37e; +} + +div.timegrid-hline, div.timegrid-vline { + background: #e6e2af; +} + +div.timegrid-xlabels-window, div.timegrid-ylabels-window { + background: #efecca; +} + +div.timegrid-label { + color: #046380; +} + +.timegrid-xlabels div.timegrid-label { + border-left: 1px solid #e6e2af; +} + +.timegrid-ylabels div.timegrid-label { + border-top: 1px solid #e6e2af; +} + +div.timegrid-event { + background-color: #e6e2af; + color: #046380; +} + +/* Monthly View */ +div.timegrid-month-cell { + color: #046380; + padding: 0px; +} + +ul.timegrid-event-list { + list-style-position: inside; + padding: .5em; +} diff --git a/styles/themes/theme-sandy-stone-beach-ocean-diver.css b/styles/themes/theme-sandy-stone-beach-ocean-diver.css new file mode 100644 index 0000000..56760ba --- /dev/null +++ b/styles/themes/theme-sandy-stone-beach-ocean-diver.css @@ -0,0 +1,79 @@ +/* + From Kuler, http://kuler.adobe.com/ + + #e6e2af + #a7a37e + #efecca + #046380 + #002f2f + */ + +div.timegrid-tab { + background-color: #efecca; +} + +div.timegrid-tab-active { + background-color: #a7a37e; + font-weight: bold; +} + +div.timegrid-tab a { + text-decoration: none; +} + +div.timegrid-view { + background: #a7a37e; + border: 1px solid #a7a37e; +} + +div.timegrid-grid-window { + border: none; + background: white; +} + +div.timegrid-xlabels-window { + border-left: 1px solid #a7a37e; + border-right: 1px solid #a7a37e; + border-bottom: 1px solid #a7a37e; +} +div.timegrid-ylabels-window { + border-top: 1px solid #a7a37e; + border-bottom: 1px solid #a7a37e; + border-right: 1px solid #a7a37e; +} + +div.timegrid-hline, div.timegrid-vline { + background: #e6e2af; +} + +div.timegrid-xlabels-window, div.timegrid-ylabels-window { + background: #efecca; +} + +div.timegrid-label { + color: #046380; +} + +.timegrid-xlabels div.timegrid-label { + border-left: 1px solid #e6e2af; +} + +.timegrid-ylabels div.timegrid-label { + border-top: 1px solid #e6e2af; +} + +div.timegrid-event { + background-color: #e6e2af; + color: #046380; +} + +/* Monthly View */ +div.timegrid-month-cell { + color: #046380; + padding: 0px; +} + +ul.timegrid-event-list { + list-style-position: inside; + padding: .5em; +} diff --git a/styles/timegrid.css b/styles/timegrid.css new file mode 100644 index 0000000..b707142 --- /dev/null +++ b/styles/timegrid.css @@ -0,0 +1,192 @@ +div.timegrid-default { + font-family: Helvetica, Arial, sans-serif; + font-size: 9pt; + overflow: hidden; +} + +div.timegrid-default * { + margin: 0; + padding: 0; +} + +div.timegrid-default ul, div.timegrid-default li { + font-size: 9pt; +} + +div.timegrid-iterator { + float: left; + font-weight: bold; + height: 1.5em; +} + +.timegrid-iterator-prev, .timegrid-iterator-next { + margin: .5em; +} + +.timegrid-iterator img { + border: none; +} + +div.timegrid-tab { + padding-left: 1em; + padding-right: 1em; + margin: 0px; + float: right; + background-color: #bbb; +} + +div.timegrid-tab-active { + font-weight: bold; +} + +div.timegrid-view { + position: absolute; + top: 1.5em; + bottom: 0px; + width: 100%; + left: 0px; + border: 1px white solid; +} + +div.timegrid-grid-window { + position: absolute; + overflow: scroll; + border: 1px inset black; +} + +div.timegrid-hline { + position: absolute; + height: 1px; + overflow: hidden; + background-color: #999; +} + +div.timegrid-vline { + position: absolute; + width: 1px; + background-color: #444; +} + +div.timegrid-events { + position: relative; + z-index: 2; +} + +div.timegrid-gridlines { + position: relative; + z-index: 1; +} + +div.timegrid-xlabels { + position: absolute; + left: 0px; +} + +.timegrid-xlabels div.timegrid-label { + top: 0px; + bottom: 0px; + text-align: center; + padding: 3px; +} + +div.timegrid-ylabels { + position: absolute; +} + +.timegrid-ylabels div.timegrid-label { + left: 0px; + right: 0px; + text-align: right; + padding: 3px; +} + +div.timegrid-xlabels-window { + position: absolute; + overflow: hidden; + text-align: center; +} + +div.timegrid-ylabels-window { + position: absolute; + overflow: hidden; +} + +div.timegrid-label { + position: absolute; + padding: 2px; + color: #aaa; +} + +/* Weekly View */ +div.timegrid-event { + position: absolute; + width: 100px; + background-color: #aaf; + padding: 0; + overflow: hidden; + z-index: 5; +} + +.timegrid-week-highlight { + position: absolute; + background-color: #eee; +} + +.timegrid-event div { + padding: 2px; +} + +/* Monthly View */ +div.timegrid-month-cell { + position: absolute; + padding: 0; + overflow: hidden; +} + +div.timegrid-month-cell-odd { + background-color: #eee; +} + +div.timegrid-month-cell-now { + background-color: #aaa; +} + +ul.timegrid-event-list { + list-style-position: inside; + padding-left: .5em; +} + +div.timegrid-month-label { + position: absolute; + text-align: center; + width: 100%; + z-index: 1; +} + +div.timegrid-month-label span { + display: block; + font-size: 12em; + font-weight: bold; + color: #ccc; +} + +span.timegrid-month-date-label { + position: absolute; + right: 5px; + top: 5px; +} + +/* Message */ +.timegrid-message-container { + position: absolute; + top: 30%; + left: 35%; + right: 35%; + z-index: 1000; + display: none; +} +.timegrid-message { + font-size: 120%; + font-weight: bold; + text-align: center; +} diff --git a/timegrid-api.js b/timegrid-api.js new file mode 100644 index 0000000..9e6db76 --- /dev/null +++ b/timegrid-api.js @@ -0,0 +1,131 @@ +/****************************************************************************** + * Timegrid API + * This file will load all the necessary Javascript files to make a standard + * Timegrid operate. + *****************************************************************************/ + +(function() { + var loadMe = function() { + if (typeof window.Timegrid != "undefined") { + return; + } + + window.Timegrid = { + loaded: false, + params: { autoCreate: true, bundle: false }, + importers: {} + }; + + var javascriptFiles = [ + "timegrid.js", + + "util/util.js", + "util/debug.js", + "util/date.js", + "util/excanvas.pack.js", + "util/jquery.dimensions.js", + "util/jquery.simile.js", + "util/jquery.corner.js", + "util/jquery.prettybox.js", + "util/dstructs/dstructs.js", + + "controls.js", + "listeners.js", + "grid.js", + "themes.js", + "labellers.js", + + "sources/default.js", + "sources/recurring.js", + + "layouts/layout.js", + "layouts/nmonth.js", + "layouts/nday.js", + "layouts/weekly.js", + "layouts/monthly.js", + "layouts/property.js" + ]; + var cssFiles = [ + "timegrid.css", + "themes/theme-sandy-stone-beach-ocean-diver.css" + ]; + + var locales = [ "en", "fr" ]; + + var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";"); + for (var l = 0; l < defaultClientLocales.length; l++) { + var locale = defaultClientLocales[l]; + var segments = locale.split("-"); + if (segments.length > 1) { + locales.push(segments[0]); + } + locales.push(locale); + } + + var url = SimileAjax.findScript(document, "timegrid-api.js"); + if (url == null) { + Timegrid.error = new Error("Failed to derive URL prefix for Simile Timegrid API code files"); + return; + } + Timegrid.urlPrefix = url.substr(0, url.indexOf("timegrid-api.js")); + var paramTypes = { bundle: Boolean, autoCreate: Boolean }; + SimileAjax.parseURLParameters(url, Timegrid.params, paramTypes); + + /* + * Core scripts and styles + */ + if (Timegrid.params.bundle) { + SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix, [ + "scripts/util/jquery.dimensions.js", + "scripts/util/jquery.simile.js", + "timegrid-bundle.js" + ]); + SimileAjax.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); + } else { + SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); + } + + /* + * Localization + */ + var localeFiles = []; + for (var i = 0; i < locales.length; i++) { + localeFiles.push(locales[i] + "/locale.js"); + }; + SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); + if (Timegrid.params.autoCreate) { + SimileAjax.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); + } + Timegrid.loaded = true; + }; + + /* + * Load SimileAjax if it's not already loaded + */ + if (typeof SimileAjax == "undefined") { + window.SimileAjax_onLoad = loadMe; + + //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; + var url = "http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js"; + //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; + var createScriptElement = function() { + var script = document.createElement("script"); + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = url; + document.getElementsByTagName("head")[0].appendChild(script); + } + if (document.body == null) { + try { + document.write(""); + } catch (e) { + createScriptElement(); + } + } else { + createScriptElement(); + } + } else { + loadMe(); + } +})(); From d104ce67ec0237cf4f87d657bce37752701c5b9e Mon Sep 17 00:00:00 2001 From: Quanquan Liu Date: Mon, 13 Jan 2014 18:59:23 -0500 Subject: [PATCH 03/43] added simile jquery plugin --- scripts/grid.js | 1 - timegrid-api.js | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/grid.js b/scripts/grid.js index 3bff36f..a73db88 100644 --- a/scripts/grid.js +++ b/scripts/grid.js @@ -20,7 +20,6 @@ Timegrid.Grid = function(objs, xSize, ySize, xMapper, yMapper) { this.addAll(objs); }; -debugger; $.inherit(Timegrid.Grid, Timegrid.ListenerAware); Timegrid.Grid.prototype.add = function(obj) { diff --git a/timegrid-api.js b/timegrid-api.js index 9e6db76..bb7d61f 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -107,14 +107,16 @@ window.SimileAjax_onLoad = loadMe; //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var url = "http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js"; + var urls = ["http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js", "http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"]; //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; var createScriptElement = function() { - var script = document.createElement("script"); - script.type = "text/javascript"; - script.language = "JavaScript"; - script.src = url; - document.getElementsByTagName("head")[0].appendChild(script); + for (url in urls) { + var script = document.createElement("script"); + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = url; + document.getElementsByTagName("head")[0].appendChild(script); + } } if (document.body == null) { try { From aac9177d10b14cf828258ed42ba17de3d640ff58 Mon Sep 17 00:00:00 2001 From: Quanquan Liu Date: Mon, 13 Jan 2014 19:23:25 -0500 Subject: [PATCH 04/43] fix jquery clash with simileajax --- timegrid-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timegrid-api.js b/timegrid-api.js index bb7d61f..96cfc3a 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -107,7 +107,7 @@ window.SimileAjax_onLoad = loadMe; //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var urls = ["http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js", "http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"]; + var urls = ["http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"]; //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; var createScriptElement = function() { for (url in urls) { From c976c72e04221f458e58f90c94ca44cde8b03aaf Mon Sep 17 00:00:00 2001 From: qqliu Date: Tue, 14 Jan 2014 11:00:19 -0500 Subject: [PATCH 05/43] updated timegrid to get rid of simileajax --- timegrid-api.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/timegrid-api.js b/timegrid-api.js index 96cfc3a..f438581 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -103,20 +103,21 @@ /* * Load SimileAjax if it's not already loaded */ - if (typeof SimileAjax == "undefined") { + /*if (typeof SimileAjax == "undefined") { window.SimileAjax_onLoad = loadMe; //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var urls = ["http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"]; + var url = "http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"; //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; + debugger; var createScriptElement = function() { - for (url in urls) { - var script = document.createElement("script"); - script.type = "text/javascript"; - script.language = "JavaScript"; - script.src = url; - document.getElementsByTagName("head")[0].appendChild(script); - } + console.log("hiiiii" + url); + var script = document.createElement("script"); + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = url; + document.getElementsByTagName("head")[0].appendChild(script); + console.log(url); } if (document.body == null) { try { @@ -129,5 +130,5 @@ } } else { loadMe(); - } + }*/ })(); From 44b5b27f395e971500766499bfb11f0aa2b93d49 Mon Sep 17 00:00:00 2001 From: qqliu Date: Tue, 14 Jan 2014 11:26:06 -0500 Subject: [PATCH 06/43] Updated to previous version --- timegrid-api.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/timegrid-api.js b/timegrid-api.js index f438581..f55e4c9 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -103,21 +103,20 @@ /* * Load SimileAjax if it's not already loaded */ - /*if (typeof SimileAjax == "undefined") { + if (typeof SimileAjax == "undefined") { window.SimileAjax_onLoad = loadMe; //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var url = "http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"; + var urls = ["http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js", "http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"]; //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; - debugger; var createScriptElement = function() { - console.log("hiiiii" + url); - var script = document.createElement("script"); - script.type = "text/javascript"; - script.language = "JavaScript"; - script.src = url; - document.getElementsByTagName("head")[0].appendChild(script); - console.log(url); + for (url in urls) { + var script = document.createElement("script"); + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = urls[url]; + document.getElementsByTagName("head")[0].appendChild(script); + } } if (document.body == null) { try { @@ -130,5 +129,5 @@ } } else { loadMe(); - }*/ + } })(); From 57de4e493ecf5237769b110951394df2590a6b54 Mon Sep 17 00:00:00 2001 From: qqliu Date: Tue, 14 Jan 2014 16:44:07 -0500 Subject: [PATCH 07/43] Finally fixed jquery bug --- scripts/grid.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/grid.js b/scripts/grid.js index a73db88..7c3fb5d 100644 --- a/scripts/grid.js +++ b/scripts/grid.js @@ -20,6 +20,7 @@ Timegrid.Grid = function(objs, xSize, ySize, xMapper, yMapper) { this.addAll(objs); }; + $.inherit(Timegrid.Grid, Timegrid.ListenerAware); Timegrid.Grid.prototype.add = function(obj) { From c3a9255c2e0be601c9b6334ca92b67413be93ef1 Mon Sep 17 00:00:00 2001 From: qqliu Date: Wed, 15 Jan 2014 17:43:33 -0500 Subject: [PATCH 08/43] Migrated simile ajax to jquery and fixed SimileAjax errors in timegrid-api --- scripts/jquery.simile.ajax.js | 142 ++++++++++++++++++++++++++++++++++ timegrid-api.js | 22 +++--- 2 files changed, 152 insertions(+), 12 deletions(-) create mode 100644 scripts/jquery.simile.ajax.js diff --git a/scripts/jquery.simile.ajax.js b/scripts/jquery.simile.ajax.js new file mode 100644 index 0000000..4300319 --- /dev/null +++ b/scripts/jquery.simile.ajax.js @@ -0,0 +1,142 @@ +/*================================================== + * This code implements the Simile Ajax jQuery plugin, which in turns simply + * provides several convenient and useful functions for manipulating the + * DOM provided by Simile Ajax which you can view here: + * + * http://simile.mit.edu/ajax/api/simile-ajax-api.js + * @overview Simile Ajax jQuery plugin + * + *================================================== + */ + +jQuery.extend({ + getHead: function(doc) { + return doc.getElementsByTagName("head")[0]; + }, + + findScript: function(doc, substring) { + var heads = doc.documentElement.getElementsByTagName("head"); + for (var h = 0; h < heads.length; h++) { + var node = heads[h].firstChild; + while (node != null) { + if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") { + var url = node.src; + var i = url.indexOf(substring); + if (i >= 0) { + return url; + } + } + node = node.nextSibling; + } + } + return null; + }, + + /** + * Parse out the query parameters from a URL + * @param {String} url the url to parse, or location.href if undefined + * @param {Object} to optional object to extend with the parameters + * @param {Object} types optional object mapping keys to value types + * (String, Number, Boolean or Array, String by default) + * @return a key/value Object whose keys are the query parameter names + * @type Object + */ + parseURLParameters: function(url, to, types) { + to = to || {}; + types = types || {}; + + if (typeof url == "undefined") { + url = location.href; + } + var q = url.indexOf("?"); + if (q < 0) { + return to; + } + url = (url+"#").slice(q+1, url.indexOf("#")); // toss the URL fragment + + var params = url.split("&"), param, parsed = {}; + var decode = window.decodeURIComponent || unescape; + for (var i = 0; param = params[i]; i++) { + var eq = param.indexOf("="); + var name = decode(param.slice(0,eq)); + var old = parsed[name]; + if (typeof old == "undefined") { + old = []; + } else if (!(old instanceof Array)) { + old = [old]; + } + parsed[name] = old.concat(decode(param.slice(eq+1))); + } + for (var i in parsed) { + if (!parsed.hasOwnProperty(i)) continue; + var type = types[i] || String; + var data = parsed[i]; + if (!(data instanceof Array)) { + data = [data]; + } + if (type === Boolean && data[0] == "false") { + to[i] = false; // because Boolean("false") === true + } else { + to[i] = type.apply(this, data); + } + } + return to; + }, + + includeJavascriptFile: function(doc, url, onerror, charset) { + onerror = onerror || ""; + if (doc.body == null) { + try { + var q = "'" + onerror.replace( /'/g, '&apos' ) + "'"; // " + doc.write(""); + return; + } catch (e) { + // fall through + } + } + + var script = doc.createElement("script"); + if (onerror) { + try { script.innerHTML = onerror; } catch(e) {} + script.setAttribute("onerror", onerror); + } + if (charset) { + script.setAttribute("charset", charset); + } + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = url; + return getHead(doc).appendChild(script); + }, + + includeJavascriptFiles: function(doc, urlPrefix, filenames) { + $.each(filenames, function (index, value) { + $.includeJavascriptFile(doc, urlPrefix + value); + }); + }, + + includeCssFile: function(doc, url) { + if (doc.body == null) { + try { + doc.write(""); + return; + } catch (e) { + // fall through + } + } + + var link = doc.createElement("link"); + link.setAttribute("rel", "stylesheet"); + link.setAttribute("type", "text/css"); + link.setAttribute("href", url); + getHead(doc).appendChild(link); + }, + + includeCssFiles: function(doc, urlPrefix, filenames) { + $.each(filenames, function (index, value) { + $.includeCssFile(doc, urlPrefix + value); + }); + } +}); \ No newline at end of file diff --git a/timegrid-api.js b/timegrid-api.js index f55e4c9..df146a3 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -5,7 +5,6 @@ *****************************************************************************/ (function() { - var loadMe = function() { if (typeof window.Timegrid != "undefined") { return; } @@ -62,28 +61,28 @@ locales.push(locale); } - var url = SimileAjax.findScript(document, "timegrid-api.js"); + var url = $.findScript(document, "timegrid-api.js"); if (url == null) { Timegrid.error = new Error("Failed to derive URL prefix for Simile Timegrid API code files"); return; } Timegrid.urlPrefix = url.substr(0, url.indexOf("timegrid-api.js")); var paramTypes = { bundle: Boolean, autoCreate: Boolean }; - SimileAjax.parseURLParameters(url, Timegrid.params, paramTypes); + $.parseURLParameters(url, Timegrid.params, paramTypes); /* * Core scripts and styles */ if (Timegrid.params.bundle) { - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix, [ + $.includeJavascriptFiles(document, Timegrid.urlPrefix, [ "scripts/util/jquery.dimensions.js", "scripts/util/jquery.simile.js", "timegrid-bundle.js" ]); - SimileAjax.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); + $.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); } else { - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); + $.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); + $.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); } /* @@ -93,17 +92,16 @@ for (var i = 0; i < locales.length; i++) { localeFiles.push(locales[i] + "/locale.js"); }; - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); + $.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); if (Timegrid.params.autoCreate) { - SimileAjax.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); + $.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); } Timegrid.loaded = true; - }; /* * Load SimileAjax if it's not already loaded */ - if (typeof SimileAjax == "undefined") { + /*if (typeof SimileAjax == "undefined") { window.SimileAjax_onLoad = loadMe; //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; @@ -129,5 +127,5 @@ } } else { loadMe(); - } + }*/ })(); From 03957f1e4bd143d6a22c88aa54bb6ed5d429f2d0 Mon Sep 17 00:00:00 2001 From: qqliu Date: Thu, 16 Jan 2014 01:49:09 -0500 Subject: [PATCH 09/43] migrated more simile ajax functions to jquery plugin and made modifications in timegrid and util --- locales/en/locale.js | 8 +- locales/fr/locale.js | 8 +- scripts/jquery.simile.ajax.js | 216 ++++++++++++++++++++++++++++++++++ scripts/timegrid.js | 18 +-- scripts/util/util.js | 4 +- 5 files changed, 235 insertions(+), 19 deletions(-) diff --git a/locales/en/locale.js b/locales/en/locale.js index 6e5c6c1..6836e87 100644 --- a/locales/en/locale.js +++ b/locales/en/locale.js @@ -20,12 +20,12 @@ var urlPrefix = Timegrid.urlPrefix + "locales/en/"; if (Timegrid.params.bundle) { - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); + $.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + $.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); } } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + $.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + $.includeCssFiles(document, urlPrefix + "styles/", cssFiles); } })(); diff --git a/locales/fr/locale.js b/locales/fr/locale.js index ff834d3..f2d57af 100644 --- a/locales/fr/locale.js +++ b/locales/fr/locale.js @@ -19,12 +19,12 @@ var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; if (Timegrid.bundle) { - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); + $.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); + $.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); } } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + $.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + $.includeCssFiles(document, urlPrefix + "styles/", cssFiles); } })(); diff --git a/scripts/jquery.simile.ajax.js b/scripts/jquery.simile.ajax.js index 4300319..628f82f 100644 --- a/scripts/jquery.simile.ajax.js +++ b/scripts/jquery.simile.ajax.js @@ -138,5 +138,221 @@ jQuery.extend({ $.each(filenames, function (index, value) { $.includeCssFile(doc, urlPrefix + value); }); + }, + + debugLog: function(msg, silent) { + var f; + if ("console" in window && "log" in window.console) { // FireBug installed + f = function(msg2) { + console.log(msg2); + } + } else { + f = function(msg2) { + if (!silent) { + alert(msg2); + } + } + } + f(msg); + }, + + createMessageBubble: function(doc, urlPrefix) { + var an = navigator.appName.toLowerCase(); + var containerDiv = doc.createElement("div"); + var pngIsTranslucent = (an.indexOf("microsoft") == -1) || ($.getBrowserMajorVersion() > 6); + if (pngIsTranslucent) { + var topDiv = doc.createElement("div"); + topDiv.style.height = "33px"; + topDiv.style.background = "url(" + urlPrefix + "images/message-top-left.png) top left no-repeat"; + topDiv.style.paddingLeft = "44px"; + containerDiv.appendChild(topDiv); + + var topRightDiv = doc.createElement("div"); + topRightDiv.style.height = "33px"; + topRightDiv.style.background = "url(" + urlPrefix + "images/message-top-right.png) top right no-repeat"; + topDiv.appendChild(topRightDiv); + + var middleDiv = doc.createElement("div"); + middleDiv.style.background = "url(" + urlPrefix + "images/message-left.png) top left repeat-y"; + middleDiv.style.paddingLeft = "44px"; + containerDiv.appendChild(middleDiv); + + var middleRightDiv = doc.createElement("div"); + middleRightDiv.style.background = "url(" + urlPrefix + "images/message-right.png) top right repeat-y"; + middleRightDiv.style.paddingRight = "44px"; + middleDiv.appendChild(middleRightDiv); + + var contentDiv = doc.createElement("div"); + middleRightDiv.appendChild(contentDiv); + + var bottomDiv = doc.createElement("div"); + bottomDiv.style.height = "55px"; + bottomDiv.style.background = "url(" + urlPrefix + "images/message-bottom-left.png) bottom left no-repeat"; + bottomDiv.style.paddingLeft = "44px"; + containerDiv.appendChild(bottomDiv); + + var bottomRightDiv = doc.createElement("div"); + bottomRightDiv.style.height = "55px"; + bottomRightDiv.style.background = "url(" + urlPrefix + "images/message-bottom-right.png) bottom right no-repeat"; + bottomDiv.appendChild(bottomRightDiv); + } else { + containerDiv.style.border = "2px solid #7777AA"; + containerDiv.style.padding = "20px"; + containerDiv.style.background = "white"; + $.setOpacity(containerDiv, 90); + + var contentDiv = doc.createElement("div"); + containerDiv.appendChild(contentDiv); + } + + return { + containerDiv: containerDiv, + contentDiv: contentDiv + }; + }, + + setOpacity: function(elmt, opacity) { + var an = navigator.appName.toLowerCase(); + + if (an.indexOf("microsoft") == -1) { + elmt.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity=" + opacity + ")"; + } else { + var o = (opacity / 100).toString(); + elmt.style.opacity = o; + elmt.style.MozOpacity = o; + } + }, + + getBrowserMajorVersion: function() { + var ua = navigator.userAgent.toLowerCase(); + + var isIE = (an.indexOf("microsoft") != -1); + var isNetscape = (an.indexOf("netscape") != -1); + var isMozilla = (ua.indexOf("mozilla") != -1); + var isFirefox = (ua.indexOf("firefox") != -1); + var isOpera = (an.indexOf("opera") != -1); + var isSafari = (an.indexOf("safari") != -1); + + var browserMajorVersion; + var parseVersionString = function(s) { + var a = s.split("."); + browserMajorVersion = parseInt(a[0]); + }; + + if (isMozilla) { + var offset = ua.indexOf("mozilla/"); + if (offset >= 0) { + parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); + } + } + if (isIE) { + var offset = ua.indexOf("msie "); + if (offset >= 0) { + parseVersionString(ua.substring(offset + 5, indexOf(ua, ";", offset))); + } + } + if (isNetscape) { + var offset = ua.indexOf("rv:"); + if (offset >= 0) { + parseVersionString(ua.substring(offset + 3, indexOf(ua, ")", offset))); + } + } + if (isFirefox) { + var offset = ua.indexOf("firefox/"); + if (offset >= 0) { + parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); + } + } + return browserMajorVersion; + }, + + getXmlHttp: function(url, fError, fDone) { + var xmlhttp = $.createXmlHttpRequest(); + + xmlhttp.open("GET", url, true); + xmlhttp.onreadystatechange = function() { + $.onReadyStateChange(xmlhttp, fError, fDone); + }; + xmlhttp.send(null); + }, + + /** + * Creates an XMLHttpRequest object. On the first run, this + * function creates a platform-specific function for + * instantiating an XMLHttpRequest object and then replaces + * itself with that function. + */ + createXmlHttpRequest: function() { + var isIE = (an.indexOf("microsoft") != -1); + if (isIE) { + var programIDs = [ + "Msxml2.XMLHTTP", + "Microsoft.XMLHTTP", + "Msxml2.XMLHTTP.4.0" + ]; + for (var i = 0; i < programIDs.length; i++) { + try { + var programID = programIDs[i]; + var f = function() { + return new ActiveXObject(programID); + }; + var o = f(); + + // We are replacing the SimileAjax._createXmlHttpRequest + // function with this inner function as we've + // found out that it works. This is so that we + // don't have to do all the testing over again + // on subsequent calls. + return f; + + return o; + } catch (e) { + // silent + } + } + // fall through to try new XMLHttpRequest(); + } + + try { + var f = function() { + return new XMLHttpRequest(); + }; + var o = f(); + + return o; + } catch (e) { + throw new Error("Failed to create an XMLHttpRequest object"); + } + }, + + onReadyStateChange: function(xmlhttp, fError, fDone) { + switch (xmlhttp.readyState) { + // 1: Request not yet made + // 2: Contact established with server but nothing downloaded yet + // 3: Called multiple while downloading in progress + + // Download complete + case 4: + try { + if (xmlhttp.status == 0 // file:// urls, works on Firefox + || xmlhttp.status == 200 // http:// urls + ) { + if (fDone) { + fDone(xmlhttp); + } + } else { + if (fError) { + fError( + xmlhttp.statusText, + xmlhttp.status, + xmlhttp + ); + } + } + } catch (e) { + SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange", e); + } + break; + } } }); \ No newline at end of file diff --git a/scripts/timegrid.js b/scripts/timegrid.js index c92e843..d1f8f91 100644 --- a/scripts/timegrid.js +++ b/scripts/timegrid.js @@ -54,7 +54,7 @@ Timegrid.getConfigFromDOM = function(elmt) { Timegrid.loadXML = function(url, f) { var fError = function(statusText, status, xmlhttp) { //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); - SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + $.debugLog(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText, true); }; var fDone = function(xmlhttp) { var xml = xmlhttp.responseXML; @@ -63,18 +63,18 @@ Timegrid.loadXML = function(url, f) { } f(xml, url); }; - SimileAjax.XmlHttp.get(url, fError, fDone); + $.getXmlHttp(url, fError, fDone); }; Timegrid.loadJSON = function(url, f) { var fError = function(statusText, status, xmlhttp) { //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); - SimileAjax.Debug.log(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); + $.debugLog(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); }; var fDone = function(xmlhttp) { f(eval('(' + xmlhttp.responseText + ')'), url); }; - SimileAjax.XmlHttp.get(url, fError, fDone); + $.getXmlHttp(url, fError, fDone); }; Timegrid._Impl = function(node, eventSource, layoutNames, layoutParams) { @@ -100,7 +100,7 @@ Timegrid._Impl.prototype.loadXML = function(url, f) { var fError = function(statusText, status, xmlhttp) { //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); - SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + $.debugLog(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); tg.hideLoadingMessage(); }; var fDone = function(xmlhttp) { @@ -116,7 +116,7 @@ Timegrid._Impl.prototype.loadXML = function(url, f) { }; this.showLoadingMessage(); window.setTimeout(function() { - SimileAjax.XmlHttp.get(url, fError, fDone); + $.getXmlHttp(url, fError, fDone); }, 0); }; @@ -124,7 +124,7 @@ Timegrid._Impl.prototype.loadJSON = function(url, f) { var tg = this; var fError = function(statusText, status, xmlhttp) { //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); - SimileAjax.Debug.log(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); + $.debugLog(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); tg.hideLoadingMessage(); }; var fDone = function(xmlhttp) { @@ -135,7 +135,7 @@ Timegrid._Impl.prototype.loadJSON = function(url, f) { } }; this.showLoadingMessage(); - window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0); + window.setTimeout(function() { $.getXmlHttp(url, fError, fDone); }, 0); }; Timegrid._Impl.prototype._construct = function() { @@ -158,7 +158,7 @@ Timegrid._Impl.prototype._construct = function() { } $(container).addClass('timegrid-default'); - var message = SimileAjax.Graphics.createMessageBubble(doc); + var message = $.createMessageBubble(doc, "timegrid"); message.containerDiv.className = "timegrid-message-container"; container.appendChild(message.containerDiv); diff --git a/scripts/util/util.js b/scripts/util/util.js index f325e96..38dffc8 100644 --- a/scripts/util/util.js +++ b/scripts/util/util.js @@ -9,7 +9,7 @@ Timegrid.abstract = function(name) { }; }; -SimileAjax.DateTime.Interval = function(ms) { +/*SimileAjax.DateTime.Interval = function(ms) { // Conversion factors as varants to eliminate all the multiplication var SECONDS_CF = 1000; var MINUTES_CF = 60000; @@ -44,4 +44,4 @@ SimileAjax.DateTime.Interval = function(ms) { SimileAjax.DateTime.Interval.prototype.toString = function() { return this.milliseconds.toString(); -}; +};*/ From b8e594432749ba3e07b73ca4bcc6d8c3e1cce444 Mon Sep 17 00:00:00 2001 From: qqliu Date: Thu, 16 Jan 2014 19:04:13 -0500 Subject: [PATCH 10/43] Fixed creating DOM object issue --- scripts/controls.js | 20 ++++++++++++++------ scripts/timegrid.js | 3 +-- timegrid-api.js | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/controls.js b/scripts/controls.js index 6e9a40a..5c6e53a 100644 --- a/scripts/controls.js +++ b/scripts/controls.js @@ -65,12 +65,20 @@ Timegrid.Controls.TabSet.prototype.render = function(container) { return function() { self.switchTo(title); }; }; for (var lTitle in this._layoutMap) { - var tab = $('') - .height(this._layoutMap[lTitle].tabHeight + "px") - .click(makeCallback(lTitle)) - .addClass('timegrid-tab').addClass('timegrid-rounded'); - tabDiv.prepend(tab); - this._tabs[lTitle] = tab; + $newLink = $("", { + href : "javascript:void", + text : lTitle + }); + + $tab = $('
      ', { height : this._layoutMap[lTitle].tabHeight + "px"}) + .addClass("timegrid-tab") + .addClass('timegrid-rounded') + .append($newLink); + + $tab.click(makeCallback(lTitle)); + + tabDiv.prepend($tab); + this._tabs[lTitle] = $tab; } if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } }; diff --git a/scripts/timegrid.js b/scripts/timegrid.js index d1f8f91..7a135b5 100644 --- a/scripts/timegrid.js +++ b/scripts/timegrid.js @@ -158,7 +158,7 @@ Timegrid._Impl.prototype._construct = function() { } $(container).addClass('timegrid-default'); - var message = $.createMessageBubble(doc, "timegrid"); + var message = $.createMessageBubble(doc, Timegrid.urlPrefix); message.containerDiv.className = "timegrid-message-container"; container.appendChild(message.containerDiv); @@ -168,7 +168,6 @@ Timegrid._Impl.prototype._construct = function() { this.showLoadingMessage = function() { $(message.containerDiv).show(); }; this.hideLoadingMessage = function() { $(message.containerDiv).hide(); }; - this._panel.render(container); this.rendering = false; }; diff --git a/timegrid-api.js b/timegrid-api.js index df146a3..8304c21 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -50,7 +50,7 @@ ]; var locales = [ "en", "fr" ]; - + var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";"); for (var l = 0; l < defaultClientLocales.length; l++) { var locale = defaultClientLocales[l]; @@ -93,7 +93,7 @@ localeFiles.push(locales[i] + "/locale.js"); }; $.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); - if (Timegrid.params.autoCreate) { + if (Timegrid.params.autoCreate) { $.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); } Timegrid.loaded = true; From f49573626962a2e982f6f51abdb3447f72934ddf Mon Sep 17 00:00:00 2001 From: qqliu Date: Thu, 16 Jan 2014 19:06:52 -0500 Subject: [PATCH 11/43] residual changes not commited --- scripts/grid.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/grid.js b/scripts/grid.js index 7c3fb5d..a73db88 100644 --- a/scripts/grid.js +++ b/scripts/grid.js @@ -20,7 +20,6 @@ Timegrid.Grid = function(objs, xSize, ySize, xMapper, yMapper) { this.addAll(objs); }; - $.inherit(Timegrid.Grid, Timegrid.ListenerAware); Timegrid.Grid.prototype.add = function(obj) { From a31e281e93f6d09afe7192c0357e773d947b4356 Mon Sep 17 00:00:00 2001 From: qqliu Date: Fri, 17 Jan 2014 16:46:40 -0500 Subject: [PATCH 12/43] Fixed date/time errors, migrated to jquery --- scripts/jquery.simile.ajax.js | 34 ++++++++++++++++++++++++++++++++++ scripts/layouts/nday.js | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/scripts/jquery.simile.ajax.js b/scripts/jquery.simile.ajax.js index 628f82f..24ff59f 100644 --- a/scripts/jquery.simile.ajax.js +++ b/scripts/jquery.simile.ajax.js @@ -354,5 +354,39 @@ jQuery.extend({ } break; } + }, + + dateTimeInterval: function(ms) { + var SECONDS_CF = 1000; + var MINUTES_CF = 60000; + var HOURS_CF = 3600000; + var DAYS_CF = 86400000; + var WEEKS_CF = 604800000; + var FORTNIGHTS_CF = 1209600000; + var MONTHS_CF = 2592000000; + var QUARTERS_CF = 7776000000; + var YEARS_CF = 31557600000; + var DECADES_CF = 315576000000; + var CENTURIES_CF = 3155760000000; + + this.milliseconds = Math.abs(ms); + this.seconds = Math.round(this.milliseconds / SECONDS_CF); + this.minutes = Math.round(this.milliseconds / MINUTES_CF); + this.hours = Math.round(this.milliseconds / HOURS_CF); + this.days = Math.floor(this.milliseconds / DAYS_CF); + this.weeks = Math.round(this.milliseconds / WEEKS_CF); + this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); + this.months = Math.round(this.milliseconds / MONTHS_CF); + // rounding errors! + this.quarters = Math.round(this.milliseconds / QUARTERS_CF); + // rounding errors! + this.years = Math.round(this.milliseconds / YEARS_CF); + // rounding errors! + this.decades = Math.round(this.milliseconds / DECADES_CF); + // rounding errors! + this.centuries = Math.round(this.milliseconds / CENTURIES_CF); + // rounding errors! + + return this; } }); \ No newline at end of file diff --git a/scripts/layouts/nday.js b/scripts/layouts/nday.js index bf68f9e..dd6ec9a 100644 --- a/scripts/layouts/nday.js +++ b/scripts/layouts/nday.js @@ -28,7 +28,7 @@ Timegrid.NDayLayout = function(eventSource, params) { this.xMapper = function(obj) { var time = self.timezoneMapper(obj.time); var start = self.timezoneMapper(self.startTime); - var ivl = new SimileAjax.DateTime.Interval(time - start); + var ivl = $.dateTimeInterval(time - start); return ivl.days; }; this.yMapper = function(obj) { From cea12b08d4914cf42cd7c90bfef2237101b6b7d6 Mon Sep 17 00:00:00 2001 From: qqliu Date: Fri, 17 Jan 2014 17:44:18 -0500 Subject: [PATCH 13/43] fixed more jqeury dom creation problems --- scripts/controls.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/controls.js b/scripts/controls.js index 5c6e53a..0405cb7 100644 --- a/scripts/controls.js +++ b/scripts/controls.js @@ -141,16 +141,20 @@ Timegrid.Controls.Iterator.prototype.render = function(container) { self.render(); }; }; - var prevLink = $('Previous') - .wrap('
      ').parent() - .addClass('timegrid-iterator-prev') - .click(makePrevCallback(this._layout)); - var nextLink = $('Next') - .wrap('').parent() + $imageURL = Timegrid.urlPrefix + "/images/go-previous.png"; + $prevLink = $('', {href: "javascript:void"}) + .append('', {alt: "Previous", src: $imageURL}) + .parent() + .addClass('timegrid-iterator-prev'); + $imageURL = Timegrid.urlPrefix + "/images/go-next.png"; + $nextLink = $('', {href: "javascript:void"}) + .append('', {alt: "Next", scr: $imageURL}) + .parent() .addClass('timegrid-iterator-next') - .click(makeNextCallback(this._layout)); - this._div.append(prevLink); - this._div.append(nextLink); - this._div.append('' + this._layout.getCurrent() + ''); + $nextLink.click(makeNextCallback(this._layout)); + this._div.append($prevLink); + this._div.append($nextLink); + $s = $('', { text: this._layout.getCurrent() } ); + this._div.append('', { text: this._layout.getCurrent() } ); return this._div; }; From 395d04a7dbf2bd4c8353bb55ce96dafec3eea034 Mon Sep 17 00:00:00 2001 From: qqliu Date: Fri, 17 Jan 2014 17:46:24 -0500 Subject: [PATCH 14/43] minor thing --- scripts/controls.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/controls.js b/scripts/controls.js index 0405cb7..a1e5ef3 100644 --- a/scripts/controls.js +++ b/scripts/controls.js @@ -154,7 +154,6 @@ Timegrid.Controls.Iterator.prototype.render = function(container) { $nextLink.click(makeNextCallback(this._layout)); this._div.append($prevLink); this._div.append($nextLink); - $s = $('', { text: this._layout.getCurrent() } ); this._div.append('', { text: this._layout.getCurrent() } ); return this._div; }; From 4735af4acea86dae5cf694049fb67ebd0181c8d1 Mon Sep 17 00:00:00 2001 From: qqliu Date: Fri, 17 Jan 2014 23:45:27 -0500 Subject: [PATCH 15/43] fixed all errors in timegrid rendering --- scripts/controls.js | 14 ++++++-------- scripts/jquery.simile.ajax.js | 35 +---------------------------------- scripts/layouts/layout.js | 2 +- scripts/layouts/nday.js | 2 +- scripts/util/jquery.simile.js | 2 +- scripts/util/util.js | 8 +++++--- timegrid-api.js | 31 ------------------------------- 7 files changed, 15 insertions(+), 79 deletions(-) diff --git a/scripts/controls.js b/scripts/controls.js index a1e5ef3..a14d31a 100644 --- a/scripts/controls.js +++ b/scripts/controls.js @@ -141,19 +141,17 @@ Timegrid.Controls.Iterator.prototype.render = function(container) { self.render(); }; }; - $imageURL = Timegrid.urlPrefix + "/images/go-previous.png"; + $imageURL = Timegrid.urlPrefix + "images/go-previous.png"; $prevLink = $('', {href: "javascript:void"}) - .append('', {alt: "Previous", src: $imageURL}) - .parent() - .addClass('timegrid-iterator-prev'); - $imageURL = Timegrid.urlPrefix + "/images/go-next.png"; + .addClass('timegrid-iterator-prev') + .append($('', {alt: "Previous", src: $imageURL})); + $imageURL = Timegrid.urlPrefix + "images/go-next.png"; $nextLink = $('', {href: "javascript:void"}) - .append('', {alt: "Next", scr: $imageURL}) - .parent() .addClass('timegrid-iterator-next') + .append($('', {alt: "Next", src: $imageURL})); $nextLink.click(makeNextCallback(this._layout)); this._div.append($prevLink); this._div.append($nextLink); - this._div.append('', { text: this._layout.getCurrent() } ); + this._div.append($('', { text: this._layout.getCurrent() })); return this._div; }; diff --git a/scripts/jquery.simile.ajax.js b/scripts/jquery.simile.ajax.js index 24ff59f..f315c8f 100644 --- a/scripts/jquery.simile.ajax.js +++ b/scripts/jquery.simile.ajax.js @@ -354,39 +354,6 @@ jQuery.extend({ } break; } - }, - - dateTimeInterval: function(ms) { - var SECONDS_CF = 1000; - var MINUTES_CF = 60000; - var HOURS_CF = 3600000; - var DAYS_CF = 86400000; - var WEEKS_CF = 604800000; - var FORTNIGHTS_CF = 1209600000; - var MONTHS_CF = 2592000000; - var QUARTERS_CF = 7776000000; - var YEARS_CF = 31557600000; - var DECADES_CF = 315576000000; - var CENTURIES_CF = 3155760000000; - - this.milliseconds = Math.abs(ms); - this.seconds = Math.round(this.milliseconds / SECONDS_CF); - this.minutes = Math.round(this.milliseconds / MINUTES_CF); - this.hours = Math.round(this.milliseconds / HOURS_CF); - this.days = Math.floor(this.milliseconds / DAYS_CF); - this.weeks = Math.round(this.milliseconds / WEEKS_CF); - this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); - this.months = Math.round(this.milliseconds / MONTHS_CF); - // rounding errors! - this.quarters = Math.round(this.milliseconds / QUARTERS_CF); - // rounding errors! - this.years = Math.round(this.milliseconds / YEARS_CF); - // rounding errors! - this.decades = Math.round(this.milliseconds / DECADES_CF); - // rounding errors! - this.centuries = Math.round(this.milliseconds / CENTURIES_CF); - // rounding errors! - - return this; } + }); \ No newline at end of file diff --git a/scripts/layouts/layout.js b/scripts/layouts/layout.js index 41604af..092f0f7 100644 --- a/scripts/layouts/layout.js +++ b/scripts/layouts/layout.js @@ -41,7 +41,7 @@ Timegrid.LayoutFactory.registerLayout = function(name, constructor) { Timegrid.LayoutFactory.createLayout = function(name, eventSource, params) { var constructor = Timegrid.LayoutFactory._constructors[name]; if (typeof constructor == 'function') { - layout = new constructor(eventSource, $.clone(params)); + layout = new constructor(eventSource, $.deepClone(params)); return layout; } else { throw "No such layout!"; diff --git a/scripts/layouts/nday.js b/scripts/layouts/nday.js index dd6ec9a..705dad1 100644 --- a/scripts/layouts/nday.js +++ b/scripts/layouts/nday.js @@ -28,7 +28,7 @@ Timegrid.NDayLayout = function(eventSource, params) { this.xMapper = function(obj) { var time = self.timezoneMapper(obj.time); var start = self.timezoneMapper(self.startTime); - var ivl = $.dateTimeInterval(time - start); + var ivl = Timegrid.Interval(time - start); return ivl.days; }; this.yMapper = function(obj) { diff --git a/scripts/util/jquery.simile.js b/scripts/util/jquery.simile.js index cf0c4e5..97ddac5 100644 --- a/scripts/util/jquery.simile.js +++ b/scripts/util/jquery.simile.js @@ -26,7 +26,7 @@ jQuery.extend({ /** * Recursively deep-copies the given object. */ - clone: function(obj, deep) { + deepClone: function(obj, deep) { if (deep == null) { deep = true; } var objectClone = new obj.constructor(); for (var property in obj) { diff --git a/scripts/util/util.js b/scripts/util/util.js index 38dffc8..4639110 100644 --- a/scripts/util/util.js +++ b/scripts/util/util.js @@ -9,7 +9,7 @@ Timegrid.abstract = function(name) { }; }; -/*SimileAjax.DateTime.Interval = function(ms) { +Timegrid.Interval = function(ms) { // Conversion factors as varants to eliminate all the multiplication var SECONDS_CF = 1000; var MINUTES_CF = 60000; @@ -40,8 +40,10 @@ Timegrid.abstract = function(name) { // rounding errors! this.centuries = Math.round(this.milliseconds / CENTURIES_CF); // rounding errors! + + return this; }; -SimileAjax.DateTime.Interval.prototype.toString = function() { +Timegrid.IntervaltoString = function() { return this.milliseconds.toString(); -};*/ +}; diff --git a/timegrid-api.js b/timegrid-api.js index 8304c21..4352892 100644 --- a/timegrid-api.js +++ b/timegrid-api.js @@ -97,35 +97,4 @@ $.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); } Timegrid.loaded = true; - - /* - * Load SimileAjax if it's not already loaded - */ - /*if (typeof SimileAjax == "undefined") { - window.SimileAjax_onLoad = loadMe; - - //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var urls = ["http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js", "http://simile-widgets.googlecode.com/svn-history/r900/timegrid/trunk/src/webapp/api/scripts/util/jquery.simile.js"]; - //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; - var createScriptElement = function() { - for (url in urls) { - var script = document.createElement("script"); - script.type = "text/javascript"; - script.language = "JavaScript"; - script.src = urls[url]; - document.getElementsByTagName("head")[0].appendChild(script); - } - } - if (document.body == null) { - try { - document.write(""); - } catch (e) { - createScriptElement(); - } - } else { - createScriptElement(); - } - } else { - loadMe(); - }*/ })(); From 1ff6a8cd21a48e28f6f1d913edee9d83a7bbd208 Mon Sep 17 00:00:00 2001 From: qqliu Date: Fri, 17 Jan 2014 23:46:37 -0500 Subject: [PATCH 16/43] trivial --- images/message-bottom-left.png | Bin 0 -> 1339 bytes images/message-bottom-right.png | Bin 0 -> 2074 bytes images/message-left.png | Bin 0 -> 717 bytes images/message-right.png | Bin 0 -> 1892 bytes images/message-top-left.png | Bin 0 -> 918 bytes images/message-top-right.png | Bin 0 -> 1604 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 images/message-bottom-left.png create mode 100644 images/message-bottom-right.png create mode 100644 images/message-left.png create mode 100644 images/message-right.png create mode 100644 images/message-top-left.png create mode 100644 images/message-top-right.png diff --git a/images/message-bottom-left.png b/images/message-bottom-left.png new file mode 100644 index 0000000000000000000000000000000000000000..43a9d616788048dc90eb8a7f62f86a9296ce8577 GIT binary patch literal 1339 zcmV-B1;qM^P)~Cqf*U zEMBe#G0vTPBuq(pj4R{;0*Hy+5&@UmdGkv5{rU6z$k(qwS&tvTCrC^>#^pF{;s61} zgvSxYh+_@q&!68c1~HBtxh(;7I5RnE6_=v{0*Hwkr2{&9)~x)Ez#?wfj~~C8H*UNr zO-U%D%K-!sGnTe61D^IUBcAp$iastbzLS!Ysu6GBeidM0VfrgCFZ>;7F|rzrb}za- zHaUO*LU%B(20Q~6dAy#yfB)haO-<`3K!^L>zyFp;SeWOBxH#WWWb;6dz|vS}#1qmC z00D%{!3+dKl7SdUpF6knmZ_flu!l%fB+)L!Hjs+W9UC|V&fiD zQ*T)&CKjFR*PrvVv9bJ-l@=8r=jaVPO-#HbSXfx~?%sXP z_w?xpb_E5IZ|v+W|L`OYtd0fY4wPclh^d!yKjPL&O8+Q z{{0uDtgO&?V5an5BGt9KSR) zBtJ??@qZT*;{GioBk%*=;Q#?ds)O;RX?%{w$p$*yPE=IRi;a!bgqfK|l~9cZ5I~GX zvWd-rBs&-xhlEs^iipUVa&YkI0*gXcQ8NzG2$t($q8jr9mzy$4GIuI%tUyA znDmUVRwSwxBeszR5J1diq-jP1MH?XpGLqm>j20n405KC8BBYefGr##7tyV z;&U`5Y4tw|-7hc=5J1#$FsT`lEQi8qfB<49A%_#=XiADLLXHKq0Ro7b#3G4UN0VE0 z;dLyC1_&T#GRjd#5=#(9A~F_Hjs;}7903c{}(##$J zU>nf0HZM1H-I}OZgl=5k#&}}@sBG6pCM`qnl0f!Fbm4+93 zSy4V#%Htk#JuVThl0I&zypv`|u5rtT@#nxWQP~z`FY)A<@8MejCdvZ4!A|BA4UTZZ z;6Ak`a;(%}f8=&U;#C3O!ah{wZe*dtm-R(Cg$#Pm?`WJ6km9)X<8KSt;ntpl=AvtB zVCCQn6~Wc(6Kk-Gwf8{8*2ZnL8OZp&hDImf)&_w6n=SFWG<|6odI0Wh2lLzXm zair%1#$<{18wTN@qQzeBY%>;-zR&shA0w(0pxa6kKP>f~kQLdc&6bmVa6w6qjhtYf z45zAnUY&3nI&{<^I(+Fu9Rc?nSzf8cz0DROVnjx7eJe0j1tX=v9i~Dn2!fhBTbmve zV|6y5NLfm0{s|6r=&+ePfDcH&uPGdBypks8O7&auA%<=uU`W%^4!WPscTat3=?RUpSF`pKD0uGAx zod9h-e-b{#v!5MIjfT>*kUxTE&6nj2Z)&n?IsEt>U7F9~Ur#Mrj*6Gs-k-f^81d!V zhc`J#zd$Dhr)OT_<^`NrH7K~ALl6%;h!hdxvHjK zggaJ+to^y@tQruJ$+*QWA3p_yC&Y@jrTtJEl8iRIPRBas(|#QZbU9dyf4|sMd1|3c zW&Dn#-Rz?-P;9BenWB48^#iDh?)|ewzjV6uPFOp&$7N#8W+3C)4#ce4mM;b|j z93&NYG6yJfYB}1j8BLK4v|$1`+csP*rWAt>Ho*l~6XH#|0od{LMQl`_4s-39^qzuS z*+Me)Dpwb}Oz%!LgBq~#g#hSKL;Bu?X(<`pIw&x**iP%1MskEJI?O=fud@n9jQOX! z^COj++l+vNC+Bw}$2v&Tz7YMOs3j7=(xi(Jy5{@}syxwdoGmKF(2sKno~4*f?;eAz zll8P*5Q6Wg-r(ANQzn8ovzk2rS~_i}tUYLRi0|wQ*E?T`3$>%JTKi5A)qD#aXKXXt zmbC-&{VqJOT?Oo8nQ4G@mVS}7oVV~{sHXAbY}v`T78o{Hg4+znG=%SG1eP{%Wr&!2 zq*|L$N=fAxiHwmk0*=9}Mt#IncG(NX+WGO1N<4As26+<>jA=sh5?VxXiSQ$k;gdg% zC^^Q>F5|LJyroe2SmV;tL|qUvh~I+lw`&y`a%CUui^IGSX~IxoXTuLvcZ z^#Zh_w)DX`*JU-HS?5M4yXYYhG}HGFb7?}Hl9=1li7RN|CYt^wMV)(LTl%q5oK z`>MOeXcVq5Jvb5}6 z8R<-`*Z@PRV*(P?s42z&0p#RCIF!X~n7F{3P>Q2XUUp|eMyCuVhr^5$%8e4KgI3fg zE0?}hL14eTraM)U2CgXmrFJiT5d%QDgW0`=4V;-zn9$rQ5YX~;TKKxUx2#MTJ(WzY z2JA@U+fbHG3bVZ)L!}Vj(%*p{>hTXdWw`d+$N5B3NnAE6uRkf*leMGiDti$8f;MPC z>#Jnyc4V^5Y!Aioe$}(q*c*?&1KDe|Io5fDNx3Wk+X&TOK3F!fUQ%knz2EE#AKOzN zic;$3S>lD4&#np!Ypb_yOluP19Q|CoHZc$p#&V&(9W&}s zPrOLx7BT7~2kGpNG68C*v@~lh%Cg6VI+v=S34mz<@c8)P)A`QOkOu%ObAnlg$)%Y8 E05J-4u>b%7 literal 0 HcmV?d00001 diff --git a/images/message-left.png b/images/message-left.png new file mode 100644 index 0000000000000000000000000000000000000000..f354376bdc9e56c4738b984c4f7e6d43d033fcd8 GIT binary patch literal 717 zcmeAS@N?(olHy`uVBq!ia0vp^IzXJl!3HG%_Fn>$3@qu6zK#qG>ra@ocD)4hB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrIztFvWYiIEGZ*N=ivcNJwd5NRgV$ zd)O!9hL1s6<gnp|vd$@?2>>aG B?=S!W literal 0 HcmV?d00001 diff --git a/images/message-right.png b/images/message-right.png new file mode 100644 index 0000000000000000000000000000000000000000..4702c2850019098670c50bc26c74d68831c939f8 GIT binary patch literal 1892 zcmeAS@N?(olHy`uVBq!ia0y~yVEh7Pr*Nx}&cn1H<|g=B!;Wfqcml z*NBqf{Irtt#G+IN$CUh}R0Yr6#Prml)Wnp^!jq{s3=C}FJY5_^DsCnH`SbI$Xf_6qi-^0Ky0Cd~^1)NyDZ+EID?UU zHlsqr47bIpB0Wt|?Y|fl8r-zMAPkdWXkd_9d%+!QbWc+wbI%nc4nnFD85o!{wm8Xy zoC7wzjgf(4!9}iGgjH+=tr|5X0VDWF!(=o}G$cmz&S-hkG$M`<2N41Q0mL$x9fu771Q5$0b|h9k00G1@NE}JDT7Upz z86by}tp*@~SO$qh8Hv>g5I`(+a40E`Bxn{u0I|@}v5Zs}1B(L$5DN_)ON;}s^7HfO zTd=aSTQe~+83QXaC7`fAP?#B6AwU4J(Acr~_+WNH!9o`{Hg(h)7QWIy4BxXJ=>qV`irKT31)*ql}E;cS4o{1P}{_$$%Kg!o>;;7X<@D zbrO&%%F4?8&(u`$m5YnkOAZd!f5bWhAb?nC;8?7VE-PCx6&R{1AdZ@v#D~B@qbL0Q zoWDtl%76drG;k~mU0S+)8pyFM zEKL7`gH0aj>&t#5)se^mAb_Y7efs|0Fhft;BzdPEg~WdEDab1)zu~5qo-MXj>YCkWB?FA zEEJTjI2{X23ZcMs>jNyV{sNQ2V`?}QrUoE@sMWkg@er`8O$IUS?9`w0@UZ{I=U99W z#U=+3KrB=UT@-d+-ds0e=sEx$`rF1v^$jk^;&LdVkOl}K7Alko$PNdFE@w1Iz}Q&f z4HFZlW65!r-O<;Pfnog#bJnhxK)z&& zYeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_st^o-U3d6}OU75)u+pBv=)$rhWc?j9XRqLRb{cG!__WXg@(4<6Mko?$+9kfnJCh;tUb`7`-{U0#~<^1yk@Tw zwRT|W<=fd0b~(u67VRQ8p(ll*|Ndu2Ze(V;kkN{8QNZ#=>f4Hrhi{x5yONnjAi47A zs{e~W8o^yGz*67%_3hFB|Nqp!#eq`zMnk66~f7CB%FOPKun?i$| z_7_k{fj!#rr|*|<lBR>+9!BtNV1^Z(i!82DE5pP zrq_IVq5FJyd3>b2eckcex3`QBo}XX8K~d{k{qDNIzb=|4IvrAE61Cnq)hbZbdW{o1 z$AXJowa^$ksG%TiQ~7D$=TA@7|19^rEB^QAXLIf?N%7yGoxR*t`ME1TU}2K_E_6)` z1pfT^I6L$FyzEEI{qKwa{`*^BIN*iphVApN-jR+KueW)cz)h~S^fWi z=ia{SJ98+oGdN`BVXcw|hNM4VUte#%s38eYssarYCr*5#d-sM`dBDcIYD` zC_p|wKECv#2Eun9(LC+mx@LvIU;w73p4iyiTN?M4UVDGv{&Z7nMtb{ilGc^mVV1Bu@*v&ZM+*0N5*CajP?nTQ>69P_7 z4%)c5d*%#{JLgIoENdeWRr0hWDQCf}lh%_Y08-m%IC& zO0tMaI#E+u`S85Ltmfw9Tx-kyE;?BPLvAfnfuy8eSz}vP15~J~+4x>z*36l%^4_X` z-{x2WU9}*;K^~qS+>8#C+ga~>SXNT___C%bhmg(-HnTJej9O>fkohS z#+6=p0mIR7@8Z$0gTmJReYtUS=g$usLzPN*jpIm$u`{ifxrstO#nRpm7@AOTdQ~z-_0}yz+ L`njxgN@xNAWpBrW literal 0 HcmV?d00001 From aeb8c1b1f80c579055a65b42533547bf9b237075 Mon Sep 17 00:00:00 2001 From: qqliu Date: Mon, 20 Jan 2014 16:32:12 -0500 Subject: [PATCH 17/43] minor changes to migrate debugging to jquery extension --- scripts/jquery.simile.ajax.js | 11 ++++++++++- scripts/util/debug.js | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/jquery.simile.ajax.js b/scripts/jquery.simile.ajax.js index f315c8f..3d8eb5a 100644 --- a/scripts/jquery.simile.ajax.js +++ b/scripts/jquery.simile.ajax.js @@ -222,9 +222,14 @@ jQuery.extend({ elmt.style.MozOpacity = o; } }, + + getIsIE: function() { + var an = navigator.userAgent.toLowerCase(); + return (an.indexOf("microsoft") != -1); + }, getBrowserMajorVersion: function() { - var ua = navigator.userAgent.toLowerCase(); + var an = navigator.userAgent.toLowerCase(); var isIE = (an.indexOf("microsoft") != -1); var isNetscape = (an.indexOf("netscape") != -1); @@ -324,6 +329,10 @@ jQuery.extend({ throw new Error("Failed to create an XMLHttpRequest object"); } }, + + debugException: function(e, msg) { + console.error(msg + " %o", e); + }, onReadyStateChange: function(xmlhttp, fError, fDone) { switch (xmlhttp.readyState) { diff --git a/scripts/util/debug.js b/scripts/util/debug.js index ce569f6..6663e9d 100644 --- a/scripts/util/debug.js +++ b/scripts/util/debug.js @@ -9,8 +9,8 @@ Timegrid.Debug.log = function(msg) { }; Timegrid.Debug.exception = function(e) { - e = SimileAjax.Platform.isIE ? e.message : e; - SimileAjax.Debug.exception(e, "Caught exception"); + e = $.getIsIE() ? e.message : e; + $.debugException(e, "Caught exception"); //alert("Caught exception: " + (SimileAjax.Platform.isIE ? e.message : e)); }; From 443f71cb9628523e260d2cc5648016590714b6d3 Mon Sep 17 00:00:00 2001 From: qqliu Date: Mon, 20 Jan 2014 21:33:04 -0500 Subject: [PATCH 18/43] fixed preview not showing --- scripts/sources/default.js | 6 +++--- scripts/sources/recurring.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/sources/default.js b/scripts/sources/default.js index 8192a45..24c40a9 100644 --- a/scripts/sources/default.js +++ b/scripts/sources/default.js @@ -267,8 +267,8 @@ Timegrid.DefaultEventSource.Event = function( this._latestStart = (latestStart != null) ? latestStart : (instant ? this._end : this._start); this._earliestEnd = (earliestEnd != null) ? earliestEnd : (instant ? this._start : this._end); - this._text = SimileAjax.HTML.deEntify(text); - this._description = SimileAjax.HTML.deEntify(description); + this._text = $('
      ').html(text).text(); + this._description = $('
      ').html(text).text(); this._image = (image != null && image != "") ? image : null; this._link = (link != null && link != "") ? link : null; @@ -301,7 +301,7 @@ Timegrid.DefaultEventSource.Event.prototype = { getTextColor: function() { return this._textColor; }, getInterval: function() { - return new SimileAjax.DateTime.Interval(this.getEnd() - + return new Timegrid.Interval(this.getEnd() - this.getStart()); }, diff --git a/scripts/sources/recurring.js b/scripts/sources/recurring.js index d881baf..cc1e966 100644 --- a/scripts/sources/recurring.js +++ b/scripts/sources/recurring.js @@ -88,10 +88,10 @@ Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, this.getID = function() { return id; } this.getText = function() { - return SimileAjax.HTML.deEntify(text); + return $('
      ').html(text).text(); }; this.getDescription = function() { - return SimileAjax.HTML.deEntify(description); + return $('
      ').html(text).text(); }; this.getImage = function() { return (image != null && image != "") ? image : null; From 2fd271712daa1dbe52c94ec415ce8fdf7e7ef200 Mon Sep 17 00:00:00 2001 From: qqliu Date: Thu, 23 Jan 2014 16:52:41 -0500 Subject: [PATCH 19/43] changed grid is constructed to table to enable adding listeners for cells --- scripts/layouts/layout.js | 28 +++++++++++++--------------- styles/timegrid.css | 13 ++----------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/scripts/layouts/layout.js b/scripts/layouts/layout.js index 092f0f7..6e95760 100644 --- a/scripts/layouts/layout.js +++ b/scripts/layouts/layout.js @@ -269,22 +269,20 @@ Timegrid.Layout.prototype.renderEvents = Timegrid.abstract("renderEvents"); * @return {Element} a DOM element containing this layout's gridlines */ Timegrid.Layout.prototype.renderGridlines = function() { - var gridlineContainer = document.createElement("div"); - gridlineContainer.className = 'timegrid-gridlines'; + var gridlineContainer = $("
      ", {class: 'timegrid-gridlines'}); - for (var x = 0; x < this.xSize; x++) { // Vertical lines - var vlineDiv = document.createElement('div'); - vlineDiv.className = 'timegrid-vline'; - vlineDiv.style.height = this.gridheight + "px"; - vlineDiv.style.left = x * this.xCell + "px"; - gridlineContainer.appendChild(vlineDiv); - } - for (var y = 0; y <= this.ySize; y++) { // Horizontal lines - var hlineDiv = document.createElement('div'); - hlineDiv.className = 'timegrid-hline'; - hlineDiv.style.width = "100%"; - hlineDiv.style.top = y * this.yCell + "px"; - gridlineContainer.appendChild(hlineDiv); + for (var y = 0; y <= this.ySize - 1; y++) { // Horizontal lines + var hlineDiv = $('', { id: '' + y, + class:'timegrid-hline', + height: this.yCell + "px"}); + gridlineContainer.append(hlineDiv); + + for (var x = 0; x < this.xSize; x++) { // Vertical lines + var vlineDiv = $('', { id: '' + x, + class: 'timegrid-vline', + width: this.xCell + "px" }); + hlineDiv.append(vlineDiv); + } } return gridlineContainer; }; diff --git a/styles/timegrid.css b/styles/timegrid.css index b707142..9387b78 100644 --- a/styles/timegrid.css +++ b/styles/timegrid.css @@ -54,17 +54,8 @@ div.timegrid-grid-window { border: 1px inset black; } -div.timegrid-hline { - position: absolute; - height: 1px; - overflow: hidden; - background-color: #999; -} - -div.timegrid-vline { - position: absolute; - width: 1px; - background-color: #444; +table.timegrid-gridlines, .timegrid-hline, .timegrid-vline { + border: 1px solid #e6e2af; } div.timegrid-events { From 0aa931a8f4ecef9a745e92f77402025b327714cc Mon Sep 17 00:00:00 2001 From: qqliu Date: Thu, 23 Jan 2014 21:04:13 -0500 Subject: [PATCH 20/43] preliminary click on grid and get classes offered during that time: lots of bugs --- scripts/layouts/layout.js | 32 +++++++++++++++++++++++++++++--- scripts/timegrid.js | 4 ++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/scripts/layouts/layout.js b/scripts/layouts/layout.js index 6e95760..a102e20 100644 --- a/scripts/layouts/layout.js +++ b/scripts/layouts/layout.js @@ -269,16 +269,42 @@ Timegrid.Layout.prototype.renderEvents = Timegrid.abstract("renderEvents"); * @return {Element} a DOM element containing this layout's gridlines */ Timegrid.Layout.prototype.renderGridlines = function() { + var numToDay = { + 0: "S", + 1: "M", + 2: "T", + 3: "W", + 4: "R", + 5: "F", + 6: "S" + }; + + var numToHour = { + 0: "8", + 1: "9", + 2: "10", + 3: "11", + 4: "12", + 5: "13", + 6: "14", + 7: "15", + 8: "16", + 9: "17", + 10: "18", + 11: "19", + 12: "20", + 13: "21" + }; + var gridlineContainer = $("
      ", {class: 'timegrid-gridlines'}); for (var y = 0; y <= this.ySize - 1; y++) { // Horizontal lines - var hlineDiv = $('', { id: '' + y, - class:'timegrid-hline', + var hlineDiv = $('', { class:'timegrid-hline', height: this.yCell + "px"}); gridlineContainer.append(hlineDiv); for (var x = 0; x < this.xSize; x++) { // Vertical lines - var vlineDiv = $('', { id: '' + x, + var vlineDiv = $('', { id: numToDay[x] + numToHour[y], class: 'timegrid-vline', width: this.xCell + "px" }); hlineDiv.append(vlineDiv); diff --git a/scripts/timegrid.js b/scripts/timegrid.js index 7a135b5..88282ea 100644 --- a/scripts/timegrid.js +++ b/scripts/timegrid.js @@ -1,6 +1,7 @@ /****************************************************************************** * Timegrid *****************************************************************************/ +Timegrid.listener = null; Timegrid.create = function(node, eventSource, layoutName, layoutParams) { return new Timegrid._Impl(node, eventSource, layoutName, layoutParams); @@ -15,6 +16,8 @@ Timegrid.resize = function() { Timegrid.createFromDOM = function(elmt) { var config = Timegrid.getConfigFromDOM(elmt); + Timegrid.listener = window[config.listener]; + var layoutNames = config.views.split(","); var getExtension = function(s) { return s.split('.').pop().toLowerCase(); @@ -145,6 +148,7 @@ Timegrid._Impl.prototype._construct = function() { return Timegrid.LayoutFactory.createLayout(s, self._eventSource, self._layoutParams); }); + if (this._panel) { this._panel.setLayouts(this._layouts); } else { From 99771360326eba798f95e061d5bb4cc572a0755c Mon Sep 17 00:00:00 2001 From: qqliu Date: Tue, 28 Jan 2014 13:45:12 -0500 Subject: [PATCH 21/43] small change to timegrid to account for some classes not showing up when clicking timegrid --- scripts/layouts/nday.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/layouts/nday.js b/scripts/layouts/nday.js index 705dad1..024a94c 100644 --- a/scripts/layouts/nday.js +++ b/scripts/layouts/nday.js @@ -114,12 +114,7 @@ Timegrid.NDayLayout.prototype.renderEvents = function(doc) { currentCount--; } } - var nowDiv = this.renderNow(); - if (nowDiv) { - return $([eventContainer, nowDiv]); - } else { - return eventContainer; - } + return eventContainer; }; Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { From a278777012884e58e8046ae9187024bc74ac2b86 Mon Sep 17 00:00:00 2001 From: qqliu Date: Wed, 5 Feb 2014 01:45:42 -0500 Subject: [PATCH 22/43] clicking on classes in timegrid/clicking on events general functionality added --- scripts/layouts/nday.js | 5 +++++ scripts/timegrid.js | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/scripts/layouts/nday.js b/scripts/layouts/nday.js index 024a94c..1562629 100644 --- a/scripts/layouts/nday.js +++ b/scripts/layouts/nday.js @@ -133,6 +133,11 @@ Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { ediv.style.left = this.xCell * x + 'px'; if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } + + if (Timegrid.eventGridClickListener && Timegrid.eventGridInput) { + var inp = Timegrid.eventGridInput(evt.getText()); + ediv.onclick = function() { Timegrid.eventGridClickListener(inp); }; + } return ediv; // Return the actual DOM element }; diff --git a/scripts/timegrid.js b/scripts/timegrid.js index 88282ea..cc9ee1b 100644 --- a/scripts/timegrid.js +++ b/scripts/timegrid.js @@ -2,6 +2,8 @@ * Timegrid *****************************************************************************/ Timegrid.listener = null; +Timegrid.eventGridClickListener = null; +Timegrid.eventGridInput = null; Timegrid.create = function(node, eventSource, layoutName, layoutParams) { return new Timegrid._Impl(node, eventSource, layoutName, layoutParams); @@ -16,7 +18,11 @@ Timegrid.resize = function() { Timegrid.createFromDOM = function(elmt) { var config = Timegrid.getConfigFromDOM(elmt); + console.log(config); Timegrid.listener = window[config.listener]; + console.log("supposed listener " + window[config.gridlistener]); + Timegrid.eventGridClickListener = window[config.gridlistener]; + Timegrid.eventGridInput = window[config.gridlistenerinput]; var layoutNames = config.views.split(","); var getExtension = function(s) { From 733179970eb89dea0610d20356b14a732557488e Mon Sep 17 00:00:00 2001 From: qqliu Date: Wed, 5 Feb 2014 01:47:22 -0500 Subject: [PATCH 23/43] cleanup --- scripts/timegrid.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/timegrid.js b/scripts/timegrid.js index cc9ee1b..8a6ed92 100644 --- a/scripts/timegrid.js +++ b/scripts/timegrid.js @@ -18,9 +18,7 @@ Timegrid.resize = function() { Timegrid.createFromDOM = function(elmt) { var config = Timegrid.getConfigFromDOM(elmt); - console.log(config); Timegrid.listener = window[config.listener]; - console.log("supposed listener " + window[config.gridlistener]); Timegrid.eventGridClickListener = window[config.gridlistener]; Timegrid.eventGridInput = window[config.gridlistenerinput]; From 6da9f695c958062ca9fde9074f16c51dd5693155 Mon Sep 17 00:00:00 2001 From: qqliu Date: Fri, 7 Feb 2014 11:50:53 -0500 Subject: [PATCH 24/43] styling changes --- scripts/layouts/nday.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/layouts/nday.js b/scripts/layouts/nday.js index 1562629..631ef74 100644 --- a/scripts/layouts/nday.js +++ b/scripts/layouts/nday.js @@ -131,6 +131,7 @@ Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { ediv.style.height = this.yCell * length + "px"; ediv.style.top = this.yCell * y + "px"; ediv.style.left = this.xCell * x + 'px'; + ediv.title = evt.getText(); if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } From 1505f8850b85d714305936e030d0d0addd5bd4d0 Mon Sep 17 00:00:00 2001 From: qqliu Date: Sun, 9 Feb 2014 02:55:15 -0500 Subject: [PATCH 25/43] lots of stuff works --- scripts/layouts/layout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/layouts/layout.js b/scripts/layouts/layout.js index a102e20..da1370b 100644 --- a/scripts/layouts/layout.js +++ b/scripts/layouts/layout.js @@ -304,7 +304,7 @@ Timegrid.Layout.prototype.renderGridlines = function() { gridlineContainer.append(hlineDiv); for (var x = 0; x < this.xSize; x++) { // Vertical lines - var vlineDiv = $('', { id: numToDay[x] + numToHour[y], + var vlineDiv = $('', { classid: numToDay[x] + numToHour[y], class: 'timegrid-vline', width: this.xCell + "px" }); hlineDiv.append(vlineDiv); From a8bb7d6477bfd52ef66a3612b3c4d305d0252403 Mon Sep 17 00:00:00 2001 From: qqliu Date: Sat, 22 Feb 2014 16:01:02 -0500 Subject: [PATCH 26/43] left overs --- scripts/jquery.simile.ajax.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/jquery.simile.ajax.js b/scripts/jquery.simile.ajax.js index 3d8eb5a..3159037 100644 --- a/scripts/jquery.simile.ajax.js +++ b/scripts/jquery.simile.ajax.js @@ -233,8 +233,8 @@ jQuery.extend({ var isIE = (an.indexOf("microsoft") != -1); var isNetscape = (an.indexOf("netscape") != -1); - var isMozilla = (ua.indexOf("mozilla") != -1); - var isFirefox = (ua.indexOf("firefox") != -1); + var isMozilla = (an.indexOf("mozilla") != -1); + var isFirefox = (an.indexOf("firefox") != -1); var isOpera = (an.indexOf("opera") != -1); var isSafari = (an.indexOf("safari") != -1); @@ -244,28 +244,33 @@ jQuery.extend({ browserMajorVersion = parseInt(a[0]); }; + var indexOf = function(s, sub, start) { + var i = s.indexOf(sub, start); + return i >= 0 ? i : s.length; + }; + if (isMozilla) { - var offset = ua.indexOf("mozilla/"); + var offset = an.indexOf("mozilla/"); if (offset >= 0) { - parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); + parseVersionString(an.substring(offset + 8, indexOf(an, " ", offset))); } } if (isIE) { - var offset = ua.indexOf("msie "); + var offset = an.indexOf("msie "); if (offset >= 0) { - parseVersionString(ua.substring(offset + 5, indexOf(ua, ";", offset))); + parseVersionString(an.substring(offset + 5, indexOf(an, ";", offset))); } } if (isNetscape) { - var offset = ua.indexOf("rv:"); + var offset = an.indexOf("rv:"); if (offset >= 0) { - parseVersionString(ua.substring(offset + 3, indexOf(ua, ")", offset))); + parseVersionString(an.substring(offset + 3, indexOf(an, ")", offset))); } } if (isFirefox) { - var offset = ua.indexOf("firefox/"); + var offset = an.indexOf("firefox/"); if (offset >= 0) { - parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); + parseVersionString(an.substring(offset + 8, indexOf(an, " ", offset))); } } return browserMajorVersion; From 36a0f230d4fea2932d0969488cd678d6f044a7f5 Mon Sep 17 00:00:00 2001 From: qqliu Date: Tue, 25 Feb 2014 01:13:14 -0500 Subject: [PATCH 27/43] gotta love those early morning bug fixes --- scripts/layouts/layout.js | 2 +- styles/timegrid.css | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/layouts/layout.js b/scripts/layouts/layout.js index da1370b..1f4722d 100644 --- a/scripts/layouts/layout.js +++ b/scripts/layouts/layout.js @@ -162,7 +162,7 @@ Timegrid.Layout.prototype.render = function(container) { } if (container) { this._container = container; - this._viewDiv = $("
      ").addClass('timegrid-view') + this._viewDiv = $("
      ").addClass('timegrid-view print') .css('top', this.tabHeight + "px"); $(this._container).append(this._viewDiv); } else { diff --git a/styles/timegrid.css b/styles/timegrid.css index 9387b78..7401874 100644 --- a/styles/timegrid.css +++ b/styles/timegrid.css @@ -181,3 +181,12 @@ span.timegrid-month-date-label { font-weight: bold; text-align: center; } + +@media print { + + .print { + display: block; + overflow: auto; + } + +} From 6abd113a93ede990dfa04cce8ffc4663401be9bf Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Tue, 25 Jul 2017 15:54:14 -0400 Subject: [PATCH 28/43] Added required file structure --- .DS_Store | Bin 0 -> 6148 bytes src/webapp/.DS_Store | Bin 0 -> 6148 bytes README.md => src/webapp/api/README.md | 0 .../webapp/api/images}/.svn/all-wcprops | 0 .../webapp/api/images}/.svn/entries | 0 .../.svn/prop-base/go-next.png.svn-base | 0 .../.svn/prop-base/go-previous.png.svn-base | 0 .../prop-base/progress-running.gif.svn-base | 0 .../.svn/text-base/go-next.png.svn-base | Bin .../.svn/text-base/go-previous.png.svn-base | Bin .../text-base/progress-running.gif.svn-base | Bin {images => src/webapp/api/images}/go-next.png | Bin .../webapp/api/images}/go-previous.png | Bin .../api/images}/message-bottom-left.png | Bin .../api/images}/message-bottom-right.png | Bin .../webapp/api/images}/message-left.png | Bin .../webapp/api/images}/message-right.png | Bin .../webapp/api/images}/message-top-left.png | Bin .../webapp/api/images}/message-top-right.png | Bin .../webapp/api/images}/progress-running.gif | Bin .../webapp/api/locales}/.svn/all-wcprops | 0 .../webapp/api/locales}/.svn/entries | 0 .../webapp/api/locales}/en/.svn/all-wcprops | 0 .../webapp/api/locales}/en/.svn/entries | 0 .../en/.svn/text-base/locale.js.svn-base | 62 +-- .../webapp/api/locales}/en/locale.js | 0 .../api/locales}/en/scripts/.svn/all-wcprops | 0 .../api/locales}/en/scripts/.svn/entries | 0 .../.svn/text-base/timegrid-l10n.js.svn-base | 0 .../en/scripts/layouts/.svn/all-wcprops | 0 .../locales}/en/scripts/layouts/.svn/entries | 0 .../.svn/text-base/monthly-l10n.js.svn-base | 0 .../.svn/text-base/nday-l10n.js.svn-base | 0 .../.svn/text-base/nmonth-l10n.js.svn-base | 0 .../.svn/text-base/property-l10n.js.svn-base | 0 .../.svn/text-base/weekly-l10n.js.svn-base | 0 .../en/scripts/layouts/monthly-l10n.js | 18 +- .../locales/en/scripts/layouts/nday-l10n.js | 62 +-- .../locales/en/scripts/layouts/nmonth-l10n.js | 60 +- .../en/scripts/layouts/property-l10n.js | 30 +- .../locales/en/scripts/layouts/weekly-l10n.js | 18 +- .../api/locales/en/scripts/timegrid-l10n.js | 24 +- .../locales}/en/scripts/util/.svn/all-wcprops | 0 .../api/locales}/en/scripts/util/.svn/entries | 0 .../util/.svn/text-base/date-l10n.js.svn-base | 0 .../api/locales/en/scripts/util/date-l10n.js | 58 +- .../webapp/api/locales}/fr/.svn/all-wcprops | 0 .../webapp/api/locales}/fr/.svn/entries | 0 .../fr/.svn/text-base/locale.js.svn-base | 60 +- .../webapp/api/locales}/fr/locale.js | 0 .../api/locales}/fr/scripts/.svn/all-wcprops | 0 .../api/locales}/fr/scripts/.svn/entries | 0 .../.svn/text-base/timegrid-l10n.js.svn-base | 0 .../fr/scripts/layouts/.svn/all-wcprops | 0 .../locales}/fr/scripts/layouts/.svn/entries | 0 .../.svn/text-base/monthly-l10n.js.svn-base | 0 .../.svn/text-base/nday-l10n.js.svn-base | 0 .../.svn/text-base/nmonth-l10n.js.svn-base | 0 .../.svn/text-base/weekly-l10n.js.svn-base | 0 .../fr/scripts/layouts/monthly-l10n.js | 18 +- .../locales/fr/scripts/layouts/nday-l10n.js | 58 +- .../locales/fr/scripts/layouts/nmonth-l10n.js | 56 +- .../locales/fr/scripts/layouts/weekly-l10n.js | 18 +- .../api/locales/fr/scripts/timegrid-l10n.js | 26 +- .../locales}/fr/scripts/util/.svn/all-wcprops | 0 .../api/locales}/fr/scripts/util/.svn/entries | 0 .../util/.svn/text-base/date-l10n.js.svn-base | 0 .../api/locales/fr/scripts/util/date-l10n.js | 58 +- .../webapp/api/scripts}/.svn/all-wcprops | 0 .../webapp/api/scripts}/.svn/entries | 0 .../.svn/text-base/controls.js.svn-base | 296 +++++----- .../scripts/.svn/text-base/create.js.svn-base | 0 .../scripts}/.svn/text-base/grid.js.svn-base | 0 .../.svn/text-base/labellers.js.svn-base | 0 .../.svn/text-base/listeners.js.svn-base | 0 .../.svn/text-base/themes.js.svn-base | 0 .../.svn/text-base/timegrid.js.svn-base | 0 .../webapp/api/scripts}/controls.js | 0 .../webapp/api/scripts/create.js | 14 +- {scripts => src/webapp/api/scripts}/grid.js | 0 .../webapp/api/scripts}/jquery.simile.ajax.js | 0 .../webapp/api/scripts}/labellers.js | 0 .../api/scripts}/layouts/.svn/all-wcprops | 0 .../webapp/api/scripts}/layouts/.svn/entries | 0 .../layouts/.svn/text-base/layout.js.svn-base | 0 .../.svn/text-base/monthly.js.svn-base | 0 .../layouts/.svn/text-base/nday.js.svn-base | 484 ++++++++-------- .../layouts/.svn/text-base/nmonth.js.svn-base | 0 .../.svn/text-base/property.js.svn-base | 0 .../layouts/.svn/text-base/weekly.js.svn-base | 0 .../webapp/api/scripts}/layouts/layout.js | 0 .../webapp/api/scripts}/layouts/monthly.js | 0 .../webapp/api/scripts}/layouts/nday.js | 0 .../webapp/api/scripts/layouts/nmonth.js | 518 +++++++++--------- .../webapp/api/scripts/layouts/property.js | 300 +++++----- .../webapp/api/scripts}/layouts/weekly.js | 0 .../webapp/api/scripts/listeners.js | 56 +- .../api/scripts}/sources/.svn/all-wcprops | 0 .../webapp/api/scripts}/sources/.svn/entries | 0 .../.svn/text-base/default.js.svn-base | 0 .../.svn/text-base/recurring.js.svn-base | 272 ++++----- .../webapp/api/scripts}/sources/default.js | 0 .../webapp/api/scripts}/sources/recurring.js | 0 {scripts => src/webapp/api/scripts}/themes.js | 0 .../webapp/api/scripts}/timegrid.js | 0 .../webapp/api/scripts}/util/.svn/all-wcprops | 0 .../webapp/api/scripts}/util/.svn/entries | 0 .../util/.svn/text-base/date.js.svn-base | 0 .../util/.svn/text-base/debug.js.svn-base | 0 .../.svn/text-base/excanvas.pack.js.svn-base | 0 .../.svn/text-base/jquery.corner.js.svn-base | 0 .../text-base/jquery.dimensions.js.svn-base | 0 .../text-base/jquery.prettybox.js.svn-base | 0 .../.svn/text-base/jquery.simile.js.svn-base | 236 ++++---- .../util/.svn/text-base/util.js.svn-base | 94 ++-- .../webapp/api/scripts}/util/date.js | 0 .../webapp/api/scripts}/util/debug.js | 0 .../scripts}/util/dstructs/.svn/all-wcprops | 0 .../api/scripts}/util/dstructs/.svn/entries | 0 .../.svn/text-base/dstructs.js.svn-base | 0 .../util/dstructs/docs/.svn/all-wcprops | 0 .../scripts}/util/dstructs/docs/.svn/entries | 0 .../api/scripts}/util/dstructs/dstructs.js | 0 .../util/dstructs/tests/.svn/all-wcprops | 0 .../scripts}/util/dstructs/tests/.svn/entries | 0 .../.svn/text-base/array-tests.html.svn-base | 0 .../.svn/text-base/array-tests.js.svn-base | 0 .../.svn/text-base/hash-tests.html.svn-base | 0 .../.svn/text-base/testpage.html.svn-base | 0 .../util/dstructs/tests/array-tests.html | 26 +- .../util/dstructs/tests/array-tests.js | 58 +- .../util/dstructs/tests/hash-tests.html | 0 .../scripts/util/dstructs/tests/testpage.html | 16 +- .../webapp/api/scripts}/util/excanvas.pack.js | 0 .../webapp/api/scripts/util/jquery.corner.js | 506 ++++++++--------- .../api/scripts}/util/jquery.dimensions.js | 0 .../api/scripts/util/jquery.prettybox.js | 342 ++++++------ .../webapp/api/scripts}/util/jquery.simile.js | 0 .../webapp/api/scripts}/util/util.js | 0 .../webapp/api/styles}/.svn/all-wcprops | 0 .../webapp/api/styles}/.svn/entries | 0 .../.svn/text-base/timegrid.css.svn-base | 384 ++++++------- .../api/styles}/themes/.svn/all-wcprops | 0 .../webapp/api/styles}/themes/.svn/entries | 0 ...sandy-stone-beach-ocean-diver.css.svn-base | 0 .../theme-sandy-stone-beach-ocean-diver.css | 0 .../webapp/api/styles}/timegrid.css | 0 .../webapp/api/timegrid-api.js | 0 148 files changed, 2114 insertions(+), 2114 deletions(-) create mode 100644 .DS_Store create mode 100644 src/webapp/.DS_Store rename README.md => src/webapp/api/README.md (100%) rename {images => src/webapp/api/images}/.svn/all-wcprops (100%) rename {images => src/webapp/api/images}/.svn/entries (100%) rename {images => src/webapp/api/images}/.svn/prop-base/go-next.png.svn-base (100%) rename {images => src/webapp/api/images}/.svn/prop-base/go-previous.png.svn-base (100%) rename {images => src/webapp/api/images}/.svn/prop-base/progress-running.gif.svn-base (100%) rename {images => src/webapp/api/images}/.svn/text-base/go-next.png.svn-base (100%) rename {images => src/webapp/api/images}/.svn/text-base/go-previous.png.svn-base (100%) rename {images => src/webapp/api/images}/.svn/text-base/progress-running.gif.svn-base (100%) rename {images => src/webapp/api/images}/go-next.png (100%) rename {images => src/webapp/api/images}/go-previous.png (100%) rename {images => src/webapp/api/images}/message-bottom-left.png (100%) rename {images => src/webapp/api/images}/message-bottom-right.png (100%) rename {images => src/webapp/api/images}/message-left.png (100%) rename {images => src/webapp/api/images}/message-right.png (100%) rename {images => src/webapp/api/images}/message-top-left.png (100%) rename {images => src/webapp/api/images}/message-top-right.png (100%) rename {images => src/webapp/api/images}/progress-running.gif (100%) rename {locales => src/webapp/api/locales}/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/.svn/entries (100%) rename {locales => src/webapp/api/locales}/en/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/en/.svn/entries (100%) rename {locales => src/webapp/api/locales}/en/.svn/text-base/locale.js.svn-base (97%) rename {locales => src/webapp/api/locales}/en/locale.js (100%) rename {locales => src/webapp/api/locales}/en/scripts/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/en/scripts/.svn/entries (100%) rename locales/en/scripts/timegrid-l10n.js => src/webapp/api/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base (100%) rename {locales => src/webapp/api/locales}/en/scripts/layouts/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/en/scripts/layouts/.svn/entries (100%) rename locales/en/scripts/layouts/monthly-l10n.js => src/webapp/api/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base (100%) rename locales/en/scripts/layouts/nday-l10n.js => src/webapp/api/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base (100%) rename locales/en/scripts/layouts/nmonth-l10n.js => src/webapp/api/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base (100%) rename locales/en/scripts/layouts/property-l10n.js => src/webapp/api/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base (100%) rename locales/en/scripts/layouts/weekly-l10n.js => src/webapp/api/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base (100%) rename locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base => src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js (97%) rename locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base => src/webapp/api/locales/en/scripts/layouts/nday-l10n.js (97%) rename locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base => src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js (97%) rename locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base => src/webapp/api/locales/en/scripts/layouts/property-l10n.js (97%) rename locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base => src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js (97%) rename locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base => src/webapp/api/locales/en/scripts/timegrid-l10n.js (97%) rename {locales => src/webapp/api/locales}/en/scripts/util/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/en/scripts/util/.svn/entries (100%) rename locales/en/scripts/util/date-l10n.js => src/webapp/api/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base (100%) rename locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base => src/webapp/api/locales/en/scripts/util/date-l10n.js (97%) rename {locales => src/webapp/api/locales}/fr/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/fr/.svn/entries (100%) rename {locales => src/webapp/api/locales}/fr/.svn/text-base/locale.js.svn-base (97%) rename {locales => src/webapp/api/locales}/fr/locale.js (100%) rename {locales => src/webapp/api/locales}/fr/scripts/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/fr/scripts/.svn/entries (100%) rename locales/fr/scripts/timegrid-l10n.js => src/webapp/api/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base (100%) rename {locales => src/webapp/api/locales}/fr/scripts/layouts/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/fr/scripts/layouts/.svn/entries (100%) rename locales/fr/scripts/layouts/monthly-l10n.js => src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base (100%) rename locales/fr/scripts/layouts/nday-l10n.js => src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base (100%) rename locales/fr/scripts/layouts/nmonth-l10n.js => src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base (100%) rename locales/fr/scripts/layouts/weekly-l10n.js => src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base (100%) rename locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base => src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js (97%) rename locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base => src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js (97%) rename locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base => src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js (97%) rename locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base => src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js (97%) rename locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base => src/webapp/api/locales/fr/scripts/timegrid-l10n.js (97%) rename {locales => src/webapp/api/locales}/fr/scripts/util/.svn/all-wcprops (100%) rename {locales => src/webapp/api/locales}/fr/scripts/util/.svn/entries (100%) rename locales/fr/scripts/util/date-l10n.js => src/webapp/api/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base (100%) rename locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base => src/webapp/api/locales/fr/scripts/util/date-l10n.js (97%) rename {scripts => src/webapp/api/scripts}/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/.svn/entries (100%) rename {scripts => src/webapp/api/scripts}/.svn/text-base/controls.js.svn-base (97%) rename scripts/create.js => src/webapp/api/scripts/.svn/text-base/create.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/.svn/text-base/grid.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/.svn/text-base/labellers.js.svn-base (100%) rename scripts/listeners.js => src/webapp/api/scripts/.svn/text-base/listeners.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/.svn/text-base/themes.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/.svn/text-base/timegrid.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/controls.js (100%) rename scripts/.svn/text-base/create.js.svn-base => src/webapp/api/scripts/create.js (97%) rename {scripts => src/webapp/api/scripts}/grid.js (100%) rename {scripts => src/webapp/api/scripts}/jquery.simile.ajax.js (100%) rename {scripts => src/webapp/api/scripts}/labellers.js (100%) rename {scripts => src/webapp/api/scripts}/layouts/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/layouts/.svn/entries (100%) rename {scripts => src/webapp/api/scripts}/layouts/.svn/text-base/layout.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/layouts/.svn/text-base/monthly.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/layouts/.svn/text-base/nday.js.svn-base (97%) rename scripts/layouts/nmonth.js => src/webapp/api/scripts/layouts/.svn/text-base/nmonth.js.svn-base (100%) rename scripts/layouts/property.js => src/webapp/api/scripts/layouts/.svn/text-base/property.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/layouts/.svn/text-base/weekly.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/layouts/layout.js (100%) rename {scripts => src/webapp/api/scripts}/layouts/monthly.js (100%) rename {scripts => src/webapp/api/scripts}/layouts/nday.js (100%) rename scripts/layouts/.svn/text-base/nmonth.js.svn-base => src/webapp/api/scripts/layouts/nmonth.js (97%) rename scripts/layouts/.svn/text-base/property.js.svn-base => src/webapp/api/scripts/layouts/property.js (97%) rename {scripts => src/webapp/api/scripts}/layouts/weekly.js (100%) rename scripts/.svn/text-base/listeners.js.svn-base => src/webapp/api/scripts/listeners.js (96%) rename {scripts => src/webapp/api/scripts}/sources/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/sources/.svn/entries (100%) rename {scripts => src/webapp/api/scripts}/sources/.svn/text-base/default.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/sources/.svn/text-base/recurring.js.svn-base (97%) rename {scripts => src/webapp/api/scripts}/sources/default.js (100%) rename {scripts => src/webapp/api/scripts}/sources/recurring.js (100%) rename {scripts => src/webapp/api/scripts}/themes.js (100%) rename {scripts => src/webapp/api/scripts}/timegrid.js (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/entries (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/text-base/date.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/text-base/debug.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/text-base/excanvas.pack.js.svn-base (100%) rename scripts/util/jquery.corner.js => src/webapp/api/scripts/util/.svn/text-base/jquery.corner.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/text-base/jquery.dimensions.js.svn-base (100%) rename scripts/util/jquery.prettybox.js => src/webapp/api/scripts/util/.svn/text-base/jquery.prettybox.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/util/.svn/text-base/jquery.simile.js.svn-base (97%) rename {scripts => src/webapp/api/scripts}/util/.svn/text-base/util.js.svn-base (97%) rename {scripts => src/webapp/api/scripts}/util/date.js (100%) rename {scripts => src/webapp/api/scripts}/util/debug.js (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/.svn/entries (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/.svn/text-base/dstructs.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/docs/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/docs/.svn/entries (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/dstructs.js (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/tests/.svn/all-wcprops (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/tests/.svn/entries (100%) rename scripts/util/dstructs/tests/array-tests.html => src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base (100%) rename scripts/util/dstructs/tests/array-tests.js => src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base (100%) rename {scripts => src/webapp/api/scripts}/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base (100%) rename scripts/util/dstructs/tests/testpage.html => src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base (100%) rename scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base => src/webapp/api/scripts/util/dstructs/tests/array-tests.html (97%) rename scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base => src/webapp/api/scripts/util/dstructs/tests/array-tests.js (96%) rename {scripts => src/webapp/api/scripts}/util/dstructs/tests/hash-tests.html (100%) rename scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base => src/webapp/api/scripts/util/dstructs/tests/testpage.html (95%) rename {scripts => src/webapp/api/scripts}/util/excanvas.pack.js (100%) rename scripts/util/.svn/text-base/jquery.corner.js.svn-base => src/webapp/api/scripts/util/jquery.corner.js (97%) rename {scripts => src/webapp/api/scripts}/util/jquery.dimensions.js (100%) rename scripts/util/.svn/text-base/jquery.prettybox.js.svn-base => src/webapp/api/scripts/util/jquery.prettybox.js (97%) rename {scripts => src/webapp/api/scripts}/util/jquery.simile.js (100%) rename {scripts => src/webapp/api/scripts}/util/util.js (100%) rename {styles => src/webapp/api/styles}/.svn/all-wcprops (100%) rename {styles => src/webapp/api/styles}/.svn/entries (100%) rename {styles => src/webapp/api/styles}/.svn/text-base/timegrid.css.svn-base (94%) rename {styles => src/webapp/api/styles}/themes/.svn/all-wcprops (100%) rename {styles => src/webapp/api/styles}/themes/.svn/entries (100%) rename {styles => src/webapp/api/styles}/themes/.svn/text-base/theme-sandy-stone-beach-ocean-diver.css.svn-base (100%) rename {styles => src/webapp/api/styles}/themes/theme-sandy-stone-beach-ocean-diver.css (100%) rename {styles => src/webapp/api/styles}/timegrid.css (100%) rename timegrid-api.js => src/webapp/api/timegrid-api.js (100%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7709f1c9b05c1492b06a7524ea79ebe2919d09f5 GIT binary patch literal 6148 zcmeHKOHRW;47J+|71(r%#AXh_rZYqENd)_vfeg>dExlK49K^e(i`om z+^h%R&m-G9&#S|GN%Z~oaHlWRMXD2#=JnKSAH{yRsdsCvgI^6@&?mjnGd)p5%}5Qs zc(0OMt>h^FtDcegNL9W3quO+XFu_1D5Dc6h19JL8=GTT{gMnZm80Z*~^C3Y6Gso6Y zj}91Z0e~~ORWO!bLUNL0=GYn{0%1!9S}J>s!Ilnx@_CtKYiQ}j-h8m{%-*4}?vC}7 zPAAR`!v+JvK%arBJuc+_zdzmo_mko&7zhT=iUFSGMZUr-`Q18rIk{^S^bsl|^IF3$ j1p~c`F;}kQ8>kBWNd~~ou{DGT5`P4ghA_dvpEB?RQNBj5 literal 0 HcmV?d00001 diff --git a/src/webapp/.DS_Store b/src/webapp/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e4cfd601c426d28fbcbaae506e57b2e3420df8f5 GIT binary patch literal 6148 zcmeHKU1|a`5T2A9Dq75M;eT_W~9dY(d?nRG)JZkJbD5%})!9>+2$A29j@* z`N`&kO)^Bpt5dTiS`g6;O^`(y5Sbn{J-PEUkR`{m-nNHsAjRWO$+u7FojUs5?{2=| zEr+(Mn$!1|=;!kGqMP}%G_g8S_Qh)5)zXfvtu!Y1;Q2zv{3dEgDo8M$^Eip zF|=@EFFx2;{w-cuS4aM&?!?(J`d}a!=rb^};X>~JHGY}FBEKIJqhKHy_-738w5qEW zHsyEg&GzK3O=uf55%DXcK%n;?0T{?R@~TF&C(+@T9gCr4k$DXV#zQ~}i7przfq^Uk C2PP)~ literal 0 HcmV?d00001 diff --git a/README.md b/src/webapp/api/README.md similarity index 100% rename from README.md rename to src/webapp/api/README.md diff --git a/images/.svn/all-wcprops b/src/webapp/api/images/.svn/all-wcprops similarity index 100% rename from images/.svn/all-wcprops rename to src/webapp/api/images/.svn/all-wcprops diff --git a/images/.svn/entries b/src/webapp/api/images/.svn/entries similarity index 100% rename from images/.svn/entries rename to src/webapp/api/images/.svn/entries diff --git a/images/.svn/prop-base/go-next.png.svn-base b/src/webapp/api/images/.svn/prop-base/go-next.png.svn-base similarity index 100% rename from images/.svn/prop-base/go-next.png.svn-base rename to src/webapp/api/images/.svn/prop-base/go-next.png.svn-base diff --git a/images/.svn/prop-base/go-previous.png.svn-base b/src/webapp/api/images/.svn/prop-base/go-previous.png.svn-base similarity index 100% rename from images/.svn/prop-base/go-previous.png.svn-base rename to src/webapp/api/images/.svn/prop-base/go-previous.png.svn-base diff --git a/images/.svn/prop-base/progress-running.gif.svn-base b/src/webapp/api/images/.svn/prop-base/progress-running.gif.svn-base similarity index 100% rename from images/.svn/prop-base/progress-running.gif.svn-base rename to src/webapp/api/images/.svn/prop-base/progress-running.gif.svn-base diff --git a/images/.svn/text-base/go-next.png.svn-base b/src/webapp/api/images/.svn/text-base/go-next.png.svn-base similarity index 100% rename from images/.svn/text-base/go-next.png.svn-base rename to src/webapp/api/images/.svn/text-base/go-next.png.svn-base diff --git a/images/.svn/text-base/go-previous.png.svn-base b/src/webapp/api/images/.svn/text-base/go-previous.png.svn-base similarity index 100% rename from images/.svn/text-base/go-previous.png.svn-base rename to src/webapp/api/images/.svn/text-base/go-previous.png.svn-base diff --git a/images/.svn/text-base/progress-running.gif.svn-base b/src/webapp/api/images/.svn/text-base/progress-running.gif.svn-base similarity index 100% rename from images/.svn/text-base/progress-running.gif.svn-base rename to src/webapp/api/images/.svn/text-base/progress-running.gif.svn-base diff --git a/images/go-next.png b/src/webapp/api/images/go-next.png similarity index 100% rename from images/go-next.png rename to src/webapp/api/images/go-next.png diff --git a/images/go-previous.png b/src/webapp/api/images/go-previous.png similarity index 100% rename from images/go-previous.png rename to src/webapp/api/images/go-previous.png diff --git a/images/message-bottom-left.png b/src/webapp/api/images/message-bottom-left.png similarity index 100% rename from images/message-bottom-left.png rename to src/webapp/api/images/message-bottom-left.png diff --git a/images/message-bottom-right.png b/src/webapp/api/images/message-bottom-right.png similarity index 100% rename from images/message-bottom-right.png rename to src/webapp/api/images/message-bottom-right.png diff --git a/images/message-left.png b/src/webapp/api/images/message-left.png similarity index 100% rename from images/message-left.png rename to src/webapp/api/images/message-left.png diff --git a/images/message-right.png b/src/webapp/api/images/message-right.png similarity index 100% rename from images/message-right.png rename to src/webapp/api/images/message-right.png diff --git a/images/message-top-left.png b/src/webapp/api/images/message-top-left.png similarity index 100% rename from images/message-top-left.png rename to src/webapp/api/images/message-top-left.png diff --git a/images/message-top-right.png b/src/webapp/api/images/message-top-right.png similarity index 100% rename from images/message-top-right.png rename to src/webapp/api/images/message-top-right.png diff --git a/images/progress-running.gif b/src/webapp/api/images/progress-running.gif similarity index 100% rename from images/progress-running.gif rename to src/webapp/api/images/progress-running.gif diff --git a/locales/.svn/all-wcprops b/src/webapp/api/locales/.svn/all-wcprops similarity index 100% rename from locales/.svn/all-wcprops rename to src/webapp/api/locales/.svn/all-wcprops diff --git a/locales/.svn/entries b/src/webapp/api/locales/.svn/entries similarity index 100% rename from locales/.svn/entries rename to src/webapp/api/locales/.svn/entries diff --git a/locales/en/.svn/all-wcprops b/src/webapp/api/locales/en/.svn/all-wcprops similarity index 100% rename from locales/en/.svn/all-wcprops rename to src/webapp/api/locales/en/.svn/all-wcprops diff --git a/locales/en/.svn/entries b/src/webapp/api/locales/en/.svn/entries similarity index 100% rename from locales/en/.svn/entries rename to src/webapp/api/locales/en/.svn/entries diff --git a/locales/en/.svn/text-base/locale.js.svn-base b/src/webapp/api/locales/en/.svn/text-base/locale.js.svn-base similarity index 97% rename from locales/en/.svn/text-base/locale.js.svn-base rename to src/webapp/api/locales/en/.svn/text-base/locale.js.svn-base index 8a29acf..6e5c6c1 100644 --- a/locales/en/.svn/text-base/locale.js.svn-base +++ b/src/webapp/api/locales/en/.svn/text-base/locale.js.svn-base @@ -1,31 +1,31 @@ -/*================================================== - * English localization - * (also base and default localization) - *================================================== - */ -(function() { - var javascriptFiles = [ - "timegrid-l10n.js", - - "util/date-l10n.js", - - "layouts/nday-l10n.js", - "layouts/nmonth-l10n.js", - "layouts/monthly-l10n.js", - "layouts/weekly-l10n.js", - "layouts/property-l10n.js" - ]; - var cssFiles = [ - ]; - - var urlPrefix = Timegrid.urlPrefix + "locales/en/"; - if (Timegrid.params.bundle) { - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); - if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); - } - } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); - } -})(); +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/monthly-l10n.js", + "layouts/weekly-l10n.js", + "layouts/property-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/en/"; + if (Timegrid.params.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/locales/en/locale.js b/src/webapp/api/locales/en/locale.js similarity index 100% rename from locales/en/locale.js rename to src/webapp/api/locales/en/locale.js diff --git a/locales/en/scripts/.svn/all-wcprops b/src/webapp/api/locales/en/scripts/.svn/all-wcprops similarity index 100% rename from locales/en/scripts/.svn/all-wcprops rename to src/webapp/api/locales/en/scripts/.svn/all-wcprops diff --git a/locales/en/scripts/.svn/entries b/src/webapp/api/locales/en/scripts/.svn/entries similarity index 100% rename from locales/en/scripts/.svn/entries rename to src/webapp/api/locales/en/scripts/.svn/entries diff --git a/locales/en/scripts/timegrid-l10n.js b/src/webapp/api/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/timegrid-l10n.js rename to src/webapp/api/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base diff --git a/locales/en/scripts/layouts/.svn/all-wcprops b/src/webapp/api/locales/en/scripts/layouts/.svn/all-wcprops similarity index 100% rename from locales/en/scripts/layouts/.svn/all-wcprops rename to src/webapp/api/locales/en/scripts/layouts/.svn/all-wcprops diff --git a/locales/en/scripts/layouts/.svn/entries b/src/webapp/api/locales/en/scripts/layouts/.svn/entries similarity index 100% rename from locales/en/scripts/layouts/.svn/entries rename to src/webapp/api/locales/en/scripts/layouts/.svn/entries diff --git a/locales/en/scripts/layouts/monthly-l10n.js b/src/webapp/api/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/layouts/monthly-l10n.js rename to src/webapp/api/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base diff --git a/locales/en/scripts/layouts/nday-l10n.js b/src/webapp/api/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/layouts/nday-l10n.js rename to src/webapp/api/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base diff --git a/locales/en/scripts/layouts/nmonth-l10n.js b/src/webapp/api/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/layouts/nmonth-l10n.js rename to src/webapp/api/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base diff --git a/locales/en/scripts/layouts/property-l10n.js b/src/webapp/api/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/layouts/property-l10n.js rename to src/webapp/api/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base diff --git a/locales/en/scripts/layouts/weekly-l10n.js b/src/webapp/api/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/layouts/weekly-l10n.js rename to src/webapp/api/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base diff --git a/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js similarity index 97% rename from locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js index 3fe6b5a..635eea9 100644 --- a/locales/en/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid MonthLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.MonthLayout)) { - Timegrid.MonthLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Month"; } \ No newline at end of file diff --git a/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/layouts/nday-l10n.js similarity index 97% rename from locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/layouts/nday-l10n.js index 09a89b2..1d3f099 100644 --- a/locales/en/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/layouts/nday-l10n.js @@ -1,31 +1,31 @@ -/****************************************************************************** - * Timegrid NDayLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NDayLayout)) { - Timegrid.NDayLayout.l10n = { mini: {} }; -} - -/** Function to create a title string from an n-value */ -Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { - return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + - d2.format(Timegrid.NDayLayout.l10n.endFormat); -}; - -/** Format for horizontal "Mon 5/24" style labels */ -Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; -Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; - -/** Format for vertical "12am" style labels */ -Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; -Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; - -/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ -Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; - -/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ -Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; - +/****************************************************************************** + * Timegrid NDayLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = { mini: {} }; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 5/24" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; + +/** Format for vertical "12am" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; + diff --git a/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js similarity index 97% rename from locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js index b62292b..eda5778 100644 --- a/locales/en/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js @@ -1,31 +1,31 @@ -/****************************************************************************** - * Timegrid NMonthLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NMonthLayout)) { - Timegrid.NMonthLayout.l10n = {}; -} - -/** Function to create a title string from an n-value */ -Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { - var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); - if (d2) { - string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); - } - return string; -}; - -/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ -Timegrid.NMonthLayout.l10n.xLabelFormat = ""; - -/** Format for vertical "W23" style labels */ -Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; - -/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ -Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; - -/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +/****************************************************************************** + * Timegrid NMonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); + if (d2) { + string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); + } + return string; +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ Timegrid.NMonthLayout.l10n.endFormat = "MMM yyyy"; \ No newline at end of file diff --git a/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/layouts/property-l10n.js similarity index 97% rename from locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/layouts/property-l10n.js index 6c2f763..d7dd304 100644 --- a/locales/en/scripts/layouts/.svn/text-base/property-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/layouts/property-l10n.js @@ -1,15 +1,15 @@ -/****************************************************************************** - * Timegrid PropertyLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.PropertyLayout)) { - Timegrid.PropertyLayout.l10n = {}; -} - -/** Function to create a title string */ -Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } - -/** Format for vertical "12am" style labels */ -Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; - - +/****************************************************************************** + * Timegrid PropertyLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.PropertyLayout)) { + Timegrid.PropertyLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } + +/** Format for vertical "12am" style labels */ +Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; + + diff --git a/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js similarity index 97% rename from locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js index 105a0e1..72157b9 100644 --- a/locales/en/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid WeekLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.WeekLayout)) { - Timegrid.WeekLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Week"; } \ No newline at end of file diff --git a/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/timegrid-l10n.js similarity index 97% rename from locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/timegrid-l10n.js index b2acaf0..0e558d0 100644 --- a/locales/en/scripts/.svn/text-base/timegrid-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/timegrid-l10n.js @@ -1,13 +1,13 @@ -/****************************************************************************** - * Timegrid English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid)) { - Timegrid.l10n = {}; -} - -Timegrid.l10n.loadingMessage = "Loading..."; - -Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; - +/****************************************************************************** + * Timegrid English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Loading..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; \ No newline at end of file diff --git a/locales/en/scripts/util/.svn/all-wcprops b/src/webapp/api/locales/en/scripts/util/.svn/all-wcprops similarity index 100% rename from locales/en/scripts/util/.svn/all-wcprops rename to src/webapp/api/locales/en/scripts/util/.svn/all-wcprops diff --git a/locales/en/scripts/util/.svn/entries b/src/webapp/api/locales/en/scripts/util/.svn/entries similarity index 100% rename from locales/en/scripts/util/.svn/entries rename to src/webapp/api/locales/en/scripts/util/.svn/entries diff --git a/locales/en/scripts/util/date-l10n.js b/src/webapp/api/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base similarity index 100% rename from locales/en/scripts/util/date-l10n.js rename to src/webapp/api/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base diff --git a/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base b/src/webapp/api/locales/en/scripts/util/date-l10n.js similarity index 97% rename from locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base rename to src/webapp/api/locales/en/scripts/util/date-l10n.js index d9fcaac..e53fb8b 100644 --- a/locales/en/scripts/util/.svn/text-base/date-l10n.js.svn-base +++ b/src/webapp/api/locales/en/scripts/util/date-l10n.js @@ -1,29 +1,29 @@ -/****************************************************************************** - * Timegrid Date English localization - *****************************************************************************/ - -if (!("l10n" in Date)) { - Date.l10n = {}; -} - -/** Full month names. Change this for local month names */ -Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; - -/** Month abbreviations. Change this for local month names */ -Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - -/** Full day names. Change this for local month names */ -Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; - -/** Day abbreviations. Change this for local month names */ -Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; - -/** - * Used for parsing ambiguous dates like 1/2/2000 - default to preferring - * 'American' format meaning Jan 2. Set to false to prefer 'European' format - * meaning Feb 1. - */ -Date.l10n.preferAmericanFormat = true; - -/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ -Date.l10n.firstDayOfWeek = 0; +/****************************************************************************** + * Timegrid Date English localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; + +/** Month abbreviations. Change this for local month names */ +Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + +/** Full day names. Change this for local month names */ +Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + +/** Day abbreviations. Change this for local month names */ +Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = true; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 0; diff --git a/locales/fr/.svn/all-wcprops b/src/webapp/api/locales/fr/.svn/all-wcprops similarity index 100% rename from locales/fr/.svn/all-wcprops rename to src/webapp/api/locales/fr/.svn/all-wcprops diff --git a/locales/fr/.svn/entries b/src/webapp/api/locales/fr/.svn/entries similarity index 100% rename from locales/fr/.svn/entries rename to src/webapp/api/locales/fr/.svn/entries diff --git a/locales/fr/.svn/text-base/locale.js.svn-base b/src/webapp/api/locales/fr/.svn/text-base/locale.js.svn-base similarity index 97% rename from locales/fr/.svn/text-base/locale.js.svn-base rename to src/webapp/api/locales/fr/.svn/text-base/locale.js.svn-base index 619dacb..ff834d3 100644 --- a/locales/fr/.svn/text-base/locale.js.svn-base +++ b/src/webapp/api/locales/fr/.svn/text-base/locale.js.svn-base @@ -1,30 +1,30 @@ -/*================================================== - * English localization - * (also base and default localization) - *================================================== - */ -(function() { - var javascriptFiles = [ - "timegrid-l10n.js", - - "util/date-l10n.js", - - "layouts/nday-l10n.js", - "layouts/nmonth-l10n.js", - "layouts/weekly-l10n.js", - "layouts/monthly-l10n.js" - ]; - var cssFiles = [ - ]; - - var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; - if (Timegrid.bundle) { - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); - if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); - } - } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); - } -})(); +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/weekly-l10n.js", + "layouts/monthly-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; + if (Timegrid.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/locales/fr/locale.js b/src/webapp/api/locales/fr/locale.js similarity index 100% rename from locales/fr/locale.js rename to src/webapp/api/locales/fr/locale.js diff --git a/locales/fr/scripts/.svn/all-wcprops b/src/webapp/api/locales/fr/scripts/.svn/all-wcprops similarity index 100% rename from locales/fr/scripts/.svn/all-wcprops rename to src/webapp/api/locales/fr/scripts/.svn/all-wcprops diff --git a/locales/fr/scripts/.svn/entries b/src/webapp/api/locales/fr/scripts/.svn/entries similarity index 100% rename from locales/fr/scripts/.svn/entries rename to src/webapp/api/locales/fr/scripts/.svn/entries diff --git a/locales/fr/scripts/timegrid-l10n.js b/src/webapp/api/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base similarity index 100% rename from locales/fr/scripts/timegrid-l10n.js rename to src/webapp/api/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base diff --git a/locales/fr/scripts/layouts/.svn/all-wcprops b/src/webapp/api/locales/fr/scripts/layouts/.svn/all-wcprops similarity index 100% rename from locales/fr/scripts/layouts/.svn/all-wcprops rename to src/webapp/api/locales/fr/scripts/layouts/.svn/all-wcprops diff --git a/locales/fr/scripts/layouts/.svn/entries b/src/webapp/api/locales/fr/scripts/layouts/.svn/entries similarity index 100% rename from locales/fr/scripts/layouts/.svn/entries rename to src/webapp/api/locales/fr/scripts/layouts/.svn/entries diff --git a/locales/fr/scripts/layouts/monthly-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base similarity index 100% rename from locales/fr/scripts/layouts/monthly-l10n.js rename to src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base diff --git a/locales/fr/scripts/layouts/nday-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base similarity index 100% rename from locales/fr/scripts/layouts/nday-l10n.js rename to src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base diff --git a/locales/fr/scripts/layouts/nmonth-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base similarity index 100% rename from locales/fr/scripts/layouts/nmonth-l10n.js rename to src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base diff --git a/locales/fr/scripts/layouts/weekly-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base similarity index 100% rename from locales/fr/scripts/layouts/weekly-l10n.js rename to src/webapp/api/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base diff --git a/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base b/src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js similarity index 97% rename from locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base rename to src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js index 36d6413..18f28c9 100644 --- a/locales/fr/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base +++ b/src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid MonthLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.MonthLayout)) { - Timegrid.MonthLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Mois"; } \ No newline at end of file diff --git a/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base b/src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js similarity index 97% rename from locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base rename to src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js index a3ad936..dd6caad 100644 --- a/locales/fr/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base +++ b/src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js @@ -1,29 +1,29 @@ -/****************************************************************************** - * Timegrid NDayLayout French localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NDayLayout)) { - Timegrid.NDayLayout.l10n = {}; -} - -/** Function to create a title string from an n-value */ -Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Jour"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { - return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + - d2.format(Timegrid.NDayLayout.l10n.endFormat); -}; - -/** Format for horizontal "Mon 24/5" style labels */ -Timegrid.NDayLayout.l10n.xLabelFormat = "E d/M"; - -/** Format for vertical "13h" style labels */ -Timegrid.NDayLayout.l10n.yLabelFormat = "H"; - -/** Format for displaying the grid's starting date, e.g. "16/6/2007" */ -Timegrid.NDayLayout.l10n.startFormat = "d/M/yyyy"; - -/** Format for displaying the grid's ending date, e.g. "17/6/2007" */ -Timegrid.NDayLayout.l10n.endFormat = "d/M/yyyy"; - +/****************************************************************************** + * Timegrid NDayLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Jour"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 24/5" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E d/M"; + +/** Format for vertical "13h" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "H"; + +/** Format for displaying the grid's starting date, e.g. "16/6/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "17/6/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "d/M/yyyy"; + diff --git a/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base b/src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js similarity index 97% rename from locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base rename to src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js index e89a0ca..3d3cb70 100644 --- a/locales/fr/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base +++ b/src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js @@ -1,28 +1,28 @@ -/****************************************************************************** - * Timegrid NMonthLayout French localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NMonthLayout)) { - Timegrid.NMonthLayout.l10n = {}; -} - -/** Function to create a title string from an n-value */ -Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Mois"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { - return d1.format(Timegrid.NMonthLayout.l10n.startFormat) + " - " + - d2.format(Timegrid.NMonthLayout.l10n.endFormat); -}; - -/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ -Timegrid.NMonthLayout.l10n.xLabelFormat = ""; - -/** Format for vertical "W23" style labels */ -Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; - -/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ -Timegrid.NMonthLayout.l10n.startFormat = "d/M/yyyy"; - -/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ -Timegrid.NMonthLayout.l10n.endFormat = "d/M/yyyy"; +/****************************************************************************** + * Timegrid NMonthLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Mois"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NMonthLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NMonthLayout.l10n.endFormat); +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "d/M/yyyy"; diff --git a/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base b/src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js similarity index 97% rename from locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base rename to src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js index bbb08c9..9114028 100644 --- a/locales/fr/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base +++ b/src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid WeekLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.WeekLayout)) { - Timegrid.WeekLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Semaine"; } \ No newline at end of file diff --git a/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base b/src/webapp/api/locales/fr/scripts/timegrid-l10n.js similarity index 97% rename from locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base rename to src/webapp/api/locales/fr/scripts/timegrid-l10n.js index 041c4b8..773ecb5 100644 --- a/locales/fr/scripts/.svn/text-base/timegrid-l10n.js.svn-base +++ b/src/webapp/api/locales/fr/scripts/timegrid-l10n.js @@ -1,13 +1,13 @@ -/****************************************************************************** - * Timegrid French localization - *****************************************************************************/ - -if (!("l10n" in Timegrid)) { - Timegrid.l10n = {}; -} - -Timegrid.l10n.loadingMessage = "Chargement..."; - -Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; - -Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; +/****************************************************************************** + * Timegrid French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Chargement..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; diff --git a/locales/fr/scripts/util/.svn/all-wcprops b/src/webapp/api/locales/fr/scripts/util/.svn/all-wcprops similarity index 100% rename from locales/fr/scripts/util/.svn/all-wcprops rename to src/webapp/api/locales/fr/scripts/util/.svn/all-wcprops diff --git a/locales/fr/scripts/util/.svn/entries b/src/webapp/api/locales/fr/scripts/util/.svn/entries similarity index 100% rename from locales/fr/scripts/util/.svn/entries rename to src/webapp/api/locales/fr/scripts/util/.svn/entries diff --git a/locales/fr/scripts/util/date-l10n.js b/src/webapp/api/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base similarity index 100% rename from locales/fr/scripts/util/date-l10n.js rename to src/webapp/api/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base diff --git a/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base b/src/webapp/api/locales/fr/scripts/util/date-l10n.js similarity index 97% rename from locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base rename to src/webapp/api/locales/fr/scripts/util/date-l10n.js index e6e8221..710dc10 100644 --- a/locales/fr/scripts/util/.svn/text-base/date-l10n.js.svn-base +++ b/src/webapp/api/locales/fr/scripts/util/date-l10n.js @@ -1,29 +1,29 @@ -/****************************************************************************** - * Timegrid Date French localization - *****************************************************************************/ - -if (!("l10n" in Date)) { - Date.l10n = {}; -} - -/** Full month names. Change this for local month names */ -Date.l10n.monthNames =[ 'janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; - -/** Month abbreviations. Change this for local month abbreviations */ -Date.l10n.monthAbbreviations = [ 'janv', 'fevr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'dec' ]; - -/** Full day names. Change this for local day names. */ -Date.l10n.dayNames = [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ]; - -/** Day abbreviations. Change this for local day abbreviations */ -Date.l10n.dayAbbreviations = ['dim','lun','mar','mer','jeu','ven','sam']; - -/** - * Used for parsing ambiguous dates like 1/2/2000 - default to preferring - * 'American' format meaning Jan 2. Set to false to prefer 'European' format - * meaning Feb 1. - */ -Date.l10n.preferAmericanFormat = false; - -/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ -Date.l10n.firstDayOfWeek = 1; +/****************************************************************************** + * Timegrid Date French localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; + +/** Month abbreviations. Change this for local month abbreviations */ +Date.l10n.monthAbbreviations = [ 'janv', 'fevr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'dec' ]; + +/** Full day names. Change this for local day names. */ +Date.l10n.dayNames = [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ]; + +/** Day abbreviations. Change this for local day abbreviations */ +Date.l10n.dayAbbreviations = ['dim','lun','mar','mer','jeu','ven','sam']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = false; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 1; diff --git a/scripts/.svn/all-wcprops b/src/webapp/api/scripts/.svn/all-wcprops similarity index 100% rename from scripts/.svn/all-wcprops rename to src/webapp/api/scripts/.svn/all-wcprops diff --git a/scripts/.svn/entries b/src/webapp/api/scripts/.svn/entries similarity index 100% rename from scripts/.svn/entries rename to src/webapp/api/scripts/.svn/entries diff --git a/scripts/.svn/text-base/controls.js.svn-base b/src/webapp/api/scripts/.svn/text-base/controls.js.svn-base similarity index 97% rename from scripts/.svn/text-base/controls.js.svn-base rename to src/webapp/api/scripts/.svn/text-base/controls.js.svn-base index 3b4ba36..6e9a40a 100644 --- a/scripts/.svn/text-base/controls.js.svn-base +++ b/src/webapp/api/scripts/.svn/text-base/controls.js.svn-base @@ -1,148 +1,148 @@ -/** - * Controls - */ - -Timegrid.Controls = {}; - -/* - * A panel will render controls around a set of layouts. This should be the - * only entrypoint into this code, in addition to the render method. - * Possible controls include: - * Switching between the layouts (tabs) - * Iterating through time, different weeks/months, etc (arrows) - * Switching between data sources - * The style and selection of which types of controls to render in the panel - * should be easily configurable through the params hash passed in. - */ -Timegrid.Controls.Panel = function(layouts, params) { - this._layouts = layouts; - this._titles = $.map(this._layouts, function(l) { return l.title; }); - this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); -}; - -Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { - this._layouts = layouts; - this._titles = $.map(this._layouts, function(l) { return l.title; }); - this._tabSet.setLayouts(this._titles, this._layouts); -}; - -Timegrid.Controls.Panel.prototype.render = function(container) { - this._tabSet.render(container); - this._tabSet.switchTo(this._tabSet.current || this._titles[0]); -}; - -Timegrid.Controls.Panel.prototype.renderChanged = function() { - this._tabSet.renderChanged(); - this._tabSet.switchTo(this._tabSet.current || this._titles[0]); -}; - -/* - * TabSet is a style of control that generates a set of tabs. These tabs can - * be configured to switch between different views, time slices, or data - * sources. - */ -Timegrid.Controls.TabSet = function(titles, layouts) { - this.setLayouts(titles, layouts); - this.current = ""; -}; - -Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { - this._tabs = {}; - this._renderedLayouts = {}; - this._iterators = {}; - this._layoutMap = {}; - for (var i = 0; i < titles.length; i++) { - this._layoutMap[titles[i]] = layouts[i]; - } -}; - -Timegrid.Controls.TabSet.prototype.render = function(container) { - this._container = container; - var self = this; - var tabDiv = $('
      ').addClass('timegrid-tabs'); - $(container).prepend(tabDiv); - var makeCallback = function(title) { - return function() { self.switchTo(title); }; - }; - for (var lTitle in this._layoutMap) { - var tab = $('') - .height(this._layoutMap[lTitle].tabHeight + "px") - .click(makeCallback(lTitle)) - .addClass('timegrid-tab').addClass('timegrid-rounded'); - tabDiv.prepend(tab); - this._tabs[lTitle] = tab; - } - if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } -}; - -Timegrid.Controls.TabSet.prototype.renderChanged = function() { - var layout = this._layoutMap[this.current]; - layout.renderChanged(); -}; - -Timegrid.Controls.TabSet.prototype.switchTo = function(title) { - if (this.current && this._renderedLayouts[this.current]) { - this._renderedLayouts[this.current].hide(); - this._tabs[this.current].removeClass('timegrid-tab-active'); - } - if (this._renderedLayouts[title]) { - this._renderedLayouts[title].show(); - } else if (this._layoutMap[title]) { - this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); - } - if (this._iDiv) { $(this._iDiv).empty(); } - if (this._layoutMap[title].iterable) { - if (!this._iterators[title]) { - this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); - this._iDiv = $(this._iterators[title].render(this._container)); - } else { - this._iDiv = $(this._iterators[title].render()); - } - } - this.current = title; - this._tabs[this.current].addClass('timegrid-tab-active'); -}; - -/* - * Iterator is a style of control that generates a textual label for the - * current selection and a set of arrows for moving to either the previous - * or next selection. Can be used for views, time, or sources. - */ -Timegrid.Controls.Iterator = function(layout) { - this._layout = layout; -}; - -Timegrid.Controls.Iterator.prototype.render = function(container) { - if (container) { - this._container = container; - this._div = $('
      ').addClass('timegrid-iterator'); - $(this._container).prepend(this._div); - } else { - this._div.empty(); - } - var self = this; - var makePrevCallback = function(layout) { - return function() { - layout.goPrevious(); - self.render(); - }; - }; - var makeNextCallback = function(layout) { - return function() { - layout.goNext(); - self.render(); - }; - }; - var prevLink = $('Previous') - .wrap('').parent() - .addClass('timegrid-iterator-prev') - .click(makePrevCallback(this._layout)); - var nextLink = $('Next') - .wrap('').parent() - .addClass('timegrid-iterator-next') - .click(makeNextCallback(this._layout)); - this._div.append(prevLink); - this._div.append(nextLink); - this._div.append('' + this._layout.getCurrent() + ''); - return this._div; -}; +/** + * Controls + */ + +Timegrid.Controls = {}; + +/* + * A panel will render controls around a set of layouts. This should be the + * only entrypoint into this code, in addition to the render method. + * Possible controls include: + * Switching between the layouts (tabs) + * Iterating through time, different weeks/months, etc (arrows) + * Switching between data sources + * The style and selection of which types of controls to render in the panel + * should be easily configurable through the params hash passed in. + */ +Timegrid.Controls.Panel = function(layouts, params) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet.setLayouts(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.render = function(container) { + this._tabSet.render(container); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +Timegrid.Controls.Panel.prototype.renderChanged = function() { + this._tabSet.renderChanged(); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +/* + * TabSet is a style of control that generates a set of tabs. These tabs can + * be configured to switch between different views, time slices, or data + * sources. + */ +Timegrid.Controls.TabSet = function(titles, layouts) { + this.setLayouts(titles, layouts); + this.current = ""; +}; + +Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { + this._tabs = {}; + this._renderedLayouts = {}; + this._iterators = {}; + this._layoutMap = {}; + for (var i = 0; i < titles.length; i++) { + this._layoutMap[titles[i]] = layouts[i]; + } +}; + +Timegrid.Controls.TabSet.prototype.render = function(container) { + this._container = container; + var self = this; + var tabDiv = $('
      ').addClass('timegrid-tabs'); + $(container).prepend(tabDiv); + var makeCallback = function(title) { + return function() { self.switchTo(title); }; + }; + for (var lTitle in this._layoutMap) { + var tab = $('') + .height(this._layoutMap[lTitle].tabHeight + "px") + .click(makeCallback(lTitle)) + .addClass('timegrid-tab').addClass('timegrid-rounded'); + tabDiv.prepend(tab); + this._tabs[lTitle] = tab; + } + if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } +}; + +Timegrid.Controls.TabSet.prototype.renderChanged = function() { + var layout = this._layoutMap[this.current]; + layout.renderChanged(); +}; + +Timegrid.Controls.TabSet.prototype.switchTo = function(title) { + if (this.current && this._renderedLayouts[this.current]) { + this._renderedLayouts[this.current].hide(); + this._tabs[this.current].removeClass('timegrid-tab-active'); + } + if (this._renderedLayouts[title]) { + this._renderedLayouts[title].show(); + } else if (this._layoutMap[title]) { + this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); + } + if (this._iDiv) { $(this._iDiv).empty(); } + if (this._layoutMap[title].iterable) { + if (!this._iterators[title]) { + this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); + this._iDiv = $(this._iterators[title].render(this._container)); + } else { + this._iDiv = $(this._iterators[title].render()); + } + } + this.current = title; + this._tabs[this.current].addClass('timegrid-tab-active'); +}; + +/* + * Iterator is a style of control that generates a textual label for the + * current selection and a set of arrows for moving to either the previous + * or next selection. Can be used for views, time, or sources. + */ +Timegrid.Controls.Iterator = function(layout) { + this._layout = layout; +}; + +Timegrid.Controls.Iterator.prototype.render = function(container) { + if (container) { + this._container = container; + this._div = $('
      ').addClass('timegrid-iterator'); + $(this._container).prepend(this._div); + } else { + this._div.empty(); + } + var self = this; + var makePrevCallback = function(layout) { + return function() { + layout.goPrevious(); + self.render(); + }; + }; + var makeNextCallback = function(layout) { + return function() { + layout.goNext(); + self.render(); + }; + }; + var prevLink = $('Previous') + .wrap('').parent() + .addClass('timegrid-iterator-prev') + .click(makePrevCallback(this._layout)); + var nextLink = $('Next') + .wrap('').parent() + .addClass('timegrid-iterator-next') + .click(makeNextCallback(this._layout)); + this._div.append(prevLink); + this._div.append(nextLink); + this._div.append('' + this._layout.getCurrent() + ''); + return this._div; +}; diff --git a/scripts/create.js b/src/webapp/api/scripts/.svn/text-base/create.js.svn-base similarity index 100% rename from scripts/create.js rename to src/webapp/api/scripts/.svn/text-base/create.js.svn-base diff --git a/scripts/.svn/text-base/grid.js.svn-base b/src/webapp/api/scripts/.svn/text-base/grid.js.svn-base similarity index 100% rename from scripts/.svn/text-base/grid.js.svn-base rename to src/webapp/api/scripts/.svn/text-base/grid.js.svn-base diff --git a/scripts/.svn/text-base/labellers.js.svn-base b/src/webapp/api/scripts/.svn/text-base/labellers.js.svn-base similarity index 100% rename from scripts/.svn/text-base/labellers.js.svn-base rename to src/webapp/api/scripts/.svn/text-base/labellers.js.svn-base diff --git a/scripts/listeners.js b/src/webapp/api/scripts/.svn/text-base/listeners.js.svn-base similarity index 100% rename from scripts/listeners.js rename to src/webapp/api/scripts/.svn/text-base/listeners.js.svn-base diff --git a/scripts/.svn/text-base/themes.js.svn-base b/src/webapp/api/scripts/.svn/text-base/themes.js.svn-base similarity index 100% rename from scripts/.svn/text-base/themes.js.svn-base rename to src/webapp/api/scripts/.svn/text-base/themes.js.svn-base diff --git a/scripts/.svn/text-base/timegrid.js.svn-base b/src/webapp/api/scripts/.svn/text-base/timegrid.js.svn-base similarity index 100% rename from scripts/.svn/text-base/timegrid.js.svn-base rename to src/webapp/api/scripts/.svn/text-base/timegrid.js.svn-base diff --git a/scripts/controls.js b/src/webapp/api/scripts/controls.js similarity index 100% rename from scripts/controls.js rename to src/webapp/api/scripts/controls.js diff --git a/scripts/.svn/text-base/create.js.svn-base b/src/webapp/api/scripts/create.js similarity index 97% rename from scripts/.svn/text-base/create.js.svn-base rename to src/webapp/api/scripts/create.js index d0484ee..fcd95ec 100644 --- a/scripts/.svn/text-base/create.js.svn-base +++ b/src/webapp/api/scripts/create.js @@ -1,8 +1,8 @@ -$(document).ready(function() { - $('div').each(function() { - if ($(this).attrs('tg').role == "grid") { - if (!window.timegrids) { window.timegrids = new Array(); } - window.timegrids.push(Timegrid.createFromDOM(this)); - } - }); +$(document).ready(function() { + $('div').each(function() { + if ($(this).attrs('tg').role == "grid") { + if (!window.timegrids) { window.timegrids = new Array(); } + window.timegrids.push(Timegrid.createFromDOM(this)); + } + }); }); \ No newline at end of file diff --git a/scripts/grid.js b/src/webapp/api/scripts/grid.js similarity index 100% rename from scripts/grid.js rename to src/webapp/api/scripts/grid.js diff --git a/scripts/jquery.simile.ajax.js b/src/webapp/api/scripts/jquery.simile.ajax.js similarity index 100% rename from scripts/jquery.simile.ajax.js rename to src/webapp/api/scripts/jquery.simile.ajax.js diff --git a/scripts/labellers.js b/src/webapp/api/scripts/labellers.js similarity index 100% rename from scripts/labellers.js rename to src/webapp/api/scripts/labellers.js diff --git a/scripts/layouts/.svn/all-wcprops b/src/webapp/api/scripts/layouts/.svn/all-wcprops similarity index 100% rename from scripts/layouts/.svn/all-wcprops rename to src/webapp/api/scripts/layouts/.svn/all-wcprops diff --git a/scripts/layouts/.svn/entries b/src/webapp/api/scripts/layouts/.svn/entries similarity index 100% rename from scripts/layouts/.svn/entries rename to src/webapp/api/scripts/layouts/.svn/entries diff --git a/scripts/layouts/.svn/text-base/layout.js.svn-base b/src/webapp/api/scripts/layouts/.svn/text-base/layout.js.svn-base similarity index 100% rename from scripts/layouts/.svn/text-base/layout.js.svn-base rename to src/webapp/api/scripts/layouts/.svn/text-base/layout.js.svn-base diff --git a/scripts/layouts/.svn/text-base/monthly.js.svn-base b/src/webapp/api/scripts/layouts/.svn/text-base/monthly.js.svn-base similarity index 100% rename from scripts/layouts/.svn/text-base/monthly.js.svn-base rename to src/webapp/api/scripts/layouts/.svn/text-base/monthly.js.svn-base diff --git a/scripts/layouts/.svn/text-base/nday.js.svn-base b/src/webapp/api/scripts/layouts/.svn/text-base/nday.js.svn-base similarity index 97% rename from scripts/layouts/.svn/text-base/nday.js.svn-base rename to src/webapp/api/scripts/layouts/.svn/text-base/nday.js.svn-base index 9804d0d..bf68f9e 100644 --- a/scripts/layouts/.svn/text-base/nday.js.svn-base +++ b/src/webapp/api/scripts/layouts/.svn/text-base/nday.js.svn-base @@ -1,242 +1,242 @@ -/****************************************************************************** - * NDayLayout - * @fileoverview - * This is where the n-day layout is defined. The layout is designed to - * resemble the equivalent Google Calendar view. - * @author masont - *****************************************************************************/ - - /** - * Constructs an NDayLayout object. - * @class NDayLayout is a subclass of Layout that implements an n-day event - * calendar, modeled off of the weekly view found in Google Calendar. - * @extends Timegrid.Layout - * @constructor - */ -Timegrid.NDayLayout = function(eventSource, params) { - Timegrid.NDayLayout.superclass.call(this, eventSource, params); - var self = this; - - // Specifications for a week layout - this.xSize = 7; - this.ySize = 24; - this.iterable = true; - - // These are default values that can be overridden in configure - this.n = 3; - - this.xMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - var start = self.timezoneMapper(self.startTime); - var ivl = new SimileAjax.DateTime.Interval(time - start); - return ivl.days; - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; - }; - - this.configure(params); - - this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); - this.xSize = this.n; - this.dayEnd = this.dayend || 24; - this.dayStart = this.daystart || 0; - this.ySize = this.dayEnd - this.dayStart; - this.computeCellSizes(); - - this.eventSource = eventSource; - this.initializeGrid(eventSource); -}; -Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); - -Timegrid.NDayLayout.prototype.initializeGrid = function() { - this.startTime = this.computeStartTime(); - this.startTime.setHours(0); - this.endTime = this.computeEndTime(this.startTime); - - this.updateGrid(); -}; - -Timegrid.NDayLayout.prototype.updateGrid = function() { - var now = new Date(); - if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } - - this.endpoints = []; - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); - this.endpoints.push(ends[0]); - this.endpoints.push(ends[1]); - } - } - this.endpoints.sort(function(a, b) { - var diff = a.time - b.time; - if (!diff) { - return a.type == "start" ? 1 : -1; - } else { - return diff; - } - }); -}; - -Timegrid.NDayLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - var currentEvents = {}; - var currentCount = 0; - for (var i = 0; i < this.endpoints.length; i++) { - var endpoint = this.endpoints[i]; - var x = this.xMapper(endpoint); - var y = this.yMapper(endpoint); - if (endpoint.type == "start") { - // Render the event - var eventDiv = this.renderEvent(endpoint.event, x, y); - eventContainer.appendChild(eventDiv); - // Push the event div onto the current events set - currentEvents[endpoint.event.getID()] = eventDiv; - currentCount++; - // Adjust widths and offsets as necessary - var hIndex = 0; - for (var id in currentEvents) { - var eDiv = currentEvents[id]; - var newWidth = this.xCell / currentCount; - var newLeft = this.xCell * x + newWidth * hIndex; - $(eDiv).css("width", newWidth + "px"); - $(eDiv).css("left", newLeft + "px"); - hIndex++; - } - } else if (endpoint.type == "end") { - // Pop event from current events set - delete currentEvents[endpoint.event.getID()]; - currentCount--; - } - } - var nowDiv = this.renderNow(); - if (nowDiv) { - return $([eventContainer, nowDiv]); - } else { - return eventContainer; - } -}; - -Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { - var ediv = document.createElement('div'); - var tediv = document.createElement('div'); - if (!this.mini) { tediv.innerHTML = evt.getText(); } - ediv.appendChild(tediv); - var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); - var className = "timegrid-event"; - if (!this.mini) { - className += ' timegrid-rounded-shadow'; - } - ediv.className = className; - ediv.style.height = this.yCell * length + "px"; - ediv.style.top = this.yCell * y + "px"; - ediv.style.left = this.xCell * x + 'px'; - if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } - if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } - return ediv; // Return the actual DOM element -}; - -Timegrid.NDayLayout.prototype.renderNow = function() { - // If we aren't looking at the current time, return - if (!this.now) { return; } - - var nowX = this.xMapper({ time: this.now }); - var nowY = Math.floor(this.yMapper({ time: this.now })); - - var rectDiv = $('
      ').addClass('timegrid-week-highlights'); - var yRect = $('
      ').height(this.yCell + "px") - .width(this.xCell * this.xSize + "px") - .css('top', nowY * this.yCell + "px") - .addClass('timegrid-week-highlight'); - var xRect = $('
      ').height(this.yCell * this.ySize + "px") - .width(this.xCell + "px") - .css('left', nowX * this.xCell + "px") - .addClass('timegrid-week-highlight'); - rectDiv.append(xRect).append(yRect); - return rectDiv.get(0); -}; - -Timegrid.NDayLayout.prototype.getXLabels = function() { - var date = new Date(this.startTime); - var labels = []; - var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : - Timegrid.NDayLayout.l10n.xLabelFormat; - while (date < this.endTime) { - labels.push(date.format(format)); - date.setHours(24); - } - return labels; -}; - -Timegrid.NDayLayout.prototype.getYLabels = function() { - var date = (new Date()).clearTime(); - var labels = []; - var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : - Timegrid.NDayLayout.l10n.yLabelFormat; - for (var i = +this.dayStart; i < +this.dayEnd; i++) { - date.setHours(i); - labels.push(date.format(format)); - } - return labels; -}; - -Timegrid.NDayLayout.prototype.goPrevious = function() { - this.endTime = this.startTime; - this.startTime = this.computeStartTime(this.endTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NDayLayout.prototype.goNext = function() { - this.startTime = this.endTime; - this.endTime = this.computeEndTime(this.startTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NDayLayout.prototype.getCurrent = function() { - this.endTime.add('s', -1); - var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, - this.endTime); - this.endTime.add('s', 1); - return result; -}; - -Timegrid.NDayLayout.prototype.computeStartTime = function(date) { - if (date) { - var startTime = new Date(date); - startTime.add('d', 0 - this.n); - startTime.setHours(0); - return startTime; - } else { - var startTime = new Date(this.eventSource.getEarliestDate()) || - new Date(); - startTime.clearTime(); - return startTime; - } -}; - -Timegrid.NDayLayout.prototype.computeEndTime = function(date) { - if (date) { - var endTime = new Date(date); - endTime.add('d', this.n); - endTime.setHours(0); - return endTime; - } - return false; -}; - -Timegrid.NDayLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; - +/****************************************************************************** + * NDayLayout + * @fileoverview + * This is where the n-day layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + + /** + * Constructs an NDayLayout object. + * @class NDayLayout is a subclass of Layout that implements an n-day event + * calendar, modeled off of the weekly view found in Google Calendar. + * @extends Timegrid.Layout + * @constructor + */ +Timegrid.NDayLayout = function(eventSource, params) { + Timegrid.NDayLayout.superclass.call(this, eventSource, params); + var self = this; + + // Specifications for a week layout + this.xSize = 7; + this.ySize = 24; + this.iterable = true; + + // These are default values that can be overridden in configure + this.n = 3; + + this.xMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + var ivl = new SimileAjax.DateTime.Interval(time - start); + return ivl.days; + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); + this.xSize = this.n; + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + this.computeCellSizes(); + + this.eventSource = eventSource; + this.initializeGrid(eventSource); +}; +Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); + +Timegrid.NDayLayout.prototype.initializeGrid = function() { + this.startTime = this.computeStartTime(); + this.startTime.setHours(0); + this.endTime = this.computeEndTime(this.startTime); + + this.updateGrid(); +}; + +Timegrid.NDayLayout.prototype.updateGrid = function() { + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + + this.endpoints = []; + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); + this.endpoints.push(ends[0]); + this.endpoints.push(ends[1]); + } + } + this.endpoints.sort(function(a, b) { + var diff = a.time - b.time; + if (!diff) { + return a.type == "start" ? 1 : -1; + } else { + return diff; + } + }); +}; + +Timegrid.NDayLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (var i = 0; i < this.endpoints.length; i++) { + var endpoint = this.endpoints[i]; + var x = this.xMapper(endpoint); + var y = this.yMapper(endpoint); + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (var id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + var newLeft = this.xCell * x + newWidth * hIndex; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", newLeft + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + var nowDiv = this.renderNow(); + if (nowDiv) { + return $([eventContainer, nowDiv]); + } else { + return eventContainer; + } +}; + +Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { + var ediv = document.createElement('div'); + var tediv = document.createElement('div'); + if (!this.mini) { tediv.innerHTML = evt.getText(); } + ediv.appendChild(tediv); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + var className = "timegrid-event"; + if (!this.mini) { + className += ' timegrid-rounded-shadow'; + } + ediv.className = className; + ediv.style.height = this.yCell * length + "px"; + ediv.style.top = this.yCell * y + "px"; + ediv.style.left = this.xCell * x + 'px'; + if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } + if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } + return ediv; // Return the actual DOM element +}; + +Timegrid.NDayLayout.prototype.renderNow = function() { + // If we aren't looking at the current time, return + if (!this.now) { return; } + + var nowX = this.xMapper({ time: this.now }); + var nowY = Math.floor(this.yMapper({ time: this.now })); + + var rectDiv = $('
      ').addClass('timegrid-week-highlights'); + var yRect = $('
      ').height(this.yCell + "px") + .width(this.xCell * this.xSize + "px") + .css('top', nowY * this.yCell + "px") + .addClass('timegrid-week-highlight'); + var xRect = $('
      ').height(this.yCell * this.ySize + "px") + .width(this.xCell + "px") + .css('left', nowX * this.xCell + "px") + .addClass('timegrid-week-highlight'); + rectDiv.append(xRect).append(yRect); + return rectDiv.get(0); +}; + +Timegrid.NDayLayout.prototype.getXLabels = function() { + var date = new Date(this.startTime); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : + Timegrid.NDayLayout.l10n.xLabelFormat; + while (date < this.endTime) { + labels.push(date.format(format)); + date.setHours(24); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : + Timegrid.NDayLayout.l10n.yLabelFormat; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(format)); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.goPrevious = function() { + this.endTime = this.startTime; + this.startTime = this.computeStartTime(this.endTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.goNext = function() { + this.startTime = this.endTime; + this.endTime = this.computeEndTime(this.startTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.getCurrent = function() { + this.endTime.add('s', -1); + var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, + this.endTime); + this.endTime.add('s', 1); + return result; +}; + +Timegrid.NDayLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.add('d', 0 - this.n); + startTime.setHours(0); + return startTime; + } else { + var startTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + startTime.clearTime(); + return startTime; + } +}; + +Timegrid.NDayLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.n); + endTime.setHours(0); + return endTime; + } + return false; +}; + +Timegrid.NDayLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/scripts/layouts/nmonth.js b/src/webapp/api/scripts/layouts/.svn/text-base/nmonth.js.svn-base similarity index 100% rename from scripts/layouts/nmonth.js rename to src/webapp/api/scripts/layouts/.svn/text-base/nmonth.js.svn-base diff --git a/scripts/layouts/property.js b/src/webapp/api/scripts/layouts/.svn/text-base/property.js.svn-base similarity index 100% rename from scripts/layouts/property.js rename to src/webapp/api/scripts/layouts/.svn/text-base/property.js.svn-base diff --git a/scripts/layouts/.svn/text-base/weekly.js.svn-base b/src/webapp/api/scripts/layouts/.svn/text-base/weekly.js.svn-base similarity index 100% rename from scripts/layouts/.svn/text-base/weekly.js.svn-base rename to src/webapp/api/scripts/layouts/.svn/text-base/weekly.js.svn-base diff --git a/scripts/layouts/layout.js b/src/webapp/api/scripts/layouts/layout.js similarity index 100% rename from scripts/layouts/layout.js rename to src/webapp/api/scripts/layouts/layout.js diff --git a/scripts/layouts/monthly.js b/src/webapp/api/scripts/layouts/monthly.js similarity index 100% rename from scripts/layouts/monthly.js rename to src/webapp/api/scripts/layouts/monthly.js diff --git a/scripts/layouts/nday.js b/src/webapp/api/scripts/layouts/nday.js similarity index 100% rename from scripts/layouts/nday.js rename to src/webapp/api/scripts/layouts/nday.js diff --git a/scripts/layouts/.svn/text-base/nmonth.js.svn-base b/src/webapp/api/scripts/layouts/nmonth.js similarity index 97% rename from scripts/layouts/.svn/text-base/nmonth.js.svn-base rename to src/webapp/api/scripts/layouts/nmonth.js index 0238403..074581f 100644 --- a/scripts/layouts/.svn/text-base/nmonth.js.svn-base +++ b/src/webapp/api/scripts/layouts/nmonth.js @@ -1,259 +1,259 @@ -/** - * NMonthLayout - * @fileoverview - * This is where the monthly layout is defined. The layout is designed to - * resemble the equivalent Google Calendar view. - * @author masont - */ - -Timegrid.NMonthLayout = function(eventSource, params) { - Timegrid.NMonthLayout.superclass.call(this, eventSource, params); - var self = this; - - this.xSize = 7; - this.ySize = 0; // This is re-calculated later based on n - this.n = 3; - this.iterable = true; - - this.configure(params); - // We put title here because it depends on this.n - this.title = this.title || Timegrid.NMonthLayout.l10n.makeTitle(this.n); - - // Initialize our eventSource - this.eventSource = eventSource; - - // Configure our mappers - this.xMapper = function(obj) { - return self.timezoneMapper(obj.time).getDay(); - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - var start = self.timezoneMapper(self.startTime); - // Simply divide by the number of milliseconds in a week - return Math.floor((time - start) / (1000 * 60 * 60 * 24 * 7.0)); - }; - - this.initializeGrid(); -}; -Timegrid.LayoutFactory.registerLayout("n-month", Timegrid.NMonthLayout); - -Timegrid.NMonthLayout.prototype.initializeGrid = function() { - this.startTime = this.eventSource.getEarliestDate() || new Date(); - this.dataStartTime = new Date(this.eventSource.getEarliestDate()) || - new Date(); - this.updateGrid(); -}; -Timegrid.NMonthLayout.prototype.updateGrid = function() { - this.computeDimensions(); - var now = new Date(); - if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } - this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, - this.xMapper, this.yMapper); - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var endpoints = Timegrid.NMonthLayout.getEndpoints(iterator.next()); - this.eventGrid.addAll(endpoints); - } - } -}; - -Timegrid.NMonthLayout.prototype.computeDimensions = function() { - this.startTime = this.computeStartTime(this.startTime); - - // Use a method to compute cell and y-labels (non-trivial). This method - // will also compute ySize based on n, an unfortunate grouping. - this.computeYSize(this.startTime); - this.computeLabels(this.startTime); - - this.endTime = this.computeEndTime(this.startTime); - - // Compute the cell sizes for the grid - this.computeCellSizes(); -}; - -Timegrid.NMonthLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - var labelContainer = doc.createElement("div"); - var colorContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - $(labelContainer).addClass("timegrid-month-labels"); - $(colorContainer).addClass("timegrid-month-colors"); - var i = 0; - var dates = this.cellLabels; - for (y = 0; y < this.ySize; y++) { - for (x = 0; x < this.xSize; x++) { - var endpoints = this.eventGrid.get(x,y); - var events = $.map(endpoints, function(e) { - return e.type == "start" ? e.event : null; - }); - var n = dates[i]; - var m = this.months[i]; - eventContainer.appendChild(this.renderEventList(events, x, y, - n, m)); - colorContainer.appendChild(this.renderCellColor(x, y, m)); - i++; - } - } - $(labelContainer).append($(this.renderMonthLabels())); - return $([eventContainer, labelContainer, colorContainer]); -}; - -Timegrid.NMonthLayout.prototype.renderEventList = function(evts, x, y, n, m) { - var jediv = $("
      ").addClass("timegrid-month-cell"); - var eList = $("
        ").addClass("timegrid-event-list"); - for (var i = 0; i < evts.length; i++) { - eList.append('
      • ' + evts[i].getText() + '
      • '); - } - jediv.append(eList); - jediv.append('' + n + ''); - jediv.css("height", this.yCell).css("width", this.xCell + "px"); - jediv.css("top", this.yCell * y); - jediv.css("left", this.xCell * x + 'px'); - return jediv.get()[0]; // Return the actual DOM element -}; - -Timegrid.NMonthLayout.prototype.renderCellColor = function(x, y, m) { - var jcdiv = $("
        ").addClass("timegrid-month-cell"); - jcdiv.addClass("timegrid-month-cell-" + (m % 2 ? "odd" : "even")); - jcdiv.css("height", this.yCell).css("width", this.xCell + "px"); - jcdiv.css("top", this.yCell * y); - jcdiv.css("left", this.xCell * x + "px"); - - if (this.now) { - var nowX = this.xMapper({ time: this.now }); - var nowY = this.yMapper({ time: this.now }); - if (x == nowX && y == nowY) { - jcdiv.addClass("timegrid-month-cell-now"); - } - } - - return jcdiv.get()[0]; - -}; - -Timegrid.NMonthLayout.prototype.renderMonthLabels = function() { - var self = this; - return $.map(this.monthStarts, function(monthStart) { - var monthString = monthStart.date.getMonthName(); - var mDiv = $('
        ' + monthString + '
        '); - mDiv.addClass('timegrid-month-label'); - mDiv.css('top', self.yCell * monthStart.i + "px"); - var height = monthStart.height * self.yCell; - mDiv.height(height + "px"); - mDiv.children().css('line-height', height + "px"); - return mDiv.get(0); - }); -}; - -Timegrid.NMonthLayout.prototype.highlightNow = function() { - var now = new Date(); - var x = this.xMapper({ time: now }); - var y = this.yMapper({ time: now }); -}; - -Timegrid.NMonthLayout.prototype.getXLabels = function() { - return Date.l10n.dayNames; -}; - -Timegrid.NMonthLayout.prototype.getYLabels = function() { - return this.yLabels; -}; - -Timegrid.NMonthLayout.prototype.goPrevious = function() { - this.dataStartTime.add('M', 0 - this.n); - this.startTime = new Date(this.dataStartTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NMonthLayout.prototype.goNext = function() { - this.dataStartTime.add('M', this.n); - this.startTime = new Date(this.dataStartTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NMonthLayout.prototype.getCurrent = function() { - var start = this.monthStarts[0].date; - var end = this.monthStarts[this.monthStarts.length - 1].date; - if (this.n > 1) { - return Timegrid.NMonthLayout.l10n.makeRange(start, end); - } else { - return Timegrid.NMonthLayout.l10n.makeRange(start); - } -}; - -Timegrid.NMonthLayout.prototype.computeStartTime = function(date) { - if (date) { - var startTime = new Date(date); - startTime.setDate(1); - startTime.setHours(0); - // Roll back to the first day on the grid - while (this.xMapper({ time: startTime }) > 0) { - startTime.setHours(-24); - } - return startTime; - } -}; - -Timegrid.NMonthLayout.prototype.computeEndTime = function(date) { - if (date) { - var endTime = new Date(date); - endTime.add('d', this.ySize * 7); - return endTime; - } - return false; -}; - -Timegrid.NMonthLayout.prototype.computeYSize = function(date) { - var gridStart = { time: new Date(date) }; - var month = this.dataStartTime.getMonth(); - this.ySize = 0; - this.monthStarts = [{ i: this.ySize, date: new Date(this.dataStartTime) }]; - while (this.xMapper(gridStart) > 0 && this.yMapper(gridStart) >= 0) { - gridStart.time.setHours(-24); - } - gridStart.time.add('d', 7); - for (; this.monthStarts.length <= this.n; gridStart.time.add('d', 7)) { - if (gridStart.time.getMonth() != month) { - month = gridStart.time.getMonth(); - var year = gridStart.time.getFullYear(); - this.monthStarts.push({i: this.ySize, date: new Date(gridStart.time)}); - var old = this.monthStarts[this.monthStarts.length - 2]; - old.height = this.ySize - old.i + 1; - } - this.ySize++; - } - this.monthStarts.pop(); -}; - -Timegrid.NMonthLayout.prototype.computeLabels = function(date) { - var gridStart = { time: new Date(date) }; - this.cellLabels = []; - this.months = []; - this.yLabels = []; - - // Iterate through and collect the tasty data - while (this.xMapper(gridStart) < this.xSize && - this.yMapper(gridStart) < this.ySize) { - var d = gridStart.time; - this.cellLabels.push(d.getDate()); - this.months.push(d.getMonth()); - if (d.getDay() == 0) { - this.yLabels.push(d.format(Timegrid.NMonthLayout.l10n.yLabelFormat)); - } - d.setHours(24); - } -}; - -Timegrid.NMonthLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; - +/** + * NMonthLayout + * @fileoverview + * This is where the monthly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + */ + +Timegrid.NMonthLayout = function(eventSource, params) { + Timegrid.NMonthLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 7; + this.ySize = 0; // This is re-calculated later based on n + this.n = 3; + this.iterable = true; + + this.configure(params); + // We put title here because it depends on this.n + this.title = this.title || Timegrid.NMonthLayout.l10n.makeTitle(this.n); + + // Initialize our eventSource + this.eventSource = eventSource; + + // Configure our mappers + this.xMapper = function(obj) { + return self.timezoneMapper(obj.time).getDay(); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + // Simply divide by the number of milliseconds in a week + return Math.floor((time - start) / (1000 * 60 * 60 * 24 * 7.0)); + }; + + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("n-month", Timegrid.NMonthLayout); + +Timegrid.NMonthLayout.prototype.initializeGrid = function() { + this.startTime = this.eventSource.getEarliestDate() || new Date(); + this.dataStartTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + this.updateGrid(); +}; +Timegrid.NMonthLayout.prototype.updateGrid = function() { + this.computeDimensions(); + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var endpoints = Timegrid.NMonthLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(endpoints); + } + } +}; + +Timegrid.NMonthLayout.prototype.computeDimensions = function() { + this.startTime = this.computeStartTime(this.startTime); + + // Use a method to compute cell and y-labels (non-trivial). This method + // will also compute ySize based on n, an unfortunate grouping. + this.computeYSize(this.startTime); + this.computeLabels(this.startTime); + + this.endTime = this.computeEndTime(this.startTime); + + // Compute the cell sizes for the grid + this.computeCellSizes(); +}; + +Timegrid.NMonthLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + var labelContainer = doc.createElement("div"); + var colorContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + $(labelContainer).addClass("timegrid-month-labels"); + $(colorContainer).addClass("timegrid-month-colors"); + var i = 0; + var dates = this.cellLabels; + for (y = 0; y < this.ySize; y++) { + for (x = 0; x < this.xSize; x++) { + var endpoints = this.eventGrid.get(x,y); + var events = $.map(endpoints, function(e) { + return e.type == "start" ? e.event : null; + }); + var n = dates[i]; + var m = this.months[i]; + eventContainer.appendChild(this.renderEventList(events, x, y, + n, m)); + colorContainer.appendChild(this.renderCellColor(x, y, m)); + i++; + } + } + $(labelContainer).append($(this.renderMonthLabels())); + return $([eventContainer, labelContainer, colorContainer]); +}; + +Timegrid.NMonthLayout.prototype.renderEventList = function(evts, x, y, n, m) { + var jediv = $("
        ").addClass("timegrid-month-cell"); + var eList = $("
          ").addClass("timegrid-event-list"); + for (var i = 0; i < evts.length; i++) { + eList.append('
        • ' + evts[i].getText() + '
        • '); + } + jediv.append(eList); + jediv.append('' + n + ''); + jediv.css("height", this.yCell).css("width", this.xCell + "px"); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.NMonthLayout.prototype.renderCellColor = function(x, y, m) { + var jcdiv = $("
          ").addClass("timegrid-month-cell"); + jcdiv.addClass("timegrid-month-cell-" + (m % 2 ? "odd" : "even")); + jcdiv.css("height", this.yCell).css("width", this.xCell + "px"); + jcdiv.css("top", this.yCell * y); + jcdiv.css("left", this.xCell * x + "px"); + + if (this.now) { + var nowX = this.xMapper({ time: this.now }); + var nowY = this.yMapper({ time: this.now }); + if (x == nowX && y == nowY) { + jcdiv.addClass("timegrid-month-cell-now"); + } + } + + return jcdiv.get()[0]; + +}; + +Timegrid.NMonthLayout.prototype.renderMonthLabels = function() { + var self = this; + return $.map(this.monthStarts, function(monthStart) { + var monthString = monthStart.date.getMonthName(); + var mDiv = $('
          ' + monthString + '
          '); + mDiv.addClass('timegrid-month-label'); + mDiv.css('top', self.yCell * monthStart.i + "px"); + var height = monthStart.height * self.yCell; + mDiv.height(height + "px"); + mDiv.children().css('line-height', height + "px"); + return mDiv.get(0); + }); +}; + +Timegrid.NMonthLayout.prototype.highlightNow = function() { + var now = new Date(); + var x = this.xMapper({ time: now }); + var y = this.yMapper({ time: now }); +}; + +Timegrid.NMonthLayout.prototype.getXLabels = function() { + return Date.l10n.dayNames; +}; + +Timegrid.NMonthLayout.prototype.getYLabels = function() { + return this.yLabels; +}; + +Timegrid.NMonthLayout.prototype.goPrevious = function() { + this.dataStartTime.add('M', 0 - this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.goNext = function() { + this.dataStartTime.add('M', this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.getCurrent = function() { + var start = this.monthStarts[0].date; + var end = this.monthStarts[this.monthStarts.length - 1].date; + if (this.n > 1) { + return Timegrid.NMonthLayout.l10n.makeRange(start, end); + } else { + return Timegrid.NMonthLayout.l10n.makeRange(start); + } +}; + +Timegrid.NMonthLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.setDate(1); + startTime.setHours(0); + // Roll back to the first day on the grid + while (this.xMapper({ time: startTime }) > 0) { + startTime.setHours(-24); + } + return startTime; + } +}; + +Timegrid.NMonthLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.ySize * 7); + return endTime; + } + return false; +}; + +Timegrid.NMonthLayout.prototype.computeYSize = function(date) { + var gridStart = { time: new Date(date) }; + var month = this.dataStartTime.getMonth(); + this.ySize = 0; + this.monthStarts = [{ i: this.ySize, date: new Date(this.dataStartTime) }]; + while (this.xMapper(gridStart) > 0 && this.yMapper(gridStart) >= 0) { + gridStart.time.setHours(-24); + } + gridStart.time.add('d', 7); + for (; this.monthStarts.length <= this.n; gridStart.time.add('d', 7)) { + if (gridStart.time.getMonth() != month) { + month = gridStart.time.getMonth(); + var year = gridStart.time.getFullYear(); + this.monthStarts.push({i: this.ySize, date: new Date(gridStart.time)}); + var old = this.monthStarts[this.monthStarts.length - 2]; + old.height = this.ySize - old.i + 1; + } + this.ySize++; + } + this.monthStarts.pop(); +}; + +Timegrid.NMonthLayout.prototype.computeLabels = function(date) { + var gridStart = { time: new Date(date) }; + this.cellLabels = []; + this.months = []; + this.yLabels = []; + + // Iterate through and collect the tasty data + while (this.xMapper(gridStart) < this.xSize && + this.yMapper(gridStart) < this.ySize) { + var d = gridStart.time; + this.cellLabels.push(d.getDate()); + this.months.push(d.getMonth()); + if (d.getDay() == 0) { + this.yLabels.push(d.format(Timegrid.NMonthLayout.l10n.yLabelFormat)); + } + d.setHours(24); + } +}; + +Timegrid.NMonthLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/scripts/layouts/.svn/text-base/property.js.svn-base b/src/webapp/api/scripts/layouts/property.js similarity index 97% rename from scripts/layouts/.svn/text-base/property.js.svn-base rename to src/webapp/api/scripts/layouts/property.js index 1488fcf..72307b8 100644 --- a/scripts/layouts/.svn/text-base/property.js.svn-base +++ b/src/webapp/api/scripts/layouts/property.js @@ -1,150 +1,150 @@ -/** - * @name Timegrid.PropertyLayout - * @author masont - */ - -/** - * PropertyLayout is a subclass of Layout that provides Timegrid with layouts - * that place events into rows and columns based on arbitrary properties, in - * addition to temporal values (hour, day, week, etc.). - * - * @constructor - */ -Timegrid.PropertyLayout = function(eventSource, params) { - Timegrid.PropertyLayout.superclass.call(this, eventSource, params); - var self = this; - - this.xSize = 0; - this.ySize = 0; - this.iterable = false; - this.title = Timegrid.PropertyLayout.l10n.makeTitle(); - this.property = "title"; - - this.xMapper = function(obj) { - return self.values.indexOf(obj.event.getProperty(self.property)); - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; - }; - - this.configure(params); - - this.dayEnd = this.dayend || 24; - this.dayStart = this.daystart || 0; - this.ySize = this.dayEnd - this.dayStart; - - this.eventSource = eventSource; - this.initializeGrid(); -}; -Timegrid.LayoutFactory.registerLayout("property", Timegrid.PropertyLayout); - -Timegrid.PropertyLayout.prototype.initializeGrid = function() { - this.startTime = new Date(this.eventSource.getEarliestDate()) || new Date(); - this.endTime = new Date(this.eventSource.getLatestDate()) || new Date(); - this.values = new DStructs.Array(); - this.updateGrid(); -}; - -Timegrid.PropertyLayout.prototype.updateGrid = function() { - this.computeDimensions(); - this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, - this.xMapper, this.yMapper); - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var eps = Timegrid.PropertyLayout.getEndpoints(iterator.next()); - this.eventGrid.addAll(eps); - } - } -}; - -Timegrid.PropertyLayout.prototype.computeDimensions = function() { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - this.values.clear(); - while (iterator.hasNext()) { - this.values.push(iterator.next().getProperty(this.property)); - } - this.values = this.values.uniq(); - this.xSize = this.values.length; -}; - -Timegrid.PropertyLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - var currentEvents = {}; - var currentCount = 0; - for (x = 0; x < this.xSize; x++) { - for (y = 0; y < this.ySize; y++) { - var endpoints = this.eventGrid.get(x,y).sort(function(a, b) { - return a.time - b.time; - }); - for (var i = 0; i < endpoints.length; i++) { - var endpoint = endpoints[i]; - if (endpoint.type == "start") { - // Render the event - var eventDiv = this.renderEvent(endpoint.event, x, y); - eventContainer.appendChild(eventDiv); - // Push the event div onto the current events set - currentEvents[endpoint.event.getID()] = eventDiv; - currentCount++; - // Adjust widths and offsets as necessary - var hIndex = 0; - for (id in currentEvents) { - var eDiv = currentEvents[id]; - var newWidth = this.xCell / currentCount; - $(eDiv).css("width", newWidth + "px"); - $(eDiv).css("left", this.xCell * x + newWidth * hIndex + "px"); - hIndex++; - } - } else if (endpoint.type == "end") { - // Pop event from current events set - delete currentEvents[endpoint.event.getID()]; - currentCount--; - } - } - } - } - return eventContainer; -}; - -Timegrid.PropertyLayout.prototype.renderEvent = function(evt, x, y) { - var jediv = this.mini ? $("
          ") : - $("
          " + evt.getText() + "
          "); - var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); - jediv.addClass("timegrid-event"); - if (!this.mini) { - jediv.addClass('timegrid-rounded-shadow'); - } - jediv.css("height", this.yCell * length); - jediv.css("top", this.yCell * y); - jediv.css("left", this.xCell * x + 'px'); - if (evt.getColor()) { jediv.css('background-color', evt.getColor()); } - if (evt.getTextColor()) { jediv.css('color', evt.getTextColor()); } - return jediv.get()[0]; // Return the actual DOM element -}; - -Timegrid.PropertyLayout.prototype.getXLabels = function() { - return this.values; -}; - -Timegrid.PropertyLayout.prototype.getYLabels = function() { - var date = (new Date()).clearTime(); - var labels = []; - for (var i = +this.dayStart; i < +this.dayEnd; i++) { - date.setHours(i); - labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); - } - return labels; -}; - -Timegrid.PropertyLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; +/** + * @name Timegrid.PropertyLayout + * @author masont + */ + +/** + * PropertyLayout is a subclass of Layout that provides Timegrid with layouts + * that place events into rows and columns based on arbitrary properties, in + * addition to temporal values (hour, day, week, etc.). + * + * @constructor + */ +Timegrid.PropertyLayout = function(eventSource, params) { + Timegrid.PropertyLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 0; + this.ySize = 0; + this.iterable = false; + this.title = Timegrid.PropertyLayout.l10n.makeTitle(); + this.property = "title"; + + this.xMapper = function(obj) { + return self.values.indexOf(obj.event.getProperty(self.property)); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + + this.eventSource = eventSource; + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("property", Timegrid.PropertyLayout); + +Timegrid.PropertyLayout.prototype.initializeGrid = function() { + this.startTime = new Date(this.eventSource.getEarliestDate()) || new Date(); + this.endTime = new Date(this.eventSource.getLatestDate()) || new Date(); + this.values = new DStructs.Array(); + this.updateGrid(); +}; + +Timegrid.PropertyLayout.prototype.updateGrid = function() { + this.computeDimensions(); + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var eps = Timegrid.PropertyLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(eps); + } + } +}; + +Timegrid.PropertyLayout.prototype.computeDimensions = function() { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + this.values.clear(); + while (iterator.hasNext()) { + this.values.push(iterator.next().getProperty(this.property)); + } + this.values = this.values.uniq(); + this.xSize = this.values.length; +}; + +Timegrid.PropertyLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (x = 0; x < this.xSize; x++) { + for (y = 0; y < this.ySize; y++) { + var endpoints = this.eventGrid.get(x,y).sort(function(a, b) { + return a.time - b.time; + }); + for (var i = 0; i < endpoints.length; i++) { + var endpoint = endpoints[i]; + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", this.xCell * x + newWidth * hIndex + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + } + } + return eventContainer; +}; + +Timegrid.PropertyLayout.prototype.renderEvent = function(evt, x, y) { + var jediv = this.mini ? $("
          ") : + $("
          " + evt.getText() + "
          "); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + jediv.addClass("timegrid-event"); + if (!this.mini) { + jediv.addClass('timegrid-rounded-shadow'); + } + jediv.css("height", this.yCell * length); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + if (evt.getColor()) { jediv.css('background-color', evt.getColor()); } + if (evt.getTextColor()) { jediv.css('color', evt.getTextColor()); } + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.PropertyLayout.prototype.getXLabels = function() { + return this.values; +}; + +Timegrid.PropertyLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); + } + return labels; +}; + +Timegrid.PropertyLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; diff --git a/scripts/layouts/weekly.js b/src/webapp/api/scripts/layouts/weekly.js similarity index 100% rename from scripts/layouts/weekly.js rename to src/webapp/api/scripts/layouts/weekly.js diff --git a/scripts/.svn/text-base/listeners.js.svn-base b/src/webapp/api/scripts/listeners.js similarity index 96% rename from scripts/.svn/text-base/listeners.js.svn-base rename to src/webapp/api/scripts/listeners.js index f1d161d..0c63df8 100644 --- a/scripts/.svn/text-base/listeners.js.svn-base +++ b/src/webapp/api/scripts/listeners.js @@ -1,29 +1,29 @@ -Timegrid.ListenerAware = function() { - this._listeners = []; -}; - -Timegrid.ListenerAware.prototype.addListener = function(listener) { - this._listeners.push(listener); -}; - -Timegrid.ListenerAware.prototype.removeListener = function(listener) { - for (var i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] == listener) { - this._listeners.splice(i, 1); - break; - } - } -}; - -Timegrid.ListenerAware.prototype._fire = function(handlerName, args) { - for (var i = 0; i < this._listeners.length; i++) { - var listener = this._listeners[i]; - if (handlerName in listener) { - try { - listener[handlerName].apply(listener, args); - } catch (e) { - Timegrid.Debug.exception(e); - } - } - } +Timegrid.ListenerAware = function() { + this._listeners = []; +}; + +Timegrid.ListenerAware.prototype.addListener = function(listener) { + this._listeners.push(listener); +}; + +Timegrid.ListenerAware.prototype.removeListener = function(listener) { + for (var i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] == listener) { + this._listeners.splice(i, 1); + break; + } + } +}; + +Timegrid.ListenerAware.prototype._fire = function(handlerName, args) { + for (var i = 0; i < this._listeners.length; i++) { + var listener = this._listeners[i]; + if (handlerName in listener) { + try { + listener[handlerName].apply(listener, args); + } catch (e) { + Timegrid.Debug.exception(e); + } + } + } }; \ No newline at end of file diff --git a/scripts/sources/.svn/all-wcprops b/src/webapp/api/scripts/sources/.svn/all-wcprops similarity index 100% rename from scripts/sources/.svn/all-wcprops rename to src/webapp/api/scripts/sources/.svn/all-wcprops diff --git a/scripts/sources/.svn/entries b/src/webapp/api/scripts/sources/.svn/entries similarity index 100% rename from scripts/sources/.svn/entries rename to src/webapp/api/scripts/sources/.svn/entries diff --git a/scripts/sources/.svn/text-base/default.js.svn-base b/src/webapp/api/scripts/sources/.svn/text-base/default.js.svn-base similarity index 100% rename from scripts/sources/.svn/text-base/default.js.svn-base rename to src/webapp/api/scripts/sources/.svn/text-base/default.js.svn-base diff --git a/scripts/sources/.svn/text-base/recurring.js.svn-base b/src/webapp/api/scripts/sources/.svn/text-base/recurring.js.svn-base similarity index 97% rename from scripts/sources/.svn/text-base/recurring.js.svn-base rename to src/webapp/api/scripts/sources/.svn/text-base/recurring.js.svn-base index 8f456ff..d881baf 100644 --- a/scripts/sources/.svn/text-base/recurring.js.svn-base +++ b/src/webapp/api/scripts/sources/.svn/text-base/recurring.js.svn-base @@ -1,136 +1,136 @@ -/** - * @name Timegrid.RecurringEventSource - * @author masont - */ - -/** - * A type of EventSource that allows the creation and display of recurring - * events that are not tied to a specific date, e.g. 8am on MWF. - * - * @constructor - */ -Timegrid.RecurringEventSource = function() { - Timegrid.RecurringEventSource.superclass.call(this); - - /* - * The actual array containing event prototypes is kept private, and only - * accessed/modified through priviledged methods created here, in the - * constructor. - */ - var eventPrototypes = new DStructs.Array(); - - //========================= Privileged Methods ==========================// - - /** Sets this source's event prototypes to the given prototypes */ - this.setEventPrototypes = function(a) { - eventPrototypes.clear(); - this.addAllEventPrototypes(a); - }; - - /** Adds the given event prototype to this event source */ - this.addEventPrototype = function(eventPrototype) { - eventPrototypes.push(eventPrototype); - this._fire("onAddMany", []); - }; - - /** Adds all of the event prototypes from the given array */ - this.addAllEventPrototypes = function(a) { - eventPrototypes.addAll(a); - this._fire("onAddMany", []); - }; - - /** Removes the given event prototype from this source's prototypes */ - this.removeEventPrototype = function(eventPrototype) { - return eventPrototypes.remove(eventPrototype); - }; - - /** Removes all of the event prototypes from this source */ - this.clearEventPrototypes = function() { - eventPrototypes.clear(); - this._fire("onClear", []); - }; - - /** Generates events from event prototypes */ - this.generateEvents = function(startDate, endDate) { - var result = new DStructs.Array(); - eventPrototypes.each(function(ep) { - result.addAll(ep.generateEvents(startDate, endDate)); - }); - return result; - }; -}; -$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); - -Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { - -}; -Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { - -}; -Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { - return this.generateEvents(startDate, endDate).iterator(); -}; -Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { - return (new Date()).clearTime().setDay(0); -}; -Timegrid.RecurringEventSource.prototype.getLatestDate = function() { - return (new Date()).clearTime().setDay(7); -}; - -Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, - text, description, image, link, icon, color, textColor) { - var id = "e" + Math.floor(Math.random() * 1000000); - var days = new DStructs.Array(); days.addAll(dayArray); - - this.getDays = function() { return days; }; - this.getStart = function() { return start; }; - this.getEnd = function() { return end; }; - - this.getID = function() { return id; } - this.getText = function() { - return SimileAjax.HTML.deEntify(text); - }; - this.getDescription = function() { - return SimileAjax.HTML.deEntify(description); - }; - this.getImage = function() { - return (image != null && image != "") ? image : null; - }; - this.getLink = function() { - return (link != null && link != "") ? link : null; - }; - this.getIcon = function() { - return (icon != null && icon != "") ? icon : null; - }; - this.getColor = function() { - return (color != null && color != "") ? color : null; - }; - this.getTextColor = function() { - return (textColor != null && textColor != "") ? textColor : null; - } - this.generateFrom = function(date) { - if (!this.getDays().contains(date.getDay())) { return false; } - var startTime = new Date(this.getStart()); - var endTime = new Date(this.getEnd()); - startTime.setDate(date.getDate()); - startTime.setMonth(date.getMonth()); - startTime.setFullYear(date.getFullYear()); - endTime.setDate(date.getDate()); - endTime.setMonth(date.getMonth()); - endTime.setFullYear(date.getFullYear()); - return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, - null, false, text, description, image, link, icon, color, - textColor); - }; -}; - -Timegrid.RecurringEventSource.EventPrototype.prototype = { - generateEvents: function(start, end) { - var events = new DStructs.Array(); - for (var date = new Date(start); date < end; date.add('d', 1)) { - var event = this.generateFrom(date); - if (event) { events.push(event); } - } - return events; - } -}; +/** + * @name Timegrid.RecurringEventSource + * @author masont + */ + +/** + * A type of EventSource that allows the creation and display of recurring + * events that are not tied to a specific date, e.g. 8am on MWF. + * + * @constructor + */ +Timegrid.RecurringEventSource = function() { + Timegrid.RecurringEventSource.superclass.call(this); + + /* + * The actual array containing event prototypes is kept private, and only + * accessed/modified through priviledged methods created here, in the + * constructor. + */ + var eventPrototypes = new DStructs.Array(); + + //========================= Privileged Methods ==========================// + + /** Sets this source's event prototypes to the given prototypes */ + this.setEventPrototypes = function(a) { + eventPrototypes.clear(); + this.addAllEventPrototypes(a); + }; + + /** Adds the given event prototype to this event source */ + this.addEventPrototype = function(eventPrototype) { + eventPrototypes.push(eventPrototype); + this._fire("onAddMany", []); + }; + + /** Adds all of the event prototypes from the given array */ + this.addAllEventPrototypes = function(a) { + eventPrototypes.addAll(a); + this._fire("onAddMany", []); + }; + + /** Removes the given event prototype from this source's prototypes */ + this.removeEventPrototype = function(eventPrototype) { + return eventPrototypes.remove(eventPrototype); + }; + + /** Removes all of the event prototypes from this source */ + this.clearEventPrototypes = function() { + eventPrototypes.clear(); + this._fire("onClear", []); + }; + + /** Generates events from event prototypes */ + this.generateEvents = function(startDate, endDate) { + var result = new DStructs.Array(); + eventPrototypes.each(function(ep) { + result.addAll(ep.generateEvents(startDate, endDate)); + }); + return result; + }; +}; +$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); + +Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { + +}; +Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { + +}; +Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { + return this.generateEvents(startDate, endDate).iterator(); +}; +Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { + return (new Date()).clearTime().setDay(0); +}; +Timegrid.RecurringEventSource.prototype.getLatestDate = function() { + return (new Date()).clearTime().setDay(7); +}; + +Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, + text, description, image, link, icon, color, textColor) { + var id = "e" + Math.floor(Math.random() * 1000000); + var days = new DStructs.Array(); days.addAll(dayArray); + + this.getDays = function() { return days; }; + this.getStart = function() { return start; }; + this.getEnd = function() { return end; }; + + this.getID = function() { return id; } + this.getText = function() { + return SimileAjax.HTML.deEntify(text); + }; + this.getDescription = function() { + return SimileAjax.HTML.deEntify(description); + }; + this.getImage = function() { + return (image != null && image != "") ? image : null; + }; + this.getLink = function() { + return (link != null && link != "") ? link : null; + }; + this.getIcon = function() { + return (icon != null && icon != "") ? icon : null; + }; + this.getColor = function() { + return (color != null && color != "") ? color : null; + }; + this.getTextColor = function() { + return (textColor != null && textColor != "") ? textColor : null; + } + this.generateFrom = function(date) { + if (!this.getDays().contains(date.getDay())) { return false; } + var startTime = new Date(this.getStart()); + var endTime = new Date(this.getEnd()); + startTime.setDate(date.getDate()); + startTime.setMonth(date.getMonth()); + startTime.setFullYear(date.getFullYear()); + endTime.setDate(date.getDate()); + endTime.setMonth(date.getMonth()); + endTime.setFullYear(date.getFullYear()); + return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, + null, false, text, description, image, link, icon, color, + textColor); + }; +}; + +Timegrid.RecurringEventSource.EventPrototype.prototype = { + generateEvents: function(start, end) { + var events = new DStructs.Array(); + for (var date = new Date(start); date < end; date.add('d', 1)) { + var event = this.generateFrom(date); + if (event) { events.push(event); } + } + return events; + } +}; diff --git a/scripts/sources/default.js b/src/webapp/api/scripts/sources/default.js similarity index 100% rename from scripts/sources/default.js rename to src/webapp/api/scripts/sources/default.js diff --git a/scripts/sources/recurring.js b/src/webapp/api/scripts/sources/recurring.js similarity index 100% rename from scripts/sources/recurring.js rename to src/webapp/api/scripts/sources/recurring.js diff --git a/scripts/themes.js b/src/webapp/api/scripts/themes.js similarity index 100% rename from scripts/themes.js rename to src/webapp/api/scripts/themes.js diff --git a/scripts/timegrid.js b/src/webapp/api/scripts/timegrid.js similarity index 100% rename from scripts/timegrid.js rename to src/webapp/api/scripts/timegrid.js diff --git a/scripts/util/.svn/all-wcprops b/src/webapp/api/scripts/util/.svn/all-wcprops similarity index 100% rename from scripts/util/.svn/all-wcprops rename to src/webapp/api/scripts/util/.svn/all-wcprops diff --git a/scripts/util/.svn/entries b/src/webapp/api/scripts/util/.svn/entries similarity index 100% rename from scripts/util/.svn/entries rename to src/webapp/api/scripts/util/.svn/entries diff --git a/scripts/util/.svn/text-base/date.js.svn-base b/src/webapp/api/scripts/util/.svn/text-base/date.js.svn-base similarity index 100% rename from scripts/util/.svn/text-base/date.js.svn-base rename to src/webapp/api/scripts/util/.svn/text-base/date.js.svn-base diff --git a/scripts/util/.svn/text-base/debug.js.svn-base b/src/webapp/api/scripts/util/.svn/text-base/debug.js.svn-base similarity index 100% rename from scripts/util/.svn/text-base/debug.js.svn-base rename to src/webapp/api/scripts/util/.svn/text-base/debug.js.svn-base diff --git a/scripts/util/.svn/text-base/excanvas.pack.js.svn-base b/src/webapp/api/scripts/util/.svn/text-base/excanvas.pack.js.svn-base similarity index 100% rename from scripts/util/.svn/text-base/excanvas.pack.js.svn-base rename to src/webapp/api/scripts/util/.svn/text-base/excanvas.pack.js.svn-base diff --git a/scripts/util/jquery.corner.js b/src/webapp/api/scripts/util/.svn/text-base/jquery.corner.js.svn-base similarity index 100% rename from scripts/util/jquery.corner.js rename to src/webapp/api/scripts/util/.svn/text-base/jquery.corner.js.svn-base diff --git a/scripts/util/.svn/text-base/jquery.dimensions.js.svn-base b/src/webapp/api/scripts/util/.svn/text-base/jquery.dimensions.js.svn-base similarity index 100% rename from scripts/util/.svn/text-base/jquery.dimensions.js.svn-base rename to src/webapp/api/scripts/util/.svn/text-base/jquery.dimensions.js.svn-base diff --git a/scripts/util/jquery.prettybox.js b/src/webapp/api/scripts/util/.svn/text-base/jquery.prettybox.js.svn-base similarity index 100% rename from scripts/util/jquery.prettybox.js rename to src/webapp/api/scripts/util/.svn/text-base/jquery.prettybox.js.svn-base diff --git a/scripts/util/.svn/text-base/jquery.simile.js.svn-base b/src/webapp/api/scripts/util/.svn/text-base/jquery.simile.js.svn-base similarity index 97% rename from scripts/util/.svn/text-base/jquery.simile.js.svn-base rename to src/webapp/api/scripts/util/.svn/text-base/jquery.simile.js.svn-base index 19c196c..cf0c4e5 100644 --- a/scripts/util/.svn/text-base/jquery.simile.js.svn-base +++ b/src/webapp/api/scripts/util/.svn/text-base/jquery.simile.js.svn-base @@ -1,118 +1,118 @@ -/** - * This code implements the Simile jQuery plugin, which in turns simply - * provides several convenient and useful functions for manipulating the - * DOM, etc. - * @overview Simile jQuery plugin - */ - -jQuery.extend({ - /** - * Simply capitalizes the first letter of each word in its argument. - */ - capitalize: function(s) { - return s.charAt(0).toUpperCase() + s.substring(1).toLowerCase(); - }, - /** - * Provides a basic mechanism for Javascript inheritance. - */ - inherit: function(subclass, superclass) { - function Dummy() {}; - Dummy.prototype = superclass.prototype; - subclass.prototype = new Dummy(); - subclass.prototype.constructor = subclass; - subclass.superclass = superclass; - subclass.superproto = superclass.prototype; - }, - /** - * Recursively deep-copies the given object. - */ - clone: function(obj, deep) { - if (deep == null) { deep = true; } - var objectClone = new obj.constructor(); - for (var property in obj) { - if (!deep) { - objectClone[property] = obj[property]; - } else if (typeof obj[property] == 'object') { - objectClone[property] = obj[property].clone(deep); - } else { - objectClone[property] = obj[property]; - } - } - return objectClone; - }, - /** - * Returns the width of the scrollbar. - */ - scrollWidth: function() { - var scr = null; - var inn = null; - var wNoScroll = 0; - var wScroll = 0; - - // Outer scrolling div - scr = document.createElement('div'); - scr.style.position = 'absolute'; - scr.style.top = '-1000px'; - scr.style.left = '-1000px'; - scr.style.width = '100px'; - scr.style.height = '50px'; - // Start with no scrollbar - scr.style.overflow = 'hidden'; - - // Inner content div - inn = document.createElement('div'); - inn.style.width = '100%'; - inn.style.height = '200px'; - - // Put the inner div in the scrolling div - scr.appendChild(inn); - // Append the scrolling div to the doc - document.body.appendChild(scr); - - // Width of the inner div sans scrollbar - wNoScroll = inn.offsetWidth; - // Add the scrollbar - scr.style.overflow = 'auto'; - // Width of the inner div width scrollbar - wScroll = inn.offsetWidth; - - // Remove the scrolling div from the doc - document.body.removeChild( - document.body.lastChild); - - // Pixel width of the scroller, with an awful, awful hack - // FIXME: Fix hardcoded scrollwidth - return (wNoScroll - wScroll) || 17; - } -}); - -jQuery.fn.extend({ - /** - * The attrs method extends jQuery to allow for aggregating attributes of - * all matched elements in a $('..') expression into a nice hash. It also - * supports only returning attributes within a certain namespace, e.g. - * ex:role, when provided with the namespace prefix as an argument. - */ - attrs: function(ns) { - // Caching the compiled regex speeds this up a bit - if (!this.__namespaceRegexps) { - this.__namespaceRegexps = {}; - } - var regexp = this.__namespaceRegexps[ns]; - if (!regexp) { - this.__namespaceRegexps[ns] = regexp = - ns ? eval("/^" + ns + ":(.+)/") : /^([^:]*)$/; - } - var result = {}; - this.each(function() { - // Within this loop, 'this' refers to each matched DOM element - var atts = this.attributes; - var l = atts.length; - for (var i = 0; i < l; i++) { - var m = atts[i].name.match(regexp); - if (m) { result[m[1]] = atts[i].value; } - } - }); - return result; - } -}); +/** + * This code implements the Simile jQuery plugin, which in turns simply + * provides several convenient and useful functions for manipulating the + * DOM, etc. + * @overview Simile jQuery plugin + */ + +jQuery.extend({ + /** + * Simply capitalizes the first letter of each word in its argument. + */ + capitalize: function(s) { + return s.charAt(0).toUpperCase() + s.substring(1).toLowerCase(); + }, + /** + * Provides a basic mechanism for Javascript inheritance. + */ + inherit: function(subclass, superclass) { + function Dummy() {}; + Dummy.prototype = superclass.prototype; + subclass.prototype = new Dummy(); + subclass.prototype.constructor = subclass; + subclass.superclass = superclass; + subclass.superproto = superclass.prototype; + }, + /** + * Recursively deep-copies the given object. + */ + clone: function(obj, deep) { + if (deep == null) { deep = true; } + var objectClone = new obj.constructor(); + for (var property in obj) { + if (!deep) { + objectClone[property] = obj[property]; + } else if (typeof obj[property] == 'object') { + objectClone[property] = obj[property].clone(deep); + } else { + objectClone[property] = obj[property]; + } + } + return objectClone; + }, + /** + * Returns the width of the scrollbar. + */ + scrollWidth: function() { + var scr = null; + var inn = null; + var wNoScroll = 0; + var wScroll = 0; + + // Outer scrolling div + scr = document.createElement('div'); + scr.style.position = 'absolute'; + scr.style.top = '-1000px'; + scr.style.left = '-1000px'; + scr.style.width = '100px'; + scr.style.height = '50px'; + // Start with no scrollbar + scr.style.overflow = 'hidden'; + + // Inner content div + inn = document.createElement('div'); + inn.style.width = '100%'; + inn.style.height = '200px'; + + // Put the inner div in the scrolling div + scr.appendChild(inn); + // Append the scrolling div to the doc + document.body.appendChild(scr); + + // Width of the inner div sans scrollbar + wNoScroll = inn.offsetWidth; + // Add the scrollbar + scr.style.overflow = 'auto'; + // Width of the inner div width scrollbar + wScroll = inn.offsetWidth; + + // Remove the scrolling div from the doc + document.body.removeChild( + document.body.lastChild); + + // Pixel width of the scroller, with an awful, awful hack + // FIXME: Fix hardcoded scrollwidth + return (wNoScroll - wScroll) || 17; + } +}); + +jQuery.fn.extend({ + /** + * The attrs method extends jQuery to allow for aggregating attributes of + * all matched elements in a $('..') expression into a nice hash. It also + * supports only returning attributes within a certain namespace, e.g. + * ex:role, when provided with the namespace prefix as an argument. + */ + attrs: function(ns) { + // Caching the compiled regex speeds this up a bit + if (!this.__namespaceRegexps) { + this.__namespaceRegexps = {}; + } + var regexp = this.__namespaceRegexps[ns]; + if (!regexp) { + this.__namespaceRegexps[ns] = regexp = + ns ? eval("/^" + ns + ":(.+)/") : /^([^:]*)$/; + } + var result = {}; + this.each(function() { + // Within this loop, 'this' refers to each matched DOM element + var atts = this.attributes; + var l = atts.length; + for (var i = 0; i < l; i++) { + var m = atts[i].name.match(regexp); + if (m) { result[m[1]] = atts[i].value; } + } + }); + return result; + } +}); diff --git a/scripts/util/.svn/text-base/util.js.svn-base b/src/webapp/api/scripts/util/.svn/text-base/util.js.svn-base similarity index 97% rename from scripts/util/.svn/text-base/util.js.svn-base rename to src/webapp/api/scripts/util/.svn/text-base/util.js.svn-base index 4c319c7..f325e96 100644 --- a/scripts/util/.svn/text-base/util.js.svn-base +++ b/src/webapp/api/scripts/util/.svn/text-base/util.js.svn-base @@ -1,47 +1,47 @@ -/****************************************************************************** - * Utility Functions - *****************************************************************************/ - -Timegrid.abstract = function(name) { - return function() { - throw "A " + name + " method has not been implemented!"; - return; - }; -}; - -SimileAjax.DateTime.Interval = function(ms) { - // Conversion factors as varants to eliminate all the multiplication - var SECONDS_CF = 1000; - var MINUTES_CF = 60000; - var HOURS_CF = 3600000; - var DAYS_CF = 86400000; - var WEEKS_CF = 604800000; - var FORTNIGHTS_CF = 1209600000; - var MONTHS_CF = 2592000000; - var QUARTERS_CF = 7776000000; - var YEARS_CF = 31557600000; - var DECADES_CF = 315576000000; - var CENTURIES_CF = 3155760000000; - - this.milliseconds = Math.abs(ms); - this.seconds = Math.round(this.milliseconds / SECONDS_CF); - this.minutes = Math.round(this.milliseconds / MINUTES_CF); - this.hours = Math.round(this.milliseconds / HOURS_CF); - this.days = Math.floor(this.milliseconds / DAYS_CF); - this.weeks = Math.round(this.milliseconds / WEEKS_CF); - this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); - this.months = Math.round(this.milliseconds / MONTHS_CF); - // rounding errors! - this.quarters = Math.round(this.milliseconds / QUARTERS_CF); - // rounding errors! - this.years = Math.round(this.milliseconds / YEARS_CF); - // rounding errors! - this.decades = Math.round(this.milliseconds / DECADES_CF); - // rounding errors! - this.centuries = Math.round(this.milliseconds / CENTURIES_CF); - // rounding errors! -}; - -SimileAjax.DateTime.Interval.prototype.toString = function() { - return this.milliseconds.toString(); -}; +/****************************************************************************** + * Utility Functions + *****************************************************************************/ + +Timegrid.abstract = function(name) { + return function() { + throw "A " + name + " method has not been implemented!"; + return; + }; +}; + +SimileAjax.DateTime.Interval = function(ms) { + // Conversion factors as varants to eliminate all the multiplication + var SECONDS_CF = 1000; + var MINUTES_CF = 60000; + var HOURS_CF = 3600000; + var DAYS_CF = 86400000; + var WEEKS_CF = 604800000; + var FORTNIGHTS_CF = 1209600000; + var MONTHS_CF = 2592000000; + var QUARTERS_CF = 7776000000; + var YEARS_CF = 31557600000; + var DECADES_CF = 315576000000; + var CENTURIES_CF = 3155760000000; + + this.milliseconds = Math.abs(ms); + this.seconds = Math.round(this.milliseconds / SECONDS_CF); + this.minutes = Math.round(this.milliseconds / MINUTES_CF); + this.hours = Math.round(this.milliseconds / HOURS_CF); + this.days = Math.floor(this.milliseconds / DAYS_CF); + this.weeks = Math.round(this.milliseconds / WEEKS_CF); + this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); + this.months = Math.round(this.milliseconds / MONTHS_CF); + // rounding errors! + this.quarters = Math.round(this.milliseconds / QUARTERS_CF); + // rounding errors! + this.years = Math.round(this.milliseconds / YEARS_CF); + // rounding errors! + this.decades = Math.round(this.milliseconds / DECADES_CF); + // rounding errors! + this.centuries = Math.round(this.milliseconds / CENTURIES_CF); + // rounding errors! +}; + +SimileAjax.DateTime.Interval.prototype.toString = function() { + return this.milliseconds.toString(); +}; diff --git a/scripts/util/date.js b/src/webapp/api/scripts/util/date.js similarity index 100% rename from scripts/util/date.js rename to src/webapp/api/scripts/util/date.js diff --git a/scripts/util/debug.js b/src/webapp/api/scripts/util/debug.js similarity index 100% rename from scripts/util/debug.js rename to src/webapp/api/scripts/util/debug.js diff --git a/scripts/util/dstructs/.svn/all-wcprops b/src/webapp/api/scripts/util/dstructs/.svn/all-wcprops similarity index 100% rename from scripts/util/dstructs/.svn/all-wcprops rename to src/webapp/api/scripts/util/dstructs/.svn/all-wcprops diff --git a/scripts/util/dstructs/.svn/entries b/src/webapp/api/scripts/util/dstructs/.svn/entries similarity index 100% rename from scripts/util/dstructs/.svn/entries rename to src/webapp/api/scripts/util/dstructs/.svn/entries diff --git a/scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base b/src/webapp/api/scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base similarity index 100% rename from scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base rename to src/webapp/api/scripts/util/dstructs/.svn/text-base/dstructs.js.svn-base diff --git a/scripts/util/dstructs/docs/.svn/all-wcprops b/src/webapp/api/scripts/util/dstructs/docs/.svn/all-wcprops similarity index 100% rename from scripts/util/dstructs/docs/.svn/all-wcprops rename to src/webapp/api/scripts/util/dstructs/docs/.svn/all-wcprops diff --git a/scripts/util/dstructs/docs/.svn/entries b/src/webapp/api/scripts/util/dstructs/docs/.svn/entries similarity index 100% rename from scripts/util/dstructs/docs/.svn/entries rename to src/webapp/api/scripts/util/dstructs/docs/.svn/entries diff --git a/scripts/util/dstructs/dstructs.js b/src/webapp/api/scripts/util/dstructs/dstructs.js similarity index 100% rename from scripts/util/dstructs/dstructs.js rename to src/webapp/api/scripts/util/dstructs/dstructs.js diff --git a/scripts/util/dstructs/tests/.svn/all-wcprops b/src/webapp/api/scripts/util/dstructs/tests/.svn/all-wcprops similarity index 100% rename from scripts/util/dstructs/tests/.svn/all-wcprops rename to src/webapp/api/scripts/util/dstructs/tests/.svn/all-wcprops diff --git a/scripts/util/dstructs/tests/.svn/entries b/src/webapp/api/scripts/util/dstructs/tests/.svn/entries similarity index 100% rename from scripts/util/dstructs/tests/.svn/entries rename to src/webapp/api/scripts/util/dstructs/tests/.svn/entries diff --git a/scripts/util/dstructs/tests/array-tests.html b/src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base similarity index 100% rename from scripts/util/dstructs/tests/array-tests.html rename to src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base diff --git a/scripts/util/dstructs/tests/array-tests.js b/src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base similarity index 100% rename from scripts/util/dstructs/tests/array-tests.js rename to src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base diff --git a/scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base b/src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base similarity index 100% rename from scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base rename to src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/hash-tests.html.svn-base diff --git a/scripts/util/dstructs/tests/testpage.html b/src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base similarity index 100% rename from scripts/util/dstructs/tests/testpage.html rename to src/webapp/api/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base diff --git a/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base b/src/webapp/api/scripts/util/dstructs/tests/array-tests.html similarity index 97% rename from scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base rename to src/webapp/api/scripts/util/dstructs/tests/array-tests.html index 333cc54..0a2693a 100644 --- a/scripts/util/dstructs/tests/.svn/text-base/array-tests.html.svn-base +++ b/src/webapp/api/scripts/util/dstructs/tests/array-tests.html @@ -1,13 +1,13 @@ - - - - - DStructs Array Tests - - - - - - - + + + + + DStructs Array Tests + + + + + + + diff --git a/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base b/src/webapp/api/scripts/util/dstructs/tests/array-tests.js similarity index 96% rename from scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base rename to src/webapp/api/scripts/util/dstructs/tests/array-tests.js index 5800710..ea22b1f 100644 --- a/scripts/util/dstructs/tests/.svn/text-base/array-tests.js.svn-base +++ b/src/webapp/api/scripts/util/dstructs/tests/array-tests.js @@ -1,29 +1,29 @@ -function setUp() { - testArray = new DStructs.Array(1, 2, 3, 1); -} - -function testSlice() { - assertEquals("Wrong length!", testArray.slice(0, 1).length, 1); -} - -function testConcat() { - testArray.concat([4, 5, 6]); - assertEquals("Wrong length!", testArray.length, 7); -} - -function testReduce() { - var add = function(a, b) { return a + b; }; - var acc = function(a, b) { a.push(b); return a; }; - assertEquals("Incorrect sum!", testArray.reduce(0, add), 7); - assertEquals("Incorrect array!", testArray.reduce([], acc).length, 4); -} - -function testIndexOf() { - assertEquals("Incorrect index!", testArray.indexOf(2), 1); - assertEquals("Incorrect index!", testArray.indexOf(1), 0); - assertEquals("Incorrect index!", testArray.indexOf(22), -1); -} - -function testIndicesOf() { - assertEquals("Wrong number of indices!", testArray.indicesOf(1).length, 2); -} +function setUp() { + testArray = new DStructs.Array(1, 2, 3, 1); +} + +function testSlice() { + assertEquals("Wrong length!", testArray.slice(0, 1).length, 1); +} + +function testConcat() { + testArray.concat([4, 5, 6]); + assertEquals("Wrong length!", testArray.length, 7); +} + +function testReduce() { + var add = function(a, b) { return a + b; }; + var acc = function(a, b) { a.push(b); return a; }; + assertEquals("Incorrect sum!", testArray.reduce(0, add), 7); + assertEquals("Incorrect array!", testArray.reduce([], acc).length, 4); +} + +function testIndexOf() { + assertEquals("Incorrect index!", testArray.indexOf(2), 1); + assertEquals("Incorrect index!", testArray.indexOf(1), 0); + assertEquals("Incorrect index!", testArray.indexOf(22), -1); +} + +function testIndicesOf() { + assertEquals("Wrong number of indices!", testArray.indicesOf(1).length, 2); +} diff --git a/scripts/util/dstructs/tests/hash-tests.html b/src/webapp/api/scripts/util/dstructs/tests/hash-tests.html similarity index 100% rename from scripts/util/dstructs/tests/hash-tests.html rename to src/webapp/api/scripts/util/dstructs/tests/hash-tests.html diff --git a/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base b/src/webapp/api/scripts/util/dstructs/tests/testpage.html similarity index 95% rename from scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base rename to src/webapp/api/scripts/util/dstructs/tests/testpage.html index 91a3066..80299cc 100644 --- a/scripts/util/dstructs/tests/.svn/text-base/testpage.html.svn-base +++ b/src/webapp/api/scripts/util/dstructs/tests/testpage.html @@ -1,8 +1,8 @@ - - - DStructs Javascript Library - - - - - + + + DStructs Javascript Library + + + + + diff --git a/scripts/util/excanvas.pack.js b/src/webapp/api/scripts/util/excanvas.pack.js similarity index 100% rename from scripts/util/excanvas.pack.js rename to src/webapp/api/scripts/util/excanvas.pack.js diff --git a/scripts/util/.svn/text-base/jquery.corner.js.svn-base b/src/webapp/api/scripts/util/jquery.corner.js similarity index 97% rename from scripts/util/.svn/text-base/jquery.corner.js.svn-base rename to src/webapp/api/scripts/util/jquery.corner.js index a7397c8..57771b6 100644 --- a/scripts/util/.svn/text-base/jquery.corner.js.svn-base +++ b/src/webapp/api/scripts/util/jquery.corner.js @@ -1,253 +1,253 @@ - // jquery-roundcorners-canvas - // www.meerbox.nl - -(function($){ - - var _corner = function(options) { - - // no native canvas support, or its msie and excanvas.js not loaded - var testcanvas = document.createElement("canvas"); - if (typeof G_vmlCanvasManager == 'undefined' && $.browser.msie) { - return this.each(function() {}); - } - - // get lowest number from array - var asNum = function(a, b) { return a-b; }; - var getMin = function(a) { - var b = a.concat(); - return b.sort(asNum)[0]; - }; - - // get CSS value as integer - var getCSSint = function(el, prop) { - return parseInt($.css(el.jquery?el[0]:el,prop))||0; - }; - - // draw the round corner in Canvas object - var drawRoundCornerCanvasShape = function(canvas,radius,r_type,bg_color,border_width,border_color) { - - // change rgba(1,2,3,0.9) to rgb(1,2,3) - var reg = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/; - var bits = reg.exec(bg_color); - if (bits) { - channels = new Array(parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])); - bg_color = 'rgb('+channels[0]+', '+channels[1]+', '+channels[2]+')'; - } - - var border_width = parseInt(border_width); - - var ctx = canvas.getContext('2d'); - - if (radius == 1) { - ctx.fillStyle = bg_color; - ctx.fillRect(0,0,1,1); - return; - } - - if (r_type == 'tl') { - var steps = new Array(0,0,radius,0,radius,0,0,radius,0,0); - } else if (r_type == 'tr') { - var steps = new Array(radius,0,radius,radius,radius,0,0,0,0,0); - } else if (r_type == 'bl') { - var steps = new Array(0,radius,radius,radius,0,radius,0,0,0,radius); - } else if (r_type == 'br') { - var steps = new Array(radius,radius,radius,0,radius,0,0,radius,radius,radius); - } - - ctx.fillStyle = bg_color; - ctx.beginPath(); - ctx.moveTo(steps[0],steps[1]); - ctx.lineTo(steps[2], steps[3]); - if(r_type == 'br') ctx.bezierCurveTo(steps[4], steps[5], radius, radius, steps[6], steps[7]); - else ctx.bezierCurveTo(steps[4], steps[5], 0, 0, steps[6], steps[7]); - ctx.lineTo(steps[8], steps[9]); - ctx.fill(); - - // draw border - if (border_width > 0 && border_width < radius) { - - // offset caused by border - var offset = border_width/2; - - if (r_type == 'tl') { - var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset); - var curve_to = new Array(0,0); - } else if (r_type == 'tr') { - var steps = new Array(radius-offset,radius-offset,radius-offset,offset,offset,offset); - var curve_to = new Array(0,0); - } else if (r_type == 'bl') { - var steps = new Array(radius-offset,radius-offset,offset,radius-offset,offset,offset,offset,radius-offset); - var curve_to = new Array(0,0); - } else if (r_type == 'br') { - var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset,radius-offset,radius-offset); - var curve_to = new Array(radius, radius); - } - - ctx.strokeStyle = border_color; - ctx.lineWidth = border_width; - ctx.beginPath(); - // go to corner to begin curve - ctx.moveTo(steps[0], steps[1]); - // curve from righttop to leftbottom (for the tl canvas) - ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); - ctx.stroke(); - - } - }; - - var creatCanvas = function(p,radius) { - var elm = document.createElement('canvas'); - elm.setAttribute("height", radius); - elm.setAttribute("width", radius); - elm.style.display = "block"; - elm.style.position = "absolute"; - elm.className = "cornercanvas"; - elm = p.appendChild(elm); - // if G_vmlCanvasManager in defined the browser (ie only) has loaded excanvas.js - if (!elm.getContext && typeof G_vmlCanvasManager != 'undefined') { - var elm = G_vmlCanvasManager.initElement(elm); - } - return elm; - }; - - // interpret the (string) argument - var o = (options || "").toLowerCase(); - var radius = parseInt((o.match(/(\d+)px/)||[])[1]) || null; // corner width - var bg_color = ((o.match(/(#[0-9a-f]+)/)||[])[1]); // strip color - if (radius == null) { radius = "auto"; } - - var edges = { T:0, B:1 }; - var opts = { - tl: /top|tl/.test(o), - tr: /top|tr/.test(o), - bl: /bottom|bl/.test(o), - br: /bottom|br/.test(o) - }; - if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) { - opts = { tl:1, tr:1, bl:1, br:1 }; - } - - return this.each(function() { - - var elm = $(this); - - // give the element 'haslayout' - if ($.browser.msie) { this.style.zoom = 1; } - - // the size of the corner is not defined... - var widthheight_smallest = getMin(new Array(getCSSint(this,'height'),getCSSint(this,'width'))); - if (radius == "auto") { - radius = widthheight_smallest/4; - if (radius > 10) { radius = 10; } - } - - // the size of the corner can't be to high - if (widthheight_smallest < radius) { - radius = (widthheight_smallest/2); - } - - // remove old canvas objects - elm.children("canvas.cornercanvas").remove(); - - // some css thats required in order to position the canvas elements - if (elm.css('position') == 'static') { - elm.css('position','relative'); - // only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode - } else if (elm.css('position') == 'fixed' && $.browser.msie && !(document.compatMode == 'CSS1Compat' && typeof document.body.style.maxHeight != "undefined")) { - elm.css('position','absolute'); - } - elm.css('overflow','visible'); - - // get border width - var border_t = getCSSint(this, 'borderTopWidth'); - var border_r = getCSSint(this, 'borderRightWidth'); - var border_b = getCSSint(this, 'borderBottomWidth'); - var border_l = getCSSint(this, 'borderLeftWidth'); - - // get the lowest borderwidth of the corners in use - var bordersWidth = new Array(); - if (opts.tl || opts.tr) { bordersWidth.push(border_t); } - if (opts.br || opts.tr) { bordersWidth.push(border_r); } - if (opts.br || opts.bl) { bordersWidth.push(border_b); } - if (opts.bl || opts.tl) { bordersWidth.push(border_l); } - - borderswidth_smallest = getMin(bordersWidth); - - // creat the canvas elements and position them - var p_top = 0-border_t; - var p_right = 0-border_r; - var p_bottom = 0-border_b; - var p_left = 0-border_l; - - if (opts.tl) { var tl = $(creatCanvas(this,radius)).css({left:p_left,top:p_top}).get(0); } - if (opts.tr) { var tr = $(creatCanvas(this,radius)).css({right:p_right,top:p_top}).get(0); } - if (opts.bl) { var bl = $(creatCanvas(this,radius)).css({left:p_left,bottom:p_bottom}).get(0); } - if (opts.br) { var br = $(creatCanvas(this,radius)).css({right:p_right,bottom:p_bottom}).get(0); } - - // get the background color of parent element - - if (bg_color == undefined) { - - var current_p = elm.parent(); - var bg = current_p.css('background-color'); - while((bg == "transparent" || bg == "rgba(0, 0, 0, 0)") && current_p.get(0).tagName.toLowerCase() != "html") { - bg = current_p.css('background-color'); - current_p = current_p.parent(); - } - } else { - bg = bg_color; - } - - if (bg == "transparent" || bg == "rgba(0, 0, 0, 0)") { bg = "#ffffff"; } - - if (opts.tl) { drawRoundCornerCanvasShape(tl,radius,'tl',bg,borderswidth_smallest,elm.css('borderTopColor')); } - if (opts.tr) { drawRoundCornerCanvasShape(tr,radius,'tr',bg,borderswidth_smallest,elm.css('borderTopColor')); } - if (opts.bl) { drawRoundCornerCanvasShape(bl,radius,'bl',bg,borderswidth_smallest,elm.css('borderBottomColor')); } - if (opts.br) { drawRoundCornerCanvasShape(br,radius,'br',bg,borderswidth_smallest,elm.css('borderBottomColor')); } - - elm.addClass('roundCornersParent'); - - }); - }; - - if ($.browser.msie && typeof G_vmlCanvasManager == 'undefined') { - - var corner_buffer = new Array(); - var corner_buffer_args = new Array(); - - $.fn.corner = function(options){ - corner_buffer[corner_buffer.length] = this; - corner_buffer_args[corner_buffer_args.length] = options; - return this.each(function(){}); - }; - - // load excanvas.pack.js - document.execCommand("BackgroundImageCache", false, true); - var elm = $("script[@src*=jquery.corner.]"); - if (elm.length == 1) { - var jc_src = elm.attr('src'); - var pathArray = jc_src.split('/'); - pathArray.pop(); - var base = pathArray.join('/') || '.'; - var excanvasjs = base+'/excanvas.pack.js'; - $.getScript(excanvasjs,function(){ - execbuffer(); - }); - } - - var execbuffer = function() { - // set back function - $.fn.corner = _corner; - // execute buffer and set back function - for(var i=0;i 0 && border_width < radius) { + + // offset caused by border + var offset = border_width/2; + + if (r_type == 'tl') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'tr') { + var steps = new Array(radius-offset,radius-offset,radius-offset,offset,offset,offset); + var curve_to = new Array(0,0); + } else if (r_type == 'bl') { + var steps = new Array(radius-offset,radius-offset,offset,radius-offset,offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'br') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset,radius-offset,radius-offset); + var curve_to = new Array(radius, radius); + } + + ctx.strokeStyle = border_color; + ctx.lineWidth = border_width; + ctx.beginPath(); + // go to corner to begin curve + ctx.moveTo(steps[0], steps[1]); + // curve from righttop to leftbottom (for the tl canvas) + ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); + ctx.stroke(); + + } + }; + + var creatCanvas = function(p,radius) { + var elm = document.createElement('canvas'); + elm.setAttribute("height", radius); + elm.setAttribute("width", radius); + elm.style.display = "block"; + elm.style.position = "absolute"; + elm.className = "cornercanvas"; + elm = p.appendChild(elm); + // if G_vmlCanvasManager in defined the browser (ie only) has loaded excanvas.js + if (!elm.getContext && typeof G_vmlCanvasManager != 'undefined') { + var elm = G_vmlCanvasManager.initElement(elm); + } + return elm; + }; + + // interpret the (string) argument + var o = (options || "").toLowerCase(); + var radius = parseInt((o.match(/(\d+)px/)||[])[1]) || null; // corner width + var bg_color = ((o.match(/(#[0-9a-f]+)/)||[])[1]); // strip color + if (radius == null) { radius = "auto"; } + + var edges = { T:0, B:1 }; + var opts = { + tl: /top|tl/.test(o), + tr: /top|tr/.test(o), + bl: /bottom|bl/.test(o), + br: /bottom|br/.test(o) + }; + if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) { + opts = { tl:1, tr:1, bl:1, br:1 }; + } + + return this.each(function() { + + var elm = $(this); + + // give the element 'haslayout' + if ($.browser.msie) { this.style.zoom = 1; } + + // the size of the corner is not defined... + var widthheight_smallest = getMin(new Array(getCSSint(this,'height'),getCSSint(this,'width'))); + if (radius == "auto") { + radius = widthheight_smallest/4; + if (radius > 10) { radius = 10; } + } + + // the size of the corner can't be to high + if (widthheight_smallest < radius) { + radius = (widthheight_smallest/2); + } + + // remove old canvas objects + elm.children("canvas.cornercanvas").remove(); + + // some css thats required in order to position the canvas elements + if (elm.css('position') == 'static') { + elm.css('position','relative'); + // only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode + } else if (elm.css('position') == 'fixed' && $.browser.msie && !(document.compatMode == 'CSS1Compat' && typeof document.body.style.maxHeight != "undefined")) { + elm.css('position','absolute'); + } + elm.css('overflow','visible'); + + // get border width + var border_t = getCSSint(this, 'borderTopWidth'); + var border_r = getCSSint(this, 'borderRightWidth'); + var border_b = getCSSint(this, 'borderBottomWidth'); + var border_l = getCSSint(this, 'borderLeftWidth'); + + // get the lowest borderwidth of the corners in use + var bordersWidth = new Array(); + if (opts.tl || opts.tr) { bordersWidth.push(border_t); } + if (opts.br || opts.tr) { bordersWidth.push(border_r); } + if (opts.br || opts.bl) { bordersWidth.push(border_b); } + if (opts.bl || opts.tl) { bordersWidth.push(border_l); } + + borderswidth_smallest = getMin(bordersWidth); + + // creat the canvas elements and position them + var p_top = 0-border_t; + var p_right = 0-border_r; + var p_bottom = 0-border_b; + var p_left = 0-border_l; + + if (opts.tl) { var tl = $(creatCanvas(this,radius)).css({left:p_left,top:p_top}).get(0); } + if (opts.tr) { var tr = $(creatCanvas(this,radius)).css({right:p_right,top:p_top}).get(0); } + if (opts.bl) { var bl = $(creatCanvas(this,radius)).css({left:p_left,bottom:p_bottom}).get(0); } + if (opts.br) { var br = $(creatCanvas(this,radius)).css({right:p_right,bottom:p_bottom}).get(0); } + + // get the background color of parent element + + if (bg_color == undefined) { + + var current_p = elm.parent(); + var bg = current_p.css('background-color'); + while((bg == "transparent" || bg == "rgba(0, 0, 0, 0)") && current_p.get(0).tagName.toLowerCase() != "html") { + bg = current_p.css('background-color'); + current_p = current_p.parent(); + } + } else { + bg = bg_color; + } + + if (bg == "transparent" || bg == "rgba(0, 0, 0, 0)") { bg = "#ffffff"; } + + if (opts.tl) { drawRoundCornerCanvasShape(tl,radius,'tl',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.tr) { drawRoundCornerCanvasShape(tr,radius,'tr',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.bl) { drawRoundCornerCanvasShape(bl,radius,'bl',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + if (opts.br) { drawRoundCornerCanvasShape(br,radius,'br',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + + elm.addClass('roundCornersParent'); + + }); + }; + + if ($.browser.msie && typeof G_vmlCanvasManager == 'undefined') { + + var corner_buffer = new Array(); + var corner_buffer_args = new Array(); + + $.fn.corner = function(options){ + corner_buffer[corner_buffer.length] = this; + corner_buffer_args[corner_buffer_args.length] = options; + return this.each(function(){}); + }; + + // load excanvas.pack.js + document.execCommand("BackgroundImageCache", false, true); + var elm = $("script[@src*=jquery.corner.]"); + if (elm.length == 1) { + var jc_src = elm.attr('src'); + var pathArray = jc_src.split('/'); + pathArray.pop(); + var base = pathArray.join('/') || '.'; + var excanvasjs = base+'/excanvas.pack.js'; + $.getScript(excanvasjs,function(){ + execbuffer(); + }); + } + + var execbuffer = function() { + // set back function + $.fn.corner = _corner; + // execute buffer and set back function + for(var i=0;i Date: Tue, 25 Jul 2017 16:01:39 -0400 Subject: [PATCH 29/43] Changed line endings to UNIX format --- build.xml | 174 +++--- src/webapp/api/locales/en/locale.js | 62 +-- .../en/scripts/layouts/monthly-l10n.js | 18 +- .../locales/en/scripts/layouts/nday-l10n.js | 62 +-- .../locales/en/scripts/layouts/nmonth-l10n.js | 60 +- .../en/scripts/layouts/property-l10n.js | 30 +- .../locales/en/scripts/layouts/weekly-l10n.js | 18 +- .../api/locales/en/scripts/timegrid-l10n.js | 24 +- .../api/locales/en/scripts/util/date-l10n.js | 58 +- src/webapp/api/locales/fr/locale.js | 60 +- .../fr/scripts/layouts/monthly-l10n.js | 18 +- .../locales/fr/scripts/layouts/nday-l10n.js | 58 +- .../locales/fr/scripts/layouts/nmonth-l10n.js | 56 +- .../locales/fr/scripts/layouts/weekly-l10n.js | 18 +- .../api/locales/fr/scripts/timegrid-l10n.js | 26 +- .../api/locales/fr/scripts/util/date-l10n.js | 58 +- src/webapp/api/scripts/controls.js | 296 +++++----- src/webapp/api/scripts/create.js | 14 +- src/webapp/api/scripts/layouts/nday.js | 484 ++++++++-------- src/webapp/api/scripts/layouts/nmonth.js | 518 +++++++++--------- src/webapp/api/scripts/layouts/property.js | 300 +++++----- src/webapp/api/scripts/listeners.js | 56 +- src/webapp/api/scripts/sources/recurring.js | 272 ++++----- src/webapp/api/scripts/util/jquery.corner.js | 506 ++++++++--------- .../api/scripts/util/jquery.prettybox.js | 342 ++++++------ src/webapp/api/scripts/util/jquery.simile.js | 236 ++++---- src/webapp/api/scripts/util/util.js | 94 ++-- src/webapp/api/styles/timegrid.css | 384 ++++++------- src/webapp/api/timegrid-api.js | 262 ++++----- src/webapp/site/docs/splash.html | 2 +- .../site/examples/academic/academic.html | 50 +- .../site/examples/conference/conference.html | 54 +- src/webapp/site/examples/property/lectures.js | 58 +- .../site/examples/property/property.html | 54 +- src/webapp/site/sidebar.html | 2 +- 35 files changed, 2392 insertions(+), 2392 deletions(-) diff --git a/build.xml b/build.xml index 5ffa08f..595d2c7 100644 --- a/build.xml +++ b/build.xml @@ -1,87 +1,87 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/webapp/api/locales/en/locale.js b/src/webapp/api/locales/en/locale.js index 8a29acf..6e5c6c1 100644 --- a/src/webapp/api/locales/en/locale.js +++ b/src/webapp/api/locales/en/locale.js @@ -1,31 +1,31 @@ -/*================================================== - * English localization - * (also base and default localization) - *================================================== - */ -(function() { - var javascriptFiles = [ - "timegrid-l10n.js", - - "util/date-l10n.js", - - "layouts/nday-l10n.js", - "layouts/nmonth-l10n.js", - "layouts/monthly-l10n.js", - "layouts/weekly-l10n.js", - "layouts/property-l10n.js" - ]; - var cssFiles = [ - ]; - - var urlPrefix = Timegrid.urlPrefix + "locales/en/"; - if (Timegrid.params.bundle) { - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); - if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); - } - } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); - } -})(); +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/monthly-l10n.js", + "layouts/weekly-l10n.js", + "layouts/property-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/en/"; + if (Timegrid.params.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js b/src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js index 3fe6b5a..635eea9 100644 --- a/src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js +++ b/src/webapp/api/locales/en/scripts/layouts/monthly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid MonthLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.MonthLayout)) { - Timegrid.MonthLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Month"; } \ No newline at end of file diff --git a/src/webapp/api/locales/en/scripts/layouts/nday-l10n.js b/src/webapp/api/locales/en/scripts/layouts/nday-l10n.js index 09a89b2..1d3f099 100644 --- a/src/webapp/api/locales/en/scripts/layouts/nday-l10n.js +++ b/src/webapp/api/locales/en/scripts/layouts/nday-l10n.js @@ -1,31 +1,31 @@ -/****************************************************************************** - * Timegrid NDayLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NDayLayout)) { - Timegrid.NDayLayout.l10n = { mini: {} }; -} - -/** Function to create a title string from an n-value */ -Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { - return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + - d2.format(Timegrid.NDayLayout.l10n.endFormat); -}; - -/** Format for horizontal "Mon 5/24" style labels */ -Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; -Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; - -/** Format for vertical "12am" style labels */ -Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; -Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; - -/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ -Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; - -/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ -Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; - +/****************************************************************************** + * Timegrid NDayLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = { mini: {} }; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 5/24" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; + +/** Format for vertical "12am" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; + diff --git a/src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js b/src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js index b62292b..eda5778 100644 --- a/src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js +++ b/src/webapp/api/locales/en/scripts/layouts/nmonth-l10n.js @@ -1,31 +1,31 @@ -/****************************************************************************** - * Timegrid NMonthLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NMonthLayout)) { - Timegrid.NMonthLayout.l10n = {}; -} - -/** Function to create a title string from an n-value */ -Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { - var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); - if (d2) { - string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); - } - return string; -}; - -/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ -Timegrid.NMonthLayout.l10n.xLabelFormat = ""; - -/** Format for vertical "W23" style labels */ -Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; - -/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ -Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; - -/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +/****************************************************************************** + * Timegrid NMonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); + if (d2) { + string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); + } + return string; +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ Timegrid.NMonthLayout.l10n.endFormat = "MMM yyyy"; \ No newline at end of file diff --git a/src/webapp/api/locales/en/scripts/layouts/property-l10n.js b/src/webapp/api/locales/en/scripts/layouts/property-l10n.js index 6c2f763..d7dd304 100644 --- a/src/webapp/api/locales/en/scripts/layouts/property-l10n.js +++ b/src/webapp/api/locales/en/scripts/layouts/property-l10n.js @@ -1,15 +1,15 @@ -/****************************************************************************** - * Timegrid PropertyLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.PropertyLayout)) { - Timegrid.PropertyLayout.l10n = {}; -} - -/** Function to create a title string */ -Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } - -/** Format for vertical "12am" style labels */ -Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; - - +/****************************************************************************** + * Timegrid PropertyLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.PropertyLayout)) { + Timegrid.PropertyLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } + +/** Format for vertical "12am" style labels */ +Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; + + diff --git a/src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js b/src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js index 105a0e1..72157b9 100644 --- a/src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js +++ b/src/webapp/api/locales/en/scripts/layouts/weekly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid WeekLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.WeekLayout)) { - Timegrid.WeekLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Week"; } \ No newline at end of file diff --git a/src/webapp/api/locales/en/scripts/timegrid-l10n.js b/src/webapp/api/locales/en/scripts/timegrid-l10n.js index b2acaf0..0e558d0 100644 --- a/src/webapp/api/locales/en/scripts/timegrid-l10n.js +++ b/src/webapp/api/locales/en/scripts/timegrid-l10n.js @@ -1,13 +1,13 @@ -/****************************************************************************** - * Timegrid English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid)) { - Timegrid.l10n = {}; -} - -Timegrid.l10n.loadingMessage = "Loading..."; - -Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; - +/****************************************************************************** + * Timegrid English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Loading..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; \ No newline at end of file diff --git a/src/webapp/api/locales/en/scripts/util/date-l10n.js b/src/webapp/api/locales/en/scripts/util/date-l10n.js index d9fcaac..e53fb8b 100644 --- a/src/webapp/api/locales/en/scripts/util/date-l10n.js +++ b/src/webapp/api/locales/en/scripts/util/date-l10n.js @@ -1,29 +1,29 @@ -/****************************************************************************** - * Timegrid Date English localization - *****************************************************************************/ - -if (!("l10n" in Date)) { - Date.l10n = {}; -} - -/** Full month names. Change this for local month names */ -Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; - -/** Month abbreviations. Change this for local month names */ -Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - -/** Full day names. Change this for local month names */ -Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; - -/** Day abbreviations. Change this for local month names */ -Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; - -/** - * Used for parsing ambiguous dates like 1/2/2000 - default to preferring - * 'American' format meaning Jan 2. Set to false to prefer 'European' format - * meaning Feb 1. - */ -Date.l10n.preferAmericanFormat = true; - -/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ -Date.l10n.firstDayOfWeek = 0; +/****************************************************************************** + * Timegrid Date English localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; + +/** Month abbreviations. Change this for local month names */ +Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + +/** Full day names. Change this for local month names */ +Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + +/** Day abbreviations. Change this for local month names */ +Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = true; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 0; diff --git a/src/webapp/api/locales/fr/locale.js b/src/webapp/api/locales/fr/locale.js index 619dacb..ff834d3 100644 --- a/src/webapp/api/locales/fr/locale.js +++ b/src/webapp/api/locales/fr/locale.js @@ -1,30 +1,30 @@ -/*================================================== - * English localization - * (also base and default localization) - *================================================== - */ -(function() { - var javascriptFiles = [ - "timegrid-l10n.js", - - "util/date-l10n.js", - - "layouts/nday-l10n.js", - "layouts/nmonth-l10n.js", - "layouts/weekly-l10n.js", - "layouts/monthly-l10n.js" - ]; - var cssFiles = [ - ]; - - var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; - if (Timegrid.bundle) { - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); - if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); - } - } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); - } -})(); +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/weekly-l10n.js", + "layouts/monthly-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; + if (Timegrid.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js index 36d6413..18f28c9 100644 --- a/src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js +++ b/src/webapp/api/locales/fr/scripts/layouts/monthly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid MonthLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.MonthLayout)) { - Timegrid.MonthLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Mois"; } \ No newline at end of file diff --git a/src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js index a3ad936..dd6caad 100644 --- a/src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js +++ b/src/webapp/api/locales/fr/scripts/layouts/nday-l10n.js @@ -1,29 +1,29 @@ -/****************************************************************************** - * Timegrid NDayLayout French localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NDayLayout)) { - Timegrid.NDayLayout.l10n = {}; -} - -/** Function to create a title string from an n-value */ -Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Jour"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { - return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + - d2.format(Timegrid.NDayLayout.l10n.endFormat); -}; - -/** Format for horizontal "Mon 24/5" style labels */ -Timegrid.NDayLayout.l10n.xLabelFormat = "E d/M"; - -/** Format for vertical "13h" style labels */ -Timegrid.NDayLayout.l10n.yLabelFormat = "H"; - -/** Format for displaying the grid's starting date, e.g. "16/6/2007" */ -Timegrid.NDayLayout.l10n.startFormat = "d/M/yyyy"; - -/** Format for displaying the grid's ending date, e.g. "17/6/2007" */ -Timegrid.NDayLayout.l10n.endFormat = "d/M/yyyy"; - +/****************************************************************************** + * Timegrid NDayLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Jour"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 24/5" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E d/M"; + +/** Format for vertical "13h" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "H"; + +/** Format for displaying the grid's starting date, e.g. "16/6/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "17/6/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "d/M/yyyy"; + diff --git a/src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js index e89a0ca..3d3cb70 100644 --- a/src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js +++ b/src/webapp/api/locales/fr/scripts/layouts/nmonth-l10n.js @@ -1,28 +1,28 @@ -/****************************************************************************** - * Timegrid NMonthLayout French localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.NMonthLayout)) { - Timegrid.NMonthLayout.l10n = {}; -} - -/** Function to create a title string from an n-value */ -Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Mois"; } - -/** Function to combine two dates into a string describing the grid's range */ -Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { - return d1.format(Timegrid.NMonthLayout.l10n.startFormat) + " - " + - d2.format(Timegrid.NMonthLayout.l10n.endFormat); -}; - -/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ -Timegrid.NMonthLayout.l10n.xLabelFormat = ""; - -/** Format for vertical "W23" style labels */ -Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; - -/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ -Timegrid.NMonthLayout.l10n.startFormat = "d/M/yyyy"; - -/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ -Timegrid.NMonthLayout.l10n.endFormat = "d/M/yyyy"; +/****************************************************************************** + * Timegrid NMonthLayout French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Mois"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NMonthLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NMonthLayout.l10n.endFormat); +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "d/M/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "d/M/yyyy"; diff --git a/src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js b/src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js index bbb08c9..9114028 100644 --- a/src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js +++ b/src/webapp/api/locales/fr/scripts/layouts/weekly-l10n.js @@ -1,10 +1,10 @@ -/****************************************************************************** - * Timegrid WeekLayout English localization - *****************************************************************************/ - -if (!("l10n" in Timegrid.WeekLayout)) { - Timegrid.WeekLayout.l10n = {}; -} - -/** Function to create a title string */ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Semaine"; } \ No newline at end of file diff --git a/src/webapp/api/locales/fr/scripts/timegrid-l10n.js b/src/webapp/api/locales/fr/scripts/timegrid-l10n.js index 041c4b8..773ecb5 100644 --- a/src/webapp/api/locales/fr/scripts/timegrid-l10n.js +++ b/src/webapp/api/locales/fr/scripts/timegrid-l10n.js @@ -1,13 +1,13 @@ -/****************************************************************************** - * Timegrid French localization - *****************************************************************************/ - -if (!("l10n" in Timegrid)) { - Timegrid.l10n = {}; -} - -Timegrid.l10n.loadingMessage = "Chargement..."; - -Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; - -Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; +/****************************************************************************** + * Timegrid French localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Chargement..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; diff --git a/src/webapp/api/locales/fr/scripts/util/date-l10n.js b/src/webapp/api/locales/fr/scripts/util/date-l10n.js index e6e8221..710dc10 100644 --- a/src/webapp/api/locales/fr/scripts/util/date-l10n.js +++ b/src/webapp/api/locales/fr/scripts/util/date-l10n.js @@ -1,29 +1,29 @@ -/****************************************************************************** - * Timegrid Date French localization - *****************************************************************************/ - -if (!("l10n" in Date)) { - Date.l10n = {}; -} - -/** Full month names. Change this for local month names */ -Date.l10n.monthNames =[ 'janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; - -/** Month abbreviations. Change this for local month abbreviations */ -Date.l10n.monthAbbreviations = [ 'janv', 'fevr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'dec' ]; - -/** Full day names. Change this for local day names. */ -Date.l10n.dayNames = [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ]; - -/** Day abbreviations. Change this for local day abbreviations */ -Date.l10n.dayAbbreviations = ['dim','lun','mar','mer','jeu','ven','sam']; - -/** - * Used for parsing ambiguous dates like 1/2/2000 - default to preferring - * 'American' format meaning Jan 2. Set to false to prefer 'European' format - * meaning Feb 1. - */ -Date.l10n.preferAmericanFormat = false; - -/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ -Date.l10n.firstDayOfWeek = 1; +/****************************************************************************** + * Timegrid Date French localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; + +/** Month abbreviations. Change this for local month abbreviations */ +Date.l10n.monthAbbreviations = [ 'janv', 'fevr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'dec' ]; + +/** Full day names. Change this for local day names. */ +Date.l10n.dayNames = [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ]; + +/** Day abbreviations. Change this for local day abbreviations */ +Date.l10n.dayAbbreviations = ['dim','lun','mar','mer','jeu','ven','sam']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = false; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 1; diff --git a/src/webapp/api/scripts/controls.js b/src/webapp/api/scripts/controls.js index 3b4ba36..6e9a40a 100644 --- a/src/webapp/api/scripts/controls.js +++ b/src/webapp/api/scripts/controls.js @@ -1,148 +1,148 @@ -/** - * Controls - */ - -Timegrid.Controls = {}; - -/* - * A panel will render controls around a set of layouts. This should be the - * only entrypoint into this code, in addition to the render method. - * Possible controls include: - * Switching between the layouts (tabs) - * Iterating through time, different weeks/months, etc (arrows) - * Switching between data sources - * The style and selection of which types of controls to render in the panel - * should be easily configurable through the params hash passed in. - */ -Timegrid.Controls.Panel = function(layouts, params) { - this._layouts = layouts; - this._titles = $.map(this._layouts, function(l) { return l.title; }); - this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); -}; - -Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { - this._layouts = layouts; - this._titles = $.map(this._layouts, function(l) { return l.title; }); - this._tabSet.setLayouts(this._titles, this._layouts); -}; - -Timegrid.Controls.Panel.prototype.render = function(container) { - this._tabSet.render(container); - this._tabSet.switchTo(this._tabSet.current || this._titles[0]); -}; - -Timegrid.Controls.Panel.prototype.renderChanged = function() { - this._tabSet.renderChanged(); - this._tabSet.switchTo(this._tabSet.current || this._titles[0]); -}; - -/* - * TabSet is a style of control that generates a set of tabs. These tabs can - * be configured to switch between different views, time slices, or data - * sources. - */ -Timegrid.Controls.TabSet = function(titles, layouts) { - this.setLayouts(titles, layouts); - this.current = ""; -}; - -Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { - this._tabs = {}; - this._renderedLayouts = {}; - this._iterators = {}; - this._layoutMap = {}; - for (var i = 0; i < titles.length; i++) { - this._layoutMap[titles[i]] = layouts[i]; - } -}; - -Timegrid.Controls.TabSet.prototype.render = function(container) { - this._container = container; - var self = this; - var tabDiv = $('
          ').addClass('timegrid-tabs'); - $(container).prepend(tabDiv); - var makeCallback = function(title) { - return function() { self.switchTo(title); }; - }; - for (var lTitle in this._layoutMap) { - var tab = $('') - .height(this._layoutMap[lTitle].tabHeight + "px") - .click(makeCallback(lTitle)) - .addClass('timegrid-tab').addClass('timegrid-rounded'); - tabDiv.prepend(tab); - this._tabs[lTitle] = tab; - } - if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } -}; - -Timegrid.Controls.TabSet.prototype.renderChanged = function() { - var layout = this._layoutMap[this.current]; - layout.renderChanged(); -}; - -Timegrid.Controls.TabSet.prototype.switchTo = function(title) { - if (this.current && this._renderedLayouts[this.current]) { - this._renderedLayouts[this.current].hide(); - this._tabs[this.current].removeClass('timegrid-tab-active'); - } - if (this._renderedLayouts[title]) { - this._renderedLayouts[title].show(); - } else if (this._layoutMap[title]) { - this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); - } - if (this._iDiv) { $(this._iDiv).empty(); } - if (this._layoutMap[title].iterable) { - if (!this._iterators[title]) { - this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); - this._iDiv = $(this._iterators[title].render(this._container)); - } else { - this._iDiv = $(this._iterators[title].render()); - } - } - this.current = title; - this._tabs[this.current].addClass('timegrid-tab-active'); -}; - -/* - * Iterator is a style of control that generates a textual label for the - * current selection and a set of arrows for moving to either the previous - * or next selection. Can be used for views, time, or sources. - */ -Timegrid.Controls.Iterator = function(layout) { - this._layout = layout; -}; - -Timegrid.Controls.Iterator.prototype.render = function(container) { - if (container) { - this._container = container; - this._div = $('
          ').addClass('timegrid-iterator'); - $(this._container).prepend(this._div); - } else { - this._div.empty(); - } - var self = this; - var makePrevCallback = function(layout) { - return function() { - layout.goPrevious(); - self.render(); - }; - }; - var makeNextCallback = function(layout) { - return function() { - layout.goNext(); - self.render(); - }; - }; - var prevLink = $('Previous') - .wrap('').parent() - .addClass('timegrid-iterator-prev') - .click(makePrevCallback(this._layout)); - var nextLink = $('Next') - .wrap('').parent() - .addClass('timegrid-iterator-next') - .click(makeNextCallback(this._layout)); - this._div.append(prevLink); - this._div.append(nextLink); - this._div.append('' + this._layout.getCurrent() + ''); - return this._div; -}; +/** + * Controls + */ + +Timegrid.Controls = {}; + +/* + * A panel will render controls around a set of layouts. This should be the + * only entrypoint into this code, in addition to the render method. + * Possible controls include: + * Switching between the layouts (tabs) + * Iterating through time, different weeks/months, etc (arrows) + * Switching between data sources + * The style and selection of which types of controls to render in the panel + * should be easily configurable through the params hash passed in. + */ +Timegrid.Controls.Panel = function(layouts, params) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { + this._layouts = layouts; + this._titles = $.map(this._layouts, function(l) { return l.title; }); + this._tabSet.setLayouts(this._titles, this._layouts); +}; + +Timegrid.Controls.Panel.prototype.render = function(container) { + this._tabSet.render(container); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +Timegrid.Controls.Panel.prototype.renderChanged = function() { + this._tabSet.renderChanged(); + this._tabSet.switchTo(this._tabSet.current || this._titles[0]); +}; + +/* + * TabSet is a style of control that generates a set of tabs. These tabs can + * be configured to switch between different views, time slices, or data + * sources. + */ +Timegrid.Controls.TabSet = function(titles, layouts) { + this.setLayouts(titles, layouts); + this.current = ""; +}; + +Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { + this._tabs = {}; + this._renderedLayouts = {}; + this._iterators = {}; + this._layoutMap = {}; + for (var i = 0; i < titles.length; i++) { + this._layoutMap[titles[i]] = layouts[i]; + } +}; + +Timegrid.Controls.TabSet.prototype.render = function(container) { + this._container = container; + var self = this; + var tabDiv = $('
          ').addClass('timegrid-tabs'); + $(container).prepend(tabDiv); + var makeCallback = function(title) { + return function() { self.switchTo(title); }; + }; + for (var lTitle in this._layoutMap) { + var tab = $('') + .height(this._layoutMap[lTitle].tabHeight + "px") + .click(makeCallback(lTitle)) + .addClass('timegrid-tab').addClass('timegrid-rounded'); + tabDiv.prepend(tab); + this._tabs[lTitle] = tab; + } + if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } +}; + +Timegrid.Controls.TabSet.prototype.renderChanged = function() { + var layout = this._layoutMap[this.current]; + layout.renderChanged(); +}; + +Timegrid.Controls.TabSet.prototype.switchTo = function(title) { + if (this.current && this._renderedLayouts[this.current]) { + this._renderedLayouts[this.current].hide(); + this._tabs[this.current].removeClass('timegrid-tab-active'); + } + if (this._renderedLayouts[title]) { + this._renderedLayouts[title].show(); + } else if (this._layoutMap[title]) { + this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); + } + if (this._iDiv) { $(this._iDiv).empty(); } + if (this._layoutMap[title].iterable) { + if (!this._iterators[title]) { + this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); + this._iDiv = $(this._iterators[title].render(this._container)); + } else { + this._iDiv = $(this._iterators[title].render()); + } + } + this.current = title; + this._tabs[this.current].addClass('timegrid-tab-active'); +}; + +/* + * Iterator is a style of control that generates a textual label for the + * current selection and a set of arrows for moving to either the previous + * or next selection. Can be used for views, time, or sources. + */ +Timegrid.Controls.Iterator = function(layout) { + this._layout = layout; +}; + +Timegrid.Controls.Iterator.prototype.render = function(container) { + if (container) { + this._container = container; + this._div = $('
          ').addClass('timegrid-iterator'); + $(this._container).prepend(this._div); + } else { + this._div.empty(); + } + var self = this; + var makePrevCallback = function(layout) { + return function() { + layout.goPrevious(); + self.render(); + }; + }; + var makeNextCallback = function(layout) { + return function() { + layout.goNext(); + self.render(); + }; + }; + var prevLink = $('Previous') + .wrap('').parent() + .addClass('timegrid-iterator-prev') + .click(makePrevCallback(this._layout)); + var nextLink = $('Next') + .wrap('').parent() + .addClass('timegrid-iterator-next') + .click(makeNextCallback(this._layout)); + this._div.append(prevLink); + this._div.append(nextLink); + this._div.append('' + this._layout.getCurrent() + ''); + return this._div; +}; diff --git a/src/webapp/api/scripts/create.js b/src/webapp/api/scripts/create.js index d0484ee..fcd95ec 100644 --- a/src/webapp/api/scripts/create.js +++ b/src/webapp/api/scripts/create.js @@ -1,8 +1,8 @@ -$(document).ready(function() { - $('div').each(function() { - if ($(this).attrs('tg').role == "grid") { - if (!window.timegrids) { window.timegrids = new Array(); } - window.timegrids.push(Timegrid.createFromDOM(this)); - } - }); +$(document).ready(function() { + $('div').each(function() { + if ($(this).attrs('tg').role == "grid") { + if (!window.timegrids) { window.timegrids = new Array(); } + window.timegrids.push(Timegrid.createFromDOM(this)); + } + }); }); \ No newline at end of file diff --git a/src/webapp/api/scripts/layouts/nday.js b/src/webapp/api/scripts/layouts/nday.js index 9804d0d..bf68f9e 100644 --- a/src/webapp/api/scripts/layouts/nday.js +++ b/src/webapp/api/scripts/layouts/nday.js @@ -1,242 +1,242 @@ -/****************************************************************************** - * NDayLayout - * @fileoverview - * This is where the n-day layout is defined. The layout is designed to - * resemble the equivalent Google Calendar view. - * @author masont - *****************************************************************************/ - - /** - * Constructs an NDayLayout object. - * @class NDayLayout is a subclass of Layout that implements an n-day event - * calendar, modeled off of the weekly view found in Google Calendar. - * @extends Timegrid.Layout - * @constructor - */ -Timegrid.NDayLayout = function(eventSource, params) { - Timegrid.NDayLayout.superclass.call(this, eventSource, params); - var self = this; - - // Specifications for a week layout - this.xSize = 7; - this.ySize = 24; - this.iterable = true; - - // These are default values that can be overridden in configure - this.n = 3; - - this.xMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - var start = self.timezoneMapper(self.startTime); - var ivl = new SimileAjax.DateTime.Interval(time - start); - return ivl.days; - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; - }; - - this.configure(params); - - this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); - this.xSize = this.n; - this.dayEnd = this.dayend || 24; - this.dayStart = this.daystart || 0; - this.ySize = this.dayEnd - this.dayStart; - this.computeCellSizes(); - - this.eventSource = eventSource; - this.initializeGrid(eventSource); -}; -Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); - -Timegrid.NDayLayout.prototype.initializeGrid = function() { - this.startTime = this.computeStartTime(); - this.startTime.setHours(0); - this.endTime = this.computeEndTime(this.startTime); - - this.updateGrid(); -}; - -Timegrid.NDayLayout.prototype.updateGrid = function() { - var now = new Date(); - if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } - - this.endpoints = []; - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); - this.endpoints.push(ends[0]); - this.endpoints.push(ends[1]); - } - } - this.endpoints.sort(function(a, b) { - var diff = a.time - b.time; - if (!diff) { - return a.type == "start" ? 1 : -1; - } else { - return diff; - } - }); -}; - -Timegrid.NDayLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - var currentEvents = {}; - var currentCount = 0; - for (var i = 0; i < this.endpoints.length; i++) { - var endpoint = this.endpoints[i]; - var x = this.xMapper(endpoint); - var y = this.yMapper(endpoint); - if (endpoint.type == "start") { - // Render the event - var eventDiv = this.renderEvent(endpoint.event, x, y); - eventContainer.appendChild(eventDiv); - // Push the event div onto the current events set - currentEvents[endpoint.event.getID()] = eventDiv; - currentCount++; - // Adjust widths and offsets as necessary - var hIndex = 0; - for (var id in currentEvents) { - var eDiv = currentEvents[id]; - var newWidth = this.xCell / currentCount; - var newLeft = this.xCell * x + newWidth * hIndex; - $(eDiv).css("width", newWidth + "px"); - $(eDiv).css("left", newLeft + "px"); - hIndex++; - } - } else if (endpoint.type == "end") { - // Pop event from current events set - delete currentEvents[endpoint.event.getID()]; - currentCount--; - } - } - var nowDiv = this.renderNow(); - if (nowDiv) { - return $([eventContainer, nowDiv]); - } else { - return eventContainer; - } -}; - -Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { - var ediv = document.createElement('div'); - var tediv = document.createElement('div'); - if (!this.mini) { tediv.innerHTML = evt.getText(); } - ediv.appendChild(tediv); - var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); - var className = "timegrid-event"; - if (!this.mini) { - className += ' timegrid-rounded-shadow'; - } - ediv.className = className; - ediv.style.height = this.yCell * length + "px"; - ediv.style.top = this.yCell * y + "px"; - ediv.style.left = this.xCell * x + 'px'; - if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } - if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } - return ediv; // Return the actual DOM element -}; - -Timegrid.NDayLayout.prototype.renderNow = function() { - // If we aren't looking at the current time, return - if (!this.now) { return; } - - var nowX = this.xMapper({ time: this.now }); - var nowY = Math.floor(this.yMapper({ time: this.now })); - - var rectDiv = $('
          ').addClass('timegrid-week-highlights'); - var yRect = $('
          ').height(this.yCell + "px") - .width(this.xCell * this.xSize + "px") - .css('top', nowY * this.yCell + "px") - .addClass('timegrid-week-highlight'); - var xRect = $('
          ').height(this.yCell * this.ySize + "px") - .width(this.xCell + "px") - .css('left', nowX * this.xCell + "px") - .addClass('timegrid-week-highlight'); - rectDiv.append(xRect).append(yRect); - return rectDiv.get(0); -}; - -Timegrid.NDayLayout.prototype.getXLabels = function() { - var date = new Date(this.startTime); - var labels = []; - var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : - Timegrid.NDayLayout.l10n.xLabelFormat; - while (date < this.endTime) { - labels.push(date.format(format)); - date.setHours(24); - } - return labels; -}; - -Timegrid.NDayLayout.prototype.getYLabels = function() { - var date = (new Date()).clearTime(); - var labels = []; - var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : - Timegrid.NDayLayout.l10n.yLabelFormat; - for (var i = +this.dayStart; i < +this.dayEnd; i++) { - date.setHours(i); - labels.push(date.format(format)); - } - return labels; -}; - -Timegrid.NDayLayout.prototype.goPrevious = function() { - this.endTime = this.startTime; - this.startTime = this.computeStartTime(this.endTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NDayLayout.prototype.goNext = function() { - this.startTime = this.endTime; - this.endTime = this.computeEndTime(this.startTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NDayLayout.prototype.getCurrent = function() { - this.endTime.add('s', -1); - var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, - this.endTime); - this.endTime.add('s', 1); - return result; -}; - -Timegrid.NDayLayout.prototype.computeStartTime = function(date) { - if (date) { - var startTime = new Date(date); - startTime.add('d', 0 - this.n); - startTime.setHours(0); - return startTime; - } else { - var startTime = new Date(this.eventSource.getEarliestDate()) || - new Date(); - startTime.clearTime(); - return startTime; - } -}; - -Timegrid.NDayLayout.prototype.computeEndTime = function(date) { - if (date) { - var endTime = new Date(date); - endTime.add('d', this.n); - endTime.setHours(0); - return endTime; - } - return false; -}; - -Timegrid.NDayLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; - +/****************************************************************************** + * NDayLayout + * @fileoverview + * This is where the n-day layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + *****************************************************************************/ + + /** + * Constructs an NDayLayout object. + * @class NDayLayout is a subclass of Layout that implements an n-day event + * calendar, modeled off of the weekly view found in Google Calendar. + * @extends Timegrid.Layout + * @constructor + */ +Timegrid.NDayLayout = function(eventSource, params) { + Timegrid.NDayLayout.superclass.call(this, eventSource, params); + var self = this; + + // Specifications for a week layout + this.xSize = 7; + this.ySize = 24; + this.iterable = true; + + // These are default values that can be overridden in configure + this.n = 3; + + this.xMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + var ivl = new SimileAjax.DateTime.Interval(time - start); + return ivl.days; + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); + this.xSize = this.n; + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + this.computeCellSizes(); + + this.eventSource = eventSource; + this.initializeGrid(eventSource); +}; +Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); + +Timegrid.NDayLayout.prototype.initializeGrid = function() { + this.startTime = this.computeStartTime(); + this.startTime.setHours(0); + this.endTime = this.computeEndTime(this.startTime); + + this.updateGrid(); +}; + +Timegrid.NDayLayout.prototype.updateGrid = function() { + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + + this.endpoints = []; + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); + this.endpoints.push(ends[0]); + this.endpoints.push(ends[1]); + } + } + this.endpoints.sort(function(a, b) { + var diff = a.time - b.time; + if (!diff) { + return a.type == "start" ? 1 : -1; + } else { + return diff; + } + }); +}; + +Timegrid.NDayLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (var i = 0; i < this.endpoints.length; i++) { + var endpoint = this.endpoints[i]; + var x = this.xMapper(endpoint); + var y = this.yMapper(endpoint); + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (var id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + var newLeft = this.xCell * x + newWidth * hIndex; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", newLeft + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + var nowDiv = this.renderNow(); + if (nowDiv) { + return $([eventContainer, nowDiv]); + } else { + return eventContainer; + } +}; + +Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { + var ediv = document.createElement('div'); + var tediv = document.createElement('div'); + if (!this.mini) { tediv.innerHTML = evt.getText(); } + ediv.appendChild(tediv); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + var className = "timegrid-event"; + if (!this.mini) { + className += ' timegrid-rounded-shadow'; + } + ediv.className = className; + ediv.style.height = this.yCell * length + "px"; + ediv.style.top = this.yCell * y + "px"; + ediv.style.left = this.xCell * x + 'px'; + if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } + if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } + return ediv; // Return the actual DOM element +}; + +Timegrid.NDayLayout.prototype.renderNow = function() { + // If we aren't looking at the current time, return + if (!this.now) { return; } + + var nowX = this.xMapper({ time: this.now }); + var nowY = Math.floor(this.yMapper({ time: this.now })); + + var rectDiv = $('
          ').addClass('timegrid-week-highlights'); + var yRect = $('
          ').height(this.yCell + "px") + .width(this.xCell * this.xSize + "px") + .css('top', nowY * this.yCell + "px") + .addClass('timegrid-week-highlight'); + var xRect = $('
          ').height(this.yCell * this.ySize + "px") + .width(this.xCell + "px") + .css('left', nowX * this.xCell + "px") + .addClass('timegrid-week-highlight'); + rectDiv.append(xRect).append(yRect); + return rectDiv.get(0); +}; + +Timegrid.NDayLayout.prototype.getXLabels = function() { + var date = new Date(this.startTime); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : + Timegrid.NDayLayout.l10n.xLabelFormat; + while (date < this.endTime) { + labels.push(date.format(format)); + date.setHours(24); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : + Timegrid.NDayLayout.l10n.yLabelFormat; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(format)); + } + return labels; +}; + +Timegrid.NDayLayout.prototype.goPrevious = function() { + this.endTime = this.startTime; + this.startTime = this.computeStartTime(this.endTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.goNext = function() { + this.startTime = this.endTime; + this.endTime = this.computeEndTime(this.startTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NDayLayout.prototype.getCurrent = function() { + this.endTime.add('s', -1); + var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, + this.endTime); + this.endTime.add('s', 1); + return result; +}; + +Timegrid.NDayLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.add('d', 0 - this.n); + startTime.setHours(0); + return startTime; + } else { + var startTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + startTime.clearTime(); + return startTime; + } +}; + +Timegrid.NDayLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.n); + endTime.setHours(0); + return endTime; + } + return false; +}; + +Timegrid.NDayLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/src/webapp/api/scripts/layouts/nmonth.js b/src/webapp/api/scripts/layouts/nmonth.js index 0238403..074581f 100644 --- a/src/webapp/api/scripts/layouts/nmonth.js +++ b/src/webapp/api/scripts/layouts/nmonth.js @@ -1,259 +1,259 @@ -/** - * NMonthLayout - * @fileoverview - * This is where the monthly layout is defined. The layout is designed to - * resemble the equivalent Google Calendar view. - * @author masont - */ - -Timegrid.NMonthLayout = function(eventSource, params) { - Timegrid.NMonthLayout.superclass.call(this, eventSource, params); - var self = this; - - this.xSize = 7; - this.ySize = 0; // This is re-calculated later based on n - this.n = 3; - this.iterable = true; - - this.configure(params); - // We put title here because it depends on this.n - this.title = this.title || Timegrid.NMonthLayout.l10n.makeTitle(this.n); - - // Initialize our eventSource - this.eventSource = eventSource; - - // Configure our mappers - this.xMapper = function(obj) { - return self.timezoneMapper(obj.time).getDay(); - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - var start = self.timezoneMapper(self.startTime); - // Simply divide by the number of milliseconds in a week - return Math.floor((time - start) / (1000 * 60 * 60 * 24 * 7.0)); - }; - - this.initializeGrid(); -}; -Timegrid.LayoutFactory.registerLayout("n-month", Timegrid.NMonthLayout); - -Timegrid.NMonthLayout.prototype.initializeGrid = function() { - this.startTime = this.eventSource.getEarliestDate() || new Date(); - this.dataStartTime = new Date(this.eventSource.getEarliestDate()) || - new Date(); - this.updateGrid(); -}; -Timegrid.NMonthLayout.prototype.updateGrid = function() { - this.computeDimensions(); - var now = new Date(); - if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } - this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, - this.xMapper, this.yMapper); - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var endpoints = Timegrid.NMonthLayout.getEndpoints(iterator.next()); - this.eventGrid.addAll(endpoints); - } - } -}; - -Timegrid.NMonthLayout.prototype.computeDimensions = function() { - this.startTime = this.computeStartTime(this.startTime); - - // Use a method to compute cell and y-labels (non-trivial). This method - // will also compute ySize based on n, an unfortunate grouping. - this.computeYSize(this.startTime); - this.computeLabels(this.startTime); - - this.endTime = this.computeEndTime(this.startTime); - - // Compute the cell sizes for the grid - this.computeCellSizes(); -}; - -Timegrid.NMonthLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - var labelContainer = doc.createElement("div"); - var colorContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - $(labelContainer).addClass("timegrid-month-labels"); - $(colorContainer).addClass("timegrid-month-colors"); - var i = 0; - var dates = this.cellLabels; - for (y = 0; y < this.ySize; y++) { - for (x = 0; x < this.xSize; x++) { - var endpoints = this.eventGrid.get(x,y); - var events = $.map(endpoints, function(e) { - return e.type == "start" ? e.event : null; - }); - var n = dates[i]; - var m = this.months[i]; - eventContainer.appendChild(this.renderEventList(events, x, y, - n, m)); - colorContainer.appendChild(this.renderCellColor(x, y, m)); - i++; - } - } - $(labelContainer).append($(this.renderMonthLabels())); - return $([eventContainer, labelContainer, colorContainer]); -}; - -Timegrid.NMonthLayout.prototype.renderEventList = function(evts, x, y, n, m) { - var jediv = $("
          ").addClass("timegrid-month-cell"); - var eList = $("
            ").addClass("timegrid-event-list"); - for (var i = 0; i < evts.length; i++) { - eList.append('
          • ' + evts[i].getText() + '
          • '); - } - jediv.append(eList); - jediv.append('' + n + ''); - jediv.css("height", this.yCell).css("width", this.xCell + "px"); - jediv.css("top", this.yCell * y); - jediv.css("left", this.xCell * x + 'px'); - return jediv.get()[0]; // Return the actual DOM element -}; - -Timegrid.NMonthLayout.prototype.renderCellColor = function(x, y, m) { - var jcdiv = $("
            ").addClass("timegrid-month-cell"); - jcdiv.addClass("timegrid-month-cell-" + (m % 2 ? "odd" : "even")); - jcdiv.css("height", this.yCell).css("width", this.xCell + "px"); - jcdiv.css("top", this.yCell * y); - jcdiv.css("left", this.xCell * x + "px"); - - if (this.now) { - var nowX = this.xMapper({ time: this.now }); - var nowY = this.yMapper({ time: this.now }); - if (x == nowX && y == nowY) { - jcdiv.addClass("timegrid-month-cell-now"); - } - } - - return jcdiv.get()[0]; - -}; - -Timegrid.NMonthLayout.prototype.renderMonthLabels = function() { - var self = this; - return $.map(this.monthStarts, function(monthStart) { - var monthString = monthStart.date.getMonthName(); - var mDiv = $('
            ' + monthString + '
            '); - mDiv.addClass('timegrid-month-label'); - mDiv.css('top', self.yCell * monthStart.i + "px"); - var height = monthStart.height * self.yCell; - mDiv.height(height + "px"); - mDiv.children().css('line-height', height + "px"); - return mDiv.get(0); - }); -}; - -Timegrid.NMonthLayout.prototype.highlightNow = function() { - var now = new Date(); - var x = this.xMapper({ time: now }); - var y = this.yMapper({ time: now }); -}; - -Timegrid.NMonthLayout.prototype.getXLabels = function() { - return Date.l10n.dayNames; -}; - -Timegrid.NMonthLayout.prototype.getYLabels = function() { - return this.yLabels; -}; - -Timegrid.NMonthLayout.prototype.goPrevious = function() { - this.dataStartTime.add('M', 0 - this.n); - this.startTime = new Date(this.dataStartTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NMonthLayout.prototype.goNext = function() { - this.dataStartTime.add('M', this.n); - this.startTime = new Date(this.dataStartTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NMonthLayout.prototype.getCurrent = function() { - var start = this.monthStarts[0].date; - var end = this.monthStarts[this.monthStarts.length - 1].date; - if (this.n > 1) { - return Timegrid.NMonthLayout.l10n.makeRange(start, end); - } else { - return Timegrid.NMonthLayout.l10n.makeRange(start); - } -}; - -Timegrid.NMonthLayout.prototype.computeStartTime = function(date) { - if (date) { - var startTime = new Date(date); - startTime.setDate(1); - startTime.setHours(0); - // Roll back to the first day on the grid - while (this.xMapper({ time: startTime }) > 0) { - startTime.setHours(-24); - } - return startTime; - } -}; - -Timegrid.NMonthLayout.prototype.computeEndTime = function(date) { - if (date) { - var endTime = new Date(date); - endTime.add('d', this.ySize * 7); - return endTime; - } - return false; -}; - -Timegrid.NMonthLayout.prototype.computeYSize = function(date) { - var gridStart = { time: new Date(date) }; - var month = this.dataStartTime.getMonth(); - this.ySize = 0; - this.monthStarts = [{ i: this.ySize, date: new Date(this.dataStartTime) }]; - while (this.xMapper(gridStart) > 0 && this.yMapper(gridStart) >= 0) { - gridStart.time.setHours(-24); - } - gridStart.time.add('d', 7); - for (; this.monthStarts.length <= this.n; gridStart.time.add('d', 7)) { - if (gridStart.time.getMonth() != month) { - month = gridStart.time.getMonth(); - var year = gridStart.time.getFullYear(); - this.monthStarts.push({i: this.ySize, date: new Date(gridStart.time)}); - var old = this.monthStarts[this.monthStarts.length - 2]; - old.height = this.ySize - old.i + 1; - } - this.ySize++; - } - this.monthStarts.pop(); -}; - -Timegrid.NMonthLayout.prototype.computeLabels = function(date) { - var gridStart = { time: new Date(date) }; - this.cellLabels = []; - this.months = []; - this.yLabels = []; - - // Iterate through and collect the tasty data - while (this.xMapper(gridStart) < this.xSize && - this.yMapper(gridStart) < this.ySize) { - var d = gridStart.time; - this.cellLabels.push(d.getDate()); - this.months.push(d.getMonth()); - if (d.getDay() == 0) { - this.yLabels.push(d.format(Timegrid.NMonthLayout.l10n.yLabelFormat)); - } - d.setHours(24); - } -}; - -Timegrid.NMonthLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; - +/** + * NMonthLayout + * @fileoverview + * This is where the monthly layout is defined. The layout is designed to + * resemble the equivalent Google Calendar view. + * @author masont + */ + +Timegrid.NMonthLayout = function(eventSource, params) { + Timegrid.NMonthLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 7; + this.ySize = 0; // This is re-calculated later based on n + this.n = 3; + this.iterable = true; + + this.configure(params); + // We put title here because it depends on this.n + this.title = this.title || Timegrid.NMonthLayout.l10n.makeTitle(this.n); + + // Initialize our eventSource + this.eventSource = eventSource; + + // Configure our mappers + this.xMapper = function(obj) { + return self.timezoneMapper(obj.time).getDay(); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + var start = self.timezoneMapper(self.startTime); + // Simply divide by the number of milliseconds in a week + return Math.floor((time - start) / (1000 * 60 * 60 * 24 * 7.0)); + }; + + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("n-month", Timegrid.NMonthLayout); + +Timegrid.NMonthLayout.prototype.initializeGrid = function() { + this.startTime = this.eventSource.getEarliestDate() || new Date(); + this.dataStartTime = new Date(this.eventSource.getEarliestDate()) || + new Date(); + this.updateGrid(); +}; +Timegrid.NMonthLayout.prototype.updateGrid = function() { + this.computeDimensions(); + var now = new Date(); + if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var endpoints = Timegrid.NMonthLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(endpoints); + } + } +}; + +Timegrid.NMonthLayout.prototype.computeDimensions = function() { + this.startTime = this.computeStartTime(this.startTime); + + // Use a method to compute cell and y-labels (non-trivial). This method + // will also compute ySize based on n, an unfortunate grouping. + this.computeYSize(this.startTime); + this.computeLabels(this.startTime); + + this.endTime = this.computeEndTime(this.startTime); + + // Compute the cell sizes for the grid + this.computeCellSizes(); +}; + +Timegrid.NMonthLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + var labelContainer = doc.createElement("div"); + var colorContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + $(labelContainer).addClass("timegrid-month-labels"); + $(colorContainer).addClass("timegrid-month-colors"); + var i = 0; + var dates = this.cellLabels; + for (y = 0; y < this.ySize; y++) { + for (x = 0; x < this.xSize; x++) { + var endpoints = this.eventGrid.get(x,y); + var events = $.map(endpoints, function(e) { + return e.type == "start" ? e.event : null; + }); + var n = dates[i]; + var m = this.months[i]; + eventContainer.appendChild(this.renderEventList(events, x, y, + n, m)); + colorContainer.appendChild(this.renderCellColor(x, y, m)); + i++; + } + } + $(labelContainer).append($(this.renderMonthLabels())); + return $([eventContainer, labelContainer, colorContainer]); +}; + +Timegrid.NMonthLayout.prototype.renderEventList = function(evts, x, y, n, m) { + var jediv = $("
            ").addClass("timegrid-month-cell"); + var eList = $("
              ").addClass("timegrid-event-list"); + for (var i = 0; i < evts.length; i++) { + eList.append('
            • ' + evts[i].getText() + '
            • '); + } + jediv.append(eList); + jediv.append('' + n + ''); + jediv.css("height", this.yCell).css("width", this.xCell + "px"); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.NMonthLayout.prototype.renderCellColor = function(x, y, m) { + var jcdiv = $("
              ").addClass("timegrid-month-cell"); + jcdiv.addClass("timegrid-month-cell-" + (m % 2 ? "odd" : "even")); + jcdiv.css("height", this.yCell).css("width", this.xCell + "px"); + jcdiv.css("top", this.yCell * y); + jcdiv.css("left", this.xCell * x + "px"); + + if (this.now) { + var nowX = this.xMapper({ time: this.now }); + var nowY = this.yMapper({ time: this.now }); + if (x == nowX && y == nowY) { + jcdiv.addClass("timegrid-month-cell-now"); + } + } + + return jcdiv.get()[0]; + +}; + +Timegrid.NMonthLayout.prototype.renderMonthLabels = function() { + var self = this; + return $.map(this.monthStarts, function(monthStart) { + var monthString = monthStart.date.getMonthName(); + var mDiv = $('
              ' + monthString + '
              '); + mDiv.addClass('timegrid-month-label'); + mDiv.css('top', self.yCell * monthStart.i + "px"); + var height = monthStart.height * self.yCell; + mDiv.height(height + "px"); + mDiv.children().css('line-height', height + "px"); + return mDiv.get(0); + }); +}; + +Timegrid.NMonthLayout.prototype.highlightNow = function() { + var now = new Date(); + var x = this.xMapper({ time: now }); + var y = this.yMapper({ time: now }); +}; + +Timegrid.NMonthLayout.prototype.getXLabels = function() { + return Date.l10n.dayNames; +}; + +Timegrid.NMonthLayout.prototype.getYLabels = function() { + return this.yLabels; +}; + +Timegrid.NMonthLayout.prototype.goPrevious = function() { + this.dataStartTime.add('M', 0 - this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.goNext = function() { + this.dataStartTime.add('M', this.n); + this.startTime = new Date(this.dataStartTime); + this.updateGrid(); + this.render(); +}; + +Timegrid.NMonthLayout.prototype.getCurrent = function() { + var start = this.monthStarts[0].date; + var end = this.monthStarts[this.monthStarts.length - 1].date; + if (this.n > 1) { + return Timegrid.NMonthLayout.l10n.makeRange(start, end); + } else { + return Timegrid.NMonthLayout.l10n.makeRange(start); + } +}; + +Timegrid.NMonthLayout.prototype.computeStartTime = function(date) { + if (date) { + var startTime = new Date(date); + startTime.setDate(1); + startTime.setHours(0); + // Roll back to the first day on the grid + while (this.xMapper({ time: startTime }) > 0) { + startTime.setHours(-24); + } + return startTime; + } +}; + +Timegrid.NMonthLayout.prototype.computeEndTime = function(date) { + if (date) { + var endTime = new Date(date); + endTime.add('d', this.ySize * 7); + return endTime; + } + return false; +}; + +Timegrid.NMonthLayout.prototype.computeYSize = function(date) { + var gridStart = { time: new Date(date) }; + var month = this.dataStartTime.getMonth(); + this.ySize = 0; + this.monthStarts = [{ i: this.ySize, date: new Date(this.dataStartTime) }]; + while (this.xMapper(gridStart) > 0 && this.yMapper(gridStart) >= 0) { + gridStart.time.setHours(-24); + } + gridStart.time.add('d', 7); + for (; this.monthStarts.length <= this.n; gridStart.time.add('d', 7)) { + if (gridStart.time.getMonth() != month) { + month = gridStart.time.getMonth(); + var year = gridStart.time.getFullYear(); + this.monthStarts.push({i: this.ySize, date: new Date(gridStart.time)}); + var old = this.monthStarts[this.monthStarts.length - 2]; + old.height = this.ySize - old.i + 1; + } + this.ySize++; + } + this.monthStarts.pop(); +}; + +Timegrid.NMonthLayout.prototype.computeLabels = function(date) { + var gridStart = { time: new Date(date) }; + this.cellLabels = []; + this.months = []; + this.yLabels = []; + + // Iterate through and collect the tasty data + while (this.xMapper(gridStart) < this.xSize && + this.yMapper(gridStart) < this.ySize) { + var d = gridStart.time; + this.cellLabels.push(d.getDate()); + this.months.push(d.getMonth()); + if (d.getDay() == 0) { + this.yLabels.push(d.format(Timegrid.NMonthLayout.l10n.yLabelFormat)); + } + d.setHours(24); + } +}; + +Timegrid.NMonthLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; + diff --git a/src/webapp/api/scripts/layouts/property.js b/src/webapp/api/scripts/layouts/property.js index 1488fcf..72307b8 100644 --- a/src/webapp/api/scripts/layouts/property.js +++ b/src/webapp/api/scripts/layouts/property.js @@ -1,150 +1,150 @@ -/** - * @name Timegrid.PropertyLayout - * @author masont - */ - -/** - * PropertyLayout is a subclass of Layout that provides Timegrid with layouts - * that place events into rows and columns based on arbitrary properties, in - * addition to temporal values (hour, day, week, etc.). - * - * @constructor - */ -Timegrid.PropertyLayout = function(eventSource, params) { - Timegrid.PropertyLayout.superclass.call(this, eventSource, params); - var self = this; - - this.xSize = 0; - this.ySize = 0; - this.iterable = false; - this.title = Timegrid.PropertyLayout.l10n.makeTitle(); - this.property = "title"; - - this.xMapper = function(obj) { - return self.values.indexOf(obj.event.getProperty(self.property)); - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; - }; - - this.configure(params); - - this.dayEnd = this.dayend || 24; - this.dayStart = this.daystart || 0; - this.ySize = this.dayEnd - this.dayStart; - - this.eventSource = eventSource; - this.initializeGrid(); -}; -Timegrid.LayoutFactory.registerLayout("property", Timegrid.PropertyLayout); - -Timegrid.PropertyLayout.prototype.initializeGrid = function() { - this.startTime = new Date(this.eventSource.getEarliestDate()) || new Date(); - this.endTime = new Date(this.eventSource.getLatestDate()) || new Date(); - this.values = new DStructs.Array(); - this.updateGrid(); -}; - -Timegrid.PropertyLayout.prototype.updateGrid = function() { - this.computeDimensions(); - this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, - this.xMapper, this.yMapper); - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var eps = Timegrid.PropertyLayout.getEndpoints(iterator.next()); - this.eventGrid.addAll(eps); - } - } -}; - -Timegrid.PropertyLayout.prototype.computeDimensions = function() { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - this.values.clear(); - while (iterator.hasNext()) { - this.values.push(iterator.next().getProperty(this.property)); - } - this.values = this.values.uniq(); - this.xSize = this.values.length; -}; - -Timegrid.PropertyLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - var currentEvents = {}; - var currentCount = 0; - for (x = 0; x < this.xSize; x++) { - for (y = 0; y < this.ySize; y++) { - var endpoints = this.eventGrid.get(x,y).sort(function(a, b) { - return a.time - b.time; - }); - for (var i = 0; i < endpoints.length; i++) { - var endpoint = endpoints[i]; - if (endpoint.type == "start") { - // Render the event - var eventDiv = this.renderEvent(endpoint.event, x, y); - eventContainer.appendChild(eventDiv); - // Push the event div onto the current events set - currentEvents[endpoint.event.getID()] = eventDiv; - currentCount++; - // Adjust widths and offsets as necessary - var hIndex = 0; - for (id in currentEvents) { - var eDiv = currentEvents[id]; - var newWidth = this.xCell / currentCount; - $(eDiv).css("width", newWidth + "px"); - $(eDiv).css("left", this.xCell * x + newWidth * hIndex + "px"); - hIndex++; - } - } else if (endpoint.type == "end") { - // Pop event from current events set - delete currentEvents[endpoint.event.getID()]; - currentCount--; - } - } - } - } - return eventContainer; -}; - -Timegrid.PropertyLayout.prototype.renderEvent = function(evt, x, y) { - var jediv = this.mini ? $("
              ") : - $("
              " + evt.getText() + "
              "); - var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); - jediv.addClass("timegrid-event"); - if (!this.mini) { - jediv.addClass('timegrid-rounded-shadow'); - } - jediv.css("height", this.yCell * length); - jediv.css("top", this.yCell * y); - jediv.css("left", this.xCell * x + 'px'); - if (evt.getColor()) { jediv.css('background-color', evt.getColor()); } - if (evt.getTextColor()) { jediv.css('color', evt.getTextColor()); } - return jediv.get()[0]; // Return the actual DOM element -}; - -Timegrid.PropertyLayout.prototype.getXLabels = function() { - return this.values; -}; - -Timegrid.PropertyLayout.prototype.getYLabels = function() { - var date = (new Date()).clearTime(); - var labels = []; - for (var i = +this.dayStart; i < +this.dayEnd; i++) { - date.setHours(i); - labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); - } - return labels; -}; - -Timegrid.PropertyLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; +/** + * @name Timegrid.PropertyLayout + * @author masont + */ + +/** + * PropertyLayout is a subclass of Layout that provides Timegrid with layouts + * that place events into rows and columns based on arbitrary properties, in + * addition to temporal values (hour, day, week, etc.). + * + * @constructor + */ +Timegrid.PropertyLayout = function(eventSource, params) { + Timegrid.PropertyLayout.superclass.call(this, eventSource, params); + var self = this; + + this.xSize = 0; + this.ySize = 0; + this.iterable = false; + this.title = Timegrid.PropertyLayout.l10n.makeTitle(); + this.property = "title"; + + this.xMapper = function(obj) { + return self.values.indexOf(obj.event.getProperty(self.property)); + }; + this.yMapper = function(obj) { + var time = self.timezoneMapper(obj.time); + return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; + }; + + this.configure(params); + + this.dayEnd = this.dayend || 24; + this.dayStart = this.daystart || 0; + this.ySize = this.dayEnd - this.dayStart; + + this.eventSource = eventSource; + this.initializeGrid(); +}; +Timegrid.LayoutFactory.registerLayout("property", Timegrid.PropertyLayout); + +Timegrid.PropertyLayout.prototype.initializeGrid = function() { + this.startTime = new Date(this.eventSource.getEarliestDate()) || new Date(); + this.endTime = new Date(this.eventSource.getLatestDate()) || new Date(); + this.values = new DStructs.Array(); + this.updateGrid(); +}; + +Timegrid.PropertyLayout.prototype.updateGrid = function() { + this.computeDimensions(); + this.eventGrid = new Timegrid.Grid([], this.xSize, this.ySize, + this.xMapper, this.yMapper); + if (this.startTime) { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + while (iterator.hasNext()) { + var eps = Timegrid.PropertyLayout.getEndpoints(iterator.next()); + this.eventGrid.addAll(eps); + } + } +}; + +Timegrid.PropertyLayout.prototype.computeDimensions = function() { + var iterator = this.eventSource.getEventIterator(this.startTime, + this.endTime); + this.values.clear(); + while (iterator.hasNext()) { + this.values.push(iterator.next().getProperty(this.property)); + } + this.values = this.values.uniq(); + this.xSize = this.values.length; +}; + +Timegrid.PropertyLayout.prototype.renderEvents = function(doc) { + var eventContainer = doc.createElement("div"); + $(eventContainer).addClass("timegrid-events"); + var currentEvents = {}; + var currentCount = 0; + for (x = 0; x < this.xSize; x++) { + for (y = 0; y < this.ySize; y++) { + var endpoints = this.eventGrid.get(x,y).sort(function(a, b) { + return a.time - b.time; + }); + for (var i = 0; i < endpoints.length; i++) { + var endpoint = endpoints[i]; + if (endpoint.type == "start") { + // Render the event + var eventDiv = this.renderEvent(endpoint.event, x, y); + eventContainer.appendChild(eventDiv); + // Push the event div onto the current events set + currentEvents[endpoint.event.getID()] = eventDiv; + currentCount++; + // Adjust widths and offsets as necessary + var hIndex = 0; + for (id in currentEvents) { + var eDiv = currentEvents[id]; + var newWidth = this.xCell / currentCount; + $(eDiv).css("width", newWidth + "px"); + $(eDiv).css("left", this.xCell * x + newWidth * hIndex + "px"); + hIndex++; + } + } else if (endpoint.type == "end") { + // Pop event from current events set + delete currentEvents[endpoint.event.getID()]; + currentCount--; + } + } + } + } + return eventContainer; +}; + +Timegrid.PropertyLayout.prototype.renderEvent = function(evt, x, y) { + var jediv = this.mini ? $("
              ") : + $("
              " + evt.getText() + "
              "); + var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); + jediv.addClass("timegrid-event"); + if (!this.mini) { + jediv.addClass('timegrid-rounded-shadow'); + } + jediv.css("height", this.yCell * length); + jediv.css("top", this.yCell * y); + jediv.css("left", this.xCell * x + 'px'); + if (evt.getColor()) { jediv.css('background-color', evt.getColor()); } + if (evt.getTextColor()) { jediv.css('color', evt.getTextColor()); } + return jediv.get()[0]; // Return the actual DOM element +}; + +Timegrid.PropertyLayout.prototype.getXLabels = function() { + return this.values; +}; + +Timegrid.PropertyLayout.prototype.getYLabels = function() { + var date = (new Date()).clearTime(); + var labels = []; + for (var i = +this.dayStart; i < +this.dayEnd; i++) { + date.setHours(i); + labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); + } + return labels; +}; + +Timegrid.PropertyLayout.getEndpoints = function(evt) { + return [ { type: "start", + time: evt.getStart(), + event: evt }, + { type: "end", + time: evt.getEnd(), + event: evt } ]; +}; diff --git a/src/webapp/api/scripts/listeners.js b/src/webapp/api/scripts/listeners.js index f1d161d..0c63df8 100644 --- a/src/webapp/api/scripts/listeners.js +++ b/src/webapp/api/scripts/listeners.js @@ -1,29 +1,29 @@ -Timegrid.ListenerAware = function() { - this._listeners = []; -}; - -Timegrid.ListenerAware.prototype.addListener = function(listener) { - this._listeners.push(listener); -}; - -Timegrid.ListenerAware.prototype.removeListener = function(listener) { - for (var i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] == listener) { - this._listeners.splice(i, 1); - break; - } - } -}; - -Timegrid.ListenerAware.prototype._fire = function(handlerName, args) { - for (var i = 0; i < this._listeners.length; i++) { - var listener = this._listeners[i]; - if (handlerName in listener) { - try { - listener[handlerName].apply(listener, args); - } catch (e) { - Timegrid.Debug.exception(e); - } - } - } +Timegrid.ListenerAware = function() { + this._listeners = []; +}; + +Timegrid.ListenerAware.prototype.addListener = function(listener) { + this._listeners.push(listener); +}; + +Timegrid.ListenerAware.prototype.removeListener = function(listener) { + for (var i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] == listener) { + this._listeners.splice(i, 1); + break; + } + } +}; + +Timegrid.ListenerAware.prototype._fire = function(handlerName, args) { + for (var i = 0; i < this._listeners.length; i++) { + var listener = this._listeners[i]; + if (handlerName in listener) { + try { + listener[handlerName].apply(listener, args); + } catch (e) { + Timegrid.Debug.exception(e); + } + } + } }; \ No newline at end of file diff --git a/src/webapp/api/scripts/sources/recurring.js b/src/webapp/api/scripts/sources/recurring.js index 8f456ff..d881baf 100644 --- a/src/webapp/api/scripts/sources/recurring.js +++ b/src/webapp/api/scripts/sources/recurring.js @@ -1,136 +1,136 @@ -/** - * @name Timegrid.RecurringEventSource - * @author masont - */ - -/** - * A type of EventSource that allows the creation and display of recurring - * events that are not tied to a specific date, e.g. 8am on MWF. - * - * @constructor - */ -Timegrid.RecurringEventSource = function() { - Timegrid.RecurringEventSource.superclass.call(this); - - /* - * The actual array containing event prototypes is kept private, and only - * accessed/modified through priviledged methods created here, in the - * constructor. - */ - var eventPrototypes = new DStructs.Array(); - - //========================= Privileged Methods ==========================// - - /** Sets this source's event prototypes to the given prototypes */ - this.setEventPrototypes = function(a) { - eventPrototypes.clear(); - this.addAllEventPrototypes(a); - }; - - /** Adds the given event prototype to this event source */ - this.addEventPrototype = function(eventPrototype) { - eventPrototypes.push(eventPrototype); - this._fire("onAddMany", []); - }; - - /** Adds all of the event prototypes from the given array */ - this.addAllEventPrototypes = function(a) { - eventPrototypes.addAll(a); - this._fire("onAddMany", []); - }; - - /** Removes the given event prototype from this source's prototypes */ - this.removeEventPrototype = function(eventPrototype) { - return eventPrototypes.remove(eventPrototype); - }; - - /** Removes all of the event prototypes from this source */ - this.clearEventPrototypes = function() { - eventPrototypes.clear(); - this._fire("onClear", []); - }; - - /** Generates events from event prototypes */ - this.generateEvents = function(startDate, endDate) { - var result = new DStructs.Array(); - eventPrototypes.each(function(ep) { - result.addAll(ep.generateEvents(startDate, endDate)); - }); - return result; - }; -}; -$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); - -Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { - -}; -Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { - -}; -Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { - return this.generateEvents(startDate, endDate).iterator(); -}; -Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { - return (new Date()).clearTime().setDay(0); -}; -Timegrid.RecurringEventSource.prototype.getLatestDate = function() { - return (new Date()).clearTime().setDay(7); -}; - -Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, - text, description, image, link, icon, color, textColor) { - var id = "e" + Math.floor(Math.random() * 1000000); - var days = new DStructs.Array(); days.addAll(dayArray); - - this.getDays = function() { return days; }; - this.getStart = function() { return start; }; - this.getEnd = function() { return end; }; - - this.getID = function() { return id; } - this.getText = function() { - return SimileAjax.HTML.deEntify(text); - }; - this.getDescription = function() { - return SimileAjax.HTML.deEntify(description); - }; - this.getImage = function() { - return (image != null && image != "") ? image : null; - }; - this.getLink = function() { - return (link != null && link != "") ? link : null; - }; - this.getIcon = function() { - return (icon != null && icon != "") ? icon : null; - }; - this.getColor = function() { - return (color != null && color != "") ? color : null; - }; - this.getTextColor = function() { - return (textColor != null && textColor != "") ? textColor : null; - } - this.generateFrom = function(date) { - if (!this.getDays().contains(date.getDay())) { return false; } - var startTime = new Date(this.getStart()); - var endTime = new Date(this.getEnd()); - startTime.setDate(date.getDate()); - startTime.setMonth(date.getMonth()); - startTime.setFullYear(date.getFullYear()); - endTime.setDate(date.getDate()); - endTime.setMonth(date.getMonth()); - endTime.setFullYear(date.getFullYear()); - return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, - null, false, text, description, image, link, icon, color, - textColor); - }; -}; - -Timegrid.RecurringEventSource.EventPrototype.prototype = { - generateEvents: function(start, end) { - var events = new DStructs.Array(); - for (var date = new Date(start); date < end; date.add('d', 1)) { - var event = this.generateFrom(date); - if (event) { events.push(event); } - } - return events; - } -}; +/** + * @name Timegrid.RecurringEventSource + * @author masont + */ + +/** + * A type of EventSource that allows the creation and display of recurring + * events that are not tied to a specific date, e.g. 8am on MWF. + * + * @constructor + */ +Timegrid.RecurringEventSource = function() { + Timegrid.RecurringEventSource.superclass.call(this); + + /* + * The actual array containing event prototypes is kept private, and only + * accessed/modified through priviledged methods created here, in the + * constructor. + */ + var eventPrototypes = new DStructs.Array(); + + //========================= Privileged Methods ==========================// + + /** Sets this source's event prototypes to the given prototypes */ + this.setEventPrototypes = function(a) { + eventPrototypes.clear(); + this.addAllEventPrototypes(a); + }; + + /** Adds the given event prototype to this event source */ + this.addEventPrototype = function(eventPrototype) { + eventPrototypes.push(eventPrototype); + this._fire("onAddMany", []); + }; + + /** Adds all of the event prototypes from the given array */ + this.addAllEventPrototypes = function(a) { + eventPrototypes.addAll(a); + this._fire("onAddMany", []); + }; + + /** Removes the given event prototype from this source's prototypes */ + this.removeEventPrototype = function(eventPrototype) { + return eventPrototypes.remove(eventPrototype); + }; + + /** Removes all of the event prototypes from this source */ + this.clearEventPrototypes = function() { + eventPrototypes.clear(); + this._fire("onClear", []); + }; + + /** Generates events from event prototypes */ + this.generateEvents = function(startDate, endDate) { + var result = new DStructs.Array(); + eventPrototypes.each(function(ep) { + result.addAll(ep.generateEvents(startDate, endDate)); + }); + return result; + }; +}; +$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); + +Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { + +}; +Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { + +}; +Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { + return this.generateEvents(startDate, endDate).iterator(); +}; +Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { + return (new Date()).clearTime().setDay(0); +}; +Timegrid.RecurringEventSource.prototype.getLatestDate = function() { + return (new Date()).clearTime().setDay(7); +}; + +Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, + text, description, image, link, icon, color, textColor) { + var id = "e" + Math.floor(Math.random() * 1000000); + var days = new DStructs.Array(); days.addAll(dayArray); + + this.getDays = function() { return days; }; + this.getStart = function() { return start; }; + this.getEnd = function() { return end; }; + + this.getID = function() { return id; } + this.getText = function() { + return SimileAjax.HTML.deEntify(text); + }; + this.getDescription = function() { + return SimileAjax.HTML.deEntify(description); + }; + this.getImage = function() { + return (image != null && image != "") ? image : null; + }; + this.getLink = function() { + return (link != null && link != "") ? link : null; + }; + this.getIcon = function() { + return (icon != null && icon != "") ? icon : null; + }; + this.getColor = function() { + return (color != null && color != "") ? color : null; + }; + this.getTextColor = function() { + return (textColor != null && textColor != "") ? textColor : null; + } + this.generateFrom = function(date) { + if (!this.getDays().contains(date.getDay())) { return false; } + var startTime = new Date(this.getStart()); + var endTime = new Date(this.getEnd()); + startTime.setDate(date.getDate()); + startTime.setMonth(date.getMonth()); + startTime.setFullYear(date.getFullYear()); + endTime.setDate(date.getDate()); + endTime.setMonth(date.getMonth()); + endTime.setFullYear(date.getFullYear()); + return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, + null, false, text, description, image, link, icon, color, + textColor); + }; +}; + +Timegrid.RecurringEventSource.EventPrototype.prototype = { + generateEvents: function(start, end) { + var events = new DStructs.Array(); + for (var date = new Date(start); date < end; date.add('d', 1)) { + var event = this.generateFrom(date); + if (event) { events.push(event); } + } + return events; + } +}; diff --git a/src/webapp/api/scripts/util/jquery.corner.js b/src/webapp/api/scripts/util/jquery.corner.js index a7397c8..57771b6 100644 --- a/src/webapp/api/scripts/util/jquery.corner.js +++ b/src/webapp/api/scripts/util/jquery.corner.js @@ -1,253 +1,253 @@ - // jquery-roundcorners-canvas - // www.meerbox.nl - -(function($){ - - var _corner = function(options) { - - // no native canvas support, or its msie and excanvas.js not loaded - var testcanvas = document.createElement("canvas"); - if (typeof G_vmlCanvasManager == 'undefined' && $.browser.msie) { - return this.each(function() {}); - } - - // get lowest number from array - var asNum = function(a, b) { return a-b; }; - var getMin = function(a) { - var b = a.concat(); - return b.sort(asNum)[0]; - }; - - // get CSS value as integer - var getCSSint = function(el, prop) { - return parseInt($.css(el.jquery?el[0]:el,prop))||0; - }; - - // draw the round corner in Canvas object - var drawRoundCornerCanvasShape = function(canvas,radius,r_type,bg_color,border_width,border_color) { - - // change rgba(1,2,3,0.9) to rgb(1,2,3) - var reg = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/; - var bits = reg.exec(bg_color); - if (bits) { - channels = new Array(parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])); - bg_color = 'rgb('+channels[0]+', '+channels[1]+', '+channels[2]+')'; - } - - var border_width = parseInt(border_width); - - var ctx = canvas.getContext('2d'); - - if (radius == 1) { - ctx.fillStyle = bg_color; - ctx.fillRect(0,0,1,1); - return; - } - - if (r_type == 'tl') { - var steps = new Array(0,0,radius,0,radius,0,0,radius,0,0); - } else if (r_type == 'tr') { - var steps = new Array(radius,0,radius,radius,radius,0,0,0,0,0); - } else if (r_type == 'bl') { - var steps = new Array(0,radius,radius,radius,0,radius,0,0,0,radius); - } else if (r_type == 'br') { - var steps = new Array(radius,radius,radius,0,radius,0,0,radius,radius,radius); - } - - ctx.fillStyle = bg_color; - ctx.beginPath(); - ctx.moveTo(steps[0],steps[1]); - ctx.lineTo(steps[2], steps[3]); - if(r_type == 'br') ctx.bezierCurveTo(steps[4], steps[5], radius, radius, steps[6], steps[7]); - else ctx.bezierCurveTo(steps[4], steps[5], 0, 0, steps[6], steps[7]); - ctx.lineTo(steps[8], steps[9]); - ctx.fill(); - - // draw border - if (border_width > 0 && border_width < radius) { - - // offset caused by border - var offset = border_width/2; - - if (r_type == 'tl') { - var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset); - var curve_to = new Array(0,0); - } else if (r_type == 'tr') { - var steps = new Array(radius-offset,radius-offset,radius-offset,offset,offset,offset); - var curve_to = new Array(0,0); - } else if (r_type == 'bl') { - var steps = new Array(radius-offset,radius-offset,offset,radius-offset,offset,offset,offset,radius-offset); - var curve_to = new Array(0,0); - } else if (r_type == 'br') { - var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset,radius-offset,radius-offset); - var curve_to = new Array(radius, radius); - } - - ctx.strokeStyle = border_color; - ctx.lineWidth = border_width; - ctx.beginPath(); - // go to corner to begin curve - ctx.moveTo(steps[0], steps[1]); - // curve from righttop to leftbottom (for the tl canvas) - ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); - ctx.stroke(); - - } - }; - - var creatCanvas = function(p,radius) { - var elm = document.createElement('canvas'); - elm.setAttribute("height", radius); - elm.setAttribute("width", radius); - elm.style.display = "block"; - elm.style.position = "absolute"; - elm.className = "cornercanvas"; - elm = p.appendChild(elm); - // if G_vmlCanvasManager in defined the browser (ie only) has loaded excanvas.js - if (!elm.getContext && typeof G_vmlCanvasManager != 'undefined') { - var elm = G_vmlCanvasManager.initElement(elm); - } - return elm; - }; - - // interpret the (string) argument - var o = (options || "").toLowerCase(); - var radius = parseInt((o.match(/(\d+)px/)||[])[1]) || null; // corner width - var bg_color = ((o.match(/(#[0-9a-f]+)/)||[])[1]); // strip color - if (radius == null) { radius = "auto"; } - - var edges = { T:0, B:1 }; - var opts = { - tl: /top|tl/.test(o), - tr: /top|tr/.test(o), - bl: /bottom|bl/.test(o), - br: /bottom|br/.test(o) - }; - if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) { - opts = { tl:1, tr:1, bl:1, br:1 }; - } - - return this.each(function() { - - var elm = $(this); - - // give the element 'haslayout' - if ($.browser.msie) { this.style.zoom = 1; } - - // the size of the corner is not defined... - var widthheight_smallest = getMin(new Array(getCSSint(this,'height'),getCSSint(this,'width'))); - if (radius == "auto") { - radius = widthheight_smallest/4; - if (radius > 10) { radius = 10; } - } - - // the size of the corner can't be to high - if (widthheight_smallest < radius) { - radius = (widthheight_smallest/2); - } - - // remove old canvas objects - elm.children("canvas.cornercanvas").remove(); - - // some css thats required in order to position the canvas elements - if (elm.css('position') == 'static') { - elm.css('position','relative'); - // only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode - } else if (elm.css('position') == 'fixed' && $.browser.msie && !(document.compatMode == 'CSS1Compat' && typeof document.body.style.maxHeight != "undefined")) { - elm.css('position','absolute'); - } - elm.css('overflow','visible'); - - // get border width - var border_t = getCSSint(this, 'borderTopWidth'); - var border_r = getCSSint(this, 'borderRightWidth'); - var border_b = getCSSint(this, 'borderBottomWidth'); - var border_l = getCSSint(this, 'borderLeftWidth'); - - // get the lowest borderwidth of the corners in use - var bordersWidth = new Array(); - if (opts.tl || opts.tr) { bordersWidth.push(border_t); } - if (opts.br || opts.tr) { bordersWidth.push(border_r); } - if (opts.br || opts.bl) { bordersWidth.push(border_b); } - if (opts.bl || opts.tl) { bordersWidth.push(border_l); } - - borderswidth_smallest = getMin(bordersWidth); - - // creat the canvas elements and position them - var p_top = 0-border_t; - var p_right = 0-border_r; - var p_bottom = 0-border_b; - var p_left = 0-border_l; - - if (opts.tl) { var tl = $(creatCanvas(this,radius)).css({left:p_left,top:p_top}).get(0); } - if (opts.tr) { var tr = $(creatCanvas(this,radius)).css({right:p_right,top:p_top}).get(0); } - if (opts.bl) { var bl = $(creatCanvas(this,radius)).css({left:p_left,bottom:p_bottom}).get(0); } - if (opts.br) { var br = $(creatCanvas(this,radius)).css({right:p_right,bottom:p_bottom}).get(0); } - - // get the background color of parent element - - if (bg_color == undefined) { - - var current_p = elm.parent(); - var bg = current_p.css('background-color'); - while((bg == "transparent" || bg == "rgba(0, 0, 0, 0)") && current_p.get(0).tagName.toLowerCase() != "html") { - bg = current_p.css('background-color'); - current_p = current_p.parent(); - } - } else { - bg = bg_color; - } - - if (bg == "transparent" || bg == "rgba(0, 0, 0, 0)") { bg = "#ffffff"; } - - if (opts.tl) { drawRoundCornerCanvasShape(tl,radius,'tl',bg,borderswidth_smallest,elm.css('borderTopColor')); } - if (opts.tr) { drawRoundCornerCanvasShape(tr,radius,'tr',bg,borderswidth_smallest,elm.css('borderTopColor')); } - if (opts.bl) { drawRoundCornerCanvasShape(bl,radius,'bl',bg,borderswidth_smallest,elm.css('borderBottomColor')); } - if (opts.br) { drawRoundCornerCanvasShape(br,radius,'br',bg,borderswidth_smallest,elm.css('borderBottomColor')); } - - elm.addClass('roundCornersParent'); - - }); - }; - - if ($.browser.msie && typeof G_vmlCanvasManager == 'undefined') { - - var corner_buffer = new Array(); - var corner_buffer_args = new Array(); - - $.fn.corner = function(options){ - corner_buffer[corner_buffer.length] = this; - corner_buffer_args[corner_buffer_args.length] = options; - return this.each(function(){}); - }; - - // load excanvas.pack.js - document.execCommand("BackgroundImageCache", false, true); - var elm = $("script[@src*=jquery.corner.]"); - if (elm.length == 1) { - var jc_src = elm.attr('src'); - var pathArray = jc_src.split('/'); - pathArray.pop(); - var base = pathArray.join('/') || '.'; - var excanvasjs = base+'/excanvas.pack.js'; - $.getScript(excanvasjs,function(){ - execbuffer(); - }); - } - - var execbuffer = function() { - // set back function - $.fn.corner = _corner; - // execute buffer and set back function - for(var i=0;i 0 && border_width < radius) { + + // offset caused by border + var offset = border_width/2; + + if (r_type == 'tl') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'tr') { + var steps = new Array(radius-offset,radius-offset,radius-offset,offset,offset,offset); + var curve_to = new Array(0,0); + } else if (r_type == 'bl') { + var steps = new Array(radius-offset,radius-offset,offset,radius-offset,offset,offset,offset,radius-offset); + var curve_to = new Array(0,0); + } else if (r_type == 'br') { + var steps = new Array(radius-offset,offset,radius-offset,offset,offset,radius-offset,radius-offset,radius-offset); + var curve_to = new Array(radius, radius); + } + + ctx.strokeStyle = border_color; + ctx.lineWidth = border_width; + ctx.beginPath(); + // go to corner to begin curve + ctx.moveTo(steps[0], steps[1]); + // curve from righttop to leftbottom (for the tl canvas) + ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); + ctx.stroke(); + + } + }; + + var creatCanvas = function(p,radius) { + var elm = document.createElement('canvas'); + elm.setAttribute("height", radius); + elm.setAttribute("width", radius); + elm.style.display = "block"; + elm.style.position = "absolute"; + elm.className = "cornercanvas"; + elm = p.appendChild(elm); + // if G_vmlCanvasManager in defined the browser (ie only) has loaded excanvas.js + if (!elm.getContext && typeof G_vmlCanvasManager != 'undefined') { + var elm = G_vmlCanvasManager.initElement(elm); + } + return elm; + }; + + // interpret the (string) argument + var o = (options || "").toLowerCase(); + var radius = parseInt((o.match(/(\d+)px/)||[])[1]) || null; // corner width + var bg_color = ((o.match(/(#[0-9a-f]+)/)||[])[1]); // strip color + if (radius == null) { radius = "auto"; } + + var edges = { T:0, B:1 }; + var opts = { + tl: /top|tl/.test(o), + tr: /top|tr/.test(o), + bl: /bottom|bl/.test(o), + br: /bottom|br/.test(o) + }; + if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) { + opts = { tl:1, tr:1, bl:1, br:1 }; + } + + return this.each(function() { + + var elm = $(this); + + // give the element 'haslayout' + if ($.browser.msie) { this.style.zoom = 1; } + + // the size of the corner is not defined... + var widthheight_smallest = getMin(new Array(getCSSint(this,'height'),getCSSint(this,'width'))); + if (radius == "auto") { + radius = widthheight_smallest/4; + if (radius > 10) { radius = 10; } + } + + // the size of the corner can't be to high + if (widthheight_smallest < radius) { + radius = (widthheight_smallest/2); + } + + // remove old canvas objects + elm.children("canvas.cornercanvas").remove(); + + // some css thats required in order to position the canvas elements + if (elm.css('position') == 'static') { + elm.css('position','relative'); + // only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode + } else if (elm.css('position') == 'fixed' && $.browser.msie && !(document.compatMode == 'CSS1Compat' && typeof document.body.style.maxHeight != "undefined")) { + elm.css('position','absolute'); + } + elm.css('overflow','visible'); + + // get border width + var border_t = getCSSint(this, 'borderTopWidth'); + var border_r = getCSSint(this, 'borderRightWidth'); + var border_b = getCSSint(this, 'borderBottomWidth'); + var border_l = getCSSint(this, 'borderLeftWidth'); + + // get the lowest borderwidth of the corners in use + var bordersWidth = new Array(); + if (opts.tl || opts.tr) { bordersWidth.push(border_t); } + if (opts.br || opts.tr) { bordersWidth.push(border_r); } + if (opts.br || opts.bl) { bordersWidth.push(border_b); } + if (opts.bl || opts.tl) { bordersWidth.push(border_l); } + + borderswidth_smallest = getMin(bordersWidth); + + // creat the canvas elements and position them + var p_top = 0-border_t; + var p_right = 0-border_r; + var p_bottom = 0-border_b; + var p_left = 0-border_l; + + if (opts.tl) { var tl = $(creatCanvas(this,radius)).css({left:p_left,top:p_top}).get(0); } + if (opts.tr) { var tr = $(creatCanvas(this,radius)).css({right:p_right,top:p_top}).get(0); } + if (opts.bl) { var bl = $(creatCanvas(this,radius)).css({left:p_left,bottom:p_bottom}).get(0); } + if (opts.br) { var br = $(creatCanvas(this,radius)).css({right:p_right,bottom:p_bottom}).get(0); } + + // get the background color of parent element + + if (bg_color == undefined) { + + var current_p = elm.parent(); + var bg = current_p.css('background-color'); + while((bg == "transparent" || bg == "rgba(0, 0, 0, 0)") && current_p.get(0).tagName.toLowerCase() != "html") { + bg = current_p.css('background-color'); + current_p = current_p.parent(); + } + } else { + bg = bg_color; + } + + if (bg == "transparent" || bg == "rgba(0, 0, 0, 0)") { bg = "#ffffff"; } + + if (opts.tl) { drawRoundCornerCanvasShape(tl,radius,'tl',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.tr) { drawRoundCornerCanvasShape(tr,radius,'tr',bg,borderswidth_smallest,elm.css('borderTopColor')); } + if (opts.bl) { drawRoundCornerCanvasShape(bl,radius,'bl',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + if (opts.br) { drawRoundCornerCanvasShape(br,radius,'br',bg,borderswidth_smallest,elm.css('borderBottomColor')); } + + elm.addClass('roundCornersParent'); + + }); + }; + + if ($.browser.msie && typeof G_vmlCanvasManager == 'undefined') { + + var corner_buffer = new Array(); + var corner_buffer_args = new Array(); + + $.fn.corner = function(options){ + corner_buffer[corner_buffer.length] = this; + corner_buffer_args[corner_buffer_args.length] = options; + return this.each(function(){}); + }; + + // load excanvas.pack.js + document.execCommand("BackgroundImageCache", false, true); + var elm = $("script[@src*=jquery.corner.]"); + if (elm.length == 1) { + var jc_src = elm.attr('src'); + var pathArray = jc_src.split('/'); + pathArray.pop(); + var base = pathArray.join('/') || '.'; + var excanvasjs = base+'/excanvas.pack.js'; + $.getScript(excanvasjs,function(){ + execbuffer(); + }); + } + + var execbuffer = function() { + // set back function + $.fn.corner = _corner; + // execute buffer and set back function + for(var i=0;i 1) { - locales.push(segments[0]); - } - locales.push(locale); - } - - var url = SimileAjax.findScript(document, "timegrid-api.js"); - if (url == null) { - Timegrid.error = new Error("Failed to derive URL prefix for Simile Timegrid API code files"); - return; - } - Timegrid.urlPrefix = url.substr(0, url.indexOf("timegrid-api.js")); - var paramTypes = { bundle: Boolean, autoCreate: Boolean }; - SimileAjax.parseURLParameters(url, Timegrid.params, paramTypes); - - /* - * Core scripts and styles - */ - if (Timegrid.params.bundle) { - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix, [ - "scripts/util/jquery.dimensions.js", - "scripts/util/jquery.simile.js", - "timegrid-bundle.js" - ]); - SimileAjax.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); - } else { - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); - } - - /* - * Localization - */ - var localeFiles = []; - for (var i = 0; i < locales.length; i++) { - localeFiles.push(locales[i] + "/locale.js"); - }; - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); - if (Timegrid.params.autoCreate) { - SimileAjax.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); - } - Timegrid.loaded = true; - }; - - /* - * Load SimileAjax if it's not already loaded - */ - if (typeof SimileAjax == "undefined") { - window.SimileAjax_onLoad = loadMe; - - //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var url = "http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js"; - //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; - var createScriptElement = function() { - var script = document.createElement("script"); - script.type = "text/javascript"; - script.language = "JavaScript"; - script.src = url; - document.getElementsByTagName("head")[0].appendChild(script); - } - if (document.body == null) { - try { - document.write(""); - } catch (e) { - createScriptElement(); - } - } else { - createScriptElement(); - } - } else { - loadMe(); - } -})(); +/****************************************************************************** + * Timegrid API + * This file will load all the necessary Javascript files to make a standard + * Timegrid operate. + *****************************************************************************/ + +(function() { + var loadMe = function() { + if (typeof window.Timegrid != "undefined") { + return; + } + + window.Timegrid = { + loaded: false, + params: { autoCreate: true, bundle: false }, + importers: {} + }; + + var javascriptFiles = [ + "timegrid.js", + + "util/util.js", + "util/debug.js", + "util/date.js", + "util/excanvas.pack.js", + "util/jquery.dimensions.js", + "util/jquery.simile.js", + "util/jquery.corner.js", + "util/jquery.prettybox.js", + "util/dstructs/dstructs.js", + + "controls.js", + "listeners.js", + "grid.js", + "themes.js", + "labellers.js", + + "sources/default.js", + "sources/recurring.js", + + "layouts/layout.js", + "layouts/nmonth.js", + "layouts/nday.js", + "layouts/weekly.js", + "layouts/monthly.js", + "layouts/property.js" + ]; + var cssFiles = [ + "timegrid.css", + "themes/theme-sandy-stone-beach-ocean-diver.css" + ]; + + var locales = [ "en", "fr" ]; + + var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";"); + for (var l = 0; l < defaultClientLocales.length; l++) { + var locale = defaultClientLocales[l]; + var segments = locale.split("-"); + if (segments.length > 1) { + locales.push(segments[0]); + } + locales.push(locale); + } + + var url = SimileAjax.findScript(document, "timegrid-api.js"); + if (url == null) { + Timegrid.error = new Error("Failed to derive URL prefix for Simile Timegrid API code files"); + return; + } + Timegrid.urlPrefix = url.substr(0, url.indexOf("timegrid-api.js")); + var paramTypes = { bundle: Boolean, autoCreate: Boolean }; + SimileAjax.parseURLParameters(url, Timegrid.params, paramTypes); + + /* + * Core scripts and styles + */ + if (Timegrid.params.bundle) { + SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix, [ + "scripts/util/jquery.dimensions.js", + "scripts/util/jquery.simile.js", + "timegrid-bundle.js" + ]); + SimileAjax.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); + } else { + SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); + } + + /* + * Localization + */ + var localeFiles = []; + for (var i = 0; i < locales.length; i++) { + localeFiles.push(locales[i] + "/locale.js"); + }; + SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); + if (Timegrid.params.autoCreate) { + SimileAjax.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); + } + Timegrid.loaded = true; + }; + + /* + * Load SimileAjax if it's not already loaded + */ + if (typeof SimileAjax == "undefined") { + window.SimileAjax_onLoad = loadMe; + + //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; + var url = "http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js"; + //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; + var createScriptElement = function() { + var script = document.createElement("script"); + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = url; + document.getElementsByTagName("head")[0].appendChild(script); + } + if (document.body == null) { + try { + document.write(""); + } catch (e) { + createScriptElement(); + } + } else { + createScriptElement(); + } + } else { + loadMe(); + } +})(); diff --git a/src/webapp/site/docs/splash.html b/src/webapp/site/docs/splash.html index 8c74951..a44fb3f 100644 --- a/src/webapp/site/docs/splash.html +++ b/src/webapp/site/docs/splash.html @@ -1,4 +1,4 @@ - + JsDoc diff --git a/src/webapp/site/examples/academic/academic.html b/src/webapp/site/examples/academic/academic.html index d647958..745c525 100644 --- a/src/webapp/site/examples/academic/academic.html +++ b/src/webapp/site/examples/academic/academic.html @@ -1,25 +1,25 @@ - - - - - SIMILE | Timegrid | Examples | MIT Academic Calendar - - - - - - -
              -

              MIT Academic Calendar

              -
              - - + + + + + SIMILE | Timegrid | Examples | MIT Academic Calendar + + + + + + +
              +

              MIT Academic Calendar

              +
              + + diff --git a/src/webapp/site/examples/conference/conference.html b/src/webapp/site/examples/conference/conference.html index 48364df..e1173be 100644 --- a/src/webapp/site/examples/conference/conference.html +++ b/src/webapp/site/examples/conference/conference.html @@ -1,27 +1,27 @@ - - - - - SIMILE | Timegrid | Examples | Conference Schedule - - - - - - -
              -

              ISWC 2005 Schedule

              -
              -
              - - + + + + + SIMILE | Timegrid | Examples | Conference Schedule + + + + + + +
              +

              ISWC 2005 Schedule

              +
              +
              + + diff --git a/src/webapp/site/examples/property/lectures.js b/src/webapp/site/examples/property/lectures.js index f330065..98d232c 100644 --- a/src/webapp/site/examples/property/lectures.js +++ b/src/webapp/site/examples/property/lectures.js @@ -1,29 +1,29 @@ -{ - 'dateTimeFormat': 'iso8601', - 'events' : [ - { - 'start' : '2007-08-09T09:00', - 'end' : '2007-08-09T10:00', - 'title' : '18.01 - Single-Variable Calculus', - 'room' : '10-250' - }, - { - 'start' : '2007-08-09T10:00', - 'end' : '2007-08-09T11:00', - 'title' : '3.091 - Solid-State Chemistry', - 'room' : '10-250' - }, - { - 'start' : '2007-08-09T15:00', - 'end' : '2007-08-09T17:00', - 'title' : '8.01 - Physics I', - 'room' : '26-132' - }, - { - 'start' : '2007-08-09T15:00', - 'end' : '2007-08-09T17:00', - 'title' : '8.02 - Physics II', - 'room' : '32-052' - } - ] -} +{ + 'dateTimeFormat': 'iso8601', + 'events' : [ + { + 'start' : '2007-08-09T09:00', + 'end' : '2007-08-09T10:00', + 'title' : '18.01 - Single-Variable Calculus', + 'room' : '10-250' + }, + { + 'start' : '2007-08-09T10:00', + 'end' : '2007-08-09T11:00', + 'title' : '3.091 - Solid-State Chemistry', + 'room' : '10-250' + }, + { + 'start' : '2007-08-09T15:00', + 'end' : '2007-08-09T17:00', + 'title' : '8.01 - Physics I', + 'room' : '26-132' + }, + { + 'start' : '2007-08-09T15:00', + 'end' : '2007-08-09T17:00', + 'title' : '8.02 - Physics II', + 'room' : '32-052' + } + ] +} diff --git a/src/webapp/site/examples/property/property.html b/src/webapp/site/examples/property/property.html index 5cbd990..73807e8 100644 --- a/src/webapp/site/examples/property/property.html +++ b/src/webapp/site/examples/property/property.html @@ -1,27 +1,27 @@ - - - - - SIMILE | Timegrid | Examples | Lecture Locations - - - - - - -
              -

              Monday Lecture Schedule

              -
              -
              - - + + + + + SIMILE | Timegrid | Examples | Lecture Locations + + + + + + +
              +

              Monday Lecture Schedule

              +
              +
              + + diff --git a/src/webapp/site/sidebar.html b/src/webapp/site/sidebar.html index f1a9f4d..ac9fc05 100644 --- a/src/webapp/site/sidebar.html +++ b/src/webapp/site/sidebar.html @@ -14,4 +14,4 @@

              Related Projects

            • Timeplot
            • - + From 88ff2b4dcb0ebad533601f8cf308dac3c019e953 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Tue, 25 Jul 2017 16:46:05 -0400 Subject: [PATCH 30/43] Examples linked to locally contained timegrid api; jQuery and jQuery plugin included in the exaples --- .DS_Store | Bin 6148 -> 6148 bytes src/.DS_Store | Bin 0 -> 6148 bytes src/webapp/.DS_Store | Bin 6148 -> 6148 bytes src/webapp/api/.DS_Store | Bin 0 -> 6148 bytes src/webapp/api/locales/.DS_Store | Bin 0 -> 6148 bytes src/webapp/api/locales/en/locale.js.orig | 41 - .../api/locales/en/timegrid-en-bundle.js | 145 + src/webapp/api/locales/fr/locale.js.orig | 40 - src/webapp/api/scripts/.DS_Store | Bin 0 -> 6148 bytes src/webapp/api/scripts/controls.js.orig | 180 - src/webapp/api/scripts/layouts/layout.js.orig | 436 --- src/webapp/api/scripts/layouts/nday.js.orig | 261 -- .../api/scripts/sources/default.js.orig | 416 -- .../api/scripts/sources/recurring.js.orig | 143 - src/webapp/api/scripts/timegrid.js.orig | 254 -- src/webapp/api/scripts/util/debug.js.orig | 20 - .../api/scripts/util/jquery.simile.js.orig | 122 - src/webapp/api/scripts/util/util.js.orig | 59 - src/webapp/api/timegrid-api.js.orig | 165 - .../timegrid.css.orig => timegrid-bundle.css} | 96 +- src/webapp/api/timegrid-bundle.js | 3355 +++++++++++++++++ src/webapp/site/.DS_Store | Bin 0 -> 6148 bytes src/webapp/site/examples/.DS_Store | Bin 0 -> 6148 bytes .../site/examples/academic/academic.html | 4 +- .../site/examples/conference/conference.html | 4 +- src/webapp/site/examples/month/month.html | 4 +- .../site/examples/property/property.html | 4 +- src/webapp/site/examples/week/sched.html | 4 +- src/webapp/site/index.html | 5 +- src/webapp/site/styles.css | 2 +- 30 files changed, 3598 insertions(+), 2162 deletions(-) create mode 100644 src/.DS_Store create mode 100644 src/webapp/api/.DS_Store create mode 100644 src/webapp/api/locales/.DS_Store delete mode 100644 src/webapp/api/locales/en/locale.js.orig create mode 100644 src/webapp/api/locales/en/timegrid-en-bundle.js delete mode 100644 src/webapp/api/locales/fr/locale.js.orig create mode 100644 src/webapp/api/scripts/.DS_Store delete mode 100644 src/webapp/api/scripts/controls.js.orig delete mode 100644 src/webapp/api/scripts/layouts/layout.js.orig delete mode 100644 src/webapp/api/scripts/layouts/nday.js.orig delete mode 100644 src/webapp/api/scripts/sources/default.js.orig delete mode 100644 src/webapp/api/scripts/sources/recurring.js.orig delete mode 100644 src/webapp/api/scripts/timegrid.js.orig delete mode 100644 src/webapp/api/scripts/util/debug.js.orig delete mode 100644 src/webapp/api/scripts/util/jquery.simile.js.orig delete mode 100644 src/webapp/api/scripts/util/util.js.orig delete mode 100644 src/webapp/api/timegrid-api.js.orig rename src/webapp/api/{styles/timegrid.css.orig => timegrid-bundle.css} (69%) create mode 100644 src/webapp/api/timegrid-bundle.js create mode 100644 src/webapp/site/.DS_Store create mode 100644 src/webapp/site/examples/.DS_Store diff --git a/.DS_Store b/.DS_Store index 7709f1c9b05c1492b06a7524ea79ebe2919d09f5..959757854ab0909aff1d022b90339c4233d06246 100644 GIT binary patch delta 67 zcmZoMXfc=|#>B`mF;Q%yo+2ab#DLw5tdn_|8aHb)-(%VAz&wX>Gdl-A2T;joL+0B)qF;Q%yo+2aH#DLw47ceq1a!ux8Y^-NvC}&7zNMcB2C}1eaNjD5m z&d)7iKmZi^+?%Dx>i?o7UAC!ezU z$G1Hi6`%rCfC^9nD)3kZvc5L+#~#bmr~nms0R`;)P~e6&u@Cf52L^8efK!CsF!x>p zSS$dniG3gj$YhoYhbi|zw8Q**X650|3M|3QPb1 delta 30 mcmZoMXfc@J&&WD4U^gS{WFE%G%}W`R*d`W8Y-Z>9%MSpR;|aL{ diff --git a/src/webapp/api/.DS_Store b/src/webapp/api/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1c3406f9faae6c5ab25fbc96e1e0ce03ae2217f2 GIT binary patch literal 6148 zcmeHK%W48q3_Y<@g>GDSd4HjQa1s3if56g~A`Du56uO(8zwODxp=GAqE^GqH8IzoQ znX{M}05U(lJ^?cTQ@SF~8v3Sn^`4C)b4L_Aqrn>vpR4`0+4Z`I6Uv>S!45BYCU*So zyPwMHfwet0_`vacdRM(?^@y)Q=J1V~O$AbcR3H^d1^%}JoY`vA2gi)5Kq`<5bPDMA zq0kj;VC!g~4hCBRh-0SB_-wlbv1o!=16xOCXyR0&QzcdmaXRxQ`f6b7=yXUd9}+i9 zY$#&4^Za7%km{H*6-WhsDxkYJZKm^oN&jX4*PgUgAQiY#1!TNfE#`c=n616n)LC2T tYx>pLYwZj+iitLg`9nwX?RcRuqY8aX_KTfbZU4~J zBBI0Nv=iw?q=Oq}Yhh-Jypgj^&+$H8Z_@?2)y$d-&r$1TwjbLB6`%rCfC^9nDzG30 z;vDbR3wkC#3KgIN%TU0+4+(C}!BXj;4g?fR2fxGo1vWo;LY;X~ujYEukMYrAMd0@LhZpaN82rogJ^y`BFD__z6g*20tuP=P;F zK->MeAMjFfwtl>x)sIoNb%BF^Il|jd01`WjH*h!XCtH9ySSnG0@khXAV4wm&Rp14m Ce-JwW literal 0 HcmV?d00001 diff --git a/src/webapp/api/locales/en/locale.js.orig b/src/webapp/api/locales/en/locale.js.orig deleted file mode 100644 index ac60380..0000000 --- a/src/webapp/api/locales/en/locale.js.orig +++ /dev/null @@ -1,41 +0,0 @@ -/*================================================== - * English localization - * (also base and default localization) - *================================================== - */ -(function() { - var javascriptFiles = [ - "timegrid-l10n.js", - - "util/date-l10n.js", - - "layouts/nday-l10n.js", - "layouts/nmonth-l10n.js", - "layouts/monthly-l10n.js", - "layouts/weekly-l10n.js", - "layouts/property-l10n.js" - ]; - var cssFiles = [ - ]; - - var urlPrefix = Timegrid.urlPrefix + "locales/en/"; - if (Timegrid.params.bundle) { -<<<<<<< HEAD - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); - if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); - } - } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); -======= - $.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); - if (cssFiles.length > 0) { - $.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); - } - } else { - $.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - $.includeCssFiles(document, urlPrefix + "styles/", cssFiles); ->>>>>>> alt/master - } -})(); diff --git a/src/webapp/api/locales/en/timegrid-en-bundle.js b/src/webapp/api/locales/en/timegrid-en-bundle.js new file mode 100644 index 0000000..029bc6b --- /dev/null +++ b/src/webapp/api/locales/en/timegrid-en-bundle.js @@ -0,0 +1,145 @@ + + +/* monthly-l10n.js */ + + + +if(!("l10n"in Timegrid.MonthLayout)){ +Timegrid.MonthLayout.l10n={}; +} + + +Timegrid.MonthLayout.l10n.makeTitle=function(n){return"Month";} + +/* nday-l10n.js */ + + + +if(!("l10n"in Timegrid.NDayLayout)){ +Timegrid.NDayLayout.l10n={mini:{}}; +} + + +Timegrid.NDayLayout.l10n.makeTitle=function(n){return n+"-Day";} + + +Timegrid.NDayLayout.l10n.makeRange=function(d1,d2){ +return d1.format(Timegrid.NDayLayout.l10n.startFormat)+" - "+ +d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + + +Timegrid.NDayLayout.l10n.xLabelFormat="E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat="e"; + + +Timegrid.NDayLayout.l10n.yLabelFormat="ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat="h"; + + +Timegrid.NDayLayout.l10n.startFormat="M/d/yyyy"; + + +Timegrid.NDayLayout.l10n.endFormat="M/d/yyyy"; + + + +/* nmonth-l10n.js */ + + + +if(!("l10n"in Timegrid.NMonthLayout)){ +Timegrid.NMonthLayout.l10n={}; +} + + +Timegrid.NMonthLayout.l10n.makeTitle=function(n){return n+"-Month";} + + +Timegrid.NMonthLayout.l10n.makeRange=function(d1,d2){ +var string=d1.format(Timegrid.NMonthLayout.l10n.startFormat); +if(d2){ +string+=" - "+d2.format(Timegrid.NMonthLayout.l10n.endFormat); +} +return string; +}; + + +Timegrid.NMonthLayout.l10n.xLabelFormat=""; + + +Timegrid.NMonthLayout.l10n.yLabelFormat="Ww"; + + +Timegrid.NMonthLayout.l10n.startFormat="MMM yyyy"; + + +Timegrid.NMonthLayout.l10n.endFormat="MMM yyyy"; + +/* property-l10n.js */ + + + +if(!("l10n"in Timegrid.PropertyLayout)){ +Timegrid.PropertyLayout.l10n={}; +} + + +Timegrid.PropertyLayout.l10n.makeTitle=function(){return"Property";} + + +Timegrid.PropertyLayout.l10n.yLabelFormat="ha"; + + + + +/* weekly-l10n.js */ + + + +if(!("l10n"in Timegrid.WeekLayout)){ +Timegrid.WeekLayout.l10n={}; +} + + +Timegrid.WeekLayout.l10n.makeTitle=function(n){return"Week";} + +/* timegrid-l10n.js */ + + + +if(!("l10n"in Timegrid)){ +Timegrid.l10n={}; +} + +Timegrid.l10n.loadingMessage="Loading..."; + +Timegrid.l10n.jsonErrorMessage="Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage="Failed to load XML data from"; + +/* date-l10n.js */ + + + +if(!("l10n"in Date)){ +Date.l10n={}; +} + + +Date.l10n.monthNames=['January','February','March','April','May','June','July','August','September','October','November','December']; + + +Date.l10n.monthAbbreviations=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + + +Date.l10n.dayNames=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + + +Date.l10n.dayAbbreviations=['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + + +Date.l10n.preferAmericanFormat=true; + + +Date.l10n.firstDayOfWeek=0; diff --git a/src/webapp/api/locales/fr/locale.js.orig b/src/webapp/api/locales/fr/locale.js.orig deleted file mode 100644 index 0dd5476..0000000 --- a/src/webapp/api/locales/fr/locale.js.orig +++ /dev/null @@ -1,40 +0,0 @@ -/*================================================== - * English localization - * (also base and default localization) - *================================================== - */ -(function() { - var javascriptFiles = [ - "timegrid-l10n.js", - - "util/date-l10n.js", - - "layouts/nday-l10n.js", - "layouts/nmonth-l10n.js", - "layouts/weekly-l10n.js", - "layouts/monthly-l10n.js" - ]; - var cssFiles = [ - ]; - - var urlPrefix = Timegrid.urlPrefix + "locales/fr/"; - if (Timegrid.bundle) { -<<<<<<< HEAD - SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); - if (cssFiles.length > 0) { - SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); - } - } else { - SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); -======= - $.includeJavascriptFiles(document, urlPrefix, [ "timegrid-fr-bundle.js" ]); - if (cssFiles.length > 0) { - $.includeCssFiles(document, urlPrefix, [ "timegrid-fr-bundle.css" ]); - } - } else { - $.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); - $.includeCssFiles(document, urlPrefix + "styles/", cssFiles); ->>>>>>> alt/master - } -})(); diff --git a/src/webapp/api/scripts/.DS_Store b/src/webapp/api/scripts/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d6dc01aa8b4e6a620f043295c116ff7ec140b4ff GIT binary patch literal 6148 zcmeH~K?=e^3`G;|qTr@Wm$UHz-e4$t0x#e~5J4)4bv;M-Clds#YZ3W@ zh=}&%VJ*^$NDDWWm4%5Z@4X|sK7L)2aQ(s zF~sWL4oz_`hnA|fT{MOdjVG&3F)*#|q6rC1vkL5fRNSp^uV?jrRBc`0P(P0F@)Ll>uHq%!4g1L!&>UK-q5|WOfMZ}Ffv*yH E0OJ%A(EtDd literal 0 HcmV?d00001 diff --git a/src/webapp/api/scripts/controls.js.orig b/src/webapp/api/scripts/controls.js.orig deleted file mode 100644 index b684d9b..0000000 --- a/src/webapp/api/scripts/controls.js.orig +++ /dev/null @@ -1,180 +0,0 @@ -/** - * Controls - */ - -Timegrid.Controls = {}; - -/* - * A panel will render controls around a set of layouts. This should be the - * only entrypoint into this code, in addition to the render method. - * Possible controls include: - * Switching between the layouts (tabs) - * Iterating through time, different weeks/months, etc (arrows) - * Switching between data sources - * The style and selection of which types of controls to render in the panel - * should be easily configurable through the params hash passed in. - */ -Timegrid.Controls.Panel = function(layouts, params) { - this._layouts = layouts; - this._titles = $.map(this._layouts, function(l) { return l.title; }); - this._tabSet = new Timegrid.Controls.TabSet(this._titles, this._layouts); -}; - -Timegrid.Controls.Panel.prototype.setLayouts = function(layouts) { - this._layouts = layouts; - this._titles = $.map(this._layouts, function(l) { return l.title; }); - this._tabSet.setLayouts(this._titles, this._layouts); -}; - -Timegrid.Controls.Panel.prototype.render = function(container) { - this._tabSet.render(container); - this._tabSet.switchTo(this._tabSet.current || this._titles[0]); -}; - -Timegrid.Controls.Panel.prototype.renderChanged = function() { - this._tabSet.renderChanged(); - this._tabSet.switchTo(this._tabSet.current || this._titles[0]); -}; - -/* - * TabSet is a style of control that generates a set of tabs. These tabs can - * be configured to switch between different views, time slices, or data - * sources. - */ -Timegrid.Controls.TabSet = function(titles, layouts) { - this.setLayouts(titles, layouts); - this.current = ""; -}; - -Timegrid.Controls.TabSet.prototype.setLayouts = function(titles, layouts) { - this._tabs = {}; - this._renderedLayouts = {}; - this._iterators = {}; - this._layoutMap = {}; - for (var i = 0; i < titles.length; i++) { - this._layoutMap[titles[i]] = layouts[i]; - } -}; - -Timegrid.Controls.TabSet.prototype.render = function(container) { - this._container = container; - var self = this; - var tabDiv = $('
              ').addClass('timegrid-tabs'); - $(container).prepend(tabDiv); - var makeCallback = function(title) { - return function() { self.switchTo(title); }; - }; - for (var lTitle in this._layoutMap) { -<<<<<<< HEAD - var tab = $('') - .height(this._layoutMap[lTitle].tabHeight + "px") - .click(makeCallback(lTitle)) - .addClass('timegrid-tab').addClass('timegrid-rounded'); - tabDiv.prepend(tab); - this._tabs[lTitle] = tab; -======= - $newLink = $("", { - href : "javascript:void", - text : lTitle - }); - - $tab = $('
              ', { height : this._layoutMap[lTitle].tabHeight + "px"}) - .addClass("timegrid-tab") - .addClass('timegrid-rounded') - .append($newLink); - - $tab.click(makeCallback(lTitle)); - - tabDiv.prepend($tab); - this._tabs[lTitle] = $tab; ->>>>>>> alt/master - } - if (!$.browser.msie) { $('.timegrid-tab').corner("30px top"); } -}; - -Timegrid.Controls.TabSet.prototype.renderChanged = function() { - var layout = this._layoutMap[this.current]; - layout.renderChanged(); -}; - -Timegrid.Controls.TabSet.prototype.switchTo = function(title) { - if (this.current && this._renderedLayouts[this.current]) { - this._renderedLayouts[this.current].hide(); - this._tabs[this.current].removeClass('timegrid-tab-active'); - } - if (this._renderedLayouts[title]) { - this._renderedLayouts[title].show(); - } else if (this._layoutMap[title]) { - this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); - } - if (this._iDiv) { $(this._iDiv).empty(); } - if (this._layoutMap[title].iterable) { - if (!this._iterators[title]) { - this._iterators[title] = new Timegrid.Controls.Iterator(this._layoutMap[title]); - this._iDiv = $(this._iterators[title].render(this._container)); - } else { - this._iDiv = $(this._iterators[title].render()); - } - } - this.current = title; - this._tabs[this.current].addClass('timegrid-tab-active'); -}; - -/* - * Iterator is a style of control that generates a textual label for the - * current selection and a set of arrows for moving to either the previous - * or next selection. Can be used for views, time, or sources. - */ -Timegrid.Controls.Iterator = function(layout) { - this._layout = layout; -}; - -Timegrid.Controls.Iterator.prototype.render = function(container) { - if (container) { - this._container = container; - this._div = $('
              ').addClass('timegrid-iterator'); - $(this._container).prepend(this._div); - } else { - this._div.empty(); - } - var self = this; - var makePrevCallback = function(layout) { - return function() { - layout.goPrevious(); - self.render(); - }; - }; - var makeNextCallback = function(layout) { - return function() { - layout.goNext(); - self.render(); - }; - }; -<<<<<<< HEAD - var prevLink = $('Previous') - .wrap('
              ').parent() - .addClass('timegrid-iterator-prev') - .click(makePrevCallback(this._layout)); - var nextLink = $('Next') - .wrap('').parent() - .addClass('timegrid-iterator-next') - .click(makeNextCallback(this._layout)); - this._div.append(prevLink); - this._div.append(nextLink); - this._div.append('' + this._layout.getCurrent() + ''); -======= - $imageURL = Timegrid.urlPrefix + "images/go-previous.png"; - $prevLink = $('', {href: "javascript:void"}) - .addClass('timegrid-iterator-prev') - .append($('', {alt: "Previous", src: $imageURL})); - $imageURL = Timegrid.urlPrefix + "images/go-next.png"; - $nextLink = $('', {href: "javascript:void"}) - .addClass('timegrid-iterator-next') - .append($('', {alt: "Next", src: $imageURL})); - $nextLink.click(makeNextCallback(this._layout)); - this._div.append($prevLink); - this._div.append($nextLink); - this._div.append($('', { text: this._layout.getCurrent() })); ->>>>>>> alt/master - return this._div; -}; diff --git a/src/webapp/api/scripts/layouts/layout.js.orig b/src/webapp/api/scripts/layouts/layout.js.orig deleted file mode 100644 index 77e9cb8..0000000 --- a/src/webapp/api/scripts/layouts/layout.js.orig +++ /dev/null @@ -1,436 +0,0 @@ -/** - * @fileOverview - * This is where we define the entrypoint for all of the different default - * layouts that Timegrid is capable of, e.g. month, week, n-day, etc. Both - * LayoutFactory and the common Layout superclass are defined in this file. - * @author masont - */ - -/** - * Constructs a LayoutFactory object. - * - * @class LayoutFactory is a simple factory class that abstracts the process of - * selecting and instantiating Layout objects. - * @constructor - */ -Timegrid.LayoutFactory = function() {}; - -Timegrid.LayoutFactory._constructors = {}; - -/** - * Registers a layout class with this layout factory. Automatically places the - * given layout under the common Layout superclass, and binds the name string - * to the constructor. - * - * @param {String} name the name to bind to the given constructor - * @param {Function} constructor the constructor to a layout class - */ -Timegrid.LayoutFactory.registerLayout = function(name, constructor) { - $.inherit(constructor, Timegrid.Layout); - Timegrid.LayoutFactory._constructors[name] = constructor; -}; - -/** - * Instantiates a Timegrid layout with the given parameter hash. - * - * @param {String} name the name of the layout - * @param {EventSource} eventSource an EventSource object to layout and render - * @param params a hash of parameters to be passed into the desired layout - * @return {Timegrid.Layout} a Timegrid.Layout instance of the specified subclass - */ -Timegrid.LayoutFactory.createLayout = function(name, eventSource, params) { - var constructor = Timegrid.LayoutFactory._constructors[name]; - if (typeof constructor == 'function') { -<<<<<<< HEAD - layout = new constructor(eventSource, $.clone(params)); -======= - layout = new constructor(eventSource, $.deepClone(params)); ->>>>>>> alt/master - return layout; - } else { - throw "No such layout!"; - }; - return; -}; - -/** - * Instantiates a Layout object. This constructor should always be overridden. - * - * @class Layout is the base class for all layouts that Timegrid supports. - * @constructor - * @param {EventSource} eventSource the eventSource to pull events from - * @param {Object} params a parameter hash - */ -Timegrid.Layout = function(eventSource, params) { - var self = this; - /** - * An object containing a parameter hash - * @type Object - */ - this.params = params; - /** - * The number of columns in the grid - * @type Number - */ - this.xSize = 0; - /** - * The number of rows in the grid - * @type Number - */ - this.ySize = 0; - /** - * A function to map date objects to a custom timezone - * @type Function - */ - this.timezoneMapper = function(date) { - if (typeof self.timezoneoffset != "undefined") { - return date.toTimezone(self.timezoneoffset); - } - return date; - }; - /** - * A function to map endpoints to an integer x-coordinate - * @type Function - */ - this.xMapper = function(obj) { return self.timezoneMapper(obj.time); }; - /** - * A function to map endpoints to an integer y-coordinate - * @type Function - */ - this.yMapper = function(obj) { return self.timezoneMapper(obj.time); }; - /** - * The height of the horizontal labels in pixels - * @type Number - */ - this.xLabelHeight = 24; - /** - * The width of the vertical labels in pixels - * @type Number - */ - this.yLabelWidth = 48; - /** - * The height of the tabs that page between views in pixels - * @type Number - */ - this.tabHeight = 18; -}; - -/** - * Takes a parameter hash and extends this layout with it, flattening key names - * to lowercase as it goes. This is done to eliminate browser-specific - * attribute case sensitivity. - * - * @param {Object} params a parameter hash - */ -Timegrid.Layout.prototype.configure = function(params) { - for (var attr in params) { - this[attr] = params[attr.toLowerCase()]; - } -}; - -/** - * Computes the grid dimensions (gridheight, gridwidth, ycell, xcell) for this - * layout. This is relatively complex since any of the above values can be - * either user-specified or computed. - */ -Timegrid.Layout.prototype.computeCellSizes = function() { - // Compute the cell sizes for the grid - this.xCell = this.params.xCell || this.params.xcell || - (this.gridwidth - 1) / this.xSize; - this.yCell = this.params.yCell || this.params.ycell || - (this.gridheight - 1) / this.ySize; - if (this.params.yCell || this.params.ycell) { - this.gridheight = this.yCell * this.ySize; - } - if (this.params.xCell || this.params.xcell) { - this.gridwidth = this.xCell * this.xSize; - } -}; - -/** - * Renders out this layout into a DOM object with a wrapping div element as its - * parent, returning the div. - * - * @param {Element} container the parent element - * @return {Element} a rendered DOM tree descended from a div element - */ -Timegrid.Layout.prototype.render = function(container) { - if (this.mini) { - this.scrollwidth = 0; - this.tabHeight = 0; - this.xLabelHeight = 24; - this.yLabelWidth = 24; - } - if (!(this.params.height && this.params.gridheight)) { - this.scrollwidth = 0; - } - if (container) { - this._container = container; -<<<<<<< HEAD - this._viewDiv = $("
              ").addClass('timegrid-view') -======= - this._viewDiv = $("
              ").addClass('timegrid-view print') ->>>>>>> alt/master - .css('top', this.tabHeight + "px"); - $(this._container).append(this._viewDiv); - } else { - this._viewDiv.empty(); - } - var gridDiv = $('
              ').addClass('timegrid-grid'); - var gridWindowDiv = $('
              ').addClass('timegrid-grid-window'); - if (!this.scrollwidth) { gridWindowDiv.css('overflow', 'visible'); } - - if (!this.params.height) { - this.height = this._container.style.height ? - $(this._container).height() : 3 + this.scrollwidth + this.tabHeight - + this.xLabelHeight + - (this.gridheight || 500); - } - $(this._container).height(this.height + "px"); - if (!this.params.width) { - this.width = this.params.gridwidth || $(this._container).width(); - } else { - $(this._container).width(this.width + "px"); - } - $(this._container).css('position', 'relative'); - this._viewDiv.height(this.height - this.tabHeight + "px"); - - gridWindowDiv.css("top", this.xLabelHeight).css("left", this.yLabelWidth) - .css("right", "0px").css("bottom", "0px"); - this._viewDiv.append(gridWindowDiv.append(gridDiv)); - - var windowHeight = this._viewDiv.height() - gridWindowDiv.position().top - 2; - var windowWidth = this._viewDiv.width() - gridWindowDiv.position().left - 2; - gridWindowDiv.height(windowHeight).width(windowWidth); - - this.gridwidth = this.gridwidth || gridWindowDiv.width() - this.scrollwidth; - this.gridheight = this.gridheight || gridWindowDiv.height() - this.scrollwidth; - gridDiv.height(this.gridheight + "px").width(this.gridwidth + "px"); - this.computeCellSizes(); - this._gridDiv = gridDiv; - gridDiv.append(this.renderEvents(document)); - gridDiv.append(this.renderGridlines(document)); - var xLabels = this.renderXLabels(); - var yLabels = this.renderYLabels(); - var syncHorizontalScroll = function(a, b) { - $(a).scroll(function() { b.scrollLeft = a.scrollLeft; }); - $(b).scroll(function() { a.scrollLeft = b.scrollLeft; }); - }; - var syncVerticalScroll = function(a, b) { - $(a).scroll(function() { b.scrollTop = a.scrollTop; }); - $(b).scroll(function() { a.scrollTop = b.scrollTop; }); - }; - syncVerticalScroll(yLabels, gridWindowDiv.get(0)); - syncHorizontalScroll(xLabels, gridWindowDiv.get(0)); - this._viewDiv.append(xLabels).append(yLabels); - - if (!this.mini) { - if ($.browser.msie) { - $('.timegrid-view:visible .timegrid-rounded-shadow', - this._container).prettybox(4,0,0,1); - } else { - $('.timegrid-view:visible .timegrid-rounded-shadow', - this._container).prettybox(4,7,1,0.7); - } - } - - return this._viewDiv.get(0); -}; - -Timegrid.Layout.prototype.renderChanged = function() { - this.initializeGrid(); - this._gridDiv.empty(); - this._gridDiv.append(this.renderEvents(document)); - this._gridDiv.append(this.renderGridlines(document)); - this.renderXLabels(); - this.renderYLabels(); - if (!this.mini) { - if ($.browser.msie) { - $('.timegrid-view:visible .timegrid-rounded-shadow', - this._container).prettybox(4,0,0,1); - } else { - $('.timegrid-view:visible .timegrid-rounded-shadow', - this._container).prettybox(4,7,1,0.7); - } - } -}; - -/** - * An abstract method to render events for this layout. This method is where - * specific layout implementations hook into the main rendering loop. While - * generally used to render events, this method can return any valid input to - * the jQuery append method, which is then appended under the grid - * div element. - * - * @function - * @param {Document} doc the document to create elements from - * @return {Content} any valid argument to jQuery's append, to be appended under - * the grid div - */ -Timegrid.Layout.prototype.renderEvents = Timegrid.abstract("renderEvents"); - -/** - * Renders the gridlines for this layout. Gridlines are represented in the DOM - * as absolutely positioned div elements with one dimension set to - * one pixel. - * - * @return {Element} a DOM element containing this layout's gridlines - */ -Timegrid.Layout.prototype.renderGridlines = function() { -<<<<<<< HEAD - var gridlineContainer = document.createElement("div"); - gridlineContainer.className = 'timegrid-gridlines'; - - for (var x = 0; x < this.xSize; x++) { // Vertical lines - var vlineDiv = document.createElement('div'); - vlineDiv.className = 'timegrid-vline'; - vlineDiv.style.height = this.gridheight + "px"; - vlineDiv.style.left = x * this.xCell + "px"; - gridlineContainer.appendChild(vlineDiv); - } - for (var y = 0; y <= this.ySize; y++) { // Horizontal lines - var hlineDiv = document.createElement('div'); - hlineDiv.className = 'timegrid-hline'; - hlineDiv.style.width = "100%"; - hlineDiv.style.top = y * this.yCell + "px"; - gridlineContainer.appendChild(hlineDiv); -======= - var numToDay = { - 0: "S", - 1: "M", - 2: "T", - 3: "W", - 4: "R", - 5: "F", - 6: "S" - }; - - var numToHour = { - 0: "8", - 1: "9", - 2: "10", - 3: "11", - 4: "12", - 5: "13", - 6: "14", - 7: "15", - 8: "16", - 9: "17", - 10: "18", - 11: "19", - 12: "20", - 13: "21" - }; - - var gridlineContainer = $("
              ", {class: 'timegrid-gridlines'}); - - for (var y = 0; y <= this.ySize - 1; y++) { // Horizontal lines - var hlineDiv = $('', { class:'timegrid-hline', - height: this.yCell + "px"}); - gridlineContainer.append(hlineDiv); - - for (var x = 0; x < this.xSize; x++) { // Vertical lines - var vlineDiv = $('', { classid: numToDay[x] + numToHour[y], - class: 'timegrid-vline', - width: this.xCell + "px" }); - hlineDiv.append(vlineDiv); - } ->>>>>>> alt/master - } - return gridlineContainer; -}; - -/** - * Renders the horizontal column labels that run above the grid. The labels - * themselves are provided by the implementing layout subclasses by - * getXLabels() - * - * @return {Element} a DOM element containing the horizontal labels - */ -Timegrid.Layout.prototype.renderXLabels = function() { - this._xLabelContainer = this._xLabelContainer || - document.createElement("div"); - var xLabelContainer = this._xLabelContainer; - xLabelContainer.innerHTML = ""; - xLabelContainer.className = 'timegrid-xlabels-window'; - xLabelContainer.style.height = this.xLabelHeight + "px"; - xLabelContainer.style.width = this.width - this.yLabelWidth - - this.scrollwidth - 2 + "px"; - xLabelContainer.style.left = this.yLabelWidth - 1 + "px"; - - var xLabelsDiv = document.createElement("div"); - xLabelsDiv.className = 'timegrid-xlabels'; - xLabelsDiv.style.height = this.xLabelHeight + "px" - xLabelsDiv.style.width = this.gridwidth + "px"; - xLabelsDiv.style.top = "0px"; - xLabelContainer.appendChild(xLabelsDiv); - - var labels = this.getXLabels(); - for (var i = 0; i < labels.length; i++) { - var label = document.createElement("div"); - label.className = 'timegrid-label'; - label.innerHTML = labels[i]; - label.style.width = this.xCell + 'px'; - label.style.left = (i * this.xCell) + 'px'; - xLabelsDiv.appendChild(label); - } - return xLabelContainer; -}; - -/** - * Renders the vertical row labels that run along the side of the grid. The - * labels themselves are provided by the implementing layout subclasses by - * getYLabels() - * - * @return {Element} a DOM element containing the vertical labels - */ -Timegrid.Layout.prototype.renderYLabels = function() { - this._yLabelContainer = this._yLabelContainer || - document.createElement("div"); - var yLabelContainer = this._yLabelContainer; - yLabelContainer.innerHTML = ""; - yLabelContainer.className = 'timegrid-ylabels-window'; - yLabelContainer.style.width = this.yLabelWidth + "px"; - yLabelContainer.style.height = this.height - this.xLabelHeight - - this.scrollwidth - this.tabHeight - 2 + "px"; - yLabelContainer.style.top = this.xLabelHeight - 1 + "px"; - - var yLabelsDiv = document.createElement("div"); - yLabelsDiv.className = 'timegrid-ylabels'; - yLabelsDiv.style.height = this.gridheight + "px"; - yLabelsDiv.style.width = this.yLabelWidth + "px"; - yLabelsDiv.style.left = "0px"; - yLabelContainer.appendChild(yLabelsDiv); - - var labels = this.getYLabels(); - var labelDivs = []; - for (var i = 0; i < labels.length; i++) { - var label = document.createElement('div'); - label.className = 'timegrid-label'; - label.innerHTML = labels[i]; - label.style.height = this.yCell + 'px'; - label.style.top = i * this.yCell + 'px'; - - yLabelsDiv.appendChild(label); - } - - return yLabelContainer; -}; - -/** - * An abstract method to get the horizontal column labels for this layout. This - * method must be implemented by all layout types subclassing Layout. - * - * @function - * @return {Array} an array of strings to use as column labels - */ -Timegrid.Layout.prototype.getXLabels = Timegrid.abstract("getXLabels"); - -/** - * An abstract method to get the vertical row labels for this layout. This - * method must be implemented by all layout types subclassing Layout. - * - * @function - * @return {Array} an array of strings to use as row labels - */ -Timegrid.Layout.prototype.getYLabels = Timegrid.abstract("getYLabels"); diff --git a/src/webapp/api/scripts/layouts/nday.js.orig b/src/webapp/api/scripts/layouts/nday.js.orig deleted file mode 100644 index 0e720e8..0000000 --- a/src/webapp/api/scripts/layouts/nday.js.orig +++ /dev/null @@ -1,261 +0,0 @@ -/****************************************************************************** - * NDayLayout - * @fileoverview - * This is where the n-day layout is defined. The layout is designed to - * resemble the equivalent Google Calendar view. - * @author masont - *****************************************************************************/ - - /** - * Constructs an NDayLayout object. - * @class NDayLayout is a subclass of Layout that implements an n-day event - * calendar, modeled off of the weekly view found in Google Calendar. - * @extends Timegrid.Layout - * @constructor - */ -Timegrid.NDayLayout = function(eventSource, params) { - Timegrid.NDayLayout.superclass.call(this, eventSource, params); - var self = this; - - // Specifications for a week layout - this.xSize = 7; - this.ySize = 24; - this.iterable = true; - - // These are default values that can be overridden in configure - this.n = 3; - - this.xMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - var start = self.timezoneMapper(self.startTime); -<<<<<<< HEAD - var ivl = new SimileAjax.DateTime.Interval(time - start); -======= - var ivl = Timegrid.Interval(time - start); ->>>>>>> alt/master - return ivl.days; - }; - this.yMapper = function(obj) { - var time = self.timezoneMapper(obj.time); - return (time.getHours() + time.getMinutes() / 60.0) - self.dayStart; - }; - - this.configure(params); - - this.title = params.title || Timegrid.NDayLayout.l10n.makeTitle(this.n); - this.xSize = this.n; - this.dayEnd = this.dayend || 24; - this.dayStart = this.daystart || 0; - this.ySize = this.dayEnd - this.dayStart; - this.computeCellSizes(); - - this.eventSource = eventSource; - this.initializeGrid(eventSource); -}; -Timegrid.LayoutFactory.registerLayout("n-day", Timegrid.NDayLayout); - -Timegrid.NDayLayout.prototype.initializeGrid = function() { - this.startTime = this.computeStartTime(); - this.startTime.setHours(0); - this.endTime = this.computeEndTime(this.startTime); - - this.updateGrid(); -}; - -Timegrid.NDayLayout.prototype.updateGrid = function() { - var now = new Date(); - if (now.isBetween(this.startTime, this.endTime)) { this.now = now; } - - this.endpoints = []; - if (this.startTime) { - var iterator = this.eventSource.getEventIterator(this.startTime, - this.endTime); - while (iterator.hasNext()) { - var ends = Timegrid.NDayLayout.getEndpoints(iterator.next()); - this.endpoints.push(ends[0]); - this.endpoints.push(ends[1]); - } - } - this.endpoints.sort(function(a, b) { - var diff = a.time - b.time; - if (!diff) { - return a.type == "start" ? 1 : -1; - } else { - return diff; - } - }); -}; - -Timegrid.NDayLayout.prototype.renderEvents = function(doc) { - var eventContainer = doc.createElement("div"); - $(eventContainer).addClass("timegrid-events"); - var currentEvents = {}; - var currentCount = 0; - for (var i = 0; i < this.endpoints.length; i++) { - var endpoint = this.endpoints[i]; - var x = this.xMapper(endpoint); - var y = this.yMapper(endpoint); - if (endpoint.type == "start") { - // Render the event - var eventDiv = this.renderEvent(endpoint.event, x, y); - eventContainer.appendChild(eventDiv); - // Push the event div onto the current events set - currentEvents[endpoint.event.getID()] = eventDiv; - currentCount++; - // Adjust widths and offsets as necessary - var hIndex = 0; - for (var id in currentEvents) { - var eDiv = currentEvents[id]; - var newWidth = this.xCell / currentCount; - var newLeft = this.xCell * x + newWidth * hIndex; - $(eDiv).css("width", newWidth + "px"); - $(eDiv).css("left", newLeft + "px"); - hIndex++; - } - } else if (endpoint.type == "end") { - // Pop event from current events set - delete currentEvents[endpoint.event.getID()]; - currentCount--; - } - } -<<<<<<< HEAD - var nowDiv = this.renderNow(); - if (nowDiv) { - return $([eventContainer, nowDiv]); - } else { - return eventContainer; - } -======= - return eventContainer; ->>>>>>> alt/master -}; - -Timegrid.NDayLayout.prototype.renderEvent = function(evt, x, y) { - var ediv = document.createElement('div'); - var tediv = document.createElement('div'); - if (!this.mini) { tediv.innerHTML = evt.getText(); } - ediv.appendChild(tediv); - var length = (evt.getEnd() - evt.getStart()) / (1000 * 60 * 60.0); - var className = "timegrid-event"; - if (!this.mini) { - className += ' timegrid-rounded-shadow'; - } - ediv.className = className; - ediv.style.height = this.yCell * length + "px"; - ediv.style.top = this.yCell * y + "px"; - ediv.style.left = this.xCell * x + 'px'; -<<<<<<< HEAD - if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } - if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } -======= - ediv.title = evt.getText(); - if (evt.getColor()) { ediv.style.backgroundColor = evt.getColor(); } - if (evt.getTextColor()) { ediv.style.color = evt.getTextColor(); } - - if (Timegrid.eventGridClickListener && Timegrid.eventGridInput) { - var inp = Timegrid.eventGridInput(evt.getText()); - ediv.onclick = function() { Timegrid.eventGridClickListener(inp); }; - } ->>>>>>> alt/master - return ediv; // Return the actual DOM element -}; - -Timegrid.NDayLayout.prototype.renderNow = function() { - // If we aren't looking at the current time, return - if (!this.now) { return; } - - var nowX = this.xMapper({ time: this.now }); - var nowY = Math.floor(this.yMapper({ time: this.now })); - - var rectDiv = $('
              ').addClass('timegrid-week-highlights'); - var yRect = $('
              ').height(this.yCell + "px") - .width(this.xCell * this.xSize + "px") - .css('top', nowY * this.yCell + "px") - .addClass('timegrid-week-highlight'); - var xRect = $('
              ').height(this.yCell * this.ySize + "px") - .width(this.xCell + "px") - .css('left', nowX * this.xCell + "px") - .addClass('timegrid-week-highlight'); - rectDiv.append(xRect).append(yRect); - return rectDiv.get(0); -}; - -Timegrid.NDayLayout.prototype.getXLabels = function() { - var date = new Date(this.startTime); - var labels = []; - var format = this.mini ? Timegrid.NDayLayout.l10n.mini.xLabelFormat : - Timegrid.NDayLayout.l10n.xLabelFormat; - while (date < this.endTime) { - labels.push(date.format(format)); - date.setHours(24); - } - return labels; -}; - -Timegrid.NDayLayout.prototype.getYLabels = function() { - var date = (new Date()).clearTime(); - var labels = []; - var format = this.mini ? Timegrid.NDayLayout.l10n.mini.yLabelFormat : - Timegrid.NDayLayout.l10n.yLabelFormat; - for (var i = +this.dayStart; i < +this.dayEnd; i++) { - date.setHours(i); - labels.push(date.format(format)); - } - return labels; -}; - -Timegrid.NDayLayout.prototype.goPrevious = function() { - this.endTime = this.startTime; - this.startTime = this.computeStartTime(this.endTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NDayLayout.prototype.goNext = function() { - this.startTime = this.endTime; - this.endTime = this.computeEndTime(this.startTime); - this.updateGrid(); - this.render(); -}; - -Timegrid.NDayLayout.prototype.getCurrent = function() { - this.endTime.add('s', -1); - var result = Timegrid.NDayLayout.l10n.makeRange(this.startTime, - this.endTime); - this.endTime.add('s', 1); - return result; -}; - -Timegrid.NDayLayout.prototype.computeStartTime = function(date) { - if (date) { - var startTime = new Date(date); - startTime.add('d', 0 - this.n); - startTime.setHours(0); - return startTime; - } else { - var startTime = new Date(this.eventSource.getEarliestDate()) || - new Date(); - startTime.clearTime(); - return startTime; - } -}; - -Timegrid.NDayLayout.prototype.computeEndTime = function(date) { - if (date) { - var endTime = new Date(date); - endTime.add('d', this.n); - endTime.setHours(0); - return endTime; - } - return false; -}; - -Timegrid.NDayLayout.getEndpoints = function(evt) { - return [ { type: "start", - time: evt.getStart(), - event: evt }, - { type: "end", - time: evt.getEnd(), - event: evt } ]; -}; - diff --git a/src/webapp/api/scripts/sources/default.js.orig b/src/webapp/api/scripts/sources/default.js.orig deleted file mode 100644 index 1e5965d..0000000 --- a/src/webapp/api/scripts/sources/default.js.orig +++ /dev/null @@ -1,416 +0,0 @@ -/****************************************************************************** - * Default Event Source - *****************************************************************************/ - - -Timegrid.DefaultEventSource = function(eventIndex) { - Timegrid.DefaultEventSource.superclass.call(this); - this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex(); -}; -$.inherit(Timegrid.DefaultEventSource, Timegrid.ListenerAware); - -Timegrid.DefaultEventSource.prototype.loadXML = function(xml, url) { - var base = this._getBaseURL(url); - - var wikiURL = xml.documentElement.getAttribute("wiki-url"); - var wikiSection = xml.documentElement.getAttribute("wiki-section"); - - var dateTimeFormat = xml.documentElement.getAttribute("date-time-format"); - var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); - - var node = xml.documentElement.firstChild; - var added = false; - while (node != null) { - if (node.nodeType == 1) { - var description = ""; - if (node.firstChild != null && node.firstChild.nodeType == 3) { - description = node.firstChild.nodeValue; - } - var evt = new Timegrid.DefaultEventSource.Event( - parseDateTimeFunction(node.getAttribute("start")), - parseDateTimeFunction(node.getAttribute("end")), - parseDateTimeFunction(node.getAttribute("latestStart")), - parseDateTimeFunction(node.getAttribute("earliestEnd")), - node.getAttribute("isDuration") != "true", - node.getAttribute("title"), - description, - this._resolveRelativeURL(node.getAttribute("image"), base), - this._resolveRelativeURL(node.getAttribute("link"), base), - this._resolveRelativeURL(node.getAttribute("icon"), base), - node.getAttribute("color"), - node.getAttribute("textColor") - ); - evt._node = node; - evt.getProperty = function(name) { - return this._node.getAttribute(name); - }; - evt.setWikiInfo(wikiURL, wikiSection); - - this._events.add(evt); - - added = true; - } - node = node.nextSibling; - } - - if (added) { - this._fire("onAddMany", []); - } -}; - - -Timegrid.DefaultEventSource.prototype.loadJSON = function(data, url) { - var base = this._getBaseURL(url); - var added = false; - if (data && data.events){ - var wikiURL = ("wikiURL" in data) ? data.wikiURL : null; - var wikiSection = ("wikiSection" in data) ? data.wikiSection : null; - - var dateTimeFormat = ("dateTimeFormat" in data) ? data.dateTimeFormat : null; - var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); - - for (var i=0; i < data.events.length; i++){ - var event = data.events[i]; - if (!(event.start || event.end || - event.latestStart || event.earliestEnd)) { - continue; - } - var evt = new Timegrid.DefaultEventSource.Event( - parseDateTimeFunction(event.start), - parseDateTimeFunction(event.end), - parseDateTimeFunction(event.latestStart), - parseDateTimeFunction(event.earliestEnd), - event.isDuration || false, - event.title, - event.description, - this._resolveRelativeURL(event.image, base), - this._resolveRelativeURL(event.link, base), - this._resolveRelativeURL(event.icon, base), - event.color, - event.textColor - ); - evt._obj = event; - evt.getProperty = function(name) { - return this._obj[name]; - }; - evt.setWikiInfo(wikiURL, wikiSection); - this._events.add(evt); - added = true; - } - } - if (added) { - this._fire("onAddMany", []); - } -}; - -/* - * Contributed by Morten Frederiksen, http://www.wasab.dk/morten/ - */ -Timegrid.DefaultEventSource.prototype.loadSPARQL = function(xml, url) { - var base = this._getBaseURL(url); - - var dateTimeFormat = 'iso8601'; - var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat); - - if (xml == null) { - return; - } - - /* - * Find tag - */ - var node = xml.documentElement.firstChild; - while (node != null && (node.nodeType != 1 || node.nodeName != 'results')) { - node = node.nextSibling; - } - - var wikiURL = null; - var wikiSection = null; - if (node != null) { - wikiURL = node.getAttribute("wiki-url"); - wikiSection = node.getAttribute("wiki-section"); - - node = node.firstChild; - } - - var added = false; - while (node != null) { - if (node.nodeType == 1) { - var bindings = { }; - var binding = node.firstChild; - while (binding != null) { - if (binding.nodeType == 1 && - binding.firstChild != null && - binding.firstChild.nodeType == 1 && - binding.firstChild.firstChild != null && - binding.firstChild.firstChild.nodeType == 3) { - bindings[binding.getAttribute('name')] = binding.firstChild.firstChild.nodeValue; - } - binding = binding.nextSibling; - } - - if (bindings["start"] == null && bindings["date"] != null) { - bindings["start"] = bindings["date"]; - } - - var evt = new Timegrid.DefaultEventSource.Event( - parseDateTimeFunction(bindings["start"]), - parseDateTimeFunction(bindings["end"]), - parseDateTimeFunction(bindings["latestStart"]), - parseDateTimeFunction(bindings["earliestEnd"]), - bindings["isDuration"] != "true", - bindings["title"], - bindings["description"], - this._resolveRelativeURL(bindings["image"], base), - this._resolveRelativeURL(bindings["link"], base), - this._resolveRelativeURL(bindings["icon"], base), - bindings["color"], - bindings["textColor"] - ); - evt._bindings = bindings; - evt.getProperty = function(name) { - return this._bindings[name]; - }; - evt.setWikiInfo(wikiURL, wikiSection); - - this._events.add(evt); - added = true; - } - node = node.nextSibling; - } - - if (added) { - this._fire("onAddMany", []); - } -}; - -Timegrid.DefaultEventSource.prototype.add = function(evt) { - this._events.add(evt); - this._fire("onAddOne", [evt]); -}; - -Timegrid.DefaultEventSource.prototype.addMany = function(events) { - for (var i = 0; i < events.length; i++) { - this._events.add(events[i]); - } - this._fire("onAddMany", []); -}; - -Timegrid.DefaultEventSource.prototype.clear = function() { - this._events.removeAll(); - this._fire("onClear", []); -}; - -Timegrid.DefaultEventSource.prototype.getEventIterator = function(startDate, endDate) { - return this._events.getIterator(startDate, endDate); -}; - -Timegrid.DefaultEventSource.prototype.getAllEventIterator = function() { - return this._events.getAllIterator(); -}; - -Timegrid.DefaultEventSource.prototype.getCount = function() { - return this._events.getCount(); -}; - -Timegrid.DefaultEventSource.prototype.getEarliestDate = function() { - return this._events.getEarliestDate(); -}; - -Timegrid.DefaultEventSource.prototype.getLatestDate = function() { - return this._events.getLatestDate(); -}; - -Timegrid.DefaultEventSource.prototype._getBaseURL = function(url) { - if (url.indexOf("://") < 0) { - var url2 = this._getBaseURL(document.location.href); - if (url.substr(0,1) == "/") { - url = url2.substr(0, url2.indexOf("/", url2.indexOf("://") + 3)) + url; - } else { - url = url2 + url; - } - } - - var i = url.lastIndexOf("/"); - if (i < 0) { - return ""; - } else { - return url.substr(0, i+1); - } -}; - -Timegrid.DefaultEventSource.prototype._resolveRelativeURL = function(url, base) { - if (url == null || url == "") { - return url; - } else if (url.indexOf("://") > 0) { - return url; - } else if (url.substr(0,1) == "/") { - return base.substr(0, base.indexOf("/", base.indexOf("://") + 3)) + url; - } else { - return base + url; - } -}; - - -Timegrid.DefaultEventSource.Event = function( - start, end, latestStart, earliestEnd, instant, - text, description, image, link, - icon, color, textColor) { - - this._id = "e" + Math.floor(Math.random() * 1000000); - - this._instant = instant || (end == null); - - this._start = start; - this._end = (end != null) ? end : start; - - this._latestStart = (latestStart != null) ? latestStart : (instant ? this._end : this._start); - this._earliestEnd = (earliestEnd != null) ? earliestEnd : (instant ? this._start : this._end); - -<<<<<<< HEAD - this._text = SimileAjax.HTML.deEntify(text); - this._description = SimileAjax.HTML.deEntify(description); -======= - this._text = $('
              ').html(text).text(); - this._description = $('
              ').html(text).text(); ->>>>>>> alt/master - this._image = (image != null && image != "") ? image : null; - this._link = (link != null && link != "") ? link : null; - - this._icon = (icon != null && icon != "") ? icon : null; - this._color = (color != null && color != "") ? color : null; - this._textColor = (textColor != null && textColor != "") ? textColor : null; - - this._wikiURL = null; - this._wikiSection = null; -}; - -Timegrid.DefaultEventSource.Event.prototype = { - getID: function() { return this._id; }, - - isInstant: function() { return this._instant; }, - isImprecise: function() { return this._start != this._latestStart || this._end != this._earliestEnd; }, - - getStart: function() { return this._start; }, - getEnd: function() { return this._end; }, - getLatestStart: function() { return this._latestStart; }, - getEarliestEnd: function() { return this._earliestEnd; }, - - getText: function() { return this._text; }, - getDescription: function() { return this._description; }, - getImage: function() { return this._image; }, - getLink: function() { return this._link; }, - - getIcon: function() { return this._icon; }, - getColor: function() { return this._color; }, - getTextColor: function() { return this._textColor; }, - - getInterval: function() { -<<<<<<< HEAD - return new SimileAjax.DateTime.Interval(this.getEnd() - -======= - return new Timegrid.Interval(this.getEnd() - ->>>>>>> alt/master - this.getStart()); - }, - - getProperty: function(name) { return null; }, - - getWikiURL: function() { return this._wikiURL; }, - getWikiSection: function() { return this._wikiSection; }, - setWikiInfo: function(wikiURL, wikiSection) { - this._wikiURL = wikiURL; - this._wikiSection = wikiSection; - }, - - fillDescription: function(elmt) { - elmt.innerHTML = this._description; - }, - fillWikiInfo: function(elmt) { - if (this._wikiURL != null && this._wikiSection != null) { - var wikiID = this.getProperty("wikiID"); - if (wikiID == null || wikiID.length == 0) { - wikiID = this.getText(); - } - wikiID = wikiID.replace(/\s/g, "_"); - - var url = this._wikiURL + this._wikiSection.replace(/\s/g, "_") + "/" + wikiID; - var a = document.createElement("a"); - a.href = url; - a.target = "new"; - a.innerHTML = "Discuss"; - - elmt.appendChild(document.createTextNode("[")); - elmt.appendChild(a); - elmt.appendChild(document.createTextNode("]")); - } else { - elmt.style.display = "none"; - } - }, - fillTime: function(elmt, labeller) { - if (this._instant) { - if (this.isImprecise()) { - elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); - elmt.appendChild(elmt.ownerDocument.createElement("br")); - elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); - } else { - elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); - } - } else { - if (this.isImprecise()) { - elmt.appendChild(elmt.ownerDocument.createTextNode( - labeller.labelPrecise(this._start) + " ~ " + labeller.labelPrecise(this._latestStart))); - elmt.appendChild(elmt.ownerDocument.createElement("br")); - elmt.appendChild(elmt.ownerDocument.createTextNode( - labeller.labelPrecise(this._earliestEnd) + " ~ " + labeller.labelPrecise(this._end))); - } else { - elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); - elmt.appendChild(elmt.ownerDocument.createElement("br")); - elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); - } - } - }, - fillInfoBubble: function(elmt, theme, labeller) { - var doc = elmt.ownerDocument; - - var title = this.getText(); - var link = this.getLink(); - var image = this.getImage(); - - if (image != null) { - var img = doc.createElement("img"); - img.src = image; - - theme.event.bubble.imageStyler(img); - elmt.appendChild(img); - } - - var divTitle = doc.createElement("div"); - var textTitle = doc.createTextNode(title); - if (link != null) { - var a = doc.createElement("a"); - a.href = link; - a.appendChild(textTitle); - divTitle.appendChild(a); - } else { - divTitle.appendChild(textTitle); - } - theme.event.bubble.titleStyler(divTitle); - elmt.appendChild(divTitle); - - var divBody = doc.createElement("div"); - this.fillDescription(divBody); - theme.event.bubble.bodyStyler(divBody); - elmt.appendChild(divBody); - - var divTime = doc.createElement("div"); - this.fillTime(divTime, labeller); - theme.event.bubble.timeStyler(divTime); - elmt.appendChild(divTime); - - var divWiki = doc.createElement("div"); - this.fillWikiInfo(divWiki); - theme.event.bubble.wikiStyler(divWiki); - elmt.appendChild(divWiki); - } -}; diff --git a/src/webapp/api/scripts/sources/recurring.js.orig b/src/webapp/api/scripts/sources/recurring.js.orig deleted file mode 100644 index 70e8116..0000000 --- a/src/webapp/api/scripts/sources/recurring.js.orig +++ /dev/null @@ -1,143 +0,0 @@ -/** - * @name Timegrid.RecurringEventSource - * @author masont - */ - -/** - * A type of EventSource that allows the creation and display of recurring - * events that are not tied to a specific date, e.g. 8am on MWF. - * - * @constructor - */ -Timegrid.RecurringEventSource = function() { - Timegrid.RecurringEventSource.superclass.call(this); - - /* - * The actual array containing event prototypes is kept private, and only - * accessed/modified through priviledged methods created here, in the - * constructor. - */ - var eventPrototypes = new DStructs.Array(); - - //========================= Privileged Methods ==========================// - - /** Sets this source's event prototypes to the given prototypes */ - this.setEventPrototypes = function(a) { - eventPrototypes.clear(); - this.addAllEventPrototypes(a); - }; - - /** Adds the given event prototype to this event source */ - this.addEventPrototype = function(eventPrototype) { - eventPrototypes.push(eventPrototype); - this._fire("onAddMany", []); - }; - - /** Adds all of the event prototypes from the given array */ - this.addAllEventPrototypes = function(a) { - eventPrototypes.addAll(a); - this._fire("onAddMany", []); - }; - - /** Removes the given event prototype from this source's prototypes */ - this.removeEventPrototype = function(eventPrototype) { - return eventPrototypes.remove(eventPrototype); - }; - - /** Removes all of the event prototypes from this source */ - this.clearEventPrototypes = function() { - eventPrototypes.clear(); - this._fire("onClear", []); - }; - - /** Generates events from event prototypes */ - this.generateEvents = function(startDate, endDate) { - var result = new DStructs.Array(); - eventPrototypes.each(function(ep) { - result.addAll(ep.generateEvents(startDate, endDate)); - }); - return result; - }; -}; -$.inherit(Timegrid.RecurringEventSource, Timegrid.ListenerAware); - -Timegrid.RecurringEventSource.prototype.loadXML = function(xml, url) { - -}; -Timegrid.RecurringEventSource.prototype.loadJSON = function(data, url) { - -}; -Timegrid.RecurringEventSource.prototype.getEventIterator = function(startDate, endDate) { - return this.generateEvents(startDate, endDate).iterator(); -}; -Timegrid.RecurringEventSource.prototype.getEarliestDate = function() { - return (new Date()).clearTime().setDay(0); -}; -Timegrid.RecurringEventSource.prototype.getLatestDate = function() { - return (new Date()).clearTime().setDay(7); -}; - -Timegrid.RecurringEventSource.EventPrototype = function(dayArray, start, end, - text, description, image, link, icon, color, textColor) { - var id = "e" + Math.floor(Math.random() * 1000000); - var days = new DStructs.Array(); days.addAll(dayArray); - - this.getDays = function() { return days; }; - this.getStart = function() { return start; }; - this.getEnd = function() { return end; }; - - this.getID = function() { return id; } - this.getText = function() { -<<<<<<< HEAD - return SimileAjax.HTML.deEntify(text); - }; - this.getDescription = function() { - return SimileAjax.HTML.deEntify(description); -======= - return $('
              ').html(text).text(); - }; - this.getDescription = function() { - return $('
              ').html(text).text(); ->>>>>>> alt/master - }; - this.getImage = function() { - return (image != null && image != "") ? image : null; - }; - this.getLink = function() { - return (link != null && link != "") ? link : null; - }; - this.getIcon = function() { - return (icon != null && icon != "") ? icon : null; - }; - this.getColor = function() { - return (color != null && color != "") ? color : null; - }; - this.getTextColor = function() { - return (textColor != null && textColor != "") ? textColor : null; - } - this.generateFrom = function(date) { - if (!this.getDays().contains(date.getDay())) { return false; } - var startTime = new Date(this.getStart()); - var endTime = new Date(this.getEnd()); - startTime.setDate(date.getDate()); - startTime.setMonth(date.getMonth()); - startTime.setFullYear(date.getFullYear()); - endTime.setDate(date.getDate()); - endTime.setMonth(date.getMonth()); - endTime.setFullYear(date.getFullYear()); - return new Timegrid.DefaultEventSource.Event(startTime, endTime, null, - null, false, text, description, image, link, icon, color, - textColor); - }; -}; - -Timegrid.RecurringEventSource.EventPrototype.prototype = { - generateEvents: function(start, end) { - var events = new DStructs.Array(); - for (var date = new Date(start); date < end; date.add('d', 1)) { - var event = this.generateFrom(date); - if (event) { events.push(event); } - } - return events; - } -}; diff --git a/src/webapp/api/scripts/timegrid.js.orig b/src/webapp/api/scripts/timegrid.js.orig deleted file mode 100644 index b643e4d..0000000 --- a/src/webapp/api/scripts/timegrid.js.orig +++ /dev/null @@ -1,254 +0,0 @@ -/****************************************************************************** - * Timegrid - *****************************************************************************/ -<<<<<<< HEAD -======= -Timegrid.listener = null; -Timegrid.eventGridClickListener = null; -Timegrid.eventGridInput = null; ->>>>>>> alt/master - -Timegrid.create = function(node, eventSource, layoutName, layoutParams) { - return new Timegrid._Impl(node, eventSource, layoutName, layoutParams); -}; - -Timegrid.resize = function() { - for (var i = 0; i < window.timegrids.length; i++) { - window.timegrids[i]._resize(); - } - return false; -}; - -Timegrid.createFromDOM = function(elmt) { - var config = Timegrid.getConfigFromDOM(elmt); -<<<<<<< HEAD -======= - Timegrid.listener = window[config.listener]; - Timegrid.eventGridClickListener = window[config.gridlistener]; - Timegrid.eventGridInput = window[config.gridlistenerinput]; - ->>>>>>> alt/master - var layoutNames = config.views.split(","); - var getExtension = function(s) { - return s.split('.').pop().toLowerCase(); - }; - if (config.eventsource) { - var eventSource = eval(config.eventsource); - var tg = Timegrid.create(elmt, eventSource, layoutNames, config); - return tg; - } else if (config.src) { - var eventSource = new Timegrid.DefaultEventSource(); - var tg = Timegrid.create(elmt, eventSource, layoutNames, config); - switch (getExtension(config.src)) { - case 'xml': - tg.loadXML(config.src, function(xml, url) { - eventSource.loadXML(xml, url); - }); - break; - case 'js': - tg.loadJSON(config.src, function(json, url) { - eventSource.loadJSON(json, url); - }); - break; - } - return tg; - } -}; - -Timegrid.getConfigFromDOM = function(elmt) { - var config = $(elmt).attrs('tg'); - config.scrollwidth = $.scrollWidth(); - for (var k in config) { - config[k.toLowerCase()] = config[k]; - } - return config; -}; - -Timegrid.loadXML = function(url, f) { - var fError = function(statusText, status, xmlhttp) { -<<<<<<< HEAD - alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); -======= - //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); - $.debugLog(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText, true); ->>>>>>> alt/master - }; - var fDone = function(xmlhttp) { - var xml = xmlhttp.responseXML; - if (!xml.documentElement && xmlhttp.responseStream) { - xml.load(xmlhttp.responseStream); - } - f(xml, url); - }; -<<<<<<< HEAD - SimileAjax.XmlHttp.get(url, fError, fDone); -======= - $.getXmlHttp(url, fError, fDone); ->>>>>>> alt/master -}; - -Timegrid.loadJSON = function(url, f) { - var fError = function(statusText, status, xmlhttp) { -<<<<<<< HEAD - alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); -======= - //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); - $.debugLog(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); ->>>>>>> alt/master - }; - var fDone = function(xmlhttp) { - f(eval('(' + xmlhttp.responseText + ')'), url); - }; -<<<<<<< HEAD - SimileAjax.XmlHttp.get(url, fError, fDone); -======= - $.getXmlHttp(url, fError, fDone); ->>>>>>> alt/master -}; - -Timegrid._Impl = function(node, eventSource, layoutNames, layoutParams) { - var tg = this; - this._container = node; - this._eventSource = eventSource; - this._layoutNames = layoutNames; - this._layoutParams = layoutParams; - - if (this._eventSource) { - this._eventListener = { - onAddMany: function() { tg._onAddMany(); }, - onClear: function() { tg._onClear(); } - } - this._eventSource.addListener(this._eventListener); - } - - this._construct(); -}; - -Timegrid._Impl.prototype.loadXML = function(url, f) { - var tg = this; - - var fError = function(statusText, status, xmlhttp) { -<<<<<<< HEAD - alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); -======= - //alert(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); - $.debugLog(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); ->>>>>>> alt/master - tg.hideLoadingMessage(); - }; - var fDone = function(xmlhttp) { - try { - var xml = xmlhttp.responseXML; - if (!xml.documentElement && xmlhttp.responseStream) { - xml.load(xmlhttp.responseStream); - } - f(xml, url); - } finally { - tg.hideLoadingMessage(); - } - }; - this.showLoadingMessage(); - window.setTimeout(function() { -<<<<<<< HEAD - SimileAjax.XmlHttp.get(url, fError, fDone); -======= - $.getXmlHttp(url, fError, fDone); ->>>>>>> alt/master - }, 0); -}; - -Timegrid._Impl.prototype.loadJSON = function(url, f) { - var tg = this; - var fError = function(statusText, status, xmlhttp) { -<<<<<<< HEAD - alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); -======= - //alert(Timegrid.l10n.jsonErrorMessage + " " + url + "\n" + statusText); - $.debugLog(Timegrid.l10n.xmlErrorMessage + " " + url + "\n" + statusText); ->>>>>>> alt/master - tg.hideLoadingMessage(); - }; - var fDone = function(xmlhttp) { - try { - f(eval('(' + xmlhttp.responseText + ')'), url); - } finally { - tg.hideLoadingMessage(); - } - }; - this.showLoadingMessage(); -<<<<<<< HEAD - window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0); -======= - window.setTimeout(function() { $.getXmlHttp(url, fError, fDone); }, 0); ->>>>>>> alt/master -}; - -Timegrid._Impl.prototype._construct = function() { - this.rendering = true; - var self = this; - this._layouts = $.map(this._layoutNames, function(s) { - return Timegrid.LayoutFactory.createLayout(s, self._eventSource, - self._layoutParams); - }); -<<<<<<< HEAD -======= - ->>>>>>> alt/master - if (this._panel) { - this._panel.setLayouts(this._layouts); - } else { - this._panel = new Timegrid.Controls.Panel(this._layouts); - } - var container = this._container; - var doc = container.ownerDocument; - - while (container.firstChild) { - container.removeChild(container.firstChild); - } - $(container).addClass('timegrid-default'); - -<<<<<<< HEAD - var message = SimileAjax.Graphics.createMessageBubble(doc); -======= - var message = $.createMessageBubble(doc, Timegrid.urlPrefix); ->>>>>>> alt/master - message.containerDiv.className = "timegrid-message-container"; - container.appendChild(message.containerDiv); - - message.contentDiv.className = "timegrid-message"; - message.contentDiv.innerHTML = " " + Timegrid.l10n.loadingMessage; - - this.showLoadingMessage = function() { $(message.containerDiv).show(); }; - this.hideLoadingMessage = function() { $(message.containerDiv).hide(); }; -<<<<<<< HEAD - -======= ->>>>>>> alt/master - this._panel.render(container); - this.rendering = false; -}; - -Timegrid._Impl.prototype._update = function() { - this._panel.renderChanged(); -}; - -Timegrid._Impl.prototype._resize = function() { - var newHeight = $(this._container).height(); - var newWidth = $(this._container).width(); - - if (!(newHeight == this._oldHeight && newWidth == this._oldWidth)) { - if (!this.rendering) { this._construct(); } - this._oldHeight = newHeight; - this._oldWidth = newWidth; - } -}; - -Timegrid._Impl.prototype._onAddMany = function() { - this._update(); -}; - -Timegrid._Impl.prototype._onClear = function() { - this._update(); -}; - diff --git a/src/webapp/api/scripts/util/debug.js.orig b/src/webapp/api/scripts/util/debug.js.orig deleted file mode 100644 index ed68286..0000000 --- a/src/webapp/api/scripts/util/debug.js.orig +++ /dev/null @@ -1,20 +0,0 @@ -/*================================================== - * Debug Utility Functions - *================================================== - */ - -Timegrid.Debug = new Object(); - -Timegrid.Debug.log = function(msg) { -}; - -Timegrid.Debug.exception = function(e) { -<<<<<<< HEAD - alert("Caught exception: " + (SimileAjax.Platform.isIE ? e.message : e)); -======= - e = $.getIsIE() ? e.message : e; - $.debugException(e, "Caught exception"); - //alert("Caught exception: " + (SimileAjax.Platform.isIE ? e.message : e)); ->>>>>>> alt/master -}; - diff --git a/src/webapp/api/scripts/util/jquery.simile.js.orig b/src/webapp/api/scripts/util/jquery.simile.js.orig deleted file mode 100644 index 4f71673..0000000 --- a/src/webapp/api/scripts/util/jquery.simile.js.orig +++ /dev/null @@ -1,122 +0,0 @@ -/** - * This code implements the Simile jQuery plugin, which in turns simply - * provides several convenient and useful functions for manipulating the - * DOM, etc. - * @overview Simile jQuery plugin - */ - -jQuery.extend({ - /** - * Simply capitalizes the first letter of each word in its argument. - */ - capitalize: function(s) { - return s.charAt(0).toUpperCase() + s.substring(1).toLowerCase(); - }, - /** - * Provides a basic mechanism for Javascript inheritance. - */ - inherit: function(subclass, superclass) { - function Dummy() {}; - Dummy.prototype = superclass.prototype; - subclass.prototype = new Dummy(); - subclass.prototype.constructor = subclass; - subclass.superclass = superclass; - subclass.superproto = superclass.prototype; - }, - /** - * Recursively deep-copies the given object. - */ -<<<<<<< HEAD - clone: function(obj, deep) { -======= - deepClone: function(obj, deep) { ->>>>>>> alt/master - if (deep == null) { deep = true; } - var objectClone = new obj.constructor(); - for (var property in obj) { - if (!deep) { - objectClone[property] = obj[property]; - } else if (typeof obj[property] == 'object') { - objectClone[property] = obj[property].clone(deep); - } else { - objectClone[property] = obj[property]; - } - } - return objectClone; - }, - /** - * Returns the width of the scrollbar. - */ - scrollWidth: function() { - var scr = null; - var inn = null; - var wNoScroll = 0; - var wScroll = 0; - - // Outer scrolling div - scr = document.createElement('div'); - scr.style.position = 'absolute'; - scr.style.top = '-1000px'; - scr.style.left = '-1000px'; - scr.style.width = '100px'; - scr.style.height = '50px'; - // Start with no scrollbar - scr.style.overflow = 'hidden'; - - // Inner content div - inn = document.createElement('div'); - inn.style.width = '100%'; - inn.style.height = '200px'; - - // Put the inner div in the scrolling div - scr.appendChild(inn); - // Append the scrolling div to the doc - document.body.appendChild(scr); - - // Width of the inner div sans scrollbar - wNoScroll = inn.offsetWidth; - // Add the scrollbar - scr.style.overflow = 'auto'; - // Width of the inner div width scrollbar - wScroll = inn.offsetWidth; - - // Remove the scrolling div from the doc - document.body.removeChild( - document.body.lastChild); - - // Pixel width of the scroller, with an awful, awful hack - // FIXME: Fix hardcoded scrollwidth - return (wNoScroll - wScroll) || 17; - } -}); - -jQuery.fn.extend({ - /** - * The attrs method extends jQuery to allow for aggregating attributes of - * all matched elements in a $('..') expression into a nice hash. It also - * supports only returning attributes within a certain namespace, e.g. - * ex:role, when provided with the namespace prefix as an argument. - */ - attrs: function(ns) { - // Caching the compiled regex speeds this up a bit - if (!this.__namespaceRegexps) { - this.__namespaceRegexps = {}; - } - var regexp = this.__namespaceRegexps[ns]; - if (!regexp) { - this.__namespaceRegexps[ns] = regexp = - ns ? eval("/^" + ns + ":(.+)/") : /^([^:]*)$/; - } - var result = {}; - this.each(function() { - // Within this loop, 'this' refers to each matched DOM element - var atts = this.attributes; - var l = atts.length; - for (var i = 0; i < l; i++) { - var m = atts[i].name.match(regexp); - if (m) { result[m[1]] = atts[i].value; } - } - }); - return result; - } -}); diff --git a/src/webapp/api/scripts/util/util.js.orig b/src/webapp/api/scripts/util/util.js.orig deleted file mode 100644 index 3086bd7..0000000 --- a/src/webapp/api/scripts/util/util.js.orig +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * Utility Functions - *****************************************************************************/ - -Timegrid.abstract = function(name) { - return function() { - throw "A " + name + " method has not been implemented!"; - return; - }; -}; - -<<<<<<< HEAD -SimileAjax.DateTime.Interval = function(ms) { -======= -Timegrid.Interval = function(ms) { ->>>>>>> alt/master - // Conversion factors as varants to eliminate all the multiplication - var SECONDS_CF = 1000; - var MINUTES_CF = 60000; - var HOURS_CF = 3600000; - var DAYS_CF = 86400000; - var WEEKS_CF = 604800000; - var FORTNIGHTS_CF = 1209600000; - var MONTHS_CF = 2592000000; - var QUARTERS_CF = 7776000000; - var YEARS_CF = 31557600000; - var DECADES_CF = 315576000000; - var CENTURIES_CF = 3155760000000; - - this.milliseconds = Math.abs(ms); - this.seconds = Math.round(this.milliseconds / SECONDS_CF); - this.minutes = Math.round(this.milliseconds / MINUTES_CF); - this.hours = Math.round(this.milliseconds / HOURS_CF); - this.days = Math.floor(this.milliseconds / DAYS_CF); - this.weeks = Math.round(this.milliseconds / WEEKS_CF); - this.fortnights = Math.round(this.milliseconds / FORTNIGHTS_CF); - this.months = Math.round(this.milliseconds / MONTHS_CF); - // rounding errors! - this.quarters = Math.round(this.milliseconds / QUARTERS_CF); - // rounding errors! - this.years = Math.round(this.milliseconds / YEARS_CF); - // rounding errors! - this.decades = Math.round(this.milliseconds / DECADES_CF); - // rounding errors! - this.centuries = Math.round(this.milliseconds / CENTURIES_CF); - // rounding errors! -<<<<<<< HEAD -}; - -SimileAjax.DateTime.Interval.prototype.toString = function() { -======= - - return this; -}; - -Timegrid.IntervaltoString = function() { ->>>>>>> alt/master - return this.milliseconds.toString(); -}; diff --git a/src/webapp/api/timegrid-api.js.orig b/src/webapp/api/timegrid-api.js.orig deleted file mode 100644 index 95f0a90..0000000 --- a/src/webapp/api/timegrid-api.js.orig +++ /dev/null @@ -1,165 +0,0 @@ -/****************************************************************************** - * Timegrid API - * This file will load all the necessary Javascript files to make a standard - * Timegrid operate. - *****************************************************************************/ - -(function() { -<<<<<<< HEAD - var loadMe = function() { -======= ->>>>>>> alt/master - if (typeof window.Timegrid != "undefined") { - return; - } - - window.Timegrid = { - loaded: false, - params: { autoCreate: true, bundle: false }, - importers: {} - }; - - var javascriptFiles = [ - "timegrid.js", - - "util/util.js", - "util/debug.js", - "util/date.js", - "util/excanvas.pack.js", - "util/jquery.dimensions.js", - "util/jquery.simile.js", - "util/jquery.corner.js", - "util/jquery.prettybox.js", - "util/dstructs/dstructs.js", - - "controls.js", - "listeners.js", - "grid.js", - "themes.js", - "labellers.js", - - "sources/default.js", - "sources/recurring.js", - - "layouts/layout.js", - "layouts/nmonth.js", - "layouts/nday.js", - "layouts/weekly.js", - "layouts/monthly.js", - "layouts/property.js" - ]; - var cssFiles = [ - "timegrid.css", - "themes/theme-sandy-stone-beach-ocean-diver.css" - ]; - - var locales = [ "en", "fr" ]; -<<<<<<< HEAD - -======= - ->>>>>>> alt/master - var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";"); - for (var l = 0; l < defaultClientLocales.length; l++) { - var locale = defaultClientLocales[l]; - var segments = locale.split("-"); - if (segments.length > 1) { - locales.push(segments[0]); - } - locales.push(locale); - } - -<<<<<<< HEAD - var url = SimileAjax.findScript(document, "timegrid-api.js"); -======= - var url = $.findScript(document, "timegrid-api.js"); ->>>>>>> alt/master - if (url == null) { - Timegrid.error = new Error("Failed to derive URL prefix for Simile Timegrid API code files"); - return; - } - Timegrid.urlPrefix = url.substr(0, url.indexOf("timegrid-api.js")); - var paramTypes = { bundle: Boolean, autoCreate: Boolean }; -<<<<<<< HEAD - SimileAjax.parseURLParameters(url, Timegrid.params, paramTypes); -======= - $.parseURLParameters(url, Timegrid.params, paramTypes); ->>>>>>> alt/master - - /* - * Core scripts and styles - */ - if (Timegrid.params.bundle) { -<<<<<<< HEAD - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix, [ -======= - $.includeJavascriptFiles(document, Timegrid.urlPrefix, [ ->>>>>>> alt/master - "scripts/util/jquery.dimensions.js", - "scripts/util/jquery.simile.js", - "timegrid-bundle.js" - ]); -<<<<<<< HEAD - SimileAjax.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); - } else { - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); - SimileAjax.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); -======= - $.includeCssFiles(document, Timegrid.urlPrefix, [ "timegrid-bundle.css" ]); - } else { - $.includeJavascriptFiles(document, Timegrid.urlPrefix + "scripts/", javascriptFiles); - $.includeCssFiles(document, Timegrid.urlPrefix + "styles/", cssFiles); ->>>>>>> alt/master - } - - /* - * Localization - */ - var localeFiles = []; - for (var i = 0; i < locales.length; i++) { - localeFiles.push(locales[i] + "/locale.js"); - }; -<<<<<<< HEAD - SimileAjax.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); - if (Timegrid.params.autoCreate) { - SimileAjax.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); - } - Timegrid.loaded = true; - }; - - /* - * Load SimileAjax if it's not already loaded - */ - if (typeof SimileAjax == "undefined") { - window.SimileAjax_onLoad = loadMe; - - //var url = "http://127.0.0.1:8888/ajax/api/simile-ajax-api.js?bundle=false"; - var url = "http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js"; - //var url = "http://simile.mit.edu/repository/ajax/trunk/src/webapp/api/simile-ajax-api.js"; - var createScriptElement = function() { - var script = document.createElement("script"); - script.type = "text/javascript"; - script.language = "JavaScript"; - script.src = url; - document.getElementsByTagName("head")[0].appendChild(script); - } - if (document.body == null) { - try { - document.write(""); - } catch (e) { - createScriptElement(); - } - } else { - createScriptElement(); - } - } else { - loadMe(); - } -======= - $.includeJavascriptFiles(document, Timegrid.urlPrefix + "locales/", localeFiles); - if (Timegrid.params.autoCreate) { - $.includeJavascriptFile(document, Timegrid.urlPrefix + "scripts/create.js"); - } - Timegrid.loaded = true; ->>>>>>> alt/master -})(); diff --git a/src/webapp/api/styles/timegrid.css.orig b/src/webapp/api/timegrid-bundle.css similarity index 69% rename from src/webapp/api/styles/timegrid.css.orig rename to src/webapp/api/timegrid-bundle.css index 01e49be..01fca12 100644 --- a/src/webapp/api/styles/timegrid.css.orig +++ b/src/webapp/api/timegrid-bundle.css @@ -1,3 +1,82 @@ +/* + From Kuler, http://kuler.adobe.com/ + + #e6e2af + #a7a37e + #efecca + #046380 + #002f2f + */ + +div.timegrid-tab { + background-color: #efecca; +} + +div.timegrid-tab-active { + background-color: #a7a37e; + font-weight: bold; +} + +div.timegrid-tab a { + text-decoration: none; +} + +div.timegrid-view { + background: #a7a37e; + border: 1px solid #a7a37e; +} + +div.timegrid-grid-window { + border: none; + background: white; +} + +div.timegrid-xlabels-window { + border-left: 1px solid #a7a37e; + border-right: 1px solid #a7a37e; + border-bottom: 1px solid #a7a37e; +} +div.timegrid-ylabels-window { + border-top: 1px solid #a7a37e; + border-bottom: 1px solid #a7a37e; + border-right: 1px solid #a7a37e; +} + +div.timegrid-hline, div.timegrid-vline { + background: #e6e2af; +} + +div.timegrid-xlabels-window, div.timegrid-ylabels-window { + background: #efecca; +} + +div.timegrid-label { + color: #046380; +} + +.timegrid-xlabels div.timegrid-label { + border-left: 1px solid #e6e2af; +} + +.timegrid-ylabels div.timegrid-label { + border-top: 1px solid #e6e2af; +} + +div.timegrid-event { + background-color: #e6e2af; + color: #046380; +} + +/* Monthly View */ +div.timegrid-month-cell { + color: #046380; + padding: 0px; +} + +ul.timegrid-event-list { + list-style-position: inside; + padding: .5em; +} div.timegrid-default { font-family: Helvetica, Arial, sans-serif; font-size: 9pt; @@ -54,22 +133,8 @@ div.timegrid-grid-window { border: 1px inset black; } -<<<<<<< HEAD -div.timegrid-hline { - position: absolute; - height: 1px; - overflow: hidden; - background-color: #999; -} - -div.timegrid-vline { - position: absolute; - width: 1px; - background-color: #444; -======= table.timegrid-gridlines, .timegrid-hline, .timegrid-vline { border: 1px solid #e6e2af; ->>>>>>> alt/master } div.timegrid-events { @@ -195,8 +260,6 @@ span.timegrid-month-date-label { font-weight: bold; text-align: center; } -<<<<<<< HEAD -======= @media print { @@ -206,4 +269,3 @@ span.timegrid-month-date-label { } } ->>>>>>> alt/master diff --git a/src/webapp/api/timegrid-bundle.js b/src/webapp/api/timegrid-bundle.js new file mode 100644 index 0000000..a87c3d3 --- /dev/null +++ b/src/webapp/api/timegrid-bundle.js @@ -0,0 +1,3355 @@ + + +/* timegrid.js */ + + +Timegrid.listener=null; +Timegrid.eventGridClickListener=null; +Timegrid.eventGridInput=null; + +Timegrid.create=function(node,eventSource,layoutName,layoutParams){ +return new Timegrid._Impl(node,eventSource,layoutName,layoutParams); +}; + +Timegrid.resize=function(){ +for(var i=0;i "+Timegrid.l10n.loadingMessage; + +this.showLoadingMessage=function(){$(message.containerDiv).show();}; +this.hideLoadingMessage=function(){$(message.containerDiv).hide();}; +this._panel.render(container); +this.rendering=false; +}; + +Timegrid._Impl.prototype._update=function(){ +this._panel.renderChanged(); +}; + +Timegrid._Impl.prototype._resize=function(){ +var newHeight=$(this._container).height(); +var newWidth=$(this._container).width(); + +if(!(newHeight==this._oldHeight&&newWidth==this._oldWidth)){ +if(!this.rendering){this._construct();} +this._oldHeight=newHeight; +this._oldWidth=newWidth; +} +}; + +Timegrid._Impl.prototype._onAddMany=function(){ +this._update(); +}; + +Timegrid._Impl.prototype._onClear=function(){ +this._update(); +}; + + + +/* util.js */ + + + +Timegrid.abstract=function(name){ +return function(){ +throw"A "+name+" method has not been implemented!"; +return; +}; +}; + +Timegrid.Interval=function(ms){ + +var SECONDS_CF=1000; +var MINUTES_CF=60000; +var HOURS_CF=3600000; +var DAYS_CF=86400000; +var WEEKS_CF=604800000; +var FORTNIGHTS_CF=1209600000; +var MONTHS_CF=2592000000; +var QUARTERS_CF=7776000000; +var YEARS_CF=31557600000; +var DECADES_CF=315576000000; +var CENTURIES_CF=3155760000000; + +this.milliseconds=Math.abs(ms); +this.seconds=Math.round(this.milliseconds/SECONDS_CF); +this.minutes=Math.round(this.milliseconds/MINUTES_CF); +this.hours=Math.round(this.milliseconds/HOURS_CF); +this.days=Math.floor(this.milliseconds/DAYS_CF); +this.weeks=Math.round(this.milliseconds/WEEKS_CF); +this.fortnights=Math.round(this.milliseconds/FORTNIGHTS_CF); +this.months=Math.round(this.milliseconds/MONTHS_CF); + +this.quarters=Math.round(this.milliseconds/QUARTERS_CF); + +this.years=Math.round(this.milliseconds/YEARS_CF); + +this.decades=Math.round(this.milliseconds/DECADES_CF); + +this.centuries=Math.round(this.milliseconds/CENTURIES_CF); + + +return this; +}; + +Timegrid.IntervaltoString=function(){ +return this.milliseconds.toString(); +}; + + +/* listeners.js */ + +Timegrid.ListenerAware=function(){ +this._listeners=[]; +}; + +Timegrid.ListenerAware.prototype.addListener=function(listener){ +this._listeners.push(listener); +}; + +Timegrid.ListenerAware.prototype.removeListener=function(listener){ +for(var i=0;i0){ +return url; +}else if(url.substr(0,1)=="/"){ +return base.substr(0,base.indexOf("/",base.indexOf("://")+3))+url; +}else{ +return base+url; +} +}; + + +Timegrid.DefaultEventSource.Event=function( +start,end,latestStart,earliestEnd,instant, +text,description,image,link, +icon,color,textColor){ + +this._id="e"+Math.floor(Math.random()*1000000); + +this._instant=instant||(end==null); + +this._start=start; +this._end=(end!=null)?end:start; + +this._latestStart=(latestStart!=null)?latestStart:(instant?this._end:this._start); +this._earliestEnd=(earliestEnd!=null)?earliestEnd:(instant?this._start:this._end); + +this._text=$('
              ').html(text).text(); +this._description=$('
              ').html(text).text(); +this._image=(image!=null&&image!="")?image:null; +this._link=(link!=null&&link!="")?link:null; + +this._icon=(icon!=null&&icon!="")?icon:null; +this._color=(color!=null&&color!="")?color:null; +this._textColor=(textColor!=null&&textColor!="")?textColor:null; + +this._wikiURL=null; +this._wikiSection=null; +}; + +Timegrid.DefaultEventSource.Event.prototype={ +getID:function(){return this._id;}, + +isInstant:function(){return this._instant;}, +isImprecise:function(){return this._start!=this._latestStart||this._end!=this._earliestEnd;}, + +getStart:function(){return this._start;}, +getEnd:function(){return this._end;}, +getLatestStart:function(){return this._latestStart;}, +getEarliestEnd:function(){return this._earliestEnd;}, + +getText:function(){return this._text;}, +getDescription:function(){return this._description;}, +getImage:function(){return this._image;}, +getLink:function(){return this._link;}, + +getIcon:function(){return this._icon;}, +getColor:function(){return this._color;}, +getTextColor:function(){return this._textColor;}, + +getInterval:function(){ +return new Timegrid.Interval(this.getEnd()- +this.getStart()); +}, + +getProperty:function(name){return null;}, + +getWikiURL:function(){return this._wikiURL;}, +getWikiSection:function(){return this._wikiSection;}, +setWikiInfo:function(wikiURL,wikiSection){ +this._wikiURL=wikiURL; +this._wikiSection=wikiSection; +}, + +fillDescription:function(elmt){ +elmt.innerHTML=this._description; +}, +fillWikiInfo:function(elmt){ +if(this._wikiURL!=null&&this._wikiSection!=null){ +var wikiID=this.getProperty("wikiID"); +if(wikiID==null||wikiID.length==0){ +wikiID=this.getText(); +} +wikiID=wikiID.replace(/\s/g,"_"); + +var url=this._wikiURL+this._wikiSection.replace(/\s/g,"_")+"/"+wikiID; +var a=document.createElement("a"); +a.href=url; +a.target="new"; +a.innerHTML="Discuss"; + +elmt.appendChild(document.createTextNode("[")); +elmt.appendChild(a); +elmt.appendChild(document.createTextNode("]")); +}else{ +elmt.style.display="none"; +} +}, +fillTime:function(elmt,labeller){ +if(this._instant){ +if(this.isImprecise()){ +elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); +elmt.appendChild(elmt.ownerDocument.createElement("br")); +elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); +}else{ +elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); +} +}else{ +if(this.isImprecise()){ +elmt.appendChild(elmt.ownerDocument.createTextNode( +labeller.labelPrecise(this._start)+" ~ "+labeller.labelPrecise(this._latestStart))); +elmt.appendChild(elmt.ownerDocument.createElement("br")); +elmt.appendChild(elmt.ownerDocument.createTextNode( +labeller.labelPrecise(this._earliestEnd)+" ~ "+labeller.labelPrecise(this._end))); +}else{ +elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start))); +elmt.appendChild(elmt.ownerDocument.createElement("br")); +elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end))); +} +} +}, +fillInfoBubble:function(elmt,theme,labeller){ +var doc=elmt.ownerDocument; + +var title=this.getText(); +var link=this.getLink(); +var image=this.getImage(); + +if(image!=null){ +var img=doc.createElement("img"); +img.src=image; + +theme.event.bubble.imageStyler(img); +elmt.appendChild(img); +} + +var divTitle=doc.createElement("div"); +var textTitle=doc.createTextNode(title); +if(link!=null){ +var a=doc.createElement("a"); +a.href=link; +a.appendChild(textTitle); +divTitle.appendChild(a); +}else{ +divTitle.appendChild(textTitle); +} +theme.event.bubble.titleStyler(divTitle); +elmt.appendChild(divTitle); + +var divBody=doc.createElement("div"); +this.fillDescription(divBody); +theme.event.bubble.bodyStyler(divBody); +elmt.appendChild(divBody); + +var divTime=doc.createElement("div"); +this.fillTime(divTime,labeller); +theme.event.bubble.timeStyler(divTime); +elmt.appendChild(divTime); + +var divWiki=doc.createElement("div"); +this.fillWikiInfo(divWiki); +theme.event.bubble.wikiStyler(divWiki); +elmt.appendChild(divWiki); +} +}; + + +/* date.js */ + + + +Date.$VERSION=1.02; + + +Date.LZ=function(x){return(x<0||x>9?"":"0")+x}; + + +Date.parseString=function(val,format){ + +if(typeof(format)=="undefined"||format==null||format==""){ +var generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d','MMM-d','d-MMM'); +var monthFirst=new Array('M/d/y','M-d-y','M.d.y','M/d','M-d'); +var dateFirst=new Array('d/M/y','d-M-y','d.M.y','d/M','d-M'); +var checkList=new Array(generalFormats,Date.preferAmericanFormat?monthFirst:dateFirst,Date.preferAmericanFormat?dateFirst:monthFirst); +for(var i=0;i=minlength;x--){ +var token=str.substring(i,i+x); +if(token.length70){ +year=1900+(year-0); +} +else{ +year=2000+(year-0); +} +} +} +else if(token=="MMM"||token=="NNN"){ +month=0; +var names=(token=="MMM"?(Date.l10n.monthNames.concat(Date.l10n.monthAbbreviations)):Date.l10n.monthAbbreviations); +for(var i=0;i12)){ +return null; +} +} +else if(token=="EE"||token=="E"){ +var names=(token=="EE"?Date.l10n.dayNames:Date.l10n.dayAbbreviations); +for(var i=0;i12)){ +return null; +} +i_val+=month.length; +} +else if(token=="dd"||token=="d"){ +date=this.getInt(val,i_val,token.length,2); +if(date==null||(date<1)||(date>31)){ +return null; +} +i_val+=date.length; +} +else if(token=="hh"||token=="h"){ +hh=this.getInt(val,i_val,token.length,2); +if(hh==null||(hh<1)||(hh>12)){ +return null; +} +i_val+=hh.length; +} +else if(token=="HH"||token=="H"){ +hh=this.getInt(val,i_val,token.length,2); +if(hh==null||(hh<0)||(hh>23)){ +return null; +} +i_val+=hh.length; +} +else if(token=="KK"||token=="K"){ +hh=this.getInt(val,i_val,token.length,2); +if(hh==null||(hh<0)||(hh>11)){ +return null; +} +i_val+=hh.length; +hh++; +} +else if(token=="kk"||token=="k"){ +hh=this.getInt(val,i_val,token.length,2); +if(hh==null||(hh<1)||(hh>24)){ +return null; +} +i_val+=hh.length; +hh--; +} +else if(token=="mm"||token=="m"){ +mm=this.getInt(val,i_val,token.length,2); +if(mm==null||(mm<0)||(mm>59)){ +return null; +} +i_val+=mm.length; +} +else if(token=="ss"||token=="s"){ +ss=this.getInt(val,i_val,token.length,2); +if(ss==null||(ss<0)||(ss>59)){ +return null; +} +i_val+=ss.length; +} +else if(token=="A"){ +if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ +ampm="AM"; +} +else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ +ampm="PM"; +} +else{ +return null; +} +i_val+=2; +} +else{ +if(val.substring(i_val,i_val+token.length)!=token){ +return null; +} +else{ +i_val+=token.length; +} +} +} + +if(i_val!=val.length){ +return null; +} + +if(month==2){ + +if(((year%4==0)&&(year%100!=0))||(year%400==0)){ +if(date>29){ +return null; +} +} +else{ +if(date>28){ +return null; +} +} +} +if((month==4)||(month==6)||(month==9)||(month==11)){ +if(date>30){ +return null; +} +} + +if(hh<12&&m=="PM"){ +hh=hh-0+12; +} +else if(hh>11&&m=="AM"){ +hh-=12; +} +return new Date(year,month-1,date,hh,mm,ss); +}; + +(function(){ + +function add(name,method){ +if(!Date.prototype[name]){ +Date.prototype[name]=method; +} +}; + +add('getFullYear',function(){ +var yy=this.getYear(); +return(yy<1900?yy+1900:yy); +}); + + +add('isValid',function(val,format){ +return(Date.parseString(val,format)!=null); +}); + + +add('isBefore',function(date2){ +if(date2==null){ +return false; +} +return(this.getTime()date2.getTime()); +}); + + +add('isBetween',function(date1,date2){ +return this.isAfter(date1)&&this.isBefore(date2); +}); + + +add('equals',function(date2){ +if(date2==null){ +return false; +} +return(this.getTime()==date2.getTime()); +}); + + +add('equalsIgnoreTime',function(date2){ +if(date2==null){ +return false; +} +var d1=new Date(this.getTime()).clearTime(); +var d2=new Date(date2.getTime()).clearTime(); +return(d1.getTime()==d2.getTime()); +}); + + +add('format',function(format){ +format=format+""; +var result=""; +var i_format=0; +var c=""; +var token=""; +var y=this.getYear()+""; +var M=this.getMonth()+1; +var d=this.getDate(); +var E=this.getDay(); +var H=this.getHours(); +var m=this.getMinutes(); +var s=this.getSeconds(); +var w=this.getWeekOfYear(); +var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; + +var value=new Object(); +if(y.length<4){ +y=""+(+y+1900); +} +value["y"]=""+y; +value["yyyy"]=y; +value["yy"]=y.substring(2,4); +value["M"]=M; +value["MM"]=Date.LZ(M); +value["MMM"]=Date.l10n.monthNames[M-1]; +value["NNN"]=Date.l10n.monthAbbreviations[M-1]; +value["d"]=d; +value["dd"]=Date.LZ(d); +value["E"]=Date.l10n.dayAbbreviations[E]; +value["EE"]=Date.l10n.dayNames[E]; +value["e"]=value["E"].substr(0,1); +value["H"]=H; +value["HH"]=Date.LZ(H); +if(H==0){ +value["h"]=12; +} +else if(H>12){ +value["h"]=H-12; +} +else{ +value["h"]=H; +} +value["hh"]=Date.LZ(value["h"]); +value["K"]=value["h"]-1; +value["k"]=value["H"]+1; +value["KK"]=Date.LZ(value["K"]); +value["kk"]=Date.LZ(value["k"]); +if(H>11){ +value["A"]="PM"; +value["a"]="pm"; +} +else{ +value["A"]="AM"; +value["a"]="am"; +} +value["m"]=m; +value["mm"]=Date.LZ(m); +value["s"]=s; +value["ss"]=Date.LZ(s); +value["w"]=w; +while(i_format=0?day:day+7); +var daynum=Math.floor((this.getTime()-newYear.getTime()- +(this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000)+1; +var weeknum; + +if(day<4){ +weeknum=Math.floor((daynum+day-1)/7)+1; +if(weeknum>52){ +nYear=new Date(this.getFullYear()+1,0,1); +nday=nYear.getDay()-dowOffset; +nday=nday>=0?nday:nday+7; + +weeknum=nday<4?1:53; +} +}else{ +weeknum=Math.floor((daynum+day-1)/7); +} +return weeknum; +}); + + +add('toTimezone',function(timezoneOffset){ +var minutesToMs=60000;var hoursToMs=60*minutesToMs; +var utcMs=this.getTime()+(this.getTimezoneOffset()*minutesToMs); +var offsetMs=hoursToMs*timezoneOffset; +return new Date(utcMs+offsetMs); +}); + + +add('clearTime',function(){ +this.setHours(0); +this.setMinutes(0); +this.setSeconds(0); +this.setMilliseconds(0); +return this; +}); + + +add('clone',function(date){ +if(date&&date instanceof Date){ +date.setTime(this.getTime()); +return date; +}else{ +return new Date(this); +} +}); + + +add('setDay',function(n){ +var day=this.getDay(); +if(day==n){return this;} +if(n==7){this.add('d',7);return this.setDay(0);} +if(dayn){this.add('d',-1);return this.setDay(n);} +}); + + +add('add',function(interval,number){ +if(typeof(interval)=="undefined"||interval==null||typeof(number)=="undefined"||number==null){ +return this; +} +number=+number; +if(interval=='y'){ +this.setFullYear(this.getFullYear()+number); +} +else if(interval=='M'){ +this.setMonth(this.getMonth()+number); +} +else if(interval=='d'){ +this.setDate(this.getDate()+number); +} +else if(interval=='w'){ +var step=(number>0)?1:-1; +while(number!=0){ +this.add('d',step); +while(this.getDay()==0||this.getDay()==6){ +this.add('d',step); +} +number-=step; +} +} +else if(interval=='h'){ +this.setHours(this.getHours()+number); +} +else if(interval=='m'){ +this.setMinutes(this.getMinutes()+number); +} +else if(interval=='s'){ +this.setSeconds(this.getSeconds()+number); +} +return this; +}); + +})(); + + +/* debug.js */ + + + +Timegrid.Debug=new Object(); + +Timegrid.Debug.log=function(msg){ +}; + +Timegrid.Debug.exception=function(e){ +e=$.getIsIE()?e.message:e; +$.debugException(e,"Caught exception"); + +}; + + + +/* dstructs.js */ + + + +DStructs={}; + +DStructs.Array=function(){ + +var x=[],a=arguments; +for(var i=0;i=0; +}; +DStructs.Array.prototype.uniq_i=function(){ +var hash=new DStructs.Hash(); +var indices=new DStructs.Array(); +var self=this; +this.each(function(e,i){ +if(hash.contains(e)){ +indices.push(i); +}else{ +hash.put(e,i); +} +}); +return this; +}; +DStructs.Array.prototype.uniq=function(){ +var hash=new DStructs.Hash(); +this.each(function(e){hash.put(e,e);}); +return hash.values(); +}; +DStructs.Array.prototype.empty=function(){ +return this.length==0; +}; +DStructs.Array.prototype.clear=function(){ +this.length=0; +}; +DStructs.Array.prototype.clone=function(){ +var clone=new DStructs.Array(); +this.each(function(e){clone.push(e);}); +return clone; +}; +DStructs.Array.prototype.iterator=function(){ +return new DStructs.Iterator(this); +}; + +DStructs.Iterator=function(items){ +var index=0; +this.hasNext=function(){ +return index"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize", +W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case"width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case"height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement; +if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit= +a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.d=a.d;b.e=a.e}function O(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){var d=a.indexOf("(",3),e=a.indexOf(")",d+1),g=a.substring(d+1,e).split(",");b="#";for(var h=0;h<3;h++){b+=R[Number(g[h])]}if(g.length==4&&a.substr(3,1)=="a"){c=g[3]}}else{b=a}return[b,c]}function S(a){switch(a){case"butt":return"flat";case"round":return"round"; +case"square":default:return"square"}}function K(a){this.a=J();this.m=[];this.k=[];this.c=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=m*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.j=b;this.d=1;this.e=1}var j=K.prototype;j.clearRect=function(){this.j.innerHTML= +"";this.c=[]};j.beginPath=function(){this.c=[]};j.moveTo=function(a,b){this.c.push({type:"moveTo",x:a,y:b});this.f=a;this.g=b};j.lineTo=function(a,b){this.c.push({type:"lineTo",x:a,y:b});this.f=a;this.g=b};j.bezierCurveTo=function(a,b,c,d,e,g){this.c.push({type:"bezierCurveTo",cp1x:a,cp1y:b,cp2x:c,cp2y:d,x:e,y:g});this.f=e;this.g=g};j.quadraticCurveTo=function(a,b,c,d){var e=this.f+0.6666666666666666*(a-this.f),g=this.g+0.6666666666666666*(b-this.g),h=e+(c-this.f)/3,l=g+(d-this.g)/3;this.bezierCurveTo(e, +g,h,l,c,d)};j.arc=function(a,b,c,d,e,g){c*=m;var h=g?"at":"wa",l=a+M(d)*c-A,n=b+L(d)*c-A,o=a+M(e)*c-A,f=b+L(e)*c-A;if(l==o&&!g){l+=0.125}this.c.push({type:h,x:a,y:b,radius:c,xStart:l,yStart:n,xEnd:o,yEnd:f})};j.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};j.strokeRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke()};j.fillRect=function(a, +b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill()};j.createLinearGradient=function(a,b,c,d){var e=new H("gradient");return e};j.createRadialGradient=function(a,b,c,d,e,g){var h=new H("gradientradial");h.n=c;h.o=g;h.i.x=a;h.i.y=b;return h};j.drawImage=function(a,b){var c,d,e,g,h,l,n,o,f=a.runtimeStyle.width,k=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var q=a.width,r=a.height;a.runtimeStyle.width= +f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}else if(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}else if(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}var s=this.b(c,d),t=[],v=10,w=10;t.push(" ','","");this.j.insertAdjacentHTML("BeforeEnd",t.join(""))};j.stroke=function(a){var b=[],c=O(a?this.fillStyle:this.strokeStyle),d=c[0],e=c[1]*this.globalAlpha,g=10,h=10;b.push("n.x){n.x=k.x}if(l.y== +null||k.yn.y){n.y=k.y}}}b.push(' ">');if(typeof this.fillStyle=="object"){var v={x:"50%",y:"50%"},w=n.x-l.x,x=n.y-l.y,p=w>x?w:x;v.x=i(this.fillStyle.i.x/w*100+50)+"%";v.y=i(this.fillStyle.i.y/x*100+50)+"%";var y=[];if(this.fillStyle.p=="gradientradial"){var z=this.fillStyle.n/p*100,B=this.fillStyle.o/p*100-z}else{var z=0,B=100}var C={offset:null,color:null},D={offset:null,color:null};this.fillStyle.h.sort(function(T,U){return T.offset-U.offset});for(var o=0;oC.offset||C.offset==null){C.offset=u.offset;C.color=u.color}if(u.offset')}else if(a){b.push('')}else{b.push("')}b.push("");this.j.insertAdjacentHTML("beforeEnd",b.join(""));this.c=[]};j.fill=function(){this.stroke(true)};j.closePath=function(){this.c.push({type:"close"})};j.b=function(a,b){return{x:m*(a*this.a[0][0]+b*this.a[1][0]+this.a[2][0])-A,y:m*(a*this.a[0][1]+b*this.a[1][1]+this.a[2][1])-A}};j.save=function(){var a={};N(this,a); +this.k.push(a);this.m.push(this.a);this.a=G(J(),this.a)};j.restore=function(){N(this.k.pop(),this);this.a=this.m.pop()};j.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];this.a=G(c,this.a)};j.rotate=function(a){var b=M(a),c=L(a),d=[[b,c,0],[-c,b,0],[0,0,1]];this.a=G(d,this.a)};j.scale=function(a,b){this.d*=a;this.e*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];this.a=G(c,this.a)};j.clip=function(){};j.arcTo=function(){};j.createPattern=function(){return new P};function H(a){this.p=a;this.n=0;this.o= +0;this.h=[];this.i={x:0,y:0}}H.prototype.addColorStop=function(a,b){b=O(b);this.h.push({offset:1-a,color:b})};function P(){}G_vmlCanvasManager=Q;CanvasRenderingContext2D=K;CanvasGradient=H;CanvasPattern=P})()}; + + +/* jquery.corner.js */ + + + + +(function($){ + +var _corner=function(options){ + + +var testcanvas=document.createElement("canvas"); +if(typeof G_vmlCanvasManager=='undefined'&&$.browser.msie){ +return this.each(function(){}); +} + + +var asNum=function(a,b){return a-b;}; +var getMin=function(a){ +var b=a.concat(); +return b.sort(asNum)[0]; +}; + + +var getCSSint=function(el,prop){ +return parseInt($.css(el.jquery?el[0]:el,prop))||0; +}; + + +var drawRoundCornerCanvasShape=function(canvas,radius,r_type,bg_color,border_width,border_color){ + + +var reg=/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/; +var bits=reg.exec(bg_color); +if(bits){ +channels=new Array(parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])); +bg_color='rgb('+channels[0]+', '+channels[1]+', '+channels[2]+')'; +} + +var border_width=parseInt(border_width); + +var ctx=canvas.getContext('2d'); + +if(radius==1){ +ctx.fillStyle=bg_color; +ctx.fillRect(0,0,1,1); +return; +} + +if(r_type=='tl'){ +var steps=new Array(0,0,radius,0,radius,0,0,radius,0,0); +}else if(r_type=='tr'){ +var steps=new Array(radius,0,radius,radius,radius,0,0,0,0,0); +}else if(r_type=='bl'){ +var steps=new Array(0,radius,radius,radius,0,radius,0,0,0,radius); +}else if(r_type=='br'){ +var steps=new Array(radius,radius,radius,0,radius,0,0,radius,radius,radius); +} + +ctx.fillStyle=bg_color; +ctx.beginPath(); +ctx.moveTo(steps[0],steps[1]); +ctx.lineTo(steps[2],steps[3]); +if(r_type=='br')ctx.bezierCurveTo(steps[4],steps[5],radius,radius,steps[6],steps[7]); +else ctx.bezierCurveTo(steps[4],steps[5],0,0,steps[6],steps[7]); +ctx.lineTo(steps[8],steps[9]); +ctx.fill(); + + +if(border_width>0&&border_width10){radius=10;} +} + + +if(widthheight_smallest
              ').addClass('timegrid-tabs'); +$(container).prepend(tabDiv); +var makeCallback=function(title){ +return function(){self.switchTo(title);}; +}; +for(var lTitle in this._layoutMap){ +$newLink=$("",{ +href:"javascript:void", +text:lTitle +}); + +$tab=$('
              ',{height:this._layoutMap[lTitle].tabHeight+"px"}) +.addClass("timegrid-tab") +.addClass('timegrid-rounded') +.append($newLink); + +$tab.click(makeCallback(lTitle)); + +tabDiv.prepend($tab); +this._tabs[lTitle]=$tab; +} +if(!$.browser.msie){$('.timegrid-tab').corner("30px top");} +}; + +Timegrid.Controls.TabSet.prototype.renderChanged=function(){ +var layout=this._layoutMap[this.current]; +layout.renderChanged(); +}; + +Timegrid.Controls.TabSet.prototype.switchTo=function(title){ +if(this.current&&this._renderedLayouts[this.current]){ +this._renderedLayouts[this.current].hide(); +this._tabs[this.current].removeClass('timegrid-tab-active'); +} +if(this._renderedLayouts[title]){ +this._renderedLayouts[title].show(); +}else if(this._layoutMap[title]){ +this._renderedLayouts[title]=$(this._layoutMap[title].render(this._container)).show(); +} +if(this._iDiv){$(this._iDiv).empty();} +if(this._layoutMap[title].iterable){ +if(!this._iterators[title]){ +this._iterators[title]=new Timegrid.Controls.Iterator(this._layoutMap[title]); +this._iDiv=$(this._iterators[title].render(this._container)); +}else{ +this._iDiv=$(this._iterators[title].render()); +} +} +this.current=title; +this._tabs[this.current].addClass('timegrid-tab-active'); +}; + + +Timegrid.Controls.Iterator=function(layout){ +this._layout=layout; +}; + +Timegrid.Controls.Iterator.prototype.render=function(container){ +if(container){ +this._container=container; +this._div=$('
              ').addClass('timegrid-iterator'); +$(this._container).prepend(this._div); +}else{ +this._div.empty(); +} +var self=this; +var makePrevCallback=function(layout){ +return function(){ +layout.goPrevious(); +self.render(); +}; +}; +var makeNextCallback=function(layout){ +return function(){ +layout.goNext(); +self.render(); +}; +}; +$imageURL=Timegrid.urlPrefix+"images/go-previous.png"; +$prevLink=$('
              ',{href:"javascript:void"}) +.addClass('timegrid-iterator-prev') +.append($('',{alt:"Previous",src:$imageURL})); +$imageURL=Timegrid.urlPrefix+"images/go-next.png"; +$nextLink=$('',{href:"javascript:void"}) +.addClass('timegrid-iterator-next') +.append($('',{alt:"Next",src:$imageURL})); +$nextLink.click(makeNextCallback(this._layout)); +this._div.append($prevLink); +this._div.append($nextLink); +this._div.append($('',{text:this._layout.getCurrent()})); +return this._div; +}; + + +/* grid.js */ + + + +Timegrid.Grid=function(objs,xSize,ySize,xMapper,yMapper){ +Timegrid.Grid.superclass.call(this); + +this.grid=new Array(xSize); +for(i=0;i0){ +text=date.getUTCFullYear(); +}else{ +text=(1-y)+"BC"; +} +emphasized= +(intervalUnit==SimileAjax.DateTime.MONTH)|| +(intervalUnit==SimileAjax.DateTime.DECADE&&y%100==0)|| +(intervalUnit==SimileAjax.DateTime.CENTURY&&y%1000==0); +break; +default: +text=date.toUTCString(); +} +return{text:text,emphasized:emphasized}; +} + + + +/* layout.js */ + + + + +Timegrid.LayoutFactory=function(){}; + +Timegrid.LayoutFactory._constructors={}; + + +Timegrid.LayoutFactory.registerLayout=function(name,constructor){ +$.inherit(constructor,Timegrid.Layout); +Timegrid.LayoutFactory._constructors[name]=constructor; +}; + + +Timegrid.LayoutFactory.createLayout=function(name,eventSource,params){ +var constructor=Timegrid.LayoutFactory._constructors[name]; +if(typeof constructor=='function'){ +layout=new constructor(eventSource,$.deepClone(params)); +return layout; +}else{ +throw"No such layout!"; +}; +return; +}; + + +Timegrid.Layout=function(eventSource,params){ +var self=this; + +this.params=params; + +this.xSize=0; + +this.ySize=0; + +this.timezoneMapper=function(date){ +if(typeof self.timezoneoffset!="undefined"){ +return date.toTimezone(self.timezoneoffset); +} +return date; +}; + +this.xMapper=function(obj){return self.timezoneMapper(obj.time);}; + +this.yMapper=function(obj){return self.timezoneMapper(obj.time);}; + +this.xLabelHeight=24; + +this.yLabelWidth=48; + +this.tabHeight=18; +}; + + +Timegrid.Layout.prototype.configure=function(params){ +for(var attr in params){ +this[attr]=params[attr.toLowerCase()]; +} +}; + + +Timegrid.Layout.prototype.computeCellSizes=function(){ + +this.xCell=this.params.xCell||this.params.xcell|| +(this.gridwidth-1)/this.xSize; +this.yCell=this.params.yCell||this.params.ycell|| +(this.gridheight-1)/this.ySize; +if(this.params.yCell||this.params.ycell){ +this.gridheight=this.yCell*this.ySize; +} +if(this.params.xCell||this.params.xcell){ +this.gridwidth=this.xCell*this.xSize; +} +}; + + +Timegrid.Layout.prototype.render=function(container){ +if(this.mini){ +this.scrollwidth=0; +this.tabHeight=0; +this.xLabelHeight=24; +this.yLabelWidth=24; +} +if(!(this.params.height&&this.params.gridheight)){ +this.scrollwidth=0; +} +if(container){ +this._container=container; +this._viewDiv=$("
              ").addClass('timegrid-view print') +.css('top',this.tabHeight+"px"); +$(this._container).append(this._viewDiv); +}else{ +this._viewDiv.empty(); +} +var gridDiv=$('
              ').addClass('timegrid-grid'); +var gridWindowDiv=$('
              ').addClass('timegrid-grid-window'); +if(!this.scrollwidth){gridWindowDiv.css('overflow','visible');} + +if(!this.params.height){ +this.height=this._container.style.height? +$(this._container).height():3+this.scrollwidth+this.tabHeight ++this.xLabelHeight+ +(this.gridheight||500); +} +$(this._container).height(this.height+"px"); +if(!this.params.width){ +this.width=this.params.gridwidth||$(this._container).width(); +}else{ +$(this._container).width(this.width+"px"); +} +$(this._container).css('position','relative'); +this._viewDiv.height(this.height-this.tabHeight+"px"); + +gridWindowDiv.css("top",this.xLabelHeight).css("left",this.yLabelWidth) +.css("right","0px").css("bottom","0px"); +this._viewDiv.append(gridWindowDiv.append(gridDiv)); + +var windowHeight=this._viewDiv.height()-gridWindowDiv.position().top-2; +var windowWidth=this._viewDiv.width()-gridWindowDiv.position().left-2; +gridWindowDiv.height(windowHeight).width(windowWidth); + +this.gridwidth=this.gridwidth||gridWindowDiv.width()-this.scrollwidth; +this.gridheight=this.gridheight||gridWindowDiv.height()-this.scrollwidth; +gridDiv.height(this.gridheight+"px").width(this.gridwidth+"px"); +this.computeCellSizes(); +this._gridDiv=gridDiv; +gridDiv.append(this.renderEvents(document)); +gridDiv.append(this.renderGridlines(document)); +var xLabels=this.renderXLabels(); +var yLabels=this.renderYLabels(); +var syncHorizontalScroll=function(a,b){ +$(a).scroll(function(){b.scrollLeft=a.scrollLeft;}); +$(b).scroll(function(){a.scrollLeft=b.scrollLeft;}); +}; +var syncVerticalScroll=function(a,b){ +$(a).scroll(function(){b.scrollTop=a.scrollTop;}); +$(b).scroll(function(){a.scrollTop=b.scrollTop;}); +}; +syncVerticalScroll(yLabels,gridWindowDiv.get(0)); +syncHorizontalScroll(xLabels,gridWindowDiv.get(0)); +this._viewDiv.append(xLabels).append(yLabels); + +if(!this.mini){ +if($.browser.msie){ +$('.timegrid-view:visible .timegrid-rounded-shadow', +this._container).prettybox(4,0,0,1); +}else{ +$('.timegrid-view:visible .timegrid-rounded-shadow', +this._container).prettybox(4,7,1,0.7); +} +} + +return this._viewDiv.get(0); +}; + +Timegrid.Layout.prototype.renderChanged=function(){ +this.initializeGrid(); +this._gridDiv.empty(); +this._gridDiv.append(this.renderEvents(document)); +this._gridDiv.append(this.renderGridlines(document)); +this.renderXLabels(); +this.renderYLabels(); +if(!this.mini){ +if($.browser.msie){ +$('.timegrid-view:visible .timegrid-rounded-shadow', +this._container).prettybox(4,0,0,1); +}else{ +$('.timegrid-view:visible .timegrid-rounded-shadow', +this._container).prettybox(4,7,1,0.7); +} +} +}; + + +Timegrid.Layout.prototype.renderEvents=Timegrid.abstract("renderEvents"); + + +Timegrid.Layout.prototype.renderGridlines=function(){ +var numToDay={ +0:"S", +1:"M", +2:"T", +3:"W", +4:"R", +5:"F", +6:"S" +}; + +var numToHour={ +0:"8", +1:"9", +2:"10", +3:"11", +4:"12", +5:"13", +6:"14", +7:"15", +8:"16", +9:"17", +10:"18", +11:"19", +12:"20", +13:"21" +}; + +var gridlineContainer=$("
              ",{class:'timegrid-gridlines'}); + +for(var y=0;y<=this.ySize-1;y++){ +var hlineDiv=$('',{class:'timegrid-hline', +height:this.yCell+"px"}); +gridlineContainer.append(hlineDiv); + +for(var x=0;x',{classid:numToDay[x]+numToHour[y], +class:'timegrid-vline', +width:this.xCell+"px"}); +hlineDiv.append(vlineDiv); +} +} +return gridlineContainer; +}; + + +Timegrid.Layout.prototype.renderXLabels=function(){ +this._xLabelContainer=this._xLabelContainer|| +document.createElement("div"); +var xLabelContainer=this._xLabelContainer; +xLabelContainer.innerHTML=""; +xLabelContainer.className='timegrid-xlabels-window'; +xLabelContainer.style.height=this.xLabelHeight+"px"; +xLabelContainer.style.width=this.width-this.yLabelWidth- +this.scrollwidth-2+"px"; +xLabelContainer.style.left=this.yLabelWidth-1+"px"; + +var xLabelsDiv=document.createElement("div"); +xLabelsDiv.className='timegrid-xlabels'; +xLabelsDiv.style.height=this.xLabelHeight+"px" +xLabelsDiv.style.width=this.gridwidth+"px"; +xLabelsDiv.style.top="0px"; +xLabelContainer.appendChild(xLabelsDiv); + +var labels=this.getXLabels(); +for(var i=0;i
              ').addClass('timegrid-week-highlights'); +var yRect=$('
              ').height(this.yCell+"px") +.width(this.xCell*this.xSize+"px") +.css('top',nowY*this.yCell+"px") +.addClass('timegrid-week-highlight'); +var xRect=$('
              ').height(this.yCell*this.ySize+"px") +.width(this.xCell+"px") +.css('left',nowX*this.xCell+"px") +.addClass('timegrid-week-highlight'); +rectDiv.append(xRect).append(yRect); +return rectDiv.get(0); +}; + +Timegrid.NDayLayout.prototype.getXLabels=function(){ +var date=new Date(this.startTime); +var labels=[]; +var format=this.mini?Timegrid.NDayLayout.l10n.mini.xLabelFormat: +Timegrid.NDayLayout.l10n.xLabelFormat; +while(date
              ").addClass("timegrid-month-cell"); +var eList=$("
                ").addClass("timegrid-event-list"); +for(var i=0;i'+evts[i].getText()+''); +} +jediv.append(eList); +jediv.append(''+n+''); +jediv.css("height",this.yCell).css("width",this.xCell+"px"); +jediv.css("top",this.yCell*y); +jediv.css("left",this.xCell*x+'px'); +return jediv.get()[0]; +}; + +Timegrid.NMonthLayout.prototype.renderCellColor=function(x,y,m){ +var jcdiv=$("
                ").addClass("timegrid-month-cell"); +jcdiv.addClass("timegrid-month-cell-"+(m%2?"odd":"even")); +jcdiv.css("height",this.yCell).css("width",this.xCell+"px"); +jcdiv.css("top",this.yCell*y); +jcdiv.css("left",this.xCell*x+"px"); + +if(this.now){ +var nowX=this.xMapper({time:this.now}); +var nowY=this.yMapper({time:this.now}); +if(x==nowX&&y==nowY){ +jcdiv.addClass("timegrid-month-cell-now"); +} +} + +return jcdiv.get()[0]; + +}; + +Timegrid.NMonthLayout.prototype.renderMonthLabels=function(){ +var self=this; +return $.map(this.monthStarts,function(monthStart){ +var monthString=monthStart.date.getMonthName(); +var mDiv=$('
                '+monthString+'
                '); +mDiv.addClass('timegrid-month-label'); +mDiv.css('top',self.yCell*monthStart.i+"px"); +var height=monthStart.height*self.yCell; +mDiv.height(height+"px"); +mDiv.children().css('line-height',height+"px"); +return mDiv.get(0); +}); +}; + +Timegrid.NMonthLayout.prototype.highlightNow=function(){ +var now=new Date(); +var x=this.xMapper({time:now}); +var y=this.yMapper({time:now}); +}; + +Timegrid.NMonthLayout.prototype.getXLabels=function(){ +return Date.l10n.dayNames; +}; + +Timegrid.NMonthLayout.prototype.getYLabels=function(){ +return this.yLabels; +}; + +Timegrid.NMonthLayout.prototype.goPrevious=function(){ +this.dataStartTime.add('M',0-this.n); +this.startTime=new Date(this.dataStartTime); +this.updateGrid(); +this.render(); +}; + +Timegrid.NMonthLayout.prototype.goNext=function(){ +this.dataStartTime.add('M',this.n); +this.startTime=new Date(this.dataStartTime); +this.updateGrid(); +this.render(); +}; + +Timegrid.NMonthLayout.prototype.getCurrent=function(){ +var start=this.monthStarts[0].date; +var end=this.monthStarts[this.monthStarts.length-1].date; +if(this.n>1){ +return Timegrid.NMonthLayout.l10n.makeRange(start,end); +}else{ +return Timegrid.NMonthLayout.l10n.makeRange(start); +} +}; + +Timegrid.NMonthLayout.prototype.computeStartTime=function(date){ +if(date){ +var startTime=new Date(date); +startTime.setDate(1); +startTime.setHours(0); + +while(this.xMapper({time:startTime})>0){ +startTime.setHours(-24); +} +return startTime; +} +}; + +Timegrid.NMonthLayout.prototype.computeEndTime=function(date){ +if(date){ +var endTime=new Date(date); +endTime.add('d',this.ySize*7); +return endTime; +} +return false; +}; + +Timegrid.NMonthLayout.prototype.computeYSize=function(date){ +var gridStart={time:new Date(date)}; +var month=this.dataStartTime.getMonth(); +this.ySize=0; +this.monthStarts=[{i:this.ySize,date:new Date(this.dataStartTime)}]; +while(this.xMapper(gridStart)>0&&this.yMapper(gridStart)>=0){ +gridStart.time.setHours(-24); +} +gridStart.time.add('d',7); +for(;this.monthStarts.length<=this.n;gridStart.time.add('d',7)){ +if(gridStart.time.getMonth()!=month){ +month=gridStart.time.getMonth(); +var year=gridStart.time.getFullYear(); +this.monthStarts.push({i:this.ySize,date:new Date(gridStart.time)}); +var old=this.monthStarts[this.monthStarts.length-2]; +old.height=this.ySize-old.i+1; +} +this.ySize++; +} +this.monthStarts.pop(); +}; + +Timegrid.NMonthLayout.prototype.computeLabels=function(date){ +var gridStart={time:new Date(date)}; +this.cellLabels=[]; +this.months=[]; +this.yLabels=[]; + + +while(this.xMapper(gridStart)
                "): +$("
                "+evt.getText()+"
                "); +var length=(evt.getEnd()-evt.getStart())/(1000*60*60.0); +jediv.addClass("timegrid-event"); +if(!this.mini){ +jediv.addClass('timegrid-rounded-shadow'); +} +jediv.css("height",this.yCell*length); +jediv.css("top",this.yCell*y); +jediv.css("left",this.xCell*x+'px'); +if(evt.getColor()){jediv.css('background-color',evt.getColor());} +if(evt.getTextColor()){jediv.css('color',evt.getTextColor());} +return jediv.get()[0]; +}; + +Timegrid.PropertyLayout.prototype.getXLabels=function(){ +return this.values; +}; + +Timegrid.PropertyLayout.prototype.getYLabels=function(){ +var date=(new Date()).clearTime(); +var labels=[]; +for(var i=+this.dayStart;i<+this.dayEnd;i++){ +date.setHours(i); +labels.push(date.format(Timegrid.PropertyLayout.l10n.yLabelFormat)); +} +return labels; +}; + +Timegrid.PropertyLayout.getEndpoints=function(evt){ +return[{type:"start", +time:evt.getStart(), +event:evt}, +{type:"end", +time:evt.getEnd(), +event:evt}]; +}; + + +/* weekly.js */ + + + + +Timegrid.WeekLayout=function(eventSource,params){ +params.n=7; +params.title=params.title||Timegrid.WeekLayout.l10n.makeTitle(); +Timegrid.WeekLayout.superclass.call(this,eventSource,params); +}; +Timegrid.LayoutFactory.registerLayout("week",Timegrid.WeekLayout); +$.inherit(Timegrid.WeekLayout,Timegrid.NDayLayout); + +Timegrid.WeekLayout.prototype.computeStartTime=function(date){ +if(date){ + + +var startTime=new Date(date); +startTime.add('d',0-this.n); +return startTime; +}else{ +var startTime=new Date(this.eventSource.getEarliestDate())|| +new Date(); +var newStartTime=new Date(startTime); +newStartTime.clearTime().setDay(Date.l10n.firstDayOfWeek); +return newStartTime>startTime?this.computeStartTime(newStartTime): +newStartTime; +} +}; + + + +/* recurring.js */ + + + + +Timegrid.RecurringEventSource=function(){ +Timegrid.RecurringEventSource.superclass.call(this); + + +var eventPrototypes=new DStructs.Array(); + + + + +this.setEventPrototypes=function(a){ +eventPrototypes.clear(); +this.addAllEventPrototypes(a); +}; + + +this.addEventPrototype=function(eventPrototype){ +eventPrototypes.push(eventPrototype); +this._fire("onAddMany",[]); +}; + + +this.addAllEventPrototypes=function(a){ +eventPrototypes.addAll(a); +this._fire("onAddMany",[]); +}; + + +this.removeEventPrototype=function(eventPrototype){ +return eventPrototypes.remove(eventPrototype); +}; + + +this.clearEventPrototypes=function(){ +eventPrototypes.clear(); +this._fire("onClear",[]); +}; + + +this.generateEvents=function(startDate,endDate){ +var result=new DStructs.Array(); +eventPrototypes.each(function(ep){ +result.addAll(ep.generateEvents(startDate,endDate)); +}); +return result; +}; +}; +$.inherit(Timegrid.RecurringEventSource,Timegrid.ListenerAware); + +Timegrid.RecurringEventSource.prototype.loadXML=function(xml,url){ + +}; +Timegrid.RecurringEventSource.prototype.loadJSON=function(data,url){ + +}; +Timegrid.RecurringEventSource.prototype.getEventIterator=function(startDate,endDate){ +return this.generateEvents(startDate,endDate).iterator(); +}; +Timegrid.RecurringEventSource.prototype.getEarliestDate=function(){ +return(new Date()).clearTime().setDay(0); +}; +Timegrid.RecurringEventSource.prototype.getLatestDate=function(){ +return(new Date()).clearTime().setDay(7); +}; + +Timegrid.RecurringEventSource.EventPrototype=function(dayArray,start,end, +text,description,image,link,icon,color,textColor){ +var id="e"+Math.floor(Math.random()*1000000); +var days=new DStructs.Array();days.addAll(dayArray); + +this.getDays=function(){return days;}; +this.getStart=function(){return start;}; +this.getEnd=function(){return end;}; + +this.getID=function(){return id;} +this.getText=function(){ +return $('
                ').html(text).text(); +}; +this.getDescription=function(){ +return $('
                ').html(text).text(); +}; +this.getImage=function(){ +return(image!=null&&image!="")?image:null; +}; +this.getLink=function(){ +return(link!=null&&link!="")?link:null; +}; +this.getIcon=function(){ +return(icon!=null&&icon!="")?icon:null; +}; +this.getColor=function(){ +return(color!=null&&color!="")?color:null; +}; +this.getTextColor=function(){ +return(textColor!=null&&textColor!="")?textColor:null; +} +this.generateFrom=function(date){ +if(!this.getDays().contains(date.getDay())){return false;} +var startTime=new Date(this.getStart()); +var endTime=new Date(this.getEnd()); +startTime.setDate(date.getDate()); +startTime.setMonth(date.getMonth()); +startTime.setFullYear(date.getFullYear()); +endTime.setDate(date.getDate()); +endTime.setMonth(date.getMonth()); +endTime.setFullYear(date.getFullYear()); +return new Timegrid.DefaultEventSource.Event(startTime,endTime,null, +null,false,text,description,image,link,icon,color, +textColor); +}; +}; + +Timegrid.RecurringEventSource.EventPrototype.prototype={ +generateEvents:function(start,end){ +var events=new DStructs.Array(); +for(var date=new Date(start);date-rwB5~=FD;9MFtp&&F%- zDszZq05(6YE`b?WIVGE)@w(h^H@odRo+tUo0$$r;g&pqjGOF)! zk2l=l3D4MYJ>EaV10J#G&MgjDkE)N|rkE6v0#ZNo?luztOmbG}^m*2!ynuPwA| s+9#OX(&<_&Cbw412XDm}-|~vDxnGlq;8xCfD<|tmz;zL%z+Wiv0fnO=IsgCw literal 0 HcmV?d00001 diff --git a/src/webapp/site/examples/.DS_Store b/src/webapp/site/examples/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..456d7097c21f31fb1c1b38b7857b1957fc168ba0 GIT binary patch literal 6148 zcmeHKOHRWu5Pbuw6v3uTmc9Zvh^lgeUI5gFkAMVKr4>6Loj0BVH6d$MRWs7~+4FJi zC&l&vkj3Zb7MKI5sfwbV2~qQ;>%xO)L@9H$c*hIY`_;CanCKKuy7n3mSW`DRTK`+$ zJ=wl+MQ@J|kMwV;9mlQi@hE1-oombv&m&Kb4`%gjHG7Azk-x%$o))ho`zf*&YYGN} zfnXpQI0puJXRFlLhS3HC!9XzZ%YdE_iK^H*X2WuHuqh<~v7)&M`&vtAPI7D9i-0YaFwor9-^<5dZQ|@gn8xoIjOtNMjgnFc1t38Mw6JT<`xo{xXwA z{xBs*!9Xx@W(-KRTrC⪙5p?wx@S(qTW+gG%jn0!v5e9z=574H^piGq SIMILE | Timegrid | Examples | MIT Academic Calendar - + + +
                  diff --git a/src/webapp/site/examples/conference/conference.html b/src/webapp/site/examples/conference/conference.html index e1173be..1786cdd 100644 --- a/src/webapp/site/examples/conference/conference.html +++ b/src/webapp/site/examples/conference/conference.html @@ -8,7 +8,9 @@ SIMILE | Timegrid | Examples | Conference Schedule - + + +
                    diff --git a/src/webapp/site/examples/month/month.html b/src/webapp/site/examples/month/month.html index c7204c8..7b51cf5 100644 --- a/src/webapp/site/examples/month/month.html +++ b/src/webapp/site/examples/month/month.html @@ -8,7 +8,9 @@ SIMILE | Timegrid | Examples | Monthly Schedule - + + +
                      diff --git a/src/webapp/site/examples/property/property.html b/src/webapp/site/examples/property/property.html index 73807e8..9d66626 100644 --- a/src/webapp/site/examples/property/property.html +++ b/src/webapp/site/examples/property/property.html @@ -8,7 +8,9 @@ SIMILE | Timegrid | Examples | Lecture Locations - + + +
                        diff --git a/src/webapp/site/examples/week/sched.html b/src/webapp/site/examples/week/sched.html index 52eb5ce..59a3fcf 100644 --- a/src/webapp/site/examples/week/sched.html +++ b/src/webapp/site/examples/week/sched.html @@ -8,7 +8,9 @@ SIMILE | Timegrid | Examples | Weekly Schedule - + + +
                          diff --git a/src/webapp/site/index.html b/src/webapp/site/index.html index aa85ec5..dcc4a62 100644 --- a/src/webapp/site/index.html +++ b/src/webapp/site/index.html @@ -9,8 +9,9 @@ SIMILE | Timegrid - + + + diff --git a/src/webapp/site/styles.css b/src/webapp/site/styles.css index f62f72e..e349d24 100644 --- a/src/webapp/site/styles.css +++ b/src/webapp/site/styles.css @@ -1,4 +1,4 @@ -@import url("http://simile.mit.edu/styles/default.css"); +@import url("docs/default.css"); body { margin-bottom: 20em; From f9c0a394f4ba7add5c7f78678d531635afbdc1d7 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Wed, 2 Aug 2017 19:21:49 -0400 Subject: [PATCH 31/43] Created new locale folder to match folder naming pattern --- src/webapp/api/locales/en-US/.DS_Store | Bin 0 -> 6148 bytes src/webapp/api/locales/en-US/.svn/all-wcprops | 11 + src/webapp/api/locales/en-US/.svn/entries | 65 ++++++ .../en-US/.svn/text-base/locale.js.svn-base | 31 +++ src/webapp/api/locales/en-US/locale.js | 31 +++ .../locales/en-US/scripts/.svn/all-wcprops | 11 + .../api/locales/en-US/scripts/.svn/entries | 68 ++++++ .../.svn/text-base/timegrid-l10n.js.svn-base | 13 ++ .../en-US/scripts/layouts/.svn/all-wcprops | 35 ++++ .../en-US/scripts/layouts/.svn/entries | 198 ++++++++++++++++++ .../.svn/text-base/monthly-l10n.js.svn-base | 10 + .../.svn/text-base/nday-l10n.js.svn-base | 31 +++ .../.svn/text-base/nmonth-l10n.js.svn-base | 31 +++ .../.svn/text-base/property-l10n.js.svn-base | 15 ++ .../.svn/text-base/weekly-l10n.js.svn-base | 10 + .../en-US/scripts/layouts/monthly-l10n.js | 10 + .../en-US/scripts/layouts/nday-l10n.js | 31 +++ .../en-US/scripts/layouts/nmonth-l10n.js | 31 +++ .../en-US/scripts/layouts/property-l10n.js | 15 ++ .../en-US/scripts/layouts/weekly-l10n.js | 10 + .../locales/en-US/scripts/timegrid-l10n.js | 13 ++ .../en-US/scripts/util/.svn/all-wcprops | 11 + .../locales/en-US/scripts/util/.svn/entries | 62 ++++++ .../util/.svn/text-base/date-l10n.js.svn-base | 29 +++ .../locales/en-US/scripts/util/date-l10n.js | 29 +++ .../api/locales/en-US/timegrid-en-bundle.js | 145 +++++++++++++ 26 files changed, 946 insertions(+) create mode 100644 src/webapp/api/locales/en-US/.DS_Store create mode 100644 src/webapp/api/locales/en-US/.svn/all-wcprops create mode 100644 src/webapp/api/locales/en-US/.svn/entries create mode 100644 src/webapp/api/locales/en-US/.svn/text-base/locale.js.svn-base create mode 100644 src/webapp/api/locales/en-US/locale.js create mode 100644 src/webapp/api/locales/en-US/scripts/.svn/all-wcprops create mode 100644 src/webapp/api/locales/en-US/scripts/.svn/entries create mode 100644 src/webapp/api/locales/en-US/scripts/.svn/text-base/timegrid-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/all-wcprops create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/entries create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/property-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/monthly-l10n.js create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/nday-l10n.js create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/nmonth-l10n.js create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/property-l10n.js create mode 100644 src/webapp/api/locales/en-US/scripts/layouts/weekly-l10n.js create mode 100644 src/webapp/api/locales/en-US/scripts/timegrid-l10n.js create mode 100644 src/webapp/api/locales/en-US/scripts/util/.svn/all-wcprops create mode 100644 src/webapp/api/locales/en-US/scripts/util/.svn/entries create mode 100644 src/webapp/api/locales/en-US/scripts/util/.svn/text-base/date-l10n.js.svn-base create mode 100644 src/webapp/api/locales/en-US/scripts/util/date-l10n.js create mode 100644 src/webapp/api/locales/en-US/timegrid-en-bundle.js diff --git a/src/webapp/api/locales/en-US/.DS_Store b/src/webapp/api/locales/en-US/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b2a6b3e6c870dde3f033c72e8cfe8a9aab8f5326 GIT binary patch literal 6148 zcmeHKOG-mQ5UkdK0XJD@IalxoLx?BH1p*O5K%yk-`mJ&$ zdAwS@eht7D?@tfF48WA`h?9r0`MLYZZYpC$I`4SJ8;&2V!~XeYRDC(&+&dhx!2!FU z{QWj>y-ZV93P=GdAO)m=6!@hA-g{}&`$R=4AO)nrw*vlsXmrP3I3&iWgCRx$;)Lli zu49%UHct?H;gHA-&5}w?s?~^LNoT%QT`wFGlMbul!|KUa6N<&td4G#?SWi@x0#e{y zf!o~9y#GJaugw4FB<-Yt6!=#P*krj{F8E5-TSqVFy|&TUbg%iOyKx;9hG@scXvf@m fJDx{T)-_-AycZ6ML1#YbMEwl7E;1?b*9v?AELauN literal 0 HcmV?d00001 diff --git a/src/webapp/api/locales/en-US/.svn/all-wcprops b/src/webapp/api/locales/en-US/.svn/all-wcprops new file mode 100644 index 0000000..63fe020 --- /dev/null +++ b/src/webapp/api/locales/en-US/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 76 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en +END +locale.js +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/locale.js +END diff --git a/src/webapp/api/locales/en-US/.svn/entries b/src/webapp/api/locales/en-US/.svn/entries new file mode 100644 index 0000000..4ffa86c --- /dev/null +++ b/src/webapp/api/locales/en-US/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +scripts +dir + +locale.js +file + + + + +2012-02-03T21:55:30.000000Z +c82dd8954ea1e0e8ba2c8b8caf01c837 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1048 + diff --git a/src/webapp/api/locales/en-US/.svn/text-base/locale.js.svn-base b/src/webapp/api/locales/en-US/.svn/text-base/locale.js.svn-base new file mode 100644 index 0000000..6e5c6c1 --- /dev/null +++ b/src/webapp/api/locales/en-US/.svn/text-base/locale.js.svn-base @@ -0,0 +1,31 @@ +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/monthly-l10n.js", + "layouts/weekly-l10n.js", + "layouts/property-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/en/"; + if (Timegrid.params.bundle) { + SimileAjax.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); + if (cssFiles.length > 0) { + SimileAjax.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + } + } else { + SimileAjax.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + SimileAjax.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/src/webapp/api/locales/en-US/locale.js b/src/webapp/api/locales/en-US/locale.js new file mode 100644 index 0000000..6836e87 --- /dev/null +++ b/src/webapp/api/locales/en-US/locale.js @@ -0,0 +1,31 @@ +/*================================================== + * English localization + * (also base and default localization) + *================================================== + */ +(function() { + var javascriptFiles = [ + "timegrid-l10n.js", + + "util/date-l10n.js", + + "layouts/nday-l10n.js", + "layouts/nmonth-l10n.js", + "layouts/monthly-l10n.js", + "layouts/weekly-l10n.js", + "layouts/property-l10n.js" + ]; + var cssFiles = [ + ]; + + var urlPrefix = Timegrid.urlPrefix + "locales/en/"; + if (Timegrid.params.bundle) { + $.includeJavascriptFiles(document, urlPrefix, [ "timegrid-en-bundle.js" ]); + if (cssFiles.length > 0) { + $.includeCssFiles(document, urlPrefix, [ "timegrid-en-bundle.css" ]); + } + } else { + $.includeJavascriptFiles(document, urlPrefix + "scripts/", javascriptFiles); + $.includeCssFiles(document, urlPrefix + "styles/", cssFiles); + } +})(); diff --git a/src/webapp/api/locales/en-US/scripts/.svn/all-wcprops b/src/webapp/api/locales/en-US/scripts/.svn/all-wcprops new file mode 100644 index 0000000..54b92e1 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 84 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts +END +timegrid-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 101 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/timegrid-l10n.js +END diff --git a/src/webapp/api/locales/en-US/scripts/.svn/entries b/src/webapp/api/locales/en-US/scripts/.svn/entries new file mode 100644 index 0000000..c8e6e8e --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en/scripts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +layouts +dir + +timegrid-l10n.js +file + + + + +2012-02-03T21:55:30.000000Z +b43a7808daa5b512b0c5cfd9f757a73c +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +440 + +util +dir + diff --git a/src/webapp/api/locales/en-US/scripts/.svn/text-base/timegrid-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/.svn/text-base/timegrid-l10n.js.svn-base new file mode 100644 index 0000000..0e558d0 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/.svn/text-base/timegrid-l10n.js.svn-base @@ -0,0 +1,13 @@ +/****************************************************************************** + * Timegrid English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Loading..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/all-wcprops b/src/webapp/api/locales/en-US/scripts/layouts/.svn/all-wcprops new file mode 100644 index 0000000..47537cf --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/all-wcprops @@ -0,0 +1,35 @@ +K 25 +svn:wc:ra_dav:version-url +V 92 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts +END +weekly-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/weekly-l10n.js +END +nmonth-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 107 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/nmonth-l10n.js +END +property-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 109 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/property-l10n.js +END +monthly-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 108 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/monthly-l10n.js +END +nday-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 105 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts/nday-l10n.js +END diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/entries b/src/webapp/api/locales/en-US/scripts/layouts/.svn/entries new file mode 100644 index 0000000..e67887c --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/layouts +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +weekly-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +a7a3b6aa63b261508a187ebbb2d6f0c1 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +402 + +nmonth-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +51a272559d94f92a3da2abe7fe95c4de +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1243 + +property-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +d3efa75c65a5ca7bdb6a263e814d74a5 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +527 + +monthly-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +b7d4d0d399abd57491910eb01a5f7b0c +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +407 + +nday-l10n.js +file + + + + +2012-02-03T21:55:29.000000Z +b93e6abb258f574e9ca0ee798a8b4611 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1263 + diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base new file mode 100644 index 0000000..635eea9 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/monthly-l10n.js.svn-base @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Month"; } \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base new file mode 100644 index 0000000..1d3f099 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nday-l10n.js.svn-base @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NDayLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = { mini: {} }; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 5/24" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; + +/** Format for vertical "12am" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; + diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base new file mode 100644 index 0000000..eda5778 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/nmonth-l10n.js.svn-base @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NMonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); + if (d2) { + string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); + } + return string; +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "MMM yyyy"; \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/property-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/property-l10n.js.svn-base new file mode 100644 index 0000000..d7dd304 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/property-l10n.js.svn-base @@ -0,0 +1,15 @@ +/****************************************************************************** + * Timegrid PropertyLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.PropertyLayout)) { + Timegrid.PropertyLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } + +/** Format for vertical "12am" style labels */ +Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; + + diff --git a/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base new file mode 100644 index 0000000..72157b9 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/.svn/text-base/weekly-l10n.js.svn-base @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Week"; } \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/layouts/monthly-l10n.js b/src/webapp/api/locales/en-US/scripts/layouts/monthly-l10n.js new file mode 100644 index 0000000..635eea9 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/monthly-l10n.js @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid MonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.MonthLayout)) { + Timegrid.MonthLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.MonthLayout.l10n.makeTitle = function(n) { return "Month"; } \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/layouts/nday-l10n.js b/src/webapp/api/locales/en-US/scripts/layouts/nday-l10n.js new file mode 100644 index 0000000..1d3f099 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/nday-l10n.js @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NDayLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NDayLayout)) { + Timegrid.NDayLayout.l10n = { mini: {} }; +} + +/** Function to create a title string from an n-value */ +Timegrid.NDayLayout.l10n.makeTitle = function(n) { return n + "-Day"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NDayLayout.l10n.makeRange = function(d1, d2) { + return d1.format(Timegrid.NDayLayout.l10n.startFormat) + " - " + + d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + +/** Format for horizontal "Mon 5/24" style labels */ +Timegrid.NDayLayout.l10n.xLabelFormat = "E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat = "e"; + +/** Format for vertical "12am" style labels */ +Timegrid.NDayLayout.l10n.yLabelFormat = "ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat = "h"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NDayLayout.l10n.startFormat = "M/d/yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NDayLayout.l10n.endFormat = "M/d/yyyy"; + diff --git a/src/webapp/api/locales/en-US/scripts/layouts/nmonth-l10n.js b/src/webapp/api/locales/en-US/scripts/layouts/nmonth-l10n.js new file mode 100644 index 0000000..eda5778 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/nmonth-l10n.js @@ -0,0 +1,31 @@ +/****************************************************************************** + * Timegrid NMonthLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.NMonthLayout)) { + Timegrid.NMonthLayout.l10n = {}; +} + +/** Function to create a title string from an n-value */ +Timegrid.NMonthLayout.l10n.makeTitle = function(n) { return n + "-Month"; } + +/** Function to combine two dates into a string describing the grid's range */ +Timegrid.NMonthLayout.l10n.makeRange = function(d1, d2) { + var string = d1.format(Timegrid.NMonthLayout.l10n.startFormat); + if (d2) { + string += " - " + d2.format(Timegrid.NMonthLayout.l10n.endFormat); + } + return string; +}; + +/** Format not needed, localized day names are in Timegrid.l10n.dayNames */ +Timegrid.NMonthLayout.l10n.xLabelFormat = ""; + +/** Format for vertical "W23" style labels */ +Timegrid.NMonthLayout.l10n.yLabelFormat = "Ww"; + +/** Format for displaying the grid's starting date, e.g. "6/12/2007" */ +Timegrid.NMonthLayout.l10n.startFormat = "MMM yyyy"; + +/** Format for displaying the grid's ending date, e.g. "6/15/2007" */ +Timegrid.NMonthLayout.l10n.endFormat = "MMM yyyy"; \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/layouts/property-l10n.js b/src/webapp/api/locales/en-US/scripts/layouts/property-l10n.js new file mode 100644 index 0000000..d7dd304 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/property-l10n.js @@ -0,0 +1,15 @@ +/****************************************************************************** + * Timegrid PropertyLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.PropertyLayout)) { + Timegrid.PropertyLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.PropertyLayout.l10n.makeTitle = function() { return "Property"; } + +/** Format for vertical "12am" style labels */ +Timegrid.PropertyLayout.l10n.yLabelFormat = "ha"; + + diff --git a/src/webapp/api/locales/en-US/scripts/layouts/weekly-l10n.js b/src/webapp/api/locales/en-US/scripts/layouts/weekly-l10n.js new file mode 100644 index 0000000..72157b9 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/layouts/weekly-l10n.js @@ -0,0 +1,10 @@ +/****************************************************************************** + * Timegrid WeekLayout English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid.WeekLayout)) { + Timegrid.WeekLayout.l10n = {}; +} + +/** Function to create a title string */ +Timegrid.WeekLayout.l10n.makeTitle = function(n) { return "Week"; } \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/timegrid-l10n.js b/src/webapp/api/locales/en-US/scripts/timegrid-l10n.js new file mode 100644 index 0000000..0e558d0 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/timegrid-l10n.js @@ -0,0 +1,13 @@ +/****************************************************************************** + * Timegrid English localization + *****************************************************************************/ + +if (!("l10n" in Timegrid)) { + Timegrid.l10n = {}; +} + +Timegrid.l10n.loadingMessage = "Loading..."; + +Timegrid.l10n.jsonErrorMessage = "Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage = "Failed to load XML data from"; \ No newline at end of file diff --git a/src/webapp/api/locales/en-US/scripts/util/.svn/all-wcprops b/src/webapp/api/locales/en-US/scripts/util/.svn/all-wcprops new file mode 100644 index 0000000..27b0aea --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/util/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 89 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/util +END +date-l10n.js +K 25 +svn:wc:ra_dav:version-url +V 102 +/repository/!svn/ver/9624/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/util/date-l10n.js +END diff --git a/src/webapp/api/locales/en-US/scripts/util/.svn/entries b/src/webapp/api/locales/en-US/scripts/util/.svn/entries new file mode 100644 index 0000000..685c483 --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/util/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +9638 +http://simile.mit.edu/repository/course-picker/trunk/src/webapp/timegrid/locales/en/scripts/util +http://simile.mit.edu/repository + + + +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + +983b779f-54db-0310-a2f8-e46c051b0de2 + +date-l10n.js +file + + + + +2012-02-03T21:55:30.000000Z +450afb8d48472a4804896b1ab9178304 +2012-02-03T21:54:55.669466Z +9624 +lizs + + + + + + + + + + + + + + + + + + + + + +1255 + diff --git a/src/webapp/api/locales/en-US/scripts/util/.svn/text-base/date-l10n.js.svn-base b/src/webapp/api/locales/en-US/scripts/util/.svn/text-base/date-l10n.js.svn-base new file mode 100644 index 0000000..e53fb8b --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/util/.svn/text-base/date-l10n.js.svn-base @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid Date English localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; + +/** Month abbreviations. Change this for local month names */ +Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + +/** Full day names. Change this for local month names */ +Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + +/** Day abbreviations. Change this for local month names */ +Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = true; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 0; diff --git a/src/webapp/api/locales/en-US/scripts/util/date-l10n.js b/src/webapp/api/locales/en-US/scripts/util/date-l10n.js new file mode 100644 index 0000000..e53fb8b --- /dev/null +++ b/src/webapp/api/locales/en-US/scripts/util/date-l10n.js @@ -0,0 +1,29 @@ +/****************************************************************************** + * Timegrid Date English localization + *****************************************************************************/ + +if (!("l10n" in Date)) { + Date.l10n = {}; +} + +/** Full month names. Change this for local month names */ +Date.l10n.monthNames =[ 'January','February','March','April','May','June','July','August','September','October','November','December']; + +/** Month abbreviations. Change this for local month names */ +Date.l10n.monthAbbreviations = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + +/** Full day names. Change this for local month names */ +Date.l10n.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + +/** Day abbreviations. Change this for local month names */ +Date.l10n.dayAbbreviations = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + +/** + * Used for parsing ambiguous dates like 1/2/2000 - default to preferring + * 'American' format meaning Jan 2. Set to false to prefer 'European' format + * meaning Feb 1. + */ +Date.l10n.preferAmericanFormat = true; + +/** Used to specify which day the week starts on, 0 meaning Sunday, etc. */ +Date.l10n.firstDayOfWeek = 0; diff --git a/src/webapp/api/locales/en-US/timegrid-en-bundle.js b/src/webapp/api/locales/en-US/timegrid-en-bundle.js new file mode 100644 index 0000000..029bc6b --- /dev/null +++ b/src/webapp/api/locales/en-US/timegrid-en-bundle.js @@ -0,0 +1,145 @@ + + +/* monthly-l10n.js */ + + + +if(!("l10n"in Timegrid.MonthLayout)){ +Timegrid.MonthLayout.l10n={}; +} + + +Timegrid.MonthLayout.l10n.makeTitle=function(n){return"Month";} + +/* nday-l10n.js */ + + + +if(!("l10n"in Timegrid.NDayLayout)){ +Timegrid.NDayLayout.l10n={mini:{}}; +} + + +Timegrid.NDayLayout.l10n.makeTitle=function(n){return n+"-Day";} + + +Timegrid.NDayLayout.l10n.makeRange=function(d1,d2){ +return d1.format(Timegrid.NDayLayout.l10n.startFormat)+" - "+ +d2.format(Timegrid.NDayLayout.l10n.endFormat); +}; + + +Timegrid.NDayLayout.l10n.xLabelFormat="E M/d"; +Timegrid.NDayLayout.l10n.mini.xLabelFormat="e"; + + +Timegrid.NDayLayout.l10n.yLabelFormat="ha"; +Timegrid.NDayLayout.l10n.mini.yLabelFormat="h"; + + +Timegrid.NDayLayout.l10n.startFormat="M/d/yyyy"; + + +Timegrid.NDayLayout.l10n.endFormat="M/d/yyyy"; + + + +/* nmonth-l10n.js */ + + + +if(!("l10n"in Timegrid.NMonthLayout)){ +Timegrid.NMonthLayout.l10n={}; +} + + +Timegrid.NMonthLayout.l10n.makeTitle=function(n){return n+"-Month";} + + +Timegrid.NMonthLayout.l10n.makeRange=function(d1,d2){ +var string=d1.format(Timegrid.NMonthLayout.l10n.startFormat); +if(d2){ +string+=" - "+d2.format(Timegrid.NMonthLayout.l10n.endFormat); +} +return string; +}; + + +Timegrid.NMonthLayout.l10n.xLabelFormat=""; + + +Timegrid.NMonthLayout.l10n.yLabelFormat="Ww"; + + +Timegrid.NMonthLayout.l10n.startFormat="MMM yyyy"; + + +Timegrid.NMonthLayout.l10n.endFormat="MMM yyyy"; + +/* property-l10n.js */ + + + +if(!("l10n"in Timegrid.PropertyLayout)){ +Timegrid.PropertyLayout.l10n={}; +} + + +Timegrid.PropertyLayout.l10n.makeTitle=function(){return"Property";} + + +Timegrid.PropertyLayout.l10n.yLabelFormat="ha"; + + + + +/* weekly-l10n.js */ + + + +if(!("l10n"in Timegrid.WeekLayout)){ +Timegrid.WeekLayout.l10n={}; +} + + +Timegrid.WeekLayout.l10n.makeTitle=function(n){return"Week";} + +/* timegrid-l10n.js */ + + + +if(!("l10n"in Timegrid)){ +Timegrid.l10n={}; +} + +Timegrid.l10n.loadingMessage="Loading..."; + +Timegrid.l10n.jsonErrorMessage="Failed to load JSON data from"; + +Timegrid.l10n.xmlErrorMessage="Failed to load XML data from"; + +/* date-l10n.js */ + + + +if(!("l10n"in Date)){ +Date.l10n={}; +} + + +Date.l10n.monthNames=['January','February','March','April','May','June','July','August','September','October','November','December']; + + +Date.l10n.monthAbbreviations=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + + +Date.l10n.dayNames=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; + + +Date.l10n.dayAbbreviations=['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; + + +Date.l10n.preferAmericanFormat=true; + + +Date.l10n.firstDayOfWeek=0; From 91e06fe9d8795f78bf640f33e955897c1c0d66db Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Wed, 2 Aug 2017 19:27:11 -0400 Subject: [PATCH 32/43] Incorporated data structures necessary to create an EventIndex list --- src/webapp/api/scripts/data-structure.js | 447 +++++++++++++++++++ src/webapp/api/scripts/jquery.simile.ajax.js | 3 +- src/webapp/api/scripts/sources/default.js | 2 +- src/webapp/api/timegrid-api.js | 4 +- src/webapp/api/timegrid-bundle.js | 5 +- 5 files changed, 457 insertions(+), 4 deletions(-) create mode 100644 src/webapp/api/scripts/data-structure.js diff --git a/src/webapp/api/scripts/data-structure.js b/src/webapp/api/scripts/data-structure.js new file mode 100644 index 0000000..ff6a6aa --- /dev/null +++ b/src/webapp/api/scripts/data-structure.js @@ -0,0 +1,447 @@ +/** + * A basic set (in the mathematical sense) data structure + * + * @constructor + * @param {Array or Timegrid.Set} [a] an initial collection + */ +Timegrid.Set = function(a) { + this._hash = {}; + this._count = 0; + + if (a instanceof Array) { + for (var i = 0; i < a.length; i++) { + this.add(a[i]); + } + } else if (a instanceof Timegrid.Set) { + this.addSet(a); + } +} + +/** + * Adds the given object to this set, assuming there it does not already exist + * + * @param {Object} o the object to add + * @return {Boolean} true if the object was added, false if not + */ +Timegrid.Set.prototype.add = function(o) { + if (!(o in this._hash)) { + this._hash[o] = true; + this._count++; + return true; + } + return false; +} + +/** + * Adds each element in the given set to this set + * + * @param {Timegrid.Set} set the set of elements to add + */ +Timegrid.Set.prototype.addSet = function(set) { + for (var o in set._hash) { + this.add(o); + } +} + +/** + * Removes the given element from this set + * + * @param {Object} o the object to remove + * @return {Boolean} true if the object was successfully removed, + * false otherwise + */ +Timegrid.Set.prototype.remove = function(o) { + if (o in this._hash) { + delete this._hash[o]; + this._count--; + return true; + } + return false; +} + +/** + * Removes the elements in this set that correspond to the elements in the + * given set + * + * @param {Timegrid.Set} set the set of elements to remove + */ +Timegrid.Set.prototype.removeSet = function(set) { + for (var o in set._hash) { + this.remove(o); + } +} + +/** + * Removes all elements in this set that are not present in the given set, i.e. + * modifies this set to the intersection of the two sets + * + * @param {Timegrid.Set} set the set to intersect + */ +Timegrid.Set.prototype.retainSet = function(set) { + for (var o in this._hash) { + if (!set.contains(o)) { + delete this._hash[o]; + this._count--; + } + } +} + +/** + * Returns whether or not the given element exists in this set + * + * @param {Timegrid.Set} o the object to test for + * @return {Boolean} true if the object is present, false otherwise + */ +Timegrid.Set.prototype.contains = function(o) { + return (o in this._hash); +} + +/** + * Returns the number of elements in this set + * + * @return {Number} the number of elements in this set + */ +Timegrid.Set.prototype.size = function() { + return this._count; +} + +/** + * Returns the elements of this set as an array + * + * @return {Array} a new array containing the elements of this set + */ +Timegrid.Set.prototype.toArray = function() { + var a = []; + for (var o in this._hash) { + a.push(o); + } + return a; +} + +/** + * Iterates through the elements of this set, order unspecified, executing the + * given function on each element until the function returns true + * + * @param {Function} f a function of form f(element) + */ +Timegrid.Set.prototype.visit = function(f) { + for (var o in this._hash) { + if (f(o) == true) { + break; + } + } +} + +/** + * A sorted array data structure + * + * @constructor + */ +Timegrid.SortedArray = function(compare, initialArray) { + this._a = (initialArray instanceof Array) ? initialArray : []; + this._compare = compare; +}; + +Timegrid.SortedArray.prototype.add = function(elmt) { + var sa = this; + var index = this.find(function(elmt2) { + return sa._compare(elmt2, elmt); + }); + + if (index < this._a.length) { + this._a.splice(index, 0, elmt); + } else { + this._a.push(elmt); + } +}; + +Timegrid.SortedArray.prototype.remove = function(elmt) { + var sa = this; + var index = this.find(function(elmt2) { + return sa._compare(elmt2, elmt); + }); + + while (index < this._a.length && this._compare(this._a[index], elmt) == 0) { + if (this._a[index] == elmt) { + this._a.splice(index, 1); + return true; + } else { + index++; + } + } + return false; +}; + +Timegrid.SortedArray.prototype.removeAll = function() { + this._a = []; +}; + +Timegrid.SortedArray.prototype.elementAt = function(index) { + return this._a[index]; +}; + +Timegrid.SortedArray.prototype.length = function() { + return this._a.length; +}; + +Timegrid.SortedArray.prototype.find = function(compare) { + var a = 0; + var b = this._a.length; + + while (a < b) { + var mid = Math.floor((a + b) / 2); + var c = compare(this._a[mid]); + if (mid == a) { + return c < 0 ? a+1 : a; + } else if (c < 0) { + a = mid; + } else { + b = mid; + } + } + return a; +}; + +Timegrid.SortedArray.prototype.getFirst = function() { + return (this._a.length > 0) ? this._a[0] : null; +}; + +Timegrid.SortedArray.prototype.getLast = function() { + return (this._a.length > 0) ? this._a[this._a.length - 1] : null; +}; + +/*================================================== + * Event Index + *================================================== + */ + +Timegrid.EventIndex = function(unit) { + var eventIndex = this; + + this._unit = (unit != null) ? unit : Timegrid.NativeDateUnit; + this._events = new Timegrid.SortedArray( + function(event1, event2) { + return eventIndex._unit.compare(event1.getStart(), event2.getStart()); + } + ); + this._idToEvent = {}; + this._indexed = true; +}; + +Timegrid.EventIndex.prototype.getUnit = function() { + return this._unit; +}; + +Timegrid.EventIndex.prototype.getEvent = function(id) { + return this._idToEvent[id]; +}; + +Timegrid.EventIndex.prototype.add = function(evt) { + this._events.add(evt); + this._idToEvent[evt.getID()] = evt; + this._indexed = false; +}; + +Timegrid.EventIndex.prototype.removeAll = function() { + this._events.removeAll(); + this._idToEvent = {}; + this._indexed = false; +}; + +Timegrid.EventIndex.prototype.getCount = function() { + return this._events.length(); +}; + +Timegrid.EventIndex.prototype.getIterator = function(startDate, endDate) { + if (!this._indexed) { + this._index(); + } + return new Timegrid.EventIndex._Iterator(this._events, startDate, endDate, this._unit); +}; + +Timegrid.EventIndex.prototype.getReverseIterator = function(startDate, endDate) { + if (!this._indexed) { + this._index(); + } + return new Timegrid.EventIndex._ReverseIterator(this._events, startDate, endDate, this._unit); +}; + +Timegrid.EventIndex.prototype.getAllIterator = function() { + return new Timegrid.EventIndex._AllIterator(this._events); +}; + +Timegrid.EventIndex.prototype.getEarliestDate = function() { + var evt = this._events.getFirst(); + return (evt == null) ? null : evt.getStart(); +}; + +Timegrid.EventIndex.prototype.getLatestDate = function() { + var evt = this._events.getLast(); + if (evt == null) { + return null; + } + + if (!this._indexed) { + this._index(); + } + + var index = evt._earliestOverlapIndex; + var date = this._events.elementAt(index).getEnd(); + for (var i = index + 1; i < this._events.length(); i++) { + date = this._unit.later(date, this._events.elementAt(i).getEnd()); + } + + return date; +}; + +Timegrid.EventIndex.prototype._index = function() { + /* + * For each event, we want to find the earliest preceding + * event that overlaps with it, if any. + */ + + var l = this._events.length(); + for (var i = 0; i < l; i++) { + var evt = this._events.elementAt(i); + evt._earliestOverlapIndex = i; + } + + var toIndex = 1; + for (var i = 0; i < l; i++) { + var evt = this._events.elementAt(i); + var end = evt.getEnd(); + + toIndex = Math.max(toIndex, i + 1); + while (toIndex < l) { + var evt2 = this._events.elementAt(toIndex); + var start2 = evt2.getStart(); + + if (this._unit.compare(start2, end) < 0) { + evt2._earliestOverlapIndex = i; + toIndex++; + } else { + break; + } + } + } + this._indexed = true; +}; + +Timegrid.EventIndex._Iterator = function(events, startDate, endDate, unit) { + this._events = events; + this._startDate = startDate; + this._endDate = endDate; + this._unit = unit; + + this._currentIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), startDate); + }); + if (this._currentIndex - 1 >= 0) { + this._currentIndex = this._events.elementAt(this._currentIndex - 1)._earliestOverlapIndex; + } + this._currentIndex--; + + this._maxIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), endDate); + }); + + this._hasNext = false; + this._next = null; + this._findNext(); +}; + +Timegrid.EventIndex._Iterator.prototype = { + hasNext: function() { return this._hasNext; }, + next: function() { + if (this._hasNext) { + var next = this._next; + this._findNext(); + + return next; + } else { + return null; + } + }, + _findNext: function() { + var unit = this._unit; + while ((++this._currentIndex) < this._maxIndex) { + var evt = this._events.elementAt(this._currentIndex); + if (unit.compare(evt.getStart(), this._endDate) < 0 && + unit.compare(evt.getEnd(), this._startDate) > 0) { + + this._next = evt; + this._hasNext = true; + return; + } + } + this._next = null; + this._hasNext = false; + } +}; + +Timegrid.EventIndex._ReverseIterator = function(events, startDate, endDate, unit) { + this._events = events; + this._startDate = startDate; + this._endDate = endDate; + this._unit = unit; + + this._minIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), startDate); + }); + if (this._minIndex - 1 >= 0) { + this._minIndex = this._events.elementAt(this._minIndex - 1)._earliestOverlapIndex; + } + + this._maxIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), endDate); + }); + + this._currentIndex = this._maxIndex; + this._hasNext = false; + this._next = null; + this._findNext(); +}; + +Timegrid.EventIndex._ReverseIterator.prototype = { + hasNext: function() { return this._hasNext; }, + next: function() { + if (this._hasNext) { + var next = this._next; + this._findNext(); + + return next; + } else { + return null; + } + }, + _findNext: function() { + var unit = this._unit; + while ((--this._currentIndex) >= this._minIndex) { + var evt = this._events.elementAt(this._currentIndex); + if (unit.compare(evt.getStart(), this._endDate) < 0 && + unit.compare(evt.getEnd(), this._startDate) > 0) { + + this._next = evt; + this._hasNext = true; + return; + } + } + this._next = null; + this._hasNext = false; + } +}; + +Timegrid.EventIndex._AllIterator = function(events) { + this._events = events; + this._index = 0; +}; + +Timegrid.EventIndex._AllIterator.prototype = { + hasNext: function() { + return this._index < this._events.length(); + }, + next: function() { + return this._index < this._events.length() ? + this._events.elementAt(this._index++) : null; + } +}; \ No newline at end of file diff --git a/src/webapp/api/scripts/jquery.simile.ajax.js b/src/webapp/api/scripts/jquery.simile.ajax.js index 3159037..2b9fdbd 100644 --- a/src/webapp/api/scripts/jquery.simile.ajax.js +++ b/src/webapp/api/scripts/jquery.simile.ajax.js @@ -293,6 +293,7 @@ jQuery.extend({ * itself with that function. */ createXmlHttpRequest: function() { + var an = navigator.userAgent.toLowerCase(); var isIE = (an.indexOf("microsoft") != -1); if (isIE) { var programIDs = [ @@ -364,7 +365,7 @@ jQuery.extend({ } } } catch (e) { - SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange", e); + Timegrid.Debug.exception("XmlHttp: Error handling onReadyStateChange", e); } break; } diff --git a/src/webapp/api/scripts/sources/default.js b/src/webapp/api/scripts/sources/default.js index 24c40a9..ef79e3c 100644 --- a/src/webapp/api/scripts/sources/default.js +++ b/src/webapp/api/scripts/sources/default.js @@ -5,7 +5,7 @@ Timegrid.DefaultEventSource = function(eventIndex) { Timegrid.DefaultEventSource.superclass.call(this); - this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex(); + this._events = (eventIndex instanceof Object) ? eventIndex : new Timegrid.EventIndex(); }; $.inherit(Timegrid.DefaultEventSource, Timegrid.ListenerAware); diff --git a/src/webapp/api/timegrid-api.js b/src/webapp/api/timegrid-api.js index 4352892..9bc2795 100644 --- a/src/webapp/api/timegrid-api.js +++ b/src/webapp/api/timegrid-api.js @@ -42,7 +42,9 @@ "layouts/nday.js", "layouts/weekly.js", "layouts/monthly.js", - "layouts/property.js" + "layouts/property.js", + + "data-structure.js" ]; var cssFiles = [ "timegrid.css", diff --git a/src/webapp/api/timegrid-bundle.js b/src/webapp/api/timegrid-bundle.js index a87c3d3..8769b09 100644 --- a/src/webapp/api/timegrid-bundle.js +++ b/src/webapp/api/timegrid-bundle.js @@ -28,6 +28,9 @@ var layoutNames=config.views.split(","); var getExtension=function(s){ return s.split('.').pop().toLowerCase(); }; + + + if(config.eventsource){ var eventSource=eval(config.eventsource); var tg=Timegrid.create(elmt,eventSource,layoutNames,config); @@ -297,7 +300,7 @@ Timegrid.Debug.exception(e); Timegrid.DefaultEventSource=function(eventIndex){ Timegrid.DefaultEventSource.superclass.call(this); -this._events=(eventIndex instanceof Object)?eventIndex:new SimileAjax.EventIndex(); +this._events=(eventIndex instanceof Object)?eventIndex:new Timegrid.EventIndex(); }; $.inherit(Timegrid.DefaultEventSource,Timegrid.ListenerAware); From 4505aee3395071ac68426b966220d04b9cc14538 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Wed, 2 Aug 2017 19:36:44 -0400 Subject: [PATCH 33/43] Updated JQuery to 1.9.0 and added the Migrate plugin --- src/webapp/site/examples/academic/academic.html | 3 ++- src/webapp/site/examples/conference/conference.html | 3 ++- src/webapp/site/examples/month/month.html | 3 ++- src/webapp/site/examples/property/property.html | 3 ++- src/webapp/site/examples/week/sched.html | 3 ++- src/webapp/site/index.html | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/webapp/site/examples/academic/academic.html b/src/webapp/site/examples/academic/academic.html index 28f5ce3..73348a6 100644 --- a/src/webapp/site/examples/academic/academic.html +++ b/src/webapp/site/examples/academic/academic.html @@ -8,7 +8,8 @@ SIMILE | Timegrid | Examples | MIT Academic Calendar - + + diff --git a/src/webapp/site/examples/conference/conference.html b/src/webapp/site/examples/conference/conference.html index 1786cdd..eedf0e9 100644 --- a/src/webapp/site/examples/conference/conference.html +++ b/src/webapp/site/examples/conference/conference.html @@ -8,7 +8,8 @@ SIMILE | Timegrid | Examples | Conference Schedule - + + diff --git a/src/webapp/site/examples/month/month.html b/src/webapp/site/examples/month/month.html index 7b51cf5..da4b2b9 100644 --- a/src/webapp/site/examples/month/month.html +++ b/src/webapp/site/examples/month/month.html @@ -8,7 +8,8 @@ SIMILE | Timegrid | Examples | Monthly Schedule - + + diff --git a/src/webapp/site/examples/property/property.html b/src/webapp/site/examples/property/property.html index 9d66626..a748747 100644 --- a/src/webapp/site/examples/property/property.html +++ b/src/webapp/site/examples/property/property.html @@ -8,7 +8,8 @@ SIMILE | Timegrid | Examples | Lecture Locations - + + diff --git a/src/webapp/site/examples/week/sched.html b/src/webapp/site/examples/week/sched.html index 59a3fcf..541be06 100644 --- a/src/webapp/site/examples/week/sched.html +++ b/src/webapp/site/examples/week/sched.html @@ -8,7 +8,8 @@ SIMILE | Timegrid | Examples | Weekly Schedule - + + diff --git a/src/webapp/site/index.html b/src/webapp/site/index.html index dcc4a62..f33a717 100644 --- a/src/webapp/site/index.html +++ b/src/webapp/site/index.html @@ -9,7 +9,8 @@ SIMILE | Timegrid - + + From 16d09f68f03d55138fcdeb1e7ce861ab1255f496 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Wed, 2 Aug 2017 19:37:18 -0400 Subject: [PATCH 34/43] Residual Changes --- .DS_Store | Bin 6148 -> 6148 bytes src/.DS_Store | Bin 6148 -> 6148 bytes src/webapp/.DS_Store | Bin 6148 -> 8196 bytes src/webapp/api/locales/.DS_Store | Bin 6148 -> 6148 bytes src/webapp/api/scripts/.DS_Store | Bin 6148 -> 6148 bytes src/webapp/site/.DS_Store | Bin 6148 -> 6148 bytes src/webapp/site/examples/.DS_Store | Bin 6148 -> 8196 bytes 7 files changed, 0 insertions(+), 0 deletions(-) diff --git a/.DS_Store b/.DS_Store index 959757854ab0909aff1d022b90339c4233d06246..1e1cc38c40c6d1182f61dd2e947ca3edcf9d5545 100644 GIT binary patch literal 6148 zcmeHKO>Wab6n@jB)S&{hKx&uXAhC$5M5J_4Az5jp zzbH$#rh9GznamN;4xQ47qF%HVZ90qsMuGoL0rBnD$ft}#im34Y^1dH&A6_vv?4#WM zB@HdXcufOJahzRz@e7QvCB`N_q#hm6Aw41&^$xhFl=h+`i*1!y6`J7A;!@OyQq+cu zLQbE&rJO%Y(G^M%-(SorNBFTYLLKE#ld;y}n?H`iByBc-u(e8c{o00At68-h)+=|& zr*7({S<>+)FXUMm41C>w%6ass?fK8b!Stwp`+&!(7si80A^hd@Fb?>%!?QR@WS+-f zIs{i<=%~Iuo3(d$8+N!d-vya%i6lrdeA!_oxPpCo4@~r0mB%kWNEiF zp2KG}^zfpSmfPo}@ww~5GveKDkfnX1?_ZuYq+fGJJXqlw4_9S-<4)p;$0x`m?rI$m zpW}!qDLn@9+7ur{A+nT1-jb;naBPi^##|vhFs7(LMP+)6!4w_+wvKZ&<_Z;^nBIIaePyP1C`?`*`E40a z%u#4+qkvIhQGtp&t&8>laP|Iwkz~${0!D!=r2wmT-EId%(rfF|;KW*Mqa33M6LGmh lNkOHTW7!Z(@ivMy_-xStIvR6@=z*CZ0V#v2i~|2uf!}_}!I1y} delta 88 zcmZoMXfc=|#>B`mu~2NHo+3Xh0|Nsi1A_pAVQ_MOZo$ODwT!Hj|Fbr37U2+P+1QZI jw3(fQp983VvmnQJ=E?jbmI6Q>AT3N#nq_l@$QotB)qu~2NHo}wr#0|Nsi1A_nqLk2@8Lo!3LXHI_d#*NDv>p?Oc4CxF- z42cW{$g)W}`AI-IpcV#eAlCQ~20#`T^<}|Dc{%xc=|DN4Eevc7xNzBYkEkaTr6P}rul9FHUlwX>cQVcdI zAh9F^s2OZiynsY?wTY>zj)IAaNv)1TwYj+gkZo*MTg$;Au4-uOnUGsqRb5kCHxuY3 zAYcS}9R&Cx6r7y3v1b;`W_AvK4q$|A-1wb&GQWtf2uK>FqX9yLHE#|P*}y!pfdv33 CEOL7Q delta 88 zcmZoMXfc=|#>CJzu~2NHo}wrt0|NsP3otMgFcg#p7v<&T=cP|9RA*$|oXb3mW%B~& nhfJHGfcMOk=`65vV<7`3fY z3qKN1o;-Q*FYu-pZ^oks{{b(a@y!QIq4bI-&P!%~v-94YxAU9n&b}=GkW8Zz2bcnY zAQpz&5LPD$)3eee1G0zt5%dRIE?KmMS6Yv)>QD?Q1{4E|0mXn~;NM^X&uk{aKIgvB zs#-Ci82B$4V9$pr7KUkw9fADOffY{y5ChoF1>5}PA2G^05YrMn0H*33lt>^6*uf(*8e00Ewxc2MU*pjoes_}f8*6O~_ z*VO3ZVx{4g0lvLmj&Qy7snJRwO?|uHXghhwwy0gjaoAl2zy%XLFpjOkd(?HWfp6Ef z3Sa*ADonLniDVL~PbAnfq*8MyF9V|)rSCGlL8U)Iv%Dj>8ToiH!5^CDZ?yA67ltp6 zXrp7}qZ6ayaCkBjo*KJ!xu}ho^zxIc!?w%pZ$=)Ux&##fa<hNYJbYst<~&!e@1iL+pL&O_$w zdfBwA(|3MxZXq%kunte5125qne1K2z z6@J2R*eAnel3XRTBu0`XMbc!RERg#oOO}QAz`-x-%0VcBWDU_@$|HN7@cpjN|D%Md zE5*R+GcYJZPO*1@yZyiapZ<-hh>8Klz^O4n0*m>@42C;6&W}fCxpoxGCKe{lt|O4U mV8zpMM4pZ#`hOT=JBp^vCoQof5PMM6hX784suTmK%D^9;bva%D delta 145 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGjdEU6q~50$j=7ifW!=glk;;6CKj$`WScA? z*u_&8T$GoSpO+4j-&mN+wwRrRLy#HB0|EhVAmIu!WnaWuI&y!m^p0gNK8$ZDZnh=E?jbilQK66o5DZh=KMn N8~|d5&5k1bnE|t=8p!|v delta 109 zcmZoMXfc=|&Zs)EP}r1_fq{XEA(bJoEVw8yCqFM8$Onmm0271)^MPUl3^4hP2i@2w pUP#=`&LP0TsJijscjn3bB8r?KeF-2vlTCP(Hz$ZJVV>B)0svg96?^~y diff --git a/src/webapp/api/scripts/.DS_Store b/src/webapp/api/scripts/.DS_Store index d6dc01aa8b4e6a620f043295c116ff7ec140b4ff..1de850875f58de8265baafbe36991f5a4c6b1b06 100644 GIT binary patch delta 160 zcmZoMXfc=|&e%S&P>hv>fq{WzVxfpE6OaJ{%s|Y@z#zcDP|8rkP+S&Vl$Vn~u~6L- zB*D&*!;r{O$&imMnU@aH0+cNV%M>vrGo-?_=A}>6kl&cD!amtRgk>`~2M-5h`^LiW Y%#-;=6a_(+Dgbc;5QD*HN0GzK03oR$)c^nh delta 114 zcmZoMXfc=|&Zs)EP}q`@fq{XAp_HM7A(J7eEVw8yCqFM8CWab6n@hh>I4v3RBD&rAhD=WDpI;YNLDC|?vR3D0jRa>&{%Rkk?j!L5abPa z0B*ohH~|OY0Pww;QIw477DZ^DH1oar`JO%BjAuMVB>IzNpQuAbJ`$tXM)nuuc1{i3 zFg45*9OF2XXK^NDlsTX?r+`yny%peZ*Q10aol$9hzmL&&|F<$Vh(*8mgCfslevVpv z_t+eU^noI}pfP3e?Kt19IF0`Cv>cm#<3~Ks(z5Dye~OJw@5aq7zt!?vcl@`5k(>^y zsG5}hsCcbPX)=tB|3b=a;YabybT~cfY(JHG6{Y#GSnB@fRhlPq+Lx0&DOH^3Q8fZr zJ?NyfJDc?m4)%gxuQ%TdW`~De_zxe==f1ylZ~w{h>BZ&M?Bo2?S0xDv7J%)phDH7j zUSpt^a9i|_QYs)>OcOd^m0#>2!m|8UZ!1jpr#6Q#SrG^AT%BAq3K_1)N~T+$%tc~ zEX)l>n2U!9RCf}gMwdGUoC2!~Z0cf%&;MuF-~U%huH+PO3j9|J2=8cc)W?v_+1eN! vpS1zfDH0p^t2HVLGIJa&hmYc2BxPs|*a3zHYmKOZxgP-~gUg%(|5SlL4qdLX delta 91 zcmZoMXfc=|#>CJ*u~2NHo}wr-0|Nsi1A_oVS#VKaPJUiGh(EDVosoI635(9;N>;ha tM_Ktdi*N|DY;53X-ptOy&jHlES&-v9^JIPzLq>+lHayasV?cXD5l|YB8O|ye1Zuu0Vco%m;e*F3IwobtL9v??we8eOn?demju-P z!G$UHtQJP~tpiSP0iZRU)(w5^19XmS)w5a{)v2gyb`Qd)3cJM+CLQCh3Ws`D3!^5T zgh?l1uPp2iMd+&|&(+~1JfrNH025dzp!V(#`80%u<^6k*$N*#N>+}eA@276)ZHN!@ z>Db193&u%2&D!nnVr#p$b7R-3*PZ&F^Lj9n`5^PN*|hIZUh1Pbi~`$#CS|hh`@!=# z%1;`19?LZI<20I-!e70J(@^GpIZMN-uJhE-M#$9{I%zcL^G>(hayy;QqUFwey*B#y zA1oG*vw!#C@c8uX{KNcW@$s{s3JH5Zq1)zo>A!56==;GWO=S8OV=C_^ut`ek4Zuxc zDUKuc@S_CpE8@!VHs)07?%*+ss+-YhwVK$kR4YaPt8YSSiWN)_je%XlEBqOqS73dr zz*>v1)T>dBN)f%Q)cH}Vvy8i9$h!|aEw|h4{qg61Il)yx>LXvkp!!<_r&nPpum9k} zjR{;Q0^8=rHr4+B$>q=guhW$HwK4%F@S6lg?Pze+N0MIEHzcc7-i4jQR8w(XAUy}&%+mY From f5ac4fe468a52cd7b84193edefe3394a4f695ca6 Mon Sep 17 00:00:00 2001 From: alhamzah Date: Wed, 9 Aug 2017 23:28:20 -0400 Subject: [PATCH 35/43] added NativeDateUnit definition --- src/webapp/api/scripts/units.js | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/webapp/api/scripts/units.js diff --git a/src/webapp/api/scripts/units.js b/src/webapp/api/scripts/units.js new file mode 100644 index 0000000..91120b1 --- /dev/null +++ b/src/webapp/api/scripts/units.js @@ -0,0 +1,73 @@ +/*================================================== + * Default Unit + *================================================== + */ + +SimileAjax.NativeDateUnit = new Object(); + +SimileAjax.NativeDateUnit.makeDefaultValue = function() { + return new Date(); +}; + +SimileAjax.NativeDateUnit.cloneValue = function(v) { + return new Date(v.getTime()); +}; + +SimileAjax.NativeDateUnit.getParser = function(format) { + if (typeof format == "string") { + format = format.toLowerCase(); + } + + var parser = (format == "iso8601" || format == "iso 8601") ? + SimileAjax.DateTime.parseIso8601DateTime : + SimileAjax.DateTime.parseGregorianDateTime; + + return function(d) { + if (typeof d != 'undefined' && typeof d.toUTCString == "function") { + return d; + } else { + return parser(d); + } + }; +}; + +SimileAjax.NativeDateUnit.parseFromObject = function(o) { + return SimileAjax.DateTime.parseGregorianDateTime(o); +}; + +SimileAjax.NativeDateUnit.toNumber = function(v) { + return v.getTime(); +}; + +SimileAjax.NativeDateUnit.fromNumber = function(n) { + return new Date(n); +}; + +SimileAjax.NativeDateUnit.compare = function(v1, v2) { + var n1, n2; + if (typeof v1 == "object") { + n1 = v1.getTime(); + } else { + n1 = Number(v1); + } + if (typeof v2 == "object") { + n2 = v2.getTime(); + } else { + n2 = Number(v2); + } + + return n1 - n2; +}; + +SimileAjax.NativeDateUnit.earlier = function(v1, v2) { + return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2; +}; + +SimileAjax.NativeDateUnit.later = function(v1, v2) { + return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2; +}; + +SimileAjax.NativeDateUnit.change = function(v, n) { + return new Date(v.getTime() + n); +}; + From 1957f27108c257fe8f77f483d0a06bfb56695b49 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Wed, 9 Aug 2017 23:48:18 -0400 Subject: [PATCH 36/43] Added date-time and got rid of SimileAjax references from units.js --- src/webapp/api/scripts/date-time.js | 452 ++++++++++++++++++++++++++++ src/webapp/api/scripts/units.js | 73 +++++ src/webapp/api/timegrid-api.js | 4 +- src/webapp/api/timegrid-bundle.js | 5 +- 4 files changed, 530 insertions(+), 4 deletions(-) create mode 100644 src/webapp/api/scripts/date-time.js create mode 100644 src/webapp/api/scripts/units.js diff --git a/src/webapp/api/scripts/date-time.js b/src/webapp/api/scripts/date-time.js new file mode 100644 index 0000000..9cd9059 --- /dev/null +++ b/src/webapp/api/scripts/date-time.js @@ -0,0 +1,452 @@ +/** + * @fileOverview A collection of date/time utility functions + * @name Timegrid.DateTime + */ + +Timegrid.DateTime = new Object(); + +Timegrid.DateTime.MILLISECOND = 0; +Timegrid.DateTime.SECOND = 1; +Timegrid.DateTime.MINUTE = 2; +Timegrid.DateTime.HOUR = 3; +Timegrid.DateTime.DAY = 4; +Timegrid.DateTime.WEEK = 5; +Timegrid.DateTime.MONTH = 6; +Timegrid.DateTime.YEAR = 7; +Timegrid.DateTime.DECADE = 8; +Timegrid.DateTime.CENTURY = 9; +Timegrid.DateTime.MILLENNIUM = 10; + +Timegrid.DateTime.EPOCH = -1; +Timegrid.DateTime.ERA = -2; + +/** + * An array of unit lengths, expressed in milliseconds, of various lengths of + * time. The array indices are predefined and stored as properties of the + * Timegrid.DateTime object, e.g. Timegrid.DateTime.YEAR. + * @type Array + */ +Timegrid.DateTime.gregorianUnitLengths = []; + (function() { + var d = Timegrid.DateTime; + var a = d.gregorianUnitLengths; + + a[d.MILLISECOND] = 1; + a[d.SECOND] = 1000; + a[d.MINUTE] = a[d.SECOND] * 60; + a[d.HOUR] = a[d.MINUTE] * 60; + a[d.DAY] = a[d.HOUR] * 24; + a[d.WEEK] = a[d.DAY] * 7; + a[d.MONTH] = a[d.DAY] * 31; + a[d.YEAR] = a[d.DAY] * 365; + a[d.DECADE] = a[d.YEAR] * 10; + a[d.CENTURY] = a[d.YEAR] * 100; + a[d.MILLENNIUM] = a[d.YEAR] * 1000; + })(); + +Timegrid.DateTime._dateRegexp = new RegExp( + "^(-?)([0-9]{4})(" + [ + "(-?([0-9]{2})(-?([0-9]{2}))?)", // -month-dayOfMonth + "(-?([0-9]{3}))", // -dayOfYear + "(-?W([0-9]{2})(-?([1-7]))?)" // -Wweek-dayOfWeek + ].join("|") + ")?$" +); +Timegrid.DateTime._timezoneRegexp = new RegExp( + "Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$" +); +Timegrid.DateTime._timeRegexp = new RegExp( + "^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$" +); + +/** + * Takes a date object and a string containing an ISO 8601 date and sets the + * the date using information parsed from the string. Note that this method + * does not parse any time information. + * + * @param {Date} dateObject the date object to modify + * @param {String} string an ISO 8601 string to parse + * @return {Date} the modified date object + */ +Timegrid.DateTime.setIso8601Date = function(dateObject, string) { + /* + * This function has been adapted from dojo.date, v.0.3.0 + * http://dojotoolkit.org/. + */ + + var d = string.match(Timegrid.DateTime._dateRegexp); + if(!d) { + throw new Error("Invalid date string: " + string); + } + + var sign = (d[1] == "-") ? -1 : 1; // BC or AD + var year = sign * d[2]; + var month = d[5]; + var date = d[7]; + var dayofyear = d[9]; + var week = d[11]; + var dayofweek = (d[13]) ? d[13] : 1; + + dateObject.setUTCFullYear(year); + if (dayofyear) { + dateObject.setUTCMonth(0); + dateObject.setUTCDate(Number(dayofyear)); + } else if (week) { + dateObject.setUTCMonth(0); + dateObject.setUTCDate(1); + var gd = dateObject.getUTCDay(); + var day = (gd) ? gd : 7; + var offset = Number(dayofweek) + (7 * Number(week)); + + if (day <= 4) { + dateObject.setUTCDate(offset + 1 - day); + } else { + dateObject.setUTCDate(offset + 8 - day); + } + } else { + if (month) { + dateObject.setUTCDate(1); + dateObject.setUTCMonth(month - 1); + } + if (date) { + dateObject.setUTCDate(date); + } + } + + return dateObject; +}; + +/** + * Takes a date object and a string containing an ISO 8601 time and sets the + * the time using information parsed from the string. Note that this method + * does not parse any date information. + * + * @param {Date} dateObject the date object to modify + * @param {String} string an ISO 8601 string to parse + * @return {Date} the modified date object + */ +Timegrid.DateTime.setIso8601Time = function (dateObject, string) { + /* + * This function has been adapted from dojo.date, v.0.3.0 + * http://dojotoolkit.org/. + */ + + var d = string.match(Timegrid.DateTime._timeRegexp); + if(!d) { + Timegrid.Debug.warn("Invalid time string: " + string); + return false; + } + var hours = d[1]; + var mins = Number((d[3]) ? d[3] : 0); + var secs = (d[5]) ? d[5] : 0; + var ms = d[7] ? (Number("0." + d[7]) * 1000) : 0; + + dateObject.setUTCHours(hours); + dateObject.setUTCMinutes(mins); + dateObject.setUTCSeconds(secs); + dateObject.setUTCMilliseconds(ms); + + return dateObject; +}; + +/** + * The timezone offset in minutes in the user's browser. + * @type Number + */ +Timegrid.DateTime.timezoneOffset = new Date().getTimezoneOffset(); + +/** + * Takes a date object and a string containing an ISO 8601 date and time and + * sets the date object using information parsed from the string. + * + * @param {Date} dateObject the date object to modify + * @param {String} string an ISO 8601 string to parse + * @return {Date} the modified date object + */ +Timegrid.DateTime.setIso8601 = function (dateObject, string){ + /* + * This function has been adapted from dojo.date, v.0.3.0 + * http://dojotoolkit.org/. + */ + + var offset = null; + var comps = (string.indexOf("T") == -1) ? string.split(" ") : string.split("T"); + + Timegrid.DateTime.setIso8601Date(dateObject, comps[0]); + if (comps.length == 2) { + // first strip timezone info from the end + var d = comps[1].match(Timegrid.DateTime._timezoneRegexp); + if (d) { + if (d[0] == 'Z') { + offset = 0; + } else { + offset = (Number(d[3]) * 60) + Number(d[5]); + offset *= ((d[2] == '-') ? 1 : -1); + } + comps[1] = comps[1].substr(0, comps[1].length - d[0].length); + } + + Timegrid.DateTime.setIso8601Time(dateObject, comps[1]); + } + if (offset == null) { + offset = dateObject.getTimezoneOffset(); // local time zone if no tz info + } + dateObject.setTime(dateObject.getTime() + offset * 60000); + + return dateObject; +}; + +/** + * Takes a string containing an ISO 8601 date and returns a newly instantiated + * date object with the parsed date and time information from the string. + * + * @param {String} string an ISO 8601 string to parse + * @return {Date} a new date object created from the string + */ +Timegrid.DateTime.parseIso8601DateTime = function (string) { + try { + return Timegrid.DateTime.setIso8601(new Date(0), string); + } catch (e) { + return null; + } +}; + +/** + * Takes a string containing a Gregorian date and time and returns a newly + * instantiated date object with the parsed date and time information from the + * string. If the param is actually an instance of Date instead of a string, + * simply returns the given date instead. + * + * @param {Object} o an object, to either return or parse as a string + * @return {Date} the date object + */ +Timegrid.DateTime.parseGregorianDateTime = function(o) { + if (o == null) { + return null; + } else if (o instanceof Date) { + return o; + } + + var s = o.toString(); + if (s.length > 0 && s.length < 8) { + var space = s.indexOf(" "); + if (space > 0) { + var year = parseInt(s.substr(0, space)); + var suffix = s.substr(space + 1); + if (suffix.toLowerCase() == "bc") { + year = 1 - year; + } + } else { + var year = parseInt(s); + } + + var d = new Date(0); + d.setUTCFullYear(year); + + return d; + } + + try { + return new Date(Date.parse(s)); + } catch (e) { + return null; + } +}; + +/** + * Rounds date objects down to the nearest interval or multiple of an interval. + * This method modifies the given date object, converting it to the given + * timezone if specified. + * + * @param {Date} date the date object to round + * @param {Number} intervalUnit a constant, integer index specifying an + * interval, e.g. Timegrid.DateTime.HOUR + * @param {Number} timeZone a timezone shift, given in hours + * @param {Number} multiple a multiple of the interval to round by + * @param {Number} firstDayOfWeek an integer specifying the first day of the + * week, 0 corresponds to Sunday, 1 to Monday, etc. + */ +Timegrid.DateTime.roundDownToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) { + var timeShift = timeZone * + Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.HOUR]; + + var date2 = new Date(date.getTime() + timeShift); + var clearInDay = function(d) { + d.setUTCMilliseconds(0); + d.setUTCSeconds(0); + d.setUTCMinutes(0); + d.setUTCHours(0); + }; + var clearInYear = function(d) { + clearInDay(d); + d.setUTCDate(1); + d.setUTCMonth(0); + }; + + switch(intervalUnit) { + case Timegrid.DateTime.MILLISECOND: + var x = date2.getUTCMilliseconds(); + date2.setUTCMilliseconds(x - (x % multiple)); + break; + case Timegrid.DateTime.SECOND: + date2.setUTCMilliseconds(0); + + var x = date2.getUTCSeconds(); + date2.setUTCSeconds(x - (x % multiple)); + break; + case Timegrid.DateTime.MINUTE: + date2.setUTCMilliseconds(0); + date2.setUTCSeconds(0); + + var x = date2.getUTCMinutes(); + date2.setTime(date2.getTime() - + (x % multiple) * Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.MINUTE]); + break; + case Timegrid.DateTime.HOUR: + date2.setUTCMilliseconds(0); + date2.setUTCSeconds(0); + date2.setUTCMinutes(0); + + var x = date2.getUTCHours(); + date2.setUTCHours(x - (x % multiple)); + break; + case Timegrid.DateTime.DAY: + clearInDay(date2); + break; + case Timegrid.DateTime.WEEK: + clearInDay(date2); + var d = (date2.getUTCDay() + 7 - firstDayOfWeek) % 7; + date2.setTime(date2.getTime() - + d * Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.DAY]); + break; + case Timegrid.DateTime.MONTH: + clearInDay(date2); + date2.setUTCDate(1); + + var x = date2.getUTCMonth(); + date2.setUTCMonth(x - (x % multiple)); + break; + case Timegrid.DateTime.YEAR: + clearInYear(date2); + + var x = date2.getUTCFullYear(); + date2.setUTCFullYear(x - (x % multiple)); + break; + case Timegrid.DateTime.DECADE: + clearInYear(date2); + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 10) * 10); + break; + case Timegrid.DateTime.CENTURY: + clearInYear(date2); + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 100) * 100); + break; + case Timegrid.DateTime.MILLENNIUM: + clearInYear(date2); + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 1000) * 1000); + break; + } + + date.setTime(date2.getTime() - timeShift); +}; + +/** + * Rounds date objects up to the nearest interval or multiple of an interval. + * This method modifies the given date object, converting it to the given + * timezone if specified. + * + * @param {Date} date the date object to round + * @param {Number} intervalUnit a constant, integer index specifying an + * interval, e.g. Timegrid.DateTime.HOUR + * @param {Number} timeZone a timezone shift, given in hours + * @param {Number} multiple a multiple of the interval to round by + * @param {Number} firstDayOfWeek an integer specifying the first day of the + * week, 0 corresponds to Sunday, 1 to Monday, etc. + * @see Timegrid.DateTime.roundDownToInterval + */ +Timegrid.DateTime.roundUpToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) { + var originalTime = date.getTime(); + Timegrid.DateTime.roundDownToInterval(date, intervalUnit, timeZone, multiple, firstDayOfWeek); + if (date.getTime() < originalTime) { + date.setTime(date.getTime() + + Timegrid.DateTime.gregorianUnitLengths[intervalUnit] * multiple); + } +}; + +/** + * Increments a date object by a specified interval, taking into + * consideration the timezone. + * + * @param {Date} date the date object to increment + * @param {Number} intervalUnit a constant, integer index specifying an + * interval, e.g. Timegrid.DateTime.HOUR + * @param {Number} timeZone the timezone offset in hours + */ +Timegrid.DateTime.incrementByInterval = function(date, intervalUnit, timeZone) { + timeZone = (typeof timeZone == 'undefined') ? 0 : timeZone; + + var timeShift = timeZone * + Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.HOUR]; + + var date2 = new Date(date.getTime() + timeShift); + + switch(intervalUnit) { + case Timegrid.DateTime.MILLISECOND: + date2.setTime(date2.getTime() + 1) + break; + case Timegrid.DateTime.SECOND: + date2.setTime(date2.getTime() + 1000); + break; + case Timegrid.DateTime.MINUTE: + date2.setTime(date2.getTime() + + Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.MINUTE]); + break; + case Timegrid.DateTime.HOUR: + date2.setTime(date2.getTime() + + Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.HOUR]); + break; + case Timegrid.DateTime.DAY: + date2.setUTCDate(date2.getUTCDate() + 1); + break; + case Timegrid.DateTime.WEEK: + date2.setUTCDate(date2.getUTCDate() + 7); + break; + case Timegrid.DateTime.MONTH: + date2.setUTCMonth(date2.getUTCMonth() + 1); + break; + case Timegrid.DateTime.YEAR: + date2.setUTCFullYear(date2.getUTCFullYear() + 1); + break; + case Timegrid.DateTime.DECADE: + date2.setUTCFullYear(date2.getUTCFullYear() + 10); + break; + case Timegrid.DateTime.CENTURY: + date2.setUTCFullYear(date2.getUTCFullYear() + 100); + break; + case Timegrid.DateTime.MILLENNIUM: + date2.setUTCFullYear(date2.getUTCFullYear() + 1000); + break; + } + + date.setTime(date2.getTime() - timeShift); +}; + +/** + * Returns a new date object with the given time offset removed. + * + * @param {Date} date the starting date + * @param {Number} timeZone a timezone specified in an hour offset to remove + * @return {Date} a new date object with the offset removed + */ +Timegrid.DateTime.removeTimeZoneOffset = function(date, timeZone) { + return new Date(date.getTime() + + timeZone * Timegrid.DateTime.gregorianUnitLengths[Timegrid.DateTime.HOUR]); +}; + +/** + * Returns the timezone of the user's browser. + * + * @return {Number} the timezone in the user's locale in hours + */ +Timegrid.DateTime.getTimezone = function() { + var d = new Date().getTimezoneOffset(); + return d / -60; +}; diff --git a/src/webapp/api/scripts/units.js b/src/webapp/api/scripts/units.js new file mode 100644 index 0000000..1694f02 --- /dev/null +++ b/src/webapp/api/scripts/units.js @@ -0,0 +1,73 @@ +/*================================================== + * Default Unit + *================================================== + */ + +Timegrid.NativeDateUnit = new Object(); + +Timegrid.NativeDateUnit.makeDefaultValue = function() { + return new Date(); +}; + +Timegrid.NativeDateUnit.cloneValue = function(v) { + return new Date(v.getTime()); +}; + +Timegrid.NativeDateUnit.getParser = function(format) { + if (typeof format == "string") { + format = format.toLowerCase(); + } + + var parser = (format == "iso8601" || format == "iso 8601") ? + Timegrid.DateTime.parseIso8601DateTime : + Timegrid.DateTime.parseGregorianDateTime; + + return function(d) { + if (typeof d != 'undefined' && typeof d.toUTCString == "function") { + return d; + } else { + return parser(d); + } + }; +}; + +Timegrid.NativeDateUnit.parseFromObject = function(o) { + return Timegrid.DateTime.parseGregorianDateTime(o); +}; + +Timegrid.NativeDateUnit.toNumber = function(v) { + return v.getTime(); +}; + +Timegrid.NativeDateUnit.fromNumber = function(n) { + return new Date(n); +}; + +Timegrid.NativeDateUnit.compare = function(v1, v2) { + var n1, n2; + if (typeof v1 == "object") { + n1 = v1.getTime(); + } else { + n1 = Number(v1); + } + if (typeof v2 == "object") { + n2 = v2.getTime(); + } else { + n2 = Number(v2); + } + + return n1 - n2; +}; + +Timegrid.NativeDateUnit.earlier = function(v1, v2) { + return Timegrid.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2; +}; + +Timegrid.NativeDateUnit.later = function(v1, v2) { + return Timegrid.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2; +}; + +Timegrid.NativeDateUnit.change = function(v, n) { + return new Date(v.getTime() + n); +}; + diff --git a/src/webapp/api/timegrid-api.js b/src/webapp/api/timegrid-api.js index 9bc2795..4f5cb32 100644 --- a/src/webapp/api/timegrid-api.js +++ b/src/webapp/api/timegrid-api.js @@ -44,7 +44,9 @@ "layouts/monthly.js", "layouts/property.js", - "data-structure.js" + "data-structure.js", + "units.js", + "date-time.js" ]; var cssFiles = [ "timegrid.css", diff --git a/src/webapp/api/timegrid-bundle.js b/src/webapp/api/timegrid-bundle.js index 8769b09..1a83993 100644 --- a/src/webapp/api/timegrid-bundle.js +++ b/src/webapp/api/timegrid-bundle.js @@ -28,9 +28,6 @@ var layoutNames=config.views.split(","); var getExtension=function(s){ return s.split('.').pop().toLowerCase(); }; - - - if(config.eventsource){ var eventSource=eval(config.eventsource); var tg=Timegrid.create(elmt,eventSource,layoutNames,config); @@ -64,11 +61,13 @@ return config; }; Timegrid.loadXML=function(url,f){ + var fError=function(statusText,status,xmlhttp){ $.debugLog(Timegrid.l10n.xmlErrorMessage+" "+url+"\n"+statusText,true); }; var fDone=function(xmlhttp){ + var xml=xmlhttp.responseXML; if(!xml.documentElement&&xmlhttp.responseStream){ xml.load(xmlhttp.responseStream); From 1a544a0e9bfcaa460824873b7c783f152a1bc2a0 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Thu, 10 Aug 2017 00:20:14 -0400 Subject: [PATCH 37/43] Fixed bug on units.js --- src/webapp/api/scripts/units.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webapp/api/scripts/units.js b/src/webapp/api/scripts/units.js index 1694f02..e008fc4 100644 --- a/src/webapp/api/scripts/units.js +++ b/src/webapp/api/scripts/units.js @@ -23,7 +23,7 @@ Timegrid.NativeDateUnit.getParser = function(format) { Timegrid.DateTime.parseGregorianDateTime; return function(d) { - if (typeof d != 'undefined' && typeof d.toUTCString == "function") { + if (d != null && typeof d != "undefined" && typeof d.toUTCString == "function") { return d; } else { return parser(d); From 0ecf826329b62eb9b7f5d75e0aa76965efa437fe Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Sat, 12 Aug 2017 20:06:58 -0400 Subject: [PATCH 38/43] Removed .DS_Store files from repo --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 9 +++++++++ src/.DS_Store | Bin 6148 -> 0 bytes src/webapp/.DS_Store | Bin 8196 -> 0 bytes src/webapp/api/.DS_Store | Bin 6148 -> 0 bytes src/webapp/api/locales/.DS_Store | Bin 6148 -> 0 bytes src/webapp/api/locales/en-US/.DS_Store | Bin 6148 -> 0 bytes src/webapp/api/scripts/.DS_Store | Bin 6148 -> 0 bytes src/webapp/site/.DS_Store | Bin 6148 -> 0 bytes src/webapp/site/examples/.DS_Store | Bin 8196 -> 0 bytes 10 files changed, 9 insertions(+) delete mode 100644 .DS_Store create mode 100644 .gitignore delete mode 100644 src/.DS_Store delete mode 100644 src/webapp/.DS_Store delete mode 100644 src/webapp/api/.DS_Store delete mode 100644 src/webapp/api/locales/.DS_Store delete mode 100644 src/webapp/api/locales/en-US/.DS_Store delete mode 100644 src/webapp/api/scripts/.DS_Store delete mode 100644 src/webapp/site/.DS_Store delete mode 100644 src/webapp/site/examples/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 1e1cc38c40c6d1182f61dd2e947ca3edcf9d5545..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO>Wab6n@jB)S&{hKx&uXAhC$5M5J_4Az5jp zzbH$#rh9GznamN;4xQ47qF%HVZ90qsMuGoL0rBnD$ft}#im34Y^1dH&A6_vv?4#WM zB@HdXcufOJahzRz@e7QvCB`N_q#hm6Aw41&^$xhFl=h+`i*1!y6`J7A;!@OyQq+cu zLQbE&rJO%Y(G^M%-(SorNBFTYLLKE#ld;y}n?H`iByBc-u(e8c{o00At68-h)+=|& zr*7({S<>+)FXUMm41C>w%6ass?fK8b!Stwp`+&!(7si80A^hd@Fb?>%!?QR@WS+-f zIs{i<=%~Iuo3(d$8+N!d-vya%i6lrdeA!_oxPpCo4@~r0mB%kWNEiF zp2KG}^zfpSmfPo}@ww~5GveKDkfnX1?_ZuYq+fGJJXqlw4_9S-<4)p;$0x`m?rI$m zpW}!qDLn@9+7ur{A+nT1-jb;naBPi^##|vhFs7(LMP+)6!4w_+wvKZ&<_Z;^nBIIaePyP1C`?`*`E40a z%u#4+qkvIhQGtp&t&8>laP|Iwkz~${0!D!=r2wmT-EId%(rfF|;KW*Mqa33M6LGmh lNkOHTW7!Z(@ivMy_-xStIvR6@=z*CZ0V#v2i~|2uf!}_}!I1y} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e159b86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +./.DS_Store +./src/.DS_Store +./src/webapp/.DS_Store +./src/webapp/api/.DS_Store +./src/webapp/api/locales/.DS_Store +./src/webapp/api/locales/en-US/.DS_Store +./src/webapp/api/scripts/.DS_Store +./src/webapp/site/.DS_Store +./src/webapp/site/examples/.DS_Store diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index cf30b7746f8ee4ee74a137470078ebfb310c9fd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!A=`75FLjA8=;CEkl?tNN*p)@HNXKOtpXglRZ7(!Xa&0@A}cNHD7#?=A!vW2 z{eylAU%=P2k%F_r;BzT z=EJNN4$e(4?sOw(f6+Rb*kSZF?iLsIjbokWVVrgcQ{msg#c4+uEj>&-nW^(R%zMZ+ z6J6A|Mx*B5-j3gFHpe^u=-{9M`_uk-?0K6XcaP34Z|?3#597z5SP(?~~|4;w^{+~^fo-iN`yekG&^`w2$!jjzGI=48!YklY?l!fC;i<1-><|;-k dU&UKcBk=od00W1mMR*|cBVcHdMi^Kq1Ftkwag6`~ diff --git a/src/webapp/.DS_Store b/src/webapp/.DS_Store deleted file mode 100644 index 621fe5798ef4920403f9640ddd170b7e4947f396..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM%}*0S6n_I%TM=14N{M=CBqk*EK()08V=M)ujRzV^v;?qh+of#W?$q5a6>3fY z3qKN1o;-Q*FYu-pZ^oks{{b(a@y!QIq4bI-&P!%~v-94YxAU9n&b}=GkW8Zz2bcnY zAQpz&5LPD$)3eee1G0zt5%dRIE?KmMS6Yv)>QD?Q1{4E|0mXn~;NM^X&uk{aKIgvB zs#-Ci82B$4V9$pr7KUkw9fADOffY{y5ChoF1>5}PA2G^05YrMn0H*33lt>^6*uf(*8e00Ewxc2MU*pjoes_}f8*6O~_ z*VO3ZVx{4g0lvLmj&Qy7snJRwO?|uHXghhwwy0gjaoAl2zy%XLFpjOkd(?HWfp6Ef z3Sa*ADonLniDVL~PbAnfq*8MyF9V|)rSCGlL8U)Iv%Dj>8ToiH!5^CDZ?yA67ltp6 zXrp7}qZ6ayaCkBjo*KJ!xu}ho^zxIc!?w%pZ$=)Ux&##fa<hNYJbYst<~&!e@1iL+pL&O_$w zdfBwA(|3MxZXq%kunte5125qne1K2z z6@J2R*eAnel3XRTBu0`XMbc!RERg#oOO}QAz`-x-%0VcBWDU_@$|HN7@cpjN|D%Md zE5*R+GcYJZPO*1@yZyiapZ<-hh>8Klz^O4n0*m>@42C;6&W}fCxpoxGCKe{lt|O4U mV8zpMM4pZ#`hOT=JBp^vCoQof5PMM6hX784suTmK%D^9;bva%D diff --git a/src/webapp/api/.DS_Store b/src/webapp/api/.DS_Store deleted file mode 100644 index 1c3406f9faae6c5ab25fbc96e1e0ce03ae2217f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%W48q3_Y<@g>GDSd4HjQa1s3if56g~A`Du56uO(8zwODxp=GAqE^GqH8IzoQ znX{M}05U(lJ^?cTQ@SF~8v3Sn^`4C)b4L_Aqrn>vpR4`0+4Z`I6Uv>S!45BYCU*So zyPwMHfwet0_`vacdRM(?^@y)Q=J1V~O$AbcR3H^d1^%}JoY`vA2gi)5Kq`<5bPDMA zq0kj;VC!g~4hCBRh-0SB_-wlbv1o!=16xOCXyR0&QzcdmaXRxQ`f6b7=yXUd9}+i9 zY$#&4^Za7%km{H*6-WhsDxkYJZKm^oN&jX4*PgUgAQiY#1!TNfE#`c=n616n)LC2T tYx>pLYwZj+iitLg`9nwX1+DEO}?w z>)F*#aXy=w@86&9%(iB>ffMbM!_v4AzA?7 z8sRX^qn7|S27tYAN<;+aNd+d=tHto7Bi<^n7fy*uH;{@=s@=>O*=t)zeyxF`jDeHadVJgI8y;&H6C4gLsc&KI19c~CG!IR-{K h#)9Q|7fG4dILCf3oDzeMc+i3R8K5pQDR6EDz5)8g7JL8z diff --git a/src/webapp/api/locales/en-US/.DS_Store b/src/webapp/api/locales/en-US/.DS_Store deleted file mode 100644 index b2a6b3e6c870dde3f033c72e8cfe8a9aab8f5326..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKOG-mQ5UkdK0XJD@IalxoLx?BH1p*O5K%yk-`mJ&$ zdAwS@eht7D?@tfF48WA`h?9r0`MLYZZYpC$I`4SJ8;&2V!~XeYRDC(&+&dhx!2!FU z{QWj>y-ZV93P=GdAO)m=6!@hA-g{}&`$R=4AO)nrw*vlsXmrP3I3&iWgCRx$;)Lli zu49%UHct?H;gHA-&5}w?s?~^LNoT%QT`wFGlMbul!|KUa6N<&td4G#?SWi@x0#e{y zf!o~9y#GJaugw4FB<-Yt6!=#P*krj{F8E5-TSqVFy|&TUbg%iOyKx;9hG@scXvf@m fJDx{T)-_-AycZ6ML1#YbMEwl7E;1?b*9v?AELauN diff --git a/src/webapp/api/scripts/.DS_Store b/src/webapp/api/scripts/.DS_Store deleted file mode 100644 index 1de850875f58de8265baafbe36991f5a4c6b1b06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}N7d44mkK1us2%{9eH~SW10@zJQ`4LTRD31#f%vwVnKQscgM^kO?HSO)}rd z&SBF4u*Ko!9+(4|(H-&SVQOA?pV(Dpu89_B9Poktakbm5x0CM63FqEmjVF9!i!=V_ zEl*{2AC(=R@p?Lataib9$2xBv^OtW^RtiV~DIf);fE3`&cAMQMDoOzf7@rP?SOJI~(_ws$U4qy=LF@~ML}qA~RAN%CRt!rz^R4>&!XYu~uv$K>ZnoM` zENW_fyB9j7tp};qk?I5NA diff --git a/src/webapp/site/.DS_Store b/src/webapp/site/.DS_Store deleted file mode 100644 index 200ed90021c5510578f5c81fb46f08d1e46f1cd7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO>Wab6n@hh>I4v3RBD&rAhD=WDpI;YNLDC|?vR3D0jRa>&{%Rkk?j!L5abPa z0B*ohH~|OY0Pww;QIw477DZ^DH1oar`JO%BjAuMVB>IzNpQuAbJ`$tXM)nuuc1{i3 zFg45*9OF2XXK^NDlsTX?r+`yny%peZ*Q10aol$9hzmL&&|F<$Vh(*8mgCfslevVpv z_t+eU^noI}pfP3e?Kt19IF0`Cv>cm#<3~Ks(z5Dye~OJw@5aq7zt!?vcl@`5k(>^y zsG5}hsCcbPX)=tB|3b=a;YabybT~cfY(JHG6{Y#GSnB@fRhlPq+Lx0&DOH^3Q8fZr zJ?NyfJDc?m4)%gxuQ%TdW`~De_zxe==f1ylZ~w{h>BZ&M?Bo2?S0xDv7J%)phDH7j zUSpt^a9i|_QYs)>OcOd^m0#>2!m|8UZ!1jpr#6Q#SrG^AT%BAq3K_1)N~T+$%tc~ zEX)l>n2U!9RCf}gMwdGUoC2!~Z0cf%&;MuF-~U%huH+PO3j9|J2=8cc)W?v_+1eN! vpS1zfDH0p^t2HVLGIJa&hmYc2BxPs|*a3zHYmKOZxgP-~gUg%(|5SlL4qdLX diff --git a/src/webapp/site/examples/.DS_Store b/src/webapp/site/examples/.DS_Store deleted file mode 100644 index 444da7b0ab8682883f9a9e33d68aec0879cde1b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeI1&u-H|5XNWQlsce_9FUr$FGw76NJT=BP$esrLvKhyZ~)ZWu^|?&H%c6=k_P$0 zL%cXD5l|YB8O|ye1Zuu0Vco%m;e*F3IwobtL9v??we8eOn?demju-P z!G$UHtQJP~tpiSP0iZRU)(w5^19XmS)w5a{)v2gyb`Qd)3cJM+CLQCh3Ws`D3!^5T zgh?l1uPp2iMd+&|&(+~1JfrNH025dzp!V(#`80%u<^6k*$N*#N>+}eA@276)ZHN!@ z>Db193&u%2&D!nnVr#p$b7R-3*PZ&F^Lj9n`5^PN*|hIZUh1Pbi~`$#CS|hh`@!=# z%1;`19?LZI<20I-!e70J(@^GpIZMN-uJhE-M#$9{I%zcL^G>(hayy;QqUFwey*B#y zA1oG*vw!#C@c8uX{KNcW@$s{s3JH5Zq1)zo>A!56==;GWO=S8OV=C_^ut`ek4Zuxc zDUKuc@S_CpE8@!VHs)07?%*+ss+-YhwVK$kR4YaPt8YSSiWN)_je%XlEBqOqS73dr zz*>v1)T>dBN)f%Q)cH}Vvy8i9$h!|aEw|h4{qg61Il)yx>LXvkp!!<_r&nPpum9k} zjR{;Q0^8=rHr4+B$>q=guhW$HwK4%F@S6lg?Pze+N0MIEHzcc7-i4jQR8w( Date: Mon, 14 Aug 2017 20:52:18 -0400 Subject: [PATCH 39/43] Got rid of syntaxError from 'javascript:void' --- src/webapp/api/scripts/controls.js | 6 +++--- src/webapp/api/timegrid-bundle.js | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/webapp/api/scripts/controls.js b/src/webapp/api/scripts/controls.js index a14d31a..0aa35b0 100644 --- a/src/webapp/api/scripts/controls.js +++ b/src/webapp/api/scripts/controls.js @@ -66,7 +66,7 @@ Timegrid.Controls.TabSet.prototype.render = function(container) { }; for (var lTitle in this._layoutMap) { $newLink = $("", { - href : "javascript:void", + href : undefined, text : lTitle }); @@ -142,11 +142,11 @@ Timegrid.Controls.Iterator.prototype.render = function(container) { }; }; $imageURL = Timegrid.urlPrefix + "images/go-previous.png"; - $prevLink = $('', {href: "javascript:void"}) + $prevLink = $('', {href: undefined}) .addClass('timegrid-iterator-prev') .append($('', {alt: "Previous", src: $imageURL})); $imageURL = Timegrid.urlPrefix + "images/go-next.png"; - $nextLink = $('', {href: "javascript:void"}) + $nextLink = $('', {href: undefined}) .addClass('timegrid-iterator-next') .append($('', {alt: "Next", src: $imageURL})); $nextLink.click(makeNextCallback(this._layout)); diff --git a/src/webapp/api/timegrid-bundle.js b/src/webapp/api/timegrid-bundle.js index 1a83993..8b63218 100644 --- a/src/webapp/api/timegrid-bundle.js +++ b/src/webapp/api/timegrid-bundle.js @@ -61,13 +61,11 @@ return config; }; Timegrid.loadXML=function(url,f){ - var fError=function(statusText,status,xmlhttp){ $.debugLog(Timegrid.l10n.xmlErrorMessage+" "+url+"\n"+statusText,true); }; var fDone=function(xmlhttp){ - var xml=xmlhttp.responseXML; if(!xml.documentElement&&xmlhttp.responseStream){ xml.load(xmlhttp.responseStream); @@ -1888,7 +1886,7 @@ return function(){self.switchTo(title);}; }; for(var lTitle in this._layoutMap){ $newLink=$("",{ -href:"javascript:void", +href:undefined, text:lTitle }); @@ -1960,11 +1958,11 @@ self.render(); }; }; $imageURL=Timegrid.urlPrefix+"images/go-previous.png"; -$prevLink=$('',{href:"javascript:void"}) +$prevLink=$('',{href:undefined}) .addClass('timegrid-iterator-prev') .append($('',{alt:"Previous",src:$imageURL})); $imageURL=Timegrid.urlPrefix+"images/go-next.png"; -$nextLink=$('',{href:"javascript:void"}) +$nextLink=$('',{href:undefined}) .addClass('timegrid-iterator-next') .append($('',{alt:"Next",src:$imageURL})); $nextLink.click(makeNextCallback(this._layout)); From 44da55bf32e8131ecf7bab1a83934b96949b5ef8 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Wed, 16 Aug 2017 12:59:21 -0400 Subject: [PATCH 40/43] Added functionality to the backbutton of the view --- src/webapp/api/scripts/controls.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webapp/api/scripts/controls.js b/src/webapp/api/scripts/controls.js index 0aa35b0..f67ff37 100644 --- a/src/webapp/api/scripts/controls.js +++ b/src/webapp/api/scripts/controls.js @@ -150,6 +150,7 @@ Timegrid.Controls.Iterator.prototype.render = function(container) { .addClass('timegrid-iterator-next') .append($('', {alt: "Next", src: $imageURL})); $nextLink.click(makeNextCallback(this._layout)); + $prevLink.click(makePrevCallback(this._layout)); this._div.append($prevLink); this._div.append($nextLink); this._div.append($('', { text: this._layout.getCurrent() })); From beca536d34038f2c99afa2a770aedc1c4654a5a4 Mon Sep 17 00:00:00 2001 From: alhamzah Date: Thu, 17 Aug 2017 03:00:33 -0400 Subject: [PATCH 41/43] fixed month layout starting date --- src/webapp/api/scripts/controls.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/webapp/api/scripts/controls.js b/src/webapp/api/scripts/controls.js index f67ff37..15cde49 100644 --- a/src/webapp/api/scripts/controls.js +++ b/src/webapp/api/scripts/controls.js @@ -93,10 +93,13 @@ Timegrid.Controls.TabSet.prototype.switchTo = function(title) { this._renderedLayouts[this.current].hide(); this._tabs[this.current].removeClass('timegrid-tab-active'); } + + this.current = title; if (this._renderedLayouts[title]) { this._renderedLayouts[title].show(); } else if (this._layoutMap[title]) { this._renderedLayouts[title] = $(this._layoutMap[title].render(this._container)).show(); + this.renderChanged(); } if (this._iDiv) { $(this._iDiv).empty(); } if (this._layoutMap[title].iterable) { From 4add7f0aee9b22e925433771875a2e7525b06bb7 Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Fri, 25 Aug 2017 09:42:11 -0400 Subject: [PATCH 42/43] collapsed borders of adjacent cells --- src/webapp/api/styles/timegrid.css | 4 ++++ src/webapp/api/timegrid-bundle.css | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/webapp/api/styles/timegrid.css b/src/webapp/api/styles/timegrid.css index 7401874..bd6dd56 100644 --- a/src/webapp/api/styles/timegrid.css +++ b/src/webapp/api/styles/timegrid.css @@ -54,6 +54,10 @@ div.timegrid-grid-window { border: 1px inset black; } +table { + border-collapse: collapse; +} + table.timegrid-gridlines, .timegrid-hline, .timegrid-vline { border: 1px solid #e6e2af; } diff --git a/src/webapp/api/timegrid-bundle.css b/src/webapp/api/timegrid-bundle.css index 01fca12..bac3500 100644 --- a/src/webapp/api/timegrid-bundle.css +++ b/src/webapp/api/timegrid-bundle.css @@ -133,6 +133,10 @@ div.timegrid-grid-window { border: 1px inset black; } +table { + border-collapse: collapse; +} + table.timegrid-gridlines, .timegrid-hline, .timegrid-vline { border: 1px solid #e6e2af; } From 7de1ec13811d88858c86623759fe887d78e72cfc Mon Sep 17 00:00:00 2001 From: "juanmoo@mnit.edu" Date: Tue, 29 Aug 2017 17:55:39 -0400 Subject: [PATCH 43/43] Made gridlines visible on odd months --- src/webapp/api/styles/timegrid.css | 1 + src/webapp/api/timegrid-bundle.css | 1 + src/webapp/api/timegrid-bundle.js | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/src/webapp/api/styles/timegrid.css b/src/webapp/api/styles/timegrid.css index bd6dd56..a1ac309 100644 --- a/src/webapp/api/styles/timegrid.css +++ b/src/webapp/api/styles/timegrid.css @@ -136,6 +136,7 @@ div.timegrid-month-cell { position: absolute; padding: 0; overflow: hidden; + border: 1px solid #e6e2af; } div.timegrid-month-cell-odd { diff --git a/src/webapp/api/timegrid-bundle.css b/src/webapp/api/timegrid-bundle.css index bac3500..225aa3d 100644 --- a/src/webapp/api/timegrid-bundle.css +++ b/src/webapp/api/timegrid-bundle.css @@ -215,6 +215,7 @@ div.timegrid-month-cell { position: absolute; padding: 0; overflow: hidden; + border: 1px solid #e6e2af; } div.timegrid-month-cell-odd { diff --git a/src/webapp/api/timegrid-bundle.js b/src/webapp/api/timegrid-bundle.js index 8b63218..6a2b81a 100644 --- a/src/webapp/api/timegrid-bundle.js +++ b/src/webapp/api/timegrid-bundle.js @@ -1913,10 +1913,13 @@ if(this.current&&this._renderedLayouts[this.current]){ this._renderedLayouts[this.current].hide(); this._tabs[this.current].removeClass('timegrid-tab-active'); } + +this.current=title; if(this._renderedLayouts[title]){ this._renderedLayouts[title].show(); }else if(this._layoutMap[title]){ this._renderedLayouts[title]=$(this._layoutMap[title].render(this._container)).show(); +this.renderChanged(); } if(this._iDiv){$(this._iDiv).empty();} if(this._layoutMap[title].iterable){ @@ -1966,6 +1969,7 @@ $nextLink=$('',{href:undefined}) .addClass('timegrid-iterator-next') .append($('',{alt:"Next",src:$imageURL})); $nextLink.click(makeNextCallback(this._layout)); +$prevLink.click(makePrevCallback(this._layout)); this._div.append($prevLink); this._div.append($nextLink); this._div.append($('',{text:this._layout.getCurrent()}));