damagecontrol 0.5.0 → 0.5.0.1391

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/README +67 -11
  2. data/Rakefile +15 -6
  3. data/app/controllers/admin_controller.rb +0 -3
  4. data/app/controllers/application.rb +42 -163
  5. data/app/controllers/build_controller.rb +33 -0
  6. data/app/controllers/files_controller.rb +1 -1
  7. data/app/controllers/project_controller.rb +23 -65
  8. data/app/controllers/rails_ext.rb +247 -0
  9. data/app/controllers/rscm_ext.rb +52 -0
  10. data/app/helpers/build_helper.rb +2 -0
  11. data/app/views/build/email.rhtml +18 -0
  12. data/app/views/build/status.rhtml +20 -0
  13. data/app/views/build/tests.rhtml +2 -0
  14. data/app/views/layouts/{rscm.rhtml → default.rhtml} +10 -4
  15. data/app/views/project/_changesets_list.rhtml +2 -2
  16. data/app/views/project/_cvs.rhtml +4 -5
  17. data/app/views/project/_project.rhtml +9 -9
  18. data/app/views/project/_select_pane.rhtml +26 -0
  19. data/app/views/project/_tab_pane.rhtml +23 -0
  20. data/app/views/project/changeset.rhtml +35 -0
  21. data/app/views/project/view.rhtml +18 -32
  22. data/app/views/setup/welcome.rhtml +118 -0
  23. data/config/database.yml +20 -20
  24. data/config/environment.rb +66 -60
  25. data/config/environments/development.rb +3 -2
  26. data/config/environments/production.rb +3 -2
  27. data/config/environments/test.rb +3 -2
  28. data/config/routes.rb +15 -0
  29. data/lib/damagecontrol/app.rb +11 -40
  30. data/lib/damagecontrol/build.rb +50 -8
  31. data/lib/damagecontrol/directories.rb +7 -6
  32. data/lib/damagecontrol/poller.rb +11 -20
  33. data/lib/damagecontrol/project.rb +83 -16
  34. data/lib/damagecontrol/publisher/ambient_orb.rb +16 -0
  35. data/lib/damagecontrol/publisher/archive.rb +16 -0
  36. data/lib/damagecontrol/publisher/base.rb +25 -0
  37. data/lib/damagecontrol/publisher/build_duration.rb +16 -0
  38. data/lib/damagecontrol/publisher/email.rb +59 -0
  39. data/lib/damagecontrol/publisher/execute.rb +49 -0
  40. data/lib/damagecontrol/publisher/ftp.rb +16 -0
  41. data/lib/damagecontrol/publisher/growl.rb +44 -0
  42. data/lib/damagecontrol/publisher/irc.rb +31 -0
  43. data/lib/damagecontrol/publisher/jabber.rb +68 -0
  44. data/lib/damagecontrol/publisher/scp.rb +16 -0
  45. data/lib/damagecontrol/publisher/x10cm11a.rb +17 -0
  46. data/lib/damagecontrol/publisher/x10cm17a.rb +17 -0
  47. data/lib/damagecontrol/publisher/yahoo.rb +16 -0
  48. data/lib/damagecontrol/standard_persister.rb +2 -2
  49. data/lib/damagecontrol/tracker.rb +48 -6
  50. data/lib/damagecontrol/visitor/rss_writer.rb +1 -1
  51. data/lib/damagecontrol/visitor/yaml_persister.rb +10 -1
  52. data/public/404.html +5 -5
  53. data/public/500.html +5 -5
  54. data/public/dispatch.cgi +2 -2
  55. data/public/dispatch.fcgi +1 -1
  56. data/public/dispatch.rb +2 -2
  57. data/public/images/growlicon.png +0 -0
  58. data/public/images/megaphone.png +0 -0
  59. data/public/images/monotone-logo.png +0 -0
  60. data/public/images/publisher/ambient_orb.png +0 -0
  61. data/public/images/publisher/build_duration.png +0 -0
  62. data/public/images/publisher/email.png +0 -0
  63. data/public/images/publisher/execute.png +0 -0
  64. data/public/images/publisher/growl.png +0 -0
  65. data/public/images/publisher/irc.png +0 -0
  66. data/public/images/publisher/jabber.png +0 -0
  67. data/public/images/publisher/x10cm11a.png +0 -0
  68. data/public/images/publisher/x10cm17a.png +0 -0
  69. data/public/images/publisher/yahoo.png +0 -0
  70. data/public/index.html +70 -1
  71. data/public/javascripts/dateFormat.js +283 -0
  72. data/public/javascripts/jscalendar/ChangeLog +500 -0
  73. data/public/javascripts/jscalendar/README +33 -0
  74. data/public/javascripts/jscalendar/bugtest-hidden-selects.html +108 -0
  75. data/public/javascripts/jscalendar/calendar-blue.css +231 -0
  76. data/public/javascripts/jscalendar/calendar-blue2.css +235 -0
  77. data/public/javascripts/jscalendar/calendar-brown.css +224 -0
  78. data/public/javascripts/jscalendar/calendar-green.css +228 -0
  79. data/public/javascripts/jscalendar/calendar-setup.js +181 -0
  80. data/public/javascripts/jscalendar/calendar-setup_stripped.js +21 -0
  81. data/public/javascripts/jscalendar/calendar-system.css +250 -0
  82. data/public/javascripts/jscalendar/calendar-tas.css +238 -0
  83. data/public/javascripts/jscalendar/calendar-win2k-1.css +270 -0
  84. data/public/javascripts/jscalendar/calendar-win2k-2.css +270 -0
  85. data/public/javascripts/jscalendar/calendar-win2k-cold-1.css +264 -0
  86. data/public/javascripts/jscalendar/calendar-win2k-cold-2.css +270 -0
  87. data/public/javascripts/jscalendar/calendar.js +1715 -0
  88. data/public/javascripts/jscalendar/calendar.php +119 -0
  89. data/public/javascripts/jscalendar/calendar_stripped.js +12 -0
  90. data/public/javascripts/jscalendar/doc/html/reference-Z-S.css +0 -0
  91. data/public/javascripts/jscalendar/doc/html/reference.css +34 -0
  92. data/public/javascripts/jscalendar/doc/html/reference.html +1316 -0
  93. data/public/javascripts/jscalendar/doc/reference.pdf +0 -0
  94. data/public/javascripts/jscalendar/img.gif +0 -0
  95. data/public/javascripts/jscalendar/index.html +333 -0
  96. data/public/javascripts/jscalendar/lang/calendar-af.js +39 -0
  97. data/public/javascripts/jscalendar/lang/calendar-br.js +45 -0
  98. data/public/javascripts/jscalendar/lang/calendar-ca.js +45 -0
  99. data/public/javascripts/jscalendar/lang/calendar-cs-win.js +34 -0
  100. data/public/javascripts/jscalendar/lang/calendar-da.js +63 -0
  101. data/public/javascripts/jscalendar/lang/calendar-de.js +100 -0
  102. data/public/javascripts/jscalendar/lang/calendar-du.js +45 -0
  103. data/public/javascripts/jscalendar/lang/calendar-el.js +89 -0
  104. data/public/javascripts/jscalendar/lang/calendar-en.js +123 -0
  105. data/public/javascripts/jscalendar/lang/calendar-es.js +114 -0
  106. data/public/javascripts/jscalendar/lang/calendar-fi.js +98 -0
  107. data/public/javascripts/jscalendar/lang/calendar-fr.js +86 -0
  108. data/public/javascripts/jscalendar/lang/calendar-hr-utf8.js +49 -0
  109. data/public/javascripts/jscalendar/lang/calendar-hr.js +0 -0
  110. data/public/javascripts/jscalendar/lang/calendar-hu.js +45 -0
  111. data/public/javascripts/jscalendar/lang/calendar-it.js +79 -0
  112. data/public/javascripts/jscalendar/lang/calendar-jp.js +45 -0
  113. data/public/javascripts/jscalendar/lang/calendar-ko-utf8.js +120 -0
  114. data/public/javascripts/jscalendar/lang/calendar-ko.js +120 -0
  115. data/public/javascripts/jscalendar/lang/calendar-lt-utf8.js +114 -0
  116. data/public/javascripts/jscalendar/lang/calendar-lt.js +114 -0
  117. data/public/javascripts/jscalendar/lang/calendar-nl.js +45 -0
  118. data/public/javascripts/jscalendar/lang/calendar-no.js +45 -0
  119. data/public/javascripts/jscalendar/lang/calendar-pl-utf8.js +93 -0
  120. data/public/javascripts/jscalendar/lang/calendar-pl.js +56 -0
  121. data/public/javascripts/jscalendar/lang/calendar-pt.js +45 -0
  122. data/public/javascripts/jscalendar/lang/calendar-ro.js +66 -0
  123. data/public/javascripts/jscalendar/lang/calendar-ru.js +45 -0
  124. data/public/javascripts/jscalendar/lang/calendar-si.js +94 -0
  125. data/public/javascripts/jscalendar/lang/calendar-sk.js +99 -0
  126. data/public/javascripts/jscalendar/lang/calendar-sp.js +63 -0
  127. data/public/javascripts/jscalendar/lang/calendar-sv.js +93 -0
  128. data/public/javascripts/jscalendar/lang/calendar-tr.js +58 -0
  129. data/public/javascripts/jscalendar/lang/calendar-zh.js +45 -0
  130. data/public/javascripts/jscalendar/menuarrow.gif +0 -0
  131. data/public/javascripts/jscalendar/menuarrow2.gif +0 -0
  132. data/public/javascripts/jscalendar/release-notes.html +334 -0
  133. data/public/javascripts/jscalendar/simple-1.html +244 -0
  134. data/public/javascripts/jscalendar/simple-2.html +108 -0
  135. data/public/javascripts/jscalendar/simple-3.html +130 -0
  136. data/public/javascripts/jscalendar/test-position.html +40 -0
  137. data/public/javascripts/jscalendar/test.php +116 -0
  138. data/public/javascripts/toggle_div.js +18 -0
  139. data/public/stylesheets/niceones.txt +1 -0
  140. data/public/stylesheets/style.css +8 -1
  141. data/script/breakpointer +4 -5
  142. data/script/console +19 -27
  143. data/script/console_sandbox.rb +7 -0
  144. data/script/destroy +5 -0
  145. data/script/generate +3 -68
  146. data/script/server +6 -16
  147. data/test/damagecontrol/build_test.rb +8 -8
  148. data/test/damagecontrol/poller_test.rb +10 -18
  149. data/test/damagecontrol/project_test.rb +49 -13
  150. data/test/damagecontrol/publisher/base_test.rb +26 -0
  151. data/test/damagecontrol/publisher/build/email.rhtml +0 -0
  152. data/test/damagecontrol/publisher/email_test.rb +26 -0
  153. data/test/damagecontrol/publisher/fixture.rb +34 -0
  154. data/test/damagecontrol/publisher/growl_test.rb +15 -0
  155. data/test/damagecontrol/publisher/jabber_test.rb +15 -0
  156. data/test/damagecontrol/scm_web_test.rb +1 -1
  157. data/test/damagecontrol/visitor/changesets.rss +1 -1
  158. data/test/damagecontrol/visitor/diff_persister_test.rb +4 -4
  159. data/test/functional/build_controller_test.rb +17 -0
  160. data/test/test_helper.rb +13 -13
  161. metadata +185 -24
  162. data/app/views/project/_bugzilla.rhtml +0 -13
  163. data/app/views/project/_jira.rhtml +0 -19
  164. data/app/views/project/_mooky.rhtml +0 -23
  165. data/app/views/project/_rubyforge.rhtml +0 -19
  166. data/app/views/project/_scarab.rhtml +0 -19
  167. data/app/views/project/_scms.rhtml +0 -15
  168. data/app/views/project/_sourceforge.rhtml +0 -19
  169. data/app/views/project/_starteam.rhtml +0 -43
  170. data/app/views/project/_svn.rhtml +0 -22
  171. data/app/views/project/_trac.rhtml +0 -13
  172. data/app/views/project/_trackers.rhtml +0 -18
  173. data/app/views/project/changesets.rhtml +0 -31
