Editorial Calendar - Version 0.4

Version Description

  • We are now doing a better job arranging our tooltips and setting GMT dates correctly.
  • Fixed a problem with the post times so posts dragged with the calendar don't change their time of day.
  • Added a dialog for creating new drafts on specific dates of the calendar.
Download this release

Release Info

Developer MaryVogt
Plugin Icon wp plugin Editorial Calendar
Version 0.4
Comparing to
See all releases

Code changes from version 0.3 to 0.4

Files changed (7) hide show
  1. LICENSE.txt +236 -236
  2. edcal.css +263 -239
  3. edcal.js +1248 -1097
  4. edcal.php +446 -385
  5. lib/edcallib.min.js +89 -103
  6. lib/jquery.tooltip.js +25 -3
  7. readme.txt +75 -70
LICENSE.txt CHANGED
@@ -1,236 +1,236 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
202
-
203
-
204
- /*
205
- * One-JAR� (http://www.simontuffs.com/one-jar). Copyright (c) 2004-2007,
206
- * P. Simon Tuffs (simon@simontuffs.com). All rights reserved.
207
- *
208
- * Redistribution and use in source and binary forms, with or without
209
- * modification, are permitted provided that the following conditions are met:
210
- *
211
- * Redistributions of source code must retain the above copyright notice, this
212
- * list of conditions and the following disclaimer.
213
- *
214
- * Redistributions in binary form must reproduce the above copyright notice,
215
- * this list of conditions and the following disclaimer in the documentation
216
- * and/or other materials provided with the distribution.
217
- *
218
- * Neither the name of P. Simon Tuffs, nor the names of any contributors,
219
- * nor the name One-JAR may be used to endorse or promote products derived
220
- * from this software without specific prior written permission.
221
- *
222
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
223
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
226
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
227
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
228
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
229
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
230
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
231
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
232
- * POSSIBILITY OF SUCH DAMAGE.
233
- *
234
- * Including this file inside the built One-JAR file conforms with these terms.
235
- */
236
-
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+
204
+ /*
205
+ * One-JAR� (http://www.simontuffs.com/one-jar). Copyright (c) 2004-2007,
206
+ * P. Simon Tuffs (simon@simontuffs.com). All rights reserved.
207
+ *
208
+ * Redistribution and use in source and binary forms, with or without
209
+ * modification, are permitted provided that the following conditions are met:
210
+ *
211
+ * Redistributions of source code must retain the above copyright notice, this
212
+ * list of conditions and the following disclaimer.
213
+ *
214
+ * Redistributions in binary form must reproduce the above copyright notice,
215
+ * this list of conditions and the following disclaimer in the documentation
216
+ * and/or other materials provided with the distribution.
217
+ *
218
+ * Neither the name of P. Simon Tuffs, nor the names of any contributors,
219
+ * nor the name One-JAR may be used to endorse or promote products derived
220
+ * from this software without specific prior written permission.
221
+ *
222
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
223
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
226
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
227
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
228
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
229
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
230
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
231
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
232
+ * POSSIBILITY OF SUCH DAMAGE.
233
+ *
234
+ * Including this file inside the built One-JAR file conforms with these terms.
235
+ */
236
+
edcal.css CHANGED
@@ -1,239 +1,263 @@
1
- /*******************************************************************************
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- *
15
- ******************************************************************************/
16
-
17
- #edcal_scrollable {
18
- width: 98%;
19
- /* required settings */
20
- position:relative;
21
- overflow:hidden;
22
-
23
- /* This height will be reset with JavaScript */
24
- height: 100%;
25
- }
26
-
27
- #cal {
28
- position:absolute;
29
-
30
- /* this time we have very large space for the height */
31
- height:100%;
32
- margin-right: 10px;
33
- }
34
-
35
- .day {
36
- /*background-color: #F2F2F2;*/
37
- background-color: #e0e0e0;;
38
- }
39
-
40
- .scrollHover {
41
- background: lightblue;
42
- }
43
-
44
- .row {
45
- height: 100%;
46
- }
47
-
48
- .jan, .mar, .may, .jul, .sep, .nov {
49
- background-color: #F1F1F1;
50
- }
51
-
52
- .today {
53
- background-color: wheat;
54
- }
55
-
56
- .today .daylabel {
57
- font-weight: bold;
58
- }
59
-
60
- .dayobj {
61
- position: relative;
62
- width: 100%;
63
- height: 100%;
64
- }
65
-
66
- .daylabel {
67
- position: absolute;
68
- top: 0px;
69
- right: 5px;
70
- font-size: 1.25em;
71
- }
72
-
73
- .post {
74
- display: block;
75
- list-style-type: none;
76
- background: #FFFFE0;
77
- z-index: 10;
78
- cursor: move;
79
- -moz-border-radius:6px;
80
- -webkit-border-radius:6px;
81
- margin-left: 2px;
82
- margin-right: 2px;
83
- padding: 5px;
84
- }
85
-
86
- .post:hover {
87
- color: white;
88
- background: black;
89
- }
90
-
91
- .day-active {
92
- background-color: lightyellow;
93
- }
94
-
95
- .dayhead {
96
- font-weight: bold;
97
- text-align: center;
98
- color: gray;
99
- }
100
-
101
- #rowhead {
102
- height: 1.5em;
103
- top: 0px;
104
- width: 98%
105
- }
106
-
107
- #topbar {
108
- margin-bottom: 1em;
109
- width: 98%;
110
- margin-top: 1em;
111
- position: relative;
112
- height: 2em;
113
- }
114
-
115
- #topleft {
116
- position: absolute;
117
- left: 10px;
118
- top: -14px;
119
- width: auto;
120
- }
121
-
122
- #topright {
123
- position: absolute;
124
- right: 2em;
125
- top: 0px;
126
- width: auto;
127
- text-align: right;
128
- }
129
-
130
- #moveToToday {
131
- margin-left: 2em;
132
- text-decoration: none;
133
- }
134
-
135
- .future {
136
- background-color: #FFFFE0;
137
- }
138
-
139
- .draft, .pending {
140
- background-color: #cccccc;
141
-
142
- }
143
-
144
- .publish {
145
- background-color: #dde4fb;
146
- }
147
-
148
- #loadingcont {
149
- position: relative;
150
- }
151
-
152
- #loading {
153
- background-image: url('images/loading.gif');
154
- background-repeat: no-repeat;
155
- position: absolute;
156
- width: 43px;
157
- height: 11px;
158
- display: block;
159
- left: 20em;
160
- top: -1.5em;
161
- }
162
-
163
- .loadingclass, .loadingclass:hover {
164
- background-image: url('images/loading_post.gif');
165
- background-position: top right;
166
- background-repeat: no-repeat;
167
- cursor: auto;
168
- }
169
-
170
- .postlist {
171
- position: relative;
172
- top: 1.5em;
173
- height: 85%;
174
- overflow: auto;
175
- }
176
-
177
- .page-numbers {
178
- text-decoration: none;
179
- border: none;
180
- border-bottom-style: none;
181
- }
182
-
183
- #tooltip p {
184
- margin-left: 1.5em;
185
- }
186
-
187
- #tooltip h3 {
188
- max-width: 20em;
189
- margin-bottom: -10px;
190
- padding-right: 15px;
191
- }
192
-
193
- #tooltip {
194
- background: white;
195
- opacity: 1;
196
- padding: 1em;
197
- padding-bottom: 0em;
198
- border: thin solid lightgray;
199
- -moz-border-radius:11px;
200
- -webkit-border-radius:11px;
201
- -moz-box-shadow:0 4px 18px #C8C8C8;
202
- }
203
-
204
- .ui-draggable-dragging {
205
- width: 8em;
206
- }
207
-
208
- #tipclose {
209
- width: 24px;
210
- height: 23px;
211
- position: absolute;
212
- top: 0px;
213
- right: -10px;
214
- }
215
-
216
- .tooltip {
217
- position: relative;
218
- }
219
-
220
- #edcal-title-box {
221
- display: none;
222
- padding-right: 15px;
223
- }
224
-
225
- #edcal-title-edit {
226
- font-size: 11px;
227
- }
228
-
229
- .daynewlink {
230
- display: none;
231
- padding-left: 0.5em;
232
- padding-right: 0.5em;
233
- text-decoration: none;
234
- font-weight: bold;
235
- }
236
-
237
- #nextmonth, #prevmonth {
238
- padding: 0.5em;
239
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************************************
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ ******************************************************************************/
16
+
17
+ #edcal_scrollable {
18
+ width: 98%;
19
+ /* required settings */
20
+ position:relative;
21
+ overflow:hidden;
22
+
23
+ /* This height will be reset with JavaScript */
24
+ height: 100%;
25
+ }
26
+
27
+ #cal {
28
+ position:absolute;
29
+
30
+ /* this time we have very large space for the height */
31
+ height:100%;
32
+ margin-right: 10px;
33
+ }
34
+
35
+ .day {
36
+ /*background-color: #F2F2F2;*/
37
+ background-color: #e0e0e0;;
38
+ }
39
+
40
+ .scrollHover {
41
+ background: lightblue;
42
+ }
43
+
44
+ .row {
45
+ height: 100%;
46
+ }
47
+
48
+ .jan, .mar, .may, .jul, .sep, .nov {
49
+ background-color: #F1F1F1;
50
+ }
51
+
52
+ .today {
53
+ background-color: wheat;
54
+ }
55
+
56
+ .today .daylabel {
57
+ font-weight: bold;
58
+ }
59
+
60
+ .dayobj {
61
+ position: relative;
62
+ width: 100%;
63
+ height: 100%;
64
+ }
65
+
66
+ .daylabel {
67
+ position: absolute;
68
+ top: 0px;
69
+ right: 5px;
70
+ font-size: 1.25em;
71
+ }
72
+
73
+ .post {
74
+ display: block;
75
+ list-style-type: none;
76
+ background: #FFFFE0;
77
+ z-index: 10;
78
+ cursor: move;
79
+ -moz-border-radius:6px;
80
+ -webkit-border-radius:6px;
81
+ margin-left: 2px;
82
+ margin-right: 2px;
83
+ padding: 5px;
84
+ }
85
+
86
+ .post:hover {
87
+ color: white;
88
+ background: black;
89
+ }
90
+
91
+ .day-active {
92
+ background-color: lightyellow;
93
+ }
94
+
95
+ .dayhead {
96
+ font-weight: bold;
97
+ text-align: center;
98
+ color: gray;
99
+ }
100
+
101
+ #rowhead {
102
+ height: 1.5em;
103
+ top: 0px;
104
+ width: 98%
105
+ }
106
+
107
+ #topbar {
108
+ margin-bottom: 1em;
109
+ width: 98%;
110
+ margin-top: 1em;
111
+ position: relative;
112
+ height: 2em;
113
+ }
114
+
115
+ #topleft {
116
+ position: absolute;
117
+ left: 10px;
118
+ top: -14px;
119
+ width: auto;
120
+ }
121
+
122
+ #topright {
123
+ position: absolute;
124
+ right: 2em;
125
+ top: 0px;
126
+ width: auto;
127
+ text-align: right;
128
+ }
129
+
130
+ #moveToToday {
131
+ margin-left: 2em;
132
+ text-decoration: none;
133
+ }
134
+
135
+ .future {
136
+ background-color: #FFFFE0;
137
+ }
138
+
139
+ .draft, .pending {
140
+ background-color: #cccccc;
141
+
142
+ }
143
+
144
+ .publish {
145
+ background-color: #dde4fb;
146
+ }
147
+
148
+ #loadingcont {
149
+ position: relative;
150
+ }
151
+
152
+ #loading {
153
+ background-image: url('images/loading.gif');
154
+ background-repeat: no-repeat;
155
+ position: absolute;
156
+ width: 43px;
157
+ height: 11px;
158
+ display: block;
159
+ left: 20em;
160
+ top: -1.5em;
161
+ }
162
+
163
+ .loadingclass, .tiploading, .loadingclass:hover {
164
+ background-image: url('images/loading_post.gif');
165
+ background-position: top right;
166
+ background-repeat: no-repeat;
167
+ cursor: auto;
168
+ }
169
+
170
+ .postlist {
171
+ position: relative;
172
+ top: 1.5em;
173
+ height: 85%;
174
+ overflow: auto;
175
+ }
176
+
177
+ .page-numbers {
178
+ text-decoration: none;
179
+ border: none;
180
+ border-bottom-style: none;
181
+ }
182
+
183
+ #tooltip p {
184
+ margin-left: 1.5em;
185
+ }
186
+
187
+ #tooltip h3 {
188
+ max-width: 20em;
189
+ margin-bottom: -10px;
190
+ padding-right: 15px;
191
+ }
192
+
193
+ #tooltip {
194
+ background: white;
195
+ opacity: 1;
196
+ padding: 1em;
197
+ padding-bottom: 0em;
198
+ border: thin solid lightgray;
199
+ -moz-border-radius:11px;
200
+ -webkit-border-radius:11px;
201
+ -moz-box-shadow:0 4px 18px #C8C8C8;
202
+ }
203
+
204
+ .newposttip {
205
+ padding: 1em;
206
+ padding-bottom: 2em;
207
+ }
208
+
209
+ #edcal-title {
210
+ padding-top: 0.5em;
211
+ padding-bottom: 0.5em;
212
+ }
213
+
214
+ #edcal-title-edit-field {
215
+ padding: 0.25em;
216
+ }
217
+
218
+ #edcal-title-new-field {
219
+ padding: 0.25em;
220
+ width: 20em;
221
+ }
222
+
223
+ #edcal-title-new-section {
224
+ padding-top: 1.5em;
225
+ padding-bottom: 0.5em;
226
+ }
227
+
228
+ .ui-draggable-dragging {
229
+ width: 8em;
230
+ }
231
+
232
+ #tipclose {
233
+ width: 24px;
234
+ height: 23px;
235
+ position: absolute;
236
+ top: 0px;
237
+ right: -10px;
238
+ }
239
+
240
+ .tooltip {
241
+ position: relative;
242
+ }
243
+
244
+ #edcal-title-box {
245
+ display: none;
246
+ padding-right: 15px;
247
+ }
248
+
249
+ #edcal-title-edit {
250
+ font-size: 11px;
251
+ }
252
+
253
+ .daynewlink {
254
+ display: none;
255
+ padding-left: 0.5em;
256
+ padding-right: 0.5em;
257
+ text-decoration: none;
258
+ font-weight: bold;
259
+ }
260
+
261
+ #nextmonth, #prevmonth {
262
+ padding: 0.5em;
263
+ }
edcal.js CHANGED
@@ -1,1097 +1,1248 @@
1
- /*******************************************************************************
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- *
15
- ******************************************************************************/
16
-
17
- /**
18
- * This is a helper function to output messages on the HTML page. It
19
- * write them out to a text area.
20
- *
21
- * @param msg the message to write
22
- */
23
- function output(msg) {
24
- //console.info(msg);
25
- }
26
-
27
- /*
28
- This is the WordPress editorial calendar. It is a continuous
29
- calendar in both directions. That means instead of showing only
30
- one month at a time it shows the months running together. Users
31
- can scroll from one month to the next using the up and down
32
- arrow keys, the page up and page down keys, the next and previous
33
- month buttons, and their mouse wheel.
34
-
35
- The calendar shows five weeks visible at a time and maintains 11
36
- weeks of rendered HTML. Only the middle weeks are visible.
37
-
38
- Week 1
39
- Week 2
40
- Week 3
41
- - Week 4 -
42
- | Week 5 |
43
- | Week 6 |
44
- | Week 7 |
45
- - Week 8 -
46
- Week 9
47
- Week 10
48
- Week 11
49
-
50
- When the user scrolls down one week the new week is added at the
51
- end of the calendar and the first week is removed. In this way
52
- the calendar will only ever have 11 weeks total and won't use up
53
- excessive memory.
54
-
55
- This calendar uses AJAX to call into the functions defined in
56
- edcal.php. These functions get posts and change post dates.
57
-
58
- The HTML structure of the calendar is:
59
-
60
- <div id="cal">
61
- <div id="row08Nov2009">
62
- <div id="row08Nov2009row">
63
- <div class="day sunday nov" id="08Nov2009">
64
- <div class="dayobj">
65
- <div class="daylabel">8</div>
66
- <ul class="postlist">
67
- </ul>
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
- </div>
73
- */
74
- var edcal = {
75
- /*
76
- * True if the calendar is in the process of moving
77
- */
78
- isMoving: false,
79
-
80
- /*
81
- This is the base URL we use to make AJAX calls back
82
- to the server. This value is set in code generated
83
- from edcal.php that run in a script tag in the main
84
- page.
85
- */
86
- ajax_url: '',
87
-
88
- /*
89
- * The cache of dates we have already loaded posts for.
90
- */
91
- cacheDates : [],
92
-
93
- /*
94
- * The ID of the timer we use to batch new post requests
95
- */
96
- tID: null,
97
-
98
- /*
99
- * The number of steps moving for this timer.
100
- */
101
- steps: 0,
102
-
103
- /*
104
- * The constant for the concurrency error.
105
- */
106
- CONCURRENCY_ERROR: 4,
107
-
108
- /*
109
- * The constant for the user permission error
110
- */
111
- PERMISSION_ERROR: 5,
112
-
113
- /*
114
- The direction the calendar last moved.
115
- true = down = to the future
116
- false = up = to the past
117
-
118
- */
119
- currentDirection: true,
120
-
121
- /*
122
- This date is our index. When the calendar moves we
123
- update this date to indicate the next rows we need
124
- to add.
125
- */
126
- _wDate: Date.today(),
127
-
128
- /*
129
- * The date since the previous move
130
- */
131
- moveDate: null,
132
-
133
- /*
134
- A cache of all the posts we have loaded so far. The
135
- data structure is:
136
-
137
- posts [date - ddMMMyyyy][posts array - post object from JSON data]
138
- */
139
- posts: new Array(50),
140
-
141
- /*
142
- IE will sometimes fire the resize event twice for the same resize
143
- action. We save it so we only resize the calendar once and avoid
144
- any flickering.
145
- */
146
- windowHeight: 0,
147
-
148
- /*
149
- This function aligns the grid in two directions. There
150
- is a vertical grid with a row of each week and a horizontal
151
- grid for each week with a list of days.
152
- */
153
- alignGrid: function(/*string*/ gridid, /*int*/ cols, /*int*/ cellWidth, /*int*/ cellHeight, /*int*/ padding) {
154
- var x = 0;
155
- var y = 0;
156
- var count = 1;
157
-
158
- jQuery(gridid).each(function(){
159
- jQuery(this).css("position", "relative");
160
-
161
- jQuery(this).children("div").each(function(){
162
- jQuery(this).css({
163
- width: cellWidth + "%",
164
- height: cellHeight + "%",
165
- position: "absolute",
166
- left: x + "%",
167
- top: y + "%"
168
- });
169
-
170
- if ((count % cols) === 0) {
171
- x = 0;
172
- y += cellHeight + padding;
173
- } else {
174
- x += cellWidth + padding;
175
- }
176
-
177
- count++;
178
- });
179
- });
180
- },
181
-
182
- /*
183
- This is a helper function to align the calendar so we don't
184
- have to change the cell sizes in multiple places.
185
- */
186
- alignCal: function() {
187
- edcal.alignGrid("#cal", 1, 100, 20, 0.25);
188
- },
189
-
190
-
191
- /*
192
- This function creates the days header at the top of the
193
- calendar.
194
-
195
- TODO: We should localize these values
196
- */
197
- createDaysHeader: function() {
198
- var html = '<div class="dayhead">Sunday</div>';
199
- html += '<div class="dayhead">Monday</div>';
200
- html += '<div class="dayhead">Tuesday</div>';
201
- html += '<div class="dayhead">Wednesday</div>';
202
- html += '<div class="dayhead">Thursday</div>';
203
- html += '<div class="dayhead">Friday</div>';
204
- html += '<div class="dayhead">Saturday</div>';
205
-
206
- jQuery("#rowhead").append(html);
207
-
208
- edcal.alignGrid("#rowhead", 7, 14.2, 100, 0.25);
209
- },
210
-
211
- /*
212
- Creates a row of the calendar and adds all of the CSS classes
213
- and listeners for each calendar day.
214
- */
215
- createRow: function(/*jQuery*/ parent, /*bool*/ append) {
216
- var _date = edcal._wDate.clone();
217
-
218
- var newrow = '<div class="rowcont" id="' + 'row' + edcal._wDate.toString("ddMMMyyyy") + '">' +
219
- '<div id="' + 'row' + edcal._wDate.toString("ddMMMyyyy") + 'row" class="row">';
220
- for (var i = 0; i < 7; i++) {
221
- newrow += '<div id="' + _date.toString("ddMMMyyyy") + '" class="day ' +
222
- _date.toString("dddd").toLowerCase() + ' ' +
223
- _date.toString("MMM").toLowerCase() + '">';
224
-
225
- newrow += '<div class="dayobj">';
226
-
227
- newrow += '<div class="daylabel">';
228
- newrow += '<a href="#" class="daynewlink" title="Add new post on ' + _date.toString("MMMM d") + '" ' +
229
- 'onclick="return false;">+</a>';
230
- if (_date.toString("dd") == "01") {
231
- newrow += _date.toString("MMM d");
232
- } else {
233
- newrow += _date.toString("d");
234
- }
235
- newrow += '</div>';
236
-
237
- newrow += '<ul class="postlist">';
238
-
239
- newrow += edcal.getPostItems(_date.toString("ddMMMyyyy"));
240
-
241
- newrow += '</ul>';
242
-
243
- newrow += '</div>';
244
- newrow += '</div>';
245
- _date.add(1).days();
246
- }
247
-
248
- newrow += '</div></div';
249
-
250
- if (append) {
251
- parent.append(newrow);
252
-
253
- } else {
254
- parent.prepend(newrow);
255
- }
256
-
257
- edcal.alignGrid("#row" + edcal._wDate.toString("ddMMMyyyy") + "row", 7, 14.2, 100, 0.25);
258
-
259
- jQuery('#row' + edcal._wDate.toString("ddMMMyyyy") + ' .day').each( function() {
260
- edcal.addTooltip(jQuery(this).attr("id"));
261
- });
262
-
263
- edcal.draggablePost('#row' + edcal._wDate.toString("ddMMMyyyy") + ' .post');
264
-
265
- jQuery('#row' + edcal._wDate.toString("ddMMMyyyy") + ' .day').droppable({
266
- hoverClass: 'day-active',
267
- accept: '.post',
268
- greedy: true,
269
- tolerance: 'pointer',
270
- drop: function(event, ui) {
271
- //output('dropped ui.draggable.attr("id"): ' + ui.draggable.attr("id"));
272
- //output('dropped on jQuery(this).attr("id"): ' + jQuery(this).attr("id"));
273
- //output('ui.draggable.html(): ' + ui.draggable.html());
274
-
275
- var dayId = ui.draggable.parent().parent().parent().attr("id");
276
-
277
- // Step 0. Get the post object from the map
278
- var post = edcal.findPostForId(ui.draggable.parent().parent().parent().attr("id"),
279
- ui.draggable.attr("id"));
280
-
281
- // Step 1. Remove the post from the posts map
282
- edcal.removePostFromMap(ui.draggable.parent().parent().parent().attr("id"),
283
- ui.draggable.attr("id"));
284
-
285
- // Step 2. Remove the old element from the old parent.
286
- jQuery('#' + ui.draggable.attr("id")).remove();
287
-
288
- // Step 3. Add the item to the new DOM parent
289
- jQuery('#' + jQuery(this).attr("id") + ' .postlist').append(edcal.createPostItem(post,
290
- jQuery(this).attr("id")));
291
-
292
- // Step 4. And add the tooltip
293
- edcal.addTooltip(jQuery(this).attr("id"));
294
-
295
- if (dayId == jQuery(this).attr("id")) {
296
- /*
297
- If they dropped back on to the day they started with we
298
- don't want to go back to the server.
299
- */
300
- edcal.draggablePost('#' + jQuery(this).attr("id") + ' .post');
301
- } else {
302
- // Step6. Update the date on the server
303
- edcal.changeDate(jQuery(this).attr("id"), post);
304
- }
305
- }
306
- });
307
-
308
- return jQuery('row' + edcal._wDate.toString("ddMMMyyyy"));
309
- },
310
-
311
- /*
312
- * This is a helper method to make an individual post item draggable.
313
- */
314
- draggablePost: function(/*post selector*/ post) {
315
- /*
316
- * Click is a different operation than drag in our UI. The problem is if
317
- * the user is moving their mouse just a little bit we can think it is a
318
- * drag instead of a click. We stop this by delaying the drag event until
319
- * the user has dragged at least 10 pixels. This works fine on IE and
320
- * Firefox, but on Chrome it causes text selection so we don't delay on
321
- * Chrome.
322
- */
323
- var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
324
- var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
325
-
326
- if (is_chrome || is_safari) {
327
- jQuery(post).draggable({
328
- revert: 'invalid',
329
- appendTo: 'body',
330
- helper: "clone",
331
- addClasses: false
332
- });
333
- } else {
334
- jQuery(post).draggable({
335
- revert: 'invalid',
336
- appendTo: 'body',
337
- distance: 10,
338
- helper: "clone",
339
- addClasses: false
340
- });
341
- }
342
- },
343
-
344
- /*
345
- This is a utility method to find a post and remove it
346
- from the cache map.
347
- */
348
- removePostFromMap: function(/*string*/ dayobjId, /*string*/ postId) {
349
- if (edcal.posts[dayobjId]) {
350
- for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
351
- if (edcal.posts[dayobjId][i] &&
352
- "post-" + edcal.posts[dayobjId][i].id === postId) {
353
- edcal.posts[dayobjId][i] = null;
354
- return true;
355
- }
356
- }
357
- }
358
-
359
- return false;
360
- },
361
-
362
- /*
363
- * Adds a post to al already existing calendar day.
364
- */
365
- addPostItem: function(/*post*/ post, /*string*/ dayobjId) {
366
- jQuery('#' + dayobjId + ' .postlist').append(edcal.createPostItem(post, dayobjId));
367
- },
368
-
369
- /*
370
- Makes all the posts in the specified day draggable
371
- and adds the tooltip.
372
- */
373
- addPostItemDragAndToolltip: function(/*string*/ dayobjId) {
374
- edcal.draggablePost('#' + dayobjId + ' .post');
375
- edcal.addTooltip(dayobjId);
376
- },
377
-
378
- /*
379
- * Confirms if you want to delete the specified post
380
- */
381
- confirmDelete: function(/*string*/ posttitle) {
382
- if (confirm('You are about to delete this post ' + posttitle + '.\n\n Press cancel to stop, OK to delete.')) {
383
- return true;
384
- } else {
385
- return false;
386
- }
387
- },
388
-
389
- /*
390
- This is an AJAX function to save the past title when
391
- the user presses the save button on the tooltip.
392
- */
393
- saveTitle: function(/*string*/ postId) {
394
-
395
- var url = edcal.ajax_url + "?action=edcal_changetitle&postid=" + postId +
396
- "&title=" + jQuery.URLEncode(jQuery("#edcal-title-edit-field").val());
397
-
398
- jQuery("#post-" + postId).addClass("loadingclass");
399
-
400
- jQuery("#tooltip").hide();
401
-
402
- jQuery.ajax( {
403
- url: url,
404
- type: "POST",
405
- processData: false,
406
- timeout: 100000,
407
- dataType: "json",
408
- success: function(res) {
409
- edcal.removePostItem(res.post.date, "post-" + res.post.id);
410
- edcal.addPostItem(res.post, res.post.date);
411
- edcal.addPostItemDragAndToolltip(res.post.date);
412
- },
413
- error: function(xhr) {
414
- edcal.showError("There was an error contacting your blog.");
415
- if (xhr.responseText) {
416
- output("xhr.responseText: " + xhr.responseText);
417
- }
418
- }
419
- });
420
- },
421
-
422
- /*
423
- * Cancels the edit title action in the tooltip.
424
- */
425
- cancelEditTitle: function(/*string*/ postTitle) {
426
- jQuery("#edcal-title-edit-field").val(postTitle);
427
-
428
- jQuery("#edcal-title-box").hide();
429
- jQuery("#edcal-title").show();
430
-
431
- },
432
-
433
- /*
434
- * Shows the edit title UI in the tooltip.
435
- */
436
- editTitle: function() {
437
- jQuery("#edcal-title").hide();
438
- jQuery("#edcal-title-box").show();
439
-
440
- jQuery("#edcal-title-edit-field").focus();
441
- jQuery("#edcal-title-edit-field").select();
442
- },
443
-
444
- /*
445
- Switches back to the normal tooltip title view
446
- and closes the tooltip.
447
- */
448
- closeTooltip: function() {
449
- edcal.cancelEditTitle();
450
- jQuery("#tooltip").hide();
451
- },
452
-
453
- /*
454
- * Adds a tooltip to every post in the specified day.
455
- */
456
- addTooltip: function(/*string*/ dayobjId) {
457
- jQuery('#' + dayobjId + ' .post').tooltip({
458
- delay: 1500,
459
- bodyHandler: function() {
460
- var post = edcal.findPostForId(dayobjId, jQuery(this).attr("id"));
461
-
462
- var posttitle = post.title;
463
-
464
- if (posttitle === "") {
465
- posttitle = "[No Title]";
466
- }
467
-
468
- var tooltip = '<div class="tooltip">' +
469
- '<a href="#" id="tipclose" onclick="edcal.closeTooltip(); return false;" title="close"> </a>' +
470
- '<h3 id="edcal-title">' + posttitle +
471
- ' <a href="#" onclick="edcal.editTitle(); return false;" class="edit-post-status" id="edcal-title-edit">Edit</a>' +
472
- '</h3>' +
473
- '<div id="edcal-title-box">' +
474
- '<input type="text" value="' + post.title + '" id="edcal-title-edit-field"/> &nbsp;&nbsp;' +
475
- '<span id="edit-slug-buttons">' +
476
- '<a class="save button" href="#" onclick="edcal.saveTitle(\'' + post.id + '\'); return false;">Save</a> ' +
477
- '<a href="#" onclick="edcal.cancelEditTitle(\'' + post.title + '\'); return false;" class="cancel">Cancel</a></span>' +
478
- '</div>' +
479
- '<p>' +
480
- '<i>by</i> ' + post.author + ' <i>on</i> ' +
481
- edcal.getDayFromDayId(post.date).toString("MMMM d, yyyy") + ' at ' +
482
- post.time +
483
- '</p>' +
484
- '<p>' +
485
- 'Status<b>: ' + post.status + '</b>' +
486
- '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
487
- if (post.editlink) {
488
- /*
489
- * If the user doesn't have permission to edit a post then
490
- * then server won't send the edit link URL and we shouldn't
491
- * show the edit link
492
- */
493
- tooltip += '<a href="' + post.editlink + '" title="Edit ' + post.title +
494
- '">Edit</a>&nbsp; | &nbsp;';
495
- }
496
-
497
- if (post.dellink) {
498
- tooltip += '<a class="submitdelete" href="' + post.dellink + '" ' +
499
- 'onclick="return edcal.confirmDelete(\'' + post.title + '\');"' +
500
- 'title="Delete ' + post.title + '">Delete</a> &nbsp; | &nbsp;';
501
- }
502
-
503
- tooltip += '<a href="' + post.permalink + '" title="View ' + post.title + '">View</a>' +
504
- '</p>' +
505
- '</div>';
506
-
507
- return tooltip;
508
- }
509
- });
510
- },
511
-
512
- /*
513
- Creates the HTML for a post item and adds the data for
514
- the post to the posts cache.
515
- */
516
- createPostItem: function(/*post*/ post, /*string*/ dayobjId) {
517
- var postHtml = edcal.getPostItemString(post);
518
- if (!edcal.posts[dayobjId]) {
519
- edcal.posts[dayobjId] = new Array(0);
520
- }
521
-
522
- edcal.posts[dayobjId][edcal.posts[dayobjId].length] = post;
523
-
524
- return postHtml;
525
- },
526
-
527
- /*
528
- Finds the post object for the specified post ID in the
529
- specified day.
530
- */
531
- findPostForId: function(/*string*/ dayobjId, /*string*/ postId) {
532
- if (edcal.posts[dayobjId]) {
533
- for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
534
- if (edcal.posts[dayobjId][i] &&
535
- "post-" + edcal.posts[dayobjId][i].id === postId) {
536
- return edcal.posts[dayobjId][i];
537
- }
538
- }
539
- }
540
- },
541
-
542
- /*
543
- * Removes a post from the HTML and the posts cache.
544
- */
545
- removePostItem: function(/*string*/ dayobjId, /*string*/ postId) {
546
- if (edcal.findPostForId(dayobjId, postId)) {
547
- for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
548
- if (edcal.posts[dayobjId][i] &&
549
- "post-" + edcal.posts[dayobjId][i].id === postId) {
550
- edcal.posts[dayobjId][i] = null;
551
- jQuery("#" + postId).remove();
552
- }
553
- }
554
-
555
- }
556
- },
557
-
558
- /*
559
- Gets all the post items for the specified day from
560
- the post cache.
561
- */
562
- getPostItems: function(/*string*/ dayobjId) {
563
- var postsString = "";
564
-
565
- if (edcal.posts[dayobjId]) {
566
- for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
567
- if (edcal.posts[dayobjId][i]) {
568
- postsString += edcal.getPostItemString(edcal.posts[dayobjId][i]);
569
- }
570
- }
571
- }
572
-
573
- return postsString;
574
- },
575
-
576
- /*
577
- * Gets the HTML string for a post.
578
- */
579
- getPostItemString: function(/*post*/ post) {
580
- var posttitle = post.title;
581
-
582
- if (posttitle === "") {
583
- posttitle = "[No Title]";
584
- }
585
- return '<li id="post-' + post.id + '" class="post ' + post.status + '">' + posttitle + '</li>';
586
- },
587
-
588
- /*
589
- Finds the calendar cell for the current day and adds the
590
- class "today" to that cell.
591
- */
592
- setClassforToday: function() {
593
- /*
594
- We want to set a class for the cell that represents the current day so we ca
595
- give it a background color.
596
- */
597
- jQuery('#' + Date.today().toString("ddMMMyyyy")).addClass("today");
598
- },
599
-
600
- /*
601
- Most browsers need us to set a calendar height in pixels instead
602
- of percent. This function get the correct pixel height for the
603
- calendar based on the window height.
604
- */
605
- getCalHeight: function() {
606
- var myHeight = 0;
607
- if ( typeof( window.innerWidth ) == 'number' ) {
608
- //Non-IE
609
- myHeight = window.innerHeight;
610
- } else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
611
- //IE 6+ in 'standards compliant mode'
612
- myHeight = document.documentElement.clientHeight;
613
- } else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
614
- //IE 4 compatible
615
- myHeight = document.body.clientHeight;
616
- }
617
- return myHeight - 150;
618
- },
619
-
620
- /*
621
- Moves the calendar a certain number of steps in the specified direction.
622
- True moves the calendar down into the future and false moves the calendar
623
- up into the past.
624
- */
625
- move: function(steps, direction) {
626
- /*
627
- The working date is a marker for the last calendar row we created.
628
- If we are moving forward that will be the last row, if we are moving
629
- backward it will be the first row. If we switch direction we need
630
- to bump up our date by 11 rows times 7 days a week or 77 days.
631
- */
632
- if (edcal.currentDirection != direction) {
633
- if (direction) { // into the future
634
- edcal._wDate = edcal._wDate.add(77).days();
635
- } else { // into the past
636
- edcal._wDate = edcal._wDate.add(-77).days();
637
- }
638
-
639
- edcal.steps = 0;
640
- edcal.moveDate = edcal._wDate;
641
- }
642
-
643
- edcal.currentDirection = direction;
644
-
645
- var i;
646
-
647
-
648
- if (direction) {
649
- for (i = 0; i < steps; i++) {
650
- jQuery("#cal > div:first").remove();
651
- edcal.createRow(jQuery("#cal"), true);
652
- edcal._wDate.add(7).days();
653
- }
654
- edcal.alignCal();
655
- } else {
656
- for (i = 0; i < steps; i++) {
657
- jQuery("#cal > div:last").remove();
658
- edcal.createRow(jQuery("#cal"), false);
659
- edcal._wDate.add(-7).days();
660
- }
661
- edcal.alignCal();
662
- }
663
-
664
- edcal.setClassforToday();
665
- edcal.setDateLabel();
666
-
667
- /*
668
- * If the user clicks quickly or uses the mouse wheel they can
669
- * get a lot of move events very quickly and we need to batch
670
- * them up together. We set a timeout and clear it if there is
671
- * another move before the timeout happens.
672
- */
673
- edcal.steps += steps;
674
- if (edcal.tID) {
675
- clearTimeout(edcal.tID);
676
- } else {
677
- edcal.moveDate = edcal._wDate;
678
- }
679
-
680
- edcal.tID = setTimeout(function() {
681
- /*
682
- * Now that we are done moving the calendar we need to get the posts for the
683
- * new dates. We want to load the posts between the place the calendar was
684
- * at when the user started moving it and the place the calendar is at now.
685
- */
686
- if (!direction) {
687
- edcal.getPosts(edcal._wDate.clone(),
688
- edcal._wDate.clone().add(7 * (edcal.steps + 1)).days());
689
- } else {
690
- edcal.getPosts(edcal._wDate.clone().add(-7 * (edcal.steps + 1)).days(),
691
- edcal._wDate.clone());
692
- }
693
-
694
- edcal.steps = 0;
695
- edcal.tID = null;
696
- edcal.moveDate = edcal._wDate;
697
- }, 1000);
698
- },
699
-
700
- /*
701
- We use the date as the ID for day elements, but the Date
702
- library can't parse the date without spaces and using
703
- spaces in IDs can cause problems. We work around the
704
- issue by adding the spaces back before we parse.
705
- */
706
- getDayFromDayId: function(/*dayId*/ day) {
707
- return Date.parse(day.substring(0, 2) + ' ' + day.substring(2, 5) + ' ' + day.substring(5));
708
- },
709
-
710
- /*
711
- This is a helper method to set the date label on the top of
712
- the calendar. It looks like November 2009-December2009
713
- */
714
- setDateLabel: function(year) {
715
- var api = jQuery(".edcal_scrollable").scrollable();
716
- var items = api.getVisibleItems();
717
-
718
- /*
719
- We need to get the first day in the first week and the
720
- last day in the last week. We call children twice to
721
- work around a small JQuery issue.
722
- */
723
- var firstDate = edcal.getDayFromDayId(items.eq(0).children(".row").children(".day:first").attr("id"));
724
- var lastDate = edcal.getDayFromDayId(items.eq(items.length - 1).children(".row").children(".day:last").attr("id"));
725
-
726
- jQuery("#currentRange").text(firstDate.toString("MMMM yyyy") + " - " + lastDate.toString("MMMM yyyy"));
727
- },
728
-
729
- /*
730
- * Moves the calendar to the specified date.
731
- */
732
- moveTo : function(/*Date*/ date) {
733
- edcal.isMoving = true;
734
- jQuery("#cal").empty();
735
-
736
- /*
737
- When we first start up our working date is 4 weeks before
738
- the next Sunday.
739
- */
740
- edcal._wDate = date.next().sunday().add(-28).days();
741
-
742
- /*
743
- After we remove and readd all the rows we are back to
744
- moving in a going down direction.
745
- */
746
- edcal.currentDirection = true;
747
-
748
- for (var i = 0; i < 10; i++) {
749
- edcal.createRow(jQuery("#cal"), true);
750
- edcal._wDate.add(7).days();
751
- }
752
-
753
- edcal.alignCal();
754
-
755
- var api = jQuery(".edcal_scrollable").scrollable();
756
- api.move(2);
757
-
758
- edcal.setDateLabel();
759
- edcal.setClassforToday();
760
- edcal.isMoving = false;
761
-
762
- },
763
-
764
- /*
765
- * Initializes the calendar
766
- */
767
- init : function() {
768
- if (jQuery("#edcal_scrollable").length === 0) {
769
- /*
770
- * This means we are on a page without the editorial
771
- * calendar
772
- */
773
- return;
774
- }
775
-
776
- jQuery("#loading").hide();
777
-
778
- jQuery("#edcal_scrollable").css("height", edcal.getCalHeight() + "px");
779
- edcal.windowHeight = jQuery(window).height();
780
-
781
- /*
782
- * Add the days of the week
783
- */
784
- edcal.createDaysHeader();
785
-
786
- // initialize scrollable
787
- jQuery(".edcal_scrollable").scrollable({
788
- vertical:true,
789
- size: 5,
790
- keyboardSteps: 1,
791
- speed: 100
792
- // use mousewheel plugin
793
- }).mousewheel();
794
-
795
- var api = jQuery(".edcal_scrollable").scrollable();
796
-
797
- edcal.moveTo(Date.today());
798
-
799
- /*
800
- * The scrollable handles some basic binding. This gets us
801
- * up arrow, down arrow and the mouse wheel.
802
- */
803
- api.onBeforeSeek(function(evt, direction) {
804
- // inside callbacks the "this" variable is a reference to the API
805
- if (!edcal.isMoving) {
806
- edcal.move(1, direction);
807
- }
808
-
809
- return false;
810
- });
811
-
812
- /*
813
- * We also want to listen for a few other key events
814
- */
815
- jQuery(document).bind("keydown", function(evt) {
816
- //if (evt.altKey || evt.ctrlKey) { return; }
817
- //output("evt.altKey: " + evt.altKey);
818
- //output("evt.keyCode: " + evt.keyCode);
819
- //output("evt.ctrlKey: " + evt.ctrlKey);
820
-
821
- if ((evt.keyCode === 34 && !(evt.altKey || evt.ctrlKey)) || //page down
822
- evt.keyCode === 40 && evt.ctrlKey){ // Ctrl+down down arrow
823
- edcal.move(4, true);
824
- return false;
825
- } else if ((evt.keyCode === 33 && !(evt.altKey || evt.ctrlKey)) || //page up
826
- evt.keyCode === 38 && evt.ctrlKey){ // Ctrl+up up arrow
827
- edcal.move(4, false);
828
- return false;
829
- } else if (evt.keyCode === 27) { //escape key
830
- edcal.closeTooltip();
831
- return false;
832
- }
833
- });
834
-
835
- edcal.getPosts(Date.today().next().sunday().add(-28).days(),
836
- Date.today().next().sunday().add(35).days());
837
-
838
- /*
839
- Now we bind the listeners for all of our links and the window
840
- resize.
841
- */
842
- jQuery("#moveToToday").click(function() {
843
- edcal.moveTo(Date.today());
844
- return false;
845
- });
846
-
847
- jQuery("#prevmonth").click(function() {
848
- edcal.move(4, false);
849
- return false;
850
- });
851
-
852
- jQuery("#nextmonth").click(function() {
853
- edcal.move(4, true);
854
- return false;
855
- });
856
-
857
- function resizeWindow(e) {
858
- if (edcal.windowHeight != jQuery(window).height()) {
859
- jQuery("#edcal_scrollable").css("height", edcal.getCalHeight() + "px");
860
- edcal.windowHeight = jQuery(window).height();
861
- }
862
- }
863
- jQuery(window).bind("resize", resizeWindow);
864
-
865
- jQuery(".day").live("mouseover", function(evt) {
866
- jQuery("#" + jQuery(this).attr("id") + " .daynewlink").show();
867
- });
868
-
869
- jQuery(".day").live("mouseout", function(evt) {
870
- jQuery("#" + jQuery(this).attr("id") + " .daynewlink").hide();
871
- });
872
-
873
- jQuery(".daynewlink").live("click", function(evt) {
874
- edcal.createEmptyDraft(jQuery(this).parent().parent().parent().attr("id"));
875
- });
876
- },
877
-
878
- /*
879
- * This function responds to the new post link on each calendar day.
880
- * The function is kind of funny. What I would really like to do is
881
- * redirect the user to the edit page with a parameter on the URL to
882
- * set a default post date, but WordPress doesn't support that. Instead
883
- * I create a new empty draft post on that day and take them to edit
884
- * that post.
885
- */
886
- createEmptyDraft: function(/*string*/ date) {
887
- /*
888
- * We don't really let them set a time in the calendar, so we
889
- * put a default post time of 10:00 AM.
890
- */
891
- var formattedDate = jQuery.URLEncode(edcal.getDayFromDayId(date).toString("yyyy-MM-dd") + " 10:00:00");
892
- var url = edcal.ajax_url + "?action=edcal_newdraft&date=" + formattedDate;
893
-
894
- jQuery.ajax( {
895
- url: url,
896
- type: "POST",
897
- processData: false,
898
- timeout: 100000,
899
- dataType: "json",
900
- success: function(res) {
901
- if (res.editlink) {
902
- window.location = res.editlink.replace("&amp;", "&");
903
- } else {
904
- edcal.showError("There was an error creating a new post for your blog.");
905
- }
906
- },
907
- error: function(xhr) {
908
- edcal.showError("There was an error contacting your blog.");
909
- if (xhr.responseText) {
910
- output("xhr.responseText: " + xhr.responseText);
911
- }
912
- }
913
- });
914
- },
915
-
916
- /*
917
- This function makes an AJAX call and changes the date of
918
- the specified post on the server.
919
- */
920
- changeDate: function(/*string*/ newdate, /*Post*/ post) {
921
- var newdateFormatted = edcal.getDayFromDayId(newdate).toString("yyyy-MM-dd");
922
-
923
- var postStatus = "";
924
-
925
- if (post.status === "draft") {
926
- /*
927
- * If the status of the post was a draft we leave it as a draft
928
- */
929
- postStatus = "draft";
930
- } else if (post.status === "pending") {
931
- /*
932
- * If the status of the post was a pending we leave it as a draft
933
- */
934
- postStatus = "pending";
935
- } else {
936
- /*
937
- If the post status was published or future we need to adjust
938
- it. If you take a post that is published a move it after
939
- the current day we change the status to future. If the post
940
- was scheduled to get published in the future and they drag
941
- it into the past we change the status to publish.
942
- */
943
- var compare = Date.parse(newdateFormatted).compareTo(Date.today());
944
- if (compare === -1) {
945
- if (post.status === "publish") {
946
- postStatus = "publish";
947
- } else {
948
- postStatus = "draft";
949
- }
950
-
951
- } else {
952
- postStatus = "future";
953
- }
954
- }
955
-
956
- var url = edcal.ajax_url + "?action=edcal_changedate&postid=" + post.id +
957
- "&postStatus=" + postStatus +
958
- "&newdate=" + newdateFormatted + "&olddate=" + edcal.getDayFromDayId(post.date).toString("yyyy-MM-dd");
959
-
960
- jQuery("#post-" + post.id).addClass("loadingclass");
961
-
962
- jQuery.ajax( {
963
- url: url,
964
- type: "POST",
965
- processData: false,
966
- timeout: 100000,
967
- dataType: "json",
968
- success: function(res) {
969
- edcal.removePostItem(res.post.date, "post-" + res.post.id);
970
- edcal.addPostItem(res.post, res.post.date);
971
- edcal.addPostItemDragAndToolltip(res.post.date);
972
-
973
- if (res.error) {
974
- /*
975
- * If there was an error we need to remove the dropped
976
- * post item.
977
- */
978
- edcal.removePostItem(newdate, "post-" + res.post.id);
979
- if (res.error === edcal.CONCURRENCY_ERROR) {
980
- edcal.showError("Someone else already moved " + res.post.title);
981
- } else if (res.error === edcal.PERMISSION_ERROR) {
982
- edcal.showError("You don't have permission to edit posts");
983
- }
984
- }
985
- },
986
- error: function(xhr) {
987
- edcal.showError("There was an error contacting your blog.");
988
- if (xhr.responseText) {
989
- output("xhr.responseText: " + xhr.responseText);
990
- }
991
- }
992
- });
993
-
994
- },
995
-
996
- /*
997
- * Shows an error message
998
- */
999
- showError: function(/*string*/ msg) {
1000
- humanMsg.displayMsg(msg);
1001
- },
1002
-
1003
- /*
1004
- Makes an AJAX call to get the posts from the server within the
1005
- specified dates.
1006
- */
1007
- getPosts: function(/*Date*/ from, /*Date*/ to) {
1008
- //output("getPosts(" + from.toString("dd-MMM-yyyy") + ", " + to.toString("dd-MMM-yyyy") + ")");
1009
-
1010
- var shouldGet = edcal.cacheDates[from];
1011
-
1012
- if (shouldGet) {
1013
- /*
1014
- * TODO: We don't want to make extra AJAX calls for dates
1015
- * that we have already coverred. This is cutting down on
1016
- * it somewhat, but we could get much better about this.
1017
- */
1018
- output("We already have the results.");
1019
- return;
1020
- }
1021
-
1022
- edcal.cacheDates[from] = true;
1023
-
1024
-
1025
- var url = edcal.ajax_url + "?action=edcal_posts&from=" + from.toString("yyyy-MM-dd") + "&to=" + to.toString("yyyy-MM-dd");
1026
- output("url: " + url);
1027
-
1028
- jQuery("#loading").show();
1029
-
1030
- jQuery.ajax( {
1031
- url: url,
1032
- type: "GET",
1033
- processData: false,
1034
- timeout: 100000,
1035
- dataType: "text",
1036
- success: function(res) {
1037
- jQuery("#loading").hide();
1038
-
1039
- /*
1040
- * These result here can get pretty large on a busy blog and
1041
- * the JSON parser from JSON.org works faster than the native
1042
- * one used by JQuery.
1043
- */
1044
- var parsedRes = JSON.parseIt(res);
1045
- var postDates = [];
1046
- jQuery.each(parsedRes, function(i, post) {
1047
- if (post) {
1048
- edcal.removePostItem(post.date, "post-" + post.id);
1049
- edcal.addPostItem(post, post.date);
1050
- postDates[postDates.length] = post.date;
1051
- }
1052
- });
1053
-
1054
- /*
1055
- * If the blog has a very larger number of posts then adding
1056
- * them all can make the UI a little slow. Particularly IE
1057
- * pops up a warning giving the user a chance to abort the
1058
- * script. Adding tooltips and making the items draggable is
1059
- * a lot of what makes things slow. Delaying those two operations
1060
- * makes the UI show up much faster and the user has to wait
1061
- * three seconds before they can drag. It also makes IE
1062
- * stop complaining.
1063
- */
1064
- setTimeout(function() {
1065
- output("adding tooltips and draggables to " + postDates.length + " items.");
1066
- jQuery.each(postDates, function(i, postDate) {
1067
- edcal.addPostItemDragAndToolltip(postDate);
1068
- });
1069
- }, 300);
1070
- },
1071
- error: function(xhr) {
1072
- edcal.showError("There was an error contacting your blog.");
1073
- if (xhr.responseText) {
1074
- output("xhr.responseText: " + xhr.responseText);
1075
- }
1076
- }
1077
- });
1078
- }
1079
- };
1080
-
1081
- jQuery(document).ready(function(){
1082
- edcal.init();
1083
- });
1084
-
1085
- /*
1086
- * This code is from the JQuery URL Encode plugin (http://plugins.jquery.com/project/URLEncode);
1087
- */
1088
- jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
1089
- while(x<c.length){var m=r.exec(c.substr(x));
1090
- if(m!==null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
1091
- }else{if(c[x]===' '){o+='+';}else{var d=c.charCodeAt(x);var h=d.toString(16);
1092
- o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
1093
- URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
1094
- while((m=r.exec(o))!==null && m.length>1 && m[1]!==''){b=parseInt(m[1].substr(1),16);
1095
- t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
1096
- });
1097
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************************************
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ ******************************************************************************/
16
+
17
+ /*
18
+ This is the WordPress editorial calendar. It is a continuous
19
+ calendar in both directions. That means instead of showing only
20
+ one month at a time it shows the months running together. Users
21
+ can scroll from one month to the next using the up and down
22
+ arrow keys, the page up and page down keys, the next and previous
23
+ month buttons, and their mouse wheel.
24
+
25
+ The calendar shows five weeks visible at a time and maintains 11
26
+ weeks of rendered HTML. Only the middle weeks are visible.
27
+
28
+ Week 1
29
+ Week 2
30
+ Week 3
31
+ - Week 4 -
32
+ | Week 5 |
33
+ | Week 6 |
34
+ | Week 7 |
35
+ - Week 8 -
36
+ Week 9
37
+ Week 10
38
+ Week 11
39
+
40
+ When the user scrolls down one week the new week is added at the
41
+ end of the calendar and the first week is removed. In this way
42
+ the calendar will only ever have 11 weeks total and won't use up
43
+ excessive memory.
44
+
45
+ This calendar uses AJAX to call into the functions defined in
46
+ edcal.php. These functions get posts and change post dates.
47
+
48
+ The HTML structure of the calendar is:
49
+
50
+ <div id="cal">
51
+ <div id="row08Nov2009">
52
+ <div id="row08Nov2009row">
53
+ <div class="day sunday nov" id="08Nov2009">
54
+ <div class="dayobj">
55
+ <div class="daylabel">8</div>
56
+ <ul class="postlist">
57
+ </ul>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ */
64
+ var edcal = {
65
+ /*
66
+ * True if the calendar is in the process of moving
67
+ */
68
+ isMoving: false,
69
+
70
+ /*
71
+ This is the base URL we use to make AJAX calls back
72
+ to the server. This value is set in code generated
73
+ from edcal.php that run in a script tag in the main
74
+ page.
75
+ */
76
+ ajax_url: '',
77
+
78
+ /*
79
+ * The cache of dates we have already loaded posts for.
80
+ */
81
+ cacheDates : [],
82
+
83
+ /*
84
+ * The ID of the timer we use to batch new post requests
85
+ */
86
+ tID: null,
87
+
88
+ /*
89
+ * The number of steps moving for this timer.
90
+ */
91
+ steps: 0,
92
+
93
+ /*
94
+ * The constant for the concurrency error.
95
+ */
96
+ CONCURRENCY_ERROR: 4,
97
+
98
+ /*
99
+ * The constant for the user permission error
100
+ */
101
+ PERMISSION_ERROR: 5,
102
+
103
+ /*
104
+ * The constant for the nonce error
105
+ */
106
+ NONCE_ERROR: 6,
107
+
108
+ /*
109
+ The direction the calendar last moved.
110
+ true = down = to the future
111
+ false = up = to the past
112
+
113
+ */
114
+ currentDirection: true,
115
+
116
+ /*
117
+ This date is our index. When the calendar moves we
118
+ update this date to indicate the next rows we need
119
+ to add.
120
+ */
121
+ _wDate: Date.today(),
122
+
123
+ /*
124
+ * The date since the previous move
125
+ */
126
+ moveDate: null,
127
+
128
+ /*
129
+ A cache of all the posts we have loaded so far. The
130
+ data structure is:
131
+
132
+ posts [date - ddMMMyyyy][posts array - post object from JSON data]
133
+ */
134
+ posts: new Array(50),
135
+
136
+ /*
137
+ IE will sometimes fire the resize event twice for the same resize
138
+ action. We save it so we only resize the calendar once and avoid
139
+ any flickering.
140
+ */
141
+ windowHeight: 0,
142
+
143
+ /*
144
+ This function aligns the grid in two directions. There
145
+ is a vertical grid with a row of each week and a horizontal
146
+ grid for each week with a list of days.
147
+ */
148
+ alignGrid: function(/*string*/ gridid, /*int*/ cols, /*int*/ cellWidth, /*int*/ cellHeight, /*int*/ padding) {
149
+ var x = 0;
150
+ var y = 0;
151
+ var count = 1;
152
+
153
+ jQuery(gridid).each(function(){
154
+ jQuery(this).css("position", "relative");
155
+
156
+ jQuery(this).children("div").each(function(){
157
+ jQuery(this).css({
158
+ width: cellWidth + "%",
159
+ height: cellHeight + "%",
160
+ position: "absolute",
161
+ left: x + "%",
162
+ top: y + "%"
163
+ });
164
+
165
+ if ((count % cols) === 0) {
166
+ x = 0;
167
+ y += cellHeight + padding;
168
+ } else {
169
+ x += cellWidth + padding;
170
+ }
171
+
172
+ count++;
173
+ });
174
+ });
175
+ },
176
+
177
+ /*
178
+ This is a helper function to align the calendar so we don't
179
+ have to change the cell sizes in multiple places.
180
+ */
181
+ alignCal: function() {
182
+ edcal.alignGrid("#cal", 1, 100, 20, 0.25);
183
+ },
184
+
185
+
186
+ /*
187
+ This function creates the days header at the top of the
188
+ calendar.
189
+
190
+ TODO: We should localize these values
191
+ */
192
+ createDaysHeader: function() {
193
+ var html = '<div class="dayhead">Sunday</div>';
194
+ html += '<div class="dayhead">Monday</div>';
195
+ html += '<div class="dayhead">Tuesday</div>';
196
+ html += '<div class="dayhead">Wednesday</div>';
197
+ html += '<div class="dayhead">Thursday</div>';
198
+ html += '<div class="dayhead">Friday</div>';
199
+ html += '<div class="dayhead">Saturday</div>';
200
+
201
+ jQuery("#rowhead").append(html);
202
+
203
+ edcal.alignGrid("#rowhead", 7, 14.2, 100, 0.25);
204
+ },
205
+
206
+ /*
207
+ Creates a row of the calendar and adds all of the CSS classes
208
+ and listeners for each calendar day.
209
+ */
210
+ createRow: function(/*jQuery*/ parent, /*bool*/ append) {
211
+ var _date = edcal._wDate.clone();
212
+
213
+ var newrow = '<div class="rowcont" id="' + 'row' + edcal._wDate.toString("ddMMMyyyy") + '">' +
214
+ '<div id="' + 'row' + edcal._wDate.toString("ddMMMyyyy") + 'row" class="row">';
215
+ for (var i = 0; i < 7; i++) {
216
+ newrow += '<div id="' + _date.toString("ddMMMyyyy") + '" class="day ' +
217
+ _date.toString("dddd").toLowerCase() + ' ' +
218
+ _date.toString("MMM").toLowerCase() + '">';
219
+
220
+ newrow += '<div class="dayobj">';
221
+
222
+ newrow += '<div class="daylabel">';
223
+ newrow += '<a href="#" adddate="' + _date.toString("MMMM d") + '" class="daynewlink" title="Add new post on ' + _date.toString("MMMM d") + '" ' +
224
+ 'onclick="return false;">+</a>';
225
+ if (_date.toString("dd") == "01") {
226
+ newrow += _date.toString("MMM d");
227
+ } else {
228
+ newrow += _date.toString("d");
229
+ }
230
+ newrow += '</div>';
231
+
232
+ newrow += '<ul class="postlist">';
233
+
234
+ newrow += edcal.getPostItems(_date.toString("ddMMMyyyy"));
235
+
236
+ newrow += '</ul>';
237
+
238
+ newrow += '</div>';
239
+ newrow += '</div>';
240
+ _date.add(1).days();
241
+ }
242
+
243
+ newrow += '</div></div';
244
+
245
+ if (append) {
246
+ parent.append(newrow);
247
+
248
+ } else {
249
+ parent.prepend(newrow);
250
+ }
251
+
252
+ edcal.alignGrid("#row" + edcal._wDate.toString("ddMMMyyyy") + "row", 7, 14.2, 100, 0.25);
253
+
254
+ jQuery('#row' + edcal._wDate.toString("ddMMMyyyy") + ' .day').each( function() {
255
+ edcal.addTooltip(jQuery(this).attr("id"));
256
+ });
257
+
258
+ edcal.draggablePost('#row' + edcal._wDate.toString("ddMMMyyyy") + ' .post');
259
+
260
+ jQuery('#row' + edcal._wDate.toString("ddMMMyyyy") + ' .day').droppable({
261
+ hoverClass: 'day-active',
262
+ accept: '.post',
263
+ greedy: true,
264
+ tolerance: 'pointer',
265
+ drop: function(event, ui) {
266
+ //output('dropped ui.draggable.attr("id"): ' + ui.draggable.attr("id"));
267
+ //output('dropped on jQuery(this).attr("id"): ' + jQuery(this).attr("id"));
268
+ //output('ui.draggable.html(): ' + ui.draggable.html());
269
+
270
+ var dayId = ui.draggable.parent().parent().parent().attr("id");
271
+
272
+ // Step 0. Get the post object from the map
273
+ var post = edcal.findPostForId(ui.draggable.parent().parent().parent().attr("id"),
274
+ ui.draggable.attr("id"));
275
+
276
+ // Step 1. Remove the post from the posts map
277
+ edcal.removePostFromMap(ui.draggable.parent().parent().parent().attr("id"),
278
+ ui.draggable.attr("id"));
279
+
280
+ // Step 2. Remove the old element from the old parent.
281
+ jQuery('#' + ui.draggable.attr("id")).remove();
282
+
283
+ // Step 3. Add the item to the new DOM parent
284
+ jQuery('#' + jQuery(this).attr("id") + ' .postlist').append(edcal.createPostItem(post,
285
+ jQuery(this).attr("id")));
286
+
287
+ // Step 4. And add the tooltip
288
+ edcal.addTooltip(jQuery(this).attr("id"));
289
+
290
+ if (dayId == jQuery(this).attr("id")) {
291
+ /*
292
+ If they dropped back on to the day they started with we
293
+ don't want to go back to the server.
294
+ */
295
+ edcal.draggablePost('#' + jQuery(this).attr("id") + ' .post');
296
+ } else {
297
+ // Step6. Update the date on the server
298
+ edcal.changeDate(jQuery(this).attr("id"), post);
299
+ }
300
+ }
301
+ });
302
+
303
+ return jQuery('row' + edcal._wDate.toString("ddMMMyyyy"));
304
+ },
305
+
306
+ /*
307
+ * This is a helper method to make an individual post item draggable.
308
+ */
309
+ draggablePost: function(/*post selector*/ post) {
310
+ /*
311
+ * Click is a different operation than drag in our UI. The problem is if
312
+ * the user is moving their mouse just a little bit we can think it is a
313
+ * drag instead of a click. We stop this by delaying the drag event until
314
+ * the user has dragged at least 10 pixels. This works fine on IE and
315
+ * Firefox, but on Chrome it causes text selection so we don't delay on
316
+ * Chrome.
317
+ */
318
+ var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
319
+ var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
320
+
321
+ if (is_chrome || is_safari) {
322
+ jQuery(post).draggable({
323
+ revert: 'invalid',
324
+ appendTo: 'body',
325
+ helper: "clone",
326
+ addClasses: false
327
+ });
328
+ } else {
329
+ jQuery(post).draggable({
330
+ revert: 'invalid',
331
+ appendTo: 'body',
332
+ distance: 10,
333
+ helper: "clone",
334
+ addClasses: false
335
+ });
336
+ }
337
+ },
338
+
339
+ /*
340
+ This is a utility method to find a post and remove it
341
+ from the cache map.
342
+ */
343
+ removePostFromMap: function(/*string*/ dayobjId, /*string*/ postId) {
344
+ if (edcal.posts[dayobjId]) {
345
+ for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
346
+ if (edcal.posts[dayobjId][i] &&
347
+ "post-" + edcal.posts[dayobjId][i].id === postId) {
348
+ edcal.posts[dayobjId][i] = null;
349
+ return true;
350
+ }
351
+ }
352
+ }
353
+
354
+ return false;
355
+ },
356
+
357
+ /*
358
+ * Adds a post to al already existing calendar day.
359
+ */
360
+ addPostItem: function(/*post*/ post, /*string*/ dayobjId) {
361
+ jQuery('#' + dayobjId + ' .postlist').append(edcal.createPostItem(post, dayobjId));
362
+ },
363
+
364
+ /*
365
+ Makes all the posts in the specified day draggable
366
+ and adds the tooltip.
367
+ */
368
+ addPostItemDragAndToolltip: function(/*string*/ dayobjId) {
369
+ edcal.draggablePost('#' + dayobjId + ' .post');
370
+ edcal.addTooltip(dayobjId);
371
+ },
372
+
373
+ /*
374
+ * Confirms if you want to delete the specified post
375
+ */
376
+ confirmDelete: function(/*string*/ posttitle) {
377
+ if (confirm('You are about to delete this post ' + posttitle + '.\n\n Press cancel to stop, OK to delete.')) {
378
+ return true;
379
+ } else {
380
+ return false;
381
+ }
382
+ },
383
+
384
+ /*
385
+ This is an AJAX function to save the past title when
386
+ the user presses the save button on the tooltip.
387
+ */
388
+ saveTitle: function(/*string*/ postId) {
389
+ edcal.output("Saving the new title " + jQuery("#edcal-title-edit-field").val() + " for post " + postId);
390
+ var url = edcal.ajax_url + "&action=edcal_changetitle&postid=" + postId +
391
+ "&title=" + jQuery.URLEncode(jQuery("#edcal-title-edit-field").val());
392
+
393
+ jQuery("#post-" + postId).addClass("loadingclass");
394
+
395
+ jQuery("#tooltip").hide();
396
+
397
+ jQuery.ajax( {
398
+ url: url,
399
+ type: "POST",
400
+ processData: false,
401
+ timeout: 100000,
402
+ dataType: "json",
403
+ success: function(res) {
404
+ edcal.removePostItem(res.post.date, "post-" + res.post.id);
405
+ if (res.error) {
406
+ /*
407
+ * If there was an error we need to remove the dropped
408
+ * post item.
409
+ */
410
+ if (res.error === edcal.NONCE_ERROR) {
411
+ edcal.showError("Invalid checksum for post. This is commonly a cross-site scripting error.");
412
+ }
413
+ }
414
+ edcal.addPostItem(res.post, res.post.date);
415
+ edcal.addPostItemDragAndToolltip(res.post.date);
416
+ edcal.output("Finished saving the new title " + jQuery("#edcal-title-edit-field").val() + " for post " + postId);
417
+ },
418
+ error: function(xhr) {
419
+ edcal.showError("There was an error contacting your blog.");
420
+ if (xhr.responseText) {
421
+ edcal.output("xhr.responseText: " + xhr.responseText);
422
+ }
423
+ }
424
+ });
425
+ },
426
+
427
+ /*
428
+ * Cancels the edit title action in the tooltip.
429
+ */
430
+ cancelEditTitle: function(/*string*/ postTitle) {
431
+ jQuery("#edcal-title-edit-field").val(postTitle);
432
+
433
+ jQuery("#edcal-title-box").hide();
434
+ jQuery("#edcal-title").show();
435
+
436
+ },
437
+
438
+ /*
439
+ * Shows the edit title UI in the tooltip.
440
+ */
441
+ editTitle: function() {
442
+ jQuery("#edcal-title").hide();
443
+ jQuery("#edcal-title-box").show();
444
+
445
+ jQuery("#edcal-title-edit-field").focus();
446
+ jQuery("#edcal-title-edit-field").select();
447
+ },
448
+
449
+ /*
450
+ Switches back to the normal tooltip title view
451
+ and closes the tooltip.
452
+ */
453
+ closeTooltip: function() {
454
+ edcal.cancelEditTitle();
455
+ jQuery("#tooltip").hide();
456
+ },
457
+
458
+ /*
459
+ * Adds a tooltip to every post in the specified day.
460
+ */
461
+ addTooltip: function(/*string*/ dayobjId) {
462
+ jQuery('#' + dayobjId + ' .post').tooltip({
463
+ delay: 1500,
464
+ bodyHandler: function() {
465
+ var post = edcal.findPostForId(dayobjId, jQuery(this).attr("id"));
466
+
467
+ var posttitle = post.title;
468
+
469
+ var tooltip = '<div class="tooltip">' +
470
+ '<a href="#" id="tipclose" onclick="edcal.closeTooltip(); return false;" title="close"> </a>' +
471
+ '<h3 id="edcal-title">' + posttitle +
472
+ ' <a href="#" onclick="edcal.editTitle(); return false;" class="edit-post-status" id="edcal-title-edit">Edit</a>' +
473
+ '</h3>' +
474
+ '<div id="edcal-title-box">' +
475
+ '<input type="text" postid="' + post.id + '" value="' + post.title + '" id="edcal-title-edit-field"/> &nbsp;&nbsp;' +
476
+ '<span id="edit-slug-buttons">' +
477
+ '<a class="save button" href="#" onclick="edcal.saveTitle(\'' + post.id + '\'); return false;">Save</a> ' +
478
+ '<a href="#" onclick="edcal.cancelEditTitle(\'' + post.title + '\'); return false;" class="cancel">Cancel</a></span>' +
479
+ '</div>' +
480
+ '<p>' +
481
+ '<i>by</i> ' + post.author + ' <i>on</i> ' +
482
+ edcal.getDayFromDayId(post.date).toString("MMMM d, yyyy") + ' at ' +
483
+ post.time +
484
+ '</p>' +
485
+ '<p>' +
486
+ 'Status<b>: ' + post.status + '</b>' +
487
+ '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
488
+ if (post.editlink) {
489
+ /*
490
+ * If the user doesn't have permission to edit a post then
491
+ * then server won't send the edit link URL and we shouldn't
492
+ * show the edit link
493
+ */
494
+ tooltip += '<a href="' + post.editlink + '" title="Edit ' + post.title +
495
+ '">Edit</a>&nbsp; | &nbsp;';
496
+ }
497
+
498
+ if (post.dellink) {
499
+ tooltip += '<a class="submitdelete" href="' + post.dellink + '" ' +
500
+ 'onclick="return edcal.confirmDelete(\'' + post.title + '\');"' +
501
+ 'title="Delete ' + post.title + '">Delete</a> &nbsp; | &nbsp;';
502
+ }
503
+
504
+ tooltip += '<a href="' + post.permalink + '" title="View ' + post.title + '">View</a>' +
505
+ '</p>' +
506
+ '</div>';
507
+
508
+ return tooltip;
509
+ }
510
+ });
511
+ },
512
+
513
+ /*
514
+ * Adds a tooltip to every add post link
515
+ */
516
+ addCreateTooltip: function(/*JQuery*/ createLink) {
517
+ if (createLink.hasClass('hasTooltip')) {
518
+ return;
519
+ }
520
+
521
+ var date = createLink.parent().parent().parent().attr("id");
522
+
523
+
524
+ createLink.tooltip({
525
+ delay: 1500,
526
+ bodyHandler: function() {
527
+ var tooltip = '<div class="tooltip newposttip">' +
528
+ '<a href="#" id="tipclose" onclick="jQuery(\'#tooltip\').hide(); return false;" title="close"> </a>' +
529
+ '<h3>Add a new post on ' + createLink.attr("adddate") + '</h3>' +
530
+ '<div id="edcal-title-new-section">' +
531
+ 'Post Title:<br />' +
532
+ '<input type="text" class="text_input" id="edcal-title-new-field"/>' +
533
+ '</div>' +
534
+ '<div id="edit-slug-buttons">' +
535
+ '<a class="save button disabled" id="newPostButton" href="#" adddate="' + date + '">Save Draft</a> ' +
536
+ '<a class="save button disabled" id="newPostEditButton" href="#" adddate="' + date + '">Save and Edit Draft</a> ' +
537
+ '<a href="#" onclick="jQuery(\'#tooltip\').hide(); return false;" class="cancel">Cancel</a>' +
538
+ '</div>' +
539
+ '</div>';
540
+ return tooltip;
541
+ },
542
+ showHandler: function() {
543
+ /*
544
+ * Put the focus in the post title field when the tooltip opens.
545
+ */
546
+ jQuery("#edcal-title-new-field").focus();
547
+ jQuery("#edcal-title-new-field").select();
548
+ }
549
+ });
550
+
551
+ createLink.addClass('hasTooltip');
552
+ },
553
+
554
+ /*
555
+ Creates the HTML for a post item and adds the data for
556
+ the post to the posts cache.
557
+ */
558
+ createPostItem: function(/*post*/ post, /*string*/ dayobjId) {
559
+ var postHtml = edcal.getPostItemString(post);
560
+ if (!edcal.posts[dayobjId]) {
561
+ edcal.posts[dayobjId] = new Array(0);
562
+ }
563
+
564
+ edcal.posts[dayobjId][edcal.posts[dayobjId].length] = post;
565
+
566
+ return postHtml;
567
+ },
568
+
569
+ /*
570
+ Finds the post object for the specified post ID in the
571
+ specified day.
572
+ */
573
+ findPostForId: function(/*string*/ dayobjId, /*string*/ postId) {
574
+ if (edcal.posts[dayobjId]) {
575
+ for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
576
+ if (edcal.posts[dayobjId][i] &&
577
+ "post-" + edcal.posts[dayobjId][i].id === postId) {
578
+ return edcal.posts[dayobjId][i];
579
+ }
580
+ }
581
+ }
582
+ },
583
+
584
+ /*
585
+ * Removes a post from the HTML and the posts cache.
586
+ */
587
+ removePostItem: function(/*string*/ dayobjId, /*string*/ postId) {
588
+ if (edcal.findPostForId(dayobjId, postId)) {
589
+ for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
590
+ if (edcal.posts[dayobjId][i] &&
591
+ "post-" + edcal.posts[dayobjId][i].id === postId) {
592
+ edcal.posts[dayobjId][i] = null;
593
+ jQuery("#" + postId).remove();
594
+ }
595
+ }
596
+
597
+ }
598
+ },
599
+
600
+ /*
601
+ Gets all the post items for the specified day from
602
+ the post cache.
603
+ */
604
+ getPostItems: function(/*string*/ dayobjId) {
605
+ var postsString = "";
606
+
607
+ if (edcal.posts[dayobjId]) {
608
+ for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
609
+ if (edcal.posts[dayobjId][i]) {
610
+ postsString += edcal.getPostItemString(edcal.posts[dayobjId][i]);
611
+ }
612
+ }
613
+ }
614
+
615
+ return postsString;
616
+ },
617
+
618
+ /*
619
+ * Gets the HTML string for a post.
620
+ */
621
+ getPostItemString: function(/*post*/ post) {
622
+ var posttitle = post.title;
623
+
624
+ if (posttitle === "") {
625
+ posttitle = "[No Title]";
626
+ }
627
+ return '<li id="post-' + post.id + '" class="post ' + post.status + '">' + posttitle + '</li>';
628
+ },
629
+
630
+ /*
631
+ Finds the calendar cell for the current day and adds the
632
+ class "today" to that cell.
633
+ */
634
+ setClassforToday: function() {
635
+ /*
636
+ We want to set a class for the cell that represents the current day so we ca
637
+ give it a background color.
638
+ */
639
+ jQuery('#' + Date.today().toString("ddMMMyyyy")).addClass("today");
640
+ },
641
+
642
+ /*
643
+ Most browsers need us to set a calendar height in pixels instead
644
+ of percent. This function get the correct pixel height for the
645
+ calendar based on the window height.
646
+ */
647
+ getCalHeight: function() {
648
+ var myHeight = 0;
649
+ if ( typeof( window.innerWidth ) == 'number' ) {
650
+ //Non-IE
651
+ myHeight = window.innerHeight;
652
+ } else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
653
+ //IE 6+ in 'standards compliant mode'
654
+ myHeight = document.documentElement.clientHeight;
655
+ } else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
656
+ //IE 4 compatible
657
+ myHeight = document.body.clientHeight;
658
+ }
659
+ return myHeight - 150;
660
+ },
661
+
662
+ /*
663
+ Moves the calendar a certain number of steps in the specified direction.
664
+ True moves the calendar down into the future and false moves the calendar
665
+ up into the past.
666
+ */
667
+ move: function(steps, direction) {
668
+ /*
669
+ The working date is a marker for the last calendar row we created.
670
+ If we are moving forward that will be the last row, if we are moving
671
+ backward it will be the first row. If we switch direction we need
672
+ to bump up our date by 11 rows times 7 days a week or 77 days.
673
+ */
674
+ if (edcal.currentDirection != direction) {
675
+ if (direction) { // into the future
676
+ edcal._wDate = edcal._wDate.add(77).days();
677
+ } else { // into the past
678
+ edcal._wDate = edcal._wDate.add(-77).days();
679
+ }
680
+
681
+ edcal.steps = 0;
682
+ edcal.moveDate = edcal._wDate;
683
+ }
684
+
685
+ edcal.currentDirection = direction;
686
+
687
+ var i;
688
+
689
+
690
+ if (direction) {
691
+ for (i = 0; i < steps; i++) {
692
+ jQuery("#cal > div:first").remove();
693
+ edcal.createRow(jQuery("#cal"), true);
694
+ edcal._wDate.add(7).days();
695
+ }
696
+ edcal.alignCal();
697
+ } else {
698
+ for (i = 0; i < steps; i++) {
699
+ jQuery("#cal > div:last").remove();
700
+ edcal.createRow(jQuery("#cal"), false);
701
+ edcal._wDate.add(-7).days();
702
+ }
703
+ edcal.alignCal();
704
+ }
705
+
706
+ edcal.setClassforToday();
707
+ edcal.setDateLabel();
708
+
709
+ /*
710
+ * If the user clicks quickly or uses the mouse wheel they can
711
+ * get a lot of move events very quickly and we need to batch
712
+ * them up together. We set a timeout and clear it if there is
713
+ * another move before the timeout happens.
714
+ */
715
+ edcal.steps += steps;
716
+ if (edcal.tID) {
717
+ clearTimeout(edcal.tID);
718
+ } else {
719
+ edcal.moveDate = edcal._wDate;
720
+ }
721
+
722
+ edcal.tID = setTimeout(function() {
723
+ /*
724
+ * Now that we are done moving the calendar we need to get the posts for the
725
+ * new dates. We want to load the posts between the place the calendar was
726
+ * at when the user started moving it and the place the calendar is at now.
727
+ */
728
+ if (!direction) {
729
+ edcal.getPosts(edcal._wDate.clone(),
730
+ edcal._wDate.clone().add(7 * (edcal.steps + 1)).days());
731
+ } else {
732
+ edcal.getPosts(edcal._wDate.clone().add(-7 * (edcal.steps + 1)).days(),
733
+ edcal._wDate.clone());
734
+ }
735
+
736
+ edcal.steps = 0;
737
+ edcal.tID = null;
738
+ edcal.moveDate = edcal._wDate;
739
+ }, 1000);
740
+ },
741
+
742
+ /*
743
+ We use the date as the ID for day elements, but the Date
744
+ library can't parse the date without spaces and using
745
+ spaces in IDs can cause problems. We work around the
746
+ issue by adding the spaces back before we parse.
747
+ */
748
+ getDayFromDayId: function(/*dayId*/ day) {
749
+ return Date.parse(day.substring(0, 2) + ' ' + day.substring(2, 5) + ' ' + day.substring(5));
750
+ },
751
+
752
+ /*
753
+ This is a helper method to set the date label on the top of
754
+ the calendar. It looks like November 2009-December2009
755
+ */
756
+ setDateLabel: function(year) {
757
+ var api = jQuery(".edcal_scrollable").scrollable();
758
+ var items = api.getVisibleItems();
759
+
760
+ /*
761
+ We need to get the first day in the first week and the
762
+ last day in the last week. We call children twice to
763
+ work around a small JQuery issue.
764
+ */
765
+ var firstDate = edcal.getDayFromDayId(items.eq(0).children(".row").children(".day:first").attr("id"));
766
+ var lastDate = edcal.getDayFromDayId(items.eq(items.length - 1).children(".row").children(".day:last").attr("id"));
767
+
768
+ jQuery("#currentRange").text(firstDate.toString("MMMM yyyy") + " - " + lastDate.toString("MMMM yyyy"));
769
+ },
770
+
771
+ /*
772
+ * Moves the calendar to the specified date.
773
+ */
774
+ moveTo: function(/*Date*/ date) {
775
+ edcal.isMoving = true;
776
+ jQuery("#cal").empty();
777
+
778
+ /*
779
+ When we first start up our working date is 4 weeks before
780
+ the next Sunday.
781
+ */
782
+ edcal._wDate = date.next().sunday().add(-28).days();
783
+
784
+ /*
785
+ After we remove and readd all the rows we are back to
786
+ moving in a going down direction.
787
+ */
788
+ edcal.currentDirection = true;
789
+
790
+ for (var i = 0; i < 10; i++) {
791
+ edcal.createRow(jQuery("#cal"), true);
792
+ edcal._wDate.add(7).days();
793
+ }
794
+
795
+ edcal.alignCal();
796
+
797
+ var api = jQuery(".edcal_scrollable").scrollable();
798
+ api.move(2);
799
+
800
+ edcal.setDateLabel();
801
+ edcal.setClassforToday();
802
+ edcal.isMoving = false;
803
+
804
+ },
805
+
806
+ /*
807
+ * Initializes the calendar
808
+ */
809
+ init: function() {
810
+ if (jQuery("#edcal_scrollable").length === 0) {
811
+ /*
812
+ * This means we are on a page without the editorial
813
+ * calendar
814
+ */
815
+ return;
816
+ }
817
+
818
+ jQuery("#loading").hide();
819
+
820
+ jQuery("#edcal_scrollable").css("height", edcal.getCalHeight() + "px");
821
+ edcal.windowHeight = jQuery(window).height();
822
+
823
+ /*
824
+ * Add the days of the week
825
+ */
826
+ edcal.createDaysHeader();
827
+
828
+ // initialize scrollable
829
+ jQuery(".edcal_scrollable").scrollable({
830
+ vertical:true,
831
+ size: 5,
832
+ keyboardSteps: 1,
833
+ speed: 100
834
+ // use mousewheel plugin
835
+ }).mousewheel();
836
+
837
+ var api = jQuery(".edcal_scrollable").scrollable();
838
+
839
+ edcal.moveTo(Date.today());
840
+
841
+ /*
842
+ * The scrollable handles some basic binding. This gets us
843
+ * up arrow, down arrow and the mouse wheel.
844
+ */
845
+ api.onBeforeSeek(function(evt, direction) {
846
+ // inside callbacks the "this" variable is a reference to the API
847
+ /*
848
+ * Some times for reasons I haven't been able to figure out
849
+ * the direction is an int instead of a boolean. I don't
850
+ * know why, but this works around it.
851
+ */
852
+ if (direction === 1) {
853
+ direction = false;
854
+ } else if (direction === 3) {
855
+ direction = true;
856
+ }
857
+
858
+ if (!edcal.isMoving) {
859
+ edcal.move(1, direction);
860
+ }
861
+
862
+ return false;
863
+ });
864
+
865
+ /*
866
+ * We also want to listen for a few other key events
867
+ */
868
+ jQuery(document).bind("keydown", function(evt) {
869
+ //if (evt.altKey || evt.ctrlKey) { return; }
870
+ //output("evt.altKey: " + evt.altKey);
871
+ //output("evt.keyCode: " + evt.keyCode);
872
+ //output("evt.ctrlKey: " + evt.ctrlKey);
873
+
874
+ if ((evt.keyCode === 34 && !(evt.altKey || evt.ctrlKey)) || //page down
875
+ evt.keyCode === 40 && evt.ctrlKey){ // Ctrl+down down arrow
876
+ edcal.move(4, true);
877
+ return false;
878
+ } else if ((evt.keyCode === 33 && !(evt.altKey || evt.ctrlKey)) || //page up
879
+ evt.keyCode === 38 && evt.ctrlKey){ // Ctrl+up up arrow
880
+ edcal.move(4, false);
881
+ return false;
882
+ } else if (evt.keyCode === 27) { //escape key
883
+ edcal.closeTooltip();
884
+ return false;
885
+ }
886
+ });
887
+
888
+ edcal.getPosts(Date.today().next().sunday().add(-28).days(),
889
+ Date.today().next().sunday().add(35).days());
890
+
891
+ /*
892
+ Now we bind the listeners for all of our links and the window
893
+ resize.
894
+ */
895
+ jQuery("#moveToToday").click(function() {
896
+ edcal.moveTo(Date.today());
897
+ return false;
898
+ });
899
+
900
+ jQuery("#prevmonth").click(function() {
901
+ edcal.move(4, false);
902
+ return false;
903
+ });
904
+
905
+ jQuery("#nextmonth").click(function() {
906
+ edcal.move(4, true);
907
+ return false;
908
+ });
909
+
910
+ function resizeWindow(e) {
911
+ if (edcal.windowHeight != jQuery(window).height()) {
912
+ jQuery("#edcal_scrollable").css("height", edcal.getCalHeight() + "px");
913
+ edcal.windowHeight = jQuery(window).height();
914
+ }
915
+ }
916
+ jQuery(window).bind("resize", resizeWindow);
917
+
918
+ jQuery(".day").live("mouseover", function(evt) {
919
+ var createLink = jQuery("#" + jQuery(this).attr("id") + " .daynewlink");
920
+ createLink.show();
921
+ edcal.addCreateTooltip(createLink);
922
+ });
923
+
924
+ jQuery(".day").live("mouseout", function(evt) {
925
+ jQuery("#" + jQuery(this).attr("id") + " .daynewlink").hide();
926
+ });
927
+
928
+ jQuery("#newPostButton").live("click", function(evt) {
929
+ edcal.createNewDraft(jQuery(this).attr("adddate"), jQuery("#edcal-title-new-field").val(), false);
930
+ });
931
+
932
+ jQuery("#newPostEditButton").live("click", function(evt) {
933
+ edcal.createNewDraft(jQuery(this).attr("adddate"), jQuery("#edcal-title-new-field").val(), true);
934
+ });
935
+
936
+ jQuery("#edcal-title-new-field").live("keyup", function(evt) {
937
+ if (jQuery("#edcal-title-new-field").val().length > 0) {
938
+ jQuery("#newPostButton").removeClass("disabled");
939
+ jQuery("#newPostEditButton").removeClass("disabled");
940
+ } else {
941
+ jQuery("#newPostButton").addClass("disabled");
942
+ jQuery("#newPostEditButton").addClass("disabled");
943
+ }
944
+
945
+ if (evt.keyCode == 13) { // enter key
946
+ /*
947
+ * If the user presses enter we want to save the draft.
948
+ */
949
+ edcal.createNewDraft(jQuery("#newPostButton").attr("adddate"), jQuery("#edcal-title-new-field").val(), false);
950
+ }
951
+ });
952
+
953
+ jQuery("#edcal-title-edit-field").live("keyup", function(evt) {
954
+ if (evt.keyCode == 13) { // enter key
955
+ /*
956
+ * If the user presses enter we want to save the post title.
957
+ */
958
+ edcal.saveTitle(jQuery(this).attr("postid"));
959
+ }
960
+
961
+ });
962
+ },
963
+
964
+ /*
965
+ * When the user presses the new post link on each calendar cell they get
966
+ * a tooltip which prompts them to edit the title of the new post. Once
967
+ * they provide a tittle we call this function.
968
+ *
969
+ * date - the date for the new post
970
+ * title - the title for the new post
971
+ * doEdit - should we edit the post immediately? if true we send the user
972
+ * to the edit screen for their new post.
973
+ */
974
+ createNewDraft: function(/*string*/ date, /*string*/ title, /*boolean*/ doEdit) {
975
+ if (!title || title === "") {
976
+ return;
977
+ }
978
+
979
+ edcal.output('Adding new draft "' + title + '" on ' + date);
980
+
981
+ jQuery("#edit-slug-buttons").addClass("tiploading");
982
+ /*
983
+ * We don't really let them set a time in the calendar, so we
984
+ * put a default post time of 10:00 AM.
985
+ */
986
+ var formattedDate = jQuery.URLEncode(edcal.getDayFromDayId(date).toString("yyyy-MM-dd") + " 10:00:00");
987
+ var url = edcal.ajax_url + "&action=edcal_newdraft&date=" + formattedDate + "&title=" +
988
+ jQuery.URLEncode(title);
989
+
990
+ jQuery.ajax( {
991
+ url: url,
992
+ type: "POST",
993
+ processData: false,
994
+ timeout: 100000,
995
+ dataType: "json",
996
+ success: function(res) {
997
+ jQuery("#edit-slug-buttons").removeClass("tiploading");
998
+ jQuery('#tooltip').hide();
999
+ if (res.error) {
1000
+ /*
1001
+ * If there was an error we need to remove the dropped
1002
+ * post item.
1003
+ */
1004
+ if (res.error === edcal.NONCE_ERROR) {
1005
+ edcal.showError("Invalid checksum for post. This is commonly a cross-site scripting error.");
1006
+ }
1007
+ return;
1008
+ }
1009
+
1010
+ if (!res.post) {
1011
+ edcal.showError("There was an error creating a new post for your blog.");
1012
+ } else {
1013
+ edcal.output('Finished adding new draft "' + title + '" on ' + date);
1014
+ if (doEdit) {
1015
+ /*
1016
+ * If the user wanted to edit the post then we redirect
1017
+ * them to the edit page.
1018
+ */
1019
+ window.location = res.post.editlink.replace("&amp;", "&");
1020
+ } else {
1021
+ edcal.addPostItem(res.post, res.post.date);
1022
+ edcal.addPostItemDragAndToolltip(res.post.date);
1023
+ }
1024
+ }
1025
+ },
1026
+ error: function(xhr) {
1027
+ jQuery("#edit-slug-buttons").removeClass("tiploading");
1028
+ jQuery('#tooltip').hide();
1029
+ edcal.showError("There was an error contacting your blog.");
1030
+ if (xhr.responseText) {
1031
+ edcal.output("xhr.responseText: " + xhr.responseText);
1032
+ }
1033
+ }
1034
+ });
1035
+ },
1036
+
1037
+ /*
1038
+ This function makes an AJAX call and changes the date of
1039
+ the specified post on the server.
1040
+ */
1041
+ changeDate: function(/*string*/ newdate, /*Post*/ post) {
1042
+ edcal.output('Changing the date of "' + post.title + '" to ' + newdate);
1043
+ var newdateFormatted = edcal.getDayFromDayId(newdate).toString("yyyy-MM-dd");
1044
+
1045
+ var postStatus = "";
1046
+
1047
+ if (post.status === "draft") {
1048
+ /*
1049
+ * If the status of the post was a draft we leave it as a draft
1050
+ */
1051
+ postStatus = "draft";
1052
+ } else if (post.status === "pending") {
1053
+ /*
1054
+ * If the status of the post was a pending we leave it as a draft
1055
+ */
1056
+ postStatus = "pending";
1057
+ } else {
1058
+ /*
1059
+ If the post status was published or future we need to adjust
1060
+ it. If you take a post that is published a move it after
1061
+ the current day we change the status to future. If the post
1062
+ was scheduled to get published in the future and they drag
1063
+ it into the past we change the status to publish.
1064
+ */
1065
+ var compare = Date.parse(newdateFormatted).compareTo(Date.today());
1066
+ if (compare === -1) {
1067
+ if (post.status === "publish") {
1068
+ postStatus = "publish";
1069
+ } else {
1070
+ postStatus = "draft";
1071
+ }
1072
+
1073
+ } else {
1074
+ postStatus = "future";
1075
+ }
1076
+ }
1077
+
1078
+ var url = edcal.ajax_url + "&action=edcal_changedate&postid=" + post.id +
1079
+ "&postStatus=" + postStatus +
1080
+ "&newdate=" + newdateFormatted + "&olddate=" + edcal.getDayFromDayId(post.date).toString("yyyy-MM-dd");
1081
+
1082
+ jQuery("#post-" + post.id).addClass("loadingclass");
1083
+
1084
+ jQuery.ajax( {
1085
+ url: url,
1086
+ type: "POST",
1087
+ processData: false,
1088
+ timeout: 100000,
1089
+ dataType: "json",
1090
+ success: function(res) {
1091
+ edcal.removePostItem(res.post.date, "post-" + res.post.id);
1092
+ edcal.addPostItem(res.post, res.post.date);
1093
+ edcal.addPostItemDragAndToolltip(res.post.date);
1094
+
1095
+ edcal.output('Finished changing the date of "' + post.title + '" to ' + newdate);
1096
+
1097
+ if (res.error) {
1098
+ /*
1099
+ * If there was an error we need to remove the dropped
1100
+ * post item.
1101
+ */
1102
+ edcal.removePostItem(newdate, "post-" + res.post.id);
1103
+ if (res.error === edcal.CONCURRENCY_ERROR) {
1104
+ edcal.showError("Someone else already moved " + res.post.title);
1105
+ } else if (res.error === edcal.PERMISSION_ERROR) {
1106
+ edcal.showError("You don't have permission to edit posts");
1107
+ } else if (res.error === edcal.NONCE_ERROR) {
1108
+ edcal.showError("Invalid checksum for post. This is commonly a cross-site scripting error.");
1109
+ }
1110
+ }
1111
+ },
1112
+ error: function(xhr) {
1113
+ edcal.showError("There was an error contacting your blog.");
1114
+ if (xhr.responseText) {
1115
+ edcal.output("xhr.responseText: " + xhr.responseText);
1116
+ }
1117
+ }
1118
+ });
1119
+
1120
+ },
1121
+
1122
+ /*
1123
+ Makes an AJAX call to get the posts from the server within the
1124
+ specified dates.
1125
+ */
1126
+ getPosts: function(/*Date*/ from, /*Date*/ to) {
1127
+ edcal.output("Getting posts from " + from.toString("dd-MMM-yyyy") + " to " + to.toString("dd-MMM-yyyy"));
1128
+
1129
+ var shouldGet = edcal.cacheDates[from];
1130
+
1131
+ if (shouldGet) {
1132
+ /*
1133
+ * TODO: We don't want to make extra AJAX calls for dates
1134
+ * that we have already coverred. This is cutting down on
1135
+ * it somewhat, but we could get much better about this.
1136
+ */
1137
+ edcal.output("Using cached results for posts from " + from.toString("dd-MMM-yyyy") + " to " + to.toString("dd-MMM-yyyy"));
1138
+ return;
1139
+ }
1140
+
1141
+ edcal.cacheDates[from] = true;
1142
+
1143
+
1144
+ var url = edcal.ajax_url + "&action=edcal_posts&from=" + from.toString("yyyy-MM-dd") + "&to=" + to.toString("yyyy-MM-dd");
1145
+ edcal.output("Calling AJAX URL: " + url);
1146
+
1147
+ jQuery("#loading").show();
1148
+
1149
+ jQuery.ajax( {
1150
+ url: url,
1151
+ type: "GET",
1152
+ processData: false,
1153
+ timeout: 100000,
1154
+ dataType: "text",
1155
+ success: function(res) {
1156
+ jQuery("#loading").hide();
1157
+ /*
1158
+ * These result here can get pretty large on a busy blog and
1159
+ * the JSON parser from JSON.org works faster than the native
1160
+ * one used by JQuery.
1161
+ */
1162
+ var parsedRes = JSON.parseIt(res);
1163
+
1164
+ if (parsedRes.error) {
1165
+ /*
1166
+ * If there was an error we need to remove the dropped
1167
+ * post item.
1168
+ */
1169
+ if (parsedRes.error === edcal.NONCE_ERROR) {
1170
+ edcal.showError("Invalid checksum for post. This is commonly a cross-site scripting error.");
1171
+ }
1172
+ return;
1173
+ }
1174
+ var postDates = [];
1175
+ jQuery.each(parsedRes, function(i, post) {
1176
+ if (post) {
1177
+ edcal.removePostItem(post.date, "post-" + post.id);
1178
+ edcal.addPostItem(post, post.date);
1179
+ postDates[postDates.length] = post.date;
1180
+ }
1181
+ });
1182
+
1183
+ /*
1184
+ * If the blog has a very larger number of posts then adding
1185
+ * them all can make the UI a little slow. Particularly IE
1186
+ * pops up a warning giving the user a chance to abort the
1187
+ * script. Adding tooltips and making the items draggable is
1188
+ * a lot of what makes things slow. Delaying those two operations
1189
+ * makes the UI show up much faster and the user has to wait
1190
+ * three seconds before they can drag. It also makes IE
1191
+ * stop complaining.
1192
+ */
1193
+ setTimeout(function() {
1194
+ edcal.output("Finished adding tooltips and draggable support to " + postDates.length + " posts.");
1195
+ jQuery.each(postDates, function(i, postDate) {
1196
+ edcal.addPostItemDragAndToolltip(postDate);
1197
+ });
1198
+ }, 300);
1199
+ },
1200
+ error: function(xhr) {
1201
+ edcal.showError("There was an error contacting your blog.");
1202
+ if (xhr.responseText) {
1203
+ edcal.output("xhr.responseText: " + xhr.responseText);
1204
+ }
1205
+ }
1206
+ });
1207
+ },
1208
+
1209
+ /**
1210
+ * Outputs info messages to the Firebug console if it is available.
1211
+ *
1212
+ * @param msg the message to write
1213
+ */
1214
+ output: function(msg) {
1215
+ if (window.console) {
1216
+ console.info(msg);
1217
+ }
1218
+ },
1219
+
1220
+ /*
1221
+ * Shows an error message and sends the message as an error to the
1222
+ * Firebug console if it is available.
1223
+ */
1224
+ showError: function(/*string*/ msg) {
1225
+ if (window.console) {
1226
+ console.error(msg);
1227
+ }
1228
+ humanMsg.displayMsg(msg);
1229
+ }
1230
+ };
1231
+
1232
+ jQuery(document).ready(function(){
1233
+ edcal.init();
1234
+ });
1235
+
1236
+ /*
1237
+ * This code is from the JQuery URL Encode plugin (http://plugins.jquery.com/project/URLEncode);
1238
+ */
1239
+ jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
1240
+ while(x<c.length){var m=r.exec(c.substr(x));
1241
+ if(m!==null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
1242
+ }else{if(c[x]===' '){o+='+';}else{var d=c.charCodeAt(x);var h=d.toString(16);
1243
+ o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
1244
+ URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
1245
+ while((m=r.exec(o))!==null && m.length>1 && m[1]!==''){b=parseInt(m[1].substr(1),16);
1246
+ t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
1247
+ });
1248
+
edcal.php CHANGED
@@ -18,7 +18,7 @@
18
  /*
19
  Plugin Name: WordPress Editorial Calendar
20
  Description: An editorial calendar for managing the dates of your WordPress posts
21
- Version: 0.3
22
  Author: Mary Vogt and Zack Grossbart
23
  Author URI: http://www.zackgrossbart.com
24
  */
@@ -30,13 +30,28 @@ add_action('admin_menu', 'edcal_list_add_management_page');
30
  add_action('wp_ajax_edcal_posts', 'edcal_posts' );
31
  add_action("admin_print_scripts", 'edcal_scripts');
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /*
34
  * This function adds our calendar page to the admin UI
35
  */
36
  function edcal_list_add_management_page( ) {
37
- if ( function_exists('add_management_page') ) {
38
- $page = add_posts_page( 'Calendar', 'Calendar', 'manage_categories', 'posts_list', 'edcal_list_admin' );
39
- }
40
  }
41
 
42
  /*
@@ -45,10 +60,10 @@ function edcal_list_add_management_page( ) {
45
  * files and cut down on the number of HTTP requests.
46
  */
47
  function echoEdCalFile($myFile) {
48
- $fh = fopen($myFile, 'r');
49
- $theData = fread($fh, filesize($myFile));
50
- fclose($fh);
51
- echo $theData;
52
  }
53
 
54
  /*
@@ -56,96 +71,96 @@ function echoEdCalFile($myFile) {
56
  * generates the divs that we need for the JavaScript to work.
57
  */
58
  function edcal_list_admin() {
59
- include_once('edcal.php');
60
-
61
-
62
- /*
63
- * This section of code embeds certain CSS and
64
- * JavaScript files into the HTML. This has the
65
- * advantage of fewer HTTP requests, but the
66
- * disadvantage that the browser can't cache the
67
- * results. We only do this for files that will
68
- * be used on this page and nowhere else.
69
- */
70
-
71
- echo '<!-- This is the styles from jquery.tooltip.css -->';
72
- echo '<style type="text/css">';
73
- echoEdCalFile(dirname( __FILE__ ) . "/lib/jquery.tooltip.css");
74
- echo '</style>';
75
-
76
- echo '<!-- This is the styles from humanmsg.css -->';
77
- echo '<style type="text/css">';
78
- echoEdCalFile(dirname( __FILE__ ) . "/lib/humanmsg.css");
79
- echo '</style>';
80
-
81
- echo '<!-- This is the styles from edcal.css -->';
82
- echo '<style type="text/css">';
83
- echoEdCalFile(dirname( __FILE__ ) . "/edcal.css");
84
- echo '</style>';
85
-
86
- ?>
87
- <!-- This is just a little script so we can pass the AJAX URL -->
88
- <script type="text/javascript">
89
- jQuery(document).ready(function(){
90
- edcal.ajax_url = '<?php echo admin_url("admin-ajax.php"); ?>';
91
- });
92
- </script>
93
 
94
- <style type="text/css">
95
- .loadingclass {
96
- background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/loading_post.gif")); ?>');
97
- }
98
 
99
- .loadingclass:hover {
100
- background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/loading_post_hover.gif")); ?>');
101
- }
102
 
103
- #loading {
104
- background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/loading.gif")); ?>');
105
- }
106
 
107
- #tipclose {
108
- background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/tip_close.gif")); ?>');
109
- }
110
- </style>
111
-
112
- <?php
113
- echo '<!-- This is the code from edcal.js -->';
114
- echo '<script type="text/javascript">';
115
- echoEdCalFile(dirname( __FILE__ ) . "/edcal.js");
116
- echo '</script>';
117
-
118
- ?>
119
-
120
- <div class="wrap">
121
- <div class="icon32" id="icon-edit"><br/></div>
122
- <h2>Posts Calendar</h2>
123
-
124
- <div id="loadingcont">
125
- <div id="loading"> </div>
126
- </div>
127
-
128
- <div id="topbar">
129
- <div id="topleft">
130
- <h2>
131
- <a href="#" title="Go back four weeks." class="prev page-numbers" id="prevmonth" style="border: none;">&laquo;</a>
132
- <span id="currentRange"></span>
133
- <a href="#" title="Skip ahead four weeks." class="next page-numbers" id="nextmonth" style="border: none;">&raquo;</a>
134
- </h2>
135
- </div>
136
-
137
- <div id="topright">
138
- <a href="#" id="moveToToday">Today</a>
139
- </div>
140
- </div>
141
-
142
- <div id="rowhead"></div>
143
- <div id="edcal_scrollable" class="edcal_scrollable vertical">
144
- <div id="cal"></div>
145
- </div>
146
- </div>
147
-
148
- <?php
149
  }
150
 
151
  /*
@@ -161,14 +176,14 @@ $edcal_endDate;
161
  * we want.
162
  */
163
  function edcal_filter_where($where = '') {
164
- global $edcal_startDate, $edcal_endDate;
165
- //posts in the last 30 days
166
- //$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
167
- //posts 30 to 60 days old
168
- //$where .= " AND post_date >= '" . date('Y-m-d', strtotime('-60 days')) . "'" . " AND post_date <= '" . date('Y-m-d', strtotime('-30 days')) . "'";
169
- //posts for March 1 to March 15, 2009
170
- $where .= " AND post_date >= '" . $edcal_startDate . "' AND post_date < '" . $edcal_endDate . "'";
171
- return $where;
172
  }
173
 
174
  /*
@@ -176,29 +191,29 @@ function edcal_filter_where($where = '') {
176
  *
177
  */
178
  function edcal_scripts() {
179
- wp_enqueue_script( "edcal-lib", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/edcallib.min.js"), array( 'jquery' ) );
180
- return;
181
-
182
- /*
183
- * If you're using one of the specific libraries you should comment out the two lines
184
- * above this comment.
185
- */
186
-
187
- wp_enqueue_script( "ui-core", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/ui.core.js"), array( 'jquery' ) );
188
- wp_enqueue_script( "ui-draggable", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/ui.draggable.js"), array( 'jquery' ) );
189
- wp_enqueue_script( "ui-droppable", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/ui.droppable.js"), array( 'jquery' ) );
190
-
191
-
192
- wp_enqueue_script( "bgiframe", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/jquery.bgiframe.js"), array( 'jquery' ) );
193
- wp_enqueue_script( "tooltip", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/jquery.tooltip.js"), array( 'jquery' ) );
194
- wp_enqueue_script( "humanMsg", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/humanmsg.js"), array( 'jquery' ) );
195
-
196
 
197
- wp_enqueue_script( "date", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/date.js"), array( 'jquery' ) );
198
- wp_enqueue_script( "scrollable", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/tools.scrollable-1.1.2.js"), array( 'jquery' ) );
199
- wp_enqueue_script( "mouse-wheel", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/tools.scrollable.mousewheel-1.0.1.js"), array( 'jquery' ) );
200
 
201
- wp_enqueue_script( "json-parse2", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/json2.js"), array( 'jquery' ) );
202
  }
203
 
204
  /*
@@ -206,43 +221,47 @@ function edcal_scripts() {
206
  * and the to date.
207
  */
208
  function edcal_posts() {
209
- header("Content-Type: application/json");
210
- global $edcal_startDate, $edcal_endDate;
211
- $edcal_startDate = isset($_GET['from'])?$_GET['from']:null;
212
- $edcal_endDate = isset($_GET['to'])?$_GET['to']:null;
213
- global $post;
214
- $args = array(
215
- 'posts_per_page' => -1,
216
- 'post_status' => "publish&future&draft",
217
- 'post_parent' => null, // any parent
218
- 'post_type' => 'post',
219
- );
220
-
221
- add_filter('posts_where', 'edcal_filter_where');
222
- $myposts = query_posts($args);
223
- remove_filter('posts_where', 'edcal_filter_where');
224
-
225
- ?>[
226
- <?php
227
-
228
- foreach($myposts as $post) {
229
- /*
230
- * Sticky posts are ones that stick to the front page.
231
- * They do technically have a date, but it doesn't
232
- * really make sense to drag and drop them around since
233
- * the user has already indicated that they want them
234
- * to stay on the front page.
235
- */
236
-
237
- if (!is_sticky($post->ID)) {
238
- edcal_postJSON($post);
239
- }
240
- }
241
-
242
- ?> ]
243
- <?php
244
-
245
- die;
 
 
 
 
246
  }
247
 
248
  /*
@@ -251,27 +270,27 @@ function edcal_posts() {
251
  * value part.
252
  */
253
  function edcal_postJSON($post) {
254
- setup_postdata($post);
255
- ?>
256
- {
257
- "date" : "<?php the_time('d') ?><?php the_time('M') ?><?php the_time('Y') ?>",
258
- "time" : "<?php the_time() ?>",
259
- "url" : "<?php the_permalink(); ?>",
260
- "status" : "<?php echo(get_post_status()); ?>",
261
- "title" : "<?php the_title(); ?>",
262
- "author" : "<?php the_author(); ?>",
263
- <?php if ( current_user_can('edit_post', $post->ID) ) {?>
264
- "editlink" : "<?php echo(get_edit_post_link($id)); ?>",
265
- <?php } ?>
266
 
267
- <?php if ( current_user_can('delete_post', $post->ID) ) {?>
268
- "dellink" : "<?php echo(wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID)); ?>",
269
- <?php } ?>
270
 
271
- "permalink" : "<?php echo(get_permalink($id)); ?>",
272
- "id" : "<?php the_ID(); ?>"
273
- },
274
- <?php
275
  }
276
 
277
  /*
@@ -280,42 +299,46 @@ function edcal_postJSON($post) {
280
  * post title in a calendar.
281
  */
282
  function edcal_changetitle() {
283
- header("Content-Type: application/json");
284
- $edcal_postid = isset($_GET['postid'])?$_GET['postid']:null;
285
- $edcal_newTitle = isset($_GET['title'])?$_GET['title']:null;
286
-
287
- $post = get_post($edcal_postid, ARRAY_A);
288
- setup_postdata($post);
289
-
290
- $post['post_title'] = $edcal_newTitle;
291
-
292
- /*
293
- * Now we finally update the post into the database
294
- */
295
- wp_update_post( $post );
296
-
297
- /*
298
- * We finish by returning the latest data for the post in the JSON
299
- */
300
- global $post;
301
- $args = array(
302
- 'posts_id' => $edcal_postid,
303
- );
304
-
305
- $post = get_post($edcal_postid);
306
-
307
- ?>{
308
- "post" :
309
- <?php
310
-
311
- edcal_postJSON($post);
312
-
313
- ?>
314
- }
315
- <?php
316
-
317
-
318
- die;
 
 
 
 
319
  }
320
 
321
  /*
@@ -323,39 +346,67 @@ function edcal_changetitle() {
323
  * post on a specified date.
324
  */
325
  function edcal_newdraft() {
326
- header("Content-Type: application/json");
327
- $edcal_date = isset($_GET['date'])?$_GET['date']:null;
328
-
329
- $my_post = array();
330
- $my_post['post_title'] = ' ';
331
- $my_post['post_status'] = 'draft';
332
-
333
- $my_post['post_date'] = $edcal_date;
334
- $my_post['post_date_gmt'] = $edcal_date;
335
- $my_post['post_modified'] = $edcal_date;
336
- $my_post['post_modified_gmt'] = $edcal_date;
337
-
338
- // Insert the post into the database
339
- $my_post_id = wp_insert_post( $my_post );
340
-
341
-
342
- /*
343
- * We finish by returning the latest data for the post in the JSON
344
- */
345
- global $post;
346
- $args = array(
347
- 'posts_id' => $edcal_postid,
348
- );
349
-
350
- $post = get_post($edcal_postid);
351
- ?>{
352
- "newpostid" : "<?php echo($my_post_id); ?>",
353
- "editlink" : "<?php echo(get_edit_post_link($my_post_id)); ?>",
354
- }
355
-
356
- <?php
357
-
358
- die;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  }
360
 
361
  /*
@@ -367,141 +418,151 @@ function edcal_newdraft() {
367
  * If the call is successful then it returns the updated post data.
368
  */
369
  function edcal_changedate() {
370
- if (!current_user_can('edit_others_posts')) {
371
- /*
372
- * This is just a sanity check to make sure that the current
373
- * user has permission to edit posts. Most of the time this
374
- * will never be run because you can't see the calendar unless
375
- * you are at least an editor
376
- */
377
- ?>
378
- {
379
- "error": 5,
380
- <?php
381
-
382
- global $post;
383
- $args = array(
384
- 'posts_id' => $edcal_postid,
385
- );
386
-
387
- $post = get_post($edcal_postid);
388
- ?>
389
- "post" :
390
- <?php
391
- edcal_postJSON($post);
392
- ?> }
393
-
394
- <?php
395
- }
396
-
397
- header("Content-Type: application/json");
398
- global $edcal_startDate, $edcal_endDate;
399
- $edcal_postid = isset($_GET['postid'])?$_GET['postid']:null;
400
- $edcal_newDate = isset($_GET['newdate'])?$_GET['newdate']:null;
401
- $edcal_oldDate = isset($_GET['olddate'])?$_GET['olddate']:null;
402
- $edcal_postStatus = isset($_GET['postStatus'])?$_GET['postStatus']:null;
403
-
404
- $post = get_post($edcal_postid, ARRAY_A);
405
- setup_postdata($post);
406
-
407
- $matches = strpos($post['post_date'], $edcal_oldDate) === 0;
408
-
409
- /*
410
- * We are doing optimistic concurrency checking on the dates. If
411
- * the user tries to move a post we want to make sure nobody else
412
- * has moved that post since the page was last updated. If the
413
- * old date in the database doesn't match the old date from the
414
- * browser then we return an error to the browser along with the
415
- * updated post data.
416
- */
417
-
418
- if ($matches != 1) {
419
- ?> {
420
- "error": 4,
421
- <?php
422
-
423
- global $post;
424
- $args = array(
425
- 'posts_id' => $edcal_postid,
426
- );
427
-
428
- $post = get_post($edcal_postid);
429
- ?>
430
- "post" :
431
- <?php
432
- edcal_postJSON($post);
433
- ?> }
434
-
435
- <?php
436
- die();
437
- }
438
-
439
- /*
440
- * Posts in WordPress have more than one date. There is the GMT date,
441
- * the date in the local time zone, the modified date in GMT and the
442
- * modified date in the local time zone. We update all of them.
443
- */
444
- $post['post_date_gmt'] = $post['post_date'];
445
-
446
- /*
447
- * When a user creates a draft and never sets a date or publishes it
448
- * then the GMT date will have a timestamp of 00:00:00 to indicate
449
- * that the date hasn't been set. In that case we need to specify
450
- * an edit date or the wp_update_post function will strip our new
451
- * date out and leave the post as publish immediately.
452
- */
453
- $needsEditDate = strpos($post['post_date_gmt'], "0000-00-00 00:00:00") === 0;
454
-
455
- $updated_post = array();
456
- $updated_post['ID'] = $edcal_postid;
457
- $updated_post['post_date'] = $edcal_newDate . substr($post['post_date'], strlen($edcal_newDate));
458
- if ($needsEditDate != -1) {
459
- $updated_post['edit_date'] = $edcal_newDate . substr($post['post_date'], strlen($edcal_newDate));
460
- }
461
- $updated_post['post_date_gmt'] = $edcal_newDate . substr($post['post_date_gmt'], strlen($edcal_newDate));
462
- $updated_post['post_modified'] = $edcal_newDate . substr($post['post_modified'], strlen($edcal_newDate));
463
- $updated_post['post_modified_gmt'] = $edcal_newDate . substr($post['post_modified_gmt'], strlen($edcal_newDate));
464
-
465
- if ( $edcal_postStatus != $post['post_status'] ) {
466
- /*
467
- * We only want to update the post status if it has changed.
468
- * If the post status has changed that takes a few more steps
469
- */
470
- wp_transition_post_status($edcal_postStatus, $post['post_status'], $post);
471
- $updated_post['post_status'] = $edcal_postStatus;
472
-
473
- // Update counts for the post's terms.
474
- foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
475
- $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
476
- wp_update_term_count($tt_ids, $taxonomy);
477
- }
478
-
479
- do_action('edit_post', $edcal_postid, $post);
480
- do_action('save_post', $edcal_postid, $post);
481
- do_action('wp_insert_post', $edcal_postid, $post);
482
- }
483
-
484
- /*
485
- * Now we finally update the post into the database
486
- */
487
- wp_update_post( $updated_post );
488
-
489
- /*
490
- * We finish by returning the latest data for the post in the JSON
491
- */
492
- global $post;
493
- $args = array(
494
- 'posts_id' => $edcal_postid,
495
- );
496
-
497
- $post = get_post($edcal_postid);
498
- ?>{
499
- "post" :
500
-
501
- <?php
502
- edcal_postJSON($post);
503
- ?>}
504
- <?php
505
-
506
- die;
 
 
 
 
 
 
 
 
 
 
507
  }
18
  /*
19
  Plugin Name: WordPress Editorial Calendar
20
  Description: An editorial calendar for managing the dates of your WordPress posts
21
+ Version: 0.4
22
  Author: Mary Vogt and Zack Grossbart
23
  Author URI: http://www.zackgrossbart.com
24
  */
30
  add_action('wp_ajax_edcal_posts', 'edcal_posts' );
31
  add_action("admin_print_scripts", 'edcal_scripts');
32
 
33
+ /*
34
+ * This error code matches CONCURRENCY_ERROR from edcal.js
35
+ */
36
+ $EDCAL_CONCURRENCY_ERROR = "4";
37
+
38
+ /*
39
+ * This error code matches NONCE_ERROR from edcal.js
40
+ */
41
+ $EDCAL_PERMISSION_ERROR = "5";
42
+
43
+ /*
44
+ * This error code matches NONCE_ERROR from edcal.js
45
+ */
46
+ $EDCAL_NONCE_ERROR = "6";
47
+
48
  /*
49
  * This function adds our calendar page to the admin UI
50
  */
51
  function edcal_list_add_management_page( ) {
52
+ if ( function_exists('add_management_page') ) {
53
+ $page = add_posts_page( 'Calendar', 'Calendar', 'manage_categories', 'posts_list', 'edcal_list_admin' );
54
+ }
55
  }
56
 
57
  /*
60
  * files and cut down on the number of HTTP requests.
61
  */
62
  function echoEdCalFile($myFile) {
63
+ $fh = fopen($myFile, 'r');
64
+ $theData = fread($fh, filesize($myFile));
65
+ fclose($fh);
66
+ echo $theData;
67
  }
68
 
69
  /*
71
  * generates the divs that we need for the JavaScript to work.
72
  */
73
  function edcal_list_admin() {
74
+ include_once('edcal.php');
75
+
76
+
77
+ /*
78
+ * This section of code embeds certain CSS and
79
+ * JavaScript files into the HTML. This has the
80
+ * advantage of fewer HTTP requests, but the
81
+ * disadvantage that the browser can't cache the
82
+ * results. We only do this for files that will
83
+ * be used on this page and nowhere else.
84
+ */
85
+
86
+ echo '<!-- This is the styles from jquery.tooltip.css -->';
87
+ echo '<style type="text/css">';
88
+ echoEdCalFile(dirname( __FILE__ ) . "/lib/jquery.tooltip.css");
89
+ echo '</style>';
90
+
91
+ echo '<!-- This is the styles from humanmsg.css -->';
92
+ echo '<style type="text/css">';
93
+ echoEdCalFile(dirname( __FILE__ ) . "/lib/humanmsg.css");
94
+ echo '</style>';
95
+
96
+ echo '<!-- This is the styles from edcal.css -->';
97
+ echo '<style type="text/css">';
98
+ echoEdCalFile(dirname( __FILE__ ) . "/edcal.css");
99
+ echo '</style>';
100
+
101
+ ?>
102
+ <!-- This is just a little script so we can pass the AJAX URL -->
103
+ <script type="text/javascript">
104
+ jQuery(document).ready(function(){
105
+ edcal.ajax_url = '<?php echo wp_nonce_url(admin_url("admin-ajax.php"), "edit-calendar"); ?>';
106
+ });
107
+ </script>
108
 
109
+ <style type="text/css">
110
+ .loadingclass, .tiploading {
111
+ background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/loading_post.gif")); ?>');
112
+ }
113
 
114
+ .loadingclass:hover {
115
+ background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/loading_post_hover.gif")); ?>');
116
+ }
117
 
118
+ #loading {
119
+ background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/loading.gif")); ?>');
120
+ }
121
 
122
+ #tipclose {
123
+ background-image: url('<?php echo(path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/images/tip_close.gif")); ?>');
124
+ }
125
+ </style>
126
+
127
+ <?php
128
+ echo '<!-- This is the code from edcal.js -->';
129
+ echo '<script type="text/javascript">';
130
+ echoEdCalFile(dirname( __FILE__ ) . "/edcal.js");
131
+ echo '</script>';
132
+
133
+ ?>
134
+
135
+ <div class="wrap">
136
+ <div class="icon32" id="icon-edit"><br/></div>
137
+ <h2>Posts Calendar</h2>
138
+
139
+ <div id="loadingcont">
140
+ <div id="loading"> </div>
141
+ </div>
142
+
143
+ <div id="topbar">
144
+ <div id="topleft">
145
+ <h2>
146
+ <a href="#" title="Go back four weeks." class="prev page-numbers" id="prevmonth" style="border: none;">&laquo;</a>
147
+ <span id="currentRange"></span>
148
+ <a href="#" title="Skip ahead four weeks." class="next page-numbers" id="nextmonth" style="border: none;">&raquo;</a>
149
+ </h2>
150
+ </div>
151
+
152
+ <div id="topright">
153
+ <a href="#" id="moveToToday">Today</a>
154
+ </div>
155
+ </div>
156
+
157
+ <div id="rowhead"></div>
158
+ <div id="edcal_scrollable" class="edcal_scrollable vertical">
159
+ <div id="cal"></div>
160
+ </div>
161
+ </div>
162
+
163
+ <?php
164
  }
165
 
166
  /*
176
  * we want.
177
  */
178
  function edcal_filter_where($where = '') {
179
+ global $edcal_startDate, $edcal_endDate;
180
+ //posts in the last 30 days
181
+ //$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
182
+ //posts 30 to 60 days old
183
+ //$where .= " AND post_date >= '" . date('Y-m-d', strtotime('-60 days')) . "'" . " AND post_date <= '" . date('Y-m-d', strtotime('-30 days')) . "'";
184
+ //posts for March 1 to March 15, 2009
185
+ $where .= " AND post_date >= '" . $edcal_startDate . "' AND post_date < '" . $edcal_endDate . "'";
186
+ return $where;
187
  }
188
 
189
  /*
191
  *
192
  */
193
  function edcal_scripts() {
194
+ //wp_enqueue_script( "edcal-lib", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/edcallib.min.js"), array( 'jquery' ) );
195
+ //return;
196
+
197
+ /*
198
+ * If you're using one of the specific libraries you should comment out the two lines
199
+ * above this comment.
200
+ */
201
+
202
+ wp_enqueue_script( "ui-core", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/ui.core.js"), array( 'jquery' ) );
203
+ wp_enqueue_script( "ui-draggable", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/ui.draggable.js"), array( 'jquery' ) );
204
+ wp_enqueue_script( "ui-droppable", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/ui.droppable.js"), array( 'jquery' ) );
205
+
206
+
207
+ wp_enqueue_script( "bgiframe", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/jquery.bgiframe.js"), array( 'jquery' ) );
208
+ wp_enqueue_script( "tooltip", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/jquery.tooltip.js"), array( 'jquery' ) );
209
+ wp_enqueue_script( "humanMsg", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/humanmsg.js"), array( 'jquery' ) );
210
+
211
 
212
+ wp_enqueue_script( "date", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/date.js"), array( 'jquery' ) );
213
+ wp_enqueue_script( "scrollable", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/tools.scrollable-1.1.2.js"), array( 'jquery' ) );
214
+ wp_enqueue_script( "mouse-wheel", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/tools.scrollable.mousewheel-1.0.1.js"), array( 'jquery' ) );
215
 
216
+ wp_enqueue_script( "json-parse2", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/lib/json2.js"), array( 'jquery' ) );
217
  }
218
 
219
  /*
221
  * and the to date.
222
  */
223
  function edcal_posts() {
224
+ header("Content-Type: application/json");
225
+ if (!edcal_checknonce()) {
226
+ die();
227
+ }
228
+
229
+ global $edcal_startDate, $edcal_endDate;
230
+ $edcal_startDate = isset($_GET['from'])?$_GET['from']:null;
231
+ $edcal_endDate = isset($_GET['to'])?$_GET['to']:null;
232
+ global $post;
233
+ $args = array(
234
+ 'posts_per_page' => -1,
235
+ 'post_status' => "publish&future&draft",
236
+ 'post_parent' => null, // any parent
237
+ 'post_type' => 'post',
238
+ );
239
+
240
+ add_filter('posts_where', 'edcal_filter_where');
241
+ $myposts = query_posts($args);
242
+ remove_filter('posts_where', 'edcal_filter_where');
243
+
244
+ ?>[
245
+ <?php
246
+
247
+ foreach($myposts as $post) {
248
+ /*
249
+ * Sticky posts are ones that stick to the front page.
250
+ * They do technically have a date, but it doesn't
251
+ * really make sense to drag and drop them around since
252
+ * the user has already indicated that they want them
253
+ * to stay on the front page.
254
+ */
255
+
256
+ if (!is_sticky($post->ID)) {
257
+ edcal_postJSON($post);
258
+ }
259
+ }
260
+
261
+ ?> ]
262
+ <?php
263
+
264
+ die();
265
  }
266
 
267
  /*
270
  * value part.
271
  */
272
  function edcal_postJSON($post) {
273
+ setup_postdata($post);
274
+ ?>
275
+ {
276
+ "date" : "<?php the_time('d') ?><?php the_time('M') ?><?php the_time('Y') ?>",
277
+ "time" : "<?php the_time() ?>",
278
+ "url" : "<?php the_permalink(); ?>",
279
+ "status" : "<?php echo(get_post_status()); ?>",
280
+ "title" : "<?php the_title(); ?>",
281
+ "author" : "<?php the_author(); ?>",
282
+ <?php if ( current_user_can('edit_post', $post->ID) ) {?>
283
+ "editlink" : "<?php echo(get_edit_post_link($id)); ?>",
284
+ <?php } ?>
285
 
286
+ <?php if ( current_user_can('delete_post', $post->ID) ) {?>
287
+ "dellink" : "<?php echo(wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID)); ?>",
288
+ <?php } ?>
289
 
290
+ "permalink" : "<?php echo(get_permalink($id)); ?>",
291
+ "id" : "<?php the_ID(); ?>"
292
+ },
293
+ <?php
294
  }
295
 
296
  /*
299
  * post title in a calendar.
300
  */
301
  function edcal_changetitle() {
302
+ if (!edcal_checknonce()) {
303
+ die();
304
+ }
305
+
306
+ header("Content-Type: application/json");
307
+ $edcal_postid = isset($_GET['postid'])?$_GET['postid']:null;
308
+ $edcal_newTitle = isset($_GET['title'])?$_GET['title']:null;
309
+
310
+ $post = get_post($edcal_postid, ARRAY_A);
311
+ setup_postdata($post);
312
+
313
+ $post['post_title'] = $edcal_newTitle;
314
+
315
+ /*
316
+ * Now we finally update the post into the database
317
+ */
318
+ wp_update_post( $post );
319
+
320
+ /*
321
+ * We finish by returning the latest data for the post in the JSON
322
+ */
323
+ global $post;
324
+ $args = array(
325
+ 'posts_id' => $edcal_postid,
326
+ );
327
+
328
+ $post = get_post($edcal_postid);
329
+
330
+ ?>{
331
+ "post" :
332
+ <?php
333
+
334
+ edcal_postJSON($post);
335
+
336
+ ?>
337
+ }
338
+ <?php
339
+
340
+
341
+ die();
342
  }
343
 
344
  /*
346
  * post on a specified date.
347
  */
348
  function edcal_newdraft() {
349
+ if (!edcal_checknonce()) {
350
+ die();
351
+ }
352
+
353
+ header("Content-Type: application/json");
354
+ $edcal_date = isset($_GET['date'])?$_GET['date']:null;
355
+
356
+ $my_post = array();
357
+ $my_post['post_title'] = isset($_GET['title'])?$_GET['title']:null;;
358
+ $my_post['post_status'] = 'draft';
359
+
360
+ $my_post['post_date'] = $edcal_date;
361
+ $my_post['post_date_gmt'] = get_gmt_from_date($edcal_date);
362
+ $my_post['post_modified'] = $edcal_date;
363
+ $my_post['post_modified_gmt'] = get_gmt_from_date($edcal_date);
364
+
365
+ // Insert the post into the database
366
+ $my_post_id = wp_insert_post( $my_post );
367
+
368
+
369
+ /*
370
+ * We finish by returning the latest data for the post in the JSON
371
+ */
372
+ global $post;
373
+ $post = get_post($my_post_id);
374
+ ?>{
375
+ "post" :
376
+ <?php
377
+
378
+ edcal_postJSON($post);
379
+
380
+ ?>
381
+ }
382
+ <?php
383
+
384
+ die();
385
+ }
386
+
387
+ /*
388
+ * This function checks the nonce for the URL. It returns
389
+ * true if the nonce checks out and outputs a JSON error
390
+ * and returns false otherwise.
391
+ */
392
+ function edcal_checknonce() {
393
+ header("Content-Type: application/json");
394
+ global $EDCAL_NONCE_ERROR;
395
+ if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'edit-calendar')) {
396
+ /*
397
+ * This is just a sanity check to make sure
398
+ * this isn't a CSRF attack. Most of the time this
399
+ * will never be run because you can't see the calendar unless
400
+ * you are at least an editor
401
+ */
402
+ ?>
403
+ {
404
+ "error": <?php echo($EDCAL_NONCE_ERROR); ?>
405
+ }
406
+ <?php
407
+ return false;
408
+ }
409
+ return true;
410
  }
411
 
412
  /*
418
  * If the call is successful then it returns the updated post data.
419
  */
420
  function edcal_changedate() {
421
+ if (!edcal_checknonce()) {
422
+ die();
423
+ }
424
+ header("Content-Type: application/json");
425
+ global $edcal_startDate, $edcal_endDate;
426
+ $edcal_postid = isset($_GET['postid'])?$_GET['postid']:null;
427
+ $edcal_newDate = isset($_GET['newdate'])?$_GET['newdate']:null;
428
+ $edcal_oldDate = isset($_GET['olddate'])?$_GET['olddate']:null;
429
+ $edcal_postStatus = isset($_GET['postStatus'])?$_GET['postStatus']:null;
430
+
431
+ if (!current_user_can('edit_others_posts')) {
432
+ global $EDCAL_PERMISSION_ERROR;
433
+ /*
434
+ * This is just a sanity check to make sure that the current
435
+ * user has permission to edit posts. Most of the time this
436
+ * will never be run because you can't see the calendar unless
437
+ * you are at least an editor
438
+ */
439
+ ?>
440
+ {
441
+ "error": <?php echo($EDCAL_PERMISSION_ERROR); ?>,
442
+ <?php
443
+
444
+ global $post;
445
+ $args = array(
446
+ 'posts_id' => $edcal_postid,
447
+ );
448
+
449
+ $post = get_post($edcal_postid);
450
+ ?>
451
+ "post" :
452
+ <?php
453
+ edcal_postJSON($post);
454
+ ?> }
455
+
456
+ <?php
457
+ die();
458
+ }
459
+
460
+ $post = get_post($edcal_postid, ARRAY_A);
461
+ setup_postdata($post);
462
+
463
+ $matches = strpos($post['post_date'], $edcal_oldDate) === 0;
464
+
465
+ /*
466
+ * We are doing optimistic concurrency checking on the dates. If
467
+ * the user tries to move a post we want to make sure nobody else
468
+ * has moved that post since the page was last updated. If the
469
+ * old date in the database doesn't match the old date from the
470
+ * browser then we return an error to the browser along with the
471
+ * updated post data.
472
+ */
473
+
474
+ if ($matches != 1) {
475
+ global $EDCAL_CONCURRENCY_ERROR;
476
+ ?> {
477
+ "error": <?php echo($EDCAL_CONCURRENCY_ERROR); ?>,
478
+ <?php
479
+
480
+ global $post;
481
+ $args = array(
482
+ 'posts_id' => $edcal_postid,
483
+ );
484
+
485
+ $post = get_post($edcal_postid);
486
+ ?>
487
+ "post" :
488
+ <?php
489
+ edcal_postJSON($post);
490
+ ?> }
491
+
492
+ <?php
493
+ die();
494
+ }
495
+
496
+ /*
497
+ * Posts in WordPress have more than one date. There is the GMT date,
498
+ * the date in the local time zone, the modified date in GMT and the
499
+ * modified date in the local time zone. We update all of them.
500
+ */
501
+ $post['post_date_gmt'] = $post['post_date'];
502
+
503
+ /*
504
+ * When a user creates a draft and never sets a date or publishes it
505
+ * then the GMT date will have a timestamp of 00:00:00 to indicate
506
+ * that the date hasn't been set. In that case we need to specify
507
+ * an edit date or the wp_update_post function will strip our new
508
+ * date out and leave the post as publish immediately.
509
+ */
510
+ $needsEditDate = strpos($post['post_date_gmt'], "0000-00-00 00:00:00") === 0;
511
+
512
+ $updated_post = array();
513
+ $updated_post['ID'] = $edcal_postid;
514
+ $updated_post['post_date'] = $edcal_newDate . substr($post['post_date'], strlen($edcal_newDate));
515
+ if ($needsEditDate != -1) {
516
+ $updated_post['edit_date'] = $edcal_newDate . substr($post['post_date'], strlen($edcal_newDate));
517
+ }
518
+
519
+ /*
520
+ * We need to make sure to use the GMT formatting for the date.
521
+ */
522
+ $updated_post['post_date_gmt'] = get_gmt_from_date($updated_post['post_date']);
523
+ $updated_post['post_modified'] = $edcal_newDate . substr($post['post_modified'], strlen($edcal_newDate));
524
+ $updated_post['post_modified_gmt'] = get_gmt_from_date($updated_post['post_date']);
525
+
526
+ if ( $edcal_postStatus != $post['post_status'] ) {
527
+ /*
528
+ * We only want to update the post status if it has changed.
529
+ * If the post status has changed that takes a few more steps
530
+ */
531
+ wp_transition_post_status($edcal_postStatus, $post['post_status'], $post);
532
+ $updated_post['post_status'] = $edcal_postStatus;
533
+
534
+ // Update counts for the post's terms.
535
+ foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
536
+ $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
537
+ wp_update_term_count($tt_ids, $taxonomy);
538
+ }
539
+
540
+ do_action('edit_post', $edcal_postid, $post);
541
+ do_action('save_post', $edcal_postid, $post);
542
+ do_action('wp_insert_post', $edcal_postid, $post);
543
+ }
544
+
545
+ /*
546
+ * Now we finally update the post into the database
547
+ */
548
+ wp_update_post( $updated_post );
549
+
550
+ /*
551
+ * We finish by returning the latest data for the post in the JSON
552
+ */
553
+ global $post;
554
+ $args = array(
555
+ 'posts_id' => $edcal_postid,
556
+ );
557
+
558
+ $post = get_post($edcal_postid);
559
+ ?>{
560
+ "post" :
561
+
562
+ <?php
563
+ edcal_postJSON($post);
564
+ ?>}
565
+ <?php
566
+
567
+ die();
568
  }
lib/edcallib.min.js CHANGED
@@ -6,102 +6,68 @@ tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:
6
  PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};Date.getMonthNumberFromName=function(b){var c=Date.CultureInfo.monthNames,d=Date.CultureInfo.abbreviatedMonthNames;b=b.toLowerCase();for(var e=0;e<c.length;e++)if(c[e].toLowerCase()==b||d[e].toLowerCase()==b)return e;return-1};
7
  Date.getDayNumberFromName=function(b){var c=Date.CultureInfo.dayNames,d=Date.CultureInfo.abbreviatedDayNames;b=b.toLowerCase();for(var e=0;e<c.length;e++)if(c[e].toLowerCase()==b||d[e].toLowerCase()==b)return e;return-1};Date.isLeapYear=function(b){return b%4===0&&b%100!==0||b%400===0};Date.getDaysInMonth=function(b,c){return[31,Date.isLeapYear(b)?29:28,31,30,31,30,31,31,30,31,30,31][c]};Date.getTimezoneOffset=function(b,c){return c?Date.CultureInfo.abbreviatedTimeZoneDST[b.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[b.toUpperCase()]};
8
  Date.getTimezoneAbbreviation=function(b,c){c=c?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard;var d;for(d in c)if(c[d]===b)return d;return null};a=Date.prototype;a.clone=function(){return new Date(this.getTime())};a.compareTo=function(b){if(isNaN(this))throw new Error(this);if(b instanceof Date&&!isNaN(b))return this>b?1:this<b?-1:0;else throw new TypeError(b);};a.equals=function(b){return this.compareTo(b)===0};
9
- a.between=function(b,c){var d=this.getTime();return d>=b.getTime()&&d<=c.getTime()};a.addMilliseconds=function(b){this.setMilliseconds(this.getMilliseconds()+b);return this};a.addSeconds=function(b){return this.addMilliseconds(b*1000)};a.addMinutes=function(b){return this.addMilliseconds(b*60000)};a.addHours=function(b){return this.addMilliseconds(b*3600000)};a.addDays=function(b){return this.addMilliseconds(b*86400000)};a.addWeeks=function(b){return this.addMilliseconds(b*604800000)};
10
  a.addMonths=function(b){var c=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+b);this.setDate(Math.min(c,this.getDaysInMonth()));return this};a.addYears=function(b){return this.addMonths(b*12)};
11
- a.add=function(b){if(typeof b=="number"){this._orient=b;return this}b=b;if(b.millisecond||b.milliseconds)this.addMilliseconds(b.millisecond||b.milliseconds);if(b.second||b.seconds)this.addSeconds(b.second||b.seconds);if(b.minute||b.minutes)this.addMinutes(b.minute||b.minutes);if(b.hour||b.hours)this.addHours(b.hour||b.hours);if(b.month||b.months)this.addMonths(b.month||b.months);if(b.year||b.years)this.addYears(b.year||b.years);if(b.day||b.days)this.addDays(b.day||b.days);return this};
12
  Date._validate=function(b,c,d,e){if(typeof b!="number")throw new TypeError(b+" is not a Number.");else if(b<c||b>d)throw new RangeError(b+" is not a valid value for "+e+".");return true};Date.validateMillisecond=function(b){return Date._validate(b,0,999,"milliseconds")};Date.validateSecond=function(b){return Date._validate(b,0,59,"seconds")};Date.validateMinute=function(b){return Date._validate(b,0,59,"minutes")};Date.validateHour=function(b){return Date._validate(b,0,23,"hours")};
13
  Date.validateDay=function(b,c,d){return Date._validate(b,1,Date.getDaysInMonth(c,d),"days")};Date.validateMonth=function(b){return Date._validate(b,0,11,"months")};Date.validateYear=function(b){return Date._validate(b,1,9999,"seconds")};a=Date.prototype;
14
- a.set=function(b){b=b;if(!b.millisecond&&b.millisecond!==0)b.millisecond=-1;if(!b.second&&b.second!==0)b.second=-1;if(!b.minute&&b.minute!==0)b.minute=-1;if(!b.hour&&b.hour!==0)b.hour=-1;if(!b.day&&b.day!==0)b.day=-1;if(!b.month&&b.month!==0)b.month=-1;if(!b.year&&b.year!==0)b.year=-1;b.millisecond!=-1&&Date.validateMillisecond(b.millisecond)&&this.addMilliseconds(b.millisecond-this.getMilliseconds());b.second!=-1&&Date.validateSecond(b.second)&&this.addSeconds(b.second-this.getSeconds());b.minute!=
15
- -1&&Date.validateMinute(b.minute)&&this.addMinutes(b.minute-this.getMinutes());b.hour!=-1&&Date.validateHour(b.hour)&&this.addHours(b.hour-this.getHours());b.month!==-1&&Date.validateMonth(b.month)&&this.addMonths(b.month-this.getMonth());b.year!=-1&&Date.validateYear(b.year)&&this.addYears(b.year-this.getFullYear());b.day!=-1&&Date.validateDay(b.day,this.getFullYear(),this.getMonth())&&this.addDays(b.day-this.getDate());b.timezone&&this.setTimezone(b.timezone);b.timezoneOffset&&this.setTimezoneOffset(b.timezoneOffset);
16
  return this};a.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};a.isLeapYear=function(){var b=this.getFullYear();return b%4===0&&b%100!==0||b%400===0};a.isWeekday=function(){return!(this.is().sat()||this.is().sun())};a.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};a.moveToFirstDayOfMonth=function(){return this.set({day:1})};a.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};
17
- a.moveToDayOfWeek=function(b,c){b=(b-this.getDay()+7*(c||+1))%7;return this.addDays(b===0?(b+=7*(c||+1)):b)};a.moveToMonth=function(b,c){b=(b-this.getMonth()+12*(c||+1))%12;return this.addMonths(b===0?(b+=12*(c||+1)):b)};a.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000)};
18
- a.getWeekOfYear=function(b){var c=this.getFullYear(),d=this.getMonth(),e=this.getDate();b=b||Date.CultureInfo.firstDayOfWeek;var g=8-(new Date(c,0,1)).getDay();if(g==8)g=1;d=(Date.UTC(c,d,e,0,0,0)-Date.UTC(c,0,1,0,0,0))/86400000+1;d=Math.floor((d-g+7)/7);if(d===b){c--;c=8-(new Date(c,0,1)).getDay();d=c==2||c==8?53:52}return d};a.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};
19
- a.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};a.setTimezoneOffset=function(b){var c=this.getTimezoneOffset();b=Number(b)*-6/10;this.addMinutes(b-c);return this};a.setTimezone=function(b){return this.setTimezoneOffset(Date.getTimezoneOffset(b))};a.getUTCOffset=function(){var b=this.getTimezoneOffset()*-10/6;if(b<0){b=(b-10000).toString();return b[0]+b.substr(2)}else{b=(b+10000).toString();return"+"+b.substr(1)}};
20
  a.getDayName=function(b){return b?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};a.getMonthName=function(b){return b?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};a._toString=Date.prototype.toString;
21
- a.toString=function(b){var c=this;function d(e){return e.toString().length==1?"0"+e:e}return b?b.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(e){switch(e){case "hh":return d(c.getHours()<13?c.getHours():c.getHours()-12);case "h":return c.getHours()<13?c.getHours():c.getHours()-12;case "HH":return d(c.getHours());case "H":return c.getHours();case "mm":return d(c.getMinutes());case "m":return c.getMinutes();case "ss":return d(c.getSeconds());case "s":return c.getSeconds();case "yyyy":return c.getFullYear();
22
- case "yy":return c.getFullYear().toString().substring(2,4);case "dddd":return c.getDayName();case "ddd":return c.getDayName(true);case "dd":return d(c.getDate());case "d":return c.getDate().toString();case "MMMM":return c.getMonthName();case "MMM":return c.getMonthName(true);case "MM":return d(c.getMonth()+1);case "M":return c.getMonth()+1;case "t":return c.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case "tt":return c.getHours()<12?Date.CultureInfo.amDesignator:
23
- Date.CultureInfo.pmDesignator;case "zzz":case "zz":case "z":return""}}):this._toString()};Date.now=function(){return new Date};Date.today=function(){return Date.now().clearTime()};a=Date.prototype;a._orient=+1;a.next=function(){this._orient=+1;return this};a.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};a._is=false;a.is=function(){this._is=true;return this};Number.prototype._dateElement="day";
24
  Number.prototype.fromNow=function(){var b={};b[this._dateElement]=this;return Date.now().add(b)};Number.prototype.ago=function(){var b={};b[this._dateElement]=this*-1;return Date.now().add(b)};
25
- (function(){var b=Date.prototype,c=Number.prototype,d="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),e="january february march april may june july august september october november december".split(/\s/),g="Millisecond Second Minute Hour Day Week Month Year".split(/\s/);function i(j){return function(){if(this._is){this._is=false;return this.getDay()==j}return this.moveToDayOfWeek(j,this._orient)}}for(var k=0;k<d.length;k++)b[d[k]]=b[d[k].substring(0,3)]=i(k);function m(j){return function(){if(this._is){this._is=
26
- false;return this.getMonth()===j}return this.moveToMonth(j,this._orient)}}for(d=0;d<e.length;d++)b[e[d]]=b[e[d].substring(0,3)]=m(d);function h(j){return function(){if(j.substring(j.length-1)!="s")j+="s";return this["add"+j](this._orient)}}function f(j){return function(){this._dateElement=j;return this}}for(d=0;d<g.length;d++){e=g[d].toLowerCase();b[e]=b[e+"s"]=h(g[d]);c[e]=c[e+"s"]=f(e)}})();a=Date.prototype;a.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};
27
  a.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};a.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};a.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};a.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};