@@ -0,0 +1,244 @@
1
+ <html style="background-color: buttonface; color: buttontext;">
2
+
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
5
+
6
+ <title>Simple calendar setups [popup calendar]</title>
7
+
8
+ <!-- calendar stylesheet -->
9
+ <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
10
+
11
+ <!-- main calendar program -->
12
+ <script type="text/javascript" src="calendar.js"></script>
13
+
14
+ <!-- language for the calendar -->
15
+ <script type="text/javascript" src="lang/calendar-en.js"></script>
16
+
17
+ <!-- the following script defines the Calendar.setup helper function, which makes
18
+ adding a calendar a matter of 1 or 2 lines of code. -->
19
+ <script type="text/javascript" src="calendar-setup.js"></script>
20
+
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <h2>DHTML Calendar &mdash; for the impatient</h2>
26
+
27
+ <blockquote>
28
+ <p>
29
+ This page lists some common setups for the popup calendar. In
30
+ order to see how to do any of them please see the source of this
31
+ page. For each example it's structured like this: there's the
32
+ &lt;form&gt; that contains the input field, and following there is
33
+ the JavaScript snippet that setups that form. An example of
34
+ <em>flat</em> calendar is available in <a
35
+ href="simple-2.html">another page</a>.
36
+ </p>
37
+ <p>
38
+ The code in this page uses a helper function defined in
39
+ "calendar-setup.js". With it you can setup the calendar in
40
+ minutes. If you're not <em>that</em> impatient, ;-) <a
41
+ href="doc/html/reference.html">complete documenation</a> is
42
+ available.
43
+ </p>
44
+ </blockquote>
45
+
46
+
47
+
48
+ <hr />
49
+
50
+ <p><b>Basic setup: one input per calendar.</b> Clicking in the input field
51
+ activates the calendar. The date format is "%m/%d/%Y %I:%M %p". The
52
+ calendar defaults to "single-click mode".</p>
53
+
54
+ <p>The example below has been updated to show you how to create "linked"
55
+ fields. Basically, when some field is filled with a date, the other
56
+ is updated so that the difference between them remains one week. The
57
+ property useful here is "onUpdate".</p>
58
+
59
+ <form action="#" method="get">
60
+ <input type="text" name="date" id="f_date_a" />
61
+ <input type="text" name="date" id="f_calcdate" />
62
+ </form>
63
+
64
+ <script type="text/javascript">
65
+ function catcalc(cal) {
66
+ var date = cal.date;
67
+ var time = date.getTime()
68
+ // use the _other_ field
69
+ var field = document.getElementById("f_calcdate");
70
+ if (field == cal.params.inputField) {
71
+ field = document.getElementById("f_date_a");
72
+ time -= Date.WEEK; // substract one week
73
+ } else {
74
+ time += Date.WEEK; // add one week
75
+ }
76
+ var date2 = new Date(time);
77
+ field.value = date2.print("%Y-%m-%d %H:%M");
78
+ }
79
+ Calendar.setup({
80
+ inputField : "f_date_a", // id of the input field
81
+ ifFormat : "%Y-%m-%d %H:%M", // format of the input field
82
+ showsTime : true,
83
+ timeFormat : "24",
84
+ onUpdate : catcalc
85
+ });
86
+ Calendar.setup({
87
+ inputField : "f_calcdate",
88
+ ifFormat : "%Y-%m-%d %H:%M",
89
+ showsTime : true,
90
+ timeFormat : "24",
91
+ onUpdate : catcalc
92
+ });
93
+ </script>
94
+
95
+
96
+
97
+ <hr />
98
+
99
+ <p><b>Input field with a trigger button.</b> Clicking the button activates
100
+ the calendar. Note that this one needs double-click (singleClick parameter
101
+ is explicitely set to false). Also demonstrates the "step" parameter
102
+ introduced in 0.9.6 (show all years in drop-down boxes, instead of every
103
+ other year as default).</p>
104
+
105
+ <form action="#" method="get">
106
+ <input type="text" name="date" id="f_date_b" /><button type="reset" id="f_trigger_b">...</button>
107
+ </form>
108
+
109
+ <script type="text/javascript">
110
+ Calendar.setup({
111
+ inputField : "f_date_b", // id of the input field
112
+ ifFormat : "%m/%d/%Y %I:%M %p", // format of the input field
113
+ showsTime : true, // will display a time selector
114
+ button : "f_trigger_b", // trigger for the calendar (button ID)
115
+ singleClick : false, // double-click mode
116
+ step : 1 // show all years in drop-down boxes (instead of every other year as default)
117
+ });
118
+ </script>
119
+
120
+
121
+
122
+ <hr />
123
+
124
+ <p><b>Input field with a trigger image.</b> Note that the Calendar.setup
125
+ function doesn't care if the trigger is a button, image, or anything else.
126
+ Also in this example we setup a different alignment, just to show how it's
127
+ done. The input field is read-only (that is set from HTML).</p>
128
+
129
+ <form action="#" method="get">
130
+ <table cellspacing="0" cellpadding="0" style="border-collapse: collapse"><tr>
131
+ <td><input type="text" name="date" id="f_date_c" readonly="1" /></td>
132
+ <td><img src="img.gif" id="f_trigger_c" style="cursor: pointer; border: 1px solid red;" title="Date selector"
133
+ onmouseover="this.style.background='red';" onmouseout="this.style.background=''" /></td>
134
+ </table>
135
+ </form>
136
+
137
+ <script type="text/javascript">
138
+ Calendar.setup({
139
+ inputField : "f_date_c", // id of the input field
140
+ ifFormat : "%B %e, %Y", // format of the input field
141
+ button : "f_trigger_c", // trigger for the calendar (button ID)
142
+ align : "Tl", // alignment (defaults to "Bl")
143
+ singleClick : true
144
+ });
145
+ </script>
146
+
147
+
148
+
149
+ <hr />
150
+
151
+ <p><b>Hidden field, display area.</b> The calendar now puts the date into 2
152
+ elements: one is an input field of type "hidden"&mdash;so that the user
153
+ can't directly see or modify it&mdash; and one is a &lt;span&gt; element in
154
+ which the date is displayed. Note that if the trigger is not specified the
155
+ calendar will use the displayArea (or inputField as in the first example).
156
+ The display area can have it's own format. This is useful if, for instance,
157
+ we need to store one format in the database (thus pass it in the input
158
+ field) but we wanna show a friendlier format to the end-user.</p>
159
+
160
+ <form action="#" method="get" style="visibility: hidden">
161
+ <input type="hidden" name="date" id="f_date_d" />
162
+ </form>
163
+
164
+ <p>Your birthday:
165
+ <span style="background-color: #ff8; cursor: default;"
166
+ onmouseover="this.style.backgroundColor='#ff0';"
167
+ onmouseout="this.style.backgroundColor='#ff8';"
168
+ id="show_d"
169
+ >Click to open date selector</span>.</p>
170
+
171
+ <script type="text/javascript">
172
+ Calendar.setup({
173
+ inputField : "f_date_d", // id of the input field
174
+ ifFormat : "%Y/%d/%m", // format of the input field (even if hidden, this format will be honored)
175
+ displayArea : "show_d", // ID of the span where the date is to be shown
176
+ daFormat : "%A, %B %d, %Y",// format of the displayed date
177
+ align : "Tl", // alignment (defaults to "Bl")
178
+ singleClick : true
179
+ });
180
+ </script>
181
+
182
+
183
+
184
+ <hr />
185
+
186
+ <p><b>Hidden field, display area, trigger image.</b> Very similar to the
187
+ previous example. The difference is that we also have a trigger image.</p>
188
+
189
+ <form action="#" method="get" style="visibility: hidden">
190
+ <input type="hidden" name="date" id="f_date_e" />
191
+ </form>
192
+
193
+ <p>Your birthday: <span id="show_e">-- not entered --</span> <img
194
+ src="img.gif" id="f_trigger_e" style="cursor: pointer; border: 1px solid
195
+ red;" title="Date selector" onmouseover="this.style.background='red';"
196
+ onmouseout="this.style.background=''" />.</p>
197
+
198
+ <script type="text/javascript">
199
+ Calendar.setup({
200
+ inputField : "f_date_e", // id of the input field
201
+ ifFormat : "%Y/%d/%m", // format of the input field (even if hidden, this format will be honored)
202
+ displayArea : "show_e", // ID of the span where the date is to be shown
203
+ daFormat : "%A, %B %d, %Y",// format of the displayed date
204
+ button : "f_trigger_e", // trigger button (well, IMG in our case)
205
+ align : "Tl", // alignment (defaults to "Bl")
206
+ singleClick : true
207
+ });
208
+ </script>
209
+
210
+
211
+
212
+ <hr />
213
+
214
+ <p><b>Hidden field, display area.</b> Very much like the previous examples,
215
+ but we now disable some dates (all weekends, that is, Saturdays and
216
+ Sundays).</p>
217
+
218
+ <form action="#" method="get" style="visibility: hidden">
219
+ <input type="hidden" name="date" id="f_date_f" />
220
+ </form>
221
+
222
+ <p>Your birthday:
223
+ <span style="background-color: #ff8; cursor: default;"
224
+ onmouseover="this.style.backgroundColor='#ff0';"
225
+ onmouseout="this.style.backgroundColor='#ff8';"
226
+ id="show_f"
227
+ >Click to open date selector</span>.</p>
228
+
229
+ <script type="text/javascript">
230
+ Calendar.setup({
231
+ inputField : "f_date_f", // id of the input field
232
+ ifFormat : "%Y/%d/%m", // format of the input field (even if hidden, this format will be honored)
233
+ displayArea : "show_f", // ID of the span where the date is to be shown
234
+ daFormat : "%A, %B %d, %Y",// format of the displayed date
235
+ align : "Tl", // alignment (defaults to "Bl")
236
+ dateStatusFunc : function (date) { // disable weekend days (Saturdays == 6 and Subdays == 0)
237
+ return (date.getDay() == 6 || date.getDay() == 0) ? true : false;
238
+ }
239
+ });
240
+ </script>
241
+
242
+
243
+ </body>
244
+ </html>
@@ -0,0 +1,108 @@
1
+ <html style="background-color: buttonface; color: buttontext;">
2
+
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
5
+
6
+ <title>Simple calendar setup [flat calendar]</title>
7
+
8
+ <!-- calendar stylesheet -->
9
+ <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
10
+
11
+ <!-- main calendar program -->
12
+ <script type="text/javascript" src="calendar.js"></script>
13
+
14
+ <!-- language for the calendar -->
15
+ <script type="text/javascript" src="lang/calendar-en.js"></script>
16
+
17
+ <!-- the following script defines the Calendar.setup helper function, which makes
18
+ adding a calendar a matter of 1 or 2 lines of code. -->
19
+ <script type="text/javascript" src="calendar-setup.js"></script>
20
+
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <h2>DHTML Calendar &mdash; for the impatient</h2>
26
+
27
+ <blockquote>
28
+ <p>
29
+ This page demonstrates how to setup a flat calendar. Examples of
30
+ <em>popup</em> calendars are available in <a
31
+ href="simple-1.html">another page</a>.
32
+ </p>
33
+ <p>
34
+ The code in this page uses a helper function defined in
35
+ "calendar-setup.js". With it you can setup the calendar in
36
+ minutes. If you're not <em>that</em> impatient, ;-) <a
37
+ href="doc/html/reference.html">complete documenation</a> is
38
+ available.
39
+ </p>
40
+ </blockquote>
41
+
42
+
43
+
44
+ <hr />
45
+
46
+ <div style="float: right; margin-left: 1em; margin-bottom: 1em;"
47
+ id="calendar-container"></div>
48
+
49
+ <script type="text/javascript">
50
+ function dateChanged(calendar) {
51
+ // Beware that this function is called even if the end-user only
52
+ // changed the month/year. In order to determine if a date was
53
+ // clicked you can use the dateClicked property of the calendar:
54
+ if (calendar.dateClicked) {
55
+ // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
56
+ var y = calendar.date.getFullYear();
57
+ var m = calendar.date.getMonth(); // integer, 0..11
58
+ var d = calendar.date.getDate(); // integer, 1..31
59
+ // redirect...
60
+ window.location = "/" + y + "/" + m + "/" + d + "/index.php";
61
+ }
62
+ };
63
+
64
+ Calendar.setup(
65
+ {
66
+ flat : "calendar-container", // ID of the parent element
67
+ flatCallback : dateChanged // our callback function
68
+ }
69
+ );
70
+ </script>
71
+
72
+ <p>The positioning of the DIV that contains the calendar is entirely your
73
+ job. For instance, the "calendar-container" DIV from this page has the
74
+ following style: "float: right; margin-left: 1em; margin-bottom: 1em".</p>
75
+
76
+ <p>Following there is the code that has been used to create this calendar.
77
+ You can find the full description of the <tt>Calendar.setup()</tt> function
78
+ in the <a href="doc/html/reference.html">calendar documenation</a>.</p>
79
+
80
+ <pre
81
+ >&lt;div style="float: right; margin-left: 1em; margin-bottom: 1em;"
82
+ id="calendar-container"&gt;&lt;/div&gt;
83
+
84
+ &lt;script type="text/javascript"&gt;
85
+ function dateChanged(calendar) {
86
+ // Beware that this function is called even if the end-user only
87
+ // changed the month/year. In order to determine if a date was
88
+ // clicked you can use the dateClicked property of the calendar:
89
+ if (calendar.dateClicked) {
90
+ // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
91
+ var y = calendar.date.getFullYear();
92
+ var m = calendar.date.getMonth(); // integer, 0..11
93
+ var d = calendar.date.getDate(); // integer, 1..31
94
+ // redirect...
95
+ window.location = "/" + y + "/" + m + "/" + d + "/index.php";
96
+ }
97
+ };
98
+
99
+ Calendar.setup(
100
+ {
101
+ flat : "calendar-container", // ID of the parent element
102
+ flatCallback : dateChanged // our callback function
103
+ }
104
+ );
105
+ &lt;/script&gt;</pre>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,130 @@
1
+ <html style="background-color: buttonface; color: buttontext;">
2
+
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
5
+
6
+ <title>Simple calendar setup [flat calendar]</title>
7
+
8
+ <!-- calendar stylesheet -->
9
+ <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
10
+
11
+ <!-- main calendar program -->
12
+ <script type="text/javascript" src="calendar.js"></script>
13
+
14
+ <!-- language for the calendar -->
15
+ <script type="text/javascript" src="lang/calendar-en.js"></script>
16
+
17
+ <!-- the following script defines the Calendar.setup helper function, which makes
18
+ adding a calendar a matter of 1 or 2 lines of code. -->
19
+ <script type="text/javascript" src="calendar-setup.js"></script>
20
+
21
+ <style type="text/css">
22
+ .special { background-color: #000; color: #fff; }
23
+ </style>
24
+
25
+ </head>
26
+
27
+ <body>
28
+
29
+ <h2>DHTML Calendar &mdash; for the impatient</h2>
30
+
31
+ <blockquote>
32
+ <p>
33
+ This page demonstrates how to setup a flat calendar. Examples of
34
+ <em>popup</em> calendars are available in <a
35
+ href="simple-1.html">another page</a>.
36
+ </p>
37
+ <p>
38
+ The code in this page uses a helper function defined in
39
+ "calendar-setup.js". With it you can setup the calendar in
40
+ minutes. If you're not <em>that</em> impatient, ;-) <a
41
+ href="doc/html/reference.html">complete documenation</a> is
42
+ available.
43
+ </p>
44
+ </blockquote>
45
+
46
+
47
+
48
+ <hr />
49
+
50
+ <div style="float: right; margin-left: 1em; margin-bottom: 1em;"
51
+ id="calendar-container"></div>
52
+
53
+ <script type="text/javascript">
54
+ var SPECIAL_DAYS = {
55
+ 0 : [ 13, 24 ], // special days in January
56
+ 2 : [ 1, 6, 8, 12, 18 ], // special days in March
57
+ 8 : [ 21, 11 ] // special days in September
58
+ };
59
+
60
+ function dateIsSpecial(year, month, day) {
61
+ var m = SPECIAL_DAYS[month];
62
+ if (!m) return false;
63
+ for (var i in m) if (m[i] == day) return true;
64
+ return false;
65
+ };
66
+
67
+ function dateChanged(calendar) {
68
+ // Beware that this function is called even if the end-user only
69
+ // changed the month/year. In order to determine if a date was
70
+ // clicked you can use the dateClicked property of the calendar:
71
+ if (calendar.dateClicked) {
72
+ // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
73
+ var y = calendar.date.getFullYear();
74
+ var m = calendar.date.getMonth(); // integer, 0..11
75
+ var d = calendar.date.getDate(); // integer, 1..31
76
+ // redirect...
77
+ window.location = "/" + y + "/" + m + "/" + d + "/index.php";
78
+ }
79
+ };
80
+
81
+ Calendar.setup(
82
+ {
83
+ flat : "calendar-container", // ID of the parent element
84
+ flatCallback : dateChanged, // our callback function
85
+ dateStatusFunc : function(date, y, m, d) {
86
+ if (dateIsSpecial(y, m, d)) return "special";
87
+ else return false; // other dates are enabled
88
+ // return true if you want to disable other dates
89
+ }
90
+ }
91
+ );
92
+ </script>
93
+
94
+ <p>The positioning of the DIV that contains the calendar is entirely your
95
+ job. For instance, the "calendar-container" DIV from this page has the
96
+ following style: "float: right; margin-left: 1em; margin-bottom: 1em".</p>
97
+
98
+ <p>Following there is the code that has been used to create this calendar.
99
+ You can find the full description of the <tt>Calendar.setup()</tt> function
100
+ in the <a href="doc/html/reference.html">calendar documenation</a>.</p>
101
+
102
+ <pre
103
+ >&lt;div style="float: right; margin-left: 1em; margin-bottom: 1em;"
104
+ id="calendar-container"&gt;&lt;/div&gt;
105
+
106
+ &lt;script type="text/javascript"&gt;
107
+ function dateChanged(calendar) {
108
+ // Beware that this function is called even if the end-user only
109
+ // changed the month/year. In order to determine if a date was
110
+ // clicked you can use the dateClicked property of the calendar:
111
+ if (calendar.dateClicked) {
112
+ // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
113
+ var y = calendar.date.getFullYear();
114
+ var m = calendar.date.getMonth(); // integer, 0..11
115
+ var d = calendar.date.getDate(); // integer, 1..31
116
+ // redirect...
117
+ window.location = "/" + y + "/" + m + "/" + d + "/index.php";
118
+ }
119
+ };
120
+
121
+ Calendar.setup(
122
+ {
123
+ flat : "calendar-container", // ID of the parent element
124
+ flatCallback : dateChanged // our callback function
125
+ }
126
+ );
127
+ &lt;/script&gt;</pre>
128
+
129
+ </body>
130
+ </html>