28
  a.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};
29
- (function(){Date.Parsing={Exception:function(k){this.message="Parse error at '"+k.substring(0,10)+" ...'"}};var b=Date.Parsing,c=b.Operators={rtoken:function(k){return function(m){var h=m.match(k);if(h)return[h[0],m.substring(h[0].length)];else throw new b.Exception(m);}},token:function(){return function(k){return c.rtoken(new RegExp("^s*"+k+"s*"))(k)}},stoken:function(k){return c.rtoken(new RegExp("^"+k))},until:function(k){return function(m){for(var h=[],f=null;m.length;){try{f=k.call(this,m)}catch(j){h.push(f[0]);
30
- m=f[1];continue}break}return[h,m]}},many:function(k){return function(m){for(var h=[],f=null;m.length;){try{f=k.call(this,m)}catch(j){return[h,m]}h.push(f[0]);m=f[1]}return[h,m]}},optional:function(k){return function(m){var h=null;try{h=k.call(this,m)}catch(f){return[null,m]}return[h[0],h[1]]}},not:function(k){return function(m){try{k.call(this,m)}catch(h){return[null,m]}throw new b.Exception(m);}},ignore:function(k){return k?function(m){var h=null;h=k.call(this,m);return[null,h[1]]}:null},product:function(){for(var k=
31
- arguments[0],m=Array.prototype.slice.call(arguments,1),h=[],f=0;f<k.length;f++)h.push(c.each(k[f],m));return h},cache:function(k){var m={},h=null;return function(f){try{h=m[f]=m[f]||k.call(this,f)}catch(j){h=m[f]=j}if(h instanceof b.Exception)throw h;else return h}},any:function(){var k=arguments;return function(m){for(var h=null,f=0;f<k.length;f++)if(k[f]!=null){try{h=k[f].call(this,m)}catch(j){h=null}if(h)return h}throw new b.Exception(m);}},each:function(){var k=arguments;return function(m){for(var h=
32
- [],f=null,j=0;j<k.length;j++)if(k[j]!=null){try{f=k[j].call(this,m)}catch(n){throw new b.Exception(m);}h.push(f[0]);m=f[1]}return[h,m]}},all:function(){var k=arguments,m=m;return m.each(m.optional(k))},sequence:function(k,m,h){m=m||c.rtoken(/^\s*/);h=h||null;if(k.length==1)return k[0];return function(f){for(var j=null,n=null,p=[],s=0;s<k.length;s++){try{j=k[s].call(this,f)}catch(t){break}p.push(j[0]);try{n=m.call(this,j[1])}catch(q){n=null;break}f=n[1]}if(!j)throw new b.Exception(f);if(n)throw new b.Exception(n[1]);
33
- if(h)try{j=h.call(this,j[1])}catch(u){throw new b.Exception(j[1]);}return[p,j?j[1]:f]}},between:function(k,m,h){h=h||k;var f=c.each(c.ignore(k),m,c.ignore(h));return function(j){j=f.call(this,j);return[[j[0][0],r[0][2]],j[1]]}},list:function(k,m,h){m=m||c.rtoken(/^\s*/);h=h||null;return k instanceof Array?c.each(c.product(k.slice(0,-1),c.ignore(m)),k.slice(-1),c.ignore(h)):c.each(c.many(c.each(k,c.ignore(m))),px,c.ignore(h))},set:function(k,m,h){m=m||c.rtoken(/^\s*/);h=h||null;return function(f){var j=
34
- null;for(var n=j=null,p=null,s=[[],f],t=false,q=0;q<k.length;q++){j=n=null;t=k.length==1;try{j=k[q].call(this,f)}catch(u){continue}p=[[j[0]],j[1]];if(j[1].length>0&&!t)try{n=m.call(this,j[1])}catch(x){t=true}else t=true;if(!t&&n[1].length===0)t=true;if(!t){j=[];for(t=0;t<k.length;t++)q!=t&&j.push(k[t]);j=c.set(j,m).call(this,n[1]);if(j[0].length>0){p[0]=p[0].concat(j[0]);p[1]=j[1]}}if(p[1].length<s[1].length)s=p;if(s[1].length===0)break}if(s[0].length===0)return s;if(h){try{n=h.call(this,s[1])}catch(l){throw new b.Exception(s[1]);
35
- }s[1]=n[1]}return s}},forward:function(k,m){return function(h){return k[m].call(this,h)}},replace:function(k,m){return function(h){h=k.call(this,h);return[m,h[1]]}},process:function(k,m){return function(h){h=k.call(this,h);return[m.call(this,h[0]),h[1]]}},min:function(k,m){return function(h){var f=m.call(this,h);if(f[0].length<k)throw new b.Exception(h);return f}}};function d(k){return function(){var m=null,h=[];if(arguments.length>1)m=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof
36
- Array)m=arguments[0];if(m)for(var f=0,j=m.shift();f<j.length;){m.unshift(j[f]);h.push(k.apply(null,m));m.shift();return h}else return k.apply(null,arguments)}}for(var e="optional not ignore cache".split(/\s/),g=0;g<e.length;g++)c[e[g]]=d(c[e[g]]);function i(k){return function(){return arguments[0]instanceof Array?k.apply(null,arguments[0]):k.apply(null,arguments)}}e="each any all".split(/\s/);for(g=0;g<e.length;g++)c[e[g]]=i(c[e[g]])})();
37
- (function(){function b(h){for(var f=[],j=0;j<h.length;j++)if(h[j]instanceof Array)f=f.concat(b(h[j]));else h[j]&&f.push(h[j]);return f}Date.Grammar={};Date.Translator={hour:function(h){return function(){this.hour=Number(h)}},minute:function(h){return function(){this.minute=Number(h)}},second:function(h){return function(){this.second=Number(h)}},meridian:function(h){return function(){this.meridian=h.slice(0,1).toLowerCase()}},timezone:function(h){return function(){var f=h.replace(/[^\d\+\-]/g,"");
38
- if(f.length)this.timezoneOffset=Number(f);else this.timezone=h.toLowerCase()}},day:function(h){var f=h[0];return function(){this.day=Number(f.match(/\d+/)[0])}},month:function(h){return function(){this.month=h.length==3?Date.getMonthNumberFromName(h):Number(h)-1}},year:function(h){return function(){var f=Number(h);this.year=h.length>2?f:f+(f+2000<Date.CultureInfo.twoDigitYearMax?2000:1900)}},rday:function(h){return function(){switch(h){case "yesterday":this.days=-1;break;case "tomorrow":this.days=
39
- 1;break;case "today":this.days=0;break;case "now":this.days=0;this.now=true;break}}},finishExact:function(h){h=h instanceof Array?h:[h];var f=new Date;this.year=f.getFullYear();this.month=f.getMonth();this.day=1;for(f=this.second=this.minute=this.hour=0;f<h.length;f++)h[f]&&h[f].call(this);this.hour=this.meridian=="p"&&this.hour<13?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");h=new Date(this.year,this.month,
40
- this.day,this.hour,this.minute,this.second);if(this.timezone)h.set({timezone:this.timezone});else this.timezoneOffset&&h.set({timezoneOffset:this.timezoneOffset});return h},finish:function(h){h=h instanceof Array?b(h):[h];if(h.length===0)return null;for(var f=0;f<h.length;f++)typeof h[f]=="function"&&h[f].call(this);if(this.now)return new Date;h=Date.today();if(f=!!(this.days!=null||this.orient||this.operator)){var j,n;n=this.orient=="past"||this.operator=="subtract"?-1:1;if(this.weekday){this.unit=
41
- "day";f=Date.getDayNumberFromName(this.weekday)-h.getDay();j=7;this.days=f?(f+n*j)%j:n*j}if(this.month){this.unit="month";f=this.month-h.getMonth();j=12;this.months=f?(f+n*j)%j:n*j;this.month=null}if(!this.unit)this.unit="day";if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value)this.value=1;if(this.unit=="week"){this.unit="day";this.value*=7}this[this.unit+"s"]=this.value*n}return h.add(this)}else{if(this.meridian&&this.hour)this.hour=this.hour<13&&this.meridian=="p"?this.hour+12:this.hour;
42
- if(this.weekday&&!this.day)this.day=h.addDays(Date.getDayNumberFromName(this.weekday)-h.getDay()).getDate();if(this.month&&!this.day)this.day=1;return h.set(this)}}};var c=Date.Parsing.Operators,d=Date.Grammar,e=Date.Translator,g;d.datePartDelimiter=c.rtoken(/^([\s\-\.\,\/\x27]+)/);d.timePartDelimiter=c.stoken(":");d.whiteSpace=c.rtoken(/^\s*/);d.generalDelimiter=c.rtoken(/^(([\s\,]|at|on)+)/);var i={};d.ctoken=function(h){var f=i[h];if(!f){f=Date.CultureInfo.regexPatterns;for(var j=h.split(/\s+/),
43
- n=[],p=0;p<j.length;p++)n.push(c.replace(c.rtoken(f[j[p]]),j[p]));f=i[h]=c.any.apply(null,n)}return f};d.ctoken2=function(h){return c.rtoken(Date.CultureInfo.regexPatterns[h])};d.h=c.cache(c.process(c.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),e.hour));d.hh=c.cache(c.process(c.rtoken(/^(0[0-9]|1[0-2])/),e.hour));d.H=c.cache(c.process(c.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),e.hour));d.HH=c.cache(c.process(c.rtoken(/^([0-1][0-9]|2[0-3])/),e.hour));d.m=c.cache(c.process(c.rtoken(/^([0-5][0-9]|[0-9])/),e.minute));
44
  d.mm=c.cache(c.process(c.rtoken(/^[0-5][0-9]/),e.minute));d.s=c.cache(c.process(c.rtoken(/^([0-5][0-9]|[0-9])/),e.second));d.ss=c.cache(c.process(c.rtoken(/^[0-5][0-9]/),e.second));d.hms=c.cache(c.sequence([d.H,d.mm,d.ss],d.timePartDelimiter));d.t=c.cache(c.process(d.ctoken2("shortMeridian"),e.meridian));d.tt=c.cache(c.process(d.ctoken2("longMeridian"),e.meridian));d.z=c.cache(c.process(c.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),e.timezone));d.zz=c.cache(c.process(c.rtoken(/^(\+|\-)\s*\d\d\d\d/),e.timezone));
45
  d.zzz=c.cache(c.process(d.ctoken2("timezone"),e.timezone));d.timeSuffix=c.each(c.ignore(d.whiteSpace),c.set([d.tt,d.zzz]));d.time=c.each(c.optional(c.ignore(c.stoken("T"))),d.hms,d.timeSuffix);d.d=c.cache(c.process(c.each(c.rtoken(/^([0-2]\d|3[0-1]|\d)/),c.optional(d.ctoken2("ordinalSuffix"))),e.day));d.dd=c.cache(c.process(c.each(c.rtoken(/^([0-2]\d|3[0-1])/),c.optional(d.ctoken2("ordinalSuffix"))),e.day));d.ddd=d.dddd=c.cache(c.process(d.ctoken("sun mon tue wed thu fri sat"),function(h){return function(){this.weekday=
46
  h}}));d.M=c.cache(c.process(c.rtoken(/^(1[0-2]|0\d|\d)/),e.month));d.MM=c.cache(c.process(c.rtoken(/^(1[0-2]|0\d)/),e.month));d.MMM=d.MMMM=c.cache(c.process(d.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),e.month));d.y=c.cache(c.process(c.rtoken(/^(\d\d?)/),e.year));d.yy=c.cache(c.process(c.rtoken(/^(\d\d)/),e.year));d.yyy=c.cache(c.process(c.rtoken(/^(\d\d?\d?\d?)/),e.year));d.yyyy=c.cache(c.process(c.rtoken(/^(\d\d\d\d)/),e.year));g=function(){return c.each(c.any.apply(null,arguments),
47
  c.not(d.ctoken2("timeContext")))};d.day=g(d.d,d.dd);d.month=g(d.M,d.MMM);d.year=g(d.yyyy,d.yy);d.orientation=c.process(d.ctoken("past future"),function(h){return function(){this.orient=h}});d.operator=c.process(d.ctoken("add subtract"),function(h){return function(){this.operator=h}});d.rday=c.process(d.ctoken("yesterday tomorrow today now"),e.rday);d.unit=c.process(d.ctoken("minute hour day week month year"),function(h){return function(){this.unit=h}});d.value=c.process(c.rtoken(/^\d\d?(st|nd|rd|th)?/),
48
  function(h){return function(){this.value=h.replace(/\D/g,"")}});d.expression=c.set([d.rday,d.operator,d.value,d.unit,d.orientation,d.ddd,d.MMM]);g=function(){return c.set(arguments,d.datePartDelimiter)};d.mdy=g(d.ddd,d.month,d.day,d.year);d.ymd=g(d.ddd,d.year,d.month,d.day);d.dmy=g(d.ddd,d.day,d.month,d.year);d.date=function(h){return(d[Date.CultureInfo.dateElementOrder]||d.mdy).call(this,h)};d.format=c.process(c.many(c.any(c.process(c.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),
49
- function(h){if(d[h])return d[h];else throw Date.Parsing.Exception(h);}),c.process(c.rtoken(/^[^dMyhHmstz]+/),function(h){return c.ignore(c.stoken(h))}))),function(h){return c.process(c.each.apply(null,h),e.finishExact)});var k={};function m(h){return k[h]=k[h]||d.format(h)[0]}d.formats=function(h){if(h instanceof Array){for(var f=[],j=0;j<h.length;j++)f.push(m(h[j]));return c.any.apply(null,f)}else return m(h)};d._formats=d.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz",
50
- "d"]);d._start=c.process(c.set([d.date,d.time,d.expression],d.generalDelimiter,d.whiteSpace),e.finish);d.start=function(h){try{var f=d._formats.call({},h);if(f[1].length===0)return f}catch(j){}return d._start.call({},h)}})();Date._parse=Date.parse;Date.parse=function(b){var c=null;if(!b)return null;try{c=Date.Grammar.start.call({},b)}catch(d){return null}return c[1].length===0?c[0]:null};
51
- Date.getParseFunction=function(b){var c=Date.Grammar.formats(b);return function(d){var e=null;try{e=c.call({},d)}catch(g){return null}return e[1].length===0?e[0]:null}};Date.parseExact=function(b,c){return Date.getParseFunction(c)(b)};var humanMsg={setup:function(b,c){humanMsg.msgID="humanMsg";humanMsg.logID="humanMsgLog";if(b==undefined)b="body";humanMsg.msgOpacity=0.8;if(c!=undefined)humanMsg.msgOpacity=parseFloat(c);jQuery(b).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><div class="round"></div><p></p><div class="round"></div></div>');jQuery("#"+humanMsg.logID+" p").click(function(){jQuery(this).siblings("ul").slideToggle()})},displayMsg:function(b){if(b!=""){clearTimeout(humanMsg.t2);jQuery("#"+humanMsg.msgID+" p").html(b);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  jQuery("#"+humanMsg.msgID+"").show().animate({opacity:humanMsg.msgOpacity},200,function(){jQuery("#"+humanMsg.logID).show().children("ul").prepend("<li>"+b+"</li>").children("li:first").slideDown(200);jQuery("#"+humanMsg.logID+" ul").css("display")=="none"&&jQuery("#"+humanMsg.logID+" p").animate({bottom:40},200,"linear",function(){jQuery(this).animate({bottom:0},300,"easeOutBounce",function(){jQuery(this).css({bottom:0})})})});humanMsg.t1=setTimeout("humanMsg.bindEvents()",700);humanMsg.t2=setTimeout("humanMsg.removeMsg()",
53
- 5000)}},bindEvents:function(){jQuery(window).mousemove(humanMsg.removeMsg).click(humanMsg.removeMsg).keypress(humanMsg.removeMsg)},removeMsg:function(){jQuery(window).unbind("mousemove",humanMsg.removeMsg).unbind("click",humanMsg.removeMsg).unbind("keypress",humanMsg.removeMsg);jQuery("#"+humanMsg.msgID).css("opacity")==humanMsg.msgOpacity&&jQuery("#"+humanMsg.msgID).animate({opacity:0},500,function(){jQuery(this).hide()})}};jQuery(document).ready(function(){humanMsg.setup()});(function(b){b.fn.bgIframe=b.fn.bgiframe=function(c){if(b.browser.msie&&parseInt(b.browser.version)<=6){c=b.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},c||{});var d=function(g){return g&&g.constructor==Number?g+"px":g},e='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(c.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
54
- d(c.top))+";left:"+(c.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":d(c.left))+";width:"+(c.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":d(c.width))+";height:"+(c.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":d(c.height))+';"/>';return this.each(function(){b("> iframe.bgiframe",this).length==0&&this.insertBefore(document.createElement(e),this.firstChild)})}return this};if(!b.browser.version)b.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1]})(jQuery);(function(b){b.each({focus:"focusin",blur:"focusout"},function(c,d){b.event.special[d]={setup:function(){if(b.browser.msie)return false;this.addEventListener(c,b.event.special[d].handler,true)},teardown:function(){if(b.browser.msie)return false;this.removeEventListener(c,b.event.special[d].handler,true)},handler:function(e){arguments[0]=b.event.fix(e);arguments[0].type=d;return b.event.handle.apply(this,arguments)}}});b.extend(b.fn,{delegate:function(c,d,e){return this.bind(c,function(g){var i=b(g.target);
55
- if(i.is(d))return e.apply(i,arguments)})},triggerEvent:function(c,d){return this.triggerHandler(c,[b.event.fix({type:c,target:d})])}})})(jQuery);(function(b){b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var c;function d(e,g){var i=this,k=b(this),m=!g.vertical,h=e.children(),f=0,j;c||(c=i);b.each(g,function(l,o){b.isFunction(o)&&k.bind(l,o)});if(h.length>
56
- 1)h=b(g.items,e);function n(l){var o=b(l);return g.globalNav?o:e.parent().find(l)}e.data("finder",n);var p=n(g.prev),s=n(g.next),t=n(g.prevPage),q=n(g.nextPage);b.extend(i,{getIndex:function(){return f},getClickIndex:function(){var l=i.getItems();return l.index(l.filter("."+g.activeClass))},getConf:function(){return g},getSize:function(){return i.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/g.size)},getPageIndex:function(){return Math.ceil(f/g.size)},getNaviButtons:function(){return p.add(s).add(t).add(q)},
57
- getRoot:function(){return e},getItemWrap:function(){return h},getItems:function(){return h.children(g.item)},getVisibleItems:function(){return i.getItems().slice(f,f+g.size)},seekTo:function(l,o,v){if(l<0)l=0;if(f===l)return i;if(b.isFunction(o))v=o;if(l>i.getSize()-g.size)return g.loop?i.begin():this.end();var w=i.getItems().eq(l);if(!w.length)return i;var y=b.Event("onBeforeSeek");k.trigger(y,[l]);if(y.isDefaultPrevented())return i;if(o===undefined||b.isFunction(o))o=g.speed;function z(){v&&v.call(i,
58
- l);k.trigger("onSeek",[l])}m?h.animate({left:-w.position().left},o,g.easing,z):h.animate({top:-w.position().top},o,g.easing,z);c=i;f=l;y=b.Event("onStart");k.trigger(y,[l]);if(y.isDefaultPrevented())return i;p.add(t).toggleClass(g.disabledClass,l===0);s.add(q).toggleClass(g.disabledClass,l>=i.getSize()-g.size);return i},move:function(l,o,v){j=l>0;return this.seekTo(f+l,o,v)},next:function(l,o){return this.move(1,l,o)},prev:function(l,o){return this.move(-1,l,o)},movePage:function(l,o,v){j=l>0;var w=
59
- g.size*l,y=f%g.size;if(y>0)w+=l>0?-y:g.size-y;return this.move(w,o,v)},prevPage:function(l,o){return this.movePage(-1,l,o)},nextPage:function(l,o){return this.movePage(1,l,o)},setPage:function(l,o,v){return this.seekTo(l*g.size,o,v)},begin:function(l,o){j=false;return this.seekTo(0,l,o)},end:function(l,o){j=true;var v=this.getSize()-g.size;return v>0?this.seekTo(v,l,o):i},reload:function(){k.trigger("onReload");return i},focus:function(){return c=i},click:function(l){var o=i.getItems().eq(l),v=g.activeClass,
60
- w=g.size;if(l<0||l>=i.getSize())return i;if(w==1){if(g.loop)return i.next();if(l===0||l==i.getSize()-1)j=j===undefined?true:!j;return j===false?i.prev():i.next()}if(w==2){l==f&&l--;i.getItems().removeClass(v);o.addClass(v);return i.seekTo(l,time,fn)}if(!o.hasClass(v)){i.getItems().removeClass(v);o.addClass(v);o=Math.floor(w/2);o=l-o;if(o>i.getSize()-w)o=i.getSize()-w;if(o!==l)return i.seekTo(o)}return i},bind:function(l,o){k.bind(l,o);return i},unbind:function(l){k.unbind(l);return i}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),
61
- function(l,o){i[o]=function(v){return i.bind(o,v)}});p.addClass(g.disabledClass).click(function(){i.prev()});s.click(function(){i.next()});q.click(function(){i.nextPage()});i.getSize()<g.size&&s.add(q).addClass(g.disabledClass);t.addClass(g.disabledClass).click(function(){i.prevPage()});var u=g.hoverClass,x="keydown."+Math.random().toString().substring(10);i.onReload(function(){u&&i.getItems().hover(function(){b(this).addClass(u)},function(){b(this).removeClass(u)});g.clickable&&i.getItems().each(function(l){b(this).unbind("click.scrollable").bind("click.scrollable",
62
- function(o){if(!b(o.target).is("a"))return i.click(l)})});g.keyboard?b(document).unbind(x).bind(x,function(l){if(!(l.altKey||l.ctrlKey))if(!(g.keyboard!="static"&&c!=i)){var o=g.keyboardSteps;if(m&&(l.keyCode==37||l.keyCode==39)){i.move(l.keyCode==37?-o:o);return l.preventDefault()}if(!m&&(l.keyCode==38||l.keyCode==40)){i.move(l.keyCode==38?-o:o);return l.preventDefault()}return true}}):b(document).unbind(x)});i.reload()}b.fn.scrollable=function(e){var g=this.eq(typeof e=="number"?e:0).data("scrollable");
63
- if(g)return g;var i=b.extend({},b.tools.scrollable.conf);e=b.extend(i,e);e.keyboardSteps=e.keyboardSteps||e.size;this.each(function(){g=new d(b(this),e);b(this).data("scrollable",g)});return e.api?g:this}})(jQuery);
64
- (function(b){var c=b.tools.scrollable;c.plugins=c.plugins||{};c.plugins.autoscroll={version:"1.0.1",conf:{autoplay:true,interval:3000,autopause:true,steps:1,api:false}};b.fn.autoscroll=function(d){if(typeof d=="number")d={interval:d};var e=b.extend({},c.plugins.autoscroll.conf),g;b.extend(e,d);this.each(function(){var i=b(this).scrollable();if(i)g=i;var k,m,h=true;i.play=function(){if(!k){h=false;k=setInterval(function(){i.move(e.steps)},e.interval);i.move(e.steps)}};i.pause=function(){k=clearInterval(k)};
65
- i.stop=function(){i.pause();h=true};e.autopause&&i.getRoot().add(i.getNaviButtons()).hover(function(){i.pause();clearInterval(m)},function(){h||(m=setTimeout(i.play,e.interval))});e.autoplay&&setTimeout(i.play,e.interval)});return e.api?g:this}})(jQuery);
66
- (function(b){var c=b.tools.scrollable;c.plugins=c.plugins||{};c.plugins.navigator={version:"1.0.2",conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:false,api:false,idPrefix:null}};b.fn.navigator=function(d){var e=b.extend({},c.plugins.navigator.conf),g;if(typeof d=="string")d={navi:d};d=b.extend(e,d);this.each(function(){var i=b(this).scrollable(),k=i.getRoot(),m=k.data("finder").call(null,d.navi),h=null,f=i.getNaviButtons();if(i)g=i;i.getNaviButtons=function(){return f.add(m)};function j(){if(!m.children().length||
67
- m.data("navi")==i){m.empty();m.data("navi",i);for(var n=0;n<i.getPageAmount();n++)m.append(b("<"+(d.naviItem||"a")+"/>"));h=m.children().each(function(p){var s=b(this);s.click(function(t){i.setPage(p);return t.preventDefault()});d.indexed&&s.text(p);d.idPrefix&&s.attr("id",d.idPrefix+p)})}else{h=d.naviItem?m.find(d.naviItem):m.children();h.each(function(p){var s=b(this);s.click(function(t){i.setPage(p);return t.preventDefault()})})}h.eq(0).addClass(d.activeClass)}i.onStart(function(){var n=d.activeClass;
68
- h.removeClass(n).eq(i.getPageIndex()).addClass(n)});i.onReload(function(){j()});j();k=h.filter("[href="+location.hash+"]");k.length&&i.move(h.index(k))});return d.api?g:this}})(jQuery);
69
- (function(b){b.fn.wheel=function(g){return this[g?"bind":"trigger"]("wheel",g)};b.event.special.wheel={setup:function(){b.event.add(this,c,d,{})},teardown:function(){b.event.remove(this,c,d)}};var c=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":"");function d(g){switch(g.type){case "mousemove":return b.extend(g.data,{clientX:g.clientX,clientY:g.clientY,pageX:g.pageX,pageY:g.pageY});case "DOMMouseScroll":b.extend(g,g.data);g.delta=-g.detail/3;break;case "mousewheel":g.delta=
70
- g.wheelDelta/120;break}g.type="wheel";return b.event.handle.call(this,g,g.delta)}var e=b.tools.scrollable;e.plugins=e.plugins||{};e.plugins.mousewheel={version:"1.0.1",conf:{api:false,speed:50}};b.fn.mousewheel=function(g){var i=b.extend({},e.plugins.mousewheel.conf),k;if(typeof g=="number")g={speed:g};g=b.extend(i,g);this.each(function(){var m=b(this).scrollable();if(m)k=m;m.getRoot().wheel(function(h,f){m.move(f<0?1:-1,g.speed||50);return false})});return g.api?k:this}})(jQuery);(function(b){var c={},d,e,g,i="auto",k=b.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),m=false;b.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){b.tooltip.blocked=!b.tooltip.blocked}};b.fn.extend({tooltip:function(q){q=b.extend({},b.tooltip.defaults,q);h(q);return this.each(function(){b.data(this,"tooltip",q);this.tOpacity=c.parent.css("opacity")}).mouseover(n).mouseup(function(){p()})},hideWhenEmpty:function(){return this.each(function(){b(this)[b(this).html()?
71
- "show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}});function h(q){if(!c.parent){c.parent=b('<div id="'+q.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();b.fn.bgiframe&&c.parent.bgiframe();c.body=b("div.body",c.parent)}}function f(q){if(q)return b.data(q,"tooltip");else b("#tooltip").hide()}function j(q){m=!!f(this).track;b(document.body).bind("mousemove",s);s(q)}function n(){if(!(b.tooltip.blocked||this==d||!this.tooltipText&&
72
- !f(this).bodyHandler)){d=this;j.apply(d,arguments)}}function p(){if(f(d)){c.parent.css({left:g,right:i,top:e});var q=t(),u=c.parent[0];if(q.x+q.cx<u.offsetLeft+u.offsetWidth){g-=u.offsetWidth+20+f(d).left+150;c.parent.css({left:g+"px"}).addClass("viewport-right")}if(q.y+q.cy<u.offsetTop+u.offsetHeight){e-=u.offsetHeight+20+f(d).top;c.parent.css({top:e+"px"}).addClass("viewport-bottom")}if(f(d).bodyHandler){q=f(d).bodyHandler.call(d);q.nodeType||q.jquery?c.body.empty().append(q):c.body.html(q);c.body.show()}else if(f(d).showBody){q=
73
- f(d).showBody;c.body.empty();u=0;for(var x;x=q[u];u++){u>0&&c.body.append("<br/>");c.body.append(x)}c.body.hideWhenEmpty()}else c.body.hide();c.parent.addClass(f(d).extraClass);f(d).fixPNG&&c.parent.fixPNG();if(f(d))if((!k||!b.fn.bgiframe)&&f(d).fade)if(c.parent.is(":animated"))c.parent.stop().show().fadeTo(f(d).fade,d.tOpacity);else c.parent.is(":visible")?c.parent.fadeTo(f(d).fade,d.tOpacity):c.parent.fadeIn(f(d).fade);else c.parent.show()}}function s(q){if(!b.tooltip.blocked)if(f(d))if(!(q&&q.target.tagName==
74
- "OPTION")){!m&&c.parent.is(":visible")&&b(document.body).unbind("mousemove",s);if(d==null)b(document.body).unbind("mousemove",s);else{c.parent.removeClass("viewport-right").removeClass("viewport-bottom");g=c.parent[0].offsetLeft;e=c.parent[0].offsetTop;if(q){g=q.pageX+f(d).left;e=q.pageY+f(d).top;i="auto";if(f(d).positionLeft){i=b(window).width()-left;g="auto"}}}}}function t(){return{x:b(window).scrollLeft(),y:b(window).scrollTop(),cx:b(window).width(),cy:b(window).height()}}})(jQuery);if(!this.JSON)this.JSON={};
75
- (function(){function b(f){return f<10?"0"+f:f}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var c=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d=
76
- /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,g,i={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;function m(f){d.lastIndex=0;return d.test(f)?'"'+f.replace(d,function(j){var n=i[j];return typeof n==="string"?n:"\\u"+("0000"+j.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}function h(f,j){var n,p,s=e,t,q=j[f];if(q&&typeof q==="object"&&typeof q.toJSON==="function")q=q.toJSON(f);
77
- if(typeof k==="function")q=k.call(j,f,q);switch(typeof q){case "string":return m(q);case "number":return isFinite(q)?String(q):"null";case "boolean":case "null":return String(q);case "object":if(!q)return"null";e+=g;t=[];if(Object.prototype.toString.apply(q)==="[object Array]"){p=q.length;for(f=0;f<p;f+=1)t[f]=h(f,q)||"null";j=t.length===0?"[]":e?"[\n"+e+t.join(",\n"+e)+"\n"+s+"]":"["+t.join(",")+"]";e=s;return j}if(k&&typeof k==="object"){p=k.length;for(f=0;f<p;f+=1){n=k[f];if(typeof n==="string")if(j=
78
- h(n,q))t.push(m(n)+(e?": ":":")+j)}}else for(n in q)if(Object.hasOwnProperty.call(q,n))if(j=h(n,q))t.push(m(n)+(e?": ":":")+j);j=t.length===0?"{}":e?"{\n"+e+t.join(",\n"+e)+"\n"+s+"}":"{"+t.join(",")+"}";e=s;return j}}if(typeof JSON.stringify!=="function")JSON.stringify=function(f,j,n){var p;g=e="";if(typeof n==="number")for(p=0;p<n;p+=1)g+=" ";else if(typeof n==="string")g=n;if((k=j)&&typeof j!=="function"&&(typeof j!=="object"||typeof j.length!=="number"))throw new Error("JSON.stringify");return h("",
79
- {"":f})};if(typeof JSON.parseIt!=="function")JSON.parseIt=function(f,j){function n(p,s){var t,q,u=p[s];if(u&&typeof u==="object")for(t in u)if(Object.hasOwnProperty.call(u,t)){q=n(u,t);if(q!==undefined)u[t]=q;else delete u[t]}return j.call(p,s,u)}c.lastIndex=0;if(c.test(f))f=f.replace(c,function(p){return"\\u"+("0000"+p.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(f.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
80
- "]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){f=eval("("+f+")");return typeof j==="function"?n({"":f},""):f}throw new SyntaxError("JSON.parseIt");}})();(function(b){b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var c;function d(e,g){var i=this,k=b(this),m=!g.vertical,h=e.children(),f=0,j;c||(c=i);b.each(g,function(l,o){b.isFunction(o)&&k.bind(l,o)});if(h.length>
81
- 1)h=b(g.items,e);function n(l){var o=b(l);return g.globalNav?o:e.parent().find(l)}e.data("finder",n);var p=n(g.prev),s=n(g.next),t=n(g.prevPage),q=n(g.nextPage);b.extend(i,{getIndex:function(){return f},getClickIndex:function(){var l=i.getItems();return l.index(l.filter("."+g.activeClass))},getConf:function(){return g},getSize:function(){return i.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/g.size)},getPageIndex:function(){return Math.ceil(f/g.size)},getNaviButtons:function(){return p.add(s).add(t).add(q)},
82
- getRoot:function(){return e},getItemWrap:function(){return h},getItems:function(){return h.children(g.item)},getVisibleItems:function(){return i.getItems().slice(f,f+g.size)},seekTo:function(l,o,v){if(l<0)l=0;if(f===l)return i;if(b.isFunction(o))v=o;if(l>i.getSize()-g.size)return g.loop?i.begin():this.end();var w=i.getItems().eq(l);if(!w.length)return i;var y=b.Event("onBeforeSeek");k.trigger(y,l>f);if(y.isDefaultPrevented())return i;if(o===undefined||b.isFunction(o))o=g.speed;function z(){v&&v.call(i,
83
- l);k.trigger("onSeek",[l])}m?h.animate({left:-w.position().left},o,g.easing,z):h.animate({top:-w.position().top},o,g.easing,z);c=i;f=l;y=b.Event("onStart");k.trigger(y,[l]);if(y.isDefaultPrevented())return i;p.add(t).toggleClass(g.disabledClass,l===0);s.add(q).toggleClass(g.disabledClass,l>=i.getSize()-g.size);return i},move:function(l,o,v){j=l>0;return this.seekTo(f+l,o,v)},next:function(l,o){return this.move(1,l,o)},prev:function(l,o){return this.move(-1,l,o)},movePage:function(l,o,v){j=l>0;var w=
84
- g.size*l,y=f%g.size;if(y>0)w+=l>0?-y:g.size-y;return this.move(w,o,v)},prevPage:function(l,o){return this.movePage(-1,l,o)},nextPage:function(l,o){return this.movePage(1,l,o)},setPage:function(l,o,v){return this.seekTo(l*g.size,o,v)},begin:function(l,o){j=false;return this.seekTo(0,l,o)},end:function(l,o){j=true;var v=this.getSize()-g.size;return v>0?this.seekTo(v,l,o):i},reload:function(){k.trigger("onReload");return i},focus:function(){return c=i},click:function(l){var o=i.getItems().eq(l),v=g.activeClass,
85
- w=g.size;if(l<0||l>=i.getSize())return i;if(w==1){if(g.loop)return i.next();if(l===0||l==i.getSize()-1)j=j===undefined?true:!j;return j===false?i.prev():i.next()}if(w==2){l==f&&l--;i.getItems().removeClass(v);o.addClass(v);return i.seekTo(l,time,fn)}if(!o.hasClass(v)){i.getItems().removeClass(v);o.addClass(v);o=Math.floor(w/2);o=l-o;if(o>i.getSize()-w)o=i.getSize()-w;if(o!==l)return i.seekTo(o)}return i},bind:function(l,o){k.bind(l,o);return i},unbind:function(l){k.unbind(l);return i}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),
86
- function(l,o){i[o]=function(v){return i.bind(o,v)}});p.addClass(g.disabledClass).click(function(){i.prev()});s.click(function(){i.next()});q.click(function(){i.nextPage()});i.getSize()<g.size&&s.add(q).addClass(g.disabledClass);t.addClass(g.disabledClass).click(function(){i.prevPage()});var u=g.hoverClass,x="keydown."+Math.random().toString().substring(10);i.onReload(function(){u&&i.getItems().hover(function(){b(this).addClass(u)},function(){b(this).removeClass(u)});g.clickable&&i.getItems().each(function(l){b(this).unbind("click.scrollable").bind("click.scrollable",
87
- function(o){if(!b(o.target).is("a"))return i.click(l)})});g.keyboard?b(document).unbind(x).bind(x,function(l){if(!(l.altKey||l.ctrlKey))if(!(g.keyboard!="static"&&c!=i)){var o=g.keyboardSteps;if(m&&(l.keyCode==37||l.keyCode==39)){i.move(l.keyCode==37?-o:o);return l.preventDefault()}if(!m&&(l.keyCode==38||l.keyCode==40)){i.move(l.keyCode==38?-o:o);return l.preventDefault()}return true}}):b(document).unbind(x)});i.reload()}b.fn.scrollable=function(e){var g=this.eq(typeof e=="number"?e:0).data("scrollable");
88
- if(g)return g;var i=b.extend({},b.tools.scrollable.conf);e=b.extend(i,e);e.keyboardSteps=e.keyboardSteps||e.size;this.each(function(){g=new d(b(this),e);b(this).data("scrollable",g)});return e.api?g:this}})(jQuery);(function(b){b.fn.wheel=function(g){return this[g?"bind":"trigger"]("wheel",g)};b.event.special.wheel={setup:function(){b.event.add(this,c,d,{})},teardown:function(){b.event.remove(this,c,d)}};var c=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":"");function d(g){switch(g.type){case "mousemove":return b.extend(g.data,{clientX:g.clientX,clientY:g.clientY,pageX:g.pageX,pageY:g.pageY});case "DOMMouseScroll":b.extend(g,g.data);g.delta=-g.detail/3;break;case "mousewheel":g.delta=
89
- g.wheelDelta/120;break}g.type="wheel";return b.event.handle.call(this,g,g.delta)}var e=b.tools.scrollable;e.plugins=e.plugins||{};e.plugins.mousewheel={version:"1.0.1",conf:{api:false,speed:50}};b.fn.mousewheel=function(g){var i=b.extend({},e.plugins.mousewheel.conf),k;if(typeof g=="number")g={speed:g};g=b.extend(i,g);this.each(function(){var m=b(this).scrollable();if(m)k=m;m.getRoot().wheel(function(h,f){m.move(f<0?1:-1,g.speed||50);return false})});return g.api?k:this}})(jQuery);jQuery.ui||function(b){var c=b.fn.remove,d=b.browser.mozilla&&parseFloat(b.browser.version)<1.9;b.ui={version:"1.7.2",plugin:{add:function(f,j,n){f=b.ui[f].prototype;for(var p in n){f.plugins[p]=f.plugins[p]||[];f.plugins[p].push([j,n[p]])}},call:function(f,j,n){if((j=f.plugins[j])&&f.element[0].parentNode)for(var p=0;p<j.length;p++)f.options[j[p][0]]&&j[p][1].apply(f.element,n)}},contains:function(f,j){return document.compareDocumentPosition?f.compareDocumentPosition(j)&16:f!==j&&f.contains(j)},
90
- hasScroll:function(f,j){if(b(f).css("overflow")=="hidden")return false;j=j&&j=="left"?"scrollLeft":"scrollTop";var n=false;if(f[j]>0)return true;f[j]=1;n=f[j]>0;f[j]=0;return n},isOverAxis:function(f,j,n){return f>j&&f<j+n},isOver:function(f,j,n,p,s,t){return b.ui.isOverAxis(f,n,s)&&b.ui.isOverAxis(j,p,t)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,
91
- NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var e=b.attr,g=b.fn.removeAttr,i="http://www.w3.org/2005/07/aaa",k=/^aria-/,m=/^wairole:/;b.attr=function(f,j,n){var p=n!==undefined;return j=="role"?p?e.call(this,f,j,"wairole:"+n):(e.apply(this,arguments)||"").replace(m,""):k.test(j)?p?f.setAttributeNS(i,j.replace(k,"aaa:"),n):e.call(this,f,j.replace(k,"aaa:")):e.apply(this,arguments)};b.fn.removeAttr=function(f){return k.test(f)?
92
- this.each(function(){this.removeAttributeNS(i,f.replace(k,""))}):g.call(this,f)}}b.fn.extend({remove:function(){b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return c.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var f;
93
- f=b.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(b.curCSS(this,"position",1))&&/(auto|scroll)/.test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||
94
- !f.length?b(document):f}});b.extend(b.expr[":"],{data:function(f,j,n){return!!b.data(f,n[3])},focusable:function(f){var j=f.nodeName.toLowerCase(),n=b.attr(f,"tabindex");return(/input|select|textarea|button|object/.test(j)?!f.disabled:"a"==j||"area"==j?f.href||!isNaN(n):!isNaN(n))&&!b(f)["area"==j?"parents":"closest"](":hidden").length},tabbable:function(f){var j=b.attr(f,"tabindex");return(isNaN(j)||j>=0)&&b(f).is(":focusable")}});function h(f,j,n,p){function s(q){q=b[f][j][q]||[];return typeof q==
95
- "string"?q.split(/,?\s+/):q}var t=s("getter");if(p.length==1&&typeof p[0]=="string")t=t.concat(s("getterSetter"));return b.inArray(n,t)!=-1}b.widget=function(f,j){var n=f.split(".")[0];f=f.split(".")[1];b.fn[f]=function(p){var s=typeof p=="string",t=Array.prototype.slice.call(arguments,1);if(s&&p.substring(0,1)=="_")return this;if(s&&h(n,f,p,t)){var q=b.data(this[0],f);return q?q[p].apply(q,t):undefined}return this.each(function(){var u=b.data(this,f);!u&&!s&&b.data(this,f,new b[n][f](this,p))._init();
96
- u&&s&&b.isFunction(u[p])&&u[p].apply(u,t)})};b[n]=b[n]||{};b[n][f]=function(p,s){var t=this;this.namespace=n;this.widgetName=f;this.widgetEventPrefix=b[n][f].eventPrefix||f;this.widgetBaseClass=n+"-"+f;this.options=b.extend({},b.widget.defaults,b[n][f].defaults,b.metadata&&b.metadata.get(p)[f],s);this.element=b(p).bind("setData."+f,function(q,u,x){if(q.target==p)return t._setData(u,x)}).bind("getData."+f,function(q,u){if(q.target==p)return t._getData(u)}).bind("remove",function(){return t.destroy()})};
97
- b[n][f].prototype=b.extend({},b.widget.prototype,j);b[n][f].getterSetter="option"};b.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(f,j){var n=f,p=this;if(typeof f=="string"){if(j===undefined)return this._getData(f);n={};n[f]=j}b.each(n,function(s,t){p._setData(s,t)})},_getData:function(f){return this.options[f]},_setData:function(f,
98
- j){this.options[f]=j;if(f=="disabled")this.element[j?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",j)},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(f,j,n){var p=this.options[f];f=f==this.widgetEventPrefix?f:this.widgetEventPrefix+f;j=b.Event(j);j.type=f;if(j.originalEvent){f=b.event.props.length;for(var s;f;){s=b.event.props[--f];j[s]=j.originalEvent[s]}}this.element.trigger(j,
99
- n);return!(b.isFunction(p)&&p.call(this.element[0],j,n)===false||j.isDefaultPrevented())}};b.widget.defaults={disabled:false};b.ui.mouse={_mouseInit:function(){var f=this;this.element.bind("mousedown."+this.widgetName,function(j){return f._mouseDown(j)}).bind("click."+this.widgetName,function(j){if(f._preventClickEvent){f._preventClickEvent=false;j.stopImmediatePropagation();return false}});if(b.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable",
100
- "on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);b.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable)},_mouseDown:function(f){f.originalEvent=f.originalEvent||{};if(!f.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(f);this._mouseDownEvent=f;var j=this,n=f.which==1,p=typeof this.options.cancel=="string"?b(f.target).parents().add(f.target).filter(this.options.cancel).length:false;if(!n||p||!this._mouseCapture(f))return true;
101
- this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){j.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=this._mouseStart(f)!==false;if(!this._mouseStarted){f.preventDefault();return true}}this._mouseMoveDelegate=function(s){return j._mouseMove(s)};this._mouseUpDelegate=function(s){return j._mouseUp(s)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+
102
- this.widgetName,this._mouseUpDelegate);b.browser.safari||f.preventDefault();return f.originalEvent.mouseHandled=true}},_mouseMove:function(f){if(b.browser.msie&&!f.button)return this._mouseUp(f);if(this._mouseStarted){this._mouseDrag(f);return f.preventDefault()}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,f)!==false)?this._mouseDrag(f):this._mouseUp(f);return!this._mouseStarted},_mouseUp:function(f){b(document).unbind("mousemove."+
103
- this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=f.target==this._mouseDownEvent.target;this._mouseStop(f)}return false},_mouseDistanceMet:function(f){return Math.max(Math.abs(this._mouseDownEvent.pageX-f.pageX),Math.abs(this._mouseDownEvent.pageY-f.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},
104
- _mouseStop:function(){},_mouseCapture:function(){return true}};b.ui.mouse.defaults={cancel:null,distance:1,delay:0}}(jQuery);(function(b){b.widget("ui.draggable",b.extend({},b.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");
105
  this._mouseDestroy()}},_mouseCapture:function(c){var d=this.options;if(this.helper||d.disabled||b(c.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(c);if(!this.handle)return false;return true},_mouseStart:function(c){var d=this.options;this.helper=this._createHelper(c);this._cacheHelperProportions();if(b.ui.ddmanager)b.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();
106
  this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};b.extend(this.offset,{click:{left:c.pageX-this.offset.left,top:c.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(c);this.originalPageX=c.pageX;this.originalPageY=c.pageY;d.cursorAt&&this._adjustOffsetFromHelper(d.cursorAt);d.containment&&this._setContainment();this._trigger("start",c);this._cacheHelperProportions();b.ui.ddmanager&&
107
  !d.dropBehaviour&&b.ui.ddmanager.prepareOffsets(this,c);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(c,true);return true},_mouseDrag:function(c,d){this.position=this._generatePosition(c);this.positionAbs=this._convertPositionTo("absolute");if(!d){d=this._uiHash();this._trigger("drag",c,d);this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+
@@ -115,34 +81,54 @@ this.margins.left,(b(c.containment=="document"?document:window).height()||docume
115
  10)||0)+(parseInt(b(d).css("paddingTop"),10)||0)-this.margins.top,c.left+(e?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(b(d).css("borderLeftWidth"),10)||0)-(parseInt(b(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,c.top+(e?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(b(d).css("borderTopWidth"),10)||0)-(parseInt(b(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(c.containment.constructor==
116
  Array)this.containment=c.containment},_convertPositionTo:function(c,d){if(!d)d=this.position;c=c=="absolute"?1:-1;var e=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(e[0].tagName);return{top:d.top+this.offset.relative.top*c+this.offset.parent.top*c-(b.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:e.scrollTop())*
117
  c),left:d.left+this.offset.relative.left*c+this.offset.parent.left*c-(b.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:e.scrollLeft())*c)}},_generatePosition:function(c){var d=this.options,e=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(e[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=
118
- document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var i=c.pageX,k=c.pageY;if(this.originalPosition){if(this.containment){if(c.pageX-this.offset.click.left<this.containment[0])i=this.containment[0]+this.offset.click.left;if(c.pageY-this.offset.click.top<this.containment[1])k=this.containment[1]+this.offset.click.top;if(c.pageX-this.offset.click.left>this.containment[2])i=this.containment[2]+this.offset.click.left;if(c.pageY-this.offset.click.top>this.containment[3])k=
119
- this.containment[3]+this.offset.click.top}if(d.grid){k=this.originalPageY+Math.round((k-this.originalPageY)/d.grid[1])*d.grid[1];k=this.containment?!(k-this.offset.click.top<this.containment[1]||k-this.offset.click.top>this.containment[3])?k:!(k-this.offset.click.top<this.containment[1])?k-d.grid[1]:k+d.grid[1]:k;i=this.originalPageX+Math.round((i-this.originalPageX)/d.grid[0])*d.grid[0];i=this.containment?!(i-this.offset.click.left<this.containment[0]||i-this.offset.click.left>this.containment[2])?
120
- i:!(i-this.offset.click.left<this.containment[0])?i-d.grid[0]:i+d.grid[0]:i}}return{top:k-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(b.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:e.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(b.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:e.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");
121
  this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(c,d,e){e=e||this._uiHash();b.ui.plugin.call(this,c,[d,e]);if(c=="drag")this.positionAbs=this._convertPositionTo("absolute");return b.widget.prototype._trigger.call(this,c,d,e)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));b.extend(b.ui.draggable,{version:"1.7.2",
122
  eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});b.ui.plugin.add("draggable","connectToSortable",{start:function(c,
123
- d){var e=b(this).data("draggable"),g=e.options,i=b.extend({},d,{item:e.element});e.sortables=[];b(g.connectToSortable).each(function(){var k=b.data(this,"sortable");if(k&&!k.options.disabled){e.sortables.push({instance:k,shouldRevert:k.options.revert});k._refreshItems();k._trigger("activate",c,i)}})},stop:function(c,d){var e=b(this).data("draggable"),g=b.extend({},d,{item:e.element});b.each(e.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;e.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=
124
  false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;e.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,g)}})},drag:function(c,d){var e=b(this).data("draggable"),g=this;b.each(e.sortables,function(){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;
125
  this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=b(g).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return d.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=
126
  e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}this.instance.currentItem&&this.instance._mouseDrag(c)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;
127
  this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();e._trigger("fromSortable",c);e.dropped=false}})}});b.ui.plugin.add("draggable","cursor",{start:function(){var c=b("body"),d=b(this).data("draggable").options;if(c.css("cursor"))d._cursor=c.css("cursor");c.css("cursor",
128
- d.cursor)},stop:function(){if(b(this).data("draggable")){var c=b(this).data("draggable").options;c._cursor&&b("body").css("cursor",c._cursor)}}});b.ui.plugin.add("draggable","iframeFix",{start:function(){var c=b(this).data("draggable").options;b(c.iframeFix===true?"iframe":c.iframeFix).each(function(){b('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(b(this).offset()).appendTo("body")})},
129
  stop:function(){b("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});b.ui.plugin.add("draggable","opacity",{start:function(c,d){c=b(d.helper);d=b(this).data("draggable").options;if(c.css("opacity"))d._opacity=c.css("opacity");c.css("opacity",d.opacity)},stop:function(c,d){c=b(this).data("draggable").options;c._opacity&&b(d.helper).css("opacity",c._opacity)}});b.ui.plugin.add("draggable","scroll",{start:function(){var c=b(this).data("draggable");if(c.scrollParent[0]!=
130
  document&&c.scrollParent[0].tagName!="HTML")c.overflowOffset=c.scrollParent.offset()},drag:function(c){var d=b(this).data("draggable"),e=d.options,g=false;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")if(d.overflowOffset.top+d.scrollParent[0].offsetHeight-c.pageY<e.scrollSensitivity)d.scrollParent[0].scrollTop=g=d.scrollParent[0].scrollTop+e.scrollSpeed;else if(c.pageY-d.overflowOffset.top<e.scrollSensitivity)d.scrollParent[0].scrollTop=g=d.scrollParent[0].scrollTop-
131
  e.scrollSpeed;if(!e.axis||e.axis!="y")if(d.overflowOffset.left+d.scrollParent[0].offsetWidth-c.pageX<e.scrollSensitivity)d.scrollParent[0].scrollLeft=g=d.scrollParent[0].scrollLeft+e.scrollSpeed;else if(c.pageX-d.overflowOffset.left<e.scrollSensitivity)d.scrollParent[0].scrollLeft=g=d.scrollParent[0].scrollLeft-e.scrollSpeed}else{if(!e.axis||e.axis!="x")if(c.pageY-b(document).scrollTop()<e.scrollSensitivity)g=b(document).scrollTop(b(document).scrollTop()-e.scrollSpeed);else if(b(window).height()-
132
  (c.pageY-b(document).scrollTop())<e.scrollSensitivity)g=b(document).scrollTop(b(document).scrollTop()+e.scrollSpeed);if(!e.axis||e.axis!="y")if(c.pageX-b(document).scrollLeft()<e.scrollSensitivity)g=b(document).scrollLeft(b(document).scrollLeft()-e.scrollSpeed);else if(b(window).width()-(c.pageX-b(document).scrollLeft())<e.scrollSensitivity)g=b(document).scrollLeft(b(document).scrollLeft()+e.scrollSpeed)}g!==false&&b.ui.ddmanager&&!e.dropBehaviour&&b.ui.ddmanager.prepareOffsets(d,c)}});b.ui.plugin.add("draggable",
133
- "snap",{start:function(){var c=b(this).data("draggable"),d=c.options;c.snapElements=[];b(d.snap.constructor!=String?d.snap.items||":data(draggable)":d.snap).each(function(){var e=b(this),g=e.offset();this!=c.element[0]&&c.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:g.top,left:g.left})})},drag:function(c,d){for(var e=b(this).data("draggable"),g=e.options,i=g.snapTolerance,k=d.offset.left,m=k+e.helperProportions.width,h=d.offset.top,f=h+e.helperProportions.height,j=
134
- e.snapElements.length-1;j>=0;j--){var n=e.snapElements[j].left,p=n+e.snapElements[j].width,s=e.snapElements[j].top,t=s+e.snapElements[j].height;if(n-i<k&&k<p+i&&s-i<h&&h<t+i||n-i<k&&k<p+i&&s-i<f&&f<t+i||n-i<m&&m<p+i&&s-i<h&&h<t+i||n-i<m&&m<p+i&&s-i<f&&f<t+i){if(g.snapMode!="inner"){var q=Math.abs(s-f)<=i,u=Math.abs(t-h)<=i,x=Math.abs(n-m)<=i,l=Math.abs(p-k)<=i;if(q)d.position.top=e._convertPositionTo("relative",{top:s-e.helperProportions.height,left:0}).top-e.margins.top;if(u)d.position.top=e._convertPositionTo("relative",
135
- {top:t,left:0}).top-e.margins.top;if(x)d.position.left=e._convertPositionTo("relative",{top:0,left:n-e.helperProportions.width}).left-e.margins.left;if(l)d.position.left=e._convertPositionTo("relative",{top:0,left:p}).left-e.margins.left}var o=q||u||x||l;if(g.snapMode!="outer"){q=Math.abs(s-h)<=i;u=Math.abs(t-f)<=i;x=Math.abs(n-k)<=i;l=Math.abs(p-m)<=i;if(q)d.position.top=e._convertPositionTo("relative",{top:s,left:0}).top-e.margins.top;if(u)d.position.top=e._convertPositionTo("relative",{top:t-e.helperProportions.height,
136
- left:0}).top-e.margins.top;if(x)d.position.left=e._convertPositionTo("relative",{top:0,left:n}).left-e.margins.left;if(l)d.position.left=e._convertPositionTo("relative",{top:0,left:p-e.helperProportions.width}).left-e.margins.left}if(!e.snapElements[j].snapping&&(q||u||x||l||o))e.options.snap.snap&&e.options.snap.snap.call(e.element,c,b.extend(e._uiHash(),{snapItem:e.snapElements[j].item}));e.snapElements[j].snapping=q||u||x||l||o}else{e.snapElements[j].snapping&&e.options.snap.release&&e.options.snap.release.call(e.element,
137
- c,b.extend(e._uiHash(),{snapItem:e.snapElements[j].item}));e.snapElements[j].snapping=false}}}});b.ui.plugin.add("draggable","stack",{start:function(){var c=b(this).data("draggable").options,d=b.makeArray(b(c.stack.group)).sort(function(e,g){return(parseInt(b(e).css("zIndex"),10)||c.stack.min)-(parseInt(b(g).css("zIndex"),10)||c.stack.min)});b(d).each(function(e){this.style.zIndex=c.stack.min+e});this[0].style.zIndex=c.stack.min+d.length}});b.ui.plugin.add("draggable","zIndex",{start:function(c,d){c=
138
- b(d.helper);d=b(this).data("draggable").options;if(c.css("zIndex"))d._zIndex=c.css("zIndex");c.css("zIndex",d.zIndex)},stop:function(c,d){c=b(this).data("draggable").options;c._zIndex&&b(d.helper).css("zIndex",c._zIndex)}})})(jQuery);(function(b){b.widget("ui.droppable",{_init:function(){var c=this.options,d=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&b.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(d)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[this.options.scope]=b.ui.ddmanager.droppables[this.options.scope]||[];b.ui.ddmanager.droppables[this.options.scope].push(this);this.options.addClasses&&
139
- this.element.addClass("ui-droppable")},destroy:function(){for(var c=b.ui.ddmanager.droppables[this.options.scope],d=0;d<c.length;d++)c[d]==this&&c.splice(d,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(c,d){if(c=="accept")this.options.accept=d&&b.isFunction(d)?d:function(e){return e.is(d)};else b.widget.prototype._setData.apply(this,arguments)},_activate:function(c){var d=b.ui.ddmanager.current;this.options.activeClass&&
140
- this.element.addClass(this.options.activeClass);d&&this._trigger("activate",c,this.ui(d))},_deactivate:function(c){var d=b.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);d&&this._trigger("deactivate",c,this.ui(d))},_over:function(c){var d=b.ui.ddmanager.current;if(!(!d||(d.currentItem||d.element)[0]==this.element[0]))if(this.options.accept.call(this.element[0],d.currentItem||d.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
141
- this._trigger("over",c,this.ui(d))}},_out:function(c){var d=b.ui.ddmanager.current;if(!(!d||(d.currentItem||d.element)[0]==this.element[0]))if(this.options.accept.call(this.element[0],d.currentItem||d.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",c,this.ui(d))}},_drop:function(c,d){var e=d||b.ui.ddmanager.current;if(!e||(e.currentItem||e.element)[0]==this.element[0])return false;var g=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var i=
142
- b.data(this,"droppable");if(i.options.greedy&&b.ui.intersect(e,b.extend(i,{offset:i.element.offset()}),i.options.tolerance)){g=true;return false}});if(g)return false;if(this.options.accept.call(this.element[0],e.currentItem||e.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",c,this.ui(e));return this.element}return false},ui:function(c){return{draggable:c.currentItem||
143
- c.element,helper:c.helper,position:c.position,absolutePosition:c.positionAbs,offset:c.positionAbs}}});b.extend(b.ui.droppable,{version:"1.7.2",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});b.ui.intersect=function(c,d,e){if(!d.offset)return false;var g=(c.positionAbs||c.position.absolute).left,i=g+c.helperProportions.width,k=(c.positionAbs||c.position.absolute).top,m=k+c.helperProportions.height,h=d.offset.left,
144
- f=h+d.proportions.width,j=d.offset.top,n=j+d.proportions.height;switch(e){case "fit":return h<g&&i<f&&j<k&&m<n;case "intersect":return h<g+c.helperProportions.width/2&&i-c.helperProportions.width/2<f&&j<k+c.helperProportions.height/2&&m-c.helperProportions.height/2<n;case "pointer":e=(c.positionAbs||c.position.absolute).left+(c.clickOffset||c.offset.click).left;c=(c.positionAbs||c.position.absolute).top+(c.clickOffset||c.offset.click).top;return d=b.ui.isOver(c,e,j,h,d.proportions.height,d.proportions.width);
145
- case "touch":return(k>=j&&k<=n||m>=j&&m<=n||k<j&&m>n)&&(g>=h&&g<=f||i>=h&&i<=f||g<h&&i>f);default:return false}};b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(c,d){var e=b.ui.ddmanager.droppables[c.options.scope],g=d?d.type:null,i=(c.currentItem||c.element).find(":data(droppable)").andSelf(),k=0;a:for(;k<e.length;k++)if(!(e[k].options.disabled||c&&!e[k].options.accept.call(e[k].element[0],c.currentItem||c.element))){for(var m=0;m<i.length;m++)if(i[m]==e[k].element[0]){e[k].proportions.height=
146
- 0;continue a}e[k].visible=e[k].element.css("display")!="none";if(e[k].visible){e[k].offset=e[k].element.offset();e[k].proportions={width:e[k].element[0].offsetWidth,height:e[k].element[0].offsetHeight};g=="mousedown"&&e[k]._activate.call(e[k],d)}}},drop:function(c,d){var e=false;b.each(b.ui.ddmanager.droppables[c.options.scope],function(){if(this.options){if(!this.options.disabled&&this.visible&&b.ui.intersect(c,this,this.options.tolerance))e=this._drop.call(this,d);if(!this.options.disabled&&this.visible&&
147
- this.options.accept.call(this.element[0],c.currentItem||c.element)){this.isout=1;this.isover=0;this._deactivate.call(this,d)}}});return e},drag:function(c,d){c.options.refreshPositions&&b.ui.ddmanager.prepareOffsets(c,d);b.each(b.ui.ddmanager.droppables[c.options.scope],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var e=b.ui.intersect(c,this,this.options.tolerance);if(e=!e&&this.isover==1?"isout":e&&this.isover==0?"isover":null){var g;if(this.options.greedy){var i=this.element.parents(":data(droppable):eq(0)");
148
- if(i.length){g=b.data(i[0],"droppable");g.greedyChild=e=="isover"?1:0}}if(g&&e=="isover"){g.isover=0;g.isout=1;g._out.call(g,d)}this[e]=1;this[e=="isout"?"isover":"isout"]=0;this[e=="isover"?"_over":"_out"].call(this,d);if(g&&e=="isout"){g.isout=0;g.isover=1;g._over.call(g,d)}}}})}}})(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};Date.getMonthNumberFromName=function(b){var c=Date.CultureInfo.monthNames,d=Date.CultureInfo.abbreviatedMonthNames;b=b.toLowerCase();for(var e=0;e<c.length;e++)if(c[e].toLowerCase()==b||d[e].toLowerCase()==b)return e;return-1};
7
  Date.getDayNumberFromName=function(b){var c=Date.CultureInfo.dayNames,d=Date.CultureInfo.abbreviatedDayNames;b=b.toLowerCase();for(var e=0;e<c.length;e++)if(c[e].toLowerCase()==b||d[e].toLowerCase()==b)return e;return-1};Date.isLeapYear=function(b){return b%4===0&&b%100!==0||b%400===0};Date.getDaysInMonth=function(b,c){return[31,Date.isLeapYear(b)?29:28,31,30,31,30,31,31,30,31,30,31][c]};Date.getTimezoneOffset=function(b,c){return c?Date.CultureInfo.abbreviatedTimeZoneDST[b.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[b.toUpperCase()]};
8
  Date.getTimezoneAbbreviation=function(b,c){c=c?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard;var d;for(d in c)if(c[d]===b)return d;return null};a=Date.prototype;a.clone=function(){return new Date(this.getTime())};a.compareTo=function(b){if(isNaN(this))throw new Error(this);if(b instanceof Date&&!isNaN(b))return this>b?1:this<b?-1:0;else throw new TypeError(b);};a.equals=function(b){return this.compareTo(b)===0};
9
+ a.between=function(b,c){var d=this.getTime();return d>=b.getTime()&&d<=c.getTime()};a.addMilliseconds=function(b){this.setMilliseconds(this.getMilliseconds()+b);return this};a.addSeconds=function(b){return this.addMilliseconds(b*1E3)};a.addMinutes=function(b){return this.addMilliseconds(b*6E4)};a.addHours=function(b){return this.addMilliseconds(b*36E5)};a.addDays=function(b){return this.addMilliseconds(b*864E5)};a.addWeeks=function(b){return this.addMilliseconds(b*6048E5)};
10
  a.addMonths=function(b){var c=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+b);this.setDate(Math.min(c,this.getDaysInMonth()));return this};a.addYears=function(b){return this.addMonths(b*12)};
11
+ a.add=function(b){if(typeof b=="number"){this._orient=b;return this}if(b.millisecond||b.milliseconds)this.addMilliseconds(b.millisecond||b.milliseconds);if(b.second||b.seconds)this.addSeconds(b.second||b.seconds);if(b.minute||b.minutes)this.addMinutes(b.minute||b.minutes);if(b.hour||b.hours)this.addHours(b.hour||b.hours);if(b.month||b.months)this.addMonths(b.month||b.months);if(b.year||b.years)this.addYears(b.year||b.years);if(b.day||b.days)this.addDays(b.day||b.days);return this};
12
  Date._validate=function(b,c,d,e){if(typeof b!="number")throw new TypeError(b+" is not a Number.");else if(b<c||b>d)throw new RangeError(b+" is not a valid value for "+e+".");return true};Date.validateMillisecond=function(b){return Date._validate(b,0,999,"milliseconds")};Date.validateSecond=function(b){return Date._validate(b,0,59,"seconds")};Date.validateMinute=function(b){return Date._validate(b,0,59,"minutes")};Date.validateHour=function(b){return Date._validate(b,0,23,"hours")};
13
  Date.validateDay=function(b,c,d){return Date._validate(b,1,Date.getDaysInMonth(c,d),"days")};Date.validateMonth=function(b){return Date._validate(b,0,11,"months")};Date.validateYear=function(b){return Date._validate(b,1,9999,"seconds")};a=Date.prototype;
14
+ a.set=function(b){if(!b.millisecond&&b.millisecond!==0)b.millisecond=-1;if(!b.second&&b.second!==0)b.second=-1;if(!b.minute&&b.minute!==0)b.minute=-1;if(!b.hour&&b.hour!==0)b.hour=-1;if(!b.day&&b.day!==0)b.day=-1;if(!b.month&&b.month!==0)b.month=-1;if(!b.year&&b.year!==0)b.year=-1;b.millisecond!=-1&&Date.validateMillisecond(b.millisecond)&&this.addMilliseconds(b.millisecond-this.getMilliseconds());b.second!=-1&&Date.validateSecond(b.second)&&this.addSeconds(b.second-this.getSeconds());b.minute!=-1&&
15
+ Date.validateMinute(b.minute)&&this.addMinutes(b.minute-this.getMinutes());b.hour!=-1&&Date.validateHour(b.hour)&&this.addHours(b.hour-this.getHours());b.month!==-1&&Date.validateMonth(b.month)&&this.addMonths(b.month-this.getMonth());b.year!=-1&&Date.validateYear(b.year)&&this.addYears(b.year-this.getFullYear());b.day!=-1&&Date.validateDay(b.day,this.getFullYear(),this.getMonth())&&this.addDays(b.day-this.getDate());b.timezone&&this.setTimezone(b.timezone);b.timezoneOffset&&this.setTimezoneOffset(b.timezoneOffset);
16
  return this};a.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};a.isLeapYear=function(){var b=this.getFullYear();return b%4===0&&b%100!==0||b%400===0};a.isWeekday=function(){return!(this.is().sat()||this.is().sun())};a.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};a.moveToFirstDayOfMonth=function(){return this.set({day:1})};a.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};
17
+ a.moveToDayOfWeek=function(b,c){b=(b-this.getDay()+7*(c||+1))%7;return this.addDays(b===0?(b+=7*(c||+1)):b)};a.moveToMonth=function(b,c){b=(b-this.getMonth()+12*(c||+1))%12;return this.addMonths(b===0?(b+=12*(c||+1)):b)};a.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/864E5)};
18
+ a.getWeekOfYear=function(b){var c=this.getFullYear(),d=this.getMonth(),e=this.getDate();b=b||Date.CultureInfo.firstDayOfWeek;var g=8-(new Date(c,0,1)).getDay();if(g==8)g=1;d=(Date.UTC(c,d,e,0,0,0)-Date.UTC(c,0,1,0,0,0))/864E5+1;d=Math.floor((d-g+7)/7);if(d===b){c--;c=8-(new Date(c,0,1)).getDay();d=c==2||c==8?53:52}return d};a.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};
19
+ a.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};a.setTimezoneOffset=function(b){var c=this.getTimezoneOffset();this.addMinutes(Number(b)*-6/10-c);return this};a.setTimezone=function(b){return this.setTimezoneOffset(Date.getTimezoneOffset(b))};a.getUTCOffset=function(){var b=this.getTimezoneOffset()*-10/6;if(b<0){b=(b-1E4).toString();return b[0]+b.substr(2)}else{b=(b+1E4).toString();return"+"+b.substr(1)}};
20
  a.getDayName=function(b){return b?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};a.getMonthName=function(b){return b?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};a._toString=Date.prototype.toString;
21
+ a.toString=function(b){var c=this,d=function(e){return e.toString().length==1?"0"+e:e};return b?b.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(e){switch(e){case "hh":return d(c.getHours()<13?c.getHours():c.getHours()-12);case "h":return c.getHours()<13?c.getHours():c.getHours()-12;case "HH":return d(c.getHours());case "H":return c.getHours();case "mm":return d(c.getMinutes());case "m":return c.getMinutes();case "ss":return d(c.getSeconds());case "s":return c.getSeconds();
22
+ case "yyyy":return c.getFullYear();case "yy":return c.getFullYear().toString().substring(2,4);case "dddd":return c.getDayName();case "ddd":return c.getDayName(true);case "dd":return d(c.getDate());case "d":return c.getDate().toString();case "MMMM":return c.getMonthName();case "MMM":return c.getMonthName(true);case "MM":return d(c.getMonth()+1);case "M":return c.getMonth()+1;case "t":return c.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case "tt":return c.getHours()<
23
+ 12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case "zzz":case "zz":case "z":return""}}):this._toString()};Date.now=function(){return new Date};Date.today=function(){return Date.now().clearTime()};a=Date.prototype;a._orient=+1;a.next=function(){this._orient=+1;return this};a.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};a._is=false;a.is=function(){this._is=true;return this};Number.prototype._dateElement="day";
24
  Number.prototype.fromNow=function(){var b={};b[this._dateElement]=this;return Date.now().add(b)};Number.prototype.ago=function(){var b={};b[this._dateElement]=this*-1;return Date.now().add(b)};
25
+ (function(){for(var b=Date.prototype,c=Number.prototype,d="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),e="january february march april may june july august september october november december".split(/\s/),g="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),m=function(k){return function(){if(this._is){this._is=false;return this.getDay()==k}return this.moveToDayOfWeek(k,this._orient)}},f=0;f<d.length;f++)b[d[f]]=b[d[f].substring(0,3)]=m(f);d=function(k){return function(){if(this._is){this._is=
26
+ false;return this.getMonth()===k}return this.moveToMonth(k,this._orient)}};for(m=0;m<e.length;m++)b[e[m]]=b[e[m].substring(0,3)]=d(m);d=function(k){return function(){if(k.substring(k.length-1)!="s")k+="s";return this["add"+k](this._orient)}};m=function(k){return function(){this._dateElement=k;return this}};for(f=0;f<g.length;f++){e=g[f].toLowerCase();b[e]=b[e+"s"]=d(g[f]);c[e]=c[e+"s"]=m(e)}})();a=Date.prototype;a.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};
27
  a.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};a.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};a.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};a.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};
28
  a.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};
29
+ (function(){Date.Parsing={Exception:function(f){this.message="Parse error at '"+f.substring(0,10)+" ...'"}};for(var b=Date.Parsing,c=b.Operators={rtoken:function(f){return function(k){var h=k.match(f);if(h)return[h[0],k.substring(h[0].length)];else throw new b.Exception(k);}},token:function(){return function(f){return c.rtoken(new RegExp("^s*"+f+"s*"))(f)}},stoken:function(f){return c.rtoken(new RegExp("^"+f))},until:function(f){return function(k){for(var h=[],i=null;k.length;){try{i=f.call(this,
30
+ k)}catch(l){h.push(i[0]);k=i[1];continue}break}return[h,k]}},many:function(f){return function(k){for(var h=[],i=null;k.length;){try{i=f.call(this,k)}catch(l){return[h,k]}h.push(i[0]);k=i[1]}return[h,k]}},optional:function(f){return function(k){var h=null;try{h=f.call(this,k)}catch(i){return[null,k]}return[h[0],h[1]]}},not:function(f){return function(k){try{f.call(this,k)}catch(h){return[null,k]}throw new b.Exception(k);}},ignore:function(f){return f?function(k){var h=null;h=f.call(this,k);return[null,
31
+ h[1]]}:null},product:function(){for(var f=arguments[0],k=Array.prototype.slice.call(arguments,1),h=[],i=0;i<f.length;i++)h.push(c.each(f[i],k));return h},cache:function(f){var k={},h=null;return function(i){try{h=k[i]=k[i]||f.call(this,i)}catch(l){h=k[i]=l}if(h instanceof b.Exception)throw h;else return h}},any:function(){var f=arguments;return function(k){for(var h=null,i=0;i<f.length;i++)if(f[i]!=null){try{h=f[i].call(this,k)}catch(l){h=null}if(h)return h}throw new b.Exception(k);}},each:function(){var f=
32
+ arguments;return function(k){for(var h=[],i=null,l=0;l<f.length;l++)if(f[l]!=null){try{i=f[l].call(this,k)}catch(o){throw new b.Exception(k);}h.push(i[0]);k=i[1]}return[h,k]}},all:function(){var f=f;return f.each(f.optional(arguments))},sequence:function(f,k,h){k=k||c.rtoken(/^\s*/);h=h||null;if(f.length==1)return f[0];return function(i){for(var l=null,o=null,q=[],t=0;t<f.length;t++){try{l=f[t].call(this,i)}catch(s){break}q.push(l[0]);try{o=k.call(this,l[1])}catch(p){o=null;break}i=o[1]}if(!l)throw new b.Exception(i);
33
+ if(o)throw new b.Exception(o[1]);if(h)try{l=h.call(this,l[1])}catch(v){throw new b.Exception(l[1]);}return[q,l?l[1]:i]}},between:function(f,k,h){h=h||f;var i=c.each(c.ignore(f),k,c.ignore(h));return function(l){l=i.call(this,l);return[[l[0][0],r[0][2]],l[1]]}},list:function(f,k,h){k=k||c.rtoken(/^\s*/);h=h||null;return f instanceof Array?c.each(c.product(f.slice(0,-1),c.ignore(k)),f.slice(-1),c.ignore(h)):c.each(c.many(c.each(f,c.ignore(k))),px,c.ignore(h))},set:function(f,k,h){k=k||c.rtoken(/^\s*/);
34
+ h=h||null;return function(i){var l=null;for(var o=l=null,q=null,t=[[],i],s=false,p=0;p<f.length;p++){l=o=null;s=f.length==1;try{l=f[p].call(this,i)}catch(v){continue}q=[[l[0]],l[1]];if(l[1].length>0&&!s)try{o=k.call(this,l[1])}catch(x){s=true}else s=true;if(!s&&o[1].length===0)s=true;if(!s){l=[];for(s=0;s<f.length;s++)p!=s&&l.push(f[s]);l=c.set(l,k).call(this,o[1]);if(l[0].length>0){q[0]=q[0].concat(l[0]);q[1]=l[1]}}if(q[1].length<t[1].length)t=q;if(t[1].length===0)break}if(t[0].length===0)return t;
35
+ if(h){try{o=h.call(this,t[1])}catch(j){throw new b.Exception(t[1]);}t[1]=o[1]}return t}},forward:function(f,k){return function(h){return f[k].call(this,h)}},replace:function(f,k){return function(h){h=f.call(this,h);return[k,h[1]]}},process:function(f,k){return function(h){h=f.call(this,h);return[k.call(this,h[0]),h[1]]}},min:function(f,k){return function(h){var i=k.call(this,h);if(i[0].length<f)throw new b.Exception(h);return i}}},d=function(f){return function(){var k=null,h=[];if(arguments.length>
36
+ 1)k=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof Array)k=arguments[0];if(k)for(var i=k.shift();0<i.length;){k.unshift(i[0]);h.push(f.apply(null,k));k.shift();return h}else return f.apply(null,arguments)}},e="optional not ignore cache".split(/\s/),g=0;g<e.length;g++)c[e[g]]=d(c[e[g]]);var m=function(f){return function(){return arguments[0]instanceof Array?f.apply(null,arguments[0]):f.apply(null,arguments)}};e="each any all".split(/\s/);for(g=0;g<e.length;g++)c[e[g]]=m(c[e[g]])})();
37
+ (function(){var b=function(h){for(var i=[],l=0;l<h.length;l++)if(h[l]instanceof Array)i=i.concat(b(h[l]));else h[l]&&i.push(h[l]);return i};Date.Grammar={};Date.Translator={hour:function(h){return function(){this.hour=Number(h)}},minute:function(h){return function(){this.minute=Number(h)}},second:function(h){return function(){this.second=Number(h)}},meridian:function(h){return function(){this.meridian=h.slice(0,1).toLowerCase()}},timezone:function(h){return function(){var i=h.replace(/[^\d\+\-]/g,
38
+ "");if(i.length)this.timezoneOffset=Number(i);else this.timezone=h.toLowerCase()}},day:function(h){var i=h[0];return function(){this.day=Number(i.match(/\d+/)[0])}},month:function(h){return function(){this.month=h.length==3?Date.getMonthNumberFromName(h):Number(h)-1}},year:function(h){return function(){var i=Number(h);this.year=h.length>2?i:i+(i+2E3<Date.CultureInfo.twoDigitYearMax?2E3:1900)}},rday:function(h){return function(){switch(h){case "yesterday":this.days=-1;break;case "tomorrow":this.days=
39
+ 1;break;case "today":this.days=0;break;case "now":this.days=0;this.now=true;break}}},finishExact:function(h){h=h instanceof Array?h:[h];var i=new Date;this.year=i.getFullYear();this.month=i.getMonth();this.day=1;for(i=this.second=this.minute=this.hour=0;i<h.length;i++)h[i]&&h[i].call(this);this.hour=this.meridian=="p"&&this.hour<13?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");h=new Date(this.year,this.month,
40
+ this.day,this.hour,this.minute,this.second);if(this.timezone)h.set({timezone:this.timezone});else this.timezoneOffset&&h.set({timezoneOffset:this.timezoneOffset});return h},finish:function(h){h=h instanceof Array?b(h):[h];if(h.length===0)return null;for(var i=0;i<h.length;i++)typeof h[i]=="function"&&h[i].call(this);if(this.now)return new Date;h=Date.today();if(this.days!=null||this.orient||this.operator){var l,o;o=this.orient=="past"||this.operator=="subtract"?-1:1;if(this.weekday){this.unit="day";
41
+ i=Date.getDayNumberFromName(this.weekday)-h.getDay();l=7;this.days=i?(i+o*l)%l:o*l}if(this.month){this.unit="month";i=this.month-h.getMonth();l=12;this.months=i?(i+o*l)%l:o*l;this.month=null}if(!this.unit)this.unit="day";if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value)this.value=1;if(this.unit=="week"){this.unit="day";this.value*=7}this[this.unit+"s"]=this.value*o}return h.add(this)}else{if(this.meridian&&this.hour)this.hour=this.hour<13&&this.meridian=="p"?this.hour+12:this.hour;
42
+ if(this.weekday&&!this.day)this.day=h.addDays(Date.getDayNumberFromName(this.weekday)-h.getDay()).getDate();if(this.month&&!this.day)this.day=1;return h.set(this)}}};var c=Date.Parsing.Operators,d=Date.Grammar,e=Date.Translator,g;d.datePartDelimiter=c.rtoken(/^([\s\-\.\,\/\x27]+)/);d.timePartDelimiter=c.stoken(":");d.whiteSpace=c.rtoken(/^\s*/);d.generalDelimiter=c.rtoken(/^(([\s\,]|at|on)+)/);var m={};d.ctoken=function(h){var i=m[h];if(!i){i=Date.CultureInfo.regexPatterns;for(var l=h.split(/\s+/),
43
+ o=[],q=0;q<l.length;q++)o.push(c.replace(c.rtoken(i[l[q]]),l[q]));i=m[h]=c.any.apply(null,o)}return i};d.ctoken2=function(h){return c.rtoken(Date.CultureInfo.regexPatterns[h])};d.h=c.cache(c.process(c.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),e.hour));d.hh=c.cache(c.process(c.rtoken(/^(0[0-9]|1[0-2])/),e.hour));d.H=c.cache(c.process(c.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),e.hour));d.HH=c.cache(c.process(c.rtoken(/^([0-1][0-9]|2[0-3])/),e.hour));d.m=c.cache(c.process(c.rtoken(/^([0-5][0-9]|[0-9])/),e.minute));
44
  d.mm=c.cache(c.process(c.rtoken(/^[0-5][0-9]/),e.minute));d.s=c.cache(c.process(c.rtoken(/^([0-5][0-9]|[0-9])/),e.second));d.ss=c.cache(c.process(c.rtoken(/^[0-5][0-9]/),e.second));d.hms=c.cache(c.sequence([d.H,d.mm,d.ss],d.timePartDelimiter));d.t=c.cache(c.process(d.ctoken2("shortMeridian"),e.meridian));d.tt=c.cache(c.process(d.ctoken2("longMeridian"),e.meridian));d.z=c.cache(c.process(c.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),e.timezone));d.zz=c.cache(c.process(c.rtoken(/^(\+|\-)\s*\d\d\d\d/),e.timezone));
45
  d.zzz=c.cache(c.process(d.ctoken2("timezone"),e.timezone));d.timeSuffix=c.each(c.ignore(d.whiteSpace),c.set([d.tt,d.zzz]));d.time=c.each(c.optional(c.ignore(c.stoken("T"))),d.hms,d.timeSuffix);d.d=c.cache(c.process(c.each(c.rtoken(/^([0-2]\d|3[0-1]|\d)/),c.optional(d.ctoken2("ordinalSuffix"))),e.day));d.dd=c.cache(c.process(c.each(c.rtoken(/^([0-2]\d|3[0-1])/),c.optional(d.ctoken2("ordinalSuffix"))),e.day));d.ddd=d.dddd=c.cache(c.process(d.ctoken("sun mon tue wed thu fri sat"),function(h){return function(){this.weekday=
46
  h}}));d.M=c.cache(c.process(c.rtoken(/^(1[0-2]|0\d|\d)/),e.month));d.MM=c.cache(c.process(c.rtoken(/^(1[0-2]|0\d)/),e.month));d.MMM=d.MMMM=c.cache(c.process(d.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),e.month));d.y=c.cache(c.process(c.rtoken(/^(\d\d?)/),e.year));d.yy=c.cache(c.process(c.rtoken(/^(\d\d)/),e.year));d.yyy=c.cache(c.process(c.rtoken(/^(\d\d?\d?\d?)/),e.year));d.yyyy=c.cache(c.process(c.rtoken(/^(\d\d\d\d)/),e.year));g=function(){return c.each(c.any.apply(null,arguments),
47
  c.not(d.ctoken2("timeContext")))};d.day=g(d.d,d.dd);d.month=g(d.M,d.MMM);d.year=g(d.yyyy,d.yy);d.orientation=c.process(d.ctoken("past future"),function(h){return function(){this.orient=h}});d.operator=c.process(d.ctoken("add subtract"),function(h){return function(){this.operator=h}});d.rday=c.process(d.ctoken("yesterday tomorrow today now"),e.rday);d.unit=c.process(d.ctoken("minute hour day week month year"),function(h){return function(){this.unit=h}});d.value=c.process(c.rtoken(/^\d\d?(st|nd|rd|th)?/),
48
  function(h){return function(){this.value=h.replace(/\D/g,"")}});d.expression=c.set([d.rday,d.operator,d.value,d.unit,d.orientation,d.ddd,d.MMM]);g=function(){return c.set(arguments,d.datePartDelimiter)};d.mdy=g(d.ddd,d.month,d.day,d.year);d.ymd=g(d.ddd,d.year,d.month,d.day);d.dmy=g(d.ddd,d.day,d.month,d.year);d.date=function(h){return(d[Date.CultureInfo.dateElementOrder]||d.mdy).call(this,h)};d.format=c.process(c.many(c.any(c.process(c.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),
49
+ function(h){if(d[h])return d[h];else throw Date.Parsing.Exception(h);}),c.process(c.rtoken(/^[^dMyhHmstz]+/),function(h){return c.ignore(c.stoken(h))}))),function(h){return c.process(c.each.apply(null,h),e.finishExact)});var f={},k=function(h){return f[h]=f[h]||d.format(h)[0]};d.formats=function(h){if(h instanceof Array){for(var i=[],l=0;l<h.length;l++)i.push(k(h[l]));return c.any.apply(null,i)}else return k(h)};d._formats=d.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz",
50
+ "d"]);d._start=c.process(c.set([d.date,d.time,d.expression],d.generalDelimiter,d.whiteSpace),e.finish);d.start=function(h){try{var i=d._formats.call({},h);if(i[1].length===0)return i}catch(l){}return d._start.call({},h)}})();Date._parse=Date.parse;Date.parse=function(b){var c=null;if(!b)return null;try{c=Date.Grammar.start.call({},b)}catch(d){return null}return c[1].length===0?c[0]:null};
51
+ Date.getParseFunction=function(b){var c=Date.Grammar.formats(b);return function(d){var e=null;try{e=c.call({},d)}catch(g){return null}return e[1].length===0?e[0]:null}};Date.parseExact=function(b,c){return Date.getParseFunction(c)(b)};if(!this.JSON)this.JSON={};
52
+ (function(){function b(i){return i<10?"0"+i:i}function c(i){g.lastIndex=0;return g.test(i)?'"'+i.replace(g,function(l){var o=k[l];return typeof o==="string"?o:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'}function d(i,l){var o,q,t=m,s,p=l[i];if(p&&typeof p==="object"&&typeof p.toJSON==="function")p=p.toJSON(i);if(typeof h==="function")p=h.call(l,i,p);switch(typeof p){case "string":return c(p);case "number":return isFinite(p)?String(p):"null";case "boolean":case "null":return String(p);case "object":if(!p)return"null";
53
+ m+=f;s=[];if(Object.prototype.toString.apply(p)==="[object Array]"){q=p.length;for(i=0;i<q;i+=1)s[i]=d(i,p)||"null";l=s.length===0?"[]":m?"[\n"+m+s.join(",\n"+m)+"\n"+t+"]":"["+s.join(",")+"]";m=t;return l}if(h&&typeof h==="object"){q=h.length;for(i=0;i<q;i+=1){o=h[i];if(typeof o==="string")if(l=d(o,p))s.push(c(o)+(m?": ":":")+l)}}else for(o in p)if(Object.hasOwnProperty.call(p,o))if(l=d(o,p))s.push(c(o)+(m?": ":":")+l);l=s.length===0?"{}":m?"{\n"+m+s.join(",\n"+m)+"\n"+t+"}":"{"+s.join(",")+"}";
54
+ m=t;return l}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
55
+ g=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,m,f,k={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},h;if(typeof JSON.stringify!=="function")JSON.stringify=function(i,l,o){var q;f=m="";if(typeof o==="number")for(q=0;q<o;q+=1)f+=" ";else if(typeof o==="string")f=o;if((h=l)&&typeof l!=="function"&&(typeof l!=="object"||typeof l.length!=="number"))throw new Error("JSON.stringify");return d("",
56
+ {"":i})};if(typeof JSON.parseIt!=="function")JSON.parseIt=function(i,l){function o(q,t){var s,p,v=q[t];if(v&&typeof v==="object")for(s in v)if(Object.hasOwnProperty.call(v,s)){p=o(v,s);if(p!==undefined)v[s]=p;else delete v[s]}return l.call(q,t,v)}e.lastIndex=0;if(e.test(i))i=i.replace(e,function(q){return"\\u"+("0000"+q.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(i.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
57
+ "]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){i=eval("("+i+")");return typeof l==="function"?o({"":i},""):i}throw new SyntaxError("JSON.parseIt");}})();(function(b){function c(e,g){function m(j){var n=b(j);return g.globalNav?n:e.parent().find(j)}var f=this,k=b(this),h=!g.vertical,i=e.children(),l=0,o;d||(d=f);b.each(g,function(j,n){b.isFunction(n)&&k.bind(j,n)});if(i.length>1)i=b(g.items,e);e.data("finder",m);var q=m(g.prev),t=m(g.next),s=m(g.prevPage),p=m(g.nextPage);b.extend(f,{getIndex:function(){return l},getClickIndex:function(){var j=f.getItems();return j.index(j.filter("."+g.activeClass))},getConf:function(){return g},getSize:function(){return f.getItems().size()},
58
+ getPageAmount:function(){return Math.ceil(this.getSize()/g.size)},getPageIndex:function(){return Math.ceil(l/g.size)},getNaviButtons:function(){return q.add(t).add(s).add(p)},getRoot:function(){return e},getItemWrap:function(){return i},getItems:function(){return i.children(g.item)},getVisibleItems:function(){return f.getItems().slice(l,l+g.size)},seekTo:function(j,n,u){function w(){u&&u.call(f,j);k.trigger("onSeek",[j])}if(j<0)j=0;if(l===j)return f;if(b.isFunction(n))u=n;if(j>f.getSize()-g.size)return g.loop?
59
+ f.begin():this.end();var y=f.getItems().eq(j);if(!y.length)return f;var z=b.Event("onBeforeSeek");k.trigger(z,j>l);if(z.isDefaultPrevented())return f;if(n===undefined||b.isFunction(n))n=g.speed;h?i.animate({left:-y.position().left},n,g.easing,w):i.animate({top:-y.position().top},n,g.easing,w);d=f;l=j;z=b.Event("onStart");k.trigger(z,[j]);if(z.isDefaultPrevented())return f;q.add(s).toggleClass(g.disabledClass,j===0);t.add(p).toggleClass(g.disabledClass,j>=f.getSize()-g.size);return f},move:function(j,
60
+ n,u){o=j>0;return this.seekTo(l+j,n,u)},next:function(j,n){return this.move(1,j,n)},prev:function(j,n){return this.move(-1,j,n)},movePage:function(j,n,u){o=j>0;var w=g.size*j,y=l%g.size;if(y>0)w+=j>0?-y:g.size-y;return this.move(w,n,u)},prevPage:function(j,n){return this.movePage(-1,j,n)},nextPage:function(j,n){return this.movePage(1,j,n)},setPage:function(j,n,u){return this.seekTo(j*g.size,n,u)},begin:function(j,n){o=false;return this.seekTo(0,j,n)},end:function(j,n){o=true;var u=this.getSize()-
61
+ g.size;return u>0?this.seekTo(u,j,n):f},reload:function(){k.trigger("onReload");return f},focus:function(){return d=f},click:function(j){var n=f.getItems().eq(j),u=g.activeClass,w=g.size;if(j<0||j>=f.getSize())return f;if(w==1){if(g.loop)return f.next();if(j===0||j==f.getSize()-1)o=o===undefined?true:!o;return o===false?f.prev():f.next()}if(w==2){j==l&&j--;f.getItems().removeClass(u);n.addClass(u);return f.seekTo(j,time,fn)}if(!n.hasClass(u)){f.getItems().removeClass(u);n.addClass(u);n=Math.floor(w/
62
+ 2);n=j-n;if(n>f.getSize()-w)n=f.getSize()-w;if(n!==j)return f.seekTo(n)}return f},bind:function(j,n){k.bind(j,n);return f},unbind:function(j){k.unbind(j);return f}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),function(j,n){f[n]=function(u){return f.bind(n,u)}});q.addClass(g.disabledClass).click(function(){f.prev()});t.click(function(){f.next()});p.click(function(){f.nextPage()});f.getSize()<g.size&&t.add(p).addClass(g.disabledClass);s.addClass(g.disabledClass).click(function(){f.prevPage()});
63
+ var v=g.hoverClass,x="keydown."+Math.random().toString().substring(10);f.onReload(function(){v&&f.getItems().hover(function(){b(this).addClass(v)},function(){b(this).removeClass(v)});g.clickable&&f.getItems().each(function(j){b(this).unbind("click.scrollable").bind("click.scrollable",function(n){if(!b(n.target).is("a"))return f.click(j)})});g.keyboard?b(document).unbind(x).bind(x,function(j){if(!(j.altKey||j.ctrlKey))if(!(g.keyboard!="static"&&d!=f)){var n=g.keyboardSteps;if(h&&(j.keyCode==37||j.keyCode==
64
+ 39)){f.move(j.keyCode==37?-n:n);return j.preventDefault()}if(!h&&(j.keyCode==38||j.keyCode==40)){f.move(j.keyCode==38?-n:n);return j.preventDefault()}return true}}):b(document).unbind(x)});f.reload()}b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",
65
+ nextPage:".nextPage",api:false}};var d;b.fn.scrollable=function(e){var g=this.eq(typeof e=="number"?e:0).data("scrollable");if(g)return g;var m=b.extend({},b.tools.scrollable.conf);e=b.extend(m,e);e.keyboardSteps=e.keyboardSteps||e.size;this.each(function(){g=new c(b(this),e);b(this).data("scrollable",g)});return e.api?g:this}})(jQuery);var humanMsg={setup:function(b,c){humanMsg.msgID="humanMsg";humanMsg.logID="humanMsgLog";if(b==undefined)b="body";humanMsg.msgOpacity=0.8;if(c!=undefined)humanMsg.msgOpacity=parseFloat(c);jQuery(b).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><div class="round"></div><p></p><div class="round"></div></div>');jQuery("#"+humanMsg.logID+" p").click(function(){jQuery(this).siblings("ul").slideToggle()})},displayMsg:function(b){if(b!=""){clearTimeout(humanMsg.t2);jQuery("#"+humanMsg.msgID+" p").html(b);
66
  jQuery("#"+humanMsg.msgID+"").show().animate({opacity:humanMsg.msgOpacity},200,function(){jQuery("#"+humanMsg.logID).show().children("ul").prepend("<li>"+b+"</li>").children("li:first").slideDown(200);jQuery("#"+humanMsg.logID+" ul").css("display")=="none"&&jQuery("#"+humanMsg.logID+" p").animate({bottom:40},200,"linear",function(){jQuery(this).animate({bottom:0},300,"easeOutBounce",function(){jQuery(this).css({bottom:0})})})});humanMsg.t1=setTimeout("humanMsg.bindEvents()",700);humanMsg.t2=setTimeout("humanMsg.removeMsg()",
67
+ 5E3)}},bindEvents:function(){jQuery(window).mousemove(humanMsg.removeMsg).click(humanMsg.removeMsg).keypress(humanMsg.removeMsg)},removeMsg:function(){jQuery(window).unbind("mousemove",humanMsg.removeMsg).unbind("click",humanMsg.removeMsg).unbind("keypress",humanMsg.removeMsg);jQuery("#"+humanMsg.msgID).css("opacity")==humanMsg.msgOpacity&&jQuery("#"+humanMsg.msgID).animate({opacity:0},500,function(){jQuery(this).hide()})}};jQuery(document).ready(function(){humanMsg.setup()});(function(b){function c(g){switch(g.type){case "mousemove":return b.extend(g.data,{clientX:g.clientX,clientY:g.clientY,pageX:g.pageX,pageY:g.pageY});case "DOMMouseScroll":b.extend(g,g.data);g.delta=-g.detail/3;break;case "mousewheel":g.delta=g.wheelDelta/120;break}g.type="wheel";return b.event.handle.call(this,g,g.delta)}b.fn.wheel=function(g){return this[g?"bind":"trigger"]("wheel",g)};b.event.special.wheel={setup:function(){b.event.add(this,d,c,{})},teardown:function(){b.event.remove(this,d,c)}};
68
+ var d=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":""),e=b.tools.scrollable;e.plugins=e.plugins||{};e.plugins.mousewheel={version:"1.0.1",conf:{api:false,speed:50}};b.fn.mousewheel=function(g){var m=b.extend({},e.plugins.mousewheel.conf),f;if(typeof g=="number")g={speed:g};g=b.extend(m,g);this.each(function(){var k=b(this).scrollable();if(k)f=k;k.getRoot().wheel(function(h,i){k.move(i<0?1:-1,g.speed||50);return false})});return g.api?f:this}})(jQuery);(function(b){b.fn.bgIframe=b.fn.bgiframe=function(c){if(b.browser.msie&&parseInt(b.browser.version)<=6){c=b.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},c||{});var d=function(g){return g&&g.constructor==Number?g+"px":g},e='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(c.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
69
+ d(c.top))+";left:"+(c.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":d(c.left))+";width:"+(c.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":d(c.width))+";height:"+(c.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":d(c.height))+';"/>';return this.each(function(){b("> iframe.bgiframe",this).length==0&&this.insertBefore(document.createElement(e),this.firstChild)})}return this};if(!b.browser.version)b.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1]})(jQuery);(function(b){b.each({focus:"focusin",blur:"focusout"},function(c,d){b.event.special[d]={setup:function(){if(b.browser.msie)return false;this.addEventListener(c,b.event.special[d].handler,true)},teardown:function(){if(b.browser.msie)return false;this.removeEventListener(c,b.event.special[d].handler,true)},handler:function(e){arguments[0]=b.event.fix(e);arguments[0].type=d;return b.event.handle.apply(this,arguments)}}});b.extend(b.fn,{delegate:function(c,d,e){return this.bind(c,function(g){var m=b(g.target);
70
+ if(m.is(d))return e.apply(m,arguments)})},triggerEvent:function(c,d){return this.triggerHandler(c,[b.event.fix({type:c,target:d})])}})})(jQuery);(function(b){b.widget("ui.draggable",b.extend({},b.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  this._mouseDestroy()}},_mouseCapture:function(c){var d=this.options;if(this.helper||d.disabled||b(c.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(c);if(!this.handle)return false;return true},_mouseStart:function(c){var d=this.options;this.helper=this._createHelper(c);this._cacheHelperProportions();if(b.ui.ddmanager)b.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();
72
  this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};b.extend(this.offset,{click:{left:c.pageX-this.offset.left,top:c.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(c);this.originalPageX=c.pageX;this.originalPageY=c.pageY;d.cursorAt&&this._adjustOffsetFromHelper(d.cursorAt);d.containment&&this._setContainment();this._trigger("start",c);this._cacheHelperProportions();b.ui.ddmanager&&
73
  !d.dropBehaviour&&b.ui.ddmanager.prepareOffsets(this,c);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(c,true);return true},_mouseDrag:function(c,d){this.position=this._generatePosition(c);this.positionAbs=this._convertPositionTo("absolute");if(!d){d=this._uiHash();this._trigger("drag",c,d);this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+
81
  10)||0)+(parseInt(b(d).css("paddingTop"),10)||0)-this.margins.top,c.left+(e?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(b(d).css("borderLeftWidth"),10)||0)-(parseInt(b(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,c.top+(e?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(b(d).css("borderTopWidth"),10)||0)-(parseInt(b(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(c.containment.constructor==
82
  Array)this.containment=c.containment},_convertPositionTo:function(c,d){if(!d)d=this.position;c=c=="absolute"?1:-1;var e=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(e[0].tagName);return{top:d.top+this.offset.relative.top*c+this.offset.parent.top*c-(b.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:e.scrollTop())*
83
  c),left:d.left+this.offset.relative.left*c+this.offset.parent.left*c-(b.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:e.scrollLeft())*c)}},_generatePosition:function(c){var d=this.options,e=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(e[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=
84
+ document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var m=c.pageX,f=c.pageY;if(this.originalPosition){if(this.containment){if(c.pageX-this.offset.click.left<this.containment[0])m=this.containment[0]+this.offset.click.left;if(c.pageY-this.offset.click.top<this.containment[1])f=this.containment[1]+this.offset.click.top;if(c.pageX-this.offset.click.left>this.containment[2])m=this.containment[2]+this.offset.click.left;if(c.pageY-this.offset.click.top>this.containment[3])f=
85
+ this.containment[3]+this.offset.click.top}if(d.grid){f=this.originalPageY+Math.round((f-this.originalPageY)/d.grid[1])*d.grid[1];f=this.containment?!(f-this.offset.click.top<this.containment[1]||f-this.offset.click.top>this.containment[3])?f:!(f-this.offset.click.top<this.containment[1])?f-d.grid[1]:f+d.grid[1]:f;m=this.originalPageX+Math.round((m-this.originalPageX)/d.grid[0])*d.grid[0];m=this.containment?!(m-this.offset.click.left<this.containment[0]||m-this.offset.click.left>this.containment[2])?
86
+ m:!(m-this.offset.click.left<this.containment[0])?m-d.grid[0]:m+d.grid[0]:m}}return{top:f-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(b.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:e.scrollTop()),left:m-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(b.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:e.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");
87
  this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(c,d,e){e=e||this._uiHash();b.ui.plugin.call(this,c,[d,e]);if(c=="drag")this.positionAbs=this._convertPositionTo("absolute");return b.widget.prototype._trigger.call(this,c,d,e)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));b.extend(b.ui.draggable,{version:"1.7.2",
88
  eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});b.ui.plugin.add("draggable","connectToSortable",{start:function(c,
89
+ d){var e=b(this).data("draggable"),g=e.options,m=b.extend({},d,{item:e.element});e.sortables=[];b(g.connectToSortable).each(function(){var f=b.data(this,"sortable");if(f&&!f.options.disabled){e.sortables.push({instance:f,shouldRevert:f.options.revert});f._refreshItems();f._trigger("activate",c,m)}})},stop:function(c,d){var e=b(this).data("draggable"),g=b.extend({},d,{item:e.element});b.each(e.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;e.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=
90
  false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;e.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,g)}})},drag:function(c,d){var e=b(this).data("draggable"),g=this;b.each(e.sortables,function(){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;
91
  this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=b(g).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return d.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=
92
  e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}this.instance.currentItem&&this.instance._mouseDrag(c)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;
93
  this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();e._trigger("fromSortable",c);e.dropped=false}})}});b.ui.plugin.add("draggable","cursor",{start:function(){var c=b("body"),d=b(this).data("draggable").options;if(c.css("cursor"))d._cursor=c.css("cursor");c.css("cursor",
94
+ d.cursor)},stop:function(){if(b(this).data("draggable")){var c=b(this).data("draggable").options;c._cursor&&b("body").css("cursor",c._cursor)}}});b.ui.plugin.add("draggable","iframeFix",{start:function(){var c=b(this).data("draggable").options;b(c.iframeFix===true?"iframe":c.iframeFix).each(function(){b('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(b(this).offset()).appendTo("body")})},
95
  stop:function(){b("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});b.ui.plugin.add("draggable","opacity",{start:function(c,d){c=b(d.helper);d=b(this).data("draggable").options;if(c.css("opacity"))d._opacity=c.css("opacity");c.css("opacity",d.opacity)},stop:function(c,d){c=b(this).data("draggable").options;c._opacity&&b(d.helper).css("opacity",c._opacity)}});b.ui.plugin.add("draggable","scroll",{start:function(){var c=b(this).data("draggable");if(c.scrollParent[0]!=
96
  document&&c.scrollParent[0].tagName!="HTML")c.overflowOffset=c.scrollParent.offset()},drag:function(c){var d=b(this).data("draggable"),e=d.options,g=false;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")if(d.overflowOffset.top+d.scrollParent[0].offsetHeight-c.pageY<e.scrollSensitivity)d.scrollParent[0].scrollTop=g=d.scrollParent[0].scrollTop+e.scrollSpeed;else if(c.pageY-d.overflowOffset.top<e.scrollSensitivity)d.scrollParent[0].scrollTop=g=d.scrollParent[0].scrollTop-
97
  e.scrollSpeed;if(!e.axis||e.axis!="y")if(d.overflowOffset.left+d.scrollParent[0].offsetWidth-c.pageX<e.scrollSensitivity)d.scrollParent[0].scrollLeft=g=d.scrollParent[0].scrollLeft+e.scrollSpeed;else if(c.pageX-d.overflowOffset.left<e.scrollSensitivity)d.scrollParent[0].scrollLeft=g=d.scrollParent[0].scrollLeft-e.scrollSpeed}else{if(!e.axis||e.axis!="x")if(c.pageY-b(document).scrollTop()<e.scrollSensitivity)g=b(document).scrollTop(b(document).scrollTop()-e.scrollSpeed);else if(b(window).height()-
98
  (c.pageY-b(document).scrollTop())<e.scrollSensitivity)g=b(document).scrollTop(b(document).scrollTop()+e.scrollSpeed);if(!e.axis||e.axis!="y")if(c.pageX-b(document).scrollLeft()<e.scrollSensitivity)g=b(document).scrollLeft(b(document).scrollLeft()-e.scrollSpeed);else if(b(window).width()-(c.pageX-b(document).scrollLeft())<e.scrollSensitivity)g=b(document).scrollLeft(b(document).scrollLeft()+e.scrollSpeed)}g!==false&&b.ui.ddmanager&&!e.dropBehaviour&&b.ui.ddmanager.prepareOffsets(d,c)}});b.ui.plugin.add("draggable",
99
+ "snap",{start:function(){var c=b(this).data("draggable"),d=c.options;c.snapElements=[];b(d.snap.constructor!=String?d.snap.items||":data(draggable)":d.snap).each(function(){var e=b(this),g=e.offset();this!=c.element[0]&&c.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:g.top,left:g.left})})},drag:function(c,d){for(var e=b(this).data("draggable"),g=e.options,m=g.snapTolerance,f=d.offset.left,k=f+e.helperProportions.width,h=d.offset.top,i=h+e.helperProportions.height,l=
100
+ e.snapElements.length-1;l>=0;l--){var o=e.snapElements[l].left,q=o+e.snapElements[l].width,t=e.snapElements[l].top,s=t+e.snapElements[l].height;if(o-m<f&&f<q+m&&t-m<h&&h<s+m||o-m<f&&f<q+m&&t-m<i&&i<s+m||o-m<k&&k<q+m&&t-m<h&&h<s+m||o-m<k&&k<q+m&&t-m<i&&i<s+m){if(g.snapMode!="inner"){var p=Math.abs(t-i)<=m,v=Math.abs(s-h)<=m,x=Math.abs(o-k)<=m,j=Math.abs(q-f)<=m;if(p)d.position.top=e._convertPositionTo("relative",{top:t-e.helperProportions.height,left:0}).top-e.margins.top;if(v)d.position.top=e._convertPositionTo("relative",
101
+ {top:s,left:0}).top-e.margins.top;if(x)d.position.left=e._convertPositionTo("relative",{top:0,left:o-e.helperProportions.width}).left-e.margins.left;if(j)d.position.left=e._convertPositionTo("relative",{top:0,left:q}).left-e.margins.left}var n=p||v||x||j;if(g.snapMode!="outer"){p=Math.abs(t-h)<=m;v=Math.abs(s-i)<=m;x=Math.abs(o-f)<=m;j=Math.abs(q-k)<=m;if(p)d.position.top=e._convertPositionTo("relative",{top:t,left:0}).top-e.margins.top;if(v)d.position.top=e._convertPositionTo("relative",{top:s-e.helperProportions.height,
102
+ left:0}).top-e.margins.top;if(x)d.position.left=e._convertPositionTo("relative",{top:0,left:o}).left-e.margins.left;if(j)d.position.left=e._convertPositionTo("relative",{top:0,left:q-e.helperProportions.width}).left-e.margins.left}if(!e.snapElements[l].snapping&&(p||v||x||j||n))e.options.snap.snap&&e.options.snap.snap.call(e.element,c,b.extend(e._uiHash(),{snapItem:e.snapElements[l].item}));e.snapElements[l].snapping=p||v||x||j||n}else{e.snapElements[l].snapping&&e.options.snap.release&&e.options.snap.release.call(e.element,
103
+ c,b.extend(e._uiHash(),{snapItem:e.snapElements[l].item}));e.snapElements[l].snapping=false}}}});b.ui.plugin.add("draggable","stack",{start:function(){var c=b(this).data("draggable").options,d=b.makeArray(b(c.stack.group)).sort(function(e,g){return(parseInt(b(e).css("zIndex"),10)||c.stack.min)-(parseInt(b(g).css("zIndex"),10)||c.stack.min)});b(d).each(function(e){this.style.zIndex=c.stack.min+e});this[0].style.zIndex=c.stack.min+d.length}});b.ui.plugin.add("draggable","zIndex",{start:function(c,d){c=
104
+ b(d.helper);d=b(this).data("draggable").options;if(c.css("zIndex"))d._zIndex=c.css("zIndex");c.css("zIndex",d.zIndex)},stop:function(c,d){c=b(this).data("draggable").options;c._zIndex&&b(d.helper).css("zIndex",c._zIndex)}})})(jQuery);(function(b){function c(e,g){function m(j){var n=b(j);return g.globalNav?n:e.parent().find(j)}var f=this,k=b(this),h=!g.vertical,i=e.children(),l=0,o;d||(d=f);b.each(g,function(j,n){b.isFunction(n)&&k.bind(j,n)});if(i.length>1)i=b(g.items,e);e.data("finder",m);var q=m(g.prev),t=m(g.next),s=m(g.prevPage),p=m(g.nextPage);b.extend(f,{getIndex:function(){return l},getClickIndex:function(){var j=f.getItems();return j.index(j.filter("."+g.activeClass))},getConf:function(){return g},getSize:function(){return f.getItems().size()},
105
+ getPageAmount:function(){return Math.ceil(this.getSize()/g.size)},getPageIndex:function(){return Math.ceil(l/g.size)},getNaviButtons:function(){return q.add(t).add(s).add(p)},getRoot:function(){return e},getItemWrap:function(){return i},getItems:function(){return i.children(g.item)},getVisibleItems:function(){return f.getItems().slice(l,l+g.size)},seekTo:function(j,n,u){function w(){u&&u.call(f,j);k.trigger("onSeek",[j])}if(j<0)j=0;if(l===j)return f;if(b.isFunction(n))u=n;if(j>f.getSize()-g.size)return g.loop?
106
+ f.begin():this.end();var y=f.getItems().eq(j);if(!y.length)return f;var z=b.Event("onBeforeSeek");k.trigger(z,[j]);if(z.isDefaultPrevented())return f;if(n===undefined||b.isFunction(n))n=g.speed;h?i.animate({left:-y.position().left},n,g.easing,w):i.animate({top:-y.position().top},n,g.easing,w);d=f;l=j;z=b.Event("onStart");k.trigger(z,[j]);if(z.isDefaultPrevented())return f;q.add(s).toggleClass(g.disabledClass,j===0);t.add(p).toggleClass(g.disabledClass,j>=f.getSize()-g.size);return f},move:function(j,
107
+ n,u){o=j>0;return this.seekTo(l+j,n,u)},next:function(j,n){return this.move(1,j,n)},prev:function(j,n){return this.move(-1,j,n)},movePage:function(j,n,u){o=j>0;var w=g.size*j,y=l%g.size;if(y>0)w+=j>0?-y:g.size-y;return this.move(w,n,u)},prevPage:function(j,n){return this.movePage(-1,j,n)},nextPage:function(j,n){return this.movePage(1,j,n)},setPage:function(j,n,u){return this.seekTo(j*g.size,n,u)},begin:function(j,n){o=false;return this.seekTo(0,j,n)},end:function(j,n){o=true;var u=this.getSize()-
108
+ g.size;return u>0?this.seekTo(u,j,n):f},reload:function(){k.trigger("onReload");return f},focus:function(){return d=f},click:function(j){var n=f.getItems().eq(j),u=g.activeClass,w=g.size;if(j<0||j>=f.getSize())return f;if(w==1){if(g.loop)return f.next();if(j===0||j==f.getSize()-1)o=o===undefined?true:!o;return o===false?f.prev():f.next()}if(w==2){j==l&&j--;f.getItems().removeClass(u);n.addClass(u);return f.seekTo(j,time,fn)}if(!n.hasClass(u)){f.getItems().removeClass(u);n.addClass(u);n=Math.floor(w/
109
+ 2);n=j-n;if(n>f.getSize()-w)n=f.getSize()-w;if(n!==j)return f.seekTo(n)}return f},bind:function(j,n){k.bind(j,n);return f},unbind:function(j){k.unbind(j);return f}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),function(j,n){f[n]=function(u){return f.bind(n,u)}});q.addClass(g.disabledClass).click(function(){f.prev()});t.click(function(){f.next()});p.click(function(){f.nextPage()});f.getSize()<g.size&&t.add(p).addClass(g.disabledClass);s.addClass(g.disabledClass).click(function(){f.prevPage()});
110
+ var v=g.hoverClass,x="keydown."+Math.random().toString().substring(10);f.onReload(function(){v&&f.getItems().hover(function(){b(this).addClass(v)},function(){b(this).removeClass(v)});g.clickable&&f.getItems().each(function(j){b(this).unbind("click.scrollable").bind("click.scrollable",function(n){if(!b(n.target).is("a"))return f.click(j)})});g.keyboard?b(document).unbind(x).bind(x,function(j){if(!(j.altKey||j.ctrlKey))if(!(g.keyboard!="static"&&d!=f)){var n=g.keyboardSteps;if(h&&(j.keyCode==37||j.keyCode==
111
+ 39)){f.move(j.keyCode==37?-n:n);return j.preventDefault()}if(!h&&(j.keyCode==38||j.keyCode==40)){f.move(j.keyCode==38?-n:n);return j.preventDefault()}return true}}):b(document).unbind(x)});f.reload()}b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",
112
+ nextPage:".nextPage",api:false}};var d;b.fn.scrollable=function(e){var g=this.eq(typeof e=="number"?e:0).data("scrollable");if(g)return g;var m=b.extend({},b.tools.scrollable.conf);e=b.extend(m,e);e.keyboardSteps=e.keyboardSteps||e.size;this.each(function(){g=new c(b(this),e);b(this).data("scrollable",g)});return e.api?g:this}})(jQuery);
113
+ (function(b){var c=b.tools.scrollable;c.plugins=c.plugins||{};c.plugins.autoscroll={version:"1.0.1",conf:{autoplay:true,interval:3E3,autopause:true,steps:1,api:false}};b.fn.autoscroll=function(d){if(typeof d=="number")d={interval:d};var e=b.extend({},c.plugins.autoscroll.conf),g;b.extend(e,d);this.each(function(){var m=b(this).scrollable();if(m)g=m;var f,k,h=true;m.play=function(){if(!f){h=false;f=setInterval(function(){m.move(e.steps)},e.interval);m.move(e.steps)}};m.pause=function(){f=clearInterval(f)};
114
+ m.stop=function(){m.pause();h=true};e.autopause&&m.getRoot().add(m.getNaviButtons()).hover(function(){m.pause();clearInterval(k)},function(){h||(k=setTimeout(m.play,e.interval))});e.autoplay&&setTimeout(m.play,e.interval)});return e.api?g:this}})(jQuery);
115
+ (function(b){var c=b.tools.scrollable;c.plugins=c.plugins||{};c.plugins.navigator={version:"1.0.2",conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:false,api:false,idPrefix:null}};b.fn.navigator=function(d){var e=b.extend({},c.plugins.navigator.conf),g;if(typeof d=="string")d={navi:d};d=b.extend(e,d);this.each(function(){function m(){if(!k.children().length||k.data("navi")==f){k.empty();k.data("navi",f);for(var o=0;o<f.getPageAmount();o++)k.append(b("<"+(d.naviItem||"a")+"/>"));h=k.children().each(function(q){var t=
116
+ b(this);t.click(function(s){f.setPage(q);return s.preventDefault()});d.indexed&&t.text(q);d.idPrefix&&t.attr("id",d.idPrefix+q)})}else{h=d.naviItem?k.find(d.naviItem):k.children();h.each(function(q){b(this).click(function(t){f.setPage(q);return t.preventDefault()})})}h.eq(0).addClass(d.activeClass)}var f=b(this).scrollable(),k=f.getRoot().data("finder").call(null,d.navi),h=null,i=f.getNaviButtons();if(f)g=f;f.getNaviButtons=function(){return i.add(k)};f.onStart(function(){var o=d.activeClass;h.removeClass(o).eq(f.getPageIndex()).addClass(o)});
117
+ f.onReload(function(){m()});m();var l=h.filter("[href="+location.hash+"]");l.length&&f.move(h.index(l))});return d.api?g:this}})(jQuery);
118
+ (function(b){function c(g){switch(g.type){case "mousemove":return b.extend(g.data,{clientX:g.clientX,clientY:g.clientY,pageX:g.pageX,pageY:g.pageY});case "DOMMouseScroll":b.extend(g,g.data);g.delta=-g.detail/3;break;case "mousewheel":g.delta=g.wheelDelta/120;break}g.type="wheel";return b.event.handle.call(this,g,g.delta)}b.fn.wheel=function(g){return this[g?"bind":"trigger"]("wheel",g)};b.event.special.wheel={setup:function(){b.event.add(this,d,c,{})},teardown:function(){b.event.remove(this,d,c)}};
119
+ var d=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":""),e=b.tools.scrollable;e.plugins=e.plugins||{};e.plugins.mousewheel={version:"1.0.1",conf:{api:false,speed:50}};b.fn.mousewheel=function(g){var m=b.extend({},e.plugins.mousewheel.conf),f;if(typeof g=="number")g={speed:g};g=b.extend(m,g);this.each(function(){var k=b(this).scrollable();if(k)f=k;k.getRoot().wheel(function(h,i){k.move(i<0?1:-1,g.speed||50);return false})});return g.api?f:this}})(jQuery);(function(b){b.widget("ui.droppable",{_init:function(){var c=this.options.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&b.isFunction(this.options.accept)?this.options.accept:function(d){return d.is(c)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[this.options.scope]=b.ui.ddmanager.droppables[this.options.scope]||[];b.ui.ddmanager.droppables[this.options.scope].push(this);this.options.addClasses&&this.element.addClass("ui-droppable")},
120
+ destroy:function(){for(var c=b.ui.ddmanager.droppables[this.options.scope],d=0;d<c.length;d++)c[d]==this&&c.splice(d,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(c,d){if(c=="accept")this.options.accept=d&&b.isFunction(d)?d:function(e){return e.is(d)};else b.widget.prototype._setData.apply(this,arguments)},_activate:function(c){var d=b.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass);
121
+ d&&this._trigger("activate",c,this.ui(d))},_deactivate:function(c){var d=b.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);d&&this._trigger("deactivate",c,this.ui(d))},_over:function(c){var d=b.ui.ddmanager.current;if(!(!d||(d.currentItem||d.element)[0]==this.element[0]))if(this.options.accept.call(this.element[0],d.currentItem||d.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);this._trigger("over",c,this.ui(d))}},
122
+ _out:function(c){var d=b.ui.ddmanager.current;if(!(!d||(d.currentItem||d.element)[0]==this.element[0]))if(this.options.accept.call(this.element[0],d.currentItem||d.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",c,this.ui(d))}},_drop:function(c,d){var e=d||b.ui.ddmanager.current;if(!e||(e.currentItem||e.element)[0]==this.element[0])return false;var g=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var m=
123
+ b.data(this,"droppable");if(m.options.greedy&&b.ui.intersect(e,b.extend(m,{offset:m.element.offset()}),m.options.tolerance)){g=true;return false}});if(g)return false;if(this.options.accept.call(this.element[0],e.currentItem||e.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",c,this.ui(e));return this.element}return false},ui:function(c){return{draggable:c.currentItem||
124
+ c.element,helper:c.helper,position:c.position,absolutePosition:c.positionAbs,offset:c.positionAbs}}});b.extend(b.ui.droppable,{version:"1.7.2",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});b.ui.intersect=function(c,d,e){if(!d.offset)return false;var g=(c.positionAbs||c.position.absolute).left,m=g+c.helperProportions.width,f=(c.positionAbs||c.position.absolute).top,k=f+c.helperProportions.height,h=d.offset.left,
125
+ i=h+d.proportions.width,l=d.offset.top,o=l+d.proportions.height;switch(e){case "fit":return h<g&&m<i&&l<f&&k<o;case "intersect":return h<g+c.helperProportions.width/2&&m-c.helperProportions.width/2<i&&l<f+c.helperProportions.height/2&&k-c.helperProportions.height/2<o;case "pointer":return b.ui.isOver((c.positionAbs||c.position.absolute).top+(c.clickOffset||c.offset.click).top,(c.positionAbs||c.position.absolute).left+(c.clickOffset||c.offset.click).left,l,h,d.proportions.height,d.proportions.width);
126
+ case "touch":return(f>=l&&f<=o||k>=l&&k<=o||f<l&&k>o)&&(g>=h&&g<=i||m>=h&&m<=i||g<h&&m>i);default:return false}};b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(c,d){var e=b.ui.ddmanager.droppables[c.options.scope],g=d?d.type:null,m=(c.currentItem||c.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<e.length;f++)if(!(e[f].options.disabled||c&&!e[f].options.accept.call(e[f].element[0],c.currentItem||c.element))){for(var k=0;k<m.length;k++)if(m[k]==e[f].element[0]){e[f].proportions.height=
127
+ 0;continue a}e[f].visible=e[f].element.css("display")!="none";if(e[f].visible){e[f].offset=e[f].element.offset();e[f].proportions={width:e[f].element[0].offsetWidth,height:e[f].element[0].offsetHeight};g=="mousedown"&&e[f]._activate.call(e[f],d)}}},drop:function(c,d){var e=false;b.each(b.ui.ddmanager.droppables[c.options.scope],function(){if(this.options){if(!this.options.disabled&&this.visible&&b.ui.intersect(c,this,this.options.tolerance))e=this._drop.call(this,d);if(!this.options.disabled&&this.visible&&
128
+ this.options.accept.call(this.element[0],c.currentItem||c.element)){this.isout=1;this.isover=0;this._deactivate.call(this,d)}}});return e},drag:function(c,d){c.options.refreshPositions&&b.ui.ddmanager.prepareOffsets(c,d);b.each(b.ui.ddmanager.droppables[c.options.scope],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var e=b.ui.intersect(c,this,this.options.tolerance);if(e=!e&&this.isover==1?"isout":e&&this.isover==0?"isover":null){var g;if(this.options.greedy){var m=this.element.parents(":data(droppable):eq(0)");
129
+ if(m.length){g=b.data(m[0],"droppable");g.greedyChild=e=="isover"?1:0}}if(g&&e=="isover"){g.isover=0;g.isout=1;g._out.call(g,d)}this[e]=1;this[e=="isout"?"isover":"isout"]=0;this[e=="isover"?"_over":"_out"].call(this,d);if(g&&e=="isout"){g.isout=0;g.isover=1;g._over.call(g,d)}}}})}}})(jQuery);(function(b){function c(p){if(!h.parent){h.parent=b('<div id="'+p.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();b.fn.bgiframe&&h.parent.bgiframe();h.body=b("div.body",h.parent)}}function d(p){if(p)return b.data(p,"tooltip");else b("#tooltip").hide()}function e(p){s=!!d(this).track;b(document.body).bind("mousemove",f);f(p)}function g(){if(!(b.tooltip.blocked||this==i||!this.tooltipText&&!d(this).bodyHandler)){i=this;e.apply(i,arguments)}}function m(){if(d(i)){h.parent.css({left:o,
130
+ right:q,top:l});var p=k(),v=h.parent[0];if(o+200>p.x+p.cx){o-=v.offsetWidth+d(i).left+(o+225-(p.x+p.cx));h.parent.css({left:o+"px"}).addClass("viewport-right")}if(l+100>p.y+p.cy){l-=v.offsetHeight+100+d(i).top;h.parent.css({top:l+"px"}).addClass("viewport-bottom")}if(p.x+p.cx<v.offsetLeft+v.offsetWidth){o-=v.offsetWidth+20+d(i).left+150;h.parent.css({left:o+"px"}).addClass("viewport-right")}if(p.y+p.cy<v.offsetTop+v.offsetHeight){l-=v.offsetHeight+20+d(i).top;h.parent.css({top:l+"px"}).addClass("viewport-bottom")}if(d(i).bodyHandler){p=
131
+ d(i).bodyHandler.call(i);p.nodeType||p.jquery?h.body.empty().append(p):h.body.html(p);h.body.show()}else if(d(i).showBody){p=d(i).showBody;h.body.empty();v=0;for(var x;x=p[v];v++){v>0&&h.body.append("<br/>");h.body.append(x)}h.body.hideWhenEmpty()}else h.body.hide();h.parent.addClass(d(i).extraClass);d(i).fixPNG&&h.parent.fixPNG();if(d(i)){if((!t||!b.fn.bgiframe)&&d(i).fade)if(h.parent.is(":animated"))h.parent.stop().show().fadeTo(d(i).fade,i.tOpacity);else h.parent.is(":visible")?h.parent.fadeTo(d(i).fade,
132
+ i.tOpacity):h.parent.fadeIn(d(i).fade);else h.parent.show();d(i).showHandler&&d(i).showHandler.call(i)}}}function f(p){if(!b.tooltip.blocked)if(d(i))if(!(p&&p.target.tagName=="OPTION")){!s&&h.parent.is(":visible")&&b(document.body).unbind("mousemove",f);if(i==null)b(document.body).unbind("mousemove",f);else{h.parent.removeClass("viewport-right").removeClass("viewport-bottom");o=h.parent[0].offsetLeft;l=h.parent[0].offsetTop;if(p){o=p.pageX+d(i).left;l=p.pageY+d(i).top;q="auto";if(d(i).positionLeft){q=
133
+ b(window).width()-left;o="auto"}}}}}function k(){return{x:b(window).scrollLeft(),y:b(window).scrollTop(),cx:b(window).width(),cy:b(window).height()}}var h={},i,l,o,q="auto",t=b.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),s=false;b.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){b.tooltip.blocked=!b.tooltip.blocked}};b.fn.extend({tooltip:function(p){p=b.extend({},b.tooltip.defaults,p);c(p);return this.each(function(){b.data(this,
134
+ "tooltip",p);this.tOpacity=h.parent.css("opacity")}).mouseover(g).mouseup(function(){m()})},hideWhenEmpty:function(){return this.each(function(){b(this)[b(this).html()?"show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}})})(jQuery);
lib/jquery.tooltip.js CHANGED
@@ -130,13 +130,31 @@
130
  right: _right,
131
  top: _top
132
  });
133
-
134
- var v = viewport(),
135
  h = helper.parent[0];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  // check horizontal position
137
  if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
138
  _left -= h.offsetWidth + 20 + tooltipsettings(current).left + 150;
139
- helper.parent.css({left: _left + 'px'}).addClass("viewport-right");
140
  }
141
  // check vertical position
142
  if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
@@ -183,6 +201,10 @@
183
  } else {
184
  helper.parent.show();
185
  }
 
 
 
 
186
  }
187
 
188
  /**
130
  right: _right,
131
  top: _top
132
  });
133
+
134
+ var v = viewport(),
135
  h = helper.parent[0];
136
+
137
+ /*
138
+ * We don't want the tooltip to cause scroll bars to appear.
139
+ * First we check the left.
140
+ */
141
+ if (_left + 200 > v.x + v.cx) {
142
+ _left -= h.offsetWidth + tooltipsettings(current).left + ((_left + 225) - (v.x + v.cx));
143
+ helper.parent.css({left: _left + 'px'}).addClass("viewport-right");
144
+ }
145
+
146
+ /*
147
+ * Now we check the top
148
+ */
149
+ if (_top + 100 > v.y + v.cy) {
150
+ _top -= h.offsetHeight + 100 + tooltipsettings(current).top;
151
+ helper.parent.css({top: _top + 'px'}).addClass("viewport-bottom");
152
+ }
153
+
154
  // check horizontal position
155
  if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
156
  _left -= h.offsetWidth + 20 + tooltipsettings(current).left + 150;
157
+ helper.parent.css({left: _left + 'px'}).addClass("viewport-right");
158
  }
159
  // check vertical position
160
  if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
201
  } else {
202
  helper.parent.show();
203
  }
204
+
205
+ if (tooltipsettings(current).showHandler) {
206
+ tooltipsettings(current).showHandler.call(current);
207
+ }
208
  }
209
 
210
  /**
readme.txt CHANGED
@@ -1,70 +1,75 @@
1
- === Editorial Calendar ===
2
- Contributors: MaryVogt, zgrossbart
3
- Tags: posts, post, calendar, AJAX, admin, administration
4
- Requires at least: 2.8.5
5
- Tested up to: 2.8.6
6
- Stable tag: 0.3
7
-
8
- Editorial calendar makes it possible to see all your posts and drag and drop them to manage your blog.
9
-
10
- == Description ==
11
-
12
- The editorial calendar lets WordPress administrators and editors manage the dates for multiple posts at once. You see all of your posts in a calendar view and can arrange them via an easy drag and drop interface. The editorial calendar greatly improves any blog that plans posts in advance or takes contributions from multiple users.
13
-
14
- This is the beta version and the first one ready for public use. Please help us make this plugin better by giving us <a href="mailto:zack@grossbart.com">feedback</a>.
15
-
16
- Features:
17
-
18
- 1. See all of your posts and when they'll be posted.
19
- 1. Drag and drop to change your post dates.
20
- 1. Edit and arrange post titles.
21
- 1. Easily see the status of your posts.
22
-
23
- == Installation ==
24
-
25
- 1. <b>Backup your WordPress database</b>.
26
- 1. Upload the plugin directory <code>editorial-calendar</code> to the <code>wp-content/plugins</code> directory.
27
- 1. Activate the plugin through the 'Plugins' menu in WordPress.
28
- 1. Click the new 'Calendar' option under the 'Posts' menu.
29
-
30
- == Frequently Asked Questions ==
31
-
32
- = Can I use the editorial calendar with pages? =
33
-
34
- Right now the calendar only supports posts. We are considering adding support for pages. If you would like to see support for pages let us know.
35
-
36
- = Does the editorial calendar change the way my posts look? =
37
-
38
- No. The calendar is only an administration tool. None of your readers will know you are running the calendar unless you tell them.
39
-
40
- = Why are my posts different colors? =
41
-
42
- The different color of each post indicates the status. Gray is <code>draft</code>, blue is <code>publish</code>, and yellow is <code>future</code>.
43
-
44
- = Why does the calendar change my post status? =
45
-
46
- The calendar works with three types of post status: <code>draft</code>, <code>publish</code>, and <code>future</code>. If you move a <code>publish</code> post to a date after the current day it becomes a <code>future</code> post. If you drag a <code>future</code> post to a day before the current day it becomes a <code>draft</code> post.
47
-
48
- = Why do I have posts named [No Title]? =
49
-
50
- If you add a new post from the calendar it will get inserted as a draft. If you then cancel or just go backwards in your browser you'll be left with an empty post. They don't cause any problems. I would like to make this work better, but I'm waiting for a fix in a future version of WordPress.
51
-
52
- == Screenshots ==
53
-
54
- 1. See all of your posts and when they'll be published.
55
- 2. Get more information and edit post titles right in the calendar.
56
- 3. Drag and drop posts to easily change dates and arrange your calendar.
57
-
58
- == Changelog ==
59
-
60
- = 0.3 =
61
- * Additional bug fixes and stabalizations as well as the ability to add new posts to a given date from the calendar.
62
-
63
- = 0.2 =
64
- * This version fixes a large number of bugs, makes many usability improvements, and has some significant performance increases.
65
-
66
- = 0.1 =
67
- * This version is just for beta testers
68
-
69
-
70
- `<?php code(); // goes in backticks ?>`
 
 
 
 
 
1
+ === Editorial Calendar ===
2
+ Contributors: MaryVogt, zgrossbart
3
+ Tags: posts, post, calendar, AJAX, admin, administration
4
+ Requires at least: 2.8.5
5
+ Tested up to: 2.8.6
6
+ Stable tag: 0.4
7
+
8
+ Editorial calendar makes it possible to see all your posts and drag and drop them to manage your blog.
9
+
10
+ == Description ==
11
+
12
+ The editorial calendar lets WordPress administrators and editors manage the dates for multiple posts at once. You see all of your posts in a calendar view and can arrange them via an easy drag and drop interface. The editorial calendar greatly improves any blog that plans posts in advance or takes contributions from multiple users.
13
+
14
+ This is the beta version and the first one ready for public use. Please help us make this plugin better by giving us <a href="mailto:zack@grossbart.com">feedback</a>.
15
+
16
+ Features:
17
+
18
+ 1. See all of your posts and when they'll be posted.
19
+ 1. Drag and drop to change your post dates.
20
+ 1. Edit and arrange post titles.
21
+ 1. Easily see the status of your posts.
22
+
23
+ == Installation ==
24
+
25
+ 1. <b>Backup your WordPress database</b>.
26
+ 1. Upload the plugin directory <code>editorial-calendar</code> to the <code>wp-content/plugins</code> directory.
27
+ 1. Activate the plugin through the 'Plugins' menu in WordPress.
28
+ 1. Click the new 'Calendar' option under the 'Posts' menu.
29
+
30
+ == Frequently Asked Questions ==
31
+
32
+ = Can I see a demo of the calendar? =
33
+
34
+ Check out our demo installation at <a href="http://www.zackgrossbart.com/extras/sandbox/wp-admin/">http://www.zackgrossbart.com/extras/sandbox/wp-admin</a>.
35
+
36
+ = Can I use the editorial calendar with pages? =
37
+
38
+ Right now the calendar only supports posts. We are considering adding support for pages. If you would like to see support for pages let us know.
39
+
40
+ = Does the editorial calendar change the way my posts look? =
41
+
42
+ No. The calendar is only an administration tool. None of your readers will know you are running the calendar unless you tell them.
43
+
44
+ = Why are my posts different colors? =
45
+
46
+ The different color of each post indicates the status. Gray is <code>draft</code>, blue is <code>publish</code>, and yellow is <code>future</code>.
47
+
48
+ = Why does the calendar change my post status? =
49
+
50
+ The calendar works with three types of post status: <code>draft</code>, <code>publish</code>, and <code>future</code>. If you move a <code>publish</code> post to a date after the current day it becomes a <code>future</code> post. If you drag a <code>future</code> post to a day before the current day it becomes a <code>draft</code> post.
51
+
52
+ == Screenshots ==
53
+
54
+ 1. See all of your posts and when they'll be published.
55
+ 2. Get more information and edit post titles right in the calendar.
56
+ 3. Drag and drop posts to easily change dates and arrange your calendar.
57
+
58
+ == Changelog ==
59
+
60
+ = 0.4 =
61
+ * We are now doing a better job arranging our tooltips and setting GMT dates correctly.
62
+ * Fixed a problem with the post times so posts dragged with the calendar don't change their time of day.
63
+ * Added a dialog for creating new drafts on specific dates of the calendar.
64
+
65
+ = 0.3 =
66
+ * Additional bug fixes and stabalizations as well as the ability to add new posts to a given date from the calendar.
67
+
68
+ = 0.2 =
69
+ * This version fixes a large number of bugs, makes many usability improvements, and has some significant performance increases.
70
+
71
+ = 0.1 =
72
+ * This version is just for beta testers
73
+
74
+
75
+ `<?php code(); // goes in backticks ?>`