Merge lp:~ideamonk/sahana-eden/vita into lp:sahana-eden/vita

Proposed by Abhishek Mishra
Status: Merged
Merged at revision: 1694
Proposed branch: lp:~ideamonk/sahana-eden/vita
Merge into: lp:sahana-eden/vita
Diff against target: 5357 lines (+2366/-1476) (has conflicts)
40 files modified
VERSION (+3/-0)
controllers/admin.py (+8/-2)
controllers/cr.py (+2/-2)
controllers/hms.py (+1/-1)
controllers/inv.py (+1/-1)
controllers/org.py (+9/-48)
deployment-templates/models/000_config.py (+23/-24)
models/00_db.py (+1/-0)
models/00_settings.py (+12/-11)
models/00_tables.py (+1/-1)
models/03_gis.py (+32/-22)
models/04_pr.py (+4/-4)
models/05_org.py (+4/-6)
models/06_hrm.py (+17/-16)
models/07_cr.py (+2/-3)
models/08_assess.py (+5/-5)
models/09_project.py (+4/-7)
models/doc.py (+3/-5)
models/event.py (+1/-1)
models/scenario.py (+1/-1)
models/survey.py (+1/-2)
models/vol.py (+1/-1)
models/zz_last.py (+5/-1)
models/zzz_1st_roles.py (+190/-34)
modules/s3/s3aaa.py (+537/-291)
modules/s3/s3cfg.py (+1/-8)
modules/s3/s3gis.py (+63/-67)
modules/s3/s3widgets.py (+654/-575)
static/scripts/S3/S3.min.js (+347/-308)
static/scripts/S3/s3.gis.js (+11/-8)
static/scripts/S3/s3.gis.layers.js (+2/-1)
static/scripts/S3/s3.gis.min.js (+2/-2)
static/scripts/S3/s3.rolesets.js (+43/-8)
static/scripts/S3/ui.multiselect.js (+336/-0)
static/scripts/tools/sahana.css.cfg (+1/-1)
static/scripts/tools/sahana.js.cfg (+5/-1)
static/styles/S3/sahana.min.css (+1/-1)
static/styles/S3/ui.multiselect.css (+31/-0)
views/admin/index.html (+1/-1)
views/gis/location_create.html (+0/-6)
Text conflict in VERSION
To merge this branch: bzr merge lp:~ideamonk/sahana-eden/vita
Reviewer Review Type Date Requested Status
nursix Pending
Review via email: mp+64483@code.launchpad.net

Description of the change

Role-set creation
============
* Added Role-set tab to Org entries (add_component in org controller)
* Added a labelled checkbox widget (S3LabelledCheckboxesWidget) to handle role representations for list and form views
* Role-set tab allows one to check one of Org_X_reader/editor/access where X is the organization selected
* the labelled checkboxes support label filters (e.g. shn_role_org_filter), using which -
        * Unrelated roles are skipped (one which don't belong to selected Org)
        * Org_X_reader/editor/access are converted to readable names (defined in 00_tables.py)

To post a comment you must log in.
lp:~ideamonk/sahana-eden/vita updated
1670. By Abhishek Mishra

added role-set crud strings, adding role-set delegation fields

1671. By Abhishek Mishra

role-sets can be delegated within role-set tabs and at time of creation now., added role-set crud strings to org controller, loaded on role-set tabs

1672. By Abhishek Mishra

merged vita

1673. By Abhishek Mishra

shifted delegation field order, todo: widget for multiple orgs

1674. By Abhishek Mishra

merged vita

1675. By Abhishek Mishra

adding S3RoleSetWidget site-wise role selections

1676. By Abhishek Mishra

removed role-org labels as they're irrelevat now

1677. By Abhishek Mishra

adding rolesets script to handle selection combinations for reader, editor, access selections

1678. By Abhishek Mishra

role-sets definable for organisations as per new draft, s3.rolsets.js functional, TODO: validations on role selections

1679. By Abhishek Mishra

added a new jquery multiselect, supports filters, org delegation is now multiselect with filter, added to build script, js not permanently added

1680. By Abhishek Mishra

added user assignment, not using auth_user_role_set yet

1681. By Abhishek Mishra

naming - role-set changed to access roles

1682. By Abhishek Mishra

merged vita

1683. By Abhishek Mishra

change to new add_component syntax

1684. By Abhishek Mishra

cutout irrelevant columns, todo: friendlier role-descriptions

1685. By Abhishek Mishra

fix rolset js issue

1686. By Abhishek Mishra

added site roles in roleset widget, shows sites related to org in context, location representation yet to be fixed, roles in list views are ids for debugging right now, https://skitch.com/ideamonk/fgnuj/organization-details

1687. By Abhishek Mishra

merged vita

1688. By Abhishek Mishra

user_id -> set_id stored in auth_user_role_set manually using an onaccept on role_set form

1689. By Abhishek Mishra

role_set table doesn't get populated with user assignments, added S3Auth API calls to retract and add users in user_role_set table, however user assignment widget is disfunctional as needs a custom widget that could pick data from user_role_set relationships and show selections accordingly

1690. By Abhishek Mishra

merged vita

1691. By Abhishek Mishra

gis_location_represent added to roleset widget, user assignment minor bug fix

1692. By Abhishek Mishra

added rolesets.js and multiselect to js.cfg, quotes refactor, merged multiselect.filter.js into multiselect as order of scripts in cfg didnt co-respond to order of script tags, remove s3labelledcheckboxes - unused, added role_set based labels to auth.messages, removed shn_role_org_filter - unused

1693. By Abhishek Mishra

merged trunk

1694. By Abhishek Mishra

added NOWARN to build.sahana.py to optionally suppress local closure compiler warnings

1695. By Abhishek Mishra

manually patched no-withs calendar.js

1696. By Abhishek Mishra

re-minified calendar.js

1697. By Abhishek Mishra

fixed users-selected field, shows up selections from auth_user_role_set now, as expected

1698. By Abhishek Mishra

merged vita

1699. By Abhishek Mishra

merged trunk

1700. By Abhishek Mishra

get_aaa_org_roles

1701. By Abhishek Mishra

merged vita

1702. By Abhishek Mishra

merged orgauth changes from trunk

1703. By Abhishek Mishra

merge trunk

1704. By Abhishek Mishra

adding two col multiselect, disabled users fields temporary to modify for new model

1705. By Abhishek Mishra

add two column js, css and dependencies - sortable, tmpl

1706. By Abhishek Mishra

multiselect fixes

1707. By Abhishek Mishra

remove unused widgets

1708. By Abhishek Mishra

added basic users_assigned, ToDo: explore s3search to make this widget more powerful, ToDo: a way to mix org names, or allow to pick from other orgs, etc

1709. By Abhishek Mishra

experimental, person search, ToDo: decide if to use search.json or manipulate a stable version of multiselect externally

1710. By Abhishek Mishra

Fixes for user assignment

1711. By Abhishek Mishra

switched to latest multiselect, removed multiselect_next as it was too buggy with drag drops (see http://www.youtube.com/watch?v=pCDI9UWxigw ), adding users selection https://skitch.com/ideamonk/fg33r/organization-details

1712. By Abhishek Mishra

users assignment

1713. By Abhishek Mishra

merged trunk, todo: fixes

1714. By Abhishek Mishra

org delegation, users assignment functional

1715. By Abhishek Mishra

merged trunk

1716. By Abhishek Mishra

two column left<->right change, removed confusing double arrow

1717. By Abhishek Mishra

user, ogranisation in users assignment list, color fixes, search box is indicated

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'VERSION'
2--- VERSION 2011-06-24 23:06:51 +0000
3+++ VERSION 2011-06-27 17:56:49 +0000
4@@ -1,1 +1,4 @@
5+<<<<<<< TREE
6 vita-1692 (2011-06-25 01:06:51)
7+=======
8+r2439 (2011-06-27 18:20:41)>>>>>>> MERGE-SOURCE
9
10=== modified file 'controllers/admin.py'
11--- controllers/admin.py 2011-06-24 22:06:22 +0000
12+++ controllers/admin.py 2011-06-27 17:56:49 +0000
13@@ -131,7 +131,7 @@
14 orderby="org_organisation.name",
15 sort=True))
16 org.represent = organisation_represent
17- org.widget = S3OrganisationAutocompleteWidget(request, session)
18+ org.widget = S3OrganisationAutocompleteWidget(globals())
19 org.comment = DIV(_class="tooltip",
20 _title="%s|%s|%s" % (T("Organization"),
21 T("The default Organization for whom this person is acting."),
22@@ -404,7 +404,9 @@
23
24 return dict(app=app, tickets=tickets)
25
26-# -----------------------------------------------------------------------------
27+# =============================================================================
28+# Importer
29+# =============================================================================
30 @auth.s3_requires_membership(1)
31 def import_file():
32 """
33@@ -488,6 +490,10 @@
34 import urllib2
35 from gluon.tools import fetch
36
37+ if db_string[0].find("sqlite") != -1:
38+ # Unlock database
39+ db.commit()
40+
41 # Keep Session
42 cookie = Cookie.SimpleCookie()
43 cookie[response.session_id_name] = response.session_id
44
45=== modified file 'controllers/cr.py'
46--- controllers/cr.py 2011-06-24 12:09:00 +0000
47+++ controllers/cr.py 2011-06-27 17:56:49 +0000
48@@ -199,7 +199,7 @@
49
50 #if r.component_name == "staff" and \
51 # isinstance(output, dict) and \
52- # deployment_settings.get_aaa_site_roles():
53+ # auth.org.site_roles:
54 # addheader = "%s %s." % (STAFF_HELP,
55 # T("Shelter"))
56 # output.update(addheader=addheader)
57@@ -278,7 +278,7 @@
58 T("Create a group entry in the registry.")))
59 )
60 )
61- db.pr_presence.pe_id.widget = S3AutocompleteWidget(request, "pr", "pentity")
62+ db.pr_presence.pe_id.widget = S3AutocompleteWidget(globals(), "pr", "pentity")
63 # Set defaults
64 db.pr_presence.datetime.default = request.utcnow
65 db.pr_presence.observer.default = s3_logged_in_person()
66
67=== modified file 'controllers/hms.py'
68--- controllers/hms.py 2011-06-24 21:00:55 +0000
69+++ controllers/hms.py 2011-06-27 17:56:49 +0000
70@@ -227,7 +227,7 @@
71 #def postp(r, output):
72 #if r.component_name == "staff" and \
73 # isinstance(output, dict) and \
74- # deployment_settings.get_aaa_site_roles():
75+ # auth.org.site_roles:
76 # addheader = "%s %s." % (STAFF_HELP,
77 # T("Hospital"))
78 # output.update(addheader=addheader)
79
80=== modified file 'controllers/inv.py'
81--- controllers/inv.py 2011-06-24 12:09:00 +0000
82+++ controllers/inv.py 2011-06-27 17:56:49 +0000
83@@ -145,7 +145,7 @@
84 #def postp(r, output):
85 #if r.component_name == "staff" and \
86 # isinstance(output, dict) and \
87- # deployment_settings.get_aaa_site_roles():
88+ # auth.org.site_roles:
89 # addheader = "%s %s." % (STAFF_HELP,
90 # T("Warehouse"))
91 # output.update(addheader=addheader)
92
93=== modified file 'controllers/org.py'
94--- controllers/org.py 2011-06-24 12:46:52 +0000
95+++ controllers/org.py 2011-06-27 17:56:49 +0000
96@@ -100,33 +100,13 @@
97
98 # Role-sets tab
99 # @ToDo: Should be visible to Organisation Admin not just ADMIN
100- if deployment_settings.get_aaa_org_roles() and s3_has_role(ADMIN):
101+ if s3_has_role(ADMIN) and auth.org.org_roles:
102 s3mgr.model.add_component("auth_role_set",
103 joinby=dict(org_organisation="organisation_id"),
104 multiple=True)
105 tabs.append((auth.messages.label_role_set_tab, "role_set"))
106
107 def role_set_crud_setup(r, table):
108- # Crud strings
109- LIST_ROLE_SETS = T("List Access Roles")
110- ADD_ROLE_SET = T("Add Access Role")
111-
112- s3.crud_strings[tablename] = Storage(
113- title_create = ADD_ROLE_SET,
114- title_display = T("Access Role Details"),
115- title_list = LIST_ROLE_SETS,
116- title_update = T("Edit Access Role"),
117- title_search = T("Search Access Roles"),
118- subtitle_create = T("Add New Access Role"),
119- subtitle_list = T("Access Roles"),
120- label_list_button = LIST_ROLE_SETS,
121- label_create_button = ADD_ROLE_SET,
122- label_delete_button = T("Delete Access Role"),
123- msg_record_created = T("Access Role added"),
124- msg_record_modified = T("Access Role updated"),
125- msg_record_deleted = T("Access Role deleted"),
126- msg_list_empty = T("No Access Roles currently registered"))
127-
128 # Allow role-set organisation delegations
129 orgs_delegated = table.orgs_delegated
130 orgs_delegated.writable = True
131@@ -138,18 +118,12 @@
132 sort=True, multiple=True))
133 orgs_delegated.represent = lambda l: ", ".join([organisation_represent(x) for x in l])
134
135- users_assigned = table.dummy_users_assigned
136- users_assigned.requires = IS_NULL_OR(IS_ONE_OF(db, "pr_person.id",
137- shn_pr_person_represent,
138- orderby="pr_person.id",
139- sort=True, multiple=True))
140 # @ToDo: add readable role description
141
142 # Pre-process
143 def prep(r):
144 if r.interactive:
145- if len(gis.get_site_countries()) == 1:
146- r.table.country.default = gis.get_site_countries("code").keys()[0]
147+ r.table.country.default = gis.get_default_country("code")
148 if r.component_name == "human_resource" and r.component_id:
149 # Workaround until widget is fixed:
150 hr_table = db.hrm_human_resource
151@@ -165,31 +139,18 @@
152 #s3mgr.configure(table._tablename,
153 # onaccept=address_onaccept)
154 if r.component_name == "role_set":
155- role_set_crud_setup(r, db.auth.table_role_set)
156- # make the widget org aware
157- r.component.table.dummy_users_assigned.widget.__self__.rs_id = r.component_id
158- r.component.table.roles.widget.__self__.org_id = r.id
159+ role_set_crud_setup(r, db.auth_role_set)
160+ if r.component_id:
161+ r.component.table.name.widget.__self__.component_id = r.component_id
162 return True
163
164 # Post-processor
165- def postp(r, output):
166- #if r.component_name == "staff" and \
167- #isinstance(output, dict) and \
168- #deployment_settings.get_aaa_org_roles():
169- #addheader = "%s %s." % (STAFF_HELP,
170- #T("Organization"))
171- #output.update(addheader=addheader)
172+ #def postp(r, output):
173 #return output
174- if r.component_name == "role_set":
175- # Let role_set's onaccept hijack users_assigned
176- # and not get inserted into dummy column of auth_role_set
177- if isinstance(output, (dict)):
178- output["form"][0][3][0][0].update(_name="users_assigned")
179- return output
180
181 # Set hooks
182 response.s3.prep = prep
183- response.s3.postp = postp
184+ #response.s3.postp = postp
185
186 # Callback function to identify duplicate records in an import
187 def org_organisation_resolve(job):
188@@ -309,7 +270,7 @@
189 #def postp(r, output):
190 #if r.component_name == "staff" and \
191 #isinstance(output, dict) and \
192- #deployment_settings.get_aaa_site_roles():
193+ #auth.org.site_roles:
194 #addheader = "%s %s." % (STAFF_HELP,
195 #T("Office"))
196 #output.update(addheader=addheader)
197@@ -352,7 +313,7 @@
198 def prep(r):
199 if r.method == "create":
200 table.organisation_id.widget = \
201- S3AutocompleteWidget(request, "org", "organisation",
202+ S3AutocompleteWidget(globals(), "org", "organisation",
203 post_process="load_offices(false);")
204 return True
205 response.s3.prep = prep
206
207=== modified file 'deployment-templates/models/000_config.py'
208--- deployment-templates/models/000_config.py 2011-06-24 12:09:00 +0000
209+++ deployment-templates/models/000_config.py 2011-06-27 17:56:49 +0000
210@@ -156,9 +156,6 @@
211 #deployment_settings.fin.currency_default = 1 # Dollars
212
213 # GIS (Map) settings
214-# Uncomment this if the deployment is just in a few countries
215-# (used in the GIS Location Selector)
216-#deployment_settings.gis.countries = ["PK"]
217 # Provide a tool to select locations via a map on all forms with location_id
218 deployment_settings.gis.map_selector = True
219 # Display Resources recorded to Admin-Level Locations on the map
220@@ -167,14 +164,6 @@
221 # Currently unused
222 #deployment_settings.gis.display_L1 = True
223
224-# Allow non-MapAdmins to edit hierarchy locations? Defaults to True if not set.
225-# (Permissions can be set per-country within a gis_config)
226-#deployment_settings.gis.edit_Lx = False
227-# Allow non-MapAdmins to edit group locations? Defaults to False if not set.
228-#deployment_settings.gis.edit_GR = True
229-# Note that editing of locations used as regions for the Regions menu is always
230-# restricted to MapAdmins.
231-
232 # Map settings that relate to locale, such as the number and names of the
233 # location hierarchy levels, are now in gis_config. The site-wide gis_config
234 # will be populated from the settings here.
235@@ -195,6 +184,8 @@
236 # Default map configuration values for the site:
237 deployment_settings.gis.default_config_values = Storage(
238 name = "Site Map Configuration",
239+ # Uncomment this to set the default starting location for the location selector
240+ #default_location_id = 1,
241 # Where the map is centered:
242 lat = "22.593723263",
243 lon = "5.28516253",
244@@ -266,27 +257,35 @@
245 deployment_settings.twitter.oauth_consumer_key = ""
246 deployment_settings.twitter.oauth_consumer_secret = ""
247
248-# Security Policy settings
249-# Lock-down access to Map Editing
250-#deployment_settings.security.map = True
251-# Security Policy (defaults to 1 = Simple)
252-# http://eden.sahanafoundation.org/wiki/S3AAA#System-widePolicy
253-#deployment_settings.security.policy = 4 # Function-ACLs
254 # Use 'soft' deletes
255 deployment_settings.security.archive_not_delete = True
256
257 # AAA Settings
258+
259+# Security Policy
260+# http://eden.sahanafoundation.org/wiki/S3AAA#System-widePolicy
261+# 1: Simple (default): Global as Reader, Authenticated as Editor
262+# 2: Editor role required for Update/Delete, unless record owned by session
263+# 3: Apply Controller ACLs
264+# 4: Apply both Controller & Function ACLs
265+# 5: Apply Controller, Function & Table ACLs
266+# 6: Apply Controller, Function, Table & Organisation ACLs
267+# 7: Apply Controller, Function, Table, Organisation & Facility ACLs
268+#
269+#deployment_settings.security.policy = 6 # Organisation-ACLs
270 #acl = deployment_settings.aaa.acl
271 #deployment_settings.aaa.default_uacl = acl.READ # User ACL
272 #deployment_settings.aaa.default_oacl = acl.CREATE | acl.READ | acl.UPDATE # Owner ACL
273
274-# OrgAuth settings
275-# Which role sets can be managed via an Organisation's 'Acess roles' Tab?
276-# (leave empty to disable organisation-based access roles)
277-#deployment_settings.aaa.org_roles = {}
278-# Which role sets can be managed via a Facility's 'Acess roles' Tab?
279-# (leave empty to disable facility-based access roles)
280-#deployment_settings.aaa.site_roles = {}
281+# Lock-down access to Map Editing
282+#deployment_settings.security.map = True
283+# Allow non-MapAdmins to edit hierarchy locations? Defaults to True if not set.
284+# (Permissions can be set per-country within a gis_config)
285+#deployment_settings.gis.edit_Lx = False
286+# Allow non-MapAdmins to edit group locations? Defaults to False if not set.
287+#deployment_settings.gis.edit_GR = True
288+# Note that editing of locations used as regions for the Regions menu is always
289+# restricted to MapAdmins.
290
291 # Audit settings
292 # We Audit if either the Global or Module asks us to
293
294=== modified file 'models/00_db.py'
295--- models/00_db.py 2011-06-16 18:06:17 +0000
296+++ models/00_db.py 2011-06-27 17:56:49 +0000
297@@ -133,6 +133,7 @@
298
299 # VITA
300 vita = s3base.S3Vita(globals(), db)
301+response.s3.vita = vita
302
303 # GIS Module
304 gis = s3base.GIS(globals(), deployment_settings, db, vita, auth, cache=cache)
305
306=== modified file 'models/00_settings.py'
307--- models/00_settings.py 2011-06-24 22:06:22 +0000
308+++ models/00_settings.py 2011-06-27 17:56:49 +0000
309@@ -246,7 +246,7 @@
310
311 #auth.settings.username_field = True
312 auth.settings.hmac_key = deployment_settings.get_auth_hmac_key()
313-auth.define_tables()
314+auth.define_tables(migrate=migrate)
315
316 # Default Language for authenticated users
317 db.auth_user.language.default = deployment_settings.get_L10n_default_language()
318@@ -396,15 +396,17 @@
319 memberships = db(_memberships.user_id == user_id).select(
320 _memberships.group_id)
321 roles = [m.group_id for m in memberships]
322- # Additional roles from role sets
323- rs = db.auth_role_set
324- rsa = db.auth_user_role_set
325- role_sets = db((rsa.user_id == user_id) &
326- (rs.id == rsa.set_id)).select(rs.roles)
327- for role_set in role_sets:
328- additional_roles = [role for role in role_set.roles
329- if role not in roles]
330- roles += additional_roles
331+ if auth.org.org_roles:
332+ # Additional roles from role sets
333+ rs = db.auth_role_set
334+ rsa = db.auth_user_role_set
335+ role_sets = db((rsa.user_id == user_id) &
336+ (rs.id == rsa.set_id)).select(rs.roles)
337+ for role_set in role_sets:
338+ if role_set.roles:
339+ additional_roles = [role for role in role_set.roles
340+ if role not in roles]
341+ roles += additional_roles
342 elif session.s3.system_roles.ANONYMOUS:
343 roles = [session.s3.system_roles.ANONYMOUS]
344
345@@ -420,7 +422,6 @@
346 session.s3.cdn = deployment_settings.get_base_cdn()
347
348 # Security Policy
349- #session.s3.self_registration = deployment_settings.get_security_self_registration()
350 session.s3.security_policy = deployment_settings.get_security_policy()
351
352 # We Audit if either the Global or Module asks us to
353
354=== modified file 'models/00_tables.py'
355--- models/00_tables.py 2011-06-24 21:42:05 +0000
356+++ models/00_tables.py 2011-06-27 17:56:49 +0000
357@@ -232,7 +232,7 @@
358 "auth_group.id",
359 "%(role)s",
360 zero=T("Public"))),
361- widget = S3AutocompleteWidget(request,
362+ widget = S3AutocompleteWidget(globals(),
363 "auth",
364 "group",
365 fieldname="role"),
366
367=== modified file 'models/03_gis.py'
368--- models/03_gis.py 2011-06-24 21:42:05 +0000
369+++ models/03_gis.py 2011-06-27 17:56:49 +0000
370@@ -193,6 +193,9 @@
371
372 """ Represent a location given its row """
373
374+ if not location:
375+ return NONE
376+
377 def lat_lon_represent(location):
378 lat = location.lat
379 lon = location.lon
380@@ -268,15 +271,10 @@
381 # Fallback to system default
382 level_name = gis.get_all_current_levels(location.level)
383 # Countries don't have Parents & shouldn't be represented with Lat/Lon
384- # L1 shouldn't show Parent if the deployment is only for 1 country
385 # Non-hierarchy levels (e.g. groups) only show the level.
386 extra = level_name
387- countries = gis.get_site_countries()
388- if location.level == "L1" \
389- and (not countries or len(countries) > 1) \
390- or location.level in ["L2", "L3"]:
391- # Show the Parent location for larger regions, including L1 if
392- # this isn't a single country site.
393+ if location.level in ["L1", "L2", "L3"]:
394+ # Show the Parent location for larger regions
395 extra = level_with_parent(location, level_name)
396 elif location.level[0] == "L" and int(location.level[1:]) > 0:
397 # For small regions, add Lat/Lon
398@@ -350,13 +348,16 @@
399 return NONE
400 elif level == "L0":
401 return T("Country")
402- elif deployment_settings.get_gis_countries() and len(deployment_settings.get_gis_countries()) == 1:
403- # Single country deployment so we can provide a nice name reliably
404- return gis.get_all_current_levels(level)
405 else:
406- # The representation of a level can vary per-record (since it varies per country),
407- # however we have no way of knowing the country here, so safest not to give a wrong answer.
408- return level
409+ config = gis.get_config()
410+ if config.default_location_id:
411+ # Single country deployment so we can provide a nice name reliably
412+ # @ToDo: Maybe not any longer
413+ return gis.get_all_current_levels(level)
414+ else:
415+ # The representation of a level can vary per-record (since it varies per country),
416+ # however we have no way of knowing the country here, so safest not to give a wrong answer.
417+ return level
418
419 resourcename = "location"
420 tablename = "gis_location"
421@@ -380,7 +381,7 @@
422 Field("parent", "reference gis_location", # This form of hierarchy may not work on all Databases
423 label = T("Parent"),
424 represent = gis_location_represent,
425- widget=S3LocationAutocompleteWidget(request, deployment_settings,
426+ widget=S3LocationAutocompleteWidget(globals(), deployment_settings,
427 level=gis.allowed_hierarchy_level_keys),
428 ondelete = "RESTRICT"),
429 Field("path", length=256,
430@@ -517,7 +518,7 @@
431 requires = IS_NULL_OR(IS_LOCATION_SELECTOR(db,
432 globals())),
433 # Alternate simple Autocomplete (e.g. used by pr_person_presence)
434- #widget = S3LocationAutocompleteWidget(request, deployment_settings),
435+ #widget = S3LocationAutocompleteWidget(globals(), deployment_settings),
436 #requires = IS_NULL_OR(IS_LOCATION),
437 ondelete = "RESTRICT")
438
439@@ -560,7 +561,7 @@
440 # region, and we need to know what supplies,
441 # medical facilities, etc., are actually
442 # accessible.
443- widget = S3LocationAutocompleteWidget(request,
444+ widget = S3LocationAutocompleteWidget(globals(),
445 deployment_settings),
446 requires = IS_NULL_OR(IS_LOCATION(db, T,
447 gis,
448@@ -569,6 +570,13 @@
449 Field("region_changed_timestamp", "datetime",
450 readable = False, writable = False),
451
452+ # Default Location
453+ location_id("default_location_id",
454+ widget = S3LocationAutocompleteWidget(globals(),
455+ deployment_settings),
456+ requires = IS_NULL_OR(IS_LOCATION(db, T,
457+ gis))),
458+
459 Field("map_height", "integer", notnull=True,
460 requires = [IS_NOT_EMPTY(), IS_INT_IN_RANGE(160, 1024)],
461 default = 600),
462@@ -649,6 +657,12 @@
463 T("Name"),
464 T("If this configuration represents a region for the Regions menu, give it a name to use in the menu. The name for a personal map configuration will be set to the user's name.")))
465 table.region_location_id.label = T("Region Location")
466+ table.default_location_id.label = T("Default Location")
467+ table.default_location_id.comment = DIV(
468+ _class="tooltip",
469+ _title="%s|%s" % (
470+ T("Default Location"),
471+ T("Use this to set the starting location for the Location Selector.")))
472 table.lat.label = T("Map Center Latitude")
473 table.lat.comment = DIV(
474 _class="tooltip",
475@@ -948,6 +962,7 @@
476 list_fields = ["id",
477 "name",
478 "region_location_id",
479+ "default_location_id",
480 "zoom",
481 "lat",
482 "lon"
483@@ -1125,12 +1140,7 @@
484 return
485 strict = gis.get_strict_hierarchy()
486 if strict:
487- countries = gis.get_site_countries()
488- # Check Parents are in exact order
489- if level == "L1" and len(countries) == 1:
490- # Hardcode the Parent
491- parent = countries.keys()[0]
492- elif level == "L0":
493+ if level == "L0":
494 # Parent is impossible
495 parent = ""
496 elif not parent:
497
498=== modified file 'models/04_pr.py'
499--- models/04_pr.py 2011-06-24 12:09:00 +0000
500+++ models/04_pr.py 2011-06-27 17:56:49 +0000
501@@ -358,7 +358,7 @@
502 label = T("Person"),
503 comment = shn_person_id_comment,
504 ondelete = "RESTRICT",
505- widget = S3PersonAutocompleteWidget(request))
506+ widget = S3PersonAutocompleteWidget(globals()))
507
508
509 # =============================================================================
510@@ -954,7 +954,7 @@
511 Field("shelter_id", "integer", # See 07_cr.py for field options
512 readable = False,
513 writable = False),
514- location_id(widget = S3LocationAutocompleteWidget(request, deployment_settings),
515+ location_id(widget = S3LocationAutocompleteWidget(globals(), deployment_settings),
516 comment = DIV(A(ADD_LOCATION, _class="colorbox", _target="top", _title=ADD_LOCATION,
517 _href=URL(r=request, c="gis", f="location", args="create", vars=dict(format="popup"))),
518 DIV(_class="tooltip",
519@@ -983,13 +983,13 @@
520 comment = DIV(DIV(_class="tooltip",
521 _title="%s|%s" % (T("Procedure"),
522 T('Describe the procedure which this record relates to (e.g. "medical examination")'))))),
523- location_id("orig_id", label=T("Origin"), widget = S3LocationAutocompleteWidget(request, deployment_settings),
524+ location_id("orig_id", label=T("Origin"), widget = S3LocationAutocompleteWidget(globals(), deployment_settings),
525 comment = DIV(A(ADD_LOCATION, _class="colorbox", _target="top", _title=ADD_LOCATION,
526 _href=URL(r=request, c="gis", f="location", args="create", vars=dict(format="popup"))),
527 DIV(_class="tooltip",
528 _title="%s|%s" % (T("Origin"),
529 T("The Location the Person has come from, which can be general (for Reporting) or precise (for displaying on a Map). Enter a few characters to search from available locations."))))),
530- location_id("dest_id", label=T("Destination"), widget = S3LocationAutocompleteWidget(request, deployment_settings),
531+ location_id("dest_id", label=T("Destination"), widget = S3LocationAutocompleteWidget(globals(), deployment_settings),
532 comment = DIV(A(ADD_LOCATION, _class="colorbox", _target="top", _title=ADD_LOCATION,
533 _href=URL(r=request, c="gis", f="location", args="create", vars=dict(format="popup"))),
534 DIV(_class="tooltip",
535
536=== modified file 'models/05_org.py'
537--- models/05_org.py 2011-06-21 19:08:22 +0000
538+++ models/05_org.py 2011-06-27 17:56:49 +0000
539@@ -358,8 +358,7 @@
540 comment = organisation_comment,
541 ondelete = "RESTRICT",
542 # Comment this to use a Dropdown & not an Autocomplete
543- widget = S3OrganisationAutocompleteWidget(request,
544- session)
545+ widget = S3OrganisationAutocompleteWidget(globals())
546 )
547
548 # Organisation Search Method --------------------------------------------------
549@@ -558,7 +557,7 @@
550 label = T("Facility"),
551 represent = shn_site_represent,
552 # Comment these to use a Dropdown & not an Autocomplete
553- widget = S3SiteAutocompleteWidget(request, auth),
554+ widget = S3SiteAutocompleteWidget(globals(), auth),
555 comment = DIV(_class="tooltip",
556 _title="%s|%s" % (T("Facility"),
557 T("Enter some characters to bring up a list of possible matches")))
558@@ -630,7 +629,7 @@
559 2:T("Regional"),
560 3:T("National"),
561 4:T("Field"),
562- 5:T("Warehouse"), # Don't change this number, as it affects the Inv module & KML Export stylesheet
563+ 5:T("Warehouse"), # Don't change this number, as it affects the Inv module, KML Export stylesheet & OrgAuth
564 }
565
566 ADD_OFFICE = T("Add Office")
567@@ -658,8 +657,7 @@
568 Field("name", notnull=True,
569 length=64, # Mayon Compatibility
570 label = T("Name")),
571- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
572- session,
573+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
574 default_from_profile = True)),
575 Field("type", "integer", label = T("Type"),
576 requires = IS_NULL_OR(IS_IN_SET(org_office_type_opts)),
577
578=== modified file 'models/06_hrm.py'
579--- models/06_hrm.py 2011-06-24 12:09:00 +0000
580+++ models/06_hrm.py 2011-06-27 17:56:49 +0000
581@@ -164,8 +164,7 @@
582 super_link(db.sit_trackable),
583
584 # Administrative data
585- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
586- session,
587+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
588 default_from_profile = True),
589 empty=False),
590 #position_id(),
591@@ -184,6 +183,7 @@
592 UNKNOWN_OPT)),
593 #Field("code", label=T("Staff ID")),
594 Field("job_title", label=T("Job Title")),
595+ # @ToDo: Deprecate (should be managed via Permissions tab)
596 Field("hrm", "boolean",
597 label=T("HR Manager"),
598 default=False,
599@@ -286,7 +286,10 @@
600 ))
601
602 def hrm_update_staff_role(record, user_id, role_id):
603- """ Set/retract the Staff role """
604+ """
605+ Set/retract the Staff role
606+ @ToDo: Port to auth.org
607+ """
608
609 mtable = db.auth_membership
610 htable = db.hrm_human_resource
611@@ -310,7 +313,10 @@
612 role.delete_record()
613
614 def hrm_update_manager_role(record, user_id):
615- """ Set/retract HR Manager role """
616+ """
617+ Set/retract HR Manager role
618+ @ToDo: Deprecate (should be managed via Permissions tab)
619+ """
620
621 rtable = db.auth_group
622 mtable = db.auth_membership
623@@ -395,7 +401,6 @@
624 user_id = data.owned_by_user
625 role_id = data.owned_by_role
626 if user_id and role_id:
627-
628 hrm_update_staff_role(record, user_id, role_id)
629 hrm_update_manager_role(record, user_id)
630
631@@ -571,7 +576,7 @@
632 comment = skill_help,
633 ondelete = "RESTRICT",
634 # Comment this to use a Dropdown & not an Autocomplete
635- widget = S3AutocompleteWidget(request,
636+ widget = S3AutocompleteWidget(globals(),
637 "hrm",
638 "skill")
639 )
640@@ -655,8 +660,7 @@
641 # This field can only be filled-out by specific roles
642 # Once this has been filled-out then the other fields are locked
643 organisation_id(label = T("Confirming Organization"),
644- widget = S3OrganisationAutocompleteWidget(request,
645- session,
646+ widget = S3OrganisationAutocompleteWidget(globals(),
647 default_from_profile = True),
648 comment = None,
649 writable = False),
650@@ -786,8 +790,7 @@
651 person_id(),
652 job_role_id(),
653 organisation_id(empty=False,
654- widget = S3OrganisationAutocompleteWidget(request,
655- session,
656+ widget = S3OrganisationAutocompleteWidget(globals(),
657 default_from_profile = True),
658 label=T("Credentialling Organization")),
659 Field("performance_rating", "integer",
660@@ -874,7 +877,7 @@
661 comment = course_help,
662 ondelete = "RESTRICT",
663 # Comment this to use a Dropdown & not an Autocomplete
664- widget = S3AutocompleteWidget(request,
665+ widget = S3AutocompleteWidget(globals(),
666 "hrm",
667 "course")
668 )
669@@ -946,9 +949,8 @@
670 notnull=True,
671 label=T("Name")),
672 organisation_id(empty=False,
673- widget = S3OrganisationAutocompleteWidget(request,
674- session,
675- default_from_profile = True),
676+ widget = S3OrganisationAutocompleteWidget(globals(),
677+ default_from_profile = True),
678 label=T("Certifying Organization")),
679 migrate=migrate, *s3_meta_fields())
680
681@@ -1124,8 +1126,7 @@
682 tablename = "hrm_experience"
683 table = db.define_table(tablename,
684 person_id(),
685- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
686- session,
687+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
688 default_from_profile = True)),
689 Field("start_date", "date",
690 label=T("Start Date")),
691
692=== modified file 'models/07_cr.py'
693--- models/07_cr.py 2011-06-21 19:08:22 +0000
694+++ models/07_cr.py 2011-06-27 17:56:49 +0000
695@@ -175,8 +175,7 @@
696 length=64, # Mayon compatibility
697 requires = IS_NOT_EMPTY(),
698 label = T("Shelter Name")),
699- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
700- session,
701+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
702 default_from_profile = True)),
703 shelter_type_id(), # e.g. NGO-operated, Government evacuation center, School, Hospital -- see Agasti opt_camp_type.)
704 shelter_service_id(), # e.g. medical, housing, food, ...
705@@ -257,7 +256,7 @@
706 "%s (%s)." % (SHELTER_HELP,
707 T("optional"))))),
708 label = SHELTER_LABEL,
709- widget = S3AutocompleteWidget(request, module, resourcename)
710+ widget = S3AutocompleteWidget(globals(), module, resourcename)
711 )
712
713 # Add Shelters as component of Services, Types as a simple way
714
715=== modified file 'models/08_assess.py'
716--- models/08_assess.py 2011-06-21 19:08:22 +0000
717+++ models/08_assess.py 2011-06-27 17:56:49 +0000
718@@ -62,11 +62,10 @@
719 Field("datetime", "datetime",
720 label = T("Date & Time"),
721 default = request.utcnow),
722- location_id(widget = S3LocationAutocompleteWidget(request,
723+ location_id(widget = S3LocationAutocompleteWidget(globals(),
724 deployment_settings),
725 requires = IS_LOCATION(db, T, gis)),
726- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
727- session,
728+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
729 default_from_profile = True)),
730 person_id("assessor_person_id", label = T("Assessor")),
731 comments(),
732@@ -411,7 +410,7 @@
733 Field("date", "date",
734 requires = [IS_DATE(), IS_NOT_EMPTY()],
735 default = datetime.datetime.today()),
736- location_id(widget = S3LocationAutocompleteWidget(request,
737+ location_id(widget = S3LocationAutocompleteWidget(globals(),
738 deployment_settings),
739 requires = IS_LOCATION(db, T, gis)),
740 human_resource_id("staff_id", label=T("Staff")),
741@@ -1832,7 +1831,8 @@
742 resourcename = "population"
743 tablename = "%s_%s" % (module, resourcename)
744 table = db.define_table(tablename,
745- location_id(widget = S3LocationAutocompleteWidget(request, deployment_settings),
746+ location_id(widget = S3LocationAutocompleteWidget(globals(),
747+ deployment_settings),
748 requires = IS_LOCATION(db, T, gis)),
749 Field("population", "double"),
750 Field("households", "double"),
751
752=== modified file 'models/09_project.py'
753--- models/09_project.py 2011-06-21 19:08:22 +0000
754+++ models/09_project.py 2011-06-27 17:56:49 +0000
755@@ -136,12 +136,11 @@
756 Field("code", label = T("Code")),
757 Field("name", label = T("Title")),
758 sector_id(),
759- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
760- session,
761+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
762 default_from_profile = True)),
763 Field("description", "text",
764 label = T("Description")),
765- location_id(widget = S3LocationAutocompleteWidget(request, deployment_settings),
766+ location_id(widget = S3LocationAutocompleteWidget(globals(), deployment_settings),
767 requires = IS_NULL_OR(IS_LOCATION(db, T, gis))),
768 Field("status", "integer",
769 requires = IS_IN_SET(project_status_opts, zero=None),
770@@ -207,8 +206,7 @@
771
772 # Projects as component of Orgs
773 s3mgr.model.add_component(table,
774- joinby=dict(org_organisation=
775- "organisation_id"))
776+ joinby=dict(org_organisation="organisation_id"))
777
778 s3mgr.configure(tablename,
779 main="code",
780@@ -514,8 +512,7 @@
781
782 # Activities as component of Orgs
783 s3mgr.model.add_component(table,
784- joinby=dict(org_organisation=
785- "organisation_id"))
786+ joinby=dict(org_organisation="organisation_id"))
787
788 # =====================================================================
789 # Tasks:
790
791=== modified file 'models/doc.py'
792--- models/doc.py 2011-06-24 21:42:05 +0000
793+++ models/doc.py 2011-06-27 17:56:49 +0000
794@@ -42,8 +42,7 @@
795 url and A(url,_href=url) or NONE),
796 person_id(label=T("Author"),
797 comment = shn_person_comment(T("Author"), T("The Author of this Document (optional)"))),
798- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
799- session,
800+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
801 default_from_profile = True)),
802 location_id(),
803 Field("date", "date"),
804@@ -138,7 +137,7 @@
805 # label = DOCUMENT,
806 # comment = document_comment,
807 # ondelete = "RESTRICT",
808- # widget = S3AutocompleteWidget(request, module, resourcename)
809+ # widget = S3AutocompleteWidget(globals(), module, resourcename)
810 # )
811
812 # Documents as Components of Organizations & Incidents
813@@ -228,8 +227,7 @@
814 Field("url", label=T("URL"),
815 requires = IS_NULL_OR(IS_URL())),
816 person_id(label=T("Author")),
817- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
818- session,
819+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
820 default_from_profile = True)),
821 location_id(),
822 Field("date", "date"),
823
824=== modified file 'models/event.py'
825--- models/event.py 2011-06-21 22:39:03 +0000
826+++ models/event.py 2011-06-27 17:56:49 +0000
827@@ -134,7 +134,7 @@
828 label = T("Event"),
829 ondelete = "RESTRICT",
830 # Comment these to use a Dropdown & not an Autocomplete
831- #widget = S3AutocompleteWidget(request)
832+ #widget = S3AutocompleteWidget(globals())
833 #comment = DIV(_class="tooltip",
834 # _title="%s|%s" % (T("Event"),
835 # T("Enter some characters to bring up a list of possible matches")))
836
837=== modified file 'models/scenario.py'
838--- models/scenario.py 2011-06-21 22:39:03 +0000
839+++ models/scenario.py 2011-06-27 17:56:49 +0000
840@@ -102,7 +102,7 @@
841 label = T("Scenario"),
842 ondelete = "RESTRICT",
843 # Comment these to use a Dropdown & not an Autocomplete
844- #widget = S3AutocompleteWidget(request)
845+ #widget = S3AutocompleteWidget(globals())
846 #comment = DIV(_class="tooltip",
847 # _title="%s|%s" % (T("Scenario"),
848 # T("Enter some characters to bring up a list of possible matches")))
849
850=== modified file 'models/survey.py'
851--- models/survey.py 2011-06-24 13:22:13 +0000
852+++ models/survey.py 2011-06-27 17:56:49 +0000
853@@ -109,8 +109,7 @@
854 Field("description", "text", default="", length=500),
855 template_id(),
856 person_id(),
857- organisation_id(widget = S3OrganisationAutocompleteWidget(request,
858- session,
859+ organisation_id(widget = S3OrganisationAutocompleteWidget(globals(),
860 default_from_profile = True)),
861 Field("logo", "string", default="", length=512),
862 Field("language", "string", default="en", length=8),
863
864=== modified file 'models/vol.py'
865--- models/vol.py 2011-06-21 19:08:22 +0000
866+++ models/vol.py 2011-06-27 17:56:49 +0000
867@@ -45,7 +45,7 @@
868 # a small number of locations.
869 widget=None,
870 # For larger numbers of Locations
871- #widget=S3LocationAutocompleteWidget(request, deployment_settings,
872+ #widget=S3LocationAutocompleteWidget(globals(), deployment_settings,
873 # level=gis.allowed_region_level_keys)
874 ),
875 Field("status", "integer",
876
877=== modified file 'models/zz_last.py'
878--- models/zz_last.py 2011-06-17 23:23:01 +0000
879+++ models/zz_last.py 2011-06-27 17:56:49 +0000
880@@ -2,9 +2,13 @@
881
882 # File needs to be last in order to be able to have all Tables defined
883
884+security_policy = deployment_settings.get_security_policy()
885+
886 # Populate dropdowns
887 _tables = db.tables
888-db.auth_permission.table_name.requires = IS_IN_SET(_tables)
889+if security_policy not in (1, 2, 3, 4, 5, 6, 7):
890+ # Web2Py security
891+ db.auth_permission.table_name.requires = IS_IN_SET(_tables)
892 db.pr_pe_subscription.resource.requires = IS_IN_SET(_tables)
893 db.gis_feature_class.resource.requires = IS_IN_SET(_tables)
894 if deployment_settings.has_module("msg"):
895
896=== modified file 'models/zzz_1st_roles.py'
897--- models/zzz_1st_roles.py 2011-06-08 17:39:49 +0000
898+++ models/zzz_1st_roles.py 2011-06-27 17:56:49 +0000
899@@ -16,9 +16,13 @@
900
901 if populate & 1:
902
903+ # Shortcuts
904 acl = auth.permission
905 sysroles = auth.S3_SYSTEM_ROLES
906 create_role = auth.s3_create_role
907+ update_acls = auth.s3_update_acls
908+ org_roles = auth.org.org_roles
909+ site_roles = auth.org.site_roles
910
911 default_uacl = deployment_settings.get_aaa_default_uacl()
912 default_oacl = deployment_settings.get_aaa_default_oacl()
913@@ -28,31 +32,39 @@
914 "System Administrator - can access & make changes to any data",
915 uid=sysroles.ADMIN,
916 system=True, protected=True)
917- create_role("Authenticated",
918- "Authenticated - all logged-in users",
919- dict(c="gis", uacl=acl.ALL, oacl=acl.ALL),
920- # Note the owning role for locations is set to Authenticated
921- # by default, so this controls the access that logged in
922- # users have. (In general, tables do not have a default
923- # owning role.)
924- dict(c="gis", f="location", uacl=acl.READ, oacl=acl.ALL),
925- # PR permissions
926- dict(c="pr", uacl=acl.NONE, oacl=acl.READ|acl.UPDATE),
927- # For Staff Permissions
928- dict(c="org", uacl=default_uacl, oacl=default_oacl),
929- dict(c="hms", uacl=default_uacl, oacl=default_oacl),
930- dict(c="cr", uacl=default_uacl, oacl=default_oacl),
931- dict(c="inv", uacl=default_uacl, oacl=default_oacl),
932- dict(c="req", uacl=default_uacl, oacl=default_oacl),
933- dict(c="supply", uacl=default_uacl, oacl=default_oacl),
934- # HRM Permissions (requires security policy 4)
935- dict(c="hrm", uacl=acl.NONE, oacl=acl.READ|acl.UPDATE),
936- dict(c="hrm", f="staff", uacl=acl.NONE, oacl=acl.NONE),
937- dict(c="hrm", f="volunteer", uacl=acl.NONE, oacl=acl.NONE),
938- dict(c="hrm", f="person", uacl=acl.NONE, oacl=acl.READ|acl.UPDATE),
939- dict(c="hrm", f="skill", uacl=acl.READ, oacl=acl.READ),
940- uid=sysroles.AUTHENTICATED,
941- protected=True)
942+ authenticated = create_role("Authenticated",
943+ "Authenticated - all logged-in users",
944+ # Authenticated users can see the Map
945+ dict(c="gis", uacl=acl.ALL, oacl=acl.ALL),
946+ # Note the owning role for locations is set to Authenticated
947+ # by default, so this controls the access that logged in
948+ # users have. (In general, tables do not have a default
949+ # owning role.)
950+ dict(c="gis", f="location", uacl=acl.READ, oacl=acl.ALL),
951+ # Authenticated users can only see/edit their own PR records
952+ dict(c="pr", uacl=acl.NONE, oacl=acl.READ|acl.UPDATE),
953+ # Authenticated users can see the Supply Catalogue
954+ dict(c="supply", uacl=default_uacl, oacl=default_oacl),
955+ uid=sysroles.AUTHENTICATED,
956+ protected=True)
957+ # If we don't have OrgAuth active, then Authenticated users:
958+ # Have access to all Orgs, Sites & the Inventory & Requests thereof
959+ update_acls(authenticated,
960+ dict(c="org", uacl=default_uacl, oacl=default_oacl, orgauth_disable=True),
961+ dict(c="hms", uacl=default_uacl, oacl=default_oacl, orgauth_disable=True),
962+ dict(c="cr", uacl=default_uacl, oacl=default_oacl, orgauth_disable=True),
963+ dict(c="inv", uacl=default_uacl, oacl=default_oacl, orgauth_disable=True),
964+ dict(c="req", uacl=default_uacl, oacl=default_oacl, orgauth_disable=True),
965+ # HRM access is controlled to just HR Staff, except for:
966+ # Access to your own record & to be able to search for Skills
967+ # requires security policy 4+
968+ dict(c="hrm", uacl=acl.NONE, oacl=acl.READ|acl.UPDATE, orgauth_disable=True),
969+ dict(c="hrm", f="staff", uacl=acl.NONE, oacl=acl.NONE, orgauth_disable=True),
970+ dict(c="hrm", f="volunteer", uacl=acl.NONE, oacl=acl.NONE, orgauth_disable=True),
971+ dict(c="hrm", f="person", uacl=acl.NONE, oacl=acl.READ|acl.UPDATE, orgauth_disable=True),
972+ dict(c="hrm", f="skill", uacl=acl.READ, oacl=acl.READ, orgauth_disable=True),
973+ )
974+
975 create_role("Anonymous",
976 "Unauthenticated users",
977 # Allow unauthenticated users to sign-up as a Volunteer
978@@ -65,10 +77,13 @@
979 dict(c="gis", f="feature_query", uacl=acl.NONE, oacl=default_oacl),
980 uid=sysroles.ANONYMOUS,
981 protected=True)
982+
983+ # Primarily for Security Policy 2
984 create_role("Editor",
985 "Editor - can access & make changes to any unprotected data",
986 uid=sysroles.EDITOR,
987 system=True, protected=True)
988+ # MapAdmin
989 create_role("MapAdmin",
990 "MapAdmin - allowed access to edit the MapService Catalogue",
991 dict(c="gis", uacl=acl.ALL, oacl=acl.ALL),
992@@ -80,15 +95,156 @@
993 create_role("DVI", "Role for DVI staff - permission to access the DVI module",
994 dict(c="dvi", uacl=acl.ALL, oacl=acl.ALL))
995 create_role("HMS Staff", "Hospital Staff - permission to add/update own records in the HMS",
996- dict(c="hms", uacl=acl.CREATE, oacl=acl.ALL))
997+ dict(c="hms", uacl=acl.CREATE, oacl=acl.ALL, orgauth_disable=True))
998 create_role("HMS Admin", "Hospital Admin - permission to add/update all records in the HMS",
999- dict(c="hms", uacl=acl.ALL, oacl=acl.ALL))
1000+ dict(c="hms", uacl=acl.ALL, oacl=acl.ALL, orgauth_disable=True))
1001
1002- create_role("HR Manager", "Human Resource Manager",
1003- dict(c="hrm", uacl=acl.ALL, oacl=acl.ALL),
1004- #dict(c="hrm", f="staff", uacl=acl.CREATE|acl.READ, oacl=acl.ALL),
1005- #dict(c="hrm", f="volunteer", uacl=acl.CREATE|acl.READ, oacl=acl.ALL),
1006- dict(c="hrm", f="human_resource", uacl=acl.CREATE, oacl=acl.ALL),
1007- dict(c="hrm", f="person", uacl=acl.CREATE|acl.READ|acl.UPDATE, oacl=acl.ALL),
1008- dict(c="hrm", f="skill", uacl=acl.READ, oacl=acl.ALL),
1009+ # HR Manager role has full access to all HRM data
1010+ # This Role is ignored in OrgAuth mode
1011+ create_role("HR Manager", "Human Resources Manager",
1012+ dict(c="hrm", uacl=acl.ALL, oacl=acl.ALL, orgauth_disable=True),
1013+ dict(c="hrm", f="human_resource", uacl=acl.CREATE, oacl=acl.ALL, orgauth_disable=True),
1014+ dict(c="hrm", f="person", uacl=acl.CREATE|acl.READ|acl.UPDATE, oacl=acl.ALL, orgauth_disable=True),
1015+ dict(c="hrm", f="job_role", uacl=acl.READ, oacl=acl.ALL, orgauth_disable=True),
1016+ dict(c="hrm", f="skill", uacl=acl.READ, oacl=acl.ALL, orgauth_disable=True),
1017+ dict(c="hrm", f="course", uacl=acl.READ, oacl=acl.ALL, orgauth_disable=True),
1018+ dict(c="hrm", f="certificate", uacl=acl.READ, oacl=acl.ALL, orgauth_disable=True),
1019 uid="HR Manager")
1020+
1021+ # Role Templates
1022+ # For every Role Template, we also create a wrapper Role Set template which
1023+ # includes the relevant Access Role(s)
1024+ create_role_template = auth.org.create_role_template
1025+ create_role_set_template = auth.org.create_role_set_template
1026+ scope = auth.org.scope
1027+ # Roles that apply just to Orgs
1028+ create_role_template("OrgAdmin",
1029+ dict(c="org", oacl=acl.ALL, access_by_role="Access"),
1030+ dict(c="org", f="office", oacl=acl.ALL, access_by_role="Access"),
1031+ dict(c="org", f="organisation", oacl=acl.ALL, access_by_role="Access"),
1032+ dict(c="hrm", oacl=acl.ALL, access_by_role="HR Access"),
1033+ dict(c="hrm", f="human_resource", oacl=acl.ALL, access_by_role="HR Access"),
1034+ dict(c="hrm", f="person", oacl=acl.ALL, access_by_role="HR Access"),
1035+ dict(c="hrm", f="job_role", oacl=acl.ALL, access_by_role="HR Access"),
1036+ dict(c="hrm", f="skill", oacl=acl.ALL, access_by_role="HR Access"),
1037+ dict(c="hrm", f="course", oacl=acl.ALL, access_by_role="HR Access"),
1038+ dict(c="hrm", f="certificate", oacl=acl.ALL, access_by_role="HR Access"),
1039+ dict(c="inv", oacl=acl.ALL, access_by_role="Logs Access"),
1040+ dict(c="inv", f="warehouse", oacl=acl.ALL, access_by_role="Logs Access"),
1041+ dict(c="inv", f="inv_item", oacl=acl.ALL, access_by_role="Logs Access"),
1042+ dict(c="inv", f="send", oacl=acl.ALL, access_by_role="Logs Access"),
1043+ dict(c="inv", f="recv", oacl=acl.ALL, access_by_role="Logs Access"),
1044+ dict(c="supply", f="item", oacl=acl.ALL, access_by_role="Logs Access"),
1045+ dict(c="supply", f="catalog_item", oacl=acl.ALL, access_by_role="Logs Access"),
1046+ dict(c="supply", f="item_category", oacl=acl.ALL, access_by_role="Logs Access")
1047+ )
1048+ create_role_set_template("OrgAdmin",
1049+ access_roles=["Access", # Org_X_Access
1050+ "HR Access",
1051+ "Logs Access"],
1052+ acl_roles=["OrgAdmin"],
1053+ scope = scope.ORG)
1054+ # Roles that apply just to Facilities
1055+ create_role_template("SiteAdmin",
1056+ dict(c="org", f="office", oacl=acl.ALL, access_by_role="Access"),
1057+ dict(c="hrm", oacl=acl.ALL, access_by_role="HR Access"),
1058+ dict(c="hrm", f="human_resource", oacl=acl.ALL, access_by_role="HR Access"),
1059+ dict(c="hrm", f="person", oacl=acl.ALL, access_by_role="HR Access"),
1060+ dict(c="hrm", f="job_role", oacl=acl.ALL, access_by_role="HR Access"),
1061+ dict(c="hrm", f="skill", oacl=acl.ALL, access_by_role="HR Access"),
1062+ dict(c="hrm", f="course", oacl=acl.ALL, access_by_role="HR Access"),
1063+ dict(c="hrm", f="certificate", oacl=acl.ALL, access_by_role="HR Access"),
1064+ dict(c="inv", oacl=acl.ALL, access_by_role="Logs Access"),
1065+ dict(c="inv", f="warehouse", oacl=acl.ALL, access_by_role="Logs Access"),
1066+ dict(c="inv", f="inv_item", oacl=acl.ALL, access_by_role="Logs Access"),
1067+ dict(c="inv", f="send", oacl=acl.ALL, access_by_role="Logs Access"),
1068+ dict(c="inv", f="recv", oacl=acl.ALL, access_by_role="Logs Access"),
1069+ dict(c="supply", f="item", oacl=acl.ALL, access_by_role="Logs Access"),
1070+ dict(c="supply", f="catalog_item", oacl=acl.ALL, access_by_role="Logs Access"),
1071+ dict(c="supply", f="item_category", oacl=acl.ALL, access_by_role="Logs Access")
1072+ )
1073+ create_role_set_template("SiteAdmin",
1074+ access_roles=["Access", # Site_Y_Access
1075+ "HR Access",
1076+ "Logs Access"],
1077+ acl_roles=["SiteAdmin"],
1078+ scope = scope.SITE)
1079+ # Roles that apply to both Orgs & Facilities
1080+ create_role_template("HR Manager",
1081+ dict(c="hrm", oacl=acl.ALL, access_by_role="HR Access"),
1082+ dict(c="hrm", f="human_resource", oacl=acl.ALL, access_by_role="HR Access"),
1083+ dict(c="hrm", f="person", oacl=acl.ALL, access_by_role="HR Access"),
1084+ dict(c="hrm", f="job_role", oacl=acl.ALL, access_by_role="HR Access"),
1085+ dict(c="hrm", f="skill", oacl=acl.ALL, access_by_role="HR Access"),
1086+ dict(c="hrm", f="course", oacl=acl.ALL, access_by_role="HR Access"),
1087+ dict(c="hrm", f="certificate", oacl=acl.ALL, access_by_role="HR Access"),
1088+ )
1089+ create_role_set_template("HR Manager",
1090+ access_roles=["HR Access"],
1091+ acl_roles=["HR Manager"])
1092+ create_role_template("HR Editor",
1093+ dict(c="hrm", oacl=acl.ALL, access_by_role="HR Access"),
1094+ dict(c="hrm", f="human_resource", oacl=acl.ALL, access_by_role="HR Access"),
1095+ dict(c="hrm", f="person", oacl=acl.ALL, access_by_role="HR Access"),
1096+ dict(c="hrm", f="job_role", oacl=acl.ALL, access_by_role="HR Access"),
1097+ dict(c="hrm", f="skill", oacl=acl.ALL, access_by_role="HR Access"),
1098+ dict(c="hrm", f="course", oacl=acl.ALL, access_by_role="HR Access"),
1099+ dict(c="hrm", f="certificate", oacl=acl.ALL, access_by_role="HR Access"),
1100+ )
1101+ create_role_set_template("HR Editor",
1102+ access_roles=["HR Access"],
1103+ acl_roles=["HR Editor"])
1104+ create_role_template("HR Reader",
1105+ dict(c="hrm", oacl=acl.READ, access_by_role="HR Access"),
1106+ dict(c="hrm", f="human_resource", oacl=acl.READ, access_by_role="HR Access"),
1107+ dict(c="hrm", f="person", oacl=acl.READ, access_by_role="HR Access"),
1108+ dict(c="hrm", f="job_role", oacl=acl.READ, access_by_role="HR Access"),
1109+ dict(c="hrm", f="skill", oacl=acl.READ, access_by_role="HR Access"),
1110+ dict(c="hrm", f="course", oacl=acl.READ, access_by_role="HR Access"),
1111+ dict(c="hrm", f="certificate", oacl=acl.READ, access_by_role="HR Access"),
1112+ )
1113+ create_role_set_template("HR Reader",
1114+ access_roles=["HR Access"],
1115+ acl_roles=["HR Reader"])
1116+ create_role_template("Logs Manager",
1117+ dict(c="inv", oacl=acl.ALL, access_by_role="Logs Access"),
1118+ dict(c="inv", f="warehouse", oacl=acl.ALL, access_by_role="Logs Access"),
1119+ dict(c="inv", f="inv_item", oacl=acl.ALL, access_by_role="Logs Access"),
1120+ dict(c="inv", f="send", oacl=acl.ALL, access_by_role="Logs Access"),
1121+ dict(c="inv", f="recv", oacl=acl.ALL, access_by_role="Logs Access"),
1122+ dict(c="supply", f="item", oacl=acl.ALL, access_by_role="Logs Access"),
1123+ dict(c="supply", f="catalog_item", oacl=acl.ALL, access_by_role="Logs Access"),
1124+ dict(c="supply", f="item_category", oacl=acl.ALL, access_by_role="Logs Access"),
1125+ )
1126+ create_role_set_template("Logs Manager",
1127+ access_roles=["Logs Access"],
1128+ acl_roles=["Logs Manager"])
1129+ create_role_template("Logs Editor",
1130+ dict(c="inv", oacl=acl.ALL, access_by_role="Logs Access"),
1131+ dict(c="inv", f="warehouse", oacl=acl.ALL, access_by_role="Logs Access"),
1132+ dict(c="inv", f="inv_item", oacl=acl.ALL, access_by_role="Logs Access"),
1133+ dict(c="inv", f="send", oacl=acl.ALL, access_by_role="Logs Access"),
1134+ dict(c="inv", f="recv", oacl=acl.ALL, access_by_role="Logs Access"),
1135+ # Logs Editors can create new Items
1136+ dict(c="supply", f="item", oacl=acl.ALL, access_by_role="Logs Access"),
1137+ # But not Edit the Catalogs or the Categories
1138+ dict(c="supply", f="catalog_item", oacl=acl.READ, access_by_role="Logs Access"),
1139+ dict(c="supply", f="item_category", oacl=acl.READ, access_by_role="Logs Access"),
1140+ )
1141+ create_role_set_template("Logs Editor",
1142+ access_roles=["Logs Access"],
1143+ acl_roles=["Logs Editor"])
1144+ create_role_template("Logs Reader",
1145+ dict(c="inv", oacl=acl.READ, access_by_role="Logs Access"),
1146+ dict(c="inv", f="warehouse", oacl=acl.READ, access_by_role="Logs Access"),
1147+ dict(c="inv", f="inv_item", oacl=acl.READ, access_by_role="Logs Access"),
1148+ dict(c="inv", f="send", oacl=acl.READ, access_by_role="Logs Access"),
1149+ dict(c="inv", f="recv", oacl=acl.READ, access_by_role="Logs Access"),
1150+ dict(c="supply", f="item", oacl=acl.READ, access_by_role="Logs Access"),
1151+ dict(c="supply", f="catalog_item", oacl=acl.READ, access_by_role="Logs Access"),
1152+ dict(c="supply", f="item_category", oacl=acl.READ, access_by_role="Logs Access"),
1153+ )
1154+ create_role_set_template("Logs Reader",
1155+ access_roles=["Logs Access"],
1156+ acl_roles=["Logs Reader"])
1157+
1158\ No newline at end of file
1159
1160=== modified file 'modules/s3/s3aaa.py'
1161--- modules/s3/s3aaa.py 2011-06-24 15:28:40 +0000
1162+++ modules/s3/s3aaa.py 2011-06-27 17:56:49 +0000
1163@@ -54,13 +54,13 @@
1164 # from gluon.contrib.gql import Field, Row, Query
1165 #except ImportError:
1166 from gluon.dal import Field, Row, Query, Set, Table, Expression
1167-from gluon.sqlhtml import SQLFORM, SQLTABLE, CheckboxesWidget
1168+from gluon.sqlhtml import SQLFORM, SQLTABLE, CheckboxesWidget, StringWidget
1169 from gluon.tools import Auth, callback
1170 from gluon.contrib.simplejson.ordered_dict import OrderedDict
1171
1172 from s3rest import S3Method
1173 from s3validators import IS_ACL
1174-from s3widgets import S3RoleSetWidget, S3RoleSetUsersWidget, S3ACLWidget
1175+from s3widgets import S3RoleSetWidget, S3ACLWidget, S3AppendRoleSetUsersWidget
1176
1177 DEFAULT = lambda: None
1178 table_field = re.compile("[\w_]+\.[\w_]+")
1179@@ -131,25 +131,22 @@
1180 self.messages.label_mobile_phone = "Mobile Phone"
1181 self.messages.help_mobile_phone = "Entering a phone number is optional, but doing so allows you to subscribe to receive SMS messages."
1182 self.messages.help_organisation = "Entering an Organization is optional, but doing so directs you to the appropriate approver & means you automatically get the appropriate permissions."
1183+ # OrgAuth
1184 self.messages.label_users_assigned = "Users assigned"
1185 self.messages.label_orgs_delegated = "Delegated to"
1186- self.messages.label_role_set_tab = "Access Roles"
1187+ self.messages.label_role_set_tab = "Permissions"
1188+
1189 self.messages.lock_keys = True
1190
1191 self.permission = S3Permission(self, environment)
1192
1193- self.table_role_set = None
1194- self.table_role_set_name = "auth_role_set"
1195- self.table_user_role_set = None
1196- self.table_user_role_set_name = "auth_user_role_set"
1197-
1198 T = self.environment.T
1199
1200 self.org = S3OrgAuth(self)
1201 self.org_site_types = self.org.site_types
1202
1203 # -------------------------------------------------------------------------
1204- def __get_migrate(self, tablename, migrate=True):
1205+ def get_migrate(self, tablename, migrate=True):
1206
1207 if type(migrate).__name__ == "str":
1208 return ("%s%s.table" % (migrate, tablename))
1209@@ -180,6 +177,7 @@
1210
1211 db = self.db
1212 request = self.environment.request
1213+ session = self.session
1214 settings = self.settings
1215 messages = self.messages
1216
1217@@ -217,7 +215,7 @@
1218 readable=False, default=False),
1219 Field("timestmp", "datetime", writable=False,
1220 readable=False, default=""),
1221- migrate = self.__get_migrate(settings.table_user_name,
1222+ migrate = self.get_migrate(settings.table_user_name,
1223 migrate))
1224 else:
1225 # with email-address (Sahana default)
1226@@ -251,7 +249,7 @@
1227 readable=False, default=False),
1228 Field("timestmp", "datetime", writable=False,
1229 readable=False, default=""),
1230- migrate = self.__get_migrate(settings.table_user_name,
1231+ migrate = self.get_migrate(settings.table_user_name,
1232 migrate))
1233 table = settings.table_user
1234 table.first_name.notnull = True
1235@@ -318,7 +316,7 @@
1236 label=messages.label_role),
1237 Field("description", "text",
1238 label=messages.label_description),
1239- migrate = self.__get_migrate(settings.table_group_name,
1240+ migrate = self.get_migrate(settings.table_group_name,
1241 migrate))
1242 table = settings.table_group
1243 table.role.requires = IS_NOT_IN_DB(db, "%s.role"
1244@@ -332,7 +330,7 @@
1245 label=messages.label_user_id),
1246 Field("group_id", settings.table_group,
1247 label=messages.label_group_id),
1248- migrate = self.__get_migrate(settings.table_membership_name,
1249+ migrate = self.get_migrate(settings.table_membership_name,
1250 migrate))
1251 table = settings.table_membership
1252 table.user_id.requires = IS_IN_DB(db, "%s.id" %
1253@@ -342,57 +340,20 @@
1254 settings.table_group._tablename,
1255 "%(id)s: %(role)s")
1256
1257- # Role sets
1258- role_set_widget = S3RoleSetWidget(self.environment, db=db,
1259- settings=settings, site_types=self.org_site_types, table_name=self.table_role_set_name)
1260- role_set_users_widget = S3RoleSetUsersWidget(db=db)
1261- if not self.table_role_set:
1262- self.table_role_set = db.define_table(
1263- self.table_role_set_name,
1264- # Each role set has a name
1265- Field("name",
1266- length=64,
1267- notnull=True),
1268- Field("dummy_users_assigned",
1269- "list:integer",
1270- label=self.messages.label_users_assigned,
1271- required=False,
1272- widget=role_set_users_widget.widget),
1273- Field("orgs_delegated",
1274- "list:integer",
1275- label=self.messages.label_orgs_delegated,
1276- readable=False,
1277- writable=False,
1278- required=False),
1279- # Role sets can be tied to organisations
1280- Field("organisation_id",
1281- "integer",
1282- label=messages.label_organisation_id),
1283- # List of roles
1284- Field("roles",
1285- "list:reference %s" % settings.table_group_name,
1286- widget=role_set_widget.widget),
1287- migrate = self.__get_migrate(self.table_role_set_name,
1288- migrate))
1289- db.manager.configure(self.table_role_set,
1290- onaccept=self.org.role_set_onaccept,
1291- list_fields=["name",
1292- "roles"])
1293-
1294- # Role set assignments
1295- # A user with a role set assigned will have all roles
1296- # defined in the role set
1297- if not self.table_user_role_set:
1298- self.table_user_role_set = db.define_table(
1299- self.table_user_role_set_name,
1300- Field("user_id", settings.table_user),
1301- Field("set_id", self.table_role_set),
1302- migrate = self.__get_migrate(self.table_user_role_set_name,
1303- migrate))
1304-
1305- # Permissions table (group<->permission)
1306- # NB This Web2Py table is deprecated / replaced in Eden by S3Permission
1307- if not settings.table_permission:
1308+ security_policy = self.deployment_settings.get_security_policy()
1309+ #if security_policy in (3, 4, 5, 6, 7):
1310+ # We do this anyway in order to reduce migration pains
1311+ # Define Eden permission table
1312+ self.permission.define_table()
1313+
1314+ # Should we create the tables for OrgAuth?
1315+ # We do this anyway in order to reduce migration pains
1316+ #if self.org.org_roles:
1317+ self.org.define_tables(migrate=migrate)
1318+
1319+ if security_policy not in (1, 2, 3, 4, 5, 6, 7) and not settings.table_permission:
1320+ # Permissions table (group<->permission)
1321+ # NB This Web2Py table is deprecated / replaced in Eden by S3Permission
1322 settings.table_permission = db.define_table(
1323 settings.table_permission_name,
1324 Field("group_id", settings.table_group,
1325@@ -403,7 +364,7 @@
1326 label=messages.label_table_name),
1327 Field("record_id", "integer",
1328 label=messages.label_record_id),
1329- migrate = self.__get_migrate(
1330+ migrate = self.get_migrate(
1331 settings.table_permission_name, migrate))
1332 table = settings.table_permission
1333 table.group_id.requires = IS_IN_DB(db, "%s.id" %
1334@@ -414,7 +375,8 @@
1335 table.record_id.requires = IS_INT_IN_RANGE(0, 10 ** 9)
1336
1337 # Event table (auth log)
1338- # - not used by Sahana
1339+ # Records Logins & ?
1340+ # @ToDo: Deprecate? At least make it configurable?
1341 if not settings.table_event:
1342 settings.table_event = db.define_table(
1343 settings.table_event_name,
1344@@ -425,22 +387,18 @@
1345 default=self.environment.request.client,
1346 label=messages.label_client_ip),
1347 Field("user_id", settings.table_user, default=None,
1348+ requires = IS_IN_DB(db, "%s.id" %
1349+ settings.table_user._tablename,
1350+ "%(id)s: %(first_name)s %(last_name)s"),
1351 label=messages.label_user_id),
1352 Field("origin", default="auth", length=512,
1353- label=messages.label_origin),
1354+ label=messages.label_origin,
1355+ requires = IS_NOT_EMPTY()),
1356 Field("description", "text", default="",
1357- label=messages.label_description),
1358- migrate = self.__get_migrate(settings.table_event_name,
1359+ label=messages.label_description,
1360+ requires = IS_NOT_EMPTY()),
1361+ migrate = self.get_migrate(settings.table_event_name,
1362 migrate))
1363- table = settings.table_event
1364- table.user_id.requires = IS_IN_DB(db, "%s.id" %
1365- settings.table_user._tablename,
1366- "%(id)s: %(first_name)s %(last_name)s")
1367- table.origin.requires = IS_NOT_EMPTY()
1368- table.description.requires = IS_NOT_EMPTY()
1369-
1370- # Define permission table
1371- self.permission.define_table()
1372
1373 # -------------------------------------------------------------------------
1374 def login_bare(self, username, password):
1375@@ -1302,6 +1260,7 @@
1376
1377 return True
1378
1379+ # -------------------------------------------------------------------------
1380 # Role Management
1381 # -------------------------------------------------------------------------
1382 def get_system_roles(self):
1383@@ -1336,7 +1295,7 @@
1384 return sr
1385
1386 # -------------------------------------------------------------------------
1387- def s3_create_role(self, role, description, *acls, **args):
1388+ def s3_create_role(self, role, description=None, *acls, **args):
1389 """
1390 Back-end method to create roles with ACLs
1391
1392@@ -1420,12 +1379,12 @@
1393 rstable = self.table_role_set
1394 rows = db(rstable.roles.contains(role_id)).select()
1395 for row in rows:
1396- self.s3_remove_role_from_set(row.id, role_id)
1397+ self.org.remove_role_from_set(row.id, role_id)
1398 # Remove the role
1399 self.db(gquery).delete()
1400
1401 # -------------------------------------------------------------------------
1402- def resolve_role_ids(roles):
1403+ def resolve_role_ids(self, roles):
1404 """
1405 Resolve role UIDs
1406
1407@@ -1567,145 +1526,29 @@
1408
1409 return role in session.s3.roles
1410
1411- # Role Sets
1412- # -------------------------------------------------------------------------
1413- def s3_define_role_set(self, name, organisation_id=None, *roles):
1414- """
1415- Define a new role set
1416-
1417- @param name: the role set name
1418- @param roles: list of role IDs
1419- @param organisation_id: record ID of the organisation the role set
1420- belongs to
1421- """
1422-
1423- db = self.db
1424- table = self.table_role_set
1425-
1426- # Resolve role UIDs
1427- role_ids = self.resolve_role_ids(roles)
1428-
1429- row = db(table.name == name).select(limitby=(0, 1)).first()
1430- if row:
1431- # Re-define an existing role set
1432- if not organisation_id:
1433- organisation_id = row.organisation_id
1434- row.update_record(roles=role_ids,
1435- organisation_id=organisation_id)
1436- return row.id
1437- else:
1438- _id = table.insert(name=name,
1439- roles=role_ids,
1440- organisation_id=organisation_id)
1441- return _id
1442-
1443- # -------------------------------------------------------------------------
1444- def s3_delete_role_set(self, set_id):
1445- """
1446- Delete a role set
1447-
1448- @param name: the role set name
1449- """
1450-
1451- db = self.db
1452-
1453- table = self.table_user_role_set
1454- db(table.set_id == set_id).delete()
1455-
1456- table = self.table_role_set
1457- db(table.id == set_id).delete()
1458-
1459- # -------------------------------------------------------------------------
1460- def s3_add_role_to_set(self, set_id, *roles):
1461- """
1462- Add roles to a role set
1463-
1464- @param set_id: the role set
1465- @param roles: list of role IDs
1466- """
1467-
1468- db = self.db
1469-
1470- # Resolve role UIDs
1471- role_ids = self.resolve_role_ids(roles)
1472-
1473- table = self.table_role_set
1474- role_set = db(table.id == set_id).select(table.id,
1475- table.roles,
1476- limitby=(0, 1)).first()
1477- retain_roles = [role for role in role_set.roles
1478- if role not in role_ids]
1479- role_ids += retain_roles
1480- role_set.update_record(roles=role_ids)
1481-
1482- # -------------------------------------------------------------------------
1483- def s3_remove_role_from_set(self, set_id, *roles):
1484- """
1485- Remove roles from a role set
1486-
1487- @param set_id: the role set
1488- @param roles: list of role IDs
1489- """
1490-
1491- db = self.db
1492-
1493- # Resolve role UIDs
1494- role_ids = self.resolve_role_ids(roles)
1495-
1496- table = self.table_role_set
1497- role_set = db(table.id == set_id).select(table.id,
1498- table.roles,
1499- limitby=(0, 1)).first()
1500- retain_roles = [role for role in role_set.roles
1501- if role not in role_ids]
1502- role_set.update_record(roles=retain_roles)
1503-
1504- # -------------------------------------------------------------------------
1505- def s3_assign_role_set(self, user_id, set_id):
1506- """
1507- Assign a role set to a user
1508-
1509- @param user_id: the user record ID
1510- @param set_id: the role set
1511- """
1512-
1513- db = self.db
1514-
1515- table = self.table_user_role_set
1516- query = (table.user_id == user_id) & \
1517- (table.set_id == set_id)
1518- row = db(query).select(limitby=(0, 1)).first()
1519- if not row:
1520- table.insert(set_id=set_id, user_id=user_id)
1521- return
1522-
1523- # -------------------------------------------------------------------------
1524- def s3_retract_role_set(self, user_id, set_id):
1525- """
1526- Retract a role set from a user
1527-
1528- @param user_id: the user record ID
1529- @param set_id: the role set
1530- """
1531-
1532- db = self.db
1533-
1534- table = self.table_user_role_set
1535- query = (table.user_id == user_id) & \
1536- (table.set_id == set_id)
1537- db(query).delete()
1538- return
1539-
1540+ # -------------------------------------------------------------------------
1541 # ACL management
1542 # -------------------------------------------------------------------------
1543+ def s3_update_acls(self, role, *acls):
1544+ """
1545+ Wrapper for s3_update_acl to allow batch updating
1546+ """
1547+ for acl in acls:
1548+ self.s3_update_acl(role, **acl)
1549+
1550+ # -------------------------------------------------------------------------
1551 def s3_update_acl(self, role,
1552 c=None, f=None, t=None, oacl=None, uacl=None,
1553- require_owner_role=None):
1554+ require_owner_role=None,
1555+ orgauth_disable=False):
1556 """
1557 Back-end method to update an ACL
1558 """
1559
1560 table = self.permission.table
1561+ if not table:
1562+ # ACLs not relevant to this security policy
1563+ return None
1564
1565 if c is None and f is None and t is None:
1566 return None
1567@@ -1718,6 +1561,7 @@
1568 if uacl is None:
1569 uacl = self.permission.NONE
1570
1571+ # For OrgAuth
1572 if isinstance(require_owner_role, str) and \
1573 not require_owner_role.isdigit():
1574 rtable = self.settings.table_group
1575@@ -1741,7 +1585,8 @@
1576 tablename=t,
1577 oacl=oacl,
1578 uacl=uacl,
1579- require_owner_role=require_owner_role)
1580+ require_owner_role=require_owner_role,
1581+ orgauth_disable=orgauth_disable)
1582 if record:
1583 success = record.update_record(**acl)
1584 else:
1585@@ -1896,7 +1741,7 @@
1586 record=record_id,
1587 method=method)
1588
1589- elif session.s3.security_policy == 5:
1590+ elif session.s3.security_policy >= 5:
1591 # Controller+Function+Table ACLs
1592 self.permission.use_cacls = True
1593 self.permission.use_facls = True
1594@@ -1943,7 +1788,7 @@
1595 elif policy == 2:
1596 # "editor" security policy: show all records
1597 return table.id > 0
1598- elif policy in (3, 4, 5):
1599+ elif policy in (3, 4, 5, 6, 7):
1600 # ACLs: use S3Permission method
1601 query = self.permission.accessible_query(table, method)
1602 return query
1603@@ -2156,9 +2001,10 @@
1604 deployment_settings = env.deployment_settings
1605 self.policy = deployment_settings.get_security_policy()
1606 # Which level of granularity do we want?
1607- self.use_cacls = self.policy in (3, 4, 5) # Controller ACLs
1608- self.use_facls = self.policy in (4, 5) # Function ACLs
1609- self.use_tacls = self.policy in (5, ) # Table ACLs
1610+ self.use_cacls = self.policy in (3, 4, 5, 6, 7) # Controller ACLs
1611+ self.use_facls = self.policy in (4, 5, 6, 7) # Function ACLs
1612+ self.use_tacls = self.policy in (5, 6, 7) # Table ACLs
1613+ self.org_roles = self.policy in (6, 7) # OrgAuth
1614 self.modules = deployment_settings.modules
1615
1616 # Permissions table
1617@@ -2207,7 +2053,7 @@
1618 # -------------------------------------------------------------------------
1619 def define_table(self):
1620 """
1621- Define permissions table, invoked by AuthS3.define_tables
1622+ Define permissions table, invoked by AuthS3.define_tables()
1623 """
1624
1625 table_group = self.auth.settings.table_group
1626@@ -2222,7 +2068,10 @@
1627 Field("tablename", length=512),
1628 Field("oacl", "integer", default=self.ALL),
1629 Field("uacl", "integer", default=self.READ),
1630+ # Only apply this ACL if the record is owned by this role
1631 Field("require_owner_role", table_group),
1632+ # Disable this ACL if OrgAuth is enabled
1633+ Field("orgauth_disable", "boolean", default=False),
1634 migrate=self.migrate)
1635
1636 # -------------------------------------------------------------------------
1637@@ -2259,7 +2108,7 @@
1638 roles = [sr.AUTHENTICATED]
1639 if self.session.s3 is not None:
1640 roles = self.session.s3.roles or roles
1641- if self.policy not in (3, 4, 5):
1642+ if not self.use_cacls:
1643 # Fall back to simple authorization
1644 self.debug("Simple authorization")
1645 if self.auth.s3_logged_in():
1646@@ -2321,15 +2170,18 @@
1647 @returns: tuple of (ACL for owned resources, ACL for all resources)
1648 """
1649
1650+ session = self.session
1651+
1652 t = self.table
1653 sr = self.auth.get_system_roles()
1654
1655 most_permissive = self.most_permissive
1656
1657 roles = []
1658- if self.session.s3 is not None:
1659- roles = self.session.s3.roles or []
1660+ if session.s3 is not None:
1661+ roles = session.s3.roles or []
1662 if sr.ADMIN in roles:
1663+ # Admin always has rights
1664 return (self.ALL, self.ALL)
1665
1666 c = c or self.controller
1667@@ -2339,13 +2191,15 @@
1668 if page in self.unrestricted_pages:
1669 page_acl = (self.ALL, self.ALL)
1670 elif c not in self.modules or \
1671- c in self.modules and not self.modules[c].restricted:
1672+ c in self.modules and not self.modules[c].restricted or \
1673+ not self.use_cacls:
1674 # Controller is not restricted => simple authorization
1675 if self.auth.s3_logged_in():
1676 page_acl = (self.ALL, self.ALL)
1677 else:
1678 page_acl = (self.READ, self.READ)
1679 else:
1680+ # Lookup cached result
1681 page_acl = self.page_acls.get(page, None)
1682
1683 if page_acl is None:
1684@@ -2419,6 +2273,9 @@
1685 (t.require_owner_role == None)) & query
1686 else:
1687 query = (t.require_owner_role == None) & query
1688+ if self.org_roles:
1689+ # Filter out rows which should be ignored
1690+ query = (t.orgauth_disable == False) & query
1691 rows = self.db(query).select()
1692 table_acl = [(r.oacl, r.uacl) for r in rows]
1693 if table_acl:
1694@@ -2552,7 +2409,7 @@
1695 sr = self.auth.get_system_roles()
1696
1697 hidden_modules = []
1698- if self.policy in (3, 4, 5):
1699+ if self.use_cacls:
1700 restricted_modules = [m for m in self.modules
1701 if self.modules[m].restricted]
1702 roles = []
1703@@ -2616,7 +2473,7 @@
1704
1705 acl = self.page_acl(c=c, f=f)
1706 acl = (acl[0] | acl[1]) & permission
1707- if acl == permission or self.policy not in (3, 4, 5):
1708+ if acl == permission or not self.use_cacls:
1709 return URL(a=a,
1710 c=c,
1711 f=f,
1712@@ -2652,7 +2509,7 @@
1713
1714 table = self.table
1715
1716- if self.policy not in (3, 4, 5):
1717+ if not self.use_cacls:
1718 # We do not use ACLs at all
1719 return None
1720
1721@@ -2701,6 +2558,9 @@
1722 query = (table.group_id.belongs(roles)) & query
1723 else:
1724 query = (table.group_id == None) & query
1725+ if self.org_roles:
1726+ # Filter out rows which should be ignored
1727+ query = (table.orgauth_disable == False) & query
1728 table_acls = self.db(query).select(table.ALL)
1729 table_acls = [acl for acl in table_acls
1730 if (not acl.require_owner_role or \
1731@@ -2836,7 +2696,7 @@
1732 roles = []
1733 if self.session.s3 is not None:
1734 # No ownership required in policies without ACLs
1735- if self.policy not in (3, 4, 5):
1736+ if not self.use_cacls:
1737 return False
1738 roles = self.session.s3.roles or []
1739
1740@@ -4064,24 +3924,369 @@
1741 self.auth = auth
1742 self.db = auth.db
1743
1744- T = self.auth.environment.T
1745+ security_policy = auth.deployment_settings.get_security_policy()
1746+ if security_policy == 6:
1747+ self.org_roles = True
1748+ self.site_roles = False
1749+ elif security_policy == 7:
1750+ self.org_roles = True
1751+ self.site_roles = True
1752+ else:
1753+ self.org_roles = False
1754+ self.site_roles = False
1755+
1756+ # Role Templates
1757+ self.table_role_template = None
1758+ self.table_role_template_name = "auth_role_template"
1759+ # Role Set Templates
1760+ self.table_role_set_template = None
1761+ self.table_role_set_template_name = "auth_role_set_template"
1762+ # Role Sets (Instances)
1763+ self.table_role_set = None
1764+ self.table_role_set_name = "auth_role_set"
1765+ # Users assigned to Role Sets
1766+ self.table_user_role_set = None
1767+ self.table_user_role_set_name = "auth_user_role_set"
1768+
1769+ self.environment = self.auth.environment
1770+ T = self.environment.T
1771 self.site_types = Storage(cr_shelter = T("Shelter"),
1772 org_office = T("Office"),
1773- hms_hospital = T("Hospital"))
1774-
1775+ hms_hospital = T("Hospital"),
1776+ )
1777+
1778+ # Should the Role Set be created for Orgs, Sites or Both?
1779+ self.scope = Storage(ORG = 1,
1780+ SITE = 2,
1781+ BOTH = 3,
1782+ )
1783+
1784+ # -------------------------------------------------------------------------
1785+ def define_tables(self, migrate=True):
1786+
1787+ """
1788+ Create the OrgAuth tables
1789+ Invoked by AuthS3.define_tables()
1790+ """
1791+
1792+ db = self.db
1793+ auth = self.auth
1794+ settings = auth.settings
1795+ messages = auth.messages
1796+ get_migrate = auth.get_migrate
1797+
1798+ # Role Templates
1799+ if not self.table_role_template:
1800+ self.table_role_template = db.define_table(
1801+ self.table_role_template_name,
1802+ # Each role template has a unique name which becomes the suffix
1803+ # of the instances. However the records are ACLs, so there are
1804+ # multiple instances thereof
1805+ Field("name",
1806+ length=64,
1807+ notnull=True),
1808+ # The ACL for this Role Template
1809+ Field("controller", length=64),
1810+ Field("function", length=512),
1811+ Field("tablename", length=512),
1812+ Field("oacl", "integer", default=auth.permission.ALL),
1813+ # Access Suffix
1814+ Field("access_by_role"),
1815+ migrate = get_migrate(self.table_role_template_name,
1816+ migrate))
1817+
1818+ # Role Set Templates
1819+ # Each Role Set consists of a list of Access Role suffixes &
1820+ # a list of ACL Role suffixes
1821+ if not self.table_role_set_template:
1822+ self.table_role_set_template = db.define_table(
1823+ self.table_role_set_template_name,
1824+ # Each role set temaplate has a name
1825+ Field("name",
1826+ length=64,
1827+ notnull=True),
1828+ Field("access_roles",
1829+ "list:string"),
1830+ Field("acl_roles",
1831+ "list:string"),
1832+ Field("scope", "integer", default=self.scope.BOTH),
1833+ migrate = get_migrate(self.table_role_set_template_name,
1834+ migrate))
1835+
1836+ # Role Sets (Instances)
1837+ # A set of Roles which is used by an Org (&/or Facility)
1838+
1839+ role_set_widget = S3RoleSetWidget(self.environment, db=db,
1840+ settings=settings,
1841+ site_types=self.site_types,
1842+ table_name=self.table_role_set_name)
1843+ users_assigned_append = S3AppendRoleSetUsersWidget(
1844+ self.environment,
1845+ db=db)
1846+ if not self.table_role_set:
1847+ self.table_role_set = db.define_table(
1848+ self.table_role_set_name,
1849+ # Each role set has a name
1850+ Field("name",
1851+ length=64,
1852+ notnull=True,
1853+ widget=users_assigned_append.widget),
1854+ # List of roles
1855+ Field("roles",
1856+ "list:reference %s" % settings.table_group_name,
1857+ readable=False,
1858+ writable=False,
1859+ #widget=role_set_widget.widget,
1860+ ),
1861+ # Role set instances belong to organisations
1862+ Field("organisation_id",
1863+ "integer",
1864+ label=messages.label_organisation_id),
1865+ # Role set instances can belong to facilities
1866+ #Field("site_id",
1867+ # "integer",
1868+ # label=messages.label_site_id),
1869+ Field("orgs_delegated",
1870+ "list:integer",
1871+ label=messages.label_orgs_delegated,
1872+ readable=False,
1873+ writable=False,
1874+ required=False),
1875+ migrate = get_migrate(self.table_role_set_name,
1876+ migrate))
1877+ db.manager.configure(self.table_role_set,
1878+ onaccept=self.role_set_onaccept,
1879+ list_fields=["name",
1880+ "organisation_id",
1881+ "roles"])
1882+ # Role Set Assignments
1883+ # A user with a role set assigned will have all roles
1884+ # defined in the role set
1885+ if not self.table_user_role_set:
1886+ self.table_user_role_set = db.define_table(
1887+ self.table_user_role_set_name,
1888+ Field("user_id", settings.table_user),
1889+ Field("set_id", self.table_role_set),
1890+ migrate = get_migrate(self.table_user_role_set_name,
1891+ migrate))
1892+
1893+ # -------------------------------------------------------------------------
1894+ def create_role_template(self, name, *acls):
1895+ """
1896+ Back-end method to create role templates
1897+ - a Role Template is a set of ACLs
1898+
1899+ @param name: unique suffix which is applied to Role Instances
1900+ created from this template
1901+ @param acls: list of initial ACLs to assign to this role
1902+ """
1903+
1904+ table = self.table_role_template
1905+
1906+ for acl in acls:
1907+ try:
1908+ access_by_role = acl["access_by_role"]
1909+ except KeyError:
1910+ raise SyntaxError("Access Role is required!")
1911+ try:
1912+ t = acl["t"]
1913+ except KeyError:
1914+ t = None
1915+ if t is None:
1916+ try:
1917+ c = acl["c"]
1918+ except KeyError:
1919+ c = None
1920+ try:
1921+ f = acl["f"]
1922+ except KeyError:
1923+ f = None
1924+ else:
1925+ c = f = None
1926+ table.insert(name = name,
1927+ controller = c,
1928+ function = f,
1929+ tablename = t,
1930+ oacl = acl["oacl"],
1931+ access_by_role = access_by_role
1932+ )
1933+
1934+ return None
1935+
1936+ # -------------------------------------------------------------------------
1937+ def create_role_set_template(self, name, access_roles, acl_roles, **args):
1938+ """
1939+ Back-end method to create role templates
1940+ - a Role Template is a set of ACLs
1941+
1942+ @poram name: Label for this Role Set Template
1943+ @param access_roles: list of Access role suffixes
1944+ @param acl_roles: list of ACL role suffixes
1945+ @param args: list of keyword arguments
1946+ @keyword scope: the scope for the role
1947+ """
1948+
1949+ table = self.table_role_set_template
1950+
1951+ # If Scope isn't specified, assume that it applies to both Orgs & Sites
1952+ scope = args.get("scope", self.scope.BOTH)
1953+
1954+ table.insert(name = name,
1955+ access_roles = access_roles,
1956+ acl_roles = acl_roles,
1957+ scope = scope
1958+ )
1959+
1960+ return None
1961+
1962+ # -------------------------------------------------------------------------
1963+ def create_role_set(self, name, organisation_id=None, *roles):
1964+ """
1965+ Back-end method to create a new role set instance from
1966+ - a Role Set is a set of Roles
1967+
1968+ @param name: the role set name
1969+ @param roles: list of role IDs
1970+ @param organisation_id: record ID of the organisation the role set
1971+ belongs to
1972+ # @ToDo:
1973+ #@param site_id: record ID of the facility the role set belongs to
1974+ """
1975+
1976+ db = self.db
1977+ auth = self.auth
1978+ table = self.table_role_set
1979+
1980+ # Resolve role UIDs
1981+ role_ids = auth.resolve_role_ids(roles)
1982+
1983+ row = db(table.name == name).select(limitby=(0, 1)).first()
1984+ if row:
1985+ # Re-define an existing role set
1986+ if not organisation_id:
1987+ organisation_id = row.organisation_id
1988+ row.update_record(roles=role_ids,
1989+ organisation_id=organisation_id)
1990+ return row.id
1991+ else:
1992+ _id = table.insert(name=name,
1993+ roles=role_ids,
1994+ organisation_id=organisation_id)
1995+ return _id
1996+
1997+ # -------------------------------------------------------------------------
1998+ def delete_role_set(self, set_id):
1999+ """
2000+ Delete a role set
2001+
2002+ @param name: the role set name
2003+ """
2004+
2005+ db = self.db
2006+
2007+ table = self.table_user_role_set
2008+ db(table.set_id == set_id).delete()
2009+
2010+ table = self.table_role_set
2011+ db(table.id == set_id).delete()
2012+
2013+ # -------------------------------------------------------------------------
2014+ def add_role_to_set(self, set_id, *roles):
2015+ """
2016+ Add roles to a role set
2017+
2018+ @param set_id: the role set
2019+ @param roles: list of role IDs
2020+ """
2021+
2022+ db = self.db
2023+ auth = self.auth
2024+
2025+ # Resolve role UIDs
2026+ role_ids = auth.resolve_role_ids(roles)
2027+
2028+ table = self.table_role_set
2029+ role_set = db(table.id == set_id).select(table.id,
2030+ table.roles,
2031+ limitby=(0, 1)).first()
2032+ retain_roles = [role for role in role_set.roles
2033+ if role not in role_ids]
2034+ role_ids += retain_roles
2035+ role_set.update_record(roles=role_ids)
2036+
2037+ # -------------------------------------------------------------------------
2038+ def remove_role_from_set(self, set_id, *roles):
2039+ """
2040+ Remove roles from a role set
2041+
2042+ @param set_id: the role set
2043+ @param roles: list of role IDs
2044+ """
2045+
2046+ db = self.db
2047+ auth = self.auth
2048+
2049+ # Resolve role UIDs
2050+ role_ids = auth.resolve_role_ids(roles)
2051+
2052+ table = self.table_role_set
2053+ role_set = db(table.id == set_id).select(table.id,
2054+ table.roles,
2055+ limitby=(0, 1)).first()
2056+ retain_roles = [role for role in role_set.roles
2057+ if role not in role_ids]
2058+ role_set.update_record(roles=retain_roles)
2059+
2060+ # -------------------------------------------------------------------------
2061+ def assign_role_set(self, user_id, set_id):
2062+ """
2063+ Assign a role set to a user
2064+
2065+ @param user_id: the user record ID
2066+ @param set_id: the role set
2067+ """
2068+
2069+ db = self.db
2070+
2071+ table = self.table_user_role_set
2072+ query = (table.user_id == user_id) & \
2073+ (table.set_id == set_id)
2074+ row = db(query).select(limitby=(0, 1)).first()
2075+ if not row:
2076+ table.insert(set_id=set_id, user_id=user_id)
2077+ return
2078+
2079+ # -------------------------------------------------------------------------
2080+ def retract_role_set(self, user_id, set_id):
2081+ """
2082+ Retract a role set from a user
2083+
2084+ @param user_id: the user record ID
2085+ @param set_id: the role set
2086+ """
2087+
2088+ db = self.db
2089+
2090+ table = self.table_user_role_set
2091+ query = (table.user_id == user_id) & \
2092+ (table.set_id == set_id)
2093+ db(query).delete()
2094+ return
2095+
2096 # -------------------------------------------------------------------------
2097 def create_record_roles(self, tablename, record_id):
2098+ """
2099+ Create the Roles, Role Sets & ACL entries for a new Organisation or
2100+ Facility
2101+ - designed to be called onaccept
2102+ """
2103+
2104+ if not self.org_roles or not record_id:
2105+ return
2106
2107 db = self.db
2108 auth = self.auth
2109-
2110- settings = auth.deployment_settings
2111- if not settings.get_aaa_org_roles() or not record_id:
2112- return
2113- if settings.get_aaa_site_roles():
2114- site_based = True
2115- else:
2116- site_based = False
2117+ create_role = auth.s3_create_role
2118
2119 table = db[tablename]
2120 record = db(table.id == record_id).select(limitby=(0, 1)).first()
2121@@ -4093,58 +4298,103 @@
2122 organisation_id = None
2123
2124 if tablename == "org_organisation":
2125+ scope = self.scope.ORG
2126 prefix = "Org_%s" % record_id
2127 elif tablename in self.site_types:
2128- if site_based:
2129+ if self.site_roles:
2130+ scope = self.scope.SITE
2131 prefix = "Site_%s" % record_id
2132- elif organisation_id:
2133- prefix = "Org_%s_facility" % organisation_id
2134 else:
2135 return
2136 else:
2137+ # We only support Organisations & Facilities
2138 return
2139
2140- access = "%s_access" % prefix
2141- reader = "%s_reader" % prefix
2142- editor = "%s_editor" % prefix
2143-
2144+ scope = (scope, self.scope.BOTH)
2145+
2146+ # Read the list of Role Set Templates
2147+ rsttable = self.table_role_set_template
2148+ query = (rsttable.scope.belongs(scope))
2149+ role_set_templates = db(query).select()
2150+
2151+ rttable = self.table_role_template
2152+ gtable = auth.settings.table_group
2153+ ptable = auth.permission.table
2154 acl = auth.permission
2155- # @todo: read from deployment settings
2156- reader_acl = acl.READ
2157- editor_acl = acl.ALL
2158-
2159- create_role = self.auth.s3_create_role
2160- access = create_role(access, None,
2161- hidden=True, uid=access)
2162-
2163- controllers = settings.modules
2164- if isinstance(reader_acl, dict):
2165- reader_acls = [dict(c=c, uacl=acl.NONE, oacl=reader_acl[c],
2166- require_owner_role=access)
2167- for c in reader_acl]
2168- else:
2169- reader_acls = [dict(c=c, uacl=acl.NONE, oacl=reader_acl,
2170- require_owner_role=access)
2171- for c in controllers
2172- if controllers[c].get("restricted", False)]
2173- if isinstance(editor_acl, dict):
2174- editor_acls = [dict(c=c, uacl=acl.NONE, oacl=editor_acl[c],
2175- require_owner_role=access)
2176- for c in reader_acl]
2177- else:
2178- editor_acls = [dict(c=c, uacl=acl.NONE, oacl=editor_acl,
2179- require_owner_role=access)
2180- for c in controllers
2181- if controllers[c].get("restricted", False)]
2182-
2183- reader = create_role(reader, None,
2184- hidden=True, uid=reader,
2185- *reader_acls)
2186- editor = create_role(editor, None,
2187- hidden=True, uid=editor,
2188- *editor_acls)
2189-
2190- # Set access as owner role
2191+
2192+ for template in role_set_templates:
2193+ # Create the Role Set instance
2194+ role_set = self.create_role_set(name="%s_%s" % (prefix,
2195+ template.name),
2196+ organisation_id=organisation_id)
2197+
2198+ # Create the Access Roles
2199+ for role in template.access_roles:
2200+ role_name = "%s_%s" % (prefix, role)
2201+ role_id = create_role(role_name, hidden=True, uid=role_name)
2202+ # Add to the Role Set
2203+ self.add_role_to_set(role_set, role_id)
2204+
2205+ # Create the ACL Roles
2206+ for role in template.access_roles:
2207+ role_name = "%s_%s" % (prefix, role)
2208+ role_id = create_role(role_name, hidden=True, uid=role_name)
2209+ # Add to the Role Set
2210+ self.add_role_to_set(role_set, role_id)
2211+ # Create the ACL records
2212+ query = (rttable.name == role_name)
2213+ role_templates = db(query).select()
2214+ for rtemplate in role_templates:
2215+ access_role_name = "%s_%s" % (prefix,
2216+ rtemplate.access_by_role)
2217+ query = (gtable.uid == access_role_name)
2218+ access_role = db(query).select(gtable.id,
2219+ limitby=(0, 1)).first()
2220+ if access_role:
2221+ ptable.insert(group_id = role_id,
2222+ controller = rtemplate.controller,
2223+ function = rtemplate.function,
2224+ tablename = rtemplate.tablename,
2225+ uacl = acl.NONE,
2226+ oacl = rtemplate.oacl,
2227+ require_owner_role = access_role.id
2228+ )
2229+ else:
2230+ raise ValueError("Access role '%s' doesn't exist!" % access_role_name)
2231+
2232+
2233+ # @ToDo: Do we need to replace this?
2234+ # @ToDo: read from deployment settings?
2235+ #reader_acl = acl.READ
2236+ #editor_acl = acl.ALL
2237+ #controllers = auth.deployment_settings.modules
2238+ #if isinstance(reader_acl, dict):
2239+ # reader_acls = [dict(c=c, uacl=acl.NONE, oacl=reader_acl[c],
2240+ # require_owner_role=access)
2241+ # for c in reader_acl]
2242+ #else:
2243+ # reader_acls = [dict(c=c, uacl=acl.NONE, oacl=reader_acl,
2244+ # require_owner_role=access)
2245+ # for c in controllers
2246+ # if controllers[c].get("restricted", False)]
2247+
2248+ # Set the access role for this record
2249+ # @ToDo: Make this more introspective
2250+ access = None
2251+ if tablename == "org_organisation":
2252+ # Org Access (this record)
2253+ access = record.id
2254+ elif tablename == "org_office" and record.type == 5:
2255+ # Logs Access
2256+ role_name = "Org_%s_Logs_Access" % organisation_id
2257+ else:
2258+ # Org Access
2259+ role_name = "Org_%s_Access" % organisation_id
2260+
2261+ if not access:
2262+ query = (gtable.uid == role_name)
2263+ access = db(query).select(gtable.id,
2264+ limitby=(0, 1)).first().id
2265 record.update_record(owned_by_role=access)
2266
2267 # -------------------------------------------------------------------------
2268@@ -4154,15 +4404,9 @@
2269 auth = self.auth
2270 delete_role = auth.s3_delete_role
2271
2272- settings = auth.deployment_settings
2273- if settings.get_aaa_site_roles():
2274- site_based = True
2275- else:
2276- site_based = False
2277-
2278 if tablename == "org_organisation":
2279 prefix = "Org_%s" % record_id
2280- elif site_based and \
2281+ elif self.site_roles and \
2282 tablename in self.site_types:
2283 prefix = "Site_%s" % record_id
2284 else:
2285@@ -4376,17 +4620,19 @@
2286
2287 set_id = form.vars.id
2288 users_assigned = request.vars.users_assigned
2289- if users_assigned:
2290+ if isinstance(users_assigned, (str)):
2291+ users_assigned = [users_assigned]
2292+ if isinstance(users_assigned, (list)):
2293 users_assigned = [int(x) for x in users_assigned]
2294- table = auth.table_user_role_set
2295+ table = self.table_user_role_set
2296 query = (table.set_id == set_id)
2297 users_existing = [x.user_id for x in db(query).select()]
2298 users_retracted = list(set(users_existing).difference(set(users_assigned)))
2299
2300 for user_id in users_assigned:
2301- auth.s3_assign_role_set(user_id, set_id)
2302+ self.assign_role_set(user_id, set_id)
2303
2304 for user_id in users_retracted:
2305- auth.s3_retract_role_set(user_id, set_id)
2306+ self.retract_role_set(user_id, set_id)
2307
2308 # =============================================================================
2309
2310=== modified file 'modules/s3/s3cfg.py'
2311--- modules/s3/s3cfg.py 2011-06-24 12:09:00 +0000
2312+++ modules/s3/s3cfg.py 2011-06-27 17:56:49 +0000
2313@@ -148,9 +148,6 @@
2314 return self.fin.get("currency_default", 1) # Dollars
2315
2316 # GIS (Map) Settings
2317- # Which countries the deployment covers (used in GIS Location Selector)
2318- def get_gis_countries(self):
2319- return self.gis.get("countries", None)
2320 # No defaults are needed for gis_config deployment settings -- initial
2321 # defaults come either from the table itself or are added to the site
2322 # config when it is created. This does not include defaults for the
2323@@ -268,6 +265,7 @@
2324 def get_security_audit_write(self):
2325 return self.security.get("audit_write", False)
2326 def get_security_policy(self):
2327+ " Default is Simple Security Policy "
2328 return self.security.get("policy", 1)
2329 def get_security_map(self):
2330 return self.security.get("map", False)
2331@@ -275,17 +273,12 @@
2332 return self.security.get("self_registration", True)
2333
2334 # AAA Settings
2335- # @ToDo: OrgAuth settings
2336 def get_aaa_default_uacl(self):
2337 return self.aaa.get("default_uacl", self.aaa.acl.READ)
2338 def get_aaa_default_oacl(self):
2339 return self.aaa.get("default_oacl", self.aaa.acl.CREATE |
2340 self.aaa.acl.READ |
2341 self.aaa.acl.UPDATE)
2342- def get_aaa_org_roles(self):
2343- return self.aaa.get("org_roles", {})
2344- def get_aaa_site_roles(self):
2345- return self.aaa.get("site_roles", {})
2346
2347 # Options
2348 def get_options_support_requests(self):
2349
2350=== modified file 'modules/s3/s3gis.py'
2351--- modules/s3/s3gis.py 2011-06-24 12:09:00 +0000
2352+++ modules/s3/s3gis.py 2011-06-27 17:56:49 +0000
2353@@ -1364,66 +1364,63 @@
2354 return None
2355
2356 # -------------------------------------------------------------------------
2357- def get_site_countries(self, key_type="id"):
2358- """
2359- Returns country code or L0 location id versus name for the site's countries.
2360-
2361- If key_type is "code", these are returned as an OrderedDict with
2362- country code as the key. If key_type is "id", then the location id
2363- is the key. In all cases, the value is the name.
2364-
2365- If the site only uses a subset of all countries, a list of their
2366- codes can be set in deployment_settings.gis.countries in 000_config.
2367- If this exists, only those countries are included.
2368- """
2369-
2370- # Do we have a cached copy of the site's countries?
2371- if not self.site_countries:
2372-
2373- # Does the site use a restricted set of countries?
2374- # @ToDo: Is this the only use of codes besides the fields in
2375- # pr_person and org_organization (which may go away)?
2376- codes = self.deployment_settings.get_gis_countries()
2377- if not codes:
2378- return self.get_countries(key_type)
2379-
2380- # If we have a full cached set, extract the site's countries.
2381- if self.countries:
2382- site_countries = filter(lambda c: c.code in codes, self.countries)
2383-
2384- else:
2385- db = self.db
2386- _location = "gis_location" in db and db.gis_location
2387- if not _location:
2388- return None # In case this is called before gis_location is in db.
2389-
2390- query = (_location.level == "L0") & (_location.code.belongs(codes))
2391- site_countries = db(query).select(_location.id,
2392- _location.code,
2393- _location.name,
2394- orderby=_location.name)
2395-
2396- if not site_countries:
2397- return [] # Return something that len() works on.
2398-
2399- # Use of OrderedDict avoids a sort for those widget options or other
2400- # lists that do not sort by default.
2401- site_countries_by_id = OrderedDict()
2402- site_countries_by_code = OrderedDict()
2403- for row in site_countries:
2404- site_countries_by_id[row.id] = row.name
2405- site_countries_by_code[row.code] = row.name
2406-
2407- # Don't expose these while they're being built. Set countries last
2408- # so it can be used to tell when all exist.
2409- self.site_countries_by_id = site_countries_by_id
2410- self.site_countries_by_code = site_countries_by_code
2411- self.site_countries = site_countries
2412-
2413- if key_type == "id":
2414- return self.site_countries_by_id
2415+ def get_parent_country(self, location, key_type="id"):
2416+ """
2417+ Returns the parent country for a given record
2418+
2419+ @param: location_id: the location or id to search for
2420+ @param: key_type: whether to return an id or code
2421+ """
2422+
2423+ db = self.db
2424+ cache = self.cache
2425+ table = db.gis_location
2426+
2427+ try:
2428+ # location is passed as integer (location_id)
2429+ query = (table.id == location)
2430+ location = db(query).select(table.id,
2431+ table.path,
2432+ table.code,
2433+ table.level,
2434+ limitby=(0, 1),
2435+ cache=cache).first()
2436+ except:
2437+ # location is passed as record
2438+ pass
2439+
2440+ if location.level == "L0":
2441+ if key_type == "id":
2442+ return location.id
2443+ elif key_type == "code":
2444+ return location.code
2445 else:
2446- return self.site_countries_by_code
2447+ parents = self.get_parents(location.id, feature=location)
2448+ if parents:
2449+ for row in parents:
2450+ if row.level == "L0":
2451+ if key_type == "id":
2452+ return row.id
2453+ elif key_type == "code":
2454+ return row.code
2455+
2456+ return None
2457+
2458+
2459+ # -------------------------------------------------------------------------
2460+ def get_default_country(self, key_type="id"):
2461+ """
2462+ Returns the default country for the active gis_config
2463+
2464+ @param: key_type: whether to return an id or code
2465+ """
2466+
2467+ config = self.get_config()
2468+
2469+ if config.default_location_id:
2470+ return self.get_parent_country(config.default_location_id)
2471+
2472+ return None
2473
2474 # -------------------------------------------------------------------------
2475 def get_representation(self,
2476@@ -3562,19 +3559,18 @@
2477 #
2478 _features = ""
2479 if features:
2480- _features = """
2481-S3.gis.features = new Array();"""
2482+ _features = "S3.gis.features = new Array();\n"
2483 counter = -1
2484 for feature in features:
2485 counter = counter + 1
2486- # Generate JS snippet to pass to static
2487- _features += """
2488-S3.gis.features[%i] = {
2489+ if feature["lat"] and feature["lon"]:
2490+ # Generate JS snippet to pass to static
2491+ _features += """S3.gis.features[%i] = {
2492 lat: %f,
2493 lon: %f
2494-}""" % (counter,
2495- feature["lat"] or 0,
2496- feature["lon"] or 0)
2497+}\n""" % (counter,
2498+ feature["lat"],
2499+ feature["lon"])
2500
2501 # ---------------------------------------------------------------------
2502 # Feature Queries
2503
2504=== modified file 'modules/s3/s3widgets.py'
2505--- modules/s3/s3widgets.py 2011-06-24 13:40:22 +0000
2506+++ modules/s3/s3widgets.py 2011-06-27 17:56:49 +0000
2507@@ -49,7 +49,7 @@
2508 "CheckboxesWidgetS3",
2509 "S3AddPersonWidget",
2510 "S3RoleSetWidget",
2511- "S3RoleSetUsersWidget",
2512+ "S3AppendRoleSetUsersWidget",
2513 "S3QuestionTypeTextWidget",
2514 ]
2515
2516@@ -250,7 +250,7 @@
2517 """
2518
2519 def __init__(self,
2520- request,
2521+ environment,
2522 prefix,
2523 resourcename,
2524 fieldname="name",
2525@@ -258,7 +258,9 @@
2526 delay = 450, # milliseconds
2527 min_length = 2): # Increase this for large deployments
2528
2529- self.request = request
2530+ self.environment = Storage(environment)
2531+ self.request = self.environment.request
2532+ self.response = self.environment.response
2533 self.prefix = prefix
2534 self.resourcename = resourcename
2535 self.fieldname = fieldname
2536@@ -266,9 +268,10 @@
2537 self.delay = delay
2538 self.min_length = min_length
2539
2540- def __call__(self ,field, value, **attributes):
2541+ def __call__(self, field, value, **attributes):
2542
2543 request = self.request
2544+ response = self.response
2545
2546 default = dict(
2547 _type = "text",
2548@@ -287,75 +290,66 @@
2549 vars={"filter":"~",
2550 "field":fieldname})
2551
2552- js_autocomplete = """
2553- (function() {
2554- $(document).ready(function() {
2555- var data = { val:$('#%s').val(), accept:false };
2556-
2557- $('#%s').autocomplete({
2558- source: '%s',
2559- delay: %d,
2560- minLength: %d,
2561- search: function(event, ui) {
2562- $( '#%s_throbber' ).removeClass('hidden').show();
2563- return true;
2564- },
2565- response: function(event, ui, content) {
2566- $( '#%s_throbber' ).hide();
2567- return content;
2568- },
2569- focus: function( event, ui ) {
2570- $( '#%s' ).val( ui.item.%s );
2571- return false;
2572- },
2573- select: function( event, ui ) {
2574- $( '#%s' ).val( ui.item.%s );
2575- $( '#%s' ).val( ui.item.id );
2576- """ % (dummy_input,
2577- dummy_input,
2578- url,
2579- self.delay,
2580- self.min_length,
2581- dummy_input,
2582- dummy_input,
2583- dummy_input,
2584- fieldname,
2585- dummy_input,
2586- fieldname,
2587- real_input) + self.post_process + """
2588- data.accept = true;
2589- return false;
2590- }
2591- })
2592- .data( 'autocomplete' )._renderItem = function( ul, item ) {
2593- return $( '<li></li>' )
2594- .data( 'item.autocomplete', item )
2595- .append( '<a>' + item.%s + '</a>' )
2596- .appendTo( ul );
2597- };
2598-
2599- $('#%s').blur(function() {
2600- if (!$('#%s').val()) {
2601- $('#%s').val('');
2602- data.accept = true;
2603- }
2604-
2605- if (!data.accept) {
2606- $('#%s').val(data.val);
2607- } else {
2608- data.val = $('#%s').val();
2609- }
2610-
2611- data.accept = false;
2612- });
2613- });
2614- })();
2615- """ % (fieldname,
2616- dummy_input,
2617- dummy_input,
2618- real_input,
2619- dummy_input,
2620- dummy_input)
2621+ js_autocomplete = "".join(("""
2622+var data = { val:$('#%s').val(), accept:false };
2623+$('#%s').autocomplete({
2624+ source: '%s',
2625+ delay: %d,
2626+ minLength: %d,
2627+ search: function(event, ui) {
2628+ $( '#%s_throbber' ).removeClass('hidden').show();
2629+ return true;
2630+ },
2631+ response: function(event, ui, content) {
2632+ $( '#%s_throbber' ).hide();
2633+ return content;
2634+ },
2635+ focus: function( event, ui ) {
2636+ $( '#%s' ).val( ui.item.%s );
2637+ return false;
2638+ },
2639+ select: function( event, ui ) {
2640+ $( '#%s' ).val( ui.item.%s );
2641+ $( '#%s' ).val( ui.item.id );
2642+ """ % (dummy_input,
2643+ dummy_input,
2644+ url,
2645+ self.delay,
2646+ self.min_length,
2647+ dummy_input,
2648+ dummy_input,
2649+ dummy_input,
2650+ fieldname,
2651+ dummy_input,
2652+ fieldname,
2653+ real_input), self.post_process, """
2654+ data.accept = true;
2655+ return false;
2656+ }
2657+})
2658+.data( 'autocomplete' )._renderItem = function( ul, item ) {
2659+ return $( '<li></li>' )
2660+ .data( 'item.autocomplete', item )
2661+ .append( '<a>' + item.%s + '</a>' )
2662+ .appendTo( ul );
2663+};
2664+$('#%s').blur(function() {
2665+ if (!$('#%s').val()) {
2666+ $('#%s').val('');
2667+ data.accept = true;
2668+ }
2669+ if (!data.accept) {
2670+ $('#%s').val(data.val);
2671+ } else {
2672+ data.val = $('#%s').val();
2673+ }
2674+ data.accept = false;
2675+});""" % (fieldname,
2676+ dummy_input,
2677+ dummy_input,
2678+ real_input,
2679+ dummy_input,
2680+ dummy_input)))
2681
2682 if value:
2683 text = str(field.represent(default["value"]))
2684@@ -374,6 +368,7 @@
2685 else:
2686 represent = ""
2687
2688+ response.s3.jquery_ready.append(js_autocomplete)
2689 return TAG[""](
2690 INPUT(_id=dummy_input,
2691 _class="string",
2692@@ -384,7 +379,6 @@
2693 _id="%s_throbber" % dummy_input,
2694 _class="throbber hidden"),
2695 INPUT(**attr),
2696- SCRIPT(js_autocomplete),
2697 requires = field.requires
2698 )
2699
2700@@ -411,7 +405,7 @@
2701 """
2702
2703 def __init__(self,
2704- request,
2705+ environment,
2706 deployment_settings,
2707 prefix="gis",
2708 resourcename="location",
2709@@ -421,7 +415,9 @@
2710 delay = 450, # milliseconds
2711 min_length = 2): # Increase this for large deployments
2712
2713- self.request = request
2714+ self.environment = Storage(environment)
2715+ self.request = self.environment.request
2716+ self.response = self.environment.response
2717 self.deployment_settings = deployment_settings
2718 self.prefix = prefix
2719 self.resourcename = resourcename
2720@@ -431,9 +427,10 @@
2721 self.delay = delay
2722 self.min_length = min_length
2723
2724- def __call__(self ,field, value, **attributes):
2725+ def __call__(self, field, value, **attributes):
2726
2727 request = self.request
2728+ response = self.response
2729
2730 default = dict(
2731 _type = "text",
2732@@ -494,69 +491,60 @@
2733 # @ToDo: Refreshes all dropdowns as-necessary
2734 post_process = ""
2735
2736- js_autocomplete = """
2737- (function() {
2738- $(document).ready(function() {
2739- var data = { val:$('#%s').val(), accept:false };
2740-
2741- $('#%s').autocomplete({
2742- source: '%s',
2743- delay: %d,
2744- minLength: %d,
2745- search: function(event, ui) {
2746- $( '#%s_throbber' ).removeClass('hidden').show();
2747- return true;
2748- },
2749- response: function(event, ui, content) {
2750- $( '#%s_throbber' ).hide();
2751- return content;
2752- },
2753- focus: function( event, ui ) {
2754- $( '#%s' ).val( ui.item.name );
2755- return false;
2756- },
2757- select: function( event, ui ) {
2758- $( '#%s' ).val( ui.item.name );
2759- $( '#%s' ).val( ui.item.id );
2760- """ % (dummy_input,
2761- dummy_input,
2762- url,
2763- self.delay,
2764- self.min_length,
2765- dummy_input,
2766- dummy_input,
2767- dummy_input,
2768- dummy_input,
2769- real_input) + post_process + """
2770- data.accept = true;
2771- return false;
2772- }
2773- })
2774- .data( 'autocomplete' )._renderItem = function( ul, item ) {
2775- // @ToDo: .represent for returned data
2776- return $( '<li></li>' )
2777- .data( 'item.autocomplete', item )
2778- .append( '<a>' + item.name + '</a>' )
2779- .appendTo( ul );
2780- };
2781-
2782- $('#%s').blur(function() {
2783- if (!$('#%s').val()) {
2784- $('#%s').val('');
2785- data.accept = true;
2786- }
2787-
2788- if (!data.accept) {
2789- $('#%s').val(data.val);
2790- } else {
2791- data.val = $('#%s').val();
2792- }
2793-
2794- data.accept = false;
2795- });
2796- });
2797- })();
2798- """ % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)
2799+ js_autocomplete = "".join(("""
2800+var data = { val:$('#%s').val(), accept:false };
2801+$('#%s').autocomplete({
2802+ source: '%s',
2803+ delay: %d,
2804+ minLength: %d,
2805+ search: function(event, ui) {
2806+ $( '#%s_throbber' ).removeClass('hidden').show();
2807+ return true;
2808+ },
2809+ response: function(event, ui, content) {
2810+ $( '#%s_throbber' ).hide();
2811+ return content;
2812+ },
2813+ focus: function( event, ui ) {
2814+ $( '#%s' ).val( ui.item.name );
2815+ return false;
2816+ },
2817+ select: function( event, ui ) {
2818+ $( '#%s' ).val( ui.item.name );
2819+ $( '#%s' ).val( ui.item.id );
2820+ """ % (dummy_input,
2821+ dummy_input,
2822+ url,
2823+ self.delay,
2824+ self.min_length,
2825+ dummy_input,
2826+ dummy_input,
2827+ dummy_input,
2828+ dummy_input,
2829+ real_input), post_process, """
2830+ data.accept = true;
2831+ return false;
2832+ }
2833+})
2834+.data( 'autocomplete' )._renderItem = function( ul, item ) {
2835+ // @ToDo: .represent for returned data
2836+ return $( '<li></li>' )
2837+ .data( 'item.autocomplete', item )
2838+ .append( '<a>' + item.name + '</a>' )
2839+ .appendTo( ul );
2840+};
2841+$('#%s').blur(function() {
2842+ if (!$('#%s').val()) {
2843+ $('#%s').val('');
2844+ data.accept = true;
2845+ }
2846+ if (!data.accept) {
2847+ $('#%s').val(data.val);
2848+ } else {
2849+ data.val = $('#%s').val();
2850+ }
2851+ data.accept = false;
2852+});""" % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)))
2853
2854 if value:
2855 text = str(field.represent(default["value"]))
2856@@ -575,6 +563,7 @@
2857 else:
2858 represent = ""
2859
2860+ response.s3.jquery_ready.append(js_autocomplete)
2861 return TAG[""](
2862 INPUT(_id=dummy_input,
2863 _class="string",
2864@@ -585,7 +574,6 @@
2865 _id="%s_throbber" % dummy_input,
2866 _class="throbber hidden"),
2867 INPUT(**attr),
2868- SCRIPT(js_autocomplete),
2869 requires = field.requires
2870 )
2871
2872@@ -603,23 +591,25 @@
2873 """
2874
2875 def __init__(self,
2876- request,
2877- session,
2878+ environment,
2879 post_process = "",
2880 delay = 450, # milliseconds
2881 default_from_profile = False,
2882 min_length = 2): # Increase this for large deployments
2883
2884- self.request = request
2885- self.session = session
2886+ self.environment = Storage(environment)
2887+ self.request = self.environment.request
2888+ self.response = self.environment.response
2889+ self.session = self.environment.session
2890 self.post_process = post_process
2891 self.delay = delay
2892 self.min_length = min_length
2893 self.default_from_profile = default_from_profile
2894
2895- def __call__(self ,field, value, **attributes):
2896+ def __call__(self, field, value, **attributes):
2897
2898 request = self.request
2899+ response = self.response
2900
2901 if not value and self.default_from_profile:
2902 session = self.session
2903@@ -641,91 +631,82 @@
2904 args="search.json",
2905 vars={"filter":"~"})
2906
2907- js_autocomplete = """
2908- (function() {
2909- $(document).ready(function() {
2910- var data = { val:$('#%s').val(), accept:false };
2911-
2912- $('#%s').autocomplete({
2913- source: '%s',
2914- delay: %d,
2915- minLength: %d,
2916- search: function(event, ui) {
2917- $( '#%s_throbber' ).removeClass('hidden').show();
2918- return true;
2919- },
2920- response: function(event, ui, content) {
2921- $( '#%s_throbber' ).hide();
2922- return content;
2923- },
2924- focus: function( event, ui ) {
2925- var name = '';
2926- if (ui.item.name != null) {
2927- name += ui.item.name;
2928- }
2929- if (ui.item.acronym != '') {
2930- name += ' (' + ui.item.acronym + ')';
2931- }
2932- $( '#%s' ).val( name );
2933- return false;
2934- },
2935- select: function( event, ui ) {
2936- var name = '';
2937- if (ui.item.name != null) {
2938- name += ui.item.name;
2939- }
2940- if (ui.item.acronym != '') {
2941- name += ' (' + ui.item.acronym + ')';
2942- }
2943- $( '#%s' ).val( name );
2944- $( '#%s' ).val( ui.item.id )
2945- .change();
2946- """ % (dummy_input,
2947- dummy_input,
2948- url,
2949- self.delay,
2950- self.min_length,
2951- dummy_input,
2952- dummy_input,
2953- dummy_input,
2954- dummy_input,
2955- real_input) + self.post_process + """
2956- data.accept = true;
2957- return false;
2958- }
2959- })
2960- .data( 'autocomplete' )._renderItem = function( ul, item ) {
2961- var name = '';
2962- if (item.name != null) {
2963- name += item.name;
2964- }
2965- if (item.acronym != '') {
2966- name += ' (' + item.acronym + ')';
2967- }
2968- return $( '<li></li>' )
2969- .data( 'item.autocomplete', item )
2970- .append( '<a>' + name + '</a>' )
2971- .appendTo( ul );
2972- };
2973-
2974- $('#%s').blur(function() {
2975- if (!$('#%s').val()) {
2976- $('#%s').val('')
2977- .change();
2978- data.accept = true;
2979- }
2980-
2981- if (!data.accept) {
2982- $('#%s').val(data.val);
2983- } else {
2984- data.val = $('#%s').val();
2985- }
2986-
2987- data.accept = false;
2988- });
2989- });
2990- })();
2991- """ % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)
2992+ js_autocomplete = "".join(("""
2993+var data = { val:$('#%s').val(), accept:false };
2994+$('#%s').autocomplete({
2995+ source: '%s',
2996+ delay: %d,
2997+ minLength: %d,
2998+ search: function(event, ui) {
2999+ $( '#%s_throbber' ).removeClass('hidden').show();
3000+ return true;
3001+ },
3002+ response: function(event, ui, content) {
3003+ $( '#%s_throbber' ).hide();
3004+ return content;
3005+ },
3006+ focus: function( event, ui ) {
3007+ var name = '';
3008+ if (ui.item.name != null) {
3009+ name += ui.item.name;
3010+ }
3011+ if (ui.item.acronym != '') {
3012+ name += ' (' + ui.item.acronym + ')';
3013+ }
3014+ $( '#%s' ).val( name );
3015+ return false;
3016+ },
3017+ select: function( event, ui ) {
3018+ var name = '';
3019+ if (ui.item.name != null) {
3020+ name += ui.item.name;
3021+ }
3022+ if (ui.item.acronym != '') {
3023+ name += ' (' + ui.item.acronym + ')';
3024+ }
3025+ $( '#%s' ).val( name );
3026+ $( '#%s' ).val( ui.item.id )
3027+ .change();
3028+ """ % (dummy_input,
3029+ dummy_input,
3030+ url,
3031+ self.delay,
3032+ self.min_length,
3033+ dummy_input,
3034+ dummy_input,
3035+ dummy_input,
3036+ dummy_input,
3037+ real_input), self.post_process, """
3038+ data.accept = true;
3039+ return false;
3040+ }
3041+})
3042+.data( 'autocomplete' )._renderItem = function( ul, item ) {
3043+ var name = '';
3044+ if (item.name != null) {
3045+ name += item.name;
3046+ }
3047+ if (item.acronym != '') {
3048+ name += ' (' + item.acronym + ')';
3049+ }
3050+ return $( '<li></li>' )
3051+ .data( 'item.autocomplete', item )
3052+ .append( '<a>' + name + '</a>' )
3053+ .appendTo( ul );
3054+};
3055+$('#%s').blur(function() {
3056+ if (!$('#%s').val()) {
3057+ $('#%s').val('')
3058+ .change();
3059+ data.accept = true;
3060+ }
3061+ if (!data.accept) {
3062+ $('#%s').val(data.val);
3063+ } else {
3064+ data.val = $('#%s').val();
3065+ }
3066+ data.accept = false;
3067+});""" % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)))
3068
3069 if value:
3070 # Provide the representation for the current/default Value
3071@@ -745,6 +726,7 @@
3072 else:
3073 represent = ""
3074
3075+ response.s3.jquery_ready.append(js_autocomplete)
3076 return TAG[""](
3077 INPUT(_id=dummy_input,
3078 _class="string",
3079@@ -755,7 +737,6 @@
3080 _id="%s_throbber" % dummy_input,
3081 _class="throbber hidden"),
3082 INPUT(**attr),
3083- SCRIPT(js_autocomplete),
3084 requires = field.requires
3085 )
3086
3087@@ -771,19 +752,22 @@
3088 """
3089
3090 def __init__(self,
3091- request,
3092+ environment,
3093 post_process = "",
3094 delay = 450, # milliseconds
3095 min_length=2): # Increase this for large deployments
3096
3097- self.request = request
3098+ self.environment = Storage(environment)
3099+ self.request = self.environment.request
3100+ self.response = self.environment.response
3101 self.post_process = post_process
3102 self.delay = delay
3103 self.min_length = min_length
3104
3105- def __call__(self ,field, value, **attributes):
3106+ def __call__(self, field, value, **attributes):
3107
3108 request = self.request
3109+ response = self.response
3110
3111 default = dict(
3112 _type = "text",
3113@@ -800,100 +784,91 @@
3114 args="search.json",
3115 vars={"filter":"~"})
3116
3117- js_autocomplete = """
3118- (function() {
3119- $(document).ready(function() {
3120- var data = { val:$('#%s').val(), accept:false };
3121-
3122- $('#%s').autocomplete({
3123- source: '%s',
3124- delay: %d,
3125- minLength: %d,
3126- search: function(event, ui) {
3127- $( '#%s_throbber' ).removeClass('hidden').show();
3128- return true;
3129- },
3130- response: function(event, ui, content) {
3131- $( '#%s_throbber' ).hide();
3132- return content;
3133- },
3134- focus: function( event, ui ) {
3135- var name = '';
3136- if (ui.item.first_name != null) {
3137- name += ui.item.first_name;
3138- }
3139- if (ui.item.middle_name != null) {
3140- name += ' ' + ui.item.middle_name;
3141- }
3142- if (ui.item.last_name != null) {
3143- name += ' ' + ui.item.last_name;
3144- }
3145- $( '#%s' ).val( name );
3146- return false;
3147- },
3148- select: function( event, ui ) {
3149- var name = '';
3150- if (ui.item.first_name != null) {
3151- name += ui.item.first_name;
3152- }
3153- if (ui.item.middle_name != null) {
3154- name += ' ' + ui.item.middle_name;
3155- }
3156- if (ui.item.last_name != null) {
3157- name += ' ' + ui.item.last_name;
3158- }
3159- $( '#%s' ).val( name );
3160- $( '#%s' ).val( ui.item.id )
3161- .change();
3162- """ % (dummy_input,
3163- dummy_input,
3164- url,
3165- self.delay,
3166- self.min_length,
3167- dummy_input,
3168- dummy_input,
3169- dummy_input,
3170- dummy_input,
3171- real_input) + self.post_process + """
3172- data.accept = true;
3173- return false;
3174- }
3175- })
3176- .data( 'autocomplete' )._renderItem = function( ul, item ) {
3177- var name = '';
3178- if (item.first_name != null) {
3179- name += item.first_name;
3180- }
3181- if (item.middle_name != null) {
3182- name += ' ' + item.middle_name;
3183- }
3184- if (item.last_name != null) {
3185- name += ' ' + item.last_name;
3186- }
3187- return $( '<li></li>' )
3188- .data( 'item.autocomplete', item )
3189- .append( '<a>' + name + '</a>' )
3190- .appendTo( ul );
3191- };
3192-
3193- $('#%s').blur(function() {
3194- if (!$('#%s').val()) {
3195- $('#%s').val('')
3196- .change();
3197- data.accept = true;
3198- }
3199-
3200- if (!data.accept) {
3201- $('#%s').val(data.val);
3202- } else {
3203- data.val = $('#%s').val();
3204- }
3205-
3206- data.accept = false;
3207- });
3208- });
3209- })();
3210- """ % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)
3211+ js_autocomplete = "".join(("""
3212+var data = { val:$('#%s').val(), accept:false };
3213+$('#%s').autocomplete({
3214+ source: '%s',
3215+ delay: %d,
3216+ minLength: %d,
3217+ search: function(event, ui) {
3218+ $( '#%s_throbber' ).removeClass('hidden').show();
3219+ return true;
3220+ },
3221+ response: function(event, ui, content) {
3222+ $( '#%s_throbber' ).hide();
3223+ return content;
3224+ },
3225+ focus: function( event, ui ) {
3226+ var name = '';
3227+ if (ui.item.first_name != null) {
3228+ name += ui.item.first_name;
3229+ }
3230+ if (ui.item.middle_name != null) {
3231+ name += ' ' + ui.item.middle_name;
3232+ }
3233+ if (ui.item.last_name != null) {
3234+ name += ' ' + ui.item.last_name;
3235+ }
3236+ $( '#%s' ).val( name );
3237+ return false;
3238+ },
3239+ select: function( event, ui ) {
3240+ var name = '';
3241+ if (ui.item.first_name != null) {
3242+ name += ui.item.first_name;
3243+ }
3244+ if (ui.item.middle_name != null) {
3245+ name += ' ' + ui.item.middle_name;
3246+ }
3247+ if (ui.item.last_name != null) {
3248+ name += ' ' + ui.item.last_name;
3249+ }
3250+ $( '#%s' ).val( name );
3251+ $( '#%s' ).val( ui.item.id )
3252+ .change();
3253+ """ % (dummy_input,
3254+ dummy_input,
3255+ url,
3256+ self.delay,
3257+ self.min_length,
3258+ dummy_input,
3259+ dummy_input,
3260+ dummy_input,
3261+ dummy_input,
3262+ real_input), self.post_process, """
3263+ data.accept = true;
3264+ return false;
3265+ }
3266+})
3267+.data( 'autocomplete' )._renderItem = function( ul, item ) {
3268+ var name = '';
3269+ if (item.first_name != null) {
3270+ name += item.first_name;
3271+ }
3272+ if (item.middle_name != null) {
3273+ name += ' ' + item.middle_name;
3274+ }
3275+ if (item.last_name != null) {
3276+ name += ' ' + item.last_name;
3277+ }
3278+ return $( '<li></li>' )
3279+ .data( 'item.autocomplete', item )
3280+ .append( '<a>' + name + '</a>' )
3281+ .appendTo( ul );
3282+};
3283+$('#%s').blur(function() {
3284+ if (!$('#%s').val()) {
3285+ $('#%s').val('')
3286+ .change();
3287+ data.accept = true;
3288+ }
3289+ if (!data.accept) {
3290+ $('#%s').val(data.val);
3291+ } else {
3292+ data.val = $('#%s').val();
3293+ }
3294+ data.accept = false;
3295+});""" % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)))
3296
3297 if value:
3298 # Provide the representation for the current/default Value
3299@@ -913,6 +888,7 @@
3300 else:
3301 represent = ""
3302
3303+ response.s3.jquery_ready.append(js_autocomplete)
3304 return TAG[""](
3305 INPUT(_id=dummy_input,
3306 _class="string",
3307@@ -923,7 +899,6 @@
3308 _id="%s_throbber" % dummy_input,
3309 _class="throbber hidden"),
3310 INPUT(**attr),
3311- SCRIPT(js_autocomplete),
3312 requires = field.requires
3313 )
3314
3315@@ -940,21 +915,24 @@
3316 """
3317
3318 def __init__(self,
3319- request,
3320+ environment,
3321 auth, # Auth is needed to be able to do the lookup of site_types
3322 post_process = "",
3323 delay = 450, # milliseconds
3324 min_length = 2):
3325
3326- self.request = request
3327+ self.environment = Storage(environment)
3328+ self.request = self.environment.request
3329+ self.response = self.environment.response
3330 self.auth = auth
3331 self.post_process = post_process
3332 self.delay = delay
3333 self.min_length = min_length
3334
3335- def __call__(self ,field, value, **attributes):
3336+ def __call__(self, field, value, **attributes):
3337
3338 request = self.request
3339+ response = self.response
3340 auth = self.auth
3341
3342 default = dict(
3343@@ -984,96 +962,87 @@
3344 """ % (instance_type,
3345 auth.org_site_types[instance_type])
3346
3347- js_autocomplete = """
3348- (function() {
3349- function s3_site_lookup(instance_type) {
3350- switch (instance_type) {
3351- %s
3352- }
3353- }""" % cases + """
3354- $(document).ready(function() {
3355- var data = { val:$('#%s').val(), accept:false };
3356-
3357- $('#%s').autocomplete({
3358- source: '%s',
3359- delay: %d,
3360- minLength: %d,
3361- search: function(event, ui) {
3362- $( '#%s_throbber' ).removeClass('hidden').show();
3363- return true;
3364- },
3365- response: function(event, ui, content) {
3366- $( '#%s_throbber' ).hide();
3367- return content;
3368- },
3369- focus: function( event, ui ) {
3370- var name = '';
3371- if (ui.item.name != null) {
3372- name += ui.item.name;
3373- }
3374- if (ui.item.instance_type != '') {
3375- name += ' (' + s3_site_lookup(ui.item.instance_type) + ')';
3376- }
3377- $( '#%s' ).val( name );
3378- return false;
3379- },
3380- select: function( event, ui ) {
3381- var name = '';
3382- if (ui.item.name != null) {
3383- name += ui.item.name;
3384- }
3385- if (ui.item.instance_type != '') {
3386- name += ' (' + s3_site_lookup(ui.item.instance_type) + ')';
3387- }
3388- $( '#%s' ).val( name );
3389- $( '#%s' ).val( ui.item.site_id )
3390- .change();
3391- """ % (dummy_input,
3392- dummy_input,
3393- url,
3394- self.delay,
3395- self.min_length,
3396- dummy_input,
3397- dummy_input,
3398- dummy_input,
3399- dummy_input,
3400- real_input) + self.post_process + """
3401- data.accept = true;
3402- return false;
3403- }
3404- })
3405- .data( 'autocomplete' )._renderItem = function( ul, item ) {
3406- var name = '';
3407- if (item.name != null) {
3408- name += item.name;
3409- }
3410- if (item.instance_type != '') {
3411- name += ' (' + s3_site_lookup(item.instance_type) + ')';
3412- }
3413- return $( '<li></li>' )
3414- .data( 'item.autocomplete', item )
3415- .append( '<a>' + name + '</a>' )
3416- .appendTo( ul );
3417- };
3418-
3419- $('#%s').blur(function() {
3420- if (!$('#%s').val()) {
3421- $('#%s').val('')
3422- .change();
3423- data.accept = true;
3424- }
3425-
3426- if (!data.accept) {
3427- $('#%s').val(data.val);
3428- } else {
3429- data.val = $('#%s').val();
3430- }
3431-
3432- data.accept = false;
3433- });
3434- });
3435- })();
3436- """ % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)
3437+ js_autocomplete = "".join(("""
3438+function s3_site_lookup(instance_type) {
3439+ switch (instance_type) {
3440+ %s
3441+ }
3442+}""" % cases, """
3443+var data = { val:$('#%s').val(), accept:false };
3444+$('#%s').autocomplete({
3445+ source: '%s',
3446+ delay: %d,
3447+ minLength: %d,
3448+ search: function(event, ui) {
3449+ $( '#%s_throbber' ).removeClass('hidden').show();
3450+ return true;
3451+ },
3452+ response: function(event, ui, content) {
3453+ $( '#%s_throbber' ).hide();
3454+ return content;
3455+ },
3456+ focus: function( event, ui ) {
3457+ var name = '';
3458+ if (ui.item.name != null) {
3459+ name += ui.item.name;
3460+ }
3461+ if (ui.item.instance_type != '') {
3462+ name += ' (' + s3_site_lookup(ui.item.instance_type) + ')';
3463+ }
3464+ $( '#%s' ).val( name );
3465+ return false;
3466+ },
3467+ select: function( event, ui ) {
3468+ var name = '';
3469+ if (ui.item.name != null) {
3470+ name += ui.item.name;
3471+ }
3472+ if (ui.item.instance_type != '') {
3473+ name += ' (' + s3_site_lookup(ui.item.instance_type) + ')';
3474+ }
3475+ $( '#%s' ).val( name );
3476+ $( '#%s' ).val( ui.item.site_id )
3477+ .change();
3478+ """ % (dummy_input,
3479+ dummy_input,
3480+ url,
3481+ self.delay,
3482+ self.min_length,
3483+ dummy_input,
3484+ dummy_input,
3485+ dummy_input,
3486+ dummy_input,
3487+ real_input), self.post_process, """
3488+ data.accept = true;
3489+ return false;
3490+ }
3491+})
3492+.data( 'autocomplete' )._renderItem = function( ul, item ) {
3493+ var name = '';
3494+ if (item.name != null) {
3495+ name += item.name;
3496+ }
3497+ if (item.instance_type != '') {
3498+ name += ' (' + s3_site_lookup(item.instance_type) + ')';
3499+ }
3500+ return $( '<li></li>' )
3501+ .data( 'item.autocomplete', item )
3502+ .append( '<a>' + name + '</a>' )
3503+ .appendTo( ul );
3504+};
3505+$('#%s').blur(function() {
3506+ if (!$('#%s').val()) {
3507+ $('#%s').val('')
3508+ .change();
3509+ data.accept = true;
3510+ }
3511+ if (!data.accept) {
3512+ $('#%s').val(data.val);
3513+ } else {
3514+ data.val = $('#%s').val();
3515+ }
3516+ data.accept = false;
3517+});""" % (dummy_input, dummy_input, real_input, dummy_input, dummy_input)))
3518
3519 if value:
3520 # Provide the representation for the current/default Value
3521@@ -1093,6 +1062,7 @@
3522 else:
3523 represent = ""
3524
3525+ response.s3.jquery_ready.append(js_autocomplete)
3526 return TAG[""](
3527 INPUT(_id=dummy_input,
3528 _class="string",
3529@@ -1103,7 +1073,6 @@
3530 _id="%s_throbber" % dummy_input,
3531 _class="throbber hidden"),
3532 INPUT(**attr),
3533- SCRIPT(js_autocomplete),
3534 requires = field.requires
3535 )
3536
3537@@ -1178,8 +1147,9 @@
3538 def __call__(self, field, value, **attributes):
3539
3540 db = self.db
3541+ gis = self.gis
3542+ cache = gis.cache
3543 environment = self.environment
3544- gis = self.gis
3545 auth = self.auth
3546 deployment_settings = self.deployment_settings
3547 request = self.request
3548@@ -1204,9 +1174,26 @@
3549
3550 # Read Options
3551 config = gis.get_config()
3552- # Are we restricted to just certain countries?
3553- # First try the site's list of countries, if any, then L0 countries.
3554- countries = gis.get_site_countries() or gis.get_countries()
3555+ default_L0 = None
3556+ if value:
3557+ default_L0 = gis.get_parent_country(value)
3558+ elif config.default_location_id:
3559+ # Populate defaults with IDs & Names of ancestors at each level
3560+ gis.get_parent_per_level(defaults,
3561+ config.default_location_id,
3562+ feature=None,
3563+ ids=True,
3564+ names=True)
3565+ if "L0" in defaults:
3566+ default_L0 = defaults["L0"]
3567+ if default_L0:
3568+ country_snippet = "S3.gis.country = '%s';" % \
3569+ gis.get_default_country(key_type="code")
3570+ else:
3571+ country_snippet = ""
3572+
3573+ # Full list of countries
3574+ countries = gis.get_countries()
3575 # Should we use a Map-based selector?
3576 map_selector = deployment_settings.get_gis_map_selector()
3577 # Navigate Away Confirm?
3578@@ -1226,14 +1213,21 @@
3579 tab = ""
3580
3581 # Which Levels do we have in our hierarchy & what are their initial Labels?
3582- # @ToDo: If we have hardcoded country or one from the value then we can lookup what options we should use for that location
3583- #if value["L0"]:
3584- #elif len(countries) == 1:
3585- #else:
3586- # Default
3587+ # If we have a default country or one from the value then we can lookup
3588+ # the labels we should use for that location
3589+ config_L0 = None
3590+ if default_L0:
3591+ query = (db.gis_config.region_location_id == default_L0.id)
3592+ config_L0 = db(query).select(db.gis_config.id,
3593+ limitby=(0, 1),
3594+ cache=cache).first()
3595+ if config_L0:
3596+ gis.set_temporary_config(config_L0.id)
3597 location_hierarchy = gis.get_location_hierarchy()
3598 # This is all levels to start, but L0 will be dropped later.
3599 levels = gis.allowed_hierarchy_level_keys
3600+ if config_L0:
3601+ gis.restore_config()
3602
3603 map_popup = ""
3604 if value:
3605@@ -1254,77 +1248,84 @@
3606 locations.parent,
3607 locations.path,
3608 limitby=(0, 1)).first()
3609- uuid = this_location.uuid
3610- level = this_location.level
3611- defaults[level] = Storage()
3612- defaults[level].id = value
3613- lat = this_location.lat
3614- lon = this_location.lon
3615- addr_street = this_location.addr_street or ""
3616- #addr_street_encoded = ""
3617- #if addr_street:
3618- # addr_street_encoded = addr_street.replace("\r\n",
3619- # "%0d").replace("\r",
3620- # "%0d").replace("\n",
3621- # "%0d")
3622- postcode = this_location.addr_postcode
3623- parent = this_location.parent
3624- path = this_location.path
3625-
3626- # Populate defaults with IDs & Names of ancestors at each level
3627- gis.get_parent_per_level(defaults,
3628- value,
3629- feature=this_location,
3630- ids=True,
3631- names=True)
3632- # If we have a non-specific location then not all keys will be populated.
3633- # Populate these now:
3634- for l in levels:
3635- try:
3636- defaults[l]
3637- except:
3638- defaults[l] = None
3639-
3640- if level and not level == "XX":
3641- # If within the locations hierarchy then don't populate the visible name box
3642- represent = ""
3643+ if this_location:
3644+ uid = this_location.uuid
3645+ level = this_location.level
3646+ defaults[level] = Storage()
3647+ defaults[level].id = value
3648+ lat = this_location.lat
3649+ lon = this_location.lon
3650+ addr_street = this_location.addr_street or ""
3651+ #addr_street_encoded = ""
3652+ #if addr_street:
3653+ # addr_street_encoded = addr_street.replace("\r\n",
3654+ # "%0d").replace("\r",
3655+ # "%0d").replace("\n",
3656+ # "%0d")
3657+ postcode = this_location.addr_postcode
3658+ parent = this_location.parent
3659+ path = this_location.path
3660+
3661+ # Populate defaults with IDs & Names of ancestors at each level
3662+ gis.get_parent_per_level(defaults,
3663+ value,
3664+ feature=this_location,
3665+ ids=True,
3666+ names=True)
3667+ # If we have a non-specific location then not all keys will be populated.
3668+ # Populate these now:
3669+ for l in levels:
3670+ try:
3671+ defaults[l]
3672+ except:
3673+ defaults[l] = None
3674+
3675+ if level and not level == "XX":
3676+ # If within the locations hierarchy then don't populate the visible name box
3677+ represent = ""
3678+ else:
3679+ represent = this_location.name
3680+
3681+ if map_selector:
3682+ # Load the Models
3683+ s3mgr.load("gis_layer_openstreetmap")
3684+ zoom = config.zoom
3685+ if lat is None or lon is None:
3686+ map_lat = config.lat
3687+ map_lon = config.lon
3688+ else:
3689+ map_lat = lat
3690+ map_lon = lon
3691+
3692+ query = (locations.id == value)
3693+ row = db(query).select(locations.lat,
3694+ locations.lon,
3695+ limitby=(0, 1)).first()
3696+ if row:
3697+ feature = {"lat" : row.lat,
3698+ "lon" : row.lon }
3699+ features = [feature]
3700+ else:
3701+ features = []
3702+ map_popup = gis.show_map(
3703+ lat = map_lat,
3704+ lon = map_lon,
3705+ # Same as a single zoom on a cluster
3706+ zoom = zoom + 2,
3707+ features = features,
3708+ add_feature = True,
3709+ #add_feature_active = True,
3710+ toolbar = True,
3711+ collapsed = True,
3712+ search = True,
3713+ window = True,
3714+ window_hide = True
3715+ )
3716 else:
3717- represent = this_location.name
3718-
3719- if map_selector:
3720- # Load the Models
3721- s3mgr.load("gis_layer_openstreetmap")
3722- zoom = config.zoom
3723- if lat is None or lon is None:
3724- map_lat = config.lat
3725- map_lon = config.lon
3726- else:
3727- map_lat = lat
3728- map_lon = lon
3729-
3730- row = db(locations.id == value).select(locations.lat,
3731- locations.lon,
3732- limitby=(0, 1)).first()
3733- if row:
3734- feature = {"lat" : row.lat,
3735- "lon" : row.lon }
3736- features = [feature]
3737- else:
3738- features = []
3739- map_popup = gis.show_map(
3740- lat = map_lat,
3741- lon = map_lon,
3742- # Same as a single zoom on a cluster
3743- zoom = zoom + 2,
3744- features = features,
3745- add_feature = True,
3746- #add_feature_active = True,
3747- toolbar = True,
3748- collapsed = True,
3749- search = True,
3750- window = True,
3751- window_hide = True
3752- )
3753+ # Bad location_id
3754+ response.error = T("Invalid Location!")
3755+ value = None
3756+
3757 elif auth.s3_has_permission("read", locations, record_id=value):
3758 # Read mode
3759 # @ToDo
3760@@ -1332,8 +1333,8 @@
3761 else:
3762 # No Permission to read location, so don't render a row
3763 return ""
3764-
3765- else:
3766+
3767+ if not value:
3768 # No default value
3769 # Check that we're allowed to create records
3770 if auth.s3_has_permission("update", locations):
3771@@ -1397,8 +1398,7 @@
3772 _class="box_top")
3773
3774 # Tabs to select between the modes
3775- # @ToDo:
3776- # Move Location tab
3777+ # @ToDo: Move Location tab
3778 view_button = A(T("View Location Details"),
3779 _style="cursor:pointer; cursor:hand",
3780 _id="gis_location_view-btn")
3781@@ -1433,52 +1433,57 @@
3782 SELECT_LOCATION = T("Select a location")
3783 level = "L0"
3784 L0_rows = ""
3785- if len(countries) == 1:
3786- # Hard-coded country
3787- (cid, country) = countries.items()[0]
3788- L0_rows = INPUT(value = cid,
3789- _id="gis_location_%s" % level,
3790- _name="gis_location_%s" % level,
3791- _class="hidden box_middle")
3792+ #if len(countries) == 1:
3793+ # # Hard-coded country
3794+ # (cid, country) = countries.items()[0]
3795+ # L0_rows = INPUT(value = cid,
3796+ # _id="gis_location_%s" % level,
3797+ # _name="gis_location_%s" % level,
3798+ # _class="hidden box_middle")
3799+ #else:
3800+ if default_L0:
3801+ attr_dropdown = OptionsWidget._attributes(field,
3802+ dict(_type = "int",
3803+ value = default_L0.id),
3804+ **attributes)
3805 else:
3806- country = ""
3807 attr_dropdown = OptionsWidget._attributes(field,
3808 dict(_type = "int",
3809 value = ""),
3810 **attributes)
3811- attr_dropdown["requires"] = \
3812- IS_NULL_OR(IS_IN_SET(countries,
3813- zero = SELECT_LOCATION))
3814- attr_dropdown["represent"] = \
3815- lambda id: gis.get_country(id) or UNKNOWN_OPT
3816- opts = [OPTION(SELECT_LOCATION, _value="")]
3817- if countries:
3818- for (id, name) in countries.iteritems():
3819- opts.append(OPTION(name, _value=id))
3820- attr_dropdown["_id"] = "gis_location_%s" % level
3821- ## Old: Need to blank the name to prevent it from appearing in form.vars & requiring validation
3822- #attr_dropdown["_name"] = ""
3823- attr_dropdown["_name"] = "gis_location_%s" % level
3824- if value:
3825- # Update form => read-only
3826- attr_dropdown["_disabled"] = "disabled"
3827- try:
3828- attr_dropdown["value"] = defaults[level].id
3829- except:
3830- pass
3831- widget = SELECT(*opts, **attr_dropdown)
3832- label = LABEL("%s:" % location_hierarchy[level])
3833- L0_rows = DIV(TR(TD(label), TD(),
3834- _class="locselect box_middle",
3835- _id="gis_location_%s_label__row" % level),
3836- TR(TD(widget), TD(),
3837- _class="locselect box_middle",
3838- _id="gis_location_%s__row" % level))
3839- row = TR(INPUT(_id="gis_location_%s_search" % level,
3840- _disabled="disabled"), TD(),
3841- _class="hidden locselect box_middle",
3842- _id="gis_location_%s_search__row" % level)
3843- L0_rows.append(row)
3844+ attr_dropdown["requires"] = \
3845+ IS_NULL_OR(IS_IN_SET(countries,
3846+ zero = SELECT_LOCATION))
3847+ attr_dropdown["represent"] = \
3848+ lambda id: gis.get_country(id) or UNKNOWN_OPT
3849+ opts = [OPTION(SELECT_LOCATION, _value="")]
3850+ if countries:
3851+ for (id, name) in countries.iteritems():
3852+ opts.append(OPTION(name, _value=id))
3853+ attr_dropdown["_id"] = "gis_location_%s" % level
3854+ ## Old: Need to blank the name to prevent it from appearing in form.vars & requiring validation
3855+ #attr_dropdown["_name"] = ""
3856+ attr_dropdown["_name"] = "gis_location_%s" % level
3857+ if value:
3858+ # Update form => read-only
3859+ attr_dropdown["_disabled"] = "disabled"
3860+ try:
3861+ attr_dropdown["value"] = defaults[level].id
3862+ except:
3863+ pass
3864+ widget = SELECT(*opts, **attr_dropdown)
3865+ label = LABEL("%s:" % location_hierarchy[level])
3866+ L0_rows = DIV(TR(TD(label), TD(),
3867+ _class="locselect box_middle",
3868+ _id="gis_location_%s_label__row" % level),
3869+ TR(TD(widget), TD(),
3870+ _class="locselect box_middle",
3871+ _id="gis_location_%s__row" % level))
3872+ row = TR(INPUT(_id="gis_location_%s_search" % level,
3873+ _disabled="disabled"), TD(),
3874+ _class="hidden locselect box_middle",
3875+ _id="gis_location_%s_search__row" % level)
3876+ L0_rows.append(row)
3877
3878 NAME_LABEL = T("Building Name")
3879 STREET_LABEL = T("Street Address")
3880@@ -1574,11 +1579,7 @@
3881 _name="gis_location_lon")
3882 for level in levels:
3883 hidden = ""
3884- if len(countries) == 1:
3885- # Q: Make the L1 selector into a dropdown?
3886- # deployment_setting? Based on flag in the region table to say that we have this populated?
3887- pass
3888- elif level not in location_hierarchy:
3889+ if level not in location_hierarchy:
3890 # Hide unused levels
3891 # (these can then be enabled for other regions)
3892 hidden = "hidden"
3893@@ -1590,10 +1591,19 @@
3894 _class="%s locselect box_middle" % hidden,
3895 _id="gis_location_%s_label__row" % level)
3896 Lx_rows.append(row)
3897- widget = DIV(INPUT(_id="gis_location_%s" % level,
3898+ if level in defaults and defaults[level]:
3899+ default = defaults[level]
3900+ default_id = default.id
3901+ default_name = default.name
3902+ else:
3903+ default_id = ""
3904+ default_name = ""
3905+ widget = DIV(INPUT(value=default_id,
3906+ _id="gis_location_%s" % level,
3907 _name="gis_location_%s" % level,
3908 _class="hidden"),
3909- INPUT(_id="gis_location_%s_ac" % level),
3910+ INPUT(value=default_name,
3911+ _id="gis_location_%s_ac" % level),
3912 IMG(_src=throbber,
3913 _height=32, _width=32,
3914 _id="gis_location_%s_throbber" % level,
3915@@ -1739,7 +1749,7 @@
3916 #S3.gis.uuid = '%s';
3917 #%s%s%s%s
3918 js_location_selector = """
3919-S3.gis.country = '%s';%s%s%s
3920+%s%s%s
3921 S3.gis.location_id = '%s';
3922 S3.gis.site = '%s';
3923 S3.i18n.gis_place_on_map = '%s';
3924@@ -1751,7 +1761,6 @@
3925 #s3_gis_address,
3926 #s3_gis_postcode,
3927 #s3_gis_lat_lon,
3928- country, # @ToDo: refactor to hide when not used
3929 geocoder,
3930 navigate_away_confirm,
3931 tab,
3932@@ -2080,25 +2089,95 @@
3933 T("Editor"))))
3934 opts.append(tds)
3935 return TABLE(*opts, **attr)
3936-
3937-class S3RoleSetUsersWidget(MultipleOptionsWidget):
3938- """
3939- """
3940-
3941+
3942+# -----------------------------------------------------------------------------
3943+class S3AppendRoleSetUsersWidget(FormWidget):
3944+ """
3945+ """
3946 def __init__(self,
3947- db=None):
3948- self.db = db
3949-
3950- def widget(self, field, value, size=5, **attributes):
3951+ env,
3952+ db=None,
3953+ settings=None,
3954+ parent_widget=None,
3955+ ):
3956+
3957+ self.db = db
3958+ self.env = env
3959+ self.response = self.env.response
3960+ self.parent_widget = parent_widget
3961+ self.component_id = None
3962+
3963+ def _get_user_controls(self):
3964+ # returns controls for filtering users list
3965+ T = self.env.T
3966+
3967+ return TR(TD(DIV(
3968+ B("%s:" % T("select users from")),
3969+ INPUT(
3970+ _name="role_set_users_filter",
3971+ _id="role_set_pickup_orgusers",
3972+ _type="radio",
3973+ value=1, _value=1),
3974+ T("this organisation"),
3975+
3976+ INPUT(
3977+ _name="role_set_users_filter",
3978+ _id="role_set_pickup_allusers",
3979+ _type="radio",
3980+ value=0, _value=1),
3981+ T("all organisations"),
3982+ _style="float:right",
3983+ )))
3984+
3985+ def widget(self, field, value, **attributes):
3986 db = self.db
3987- rs_id = self.rs_id
3988- if rs_id:
3989- # fill in values from auth_user_role_set table
3990- table = db.auth.table_user_role_set
3991- value = [r.user_id for r in db(table.set_id == rs_id).select()]
3992- return MultipleOptionsWidget.widget(field, value, **attributes)
3993-
3994-# -----------------------------------------------------------------------------
3995+ auth = db.auth
3996+ response = self.response
3997+ vita = response.s3.vita
3998+ parent_widget=self.parent_widget
3999+
4000+ if not parent_widget:
4001+ parent_widget = StringWidget.widget
4002+
4003+ widgets = []
4004+ widgets.append(parent_widget(field, value, **attributes))
4005+
4006+ if self.component_id:
4007+ opts = []
4008+ widgets.append(TR(TD()))
4009+ widgets.append(TR(TD()))
4010+ widgets.append(TR(TD(B( "%s:" % auth.messages.label_users_assigned))))
4011+
4012+ auth_user_role_set = auth.org.table_user_role_set
4013+ auth_user = db["auth_user"]
4014+ pr_person = db["pr_person"]
4015+ org_organisation = db["org_organisation"]
4016+ users_list = db((auth_user.id > 0) and \
4017+ (pr_person.uuid == auth_user.person_uuid) \
4018+ ).select()
4019+
4020+ assigned_users = db(auth_user_role_set.set_id == int(self.component_id)).select(distinct=True)
4021+ assigned_users = [x.user_id for x in assigned_users]
4022+
4023+ for person in users_list:
4024+ fullname = vita.fullname(person)
4025+ opts.append(OPTION(
4026+ fullname,
4027+ _value=person.auth_user.id,
4028+ _selected="selected" if person.auth_user.id in assigned_users else None
4029+ ))
4030+
4031+ if len(opts)>0:
4032+ #widgets.append(self._get_user_controls())
4033+ widgets.append(TR(TD(SELECT(opts,
4034+ _name="users_assigned",
4035+ _id="auth_org_role_set_users_assigned",
4036+ _multiple="multiple",
4037+ _class="multiselect"))))
4038+
4039+ return widgets
4040+
4041+
4042 class JSON(INPUT):
4043 """
4044 Extends INPUT() from gluon/html.py
4045@@ -2782,7 +2861,7 @@
4046
4047 # Autocomplete
4048 select = "select_person($('#hrm_human_resource_person_id').val());"
4049- widget = S3PersonAutocompleteWidget(request,
4050+ widget = S3PersonAutocompleteWidget(self.env,
4051 post_process=select)
4052 ac_row = TR(TD(LABEL("%s: " % T("Name"),
4053 _class="hide",
4054
4055=== modified file 'static/scripts/S3/S3.min.js'
4056--- static/scripts/S3/S3.min.js 2011-06-24 15:28:40 +0000
4057+++ static/scripts/S3/S3.min.js 2011-06-27 17:56:49 +0000
4058@@ -1,54 +1,54 @@
4059-(function(b,e){function a(a,f){var j=a.nodeName.toLowerCase();if("area"===j){var j=a.parentNode,g=j.name;if(!a.href||!g||j.nodeName.toLowerCase()!=="map")return!1;j=b("img[usemap=#"+g+"]")[0];return!!j&&c(j)}return(/input|select|textarea|button|object/.test(j)?!a.disabled:"a"==j?a.href||f:f)&&c(a)}function c(a){return!b(a).parents().andSelf().filter(function(){return b.curCSS(this,"visibility")==="hidden"||b.expr.filters.hidden(this)}).length}b.ui=b.ui||{};b.ui.version||(b.extend(b.ui,{version:"1.8.13",
4060-keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),b.fn.extend({_focus:b.fn.focus,focus:function(a,f){return typeof a==="number"?this.each(function(){var c=this;setTimeout(function(){b(c).focus();
4061-f&&f.call(c)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=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,
4062-"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?b(document):a},zIndex:function(a){if(a!==e)return this.css("zIndex",a);if(this.length)for(var a=b(this[0]),f;a.length&&a[0]!==document;){f=a.css("position");if(f==="absolute"||f==="relative"||f==="fixed")if(f=parseInt(a.css("zIndex"),10),!isNaN(f)&&f!==0)return f;a=a.parent()}return 0},disableSelection:function(){return this.bind((b.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
4063-function(b){b.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),b.each(["Width","Height"],function(a,f){function c(a,f,k,e){b.each(g,function(){f-=parseFloat(b.curCSS(a,"padding"+this,!0))||0;k&&(f-=parseFloat(b.curCSS(a,"border"+this+"Width",!0))||0);e&&(f-=parseFloat(b.curCSS(a,"margin"+this,!0))||0)});return f}var g=f==="Width"?["Left","Right"]:["Top","Bottom"],k=f.toLowerCase(),n={innerWidth:b.fn.innerWidth,innerHeight:b.fn.innerHeight,outerWidth:b.fn.outerWidth,
4064-outerHeight:b.fn.outerHeight};b.fn["inner"+f]=function(g){if(g===e)return n["inner"+f].call(this);return this.each(function(){b(this).css(k,c(this,g)+"px")})};b.fn["outer"+f]=function(g,a){if(typeof g!=="number")return n["outer"+f].call(this,g);return this.each(function(){b(this).css(k,c(this,g,!0,a)+"px")})}}),b.extend(b.expr[":"],{data:function(a,f,c){return!!b.data(a,c[3])},focusable:function(c){return a(c,!isNaN(b.attr(c,"tabindex")))},tabbable:function(c){var f=b.attr(c,"tabindex"),e=isNaN(f);
4065-return(e||f>=0)&&a(c,!e)}}),b(function(){var a=document.body,f=a.appendChild(f=document.createElement("div"));b.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});b.support.minHeight=f.offsetHeight===100;b.support.selectstart="onselectstart"in f;a.removeChild(f).style.display="none"}),b.extend(b.ui,{plugin:{add:function(a,f,c){var a=b.ui[a].prototype,g;for(g in c)a.plugins[g]=a.plugins[g]||[],a.plugins[g].push([f,c[g]])},call:function(b,a,c){if((a=b.plugins[a])&&b.element[0].parentNode)for(var g=
4066-0;g<a.length;g++)b.options[a[g][0]]&&a[g][1].apply(b.element,c)}},contains:function(b,a){return document.compareDocumentPosition?b.compareDocumentPosition(a)&16:b!==a&&b.contains(a)},hasScroll:function(a,f){if(b(a).css("overflow")==="hidden")return!1;var c=f&&f==="left"?"scrollLeft":"scrollTop",g=!1;if(a[c]>0)return!0;a[c]=1;g=a[c]>0;a[c]=0;return g},isOverAxis:function(b,a,c){return b>a&&b<a+c},isOver:function(a,f,c,g,k,e){return b.ui.isOverAxis(a,c,k)&&b.ui.isOverAxis(f,g,e)}}))})(jQuery);
4067-(function(b,e){if(b.cleanData){var a=b.cleanData;b.cleanData=function(c){for(var f=0,e;(e=c[f])!=null;f++)b(e).triggerHandler("remove");a(c)}}else{var c=b.fn.remove;b.fn.remove=function(a,f){return this.each(function(){f||(!a||b.filter(a,[this]).length)&&b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return c.call(b(this),a,f)})}}b.widget=function(a,f,c){var g=a.split(".")[0],k,a=a.split(".")[1];k=g+"-"+a;if(!c)c=f,f=b.Widget;b.expr[":"][k]=function(g){return!!b.data(g,
4068-a)};b[g]=b[g]||{};b[g][a]=function(b,g){arguments.length&&this._createWidget(b,g)};f=new f;f.options=b.extend(!0,{},f.options);b[g][a].prototype=b.extend(!0,f,{namespace:g,widgetName:a,widgetEventPrefix:b[g][a].prototype.widgetEventPrefix||a,widgetBaseClass:k},c);b.widget.bridge(a,b[g][a])};b.widget.bridge=function(a,f){b.fn[a]=function(c){var g=typeof c==="string",k=Array.prototype.slice.call(arguments,1),n=this,c=!g&&k.length?b.extend.apply(null,[!0,c].concat(k)):c;if(g&&c.charAt(0)==="_")return n;
4069-g?this.each(function(){var g=b.data(this,a),f=g&&b.isFunction(g[c])?g[c].apply(g,k):g;if(f!==g&&f!==e)return n=f,!1}):this.each(function(){var g=b.data(this,a);g?g.option(c||{})._init():b.data(this,a,new f(c,this))});return n}};b.Widget=function(b,a){arguments.length&&this._createWidget(b,a)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(a,f){b.data(f,this.widgetName,this);this.element=b(f);this.options=b.extend(!0,{},this.options,this._getCreateOptions(),
4070-a);var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},
4071-option:function(a,f){var c=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(f===e)return this.options[a];c={};c[a]=f}this._setOptions(c);return this},_setOptions:function(a){var c=this;b.each(a,function(b,g){c._setOption(b,g)});return this},_setOption:function(b,a){this.options[b]=a;b==="disabled"&&this.widget()[a?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",a);return this},enable:function(){return this._setOption("disabled",
4072-!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(a,c,e){var g=this.options[a],c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();e=e||{};if(c.originalEvent)for(var a=b.event.props.length,k;a;)k=b.event.props[--a],c[k]=c.originalEvent[k];this.element.trigger(c,e);return!(b.isFunction(g)&&g.call(this.element[0],c,e)===!1||c.isDefaultPrevented())}}})(jQuery);
4073-(function(b){b.ui=b.ui||{};var e=/left|center|right/,a=/top|center|bottom/,c=b.fn.position,h=b.fn.offset;b.fn.position=function(f){if(!f||!f.of)return c.apply(this,arguments);var f=b.extend({},f),j=b(f.of),g=j[0],k=(f.collision||"flip").split(" "),n=f.offset?f.offset.split(" "):[0,0],h,o,s;g.nodeType===9?(h=j.width(),o=j.height(),s={top:0,left:0}):g.setTimeout?(h=j.width(),o=j.height(),s={top:j.scrollTop(),left:j.scrollLeft()}):g.preventDefault?(f.at="left top",h=o=0,s={top:f.of.pageY,left:f.of.pageX}):
4074-(h=j.outerWidth(),o=j.outerHeight(),s=j.offset());b.each(["my","at"],function(){var b=(f[this]||"").split(" ");b.length===1&&(b=e.test(b[0])?b.concat(["center"]):a.test(b[0])?["center"].concat(b):["center","center"]);b[0]=e.test(b[0])?b[0]:"center";b[1]=a.test(b[1])?b[1]:"center";f[this]=b});k.length===1&&(k[1]=k[0]);n[0]=parseInt(n[0],10)||0;n.length===1&&(n[1]=n[0]);n[1]=parseInt(n[1],10)||0;f.at[0]==="right"?s.left+=h:f.at[0]==="center"&&(s.left+=h/2);f.at[1]==="bottom"?s.top+=o:f.at[1]==="center"&&
4075-(s.top+=o/2);s.left+=n[0];s.top+=n[1];return this.each(function(){var g=b(this),a=g.outerWidth(),c=g.outerHeight(),e=parseInt(b.curCSS(this,"marginLeft",!0))||0,j=parseInt(b.curCSS(this,"marginTop",!0))||0,x=a+e+(parseInt(b.curCSS(this,"marginRight",!0))||0),z=c+j+(parseInt(b.curCSS(this,"marginBottom",!0))||0),w=b.extend({},s),y;f.my[0]==="right"?w.left-=a:f.my[0]==="center"&&(w.left-=a/2);f.my[1]==="bottom"?w.top-=c:f.my[1]==="center"&&(w.top-=c/2);w.left=Math.round(w.left);w.top=Math.round(w.top);
4076-y={left:w.left-e,top:w.top-j};b.each(["left","top"],function(g,e){if(b.ui.position[k[g]])b.ui.position[k[g]][e](w,{targetWidth:h,targetHeight:o,elemWidth:a,elemHeight:c,collisionPosition:y,collisionWidth:x,collisionHeight:z,offset:n,my:f.my,at:f.at})});b.fn.bgiframe&&g.bgiframe();g.offset(b.extend(w,{using:f.using}))})};b.ui.position={fit:{left:function(a,c){var g=b(window),g=c.collisionPosition.left+c.collisionWidth-g.width()-g.scrollLeft();a.left=g>0?a.left-g:Math.max(a.left-c.collisionPosition.left,
4077-a.left)},top:function(a,c){var g=b(window),g=c.collisionPosition.top+c.collisionHeight-g.height()-g.scrollTop();a.top=g>0?a.top-g:Math.max(a.top-c.collisionPosition.top,a.top)}},flip:{left:function(a,c){if(c.at[0]!=="center"){var g=b(window),g=c.collisionPosition.left+c.collisionWidth-g.width()-g.scrollLeft(),k=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,e=c.at[0]==="left"?c.targetWidth:-c.targetWidth,h=-2*c.offset[0];a.left+=c.collisionPosition.left<0?k+e+h:g>0?k+e+h:0}},top:function(a,
4078-c){if(c.at[1]!=="center"){var g=b(window),g=c.collisionPosition.top+c.collisionHeight-g.height()-g.scrollTop(),k=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,e=c.at[1]==="top"?c.targetHeight:-c.targetHeight,h=-2*c.offset[1];a.top+=c.collisionPosition.top<0?k+e+h:g>0?k+e+h:0}}}};if(!b.offset.setOffset)b.offset.setOffset=function(a,c){if(/static/.test(b.curCSS(a,"position")))a.style.position="relative";var g=b(a),e=g.offset(),n=parseInt(b.curCSS(a,"top",!0),10)||0,h=parseInt(b.curCSS(a,
4079-"left",!0),10)||0,e={top:c.top-e.top+n,left:c.left-e.left+h};"using"in c?c.using.call(a,e):g.css(e)},b.fn.offset=function(a){var c=this[0];if(!c||!c.ownerDocument)return null;if(a)return this.each(function(){b.offset.setOffset(this,a)});return h.call(this)}})(jQuery);
4080-(function(b){var e=!1;b(document).mousedown(function(){e=!1});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(c){if(!0===b.data(c.target,a.widgetName+".preventClickEvent"))return b.removeData(c.target,a.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+
4081-this.widgetName)},_mouseDown:function(a){if(!e){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,h=a.which==1,f=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:!1;if(!h||f||!this._mouseCapture(a))return!0;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=!0},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=
4082-this._mouseStart(a)!==!1,!this._mouseStarted))return a.preventDefault(),!0;!0===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(b){return c._mouseMove(b)};this._mouseUpDelegate=function(b){return c._mouseUp(b)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return e=!0}},_mouseMove:function(a){if(b.browser.msie&&
4083+(function(b,c){function a(a,c){var h=a.nodeName.toLowerCase();if("area"===h){var h=a.parentNode,j=h.name;if(!a.href||!j||h.nodeName.toLowerCase()!=="map")return!1;h=b("img[usemap=#"+j+"]")[0];return!!h&&e(h)}return(/input|select|textarea|button|object/.test(h)?!a.disabled:"a"==h?a.href||c:c)&&e(a)}function e(a){return!b(a).parents().andSelf().filter(function(){return b.curCSS(this,"visibility")==="hidden"||b.expr.filters.hidden(this)}).length}b.ui=b.ui||{};b.ui.version||(b.extend(b.ui,{version:"1.8.13",
4084+keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),b.fn.extend({_focus:b.fn.focus,focus:function(a,c){return typeof a==="number"?this.each(function(){var e=this;setTimeout(function(){b(e).focus();
4085+c&&c.call(e)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=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,
4086+"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?b(document):a},zIndex:function(a){if(a!==c)return this.css("zIndex",a);if(this.length)for(var a=b(this[0]),e;a.length&&a[0]!==document;){e=a.css("position");if(e==="absolute"||e==="relative"||e==="fixed")if(e=parseInt(a.css("zIndex"),10),!isNaN(e)&&e!==0)return e;a=a.parent()}return 0},disableSelection:function(){return this.bind((b.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
4087+function(b){b.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),b.each(["Width","Height"],function(a,e){function h(a,c,e,g){b.each(j,function(){c-=parseFloat(b.curCSS(a,"padding"+this,!0))||0;e&&(c-=parseFloat(b.curCSS(a,"border"+this+"Width",!0))||0);g&&(c-=parseFloat(b.curCSS(a,"margin"+this,!0))||0)});return c}var j=e==="Width"?["Left","Right"]:["Top","Bottom"],k=e.toLowerCase(),p={innerWidth:b.fn.innerWidth,innerHeight:b.fn.innerHeight,outerWidth:b.fn.outerWidth,
4088+outerHeight:b.fn.outerHeight};b.fn["inner"+e]=function(a){if(a===c)return p["inner"+e].call(this);return this.each(function(){b(this).css(k,h(this,a)+"px")})};b.fn["outer"+e]=function(a,j){if(typeof a!=="number")return p["outer"+e].call(this,a);return this.each(function(){b(this).css(k,h(this,a,!0,j)+"px")})}}),b.extend(b.expr[":"],{data:function(a,c,e){return!!b.data(a,e[3])},focusable:function(c){return a(c,!isNaN(b.attr(c,"tabindex")))},tabbable:function(c){var e=b.attr(c,"tabindex"),h=isNaN(e);
4089+return(h||e>=0)&&a(c,!h)}}),b(function(){var a=document.body,c=a.appendChild(c=document.createElement("div"));b.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});b.support.minHeight=c.offsetHeight===100;b.support.selectstart="onselectstart"in c;a.removeChild(c).style.display="none"}),b.extend(b.ui,{plugin:{add:function(a,c,e){var a=b.ui[a].prototype,j;for(j in e)a.plugins[j]=a.plugins[j]||[],a.plugins[j].push([c,e[j]])},call:function(b,a,c){if((a=b.plugins[a])&&b.element[0].parentNode)for(var j=
4090+0;j<a.length;j++)b.options[a[j][0]]&&a[j][1].apply(b.element,c)}},contains:function(b,a){return document.compareDocumentPosition?b.compareDocumentPosition(a)&16:b!==a&&b.contains(a)},hasScroll:function(a,c){if(b(a).css("overflow")==="hidden")return!1;var e=c&&c==="left"?"scrollLeft":"scrollTop",j=!1;if(a[e]>0)return!0;a[e]=1;j=a[e]>0;a[e]=0;return j},isOverAxis:function(b,a,c){return b>a&&b<a+c},isOver:function(a,c,e,j,k,p){return b.ui.isOverAxis(a,e,k)&&b.ui.isOverAxis(c,j,p)}}))})(jQuery);
4091+(function(b,c){if(b.cleanData){var a=b.cleanData;b.cleanData=function(c){for(var e=0,h;(h=c[e])!=null;e++)b(h).triggerHandler("remove");a(c)}}else{var e=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){c||(!a||b.filter(a,[this]).length)&&b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return e.call(b(this),a,c)})}}b.widget=function(a,c,e){var j=a.split(".")[0],k,a=a.split(".")[1];k=j+"-"+a;if(!e)e=c,c=b.Widget;b.expr[":"][k]=function(j){return!!b.data(j,
4092+a)};b[j]=b[j]||{};b[j][a]=function(b,a){arguments.length&&this._createWidget(b,a)};c=new c;c.options=b.extend(!0,{},c.options);b[j][a].prototype=b.extend(!0,c,{namespace:j,widgetName:a,widgetEventPrefix:b[j][a].prototype.widgetEventPrefix||a,widgetBaseClass:k},e);b.widget.bridge(a,b[j][a])};b.widget.bridge=function(a,e){b.fn[a]=function(h){var j=typeof h==="string",k=Array.prototype.slice.call(arguments,1),p=this,h=!j&&k.length?b.extend.apply(null,[!0,h].concat(k)):h;if(j&&h.charAt(0)==="_")return p;
4093+j?this.each(function(){var j=b.data(this,a),e=j&&b.isFunction(j[h])?j[h].apply(j,k):j;if(e!==j&&e!==c)return p=e,!1}):this.each(function(){var j=b.data(this,a);j?j.option(h||{})._init():b.data(this,a,new e(h,this))});return p}};b.Widget=function(b,a){arguments.length&&this._createWidget(b,a)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(!0,{},this.options,this._getCreateOptions(),
4094+a);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},
4095+option:function(a,e){var h=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(e===c)return this.options[a];h={};h[a]=e}this._setOptions(h);return this},_setOptions:function(a){var c=this;b.each(a,function(b,a){c._setOption(b,a)});return this},_setOption:function(b,a){this.options[b]=a;b==="disabled"&&this.widget()[a?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",a);return this},enable:function(){return this._setOption("disabled",
4096+!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(a,c,e){var j=this.options[a],c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();e=e||{};if(c.originalEvent)for(var a=b.event.props.length,k;a;)k=b.event.props[--a],c[k]=c.originalEvent[k];this.element.trigger(c,e);return!(b.isFunction(j)&&j.call(this.element[0],c,e)===!1||c.isDefaultPrevented())}}})(jQuery);
4097+(function(b){b.ui=b.ui||{};var c=/left|center|right/,a=/top|center|bottom/,e=b.fn.position,f=b.fn.offset;b.fn.position=function(g){if(!g||!g.of)return e.apply(this,arguments);var g=b.extend({},g),h=b(g.of),j=h[0],k=(g.collision||"flip").split(" "),f=g.offset?g.offset.split(" "):[0,0],n,o,t;j.nodeType===9?(n=h.width(),o=h.height(),t={top:0,left:0}):j.setTimeout?(n=h.width(),o=h.height(),t={top:h.scrollTop(),left:h.scrollLeft()}):j.preventDefault?(g.at="left top",n=o=0,t={top:g.of.pageY,left:g.of.pageX}):
4098+(n=h.outerWidth(),o=h.outerHeight(),t=h.offset());b.each(["my","at"],function(){var b=(g[this]||"").split(" ");b.length===1&&(b=c.test(b[0])?b.concat(["center"]):a.test(b[0])?["center"].concat(b):["center","center"]);b[0]=c.test(b[0])?b[0]:"center";b[1]=a.test(b[1])?b[1]:"center";g[this]=b});k.length===1&&(k[1]=k[0]);f[0]=parseInt(f[0],10)||0;f.length===1&&(f[1]=f[0]);f[1]=parseInt(f[1],10)||0;g.at[0]==="right"?t.left+=n:g.at[0]==="center"&&(t.left+=n/2);g.at[1]==="bottom"?t.top+=o:g.at[1]==="center"&&
4099+(t.top+=o/2);t.left+=f[0];t.top+=f[1];return this.each(function(){var a=b(this),j=a.outerWidth(),c=a.outerHeight(),e=parseInt(b.curCSS(this,"marginLeft",!0))||0,h=parseInt(b.curCSS(this,"marginTop",!0))||0,x=j+e+(parseInt(b.curCSS(this,"marginRight",!0))||0),z=c+h+(parseInt(b.curCSS(this,"marginBottom",!0))||0),w=b.extend({},t),y;g.my[0]==="right"?w.left-=j:g.my[0]==="center"&&(w.left-=j/2);g.my[1]==="bottom"?w.top-=c:g.my[1]==="center"&&(w.top-=c/2);w.left=Math.round(w.left);w.top=Math.round(w.top);
4100+y={left:w.left-e,top:w.top-h};b.each(["left","top"],function(a,e){if(b.ui.position[k[a]])b.ui.position[k[a]][e](w,{targetWidth:n,targetHeight:o,elemWidth:j,elemHeight:c,collisionPosition:y,collisionWidth:x,collisionHeight:z,offset:f,my:g.my,at:g.at})});b.fn.bgiframe&&a.bgiframe();a.offset(b.extend(w,{using:g.using}))})};b.ui.position={fit:{left:function(a,c){var j=b(window),j=c.collisionPosition.left+c.collisionWidth-j.width()-j.scrollLeft();a.left=j>0?a.left-j:Math.max(a.left-c.collisionPosition.left,
4101+a.left)},top:function(a,c){var j=b(window),j=c.collisionPosition.top+c.collisionHeight-j.height()-j.scrollTop();a.top=j>0?a.top-j:Math.max(a.top-c.collisionPosition.top,a.top)}},flip:{left:function(a,c){if(c.at[0]!=="center"){var j=b(window),j=c.collisionPosition.left+c.collisionWidth-j.width()-j.scrollLeft(),e=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,f=c.at[0]==="left"?c.targetWidth:-c.targetWidth,n=-2*c.offset[0];a.left+=c.collisionPosition.left<0?e+f+n:j>0?e+f+n:0}},top:function(a,
4102+c){if(c.at[1]!=="center"){var j=b(window),j=c.collisionPosition.top+c.collisionHeight-j.height()-j.scrollTop(),e=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,f=c.at[1]==="top"?c.targetHeight:-c.targetHeight,n=-2*c.offset[1];a.top+=c.collisionPosition.top<0?e+f+n:j>0?e+f+n:0}}}};if(!b.offset.setOffset)b.offset.setOffset=function(a,c){if(/static/.test(b.curCSS(a,"position")))a.style.position="relative";var j=b(a),e=j.offset(),f=parseInt(b.curCSS(a,"top",!0),10)||0,n=parseInt(b.curCSS(a,
4103+"left",!0),10)||0,e={top:c.top-e.top+f,left:c.left-e.left+n};"using"in c?c.using.call(a,e):j.css(e)},b.fn.offset=function(a){var c=this[0];if(!c||!c.ownerDocument)return null;if(a)return this.each(function(){b.offset.setOffset(this,a)});return f.call(this)}})(jQuery);
4104+(function(b){var c=!1;b(document).mousedown(function(){c=!1});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(c){if(!0===b.data(c.target,a.widgetName+".preventClickEvent"))return b.removeData(c.target,a.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+
4105+this.widgetName)},_mouseDown:function(a){if(!c){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var e=this,f=a.which==1,g=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:!1;if(!f||g||!this._mouseCapture(a))return!0;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=
4106+this._mouseStart(a)!==!1,!this._mouseStarted))return a.preventDefault(),!0;!0===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(b){return e._mouseMove(b)};this._mouseUpDelegate=function(b){return e._mouseUp(b)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return c=!0}},_mouseMove:function(a){if(b.browser.msie&&
4107 !(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted)return this._mouseDrag(a),a.preventDefault();if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==!1)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted)this._mouseStarted=
4108 !1,a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(a);return!1},_mouseDistanceMet:function(b){return Math.max(Math.abs(this._mouseDownEvent.pageX-b.pageX),Math.abs(this._mouseDownEvent.pageY-b.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);var S3MultiselectWidgetFileCounter=0;
4109-function S3MultiselectWidgetAddClick(b){var e=b.WidgetID,a=[/DummyDisplay0/g,/DummyDisplay1/g,/DummyDisplay2/g,/DummyDisplay3/g,/DummyDisplay4/g],c=[/DummyJSON0/g,/DummyJSON1/g,/DummyJSON2/g,/DummyJSON3/g,/DummyJSON4/g],h=$("#"+e+"_json").val(),f="{",j,g=!0,k=b.NewRow,n="",p="";for(i=0;i<b.ColumnFields.length;i++){var o="#"+e+"_"+b.ColumnFields[i],s=$(o),v=$(o+"_auto_text").val();DisplayValue="";if(s.is("select"))j="'"+s.val()+"'",DisplayValue=$(o+" option:selected").text(),s.val("");else if(v!=void 0){DisplayValue=
4110-v;j=$(o+"_auto_json").val();if(b.ColumnFields[i].slice(-3)=="_id"&&j==""){DisplayValue="";break}$(o+"_auto_text").val("");$(o+"_auto_json").val("");$(o+"_auto_edit").hide()}else s.attr("type")=="file"?(DisplayValue=s.val(),DisplayValue!=""&&(n=o,p=b.ColumnFields[i]+S3MultiselectWidgetFileCounter,j="'"+p+"'",S3MultiselectWidgetFileCounter++)):(DisplayValue=s.val(),s.val(""),s.attr("class")=="currency"&&(DisplayValue=j.replace("$","")),DisplayValue=DisplayValue.replace(/'/g,'"'),j="'"+DisplayValue+
4111-"'");DisplayValue!=""&&(g=!1);k=k.replace(a[i],DisplayValue);k=k.replace(c[i],j);f=f+"'"+b.ColumnFields[i]+"':"+j+","}f=f.slice(0,-1)+"}";!g&&!h.match(f)&&(h!=""&&(h+=","),h+=f,$("#"+e+"_json").val(h),$(k).insertBefore("#"+b.WidgetID+"_input_row"),n!=""&&($(n).attr("id",p),$("#"+p).attr("name",p),$("#"+p).hide(),$('<input class="upload" id="drrpp_framework_file_dummy_file" type="file" />').insertAfter("#"+p)))}
4112-function S3MultiselectWidgetDeleteClick(b,e){var a=e.WidgetID,c=$(b).attr("row_id");$("#"+e.DummyName).val();var h=$("#"+a+"_json").val();$(b).parent().parent().remove();if(c!="New")h!=""&&(h+=","),h=h+"{'id':'"+c+"','deleted':True},";else{c="{";for(i=0;i<e.ColumnFields.length;i++)c=c+"'"+e.ColumnFields[i]+"':'"+$(b).attr(e.ColumnFields[i])+"',";c=c.slice(0,-1)+"}";h=h.replace(c,"")}h=h.replace(",,",",");h.slice(-1)==","&&(h=h.slice(0,-1));$("#"+a+"_json").val(h)}
4113+function S3MultiselectWidgetAddClick(b){var c=b.WidgetID,a=[/DummyDisplay0/g,/DummyDisplay1/g,/DummyDisplay2/g,/DummyDisplay3/g,/DummyDisplay4/g],e=[/DummyJSON0/g,/DummyJSON1/g,/DummyJSON2/g,/DummyJSON3/g,/DummyJSON4/g],f=$("#"+c+"_json").val(),g="{",h,j=!0,k=b.NewRow,p="",n="";for(i=0;i<b.ColumnFields.length;i++){var o="#"+c+"_"+b.ColumnFields[i],t=$(o),v=$(o+"_auto_text").val();DisplayValue="";if(t.is("select"))h="'"+t.val()+"'",DisplayValue=$(o+" option:selected").text(),t.val("");else if(v!=void 0){DisplayValue=
4114+v;h=$(o+"_auto_json").val();if(b.ColumnFields[i].slice(-3)=="_id"&&h==""){DisplayValue="";break}$(o+"_auto_text").val("");$(o+"_auto_json").val("");$(o+"_auto_edit").hide()}else t.attr("type")=="file"?(DisplayValue=t.val(),DisplayValue!=""&&(p=o,n=b.ColumnFields[i]+S3MultiselectWidgetFileCounter,h="'"+n+"'",S3MultiselectWidgetFileCounter++)):(DisplayValue=t.val(),t.val(""),t.attr("class")=="currency"&&(DisplayValue=h.replace("$","")),DisplayValue=DisplayValue.replace(/'/g,'"'),h="'"+DisplayValue+
4115+"'");DisplayValue!=""&&(j=!1);k=k.replace(a[i],DisplayValue);k=k.replace(e[i],h);g=g+"'"+b.ColumnFields[i]+"':"+h+","}g=g.slice(0,-1)+"}";!j&&!f.match(g)&&(f!=""&&(f+=","),f+=g,$("#"+c+"_json").val(f),$(k).insertBefore("#"+b.WidgetID+"_input_row"),p!=""&&($(p).attr("id",n),$("#"+n).attr("name",n),$("#"+n).hide(),$('<input class="upload" id="drrpp_framework_file_dummy_file" type="file" />').insertAfter("#"+n)))}
4116+function S3MultiselectWidgetDeleteClick(b,c){var a=c.WidgetID,e=$(b).attr("row_id");$("#"+c.DummyName).val();var f=$("#"+a+"_json").val();$(b).parent().parent().remove();if(e!="New")f!=""&&(f+=","),f=f+"{'id':'"+e+"','deleted':True},";else{e="{";for(i=0;i<c.ColumnFields.length;i++)e=e+"'"+c.ColumnFields[i]+"':'"+$(b).attr(c.ColumnFields[i])+"',";e=e.slice(0,-1)+"}";f=f.replace(e,"")}f=f.replace(",,",",");f.slice(-1)==","&&(f=f.slice(0,-1));$("#"+a+"_json").val(f)}
4117 $(function(){if(typeof S3.gis.location_id!="undefined")$("#"+S3.gis.location_id+"__row1").hide(),S3.gis.url=S3.Ap.concat("/gis/location"),S3.gis.tab&&S3.gis.tab=="search"&&s3_gis_search_tab(),S3.gis.geocoder&&s3_gis_loadGoogle(),s3_gis_autocompletes(),S3.gis.site&&$("#"+S3.gis.site+"_name").blur(function(){if(!$("#gis_location_name").val()){var b=$("#"+S3.gis.site+"_name").val();$("#gis_location_name").val(b)}}),$("#gis_location_L0").change(function(){s3_gis_l0_select()}),$("#gis_location_search-btn").click(function(b){s3_gis_search_tab();
4118 b.preventDefault()}),$("#gis_location_add-btn").click(function(b){s3_gis_add_tab();b.preventDefault()}),$("#gis_location_edit-btn").click(function(b){s3_gis_edit_tab();b.preventDefault()}),$("#gis_location_view-btn").click(function(b){s3_gis_view_tab();b.preventDefault()}),$("#gis_location_expand").click(function(b){$("#gis_location_expand").hasClass("minus")?(s3_gis_hide_selector(),$("#gis_location_expand").addClass("plus"),$("#gis_location_expand").removeClass("minus")):(s3_gis_show_tab("add"),
4119 $("#gis_location_expand").addClass("minus"),$("#gis_location_expand").removeClass("plus"));b.preventDefault()}),$("#gis_location_search_select-btn").click(function(b){s3_gis_select_search_result();b.preventDefault()}),$("form").submit(function(){S3ClearNavigateAwayConfirm();return s3_gis_save_locations()?!0:!1})});
4120 Ext.onReady(function(){var b=Ext.get("gis_location_map-btn");if(b)b.on("click",function(){S3.gis.mapWin.show();var b=$("#gis_location_lat").val(),a=$("#gis_location_lon").val();(!b||!a)&&$(".olMapViewport").addClass("crosshair")})});function s3_gis_autocompletes(){s3_gis_autocomplete(1);s3_gis_autocomplete(2);s3_gis_autocomplete(3);s3_gis_autocomplete(4);s3_gis_autocomplete(5);s3_gis_autocomplete_search()}
4121-function s3_gis_autocomplete(b){if(void 0!=$("#gis_location_L"+b+"_ac").val())$("#gis_location_L"+b+"_ac").autocomplete({source:s3_gis_ac_set_source(b),minLength:2,search:function(){$("#gis_location_L"+b+"_throbber").removeClass("hidden").show();$("#gis_location_L"+b).val("");return!0},response:function(e,a,c){$("#gis_location_L"+b+"_throbber").hide();return c},focus:function(e,a){$("#gis_location_L"+b+"_ac").val(a.item.name);return!1},select:function(e,a){$("#gis_location_L"+b+"_ac").val(a.item.name);
4122+function s3_gis_autocomplete(b){if(void 0!=$("#gis_location_L"+b+"_ac").val())$("#gis_location_L"+b+"_ac").autocomplete({source:s3_gis_ac_set_source(b),minLength:2,search:function(){$("#gis_location_L"+b+"_throbber").removeClass("hidden").show();$("#gis_location_L"+b).val("");return!0},response:function(c,a,e){$("#gis_location_L"+b+"_throbber").hide();return e},focus:function(c,a){$("#gis_location_L"+b+"_ac").val(a.item.name);return!1},select:function(c,a){$("#gis_location_L"+b+"_ac").val(a.item.name);
4123 $("#gis_location_L"+b).val(a.item.id);a.item.level=="L1"&&a.item.parent&&$("#gis_location_L0").val()==""&&$("#gis_location_L0").val(a.item.parent);$("ul.ui-autocomplete").hide();return!1}}).data("autocomplete")._renderItem=function(b,a){return $("<li></li>").data("item.autocomplete",a).append("<a>"+a.name+"</a>").appendTo(b)}}
4124-function s3_gis_autocomplete_search(){if(void 0!=$("#gis_location_search_ac").val())$("#gis_location_search_ac").autocomplete({source:s3_gis_ac_set_search_source(),minLength:2,search:function(){$("#gis_location_search_throbber").removeClass("hidden").show();$("#gis_location_search_select-btn").hide();return!0},response:function(b,e,a){$("#gis_location_search_throbber").hide();return a},focus:function(b,e){$("#gis_location_search_ac").val(e.item.name);return!1},select:function(b,e){$("#gis_location_search_ac").val(e.item.name);
4125-$("ul.ui-autocomplete").hide();s3_gis_ac_search_selected(e.item);return!1}}).data("autocomplete")._renderItem=function(b,e){var a=e.name&&e.addr_street?"<a>"+e.name+", "+e.addr_street.split(",")[0].split("\n")[0]+"</a>":e.name?"<a>"+e.name+"</a>":"<a>"+e.addr_street.split(",")[0].split("\n")[0]+"</a>";return $("<li></li>").data("item.autocomplete",e).append(a).appendTo(b)}}
4126-function s3_gis_ac_set_source(b){var e=$("#gis_location_L"+(b-1)).val(),a;""==e&&b>1&&(a=$("#gis_location_L"+(b-2)).val(),""==a&&b>2&&(a=$("#gis_location_L"+(b-2)).val(),""==a&&b>3&&(a=$("#gis_location_L"+(b-3)).val(),""==a&&b>4&&(a=$("#gis_location_L"+(b-4)).val(),""==a&&b>5&&(a=$("#gis_location_L"+(b-5)).val())))));return e?S3.gis.url+"/search.json?filter=~&field=name&level=L"+b+"&parent="+e:a?S3.gis.url+"/search.json?filter=~&field=name&level=L"+b+"&children="+a:S3.gis.url+"/search.json?filter=~&field=name&level=L"+
4127+function s3_gis_autocomplete_search(){if(void 0!=$("#gis_location_search_ac").val())$("#gis_location_search_ac").autocomplete({source:s3_gis_ac_set_search_source(),minLength:2,search:function(){$("#gis_location_search_throbber").removeClass("hidden").show();$("#gis_location_search_select-btn").hide();return!0},response:function(b,c,a){$("#gis_location_search_throbber").hide();return a},focus:function(b,c){$("#gis_location_search_ac").val(c.item.name);return!1},select:function(b,c){$("#gis_location_search_ac").val(c.item.name);
4128+$("ul.ui-autocomplete").hide();s3_gis_ac_search_selected(c.item);return!1}}).data("autocomplete")._renderItem=function(b,c){var a=c.name&&c.addr_street?"<a>"+c.name+", "+c.addr_street.split(",")[0].split("\n")[0]+"</a>":c.name?"<a>"+c.name+"</a>":"<a>"+c.addr_street.split(",")[0].split("\n")[0]+"</a>";return $("<li></li>").data("item.autocomplete",c).append(a).appendTo(b)}}
4129+function s3_gis_ac_set_source(b){var c=$("#gis_location_L"+(b-1)).val(),a;""==c&&b>1&&(a=$("#gis_location_L"+(b-2)).val(),""==a&&b>2&&(a=$("#gis_location_L"+(b-2)).val(),""==a&&b>3&&(a=$("#gis_location_L"+(b-3)).val(),""==a&&b>4&&(a=$("#gis_location_L"+(b-4)).val(),""==a&&b>5&&(a=$("#gis_location_L"+(b-5)).val())))));return c?S3.gis.url+"/search.json?filter=~&field=name&level=L"+b+"&parent="+c:a?S3.gis.url+"/search.json?filter=~&field=name&level=L"+b+"&children="+a:S3.gis.url+"/search.json?filter=~&field=name&level=L"+
4130 b}function s3_gis_ac_set_search_source(){return S3.gis.url+"/search.json?filter=~&field=name&field2=addr_street&level=nullnone"}
4131-function s3_gis_ac_search_selected(b){var e;for(e=0;e<=5;e++)$("#gis_location_L"+e+"_search").val(""),$("#gis_location_L"+e+"_label__row").hide(),$("#gis_location_L"+e+"_search__row").hide();var a=b.path,c=b.parent;if(a){var h=a.slice(0,a.toString().length+1).split("/"),f=h.length-1;if(f==0)$("#gis_location_search_throbber").hide(),$("#gis_location_search_select-btn").removeClass("hidden").show();else for(e=0;e<=f;e++)e==f-1?s3_gis_search_hierarchy(h[e],!1,!0):s3_gis_search_hierarchy(h[e],!1,!1)}else c&&
4132-s3_gis_search_hierarchy(c,!0,!0);b.name?($("#gis_location_name_label__row").removeClass("hidden").show(),$("#gis_location_name_search").val(b.name),$("#gis_location_name_search__row").removeClass("hidden").show()):($("#gis_location_name_label__row").hide(),$("#gis_location_name_search").val(""),$("#gis_location_name_search__row").hide());b.addr_street?($("#gis_location_street_label__row").removeClass("hidden").show(),$("#gis_location_street_search").val(b.addr_street),$("#gis_location_street_search__row").removeClass("hidden").show()):
4133+function s3_gis_ac_search_selected(b){var c;for(c=0;c<=5;c++)$("#gis_location_L"+c+"_search").val(""),$("#gis_location_L"+c+"_label__row").hide(),$("#gis_location_L"+c+"_search__row").hide();var a=b.path,e=b.parent;if(a){var f=a.slice(0,a.toString().length+1).split("/"),g=f.length-1;if(g==0)$("#gis_location_search_throbber").hide(),$("#gis_location_search_select-btn").removeClass("hidden").show();else for(c=0;c<=g;c++)c==g-1?s3_gis_search_hierarchy(f[c],!1,!0):s3_gis_search_hierarchy(f[c],!1,!1)}else e&&
4134+s3_gis_search_hierarchy(e,!0,!0);b.name?($("#gis_location_name_label__row").removeClass("hidden").show(),$("#gis_location_name_search").val(b.name),$("#gis_location_name_search__row").removeClass("hidden").show()):($("#gis_location_name_label__row").hide(),$("#gis_location_name_search").val(""),$("#gis_location_name_search__row").hide());b.addr_street?($("#gis_location_street_label__row").removeClass("hidden").show(),$("#gis_location_street_search").val(b.addr_street),$("#gis_location_street_search__row").removeClass("hidden").show()):
4135 ($("#gis_location_street_label__row").hide(),$("#gis_location_street_search").val(""),$("#gis_location_street_search__row").hide());b.addr_postcode?($("#gis_location_postcode_label__row").removeClass("hidden").show(),$("#gis_location_postcode_search").val(b.addr_postcode),$("#gis_location_postcode_search__row").removeClass("hidden").show()):($("#gis_location_postcode_label__row").hide(),$("#gis_location_postcode_search").val(""),$("#gis_location_postcode_search__row").hide());b.lat?($("#gis_location_lat_label__row").removeClass("hidden").show(),
4136 $("#gis_location_lat_search").val(b.lat),$("#gis_location_lat_search__row").removeClass("hidden").show()):($("#gis_location_lat_label__row").hide(),$("#gis_location_lat_search").val(""),$("#gis_location_lat_search__row").hide());b.lon?($("#gis_location_lon_label__row").removeClass("hidden").show(),$("#gis_location_lon_search").val(b.lon),$("#gis_location_lon_search__row").removeClass("hidden").show()):($("#gis_location_lon_label__row").hide(),$("#gis_location_lon_search").val(""),$("#gis_location_lon_search__row").hide());
4137-$("body").data("id",b.id);!a&&!c&&$("#gis_location_search_select-btn").removeClass("hidden").show()}
4138-function s3_gis_search_hierarchy(b,e,a){$("#gis_location_search_throbber").removeClass("hidden").show();$.ajax({async:!0,url:S3.gis.url+"/"+b+".json",dataType:"json",success:function(c){if(c[0].id==b){var h=c[0].name,f=c[0].level,c=c[0].parent;$("body").data(f,b);$("#gis_location_"+f+"_search").val(h);$("#gis_location_"+f+"_label__row").removeClass("hidden").show();$("#gis_location_"+f+"_search__row").removeClass("hidden").show();e&&c?s3_gis_search_hierarchy(c,!0,!0):a&&($("#gis_location_search_throbber").hide(),
4139+$("body").data("id",b.id);!a&&!e&&$("#gis_location_search_select-btn").removeClass("hidden").show()}
4140+function s3_gis_search_hierarchy(b,c,a){$("#gis_location_search_throbber").removeClass("hidden").show();$.ajax({async:!0,url:S3.gis.url+"/"+b+".json",dataType:"json",success:function(e){if(e[0].id==b){var f=e[0].name,g=e[0].level,e=e[0].parent;$("body").data(g,b);$("#gis_location_"+g+"_search").val(f);$("#gis_location_"+g+"_label__row").removeClass("hidden").show();$("#gis_location_"+g+"_search__row").removeClass("hidden").show();c&&e?s3_gis_search_hierarchy(e,!0,!0):a&&($("#gis_location_search_throbber").hide(),
4141 $("#gis_location_search_select-btn").removeClass("hidden").show())}}})}function s3_gis_show_level(b){$("#gis_location_L"+b+"_label__row").removeClass("hidden").show();$("#gis_location_L"+b+"__row").removeClass("hidden").show()}function s3_gis_hide_level(b){$("#gis_location_L"+b+"_label__row").hide();$("#gis_location_L"+b+"__row").hide()}
4142-function s3_gis_l0_select(){var b=$("#gis_location_L0").val(),e=S3.gis.url.replace("gis/location","gis/l0")+"/"+b;$.ajax({async:!0,url:e,dataType:"json",success:function(a){if(a.id==b){S3.gis.country=a.code;for(level=1;level<6;level++){var c="L"+level;a[c]?($("#gis_location_"+c+"_label__row label").text(a[c]+":"),s3_gis_show_level(level)):s3_gis_hide_level(level)}var c=$("#gis_location_lat").val(),e=$("#gis_location_lon").val();if(!c&&!e){var c=a.lon_min,e=a.lat_min,f=a.lon_max,j=a.lat_max;if(c&&
4143-e&&f&&j)s3_gis_zoomMap(c,e,f,j);else if(c=a.lat,e=a.lon,c&&e)a=new OpenLayers.LonLat(e,c),a.transform(S3.gis.proj4326,S3.gis.projection_current),S3.gis.mapWin.rendered?map.setCenter(a):S3.gis.mapPanel.center=a}}}});$("#gis_location_L1_ac").autocomplete("option","source",s3_gis_ac_set_source(1));$("#gis_location_L2_ac").autocomplete("option","source",s3_gis_ac_set_source(2));$("#gis_location_L3_ac").autocomplete("option","source",s3_gis_ac_set_source(3));$("#gis_location_L4_ac").autocomplete("option",
4144+function s3_gis_l0_select(){var b=$("#gis_location_L0").val(),c=S3.gis.url.replace("gis/location","gis/l0")+"/"+b;$.ajax({async:!0,url:c,dataType:"json",success:function(a){if(a.id==b){S3.gis.country=a.code;for(level=1;level<6;level++){var c="L"+level;a[c]?($("#gis_location_"+c+"_label__row label").text(a[c]+":"),s3_gis_show_level(level)):s3_gis_hide_level(level)}var c=$("#gis_location_lat").val(),f=$("#gis_location_lon").val();if(!c&&!f){var c=a.lon_min,f=a.lat_min,g=a.lon_max,h=a.lat_max;if(c&&
4145+f&&g&&h)s3_gis_zoomMap(c,f,g,h);else if(c=a.lat,f=a.lon,c&&f)a=new OpenLayers.LonLat(f,c),a.transform(S3.gis.proj4326,S3.gis.projection_current),S3.gis.mapWin.rendered?map.setCenter(a):S3.gis.mapPanel.center=a}}}});$("#gis_location_L1_ac").autocomplete("option","source",s3_gis_ac_set_source(1));$("#gis_location_L2_ac").autocomplete("option","source",s3_gis_ac_set_source(2));$("#gis_location_L3_ac").autocomplete("option","source",s3_gis_ac_set_source(3));$("#gis_location_L4_ac").autocomplete("option",
4146 "source",s3_gis_ac_set_source(4));$("#gis_location_L5_ac").autocomplete("option","source",s3_gis_ac_set_source(5))}
4147-function s3_gis_zoomMap(b,e,a,c){if(S3.gis.mapWin.rendered)e=new OpenLayers.LonLat(b,e),c=new OpenLayers.LonLat(a,c),e.transform(S3.gis.proj4326,S3.gis.projection_current),c.transform(S3.gis.proj4326,S3.gis.projection_current),b=e.lon,e=e.lat,a=c.lon,c=c.lat;a=OpenLayers.Bounds.fromArray([b,e,a,c]);b=a.getCenterLonLat();a=map.getZoomForExtent(a,!0);a>16&&(a=16);S3.gis.mapWin.rendered?(map.setCenter(b),map.zoomTo(a)):(b.transform(S3.gis.proj4326,S3.gis.projection_current),S3.gis.mapPanel.center=b,
4148+function s3_gis_zoomMap(b,c,a,e){if(S3.gis.mapWin.rendered)c=new OpenLayers.LonLat(b,c),e=new OpenLayers.LonLat(a,e),c.transform(S3.gis.proj4326,S3.gis.projection_current),e.transform(S3.gis.proj4326,S3.gis.projection_current),b=c.lon,c=c.lat,a=e.lon,e=e.lat;a=OpenLayers.Bounds.fromArray([b,c,a,e]);b=a.getCenterLonLat();a=map.getZoomForExtent(a,!0);a>16&&(a=16);S3.gis.mapWin.rendered?(map.setCenter(b),map.zoomTo(a)):(b.transform(S3.gis.proj4326,S3.gis.projection_current),S3.gis.mapPanel.center=b,
4149 S3.gis.mapPanel.zoom=a)}function s3_gis_hide_selector(){$(".locselect").hide()}function s3_gis_hide_selector_all(){$("#gis_location_label_row").hide();$(".subheading").hide();s3_gis_hide_selector()}function s3_gis_show_selector(){$("#gis_location_label_row").show();$(".subheading").show();s3_gis_show_tab("add")}
4150 function s3_gis_show_tab(b){$("#gis_location_tabs_row").removeClass("hidden").show();if(b=="search")s3_gis_search_tab();else if(b=="add")s3_gis_add_tab();else if(b=="edit")s3_gis_edit_tab();else if(b=="view")s3_gis_view_tab();else return!1}
4151 function s3_gis_search_tab(){$("#gis_location_L0_label__row").hide();$("#gis_location_L0__row").hide();$("#gis_location_name_label__row").hide();$("#gis_location_name__row").hide();$("#gis_location_street_label__row").hide();$("#gis_location_street__row").hide();$("#gis_location_postcode_label__row").hide();$("#gis_location_postcode__row").hide();$("#gis_location_L1_label__row").hide();$("#gis_location_L1__row").hide();$("#gis_location_L2_label__row").hide();$("#gis_location_L2__row").hide();$("#gis_location_L3_label__row").hide();
4152@@ -71,303 +71,342 @@
4153 b=$("#gis_location_L2_search").val();$("#gis_location_L2_ac").val(b);b=$("#gis_location_L3_search").val();$("#gis_location_L3_ac").val(b);b=$("#gis_location_L4_search").val();$("#gis_location_L4_ac").val(b);b=$("#gis_location_L5_search").val();$("#gis_location_L5_ac").val(b);s3_gis_view_tab()}
4154 function s3_gis_hide_search_fields(){$("#gis_location_search_label__row").hide();$("#gis_location_search__row").hide();$("#gis_location_name_search__row").hide();$("#gis_location_street_search__row").hide();$("#gis_location_postcode_search__row").hide();$("#gis_location_lat_search__row").hide();$("#gis_location_lon_search__row").hide();$("#gis_location_L0_search__row").hide();$("#gis_location_L1_search__row").hide();$("#gis_location_L2_search__row").hide();$("#gis_location_L3_search__row").hide();
4155 $("#gis_location_L4_search__row").hide();$("#gis_location_L5_search__row").hide()}function s3_gis_loadGoogle(){var b=document.createElement("script");b.type="text/javascript";b.src="http://maps.google.com/maps/api/js?v=3.2&sensor=false&callback=s3_gis_initGeocoder";document.body.appendChild(b)}function s3_gis_initGeocoder(){$("#gis_location_street").blur(function(){s3_gis_geocode()});$("#gis_location_L3_ac").blur(function(){s3_gis_geocode()})}
4156-function s3_gis_geocode(){var b=$("#gis_location_lat").val(),e=$("#gis_location_lon").val();if(!b&&!e){if(b=$("#gis_location_street").val())e=b.search(/[A-z]/),b=b.substr(e);(e=$("#gis_location_L5_ac").val())&&(b+=" "+e);(e=$("#gis_location_L4_ac").val())&&(b+=" "+e);(e=$("#gis_location_L3_ac").val())&&(b+=" "+e);(e=$("#gis_location_L2_ac").val())&&(b+=" "+e);(e=$("#gis_location_L1_ac").val())&&(b+=" "+e);b={address:b};if(S3.gis.country)b.region=S3.gis.country;(new google.maps.Geocoder).geocode(b,
4157-function(b,c){if(c==google.maps.GeocoderStatus.OK){var e=b[0].geometry.location,f=e.lat(),e=e.lng(),f=new OpenLayers.LonLat(e,f);if(e=b[0].geometry.viewport){var f=e.getNorthEast(),j=e.getSouthWest(),e=j.lng(),j=j.lat(),g=f.lng(),f=f.lat();s3_gis_zoomMap(e,j,g,f)}else S3.gis.mapWin.rendered?(f.transform(S3.gis.proj4326,S3.gis.projection_current),map.setCenter(f)):S3.gis.mapPanel.center=f}else s3_debug("Geocode was not successful for the following reason",c)})}}
4158-function s3_gis_save_locations(){$("#"+S3.gis.location_id).val()||$("#"+S3.gis.location_id).val("dummy");if(S3.gis.site){var b="#"+S3.gis.site+"_name",e=$(b).val();if(e)$("#gis_location_name").val()||$("#gis_location_name").val(e);else return void 0==$("#name__error").val()&&$(b).after('<div id="name__error" class="error" style="display: block;">'+S3.i18n.gis_name_required+"</div>"),$(b).focus(),S3.navigate_away_confirm&&S3SetNavigateAwayConfirm(),!1}var b=$("#gis_location_L1").val(),a=$("#gis_location_L2").val(),
4159-c=$("#gis_location_L3").val(),h=$("#gis_location_L4").val(),f=$("#gis_location_L5").val();if(!$("#gis_location_L0").val()){var e=S3.gis.site?"":$("#gis_location_name").val(),j=$("#gis_location_street").val(),g=$("#gis_location_postcode").val(),k=$("#gis_location_lat").val(),n=$("#gis_location_lon").val();if(b||a||c||h||f||e||j||g||k||n)return void 0==$("#country__error").val()&&$("#gis_location_L0").after('<div id="country__error" class="error" style="display: block;">'+S3.i18n.gis_country_required+
4160-"</div>"),$("#gis_location_L0").focus(),S3.navigate_away_confirm&&S3SetNavigateAwayConfirm(),!1}b||(b=$("#gis_location_L1_ac").val())&&$("#gis_location_L1").val(b);a||(a=$("#gis_location_L2_ac").val())&&$("#gis_location_L2").val(a);c||(c=$("#gis_location_L3_ac").val())&&$("#gis_location_L3").val(c);h||(h=$("#gis_location_L4_ac").val())&&$("#gis_location_L4").val(h);f||(f=$("#gis_location_L5_ac").val())&&$("#gis_location_L5").val(f);$("#gis_location_L0").removeAttr("disabled");$("#gis_location_name").removeAttr("disabled");
4161+function s3_gis_geocode(){var b=$("#gis_location_lat").val(),c=$("#gis_location_lon").val();if(!b&&!c){if(b=$("#gis_location_street").val())c=b.search(/[A-z]/),b=b.substr(c);(c=$("#gis_location_L5_ac").val())&&(b+=" "+c);(c=$("#gis_location_L4_ac").val())&&(b+=" "+c);(c=$("#gis_location_L3_ac").val())&&(b+=" "+c);(c=$("#gis_location_L2_ac").val())&&(b+=" "+c);(c=$("#gis_location_L1_ac").val())&&(b+=" "+c);b={address:b};if(S3.gis.country)b.region=S3.gis.country;(new google.maps.Geocoder).geocode(b,
4162+function(b,c){if(c==google.maps.GeocoderStatus.OK){var f=b[0].geometry.location,g=f.lat(),f=f.lng(),g=new OpenLayers.LonLat(f,g);if(f=b[0].geometry.viewport){var g=f.getNorthEast(),h=f.getSouthWest(),f=h.lng(),h=h.lat(),j=g.lng(),g=g.lat();s3_gis_zoomMap(f,h,j,g)}else S3.gis.mapWin.rendered?(g.transform(S3.gis.proj4326,S3.gis.projection_current),map.setCenter(g)):S3.gis.mapPanel.center=g}else s3_debug("Geocode was not successful for the following reason",c)})}}
4163+function s3_gis_save_locations(){$("#"+S3.gis.location_id).val()||$("#"+S3.gis.location_id).val("dummy");if(S3.gis.site){var b="#"+S3.gis.site+"_name",c=$(b).val();if(c)$("#gis_location_name").val()||$("#gis_location_name").val(c);else return void 0==$("#name__error").val()&&$(b).after('<div id="name__error" class="error" style="display: block;">'+S3.i18n.gis_name_required+"</div>"),$(b).focus(),S3.navigate_away_confirm&&S3SetNavigateAwayConfirm(),!1}var b=$("#gis_location_L1").val(),a=$("#gis_location_L2").val(),
4164+e=$("#gis_location_L3").val(),f=$("#gis_location_L4").val(),g=$("#gis_location_L5").val();if(!$("#gis_location_L0").val()){var c=S3.gis.site?"":$("#gis_location_name").val(),h=$("#gis_location_street").val(),j=$("#gis_location_postcode").val(),k=$("#gis_location_lat").val(),p=$("#gis_location_lon").val();if(b||a||e||f||g||c||h||j||k||p)return void 0==$("#country__error").val()&&$("#gis_location_L0").after('<div id="country__error" class="error" style="display: block;">'+S3.i18n.gis_country_required+
4165+"</div>"),$("#gis_location_L0").focus(),S3.navigate_away_confirm&&S3SetNavigateAwayConfirm(),!1}b||(b=$("#gis_location_L1_ac").val())&&$("#gis_location_L1").val(b);a||(a=$("#gis_location_L2_ac").val())&&$("#gis_location_L2").val(a);e||(e=$("#gis_location_L3_ac").val())&&$("#gis_location_L3").val(e);f||(f=$("#gis_location_L4_ac").val())&&$("#gis_location_L4").val(f);g||(g=$("#gis_location_L5_ac").val())&&$("#gis_location_L5").val(g);$("#gis_location_L0").removeAttr("disabled");$("#gis_location_name").removeAttr("disabled");
4166 $("#gis_location_street").removeAttr("disabled");$("#gis_location_postcode").removeAttr("disabled");$("#gis_location_lat").removeAttr("disabled");$("#gis_location_lon").removeAttr("disabled");return!0}
4167-(function(b){b.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var e=this,a=e.options;e.running=0;e.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
4168-e.headers=e.element.find(a.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a.disabled||b(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a.disabled||b(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a.disabled||b(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a.disabled||b(this).removeClass("ui-state-focus")});e.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
4169-if(a.navigation){var c=e.element.find("a").filter(a.navigationFilter).eq(0);if(c.length){var h=c.closest(".ui-accordion-header");e.active=h.length?h:c.closest(".ui-accordion-content").prev()}}e.active=e._findActive(e.active||a.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");e.active.next().addClass("ui-accordion-content-active");e._createIcons();e.resize();e.element.attr("role","tablist");e.headers.attr("role","tab").bind("keydown.accordion",
4170-function(b){return e._keydown(b)}).next().attr("role","tabpanel");e.headers.not(e.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();e.active.length?e.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):e.headers.eq(0).attr("tabIndex",0);b.browser.safari||e.headers.find("a").attr("tabIndex",-1);a.event&&e.headers.bind(a.event.split(" ").join(".accordion ")+".accordion",function(b){e._clickHandler.call(e,b,this);b.preventDefault()})},_createIcons:function(){var e=
4171-this.options;e.icons&&(b("<span></span>").addClass("ui-icon "+e.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(e.icons.header).toggleClass(e.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var e=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
4172-this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var a=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(e.autoHeight||e.fillHeight)&&a.css("height","");return b.Widget.prototype.destroy.call(this)},_setOption:function(e,a){b.Widget.prototype._setOption.apply(this,arguments);e=="active"&&this.activate(a);e=="icons"&&(this._destroyIcons(),
4173-a&&this._createIcons());if(e=="disabled")this.headers.add(this.headers.next())[a?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(e){if(!this.options.disabled&&!e.altKey&&!e.ctrlKey){var a=b.ui.keyCode,c=this.headers.length,h=this.headers.index(e.target),f=!1;switch(e.keyCode){case a.RIGHT:case a.DOWN:f=this.headers[(h+1)%c];break;case a.LEFT:case a.UP:f=this.headers[(h-1+c)%c];break;case a.SPACE:case a.ENTER:this._clickHandler({target:e.target},e.target),e.preventDefault()}if(f)return b(e.target).attr("tabIndex",
4174--1),b(f).attr("tabIndex",0),f.focus(),!1;return!0}},resize:function(){var e=this.options,a;if(e.fillSpace){if(b.browser.msie){var c=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}a=this.element.parent().height();b.browser.msie&&this.element.parent().css("overflow",c);this.headers.each(function(){a-=b(this).outerHeight(!0)});this.headers.next().each(function(){b(this).height(Math.max(0,a-b(this).innerHeight()+b(this).height()))}).css("overflow","auto")}else e.autoHeight&&
4175-(a=0,this.headers.next().each(function(){a=Math.max(a,b(this).height("").height())}).height(a));return this},activate:function(b){this.options.active=b;b=this._findActive(b)[0];this._clickHandler({target:b},b);return this},_findActive:function(e){return e?typeof e==="number"?this.headers.filter(":eq("+e+")"):this.headers.not(this.headers.not(e)):e===!1?b([]):this.headers.filter(":eq(0)")},_clickHandler:function(e,a){var c=this.options;if(!c.disabled)if(e.target){var h=b(e.currentTarget||a),f=h[0]===
4176-this.active[0];c.active=c.collapsible&&f?!1:this.headers.index(h);if(!(this.running||!c.collapsible&&f)){var j=this.active,g=h.next(),k=this.active.next(),n={options:c,newHeader:f&&c.collapsible?b([]):h,oldHeader:this.active,newContent:f&&c.collapsible?b([]):g,oldContent:k},p=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=f?b([]):h;this._toggle(g,k,n,f,p);j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(c.icons.headerSelected).addClass(c.icons.header);
4177-f||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(c.icons.header).addClass(c.icons.headerSelected),h.next().addClass("ui-accordion-content-active"))}}else if(c.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(c.icons.headerSelected).addClass(c.icons.header);this.active.next().addClass("ui-accordion-content-active");var k=this.active.next(),
4178-n={options:c,newHeader:b([]),oldHeader:c.active,newContent:b([]),oldContent:k},g=this.active=b([]);this._toggle(g,k,n)}},_toggle:function(e,a,c,h,f){var j=this,g=j.options;j.toShow=e;j.toHide=a;j.data=c;var k=function(){if(j)return j._completed.apply(j,arguments)};j._trigger("changestart",null,j.data);j.running=a.size()===0?e.size():a.size();if(g.animated){c={};c=g.collapsible&&h?{toShow:b([]),toHide:a,complete:k,down:f,autoHeight:g.autoHeight||g.fillSpace}:{toShow:e,toHide:a,complete:k,down:f,autoHeight:g.autoHeight||
4179-g.fillSpace};if(!g.proxied)g.proxied=g.animated;if(!g.proxiedDuration)g.proxiedDuration=g.duration;g.animated=b.isFunction(g.proxied)?g.proxied(c):g.proxied;g.duration=b.isFunction(g.proxiedDuration)?g.proxiedDuration(c):g.proxiedDuration;var h=b.ui.accordion.animations,n=g.duration,p=g.animated;p&&!h[p]&&!b.easing[p]&&(p="slide");h[p]||(h[p]=function(b){this.slide(b,{easing:p,duration:n||700})});h[p](c)}else g.collapsible&&h?e.toggle():(a.hide(),e.show()),k(!0);a.prev().attr({"aria-expanded":"false",
4180-"aria-selected":"false",tabIndex:-1}).blur();e.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(b){this.running=b?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});b.extend(b.ui.accordion,{version:"1.8.13",
4181-animations:{slide:function(e,a){e=b.extend({easing:"swing",duration:300},e,a);if(e.toHide.size())if(e.toShow.size()){var c=e.toShow.css("overflow"),h=0,f={},j={},g,k=e.toShow;g=k[0].style.width;k.width(parseInt(k.parent().width(),10)-parseInt(k.css("paddingLeft"),10)-parseInt(k.css("paddingRight"),10)-(parseInt(k.css("borderLeftWidth"),10)||0)-(parseInt(k.css("borderRightWidth"),10)||0));b.each(["height","paddingTop","paddingBottom"],function(g,a){j[a]="hide";var c=(""+b.css(e.toShow[0],a)).match(/^([\d+-.]+)(.*)$/);
4182-f[a]={value:c[1],unit:c[2]||"px"}});e.toShow.css({height:0,overflow:"hidden"}).show();e.toHide.filter(":hidden").each(e.complete).end().filter(":visible").animate(j,{step:function(b,g){g.prop=="height"&&(h=g.end-g.start===0?0:(g.now-g.start)/(g.end-g.start));e.toShow[0].style[g.prop]=h*f[g.prop].value+f[g.prop].unit},duration:e.duration,easing:e.easing,complete:function(){e.autoHeight||e.toShow.css("height","");e.toShow.css({width:g,overflow:c});e.complete()}})}else e.toHide.animate({height:"hide",
4183-paddingTop:"hide",paddingBottom:"hide"},e);else e.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},e)},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1E3:200})}}})})(jQuery);function fncPrepItem(b){for(var e=0;e<b.length;e++)if(b[e].quantity==1)return b[e].name}function fncRepresentItem(b,e){return b.quantity==1?b.name:b.name+" ("+b.quantity+" x "+e+")"}
4184-$(document).ready(function(){var b;$("#inv_send_item_item_pack_id").change(function(){try{b.abort()}catch(e){}$("#TotalQuantity").remove();$("#inv_quantity_ajax_throbber").length==0&&$('[name = "quantity"]').after('<div id="inv_quantity_ajax_throbber" class="ajax_throbber" style="float:right"/>');var a=S3.Ap.concat("/inv/inv_item_quantity/"+$('[name = "inv_item_id"]').val());b=$.getJSON(a,function(b){var a=b.inv_inv_item.quantity,b=b.supply_item_pack.quantity,f=$('[name = "item_pack_id"] option:selected').text(),
4185-e=/\(([0-9]*)\sx/.exec(f);TotalQuantity='<span id = "TotalQuantity"> / '+(a*b/(e==null?1:e[1])).toFixed(2)+" "+f+" ("+S3.i18n.in_inv+")</span>";$("#inv_quantity_ajax_throbber").remove();$('[name = "quantity"]').after(TotalQuantity)})});$(".quantity.ajax_more").live("click",function(b){b.preventDefault();var b=$(this),a,c;if(b.hasClass("collapsed")){b.hasClass("fulfil")?(c="inv",a="recv"):b.hasClass("transit")?(a="send",c="inv"):b.hasClass("commit")&&(a="commit",c="req");b.after('<div class="ajax_throbber quantity_req_ajax_throbber"/>').removeClass("collapsed").addClass("expanded");
4186-var h=/req_item\/(\d*).*/i.exec($(".action-btn",b.parent().parent().parent()).attr("href"))[1],h=S3.Ap.concat("/",c,"/",a,"_item_json/",h);$.ajax({url:h,dataType:"json",context:b,success:function(b){RecvTable='<table class="recv_table">';for(i=0;i<b.length;i++)RecvTable+="<tr><td>",i==0?RecvTable+=b[0].id:(RecvURL=S3.Ap.concat("/",c,"/",a,"/",a,"_item/",b[i].id),RecvTable+="<a href = '"+RecvURL+"'>",b[i].date!=null?(RecvTable+=b[i].date.substring(0,10)+" - ",RecvTable+=b[i].name+"</a>"):RecvTable+=
4187+(function(b){b.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var c=this,a=c.options;c.running=0;c.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
4188+c.headers=c.element.find(a.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a.disabled||b(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a.disabled||b(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a.disabled||b(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a.disabled||b(this).removeClass("ui-state-focus")});c.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
4189+if(a.navigation){var e=c.element.find("a").filter(a.navigationFilter).eq(0);if(e.length){var f=e.closest(".ui-accordion-header");c.active=f.length?f:e.closest(".ui-accordion-content").prev()}}c.active=c._findActive(c.active||a.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");c.active.next().addClass("ui-accordion-content-active");c._createIcons();c.resize();c.element.attr("role","tablist");c.headers.attr("role","tab").bind("keydown.accordion",
4190+function(b){return c._keydown(b)}).next().attr("role","tabpanel");c.headers.not(c.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();c.active.length?c.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):c.headers.eq(0).attr("tabIndex",0);b.browser.safari||c.headers.find("a").attr("tabIndex",-1);a.event&&c.headers.bind(a.event.split(" ").join(".accordion ")+".accordion",function(b){c._clickHandler.call(c,b,this);b.preventDefault()})},_createIcons:function(){var c=
4191+this.options;c.icons&&(b("<span></span>").addClass("ui-icon "+c.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(c.icons.header).toggleClass(c.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
4192+this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var a=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(c.autoHeight||c.fillHeight)&&a.css("height","");return b.Widget.prototype.destroy.call(this)},_setOption:function(c,a){b.Widget.prototype._setOption.apply(this,arguments);c=="active"&&this.activate(a);c=="icons"&&(this._destroyIcons(),
4193+a&&this._createIcons());if(c=="disabled")this.headers.add(this.headers.next())[a?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(c){if(!this.options.disabled&&!c.altKey&&!c.ctrlKey){var a=b.ui.keyCode,e=this.headers.length,f=this.headers.index(c.target),g=!1;switch(c.keyCode){case a.RIGHT:case a.DOWN:g=this.headers[(f+1)%e];break;case a.LEFT:case a.UP:g=this.headers[(f-1+e)%e];break;case a.SPACE:case a.ENTER:this._clickHandler({target:c.target},c.target),c.preventDefault()}if(g)return b(c.target).attr("tabIndex",
4194+-1),b(g).attr("tabIndex",0),g.focus(),!1;return!0}},resize:function(){var c=this.options,a;if(c.fillSpace){if(b.browser.msie){var e=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}a=this.element.parent().height();b.browser.msie&&this.element.parent().css("overflow",e);this.headers.each(function(){a-=b(this).outerHeight(!0)});this.headers.next().each(function(){b(this).height(Math.max(0,a-b(this).innerHeight()+b(this).height()))}).css("overflow","auto")}else c.autoHeight&&
4195+(a=0,this.headers.next().each(function(){a=Math.max(a,b(this).height("").height())}).height(a));return this},activate:function(b){this.options.active=b;b=this._findActive(b)[0];this._clickHandler({target:b},b);return this},_findActive:function(c){return c?typeof c==="number"?this.headers.filter(":eq("+c+")"):this.headers.not(this.headers.not(c)):c===!1?b([]):this.headers.filter(":eq(0)")},_clickHandler:function(c,a){var e=this.options;if(!e.disabled)if(c.target){var f=b(c.currentTarget||a),g=f[0]===
4196+this.active[0];e.active=e.collapsible&&g?!1:this.headers.index(f);if(!(this.running||!e.collapsible&&g)){var h=this.active,j=f.next(),k=this.active.next(),p={options:e,newHeader:g&&e.collapsible?b([]):f,oldHeader:this.active,newContent:g&&e.collapsible?b([]):j,oldContent:k},n=this.headers.index(this.active[0])>this.headers.index(f[0]);this.active=g?b([]):f;this._toggle(j,k,p,g,n);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(e.icons.headerSelected).addClass(e.icons.header);
4197+g||(f.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(e.icons.header).addClass(e.icons.headerSelected),f.next().addClass("ui-accordion-content-active"))}}else if(e.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(e.icons.headerSelected).addClass(e.icons.header);this.active.next().addClass("ui-accordion-content-active");var k=this.active.next(),
4198+p={options:e,newHeader:b([]),oldHeader:e.active,newContent:b([]),oldContent:k},j=this.active=b([]);this._toggle(j,k,p)}},_toggle:function(c,a,e,f,g){var h=this,j=h.options;h.toShow=c;h.toHide=a;h.data=e;var k=function(){if(h)return h._completed.apply(h,arguments)};h._trigger("changestart",null,h.data);h.running=a.size()===0?c.size():a.size();if(j.animated){e={};e=j.collapsible&&f?{toShow:b([]),toHide:a,complete:k,down:g,autoHeight:j.autoHeight||j.fillSpace}:{toShow:c,toHide:a,complete:k,down:g,autoHeight:j.autoHeight||
4199+j.fillSpace};if(!j.proxied)j.proxied=j.animated;if(!j.proxiedDuration)j.proxiedDuration=j.duration;j.animated=b.isFunction(j.proxied)?j.proxied(e):j.proxied;j.duration=b.isFunction(j.proxiedDuration)?j.proxiedDuration(e):j.proxiedDuration;var f=b.ui.accordion.animations,p=j.duration,n=j.animated;n&&!f[n]&&!b.easing[n]&&(n="slide");f[n]||(f[n]=function(b){this.slide(b,{easing:n,duration:p||700})});f[n](e)}else j.collapsible&&f?c.toggle():(a.hide(),c.show()),k(!0);a.prev().attr({"aria-expanded":"false",
4200+"aria-selected":"false",tabIndex:-1}).blur();c.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(b){this.running=b?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});b.extend(b.ui.accordion,{version:"1.8.13",
4201+animations:{slide:function(c,a){c=b.extend({easing:"swing",duration:300},c,a);if(c.toHide.size())if(c.toShow.size()){var e=c.toShow.css("overflow"),f=0,g={},h={},j,k=c.toShow;j=k[0].style.width;k.width(parseInt(k.parent().width(),10)-parseInt(k.css("paddingLeft"),10)-parseInt(k.css("paddingRight"),10)-(parseInt(k.css("borderLeftWidth"),10)||0)-(parseInt(k.css("borderRightWidth"),10)||0));b.each(["height","paddingTop","paddingBottom"],function(a,j){h[j]="hide";var e=(""+b.css(c.toShow[0],j)).match(/^([\d+-.]+)(.*)$/);
4202+g[j]={value:e[1],unit:e[2]||"px"}});c.toShow.css({height:0,overflow:"hidden"}).show();c.toHide.filter(":hidden").each(c.complete).end().filter(":visible").animate(h,{step:function(b,a){a.prop=="height"&&(f=a.end-a.start===0?0:(a.now-a.start)/(a.end-a.start));c.toShow[0].style[a.prop]=f*g[a.prop].value+g[a.prop].unit},duration:c.duration,easing:c.easing,complete:function(){c.autoHeight||c.toShow.css("height","");c.toShow.css({width:j,overflow:e});c.complete()}})}else c.toHide.animate({height:"hide",
4203+paddingTop:"hide",paddingBottom:"hide"},c);else c.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},c)},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1E3:200})}}})})(jQuery);function fncPrepItem(b){for(var c=0;c<b.length;c++)if(b[c].quantity==1)return b[c].name}function fncRepresentItem(b,c){return b.quantity==1?b.name:b.name+" ("+b.quantity+" x "+c+")"}
4204+$(document).ready(function(){var b;$("#inv_send_item_item_pack_id").change(function(){try{b.abort()}catch(c){}$("#TotalQuantity").remove();$("#inv_quantity_ajax_throbber").length==0&&$('[name = "quantity"]').after('<div id="inv_quantity_ajax_throbber" class="ajax_throbber" style="float:right"/>');var a=S3.Ap.concat("/inv/inv_item_quantity/"+$('[name = "inv_item_id"]').val());b=$.getJSON(a,function(b){var a=b.inv_inv_item.quantity,b=b.supply_item_pack.quantity,c=$('[name = "item_pack_id"] option:selected').text(),
4205+h=/\(([0-9]*)\sx/.exec(c);TotalQuantity='<span id = "TotalQuantity"> / '+(a*b/(h==null?1:h[1])).toFixed(2)+" "+c+" ("+S3.i18n.in_inv+")</span>";$("#inv_quantity_ajax_throbber").remove();$('[name = "quantity"]').after(TotalQuantity)})});$(".quantity.ajax_more").live("click",function(b){b.preventDefault();var b=$(this),a,e;if(b.hasClass("collapsed")){b.hasClass("fulfil")?(e="inv",a="recv"):b.hasClass("transit")?(a="send",e="inv"):b.hasClass("commit")&&(a="commit",e="req");b.after('<div class="ajax_throbber quantity_req_ajax_throbber"/>').removeClass("collapsed").addClass("expanded");
4206+var f=/req_item\/(\d*).*/i.exec($(".action-btn",b.parent().parent().parent()).attr("href"))[1],f=S3.Ap.concat("/",e,"/",a,"_item_json/",f);$.ajax({url:f,dataType:"json",context:b,success:function(b){RecvTable='<table class="recv_table">';for(i=0;i<b.length;i++)RecvTable+="<tr><td>",i==0?RecvTable+=b[0].id:(RecvURL=S3.Ap.concat("/",e,"/",a,"/",a,"_item/",b[i].id),RecvTable+="<a href = '"+RecvURL+"'>",b[i].date!=null?(RecvTable+=b[i].date.substring(0,10)+" - ",RecvTable+=b[i].name+"</a>"):RecvTable+=
4207 " - </a>"),RecvTable+="</td><td>"+b[i].quantity+"</td></tr>";RecvTable+="</table>";$(".quantity_req_ajax_throbber",this.parent()).remove();this.parent().after(RecvTable)}})}else b.removeClass("expanded").addClass("collapsed"),$(".recv_table",b.parent().parent()).remove()});$('[name="site_or_location"]').change(function(){$("#asset_log_site_or_location").length==0&&($('[id^="asset_log_site_id__row"]').hide(),$('tr[id^="gis_location"]').hide(),$('span[id^="gis_loc"]').hide(),$("#gis_location_map-btn").hide(),
4208 $("td.subheading").hide());$('[name="site_or_location"]:checked').val()=="1"?($('[id^="asset_log_site_id__row"]').show(),$('[name="site_id"]').val()&&$('[id^="asset_log_room_id__row"]').show(),$('tr[id^="gis_location"]').hide(),$('span[id^="gis_loc"]').hide(),$("#gis_location_map-btn").hide(),$("td.subheading").hide()):$('[name="site_or_location"]:checked').val()=="2"&&($('[id^="asset_log_site_id__row"]').hide(),$('[id^="asset_log_room_id__row"]').hide(),$('tr[id^="gis_location"]').show(),$('span[id^="gis_loc"]').show(),
4209-$("#gis_location_map-btn").show(),$("td.subheading").show())});$('[name="site_or_location"]').change();$("#asset_log_site_id").change(function(){if($("#asset_log_person_id").val()!=""||$("#asset_log_organisation_id").val()!=""){try{b.abort()}catch(e){}var a=$("#asset_log_site_id").val();a!=""?($("#dummy_asset_log_organisation_id").after('<div id="organisation_ajax_throbber" class="ajax_throbber"/>').hide(),a=S3.Ap.concat("/org/site_org_json/",a),b=$.ajax({url:a,dataType:"json",success:function(b){$("#organisation_ajax_throbber").remove();
4210-b.length>0?($("#dummy_asset_log_organisation_id").show().val(b[0].name).attr("disabled","disabled"),$("#asset_log_organisation_id").val(b[0].id)):($("#dummy_asset_log_organisation_id").show().val("").removeAttr("disabled"),$("#asset_log_organisation_id").val(""))}})):($("#dummy_asset_log_organisation_id").val("").removeAttr("disabled"),$("#asset_log_organisation_id").val(""))}});$("#asset_log_person_id").change(function(){try{b.abort()}catch(e){}$("#asset_log_site_id").change(function(){});var a=
4211+$("#gis_location_map-btn").show(),$("td.subheading").show())});$('[name="site_or_location"]').change();$("#asset_log_site_id").change(function(){if($("#asset_log_person_id").val()!=""||$("#asset_log_organisation_id").val()!=""){try{b.abort()}catch(c){}var a=$("#asset_log_site_id").val();a!=""?($("#dummy_asset_log_organisation_id").after('<div id="organisation_ajax_throbber" class="ajax_throbber"/>').hide(),a=S3.Ap.concat("/org/site_org_json/",a),b=$.ajax({url:a,dataType:"json",success:function(b){$("#organisation_ajax_throbber").remove();
4212+b.length>0?($("#dummy_asset_log_organisation_id").show().val(b[0].name).attr("disabled","disabled"),$("#asset_log_organisation_id").val(b[0].id)):($("#dummy_asset_log_organisation_id").show().val("").removeAttr("disabled"),$("#asset_log_organisation_id").val(""))}})):($("#dummy_asset_log_organisation_id").val("").removeAttr("disabled"),$("#asset_log_organisation_id").val(""))}});$("#asset_log_person_id").change(function(){try{b.abort()}catch(c){}$("#asset_log_site_id").change(function(){});var a=
4213 $("#asset_log_person_id").val();a!=""?($("#asset_log_site_id").after('<div id="site_ajax_throbber" class="ajax_throbber"/>').hide(),$("#dummy_asset_log_organisation_id").after('<div id="organisation_ajax_throbber" class="ajax_throbber"/>').hide(),a=S3.Ap.concat("/hrm/staff_org_site_json/",a),b=$.ajax({url:a,dataType:"json",success:function(b){$("#site_ajax_throbber").remove();$("#organisation_ajax_throbber").remove();b.length>0?($("#dummy_asset_log_organisation_id").show().val(b[0].name).attr("disabled",
4214 "disabled"),$("#asset_log_organisation_id").val(b[0].id),$("#asset_log_site_id").show().val(b[0].site_id).attr("disabled","disabled").change()):($("#dummy_asset_log_organisation_id").show().val("").removeAttr("disabled"),$("#asset_log_organisation_id").val(""),$("#asset_log_site_id").show().val("").removeAttr("disabled").change())}})):($("#asset_log_site_id").show().val("").removeAttr("disabled").change(),$("#asset_log_organisation_id").val(""),$("#dummy_asset_log_organisation_id").val("").removeAttr("disabled"))})});
4215-(function(b){b.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var e=this.options,a=e.accept;this.isover=0;this.isout=1;this.accept=b.isFunction(a)?a:function(b){return b.is(a)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[e.scope]=b.ui.ddmanager.droppables[e.scope]||[];b.ui.ddmanager.droppables[e.scope].push(this);
4216-e.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var e=b.ui.ddmanager.droppables[this.options.scope],a=0;a<e.length;a++)e[a]==this&&e.splice(a,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(e,a){if(e=="accept")this.accept=b.isFunction(a)?a:function(b){return b.is(a)};b.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var a=b.ui.ddmanager.current;this.options.activeClass&&
4217-this.element.addClass(this.options.activeClass);a&&this._trigger("activate",e,this.ui(a))},_deactivate:function(e){var a=b.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);a&&this._trigger("deactivate",e,this.ui(a))},_over:function(e){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",
4218-e,this.ui(a))},_out:function(e){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(a))},_drop:function(e,a){var c=a||b.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return!1;var h=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var a=b.data(this,
4219-"droppable");if(a.options.greedy&&!a.options.disabled&&a.options.scope==c.options.scope&&a.accept.call(a.element[0],c.currentItem||c.element)&&b.ui.intersect(c,b.extend(a,{offset:a.element.offset()}),a.options.tolerance))return h=!0,!1});if(h)return!1;if(this.accept.call(this.element[0],c.currentItem||c.element))return this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(c)),
4220-this.element;return!1},ui:function(b){return{draggable:b.currentItem||b.element,helper:b.helper,position:b.position,offset:b.positionAbs}}});b.extend(b.ui.droppable,{version:"1.8.13"});b.ui.intersect=function(e,a,c){if(!a.offset)return!1;var h=(e.positionAbs||e.position.absolute).left,f=h+e.helperProportions.width,j=(e.positionAbs||e.position.absolute).top,g=j+e.helperProportions.height,k=a.offset.left,n=k+a.proportions.width,p=a.offset.top,o=p+a.proportions.height;switch(c){case "fit":return k<=
4221-h&&f<=n&&p<=j&&g<=o;case "intersect":return k<h+e.helperProportions.width/2&&f-e.helperProportions.width/2<n&&p<j+e.helperProportions.height/2&&g-e.helperProportions.height/2<o;case "pointer":return b.ui.isOver((e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,p,k,a.proportions.height,a.proportions.width);case "touch":return(j>=p&&j<=o||g>=p&&g<=o||j<p&&g>o)&&(h>=k&&h<=n||f>=k&&f<=n||h<k&&f>n);
4222-default:return!1}};b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,a){var c=b.ui.ddmanager.droppables[e.options.scope]||[],h=a?a.type:null,f=(e.currentItem||e.element).find(":data(droppable)").andSelf(),j=0;a:for(;j<c.length;j++)if(!(c[j].options.disabled||e&&!c[j].accept.call(c[j].element[0],e.currentItem||e.element))){for(var g=0;g<f.length;g++)if(f[g]==c[j].element[0]){c[j].proportions.height=0;continue a}c[j].visible=c[j].element.css("display")!="none";if(c[j].visible)h==
4223-"mousedown"&&c[j]._activate.call(c[j],a),c[j].offset=c[j].element.offset(),c[j].proportions={width:c[j].element[0].offsetWidth,height:c[j].element[0].offsetHeight}}},drop:function(e,a){var c=!1;b.each(b.ui.ddmanager.droppables[e.options.scope]||[],function(){if(this.options&&(!this.options.disabled&&this.visible&&b.ui.intersect(e,this,this.options.tolerance)&&(c=c||this._drop.call(this,a)),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)))this.isout=
4224-1,this.isover=0,this._deactivate.call(this,a)});return c},drag:function(e,a){e.options.refreshPositions&&b.ui.ddmanager.prepareOffsets(e,a);b.each(b.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var c=b.ui.intersect(e,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var h;if(this.options.greedy){var f=this.element.parents(":data(droppable):eq(0)");if(f.length)h=b.data(f[0],"droppable"),
4225-h.greedyChild=c=="isover"?1:0}if(h&&c=="isover")h.isover=0,h.isout=1,h._out.call(h,a);this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,a);if(h&&c=="isout")h.isout=0,h.isover=1,h._over.call(h,a)}}})}}})(jQuery);
4226+(function(b){b.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var c=this.options,a=c.accept;this.isover=0;this.isout=1;this.accept=b.isFunction(a)?a:function(b){return b.is(a)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[c.scope]=b.ui.ddmanager.droppables[c.scope]||[];b.ui.ddmanager.droppables[c.scope].push(this);
4227+c.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var c=b.ui.ddmanager.droppables[this.options.scope],a=0;a<c.length;a++)c[a]==this&&c.splice(a,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(c,a){if(c=="accept")this.accept=b.isFunction(a)?a:function(b){return b.is(a)};b.Widget.prototype._setOption.apply(this,arguments)},_activate:function(c){var a=b.ui.ddmanager.current;this.options.activeClass&&
4228+this.element.addClass(this.options.activeClass);a&&this._trigger("activate",c,this.ui(a))},_deactivate:function(c){var a=b.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);a&&this._trigger("deactivate",c,this.ui(a))},_over:function(c){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",
4229+c,this.ui(a))},_out:function(c){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",c,this.ui(a))},_drop:function(c,a){var e=a||b.ui.ddmanager.current;if(!e||(e.currentItem||e.element)[0]==this.element[0])return!1;var f=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var a=b.data(this,
4230+"droppable");if(a.options.greedy&&!a.options.disabled&&a.options.scope==e.options.scope&&a.accept.call(a.element[0],e.currentItem||e.element)&&b.ui.intersect(e,b.extend(a,{offset:a.element.offset()}),a.options.tolerance))return f=!0,!1});if(f)return!1;if(this.accept.call(this.element[0],e.currentItem||e.element))return 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)),
4231+this.element;return!1},ui:function(b){return{draggable:b.currentItem||b.element,helper:b.helper,position:b.position,offset:b.positionAbs}}});b.extend(b.ui.droppable,{version:"1.8.13"});b.ui.intersect=function(c,a,e){if(!a.offset)return!1;var f=(c.positionAbs||c.position.absolute).left,g=f+c.helperProportions.width,h=(c.positionAbs||c.position.absolute).top,j=h+c.helperProportions.height,k=a.offset.left,p=k+a.proportions.width,n=a.offset.top,o=n+a.proportions.height;switch(e){case "fit":return k<=
4232+f&&g<=p&&n<=h&&j<=o;case "intersect":return k<f+c.helperProportions.width/2&&g-c.helperProportions.width/2<p&&n<h+c.helperProportions.height/2&&j-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,n,k,a.proportions.height,a.proportions.width);case "touch":return(h>=n&&h<=o||j>=n&&j<=o||h<n&&j>o)&&(f>=k&&f<=p||g>=k&&g<=p||f<k&&g>p);
4233+default:return!1}};b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(c,a){var e=b.ui.ddmanager.droppables[c.options.scope]||[],f=a?a.type:null,g=(c.currentItem||c.element).find(":data(droppable)").andSelf(),h=0;a:for(;h<e.length;h++)if(!(e[h].options.disabled||c&&!e[h].accept.call(e[h].element[0],c.currentItem||c.element))){for(var j=0;j<g.length;j++)if(g[j]==e[h].element[0]){e[h].proportions.height=0;continue a}e[h].visible=e[h].element.css("display")!="none";if(e[h].visible)f==
4234+"mousedown"&&e[h]._activate.call(e[h],a),e[h].offset=e[h].element.offset(),e[h].proportions={width:e[h].element[0].offsetWidth,height:e[h].element[0].offsetHeight}}},drop:function(c,a){var e=!1;b.each(b.ui.ddmanager.droppables[c.options.scope]||[],function(){if(this.options&&(!this.options.disabled&&this.visible&&b.ui.intersect(c,this,this.options.tolerance)&&(e=e||this._drop.call(this,a)),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],c.currentItem||c.element)))this.isout=
4235+1,this.isover=0,this._deactivate.call(this,a)});return e},drag:function(c,a){c.options.refreshPositions&&b.ui.ddmanager.prepareOffsets(c,a);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 f;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length)f=b.data(g[0],"droppable"),
4236+f.greedyChild=e=="isover"?1:0}if(f&&e=="isover")f.isover=0,f.isout=1,f._out.call(f,a);this[e]=1;this[e=="isout"?"isover":"isout"]=0;this[e=="isover"?"_over":"_out"].call(this,a);if(f&&e=="isout")f.isout=0,f.isover=1,f._over.call(f,a)}}})}}})(jQuery);
4237 (function(b){b.widget("ui.draggable",b.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){if(this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position=
4238-"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"))return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(e){var a=this.options;if(this.helper||a.disabled||b(e.target).is(".ui-resizable-handle"))return!1;
4239-this.handle=this._getHandle(e);if(!this.handle)return!1;b(a.iframeFix===!0?"iframe":a.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")});return!0},_mouseStart:function(e){var a=this.options;this.helper=this._createHelper(e);this._cacheHelperProportions();if(b.ui.ddmanager)b.ui.ddmanager.current=this;
4240-this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};b.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=
4241-e.pageY;a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt);a.containment&&this._setContainment();if(this._trigger("start",e)===!1)return this._clear(),!1;this._cacheHelperProportions();b.ui.ddmanager&&!a.dropBehaviour&&b.ui.ddmanager.prepareOffsets(this,e);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(e,!0);return!0},_mouseDrag:function(e,a){this.position=this._generatePosition(e);this.positionAbs=this._convertPositionTo("absolute");if(!a){var c=this._uiHash();if(this._trigger("drag",
4242-e,c)===!1)return this._mouseUp({}),!1;this.position=c.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+"px";b.ui.ddmanager&&b.ui.ddmanager.drag(this,e);return!1},_mouseStop:function(e){var a=!1;b.ui.ddmanager&&!this.options.dropBehaviour&&(a=b.ui.ddmanager.drop(this,e));if(this.dropped)a=this.dropped,this.dropped=!1;if((!this.element[0]||!this.element[0].parentNode)&&
4243-this.options.helper=="original")return!1;if(this.options.revert=="invalid"&&!a||this.options.revert=="valid"&&a||this.options.revert===!0||b.isFunction(this.options.revert)&&this.options.revert.call(this.element,a)){var c=this;b(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",e)!==!1&&c._clear()})}else this._trigger("stop",e)!==!1&&this._clear();return!1},_mouseUp:function(e){this.options.iframeFix===!0&&b("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});
4244-return b.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(e){var a=!this.options.handle||!b(this.options.handle,this.element).length?!0:!1;b(this.options.handle,this.element).find("*").andSelf().each(function(){this==e.target&&(a=!0)});return a},_createHelper:function(e){var a=this.options,e=b.isFunction(a.helper)?b(a.helper.apply(this.element[0],[e])):a.helper=="clone"?this.element.clone().removeAttr("id"):
4245-this.element;e.parents("body").length||e.appendTo(a.appendTo=="parent"?this.element[0].parentNode:a.appendTo);e[0]!=this.element[0]&&!/(fixed|absolute)/.test(e.css("position"))&&e.css("position","absolute");return e},_adjustOffsetFromHelper:function(e){typeof e=="string"&&(e=e.split(" "));b.isArray(e)&&(e={left:+e[0],top:+e[1]||0});if("left"in e)this.offset.click.left=e.left+this.margins.left;if("right"in e)this.offset.click.left=this.helperProportions.width-e.right+this.margins.left;if("top"in e)this.offset.click.top=
4246-e.top+this.margins.top;if("bottom"in e)this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==
4247-"html"&&b.browser.msie)e={top:0,left:0};return{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins=
4248-{left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent")e.containment=this.helper[0].parentNode;if(e.containment=="document"||e.containment=="window")this.containment=
4249-[(e.containment=="document"?0:b(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(e.containment=="document"?0:b(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(e.containment=="document"?0:b(window).scrollLeft())+b(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(e.containment=="document"?0:b(window).scrollTop())+(b(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-
4250-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(e.containment)&&e.containment.constructor!=Array){var e=b(e.containment),a=e[0];if(a){e.offset();var c=b(a).css("overflow")!="hidden";this.containment=[(parseInt(b(a).css("borderLeftWidth"),10)||0)+(parseInt(b(a).css("paddingLeft"),10)||0),(parseInt(b(a).css("borderTopWidth"),10)||0)+(parseInt(b(a).css("paddingTop"),10)||0),(c?Math.max(a.scrollWidth,a.offsetWidth):a.offsetWidth)-(parseInt(b(a).css("borderLeftWidth"),
4251-10)||0)-(parseInt(b(a).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(a.scrollHeight,a.offsetHeight):a.offsetHeight)-(parseInt(b(a).css("borderTopWidth"),10)||0)-(parseInt(b(a).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=e}}else if(e.containment.constructor==Array)this.containment=e.containment},_convertPositionTo:function(e,a){if(!a)a=this.position;var c=e=="absolute"?
4252-1:-1,h=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(h[0].tagName);return{top:a.top+this.offset.relative.top*c+this.offset.parent.top*c-(b.browser.safari&&b.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:h.scrollTop())*c),left:a.left+this.offset.relative.left*c+this.offset.parent.left*c-(b.browser.safari&&
4253-b.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:h.scrollLeft())*c)}},_generatePosition:function(e){var a=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,h=/(html|body)/i.test(c[0].tagName),f=e.pageX,j=e.pageY;if(this.originalPosition){var g;if(this.containment)this.relative_container?(g=this.relative_container.offset(),
4254-g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]):g=this.containment,e.pageX-this.offset.click.left<g[0]&&(f=g[0]+this.offset.click.left),e.pageY-this.offset.click.top<g[1]&&(j=g[1]+this.offset.click.top),e.pageX-this.offset.click.left>g[2]&&(f=g[2]+this.offset.click.left),e.pageY-this.offset.click.top>g[3]&&(j=g[3]+this.offset.click.top);a.grid&&(j=this.originalPageY+Math.round((j-this.originalPageY)/a.grid[1])*a.grid[1],j=g?!(j-this.offset.click.top<
4255-g[1]||j-this.offset.click.top>g[3])?j:!(j-this.offset.click.top<g[1])?j-a.grid[1]:j+a.grid[1]:j,f=this.originalPageX+Math.round((f-this.originalPageX)/a.grid[0])*a.grid[0],f=g?!(f-this.offset.click.left<g[0]||f-this.offset.click.left>g[2])?f:!(f-this.offset.click.left<g[0])?f-a.grid[0]:f+a.grid[0]:f)}return{top:j-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(b.browser.safari&&b.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():
4256-h?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(b.browser.safari&&b.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():h?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=!1},_trigger:function(e,a,c){c=c||this._uiHash();b.ui.plugin.call(this,
4257-e,[a,c]);if(e=="drag")this.positionAbs=this._convertPositionTo("absolute");return b.Widget.prototype._trigger.call(this,e,a,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});b.extend(b.ui.draggable,{version:"1.8.13"});b.ui.plugin.add("draggable","connectToSortable",{start:function(e,a){var c=b(this).data("draggable"),h=c.options,f=b.extend({},a,{item:c.element});c.sortables=[];b(h.connectToSortable).each(function(){var a=
4258-b.data(this,"sortable");a&&!a.options.disabled&&(c.sortables.push({instance:a,shouldRevert:a.options.revert}),a.refreshPositions(),a._trigger("activate",e,f))})},stop:function(e,a){var c=b(this).data("draggable"),h=b.extend({},a,{item:c.element});b.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=!0;this.instance.cancelHelperRemoval=!1;if(this.shouldRevert)this.instance.options.revert=!0;this.instance._mouseStop(e);this.instance.options.helper=this.instance.options._helper;
4259-c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,h)})},drag:function(e,a){var c=b(this).data("draggable"),h=this;b.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver)this.instance.isOver=
4260-1,this.instance.currentItem=b(h).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return a.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=c.offset.click.top,this.instance.offset.click.left=c.offset.click.left,this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left,
4261-this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top,c._trigger("toSortable",e),c.dropped=this.instance.element,c.currentItem=c.element,this.instance.fromOutside=c;this.instance.currentItem&&this.instance._mouseDrag(e)}else if(this.instance.isOver)this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=
4262-this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),c._trigger("fromSortable",e),c.dropped=!1})}});b.ui.plugin.add("draggable","cursor",{start:function(){var e=b("body"),a=b(this).data("draggable").options;if(e.css("cursor"))a._cursor=e.css("cursor");e.css("cursor",a.cursor)},stop:function(){var e=b(this).data("draggable").options;e._cursor&&b("body").css("cursor",e._cursor)}});b.ui.plugin.add("draggable","opacity",{start:function(e,
4263-a){var c=b(a.helper),h=b(this).data("draggable").options;if(c.css("opacity"))h._opacity=c.css("opacity");c.css("opacity",h.opacity)},stop:function(e,a){var c=b(this).data("draggable").options;c._opacity&&b(a.helper).css("opacity",c._opacity)}});b.ui.plugin.add("draggable","scroll",{start:function(){var e=b(this).data("draggable");if(e.scrollParent[0]!=document&&e.scrollParent[0].tagName!="HTML")e.overflowOffset=e.scrollParent.offset()},drag:function(e){var a=b(this).data("draggable"),c=a.options,
4264-h=!1;if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(a.overflowOffset.top+a.scrollParent[0].offsetHeight-e.pageY<c.scrollSensitivity)a.scrollParent[0].scrollTop=h=a.scrollParent[0].scrollTop+c.scrollSpeed;else if(e.pageY-a.overflowOffset.top<c.scrollSensitivity)a.scrollParent[0].scrollTop=h=a.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(a.overflowOffset.left+a.scrollParent[0].offsetWidth-e.pageX<c.scrollSensitivity)a.scrollParent[0].scrollLeft=
4265-h=a.scrollParent[0].scrollLeft+c.scrollSpeed;else if(e.pageX-a.overflowOffset.left<c.scrollSensitivity)a.scrollParent[0].scrollLeft=h=a.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")e.pageY-b(document).scrollTop()<c.scrollSensitivity?h=b(document).scrollTop(b(document).scrollTop()-c.scrollSpeed):b(window).height()-(e.pageY-b(document).scrollTop())<c.scrollSensitivity&&(h=b(document).scrollTop(b(document).scrollTop()+c.scrollSpeed));if(!c.axis||c.axis!="y")e.pageX-b(document).scrollLeft()<
4266-c.scrollSensitivity?h=b(document).scrollLeft(b(document).scrollLeft()-c.scrollSpeed):b(window).width()-(e.pageX-b(document).scrollLeft())<c.scrollSensitivity&&(h=b(document).scrollLeft(b(document).scrollLeft()+c.scrollSpeed))}h!==!1&&b.ui.ddmanager&&!c.dropBehaviour&&b.ui.ddmanager.prepareOffsets(a,e)}});b.ui.plugin.add("draggable","snap",{start:function(){var e=b(this).data("draggable"),a=e.options;e.snapElements=[];b(a.snap.constructor!=String?a.snap.items||":data(draggable)":a.snap).each(function(){var a=
4267-b(this),h=a.offset();this!=e.element[0]&&e.snapElements.push({item:this,width:a.outerWidth(),height:a.outerHeight(),top:h.top,left:h.left})})},drag:function(e,a){for(var c=b(this).data("draggable"),h=c.options,f=h.snapTolerance,j=a.offset.left,g=j+c.helperProportions.width,k=a.offset.top,n=k+c.helperProportions.height,p=c.snapElements.length-1;p>=0;p--){var o=c.snapElements[p].left,s=o+c.snapElements[p].width,v=c.snapElements[p].top,t=v+c.snapElements[p].height;if(o-f<j&&j<s+f&&v-f<k&&k<t+f||o-f<
4268-j&&j<s+f&&v-f<n&&n<t+f||o-f<g&&g<s+f&&v-f<k&&k<t+f||o-f<g&&g<s+f&&v-f<n&&n<t+f){if(h.snapMode!="inner"){var u=Math.abs(v-n)<=f,r=Math.abs(t-k)<=f,m=Math.abs(o-g)<=f,x=Math.abs(s-j)<=f;if(u)a.position.top=c._convertPositionTo("relative",{top:v-c.helperProportions.height,left:0}).top-c.margins.top;if(r)a.position.top=c._convertPositionTo("relative",{top:t,left:0}).top-c.margins.top;if(m)a.position.left=c._convertPositionTo("relative",{top:0,left:o-c.helperProportions.width}).left-c.margins.left;if(x)a.position.left=
4269-c._convertPositionTo("relative",{top:0,left:s}).left-c.margins.left}var z=u||r||m||x;if(h.snapMode!="outer"){u=Math.abs(v-k)<=f;r=Math.abs(t-n)<=f;m=Math.abs(o-j)<=f;x=Math.abs(s-g)<=f;if(u)a.position.top=c._convertPositionTo("relative",{top:v,left:0}).top-c.margins.top;if(r)a.position.top=c._convertPositionTo("relative",{top:t-c.helperProportions.height,left:0}).top-c.margins.top;if(m)a.position.left=c._convertPositionTo("relative",{top:0,left:o}).left-c.margins.left;if(x)a.position.left=c._convertPositionTo("relative",
4270-{top:0,left:s-c.helperProportions.width}).left-c.margins.left}!c.snapElements[p].snapping&&(u||r||m||x||z)&&c.options.snap.snap&&c.options.snap.snap.call(c.element,e,b.extend(c._uiHash(),{snapItem:c.snapElements[p].item}));c.snapElements[p].snapping=u||r||m||x||z}else c.snapElements[p].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,e,b.extend(c._uiHash(),{snapItem:c.snapElements[p].item})),c.snapElements[p].snapping=!1}}});b.ui.plugin.add("draggable","stack",{start:function(){var e=
4271-b(this).data("draggable").options,e=b.makeArray(b(e.stack)).sort(function(a,e){return(parseInt(b(a).css("zIndex"),10)||0)-(parseInt(b(e).css("zIndex"),10)||0)});if(e.length){var a=parseInt(e[0].style.zIndex)||0;b(e).each(function(b){this.style.zIndex=a+b});this[0].style.zIndex=a+e.length}}});b.ui.plugin.add("draggable","zIndex",{start:function(e,a){var c=b(a.helper),h=b(this).data("draggable").options;if(c.css("zIndex"))h._zIndex=c.css("zIndex");c.css("zIndex",h.zIndex)},stop:function(e,a){var c=
4272-b(this).data("draggable").options;c._zIndex&&b(a.helper).css("zIndex",c._zIndex)}})})(jQuery);
4273-(function(b,e){function a(){this.debug=!1;this._curInst=null;this._keyEvent=!1;this._disabledInputs=[];this._inDialog=this._datepickerShowing=!1;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
4274+"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"))return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(c){var a=this.options;if(this.helper||a.disabled||b(c.target).is(".ui-resizable-handle"))return!1;
4275+this.handle=this._getHandle(c);if(!this.handle)return!1;b(a.iframeFix===!0?"iframe":a.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")});return!0},_mouseStart:function(c){var a=this.options;this.helper=this._createHelper(c);this._cacheHelperProportions();if(b.ui.ddmanager)b.ui.ddmanager.current=this;
4276+this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();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.position=this._generatePosition(c);this.originalPageX=c.pageX;this.originalPageY=
4277+c.pageY;a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt);a.containment&&this._setContainment();if(this._trigger("start",c)===!1)return this._clear(),!1;this._cacheHelperProportions();b.ui.ddmanager&&!a.dropBehaviour&&b.ui.ddmanager.prepareOffsets(this,c);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(c,!0);return!0},_mouseDrag:function(c,a){this.position=this._generatePosition(c);this.positionAbs=this._convertPositionTo("absolute");if(!a){var e=this._uiHash();if(this._trigger("drag",
4278+c,e)===!1)return this._mouseUp({}),!1;this.position=e.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+"px";b.ui.ddmanager&&b.ui.ddmanager.drag(this,c);return!1},_mouseStop:function(c){var a=!1;b.ui.ddmanager&&!this.options.dropBehaviour&&(a=b.ui.ddmanager.drop(this,c));if(this.dropped)a=this.dropped,this.dropped=!1;if((!this.element[0]||!this.element[0].parentNode)&&
4279+this.options.helper=="original")return!1;if(this.options.revert=="invalid"&&!a||this.options.revert=="valid"&&a||this.options.revert===!0||b.isFunction(this.options.revert)&&this.options.revert.call(this.element,a)){var e=this;b(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){e._trigger("stop",c)!==!1&&e._clear()})}else this._trigger("stop",c)!==!1&&this._clear();return!1},_mouseUp:function(c){this.options.iframeFix===!0&&b("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});
4280+return b.ui.mouse.prototype._mouseUp.call(this,c)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(c){var a=!this.options.handle||!b(this.options.handle,this.element).length?!0:!1;b(this.options.handle,this.element).find("*").andSelf().each(function(){this==c.target&&(a=!0)});return a},_createHelper:function(c){var a=this.options,c=b.isFunction(a.helper)?b(a.helper.apply(this.element[0],[c])):a.helper=="clone"?this.element.clone().removeAttr("id"):
4281+this.element;c.parents("body").length||c.appendTo(a.appendTo=="parent"?this.element[0].parentNode:a.appendTo);c[0]!=this.element[0]&&!/(fixed|absolute)/.test(c.css("position"))&&c.css("position","absolute");return c},_adjustOffsetFromHelper:function(c){typeof c=="string"&&(c=c.split(" "));b.isArray(c)&&(c={left:+c[0],top:+c[1]||0});if("left"in c)this.offset.click.left=c.left+this.margins.left;if("right"in c)this.offset.click.left=this.helperProportions.width-c.right+this.margins.left;if("top"in c)this.offset.click.top=
4282+c.top+this.margins.top;if("bottom"in c)this.offset.click.top=this.helperProportions.height-c.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var c=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(c.left+=this.scrollParent.scrollLeft(),c.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==
4283+"html"&&b.browser.msie)c={top:0,left:0};return{top:c.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:c.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins=
4284+{left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var c=this.options;if(c.containment=="parent")c.containment=this.helper[0].parentNode;if(c.containment=="document"||c.containment=="window")this.containment=
4285+[(c.containment=="document"?0:b(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(c.containment=="document"?0:b(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(c.containment=="document"?0:b(window).scrollLeft())+b(c.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(c.containment=="document"?0:b(window).scrollTop())+(b(c.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-
4286+this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(c.containment)&&c.containment.constructor!=Array){var c=b(c.containment),a=c[0];if(a){c.offset();var e=b(a).css("overflow")!="hidden";this.containment=[(parseInt(b(a).css("borderLeftWidth"),10)||0)+(parseInt(b(a).css("paddingLeft"),10)||0),(parseInt(b(a).css("borderTopWidth"),10)||0)+(parseInt(b(a).css("paddingTop"),10)||0),(e?Math.max(a.scrollWidth,a.offsetWidth):a.offsetWidth)-(parseInt(b(a).css("borderLeftWidth"),
4287+10)||0)-(parseInt(b(a).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(a.scrollHeight,a.offsetHeight):a.offsetHeight)-(parseInt(b(a).css("borderTopWidth"),10)||0)-(parseInt(b(a).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=c}}else if(c.containment.constructor==Array)this.containment=c.containment},_convertPositionTo:function(c,a){if(!a)a=this.position;var e=c=="absolute"?
4288+1:-1,f=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(f[0].tagName);return{top:a.top+this.offset.relative.top*e+this.offset.parent.top*e-(b.browser.safari&&b.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*e),left:a.left+this.offset.relative.left*e+this.offset.parent.left*e-(b.browser.safari&&
4289+b.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*e)}},_generatePosition:function(c){var a=this.options,e=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(e[0].tagName),g=c.pageX,h=c.pageY;if(this.originalPosition){var j;if(this.containment)this.relative_container?(j=this.relative_container.offset(),
4290+j=[this.containment[0]+j.left,this.containment[1]+j.top,this.containment[2]+j.left,this.containment[3]+j.top]):j=this.containment,c.pageX-this.offset.click.left<j[0]&&(g=j[0]+this.offset.click.left),c.pageY-this.offset.click.top<j[1]&&(h=j[1]+this.offset.click.top),c.pageX-this.offset.click.left>j[2]&&(g=j[2]+this.offset.click.left),c.pageY-this.offset.click.top>j[3]&&(h=j[3]+this.offset.click.top);a.grid&&(h=this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1],h=j?!(h-this.offset.click.top<
4291+j[1]||h-this.offset.click.top>j[3])?h:!(h-this.offset.click.top<j[1])?h-a.grid[1]:h+a.grid[1]:h,g=this.originalPageX+Math.round((g-this.originalPageX)/a.grid[0])*a.grid[0],g=j?!(g-this.offset.click.left<j[0]||g-this.offset.click.left>j[2])?g:!(g-this.offset.click.left<j[0])?g-a.grid[0]:g+a.grid[0]:g)}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(b.browser.safari&&b.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():
4292+f?0:e.scrollTop()),left:g-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(b.browser.safari&&b.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:e.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=!1},_trigger:function(c,a,e){e=e||this._uiHash();b.ui.plugin.call(this,
4293+c,[a,e]);if(c=="drag")this.positionAbs=this._convertPositionTo("absolute");return b.Widget.prototype._trigger.call(this,c,a,e)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});b.extend(b.ui.draggable,{version:"1.8.13"});b.ui.plugin.add("draggable","connectToSortable",{start:function(c,a){var e=b(this).data("draggable"),f=e.options,g=b.extend({},a,{item:e.element});e.sortables=[];b(f.connectToSortable).each(function(){var a=
4294+b.data(this,"sortable");a&&!a.options.disabled&&(e.sortables.push({instance:a,shouldRevert:a.options.revert}),a.refreshPositions(),a._trigger("activate",c,g))})},stop:function(c,a){var e=b(this).data("draggable"),f=b.extend({},a,{item:e.element});b.each(e.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;e.cancelHelperRemoval=!0;this.instance.cancelHelperRemoval=!1;if(this.shouldRevert)this.instance.options.revert=!0;this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;
4295+e.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",c,f)})},drag:function(c,a){var e=b(this).data("draggable"),f=this;b.each(e.sortables,function(){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver)this.instance.isOver=
4296+1,this.instance.currentItem=b(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return a.helper[0]},c.target=this.instance.currentItem[0],this.instance._mouseCapture(c,!0),this.instance._mouseStart(c,!0,!0),this.instance.offset.click.top=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,
4297+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=!0,this.instance.options.revert=!1,this.instance._trigger("out",c,this.instance._uiHash(this.instance)),this.instance._mouseStop(c,!0),this.instance.options.helper=
4298+this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),e._trigger("fromSortable",c),e.dropped=!1})}});b.ui.plugin.add("draggable","cursor",{start:function(){var c=b("body"),a=b(this).data("draggable").options;if(c.css("cursor"))a._cursor=c.css("cursor");c.css("cursor",a.cursor)},stop:function(){var c=b(this).data("draggable").options;c._cursor&&b("body").css("cursor",c._cursor)}});b.ui.plugin.add("draggable","opacity",{start:function(c,
4299+a){var e=b(a.helper),f=b(this).data("draggable").options;if(e.css("opacity"))f._opacity=e.css("opacity");e.css("opacity",f.opacity)},stop:function(c,a){var e=b(this).data("draggable").options;e._opacity&&b(a.helper).css("opacity",e._opacity)}});b.ui.plugin.add("draggable","scroll",{start:function(){var c=b(this).data("draggable");if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML")c.overflowOffset=c.scrollParent.offset()},drag:function(c){var a=b(this).data("draggable"),e=a.options,
4300+f=!1;if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")if(a.overflowOffset.top+a.scrollParent[0].offsetHeight-c.pageY<e.scrollSensitivity)a.scrollParent[0].scrollTop=f=a.scrollParent[0].scrollTop+e.scrollSpeed;else if(c.pageY-a.overflowOffset.top<e.scrollSensitivity)a.scrollParent[0].scrollTop=f=a.scrollParent[0].scrollTop-e.scrollSpeed;if(!e.axis||e.axis!="y")if(a.overflowOffset.left+a.scrollParent[0].offsetWidth-c.pageX<e.scrollSensitivity)a.scrollParent[0].scrollLeft=
4301+f=a.scrollParent[0].scrollLeft+e.scrollSpeed;else if(c.pageX-a.overflowOffset.left<e.scrollSensitivity)a.scrollParent[0].scrollLeft=f=a.scrollParent[0].scrollLeft-e.scrollSpeed}else{if(!e.axis||e.axis!="x")c.pageY-b(document).scrollTop()<e.scrollSensitivity?f=b(document).scrollTop(b(document).scrollTop()-e.scrollSpeed):b(window).height()-(c.pageY-b(document).scrollTop())<e.scrollSensitivity&&(f=b(document).scrollTop(b(document).scrollTop()+e.scrollSpeed));if(!e.axis||e.axis!="y")c.pageX-b(document).scrollLeft()<
4302+e.scrollSensitivity?f=b(document).scrollLeft(b(document).scrollLeft()-e.scrollSpeed):b(window).width()-(c.pageX-b(document).scrollLeft())<e.scrollSensitivity&&(f=b(document).scrollLeft(b(document).scrollLeft()+e.scrollSpeed))}f!==!1&&b.ui.ddmanager&&!e.dropBehaviour&&b.ui.ddmanager.prepareOffsets(a,c)}});b.ui.plugin.add("draggable","snap",{start:function(){var c=b(this).data("draggable"),a=c.options;c.snapElements=[];b(a.snap.constructor!=String?a.snap.items||":data(draggable)":a.snap).each(function(){var a=
4303+b(this),f=a.offset();this!=c.element[0]&&c.snapElements.push({item:this,width:a.outerWidth(),height:a.outerHeight(),top:f.top,left:f.left})})},drag:function(c,a){for(var e=b(this).data("draggable"),f=e.options,g=f.snapTolerance,h=a.offset.left,j=h+e.helperProportions.width,k=a.offset.top,p=k+e.helperProportions.height,n=e.snapElements.length-1;n>=0;n--){var o=e.snapElements[n].left,t=o+e.snapElements[n].width,v=e.snapElements[n].top,s=v+e.snapElements[n].height;if(o-g<h&&h<t+g&&v-g<k&&k<s+g||o-g<
4304+h&&h<t+g&&v-g<p&&p<s+g||o-g<j&&j<t+g&&v-g<k&&k<s+g||o-g<j&&j<t+g&&v-g<p&&p<s+g){if(f.snapMode!="inner"){var u=Math.abs(v-p)<=g,r=Math.abs(s-k)<=g,m=Math.abs(o-j)<=g,x=Math.abs(t-h)<=g;if(u)a.position.top=e._convertPositionTo("relative",{top:v-e.helperProportions.height,left:0}).top-e.margins.top;if(r)a.position.top=e._convertPositionTo("relative",{top:s,left:0}).top-e.margins.top;if(m)a.position.left=e._convertPositionTo("relative",{top:0,left:o-e.helperProportions.width}).left-e.margins.left;if(x)a.position.left=
4305+e._convertPositionTo("relative",{top:0,left:t}).left-e.margins.left}var z=u||r||m||x;if(f.snapMode!="outer"){u=Math.abs(v-k)<=g;r=Math.abs(s-p)<=g;m=Math.abs(o-h)<=g;x=Math.abs(t-j)<=g;if(u)a.position.top=e._convertPositionTo("relative",{top:v,left:0}).top-e.margins.top;if(r)a.position.top=e._convertPositionTo("relative",{top:s-e.helperProportions.height,left:0}).top-e.margins.top;if(m)a.position.left=e._convertPositionTo("relative",{top:0,left:o}).left-e.margins.left;if(x)a.position.left=e._convertPositionTo("relative",
4306+{top:0,left:t-e.helperProportions.width}).left-e.margins.left}!e.snapElements[n].snapping&&(u||r||m||x||z)&&e.options.snap.snap&&e.options.snap.snap.call(e.element,c,b.extend(e._uiHash(),{snapItem:e.snapElements[n].item}));e.snapElements[n].snapping=u||r||m||x||z}else e.snapElements[n].snapping&&e.options.snap.release&&e.options.snap.release.call(e.element,c,b.extend(e._uiHash(),{snapItem:e.snapElements[n].item})),e.snapElements[n].snapping=!1}}});b.ui.plugin.add("draggable","stack",{start:function(){var c=
4307+b(this).data("draggable").options,c=b.makeArray(b(c.stack)).sort(function(a,c){return(parseInt(b(a).css("zIndex"),10)||0)-(parseInt(b(c).css("zIndex"),10)||0)});if(c.length){var a=parseInt(c[0].style.zIndex)||0;b(c).each(function(b){this.style.zIndex=a+b});this[0].style.zIndex=a+c.length}}});b.ui.plugin.add("draggable","zIndex",{start:function(c,a){var e=b(a.helper),f=b(this).data("draggable").options;if(e.css("zIndex"))f._zIndex=e.css("zIndex");e.css("zIndex",f.zIndex)},stop:function(c,a){var e=
4308+b(this).data("draggable").options;e._zIndex&&b(a.helper).css("zIndex",e._zIndex)}})})(jQuery);
4309+(function(b){b.widget("ui.sortable",b.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();
4310+this.floating=this.items.length?b.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData("sortable-item");return this},_setOption:function(c,a){c==="disabled"?(this.options[c]=
4311+a,this.widget()[a?"addClass":"removeClass"]("ui-sortable-disabled")):b.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(c,a){if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(c);var e=null,f=this;b(c.target).parents().each(function(){if(b.data(this,"sortable-item")==f)return e=b(this),!1});b.data(c.target,"sortable-item")==f&&(e=b(c.target));if(!e)return!1;if(this.options.handle&&!a){var g=!1;b(this.options.handle,
4312+e).find("*").andSelf().each(function(){this==c.target&&(g=!0)});if(!g)return!1}this.currentItem=e;this._removeCurrentsFromItems();return!0},_mouseStart:function(c,a,e){a=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(c);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position",
4313+"absolute");this.cssPosition=this.helper.css("position");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;a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();
4314+this._createPlaceholder();a.containment&&this._setContainment();if(a.cursor){if(b("body").css("cursor"))this._storedCursor=b("body").css("cursor");b("body").css("cursor",a.cursor)}if(a.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",a.opacity)}if(a.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",a.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=
4315+this.scrollParent.offset();this._trigger("start",c,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!e)for(e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("activate",c,this._uiHash(this));if(b.ui.ddmanager)b.ui.ddmanager.current=this;b.ui.ddmanager&&!a.dropBehaviour&&b.ui.ddmanager.prepareOffsets(this,c);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(c);return!0},_mouseDrag:function(c){this.position=this._generatePosition(c);
4316+this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var a=this.options,e=!1;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-c.pageY<a.scrollSensitivity)this.scrollParent[0].scrollTop=e=this.scrollParent[0].scrollTop+a.scrollSpeed;else if(c.pageY-this.overflowOffset.top<a.scrollSensitivity)this.scrollParent[0].scrollTop=e=this.scrollParent[0].scrollTop-
4317+a.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-c.pageX<a.scrollSensitivity)this.scrollParent[0].scrollLeft=e=this.scrollParent[0].scrollLeft+a.scrollSpeed;else if(c.pageX-this.overflowOffset.left<a.scrollSensitivity)this.scrollParent[0].scrollLeft=e=this.scrollParent[0].scrollLeft-a.scrollSpeed}else c.pageY-b(document).scrollTop()<a.scrollSensitivity?e=b(document).scrollTop(b(document).scrollTop()-a.scrollSpeed):b(window).height()-(c.pageY-b(document).scrollTop())<a.scrollSensitivity&&
4318+(e=b(document).scrollTop(b(document).scrollTop()+a.scrollSpeed)),c.pageX-b(document).scrollLeft()<a.scrollSensitivity?e=b(document).scrollLeft(b(document).scrollLeft()-a.scrollSpeed):b(window).width()-(c.pageX-b(document).scrollLeft())<a.scrollSensitivity&&(e=b(document).scrollLeft(b(document).scrollLeft()+a.scrollSpeed));e!==!1&&b.ui.ddmanager&&!a.dropBehaviour&&b.ui.ddmanager.prepareOffsets(this,c)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=
4319+this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(a=this.items.length-1;a>=0;a--){var e=this.items[a],f=e.item[0],g=this._intersectsWithPointer(e);if(g&&f!=this.currentItem[0]&&this.placeholder[g==1?"next":"prev"]()[0]!=f&&!b.ui.contains(this.placeholder[0],f)&&(this.options.type=="semi-dynamic"?!b.ui.contains(this.element[0],f):1)){this.direction=g==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e))this._rearrange(c,
4320+e);else break;this._trigger("change",c,this._uiHash());break}}this._contactContainers(c);b.ui.ddmanager&&b.ui.ddmanager.drag(this,c);this._trigger("sort",c,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(c,a){if(c){b.ui.ddmanager&&!this.options.dropBehaviour&&b.ui.ddmanager.drop(this,c);if(this.options.revert){var e=this,f=e.placeholder.offset();e.reverting=!0;b(this.helper).animate({left:f.left-this.offset.parent.left-e.margins.left+(this.offsetParent[0]==document.body?
4321+0:this.offsetParent[0].scrollLeft),top:f.top-this.offset.parent.top-e.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){e._clear(c)})}else this._clear(c,a);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)if(this.containers[c]._trigger("deactivate",
4322+null,this._uiHash(this)),this.containers[c].containerCache.over)this.containers[c]._trigger("out",null,this._uiHash(this)),this.containers[c].containerCache.over=0}this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),b.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?b(this.domPosition.prev).after(this.currentItem):
4323+b(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(c){var a=this._getItemsAsjQuery(c&&c.connected),e=[],c=c||{};b(a).each(function(){var a=(b(c.item||this).attr(c.attribute||"id")||"").match(c.expression||/(.+)[-=_](.+)/);a&&e.push((c.key||a[1]+"[]")+"="+(c.key&&c.expression?a[1]:a[2]))});!e.length&&c.key&&e.push(c.key+"=");return e.join("&")},toArray:function(c){var a=this._getItemsAsjQuery(c&&c.connected),e=[],c=c||{};a.each(function(){e.push(b(c.item||this).attr(c.attribute||
4324+"id")||"")});return e},_intersectsWith:function(b){var a=this.positionAbs.left,e=a+this.helperProportions.width,f=this.positionAbs.top,g=f+this.helperProportions.height,h=b.left,j=h+b.width,k=b.top,p=k+b.height,n=this.offset.click.top,o=this.offset.click.left;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>b[this.floating?"width":"height"]?f+n>k&&f+n<p&&a+o>h&&a+o<j:h<a+this.helperProportions.width/
4325+2&&e-this.helperProportions.width/2<j&&k<f+this.helperProportions.height/2&&g-this.helperProportions.height/2<p},_intersectsWithPointer:function(c){var a=b.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,c.top,c.height),c=b.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,c.left,c.width),a=a&&c,c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();if(!a)return!1;return this.floating?e&&e=="right"||c=="down"?2:1:c&&(c=="down"?2:1)},_intersectsWithSides:function(c){var a=
4326+b.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,c.top+c.height/2,c.height),c=b.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,c.left+c.width/2,c.width),e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return this.floating&&f?f=="right"&&c||f=="left"&&!c:e&&(e=="down"&&a||e=="up"&&!a)},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-
4327+this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions();return this},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(c){var a=[],e=[],f=this._connectWith();if(f&&c)for(c=f.length-1;c>=0;c--)for(var g=b(f[c]),h=g.length-1;h>=0;h--){var j=b.data(g[h],"sortable");j&&j!=this&&!j.options.disabled&&e.push([b.isFunction(j.options.items)?j.options.items.call(j.element):
4328+b(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}e.push([b.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):b(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(c=e.length-1;c>=0;c--)e[c][0].each(function(){a.push(this)});return b(a)},_removeCurrentsFromItems:function(){for(var b=this.currentItem.find(":data(sortable-item)"),a=0;a<this.items.length;a++)for(var e=
4329+0;e<b.length;e++)b[e]==this.items[a].item[0]&&this.items.splice(a,1)},_refreshItems:function(c){this.items=[];this.containers=[this];var a=this.items,e=[[b.isFunction(this.options.items)?this.options.items.call(this.element[0],c,{item:this.currentItem}):b(this.options.items,this.element),this]],f=this._connectWith();if(f)for(var g=f.length-1;g>=0;g--)for(var h=b(f[g]),j=h.length-1;j>=0;j--){var k=b.data(h[j],"sortable");k&&k!=this&&!k.options.disabled&&(e.push([b.isFunction(k.options.items)?k.options.items.call(k.element[0],
4330+c,{item:this.currentItem}):b(k.options.items,k.element),k]),this.containers.push(k))}for(g=e.length-1;g>=0;g--){c=e[g][1];f=e[g][0];j=0;for(h=f.length;j<h;j++)k=b(f[j]),k.data("sortable-item",c),a.push({item:k,instance:c,width:0,height:0,left:0,top:0})}},refreshPositions:function(c){if(this.offsetParent&&this.helper)this.offset.parent=this._getParentOffset();for(var a=this.items.length-1;a>=0;a--){var e=this.items[a];if(!(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0])){var f=
4331+this.options.toleranceElement?b(this.options.toleranceElement,e.item):e.item;if(!c)e.width=f.outerWidth(),e.height=f.outerHeight();f=f.offset();e.left=f.left;e.top=f.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(a=this.containers.length-1;a>=0;a--)f=this.containers[a].element.offset(),this.containers[a].containerCache.left=f.left,this.containers[a].containerCache.top=f.top,this.containers[a].containerCache.width=this.containers[a].element.outerWidth(),
4332+this.containers[a].containerCache.height=this.containers[a].element.outerHeight();return this},_createPlaceholder:function(c){var a=c||this,e=a.options;if(!e.placeholder||e.placeholder.constructor==String){var f=e.placeholder;e.placeholder={element:function(){var c=b(document.createElement(a.currentItem[0].nodeName)).addClass(f||a.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!f)c.style.visibility="hidden";return c},update:function(b,c){if(!f||e.forcePlaceholderSize)c.height()||
4333+c.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10)),c.width()||c.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||0,10))}}}a.placeholder=b(e.placeholder.element.call(a.element,a.currentItem));a.currentItem.after(a.placeholder);e.placeholder.update(a,a.placeholder)},_contactContainers:function(c){for(var a=null,e=null,f=this.containers.length-
4334+1;f>=0;f--)if(!b.ui.contains(this.currentItem[0],this.containers[f].element[0]))if(this._intersectsWith(this.containers[f].containerCache)){if(!a||!b.ui.contains(this.containers[f].element[0],a.element[0]))a=this.containers[f],e=f}else if(this.containers[f].containerCache.over)this.containers[f]._trigger("out",c,this._uiHash(this)),this.containers[f].containerCache.over=0;if(a)if(this.containers.length===1)this.containers[e]._trigger("over",c,this._uiHash(this)),this.containers[e].containerCache.over=
4335+1;else if(this.currentContainer!=this.containers[e]){for(var a=1E4,f=null,g=this.positionAbs[this.containers[e].floating?"left":"top"],h=this.items.length-1;h>=0;h--)if(b.ui.contains(this.containers[e].element[0],this.items[h].item[0])){var j=this.items[h][this.containers[e].floating?"left":"top"];Math.abs(j-g)<a&&(a=Math.abs(j-g),f=this.items[h])}if(f||this.options.dropOnEmpty)this.currentContainer=this.containers[e],f?this._rearrange(c,f,null,!0):this._rearrange(c,null,this.containers[e].element,
4336+!0),this._trigger("change",c,this._uiHash()),this.containers[e]._trigger("change",c,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[e]._trigger("over",c,this._uiHash(this)),this.containers[e].containerCache.over=1}},_createHelper:function(c){var a=this.options,c=b.isFunction(a.helper)?b(a.helper.apply(this.element[0],[c,this.currentItem])):a.helper=="clone"?this.currentItem.clone():this.currentItem;c.parents("body").length||b(a.appendTo!=
4337+"parent"?a.appendTo:this.currentItem[0].parentNode)[0].appendChild(c[0]);if(c[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};(c[0].style.width==""||a.forceHelperSize)&&c.width(this.currentItem.width());(c[0].style.height==""||a.forceHelperSize)&&c.height(this.currentItem.height());return c},_adjustOffsetFromHelper:function(c){typeof c==
4338+"string"&&(c=c.split(" "));b.isArray(c)&&(c={left:+c[0],top:+c[1]||0});if("left"in c)this.offset.click.left=c.left+this.margins.left;if("right"in c)this.offset.click.left=this.helperProportions.width-c.right+this.margins.left;if("top"in c)this.offset.click.top=c.top+this.margins.top;if("bottom"in c)this.offset.click.top=this.helperProportions.height-c.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var c=this.offsetParent.offset();this.cssPosition==
4339+"absolute"&&this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(c.left+=this.scrollParent.scrollLeft(),c.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&b.browser.msie)c={top:0,left:0};return{top:c.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:c.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==
4340+"relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},
4341+_setContainment:function(){var c=this.options;if(c.containment=="parent")c.containment=this.helper[0].parentNode;if(c.containment=="document"||c.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,b(c.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b(c.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-
4342+this.margins.top];if(!/^(document|window|parent)$/.test(c.containment)){var a=b(c.containment)[0],c=b(c.containment).offset(),e=b(a).css("overflow")!="hidden";this.containment=[c.left+(parseInt(b(a).css("borderLeftWidth"),10)||0)+(parseInt(b(a).css("paddingLeft"),10)||0)-this.margins.left,c.top+(parseInt(b(a).css("borderTopWidth"),10)||0)+(parseInt(b(a).css("paddingTop"),10)||0)-this.margins.top,c.left+(e?Math.max(a.scrollWidth,a.offsetWidth):a.offsetWidth)-(parseInt(b(a).css("borderLeftWidth"),10)||
4343+0)-(parseInt(b(a).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,c.top+(e?Math.max(a.scrollHeight,a.offsetHeight):a.offsetHeight)-(parseInt(b(a).css("borderTopWidth"),10)||0)-(parseInt(b(a).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(c,a){if(!a)a=this.position;var e=c=="absolute"?1:-1,f=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?
4344+this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:a.top+this.offset.relative.top*e+this.offset.parent.top*e-(b.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*e),left:a.left+this.offset.relative.left*e+this.offset.parent.left*e-(b.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*e)}},_generatePosition:function(c){var a=
4345+this.options,e=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&b.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(e[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var g=c.pageX,h=c.pageY;this.originalPosition&&(this.containment&&(c.pageX-this.offset.click.left<this.containment[0]&&(g=this.containment[0]+
4346+this.offset.click.left),c.pageY-this.offset.click.top<this.containment[1]&&(h=this.containment[1]+this.offset.click.top),c.pageX-this.offset.click.left>this.containment[2]&&(g=this.containment[2]+this.offset.click.left),c.pageY-this.offset.click.top>this.containment[3]&&(h=this.containment[3]+this.offset.click.top)),a.grid&&(h=this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1],h=this.containment?!(h-this.offset.click.top<this.containment[1]||h-this.offset.click.top>this.containment[3])?
4347+h:!(h-this.offset.click.top<this.containment[1])?h-a.grid[1]:h+a.grid[1]:h,g=this.originalPageX+Math.round((g-this.originalPageX)/a.grid[0])*a.grid[0],g=this.containment?!(g-this.offset.click.left<this.containment[0]||g-this.offset.click.left>this.containment[2])?g:!(g-this.offset.click.left<this.containment[0])?g-a.grid[0]:g+a.grid[0]:g));return{top:h-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():
4348+f?0:e.scrollTop()),left:g-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():f?0:e.scrollLeft())}},_rearrange:function(b,a,e,f){e?e[0].appendChild(this.placeholder[0]):a.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?a.item[0]:a.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var g=this,h=this.counter;window.setTimeout(function(){h==
4349+g.counter&&g.refreshPositions(!f)},0)},_clear:function(c,a){this.reverting=!1;var e=[];!this._noFinalSort&&this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var f in this._storedCSS)if(this._storedCSS[f]=="auto"||this._storedCSS[f]=="static")this._storedCSS[f]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!a&&e.push(function(b){this._trigger("receive",
4350+b,this._uiHash(this.fromOutside))});(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!a&&e.push(function(b){this._trigger("update",b,this._uiHash())});if(!b.ui.contains(this.element[0],this.currentItem[0])){a||e.push(function(b){this._trigger("remove",b,this._uiHash())});for(f=this.containers.length-1;f>=0;f--)b.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!a&&(e.push(function(b){return function(a){b._trigger("receive",
4351+a,this._uiHash(this))}}.call(this,this.containers[f])),e.push(function(b){return function(a){b._trigger("update",a,this._uiHash(this))}}.call(this,this.containers[f])))}for(f=this.containers.length-1;f>=0;f--)if(a||e.push(function(b){return function(a){b._trigger("deactivate",a,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over)e.push(function(b){return function(a){b._trigger("out",a,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=
4352+0;this._storedCursor&&b("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!a){this._trigger("beforeStop",c,this._uiHash());for(f=0;f<e.length;f++)e[f].call(this,c);this._trigger("stop",c,this._uiHash())}return!1}a||this._trigger("beforeStop",c,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
4353+this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!a){for(f=0;f<e.length;f++)e[f].call(this,c);this._trigger("stop",c,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){b.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(c){var a=c||this;return{helper:a.helper,placeholder:a.placeholder||b([]),position:a.position,originalPosition:a.originalPosition,offset:a.positionAbs,item:a.currentItem,sender:c?c.element:null}}});b.extend(b.ui.sortable,
4354+{version:"1.8.13"})})(jQuery);
4355+(function(b,c){function a(){this.debug=!1;this._curInst=null;this._keyEvent=!1;this._disabledInputs=[];this._inDialog=this._datepickerShowing=!1;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
4356 "ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
4357 "Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,
4358-maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1};b.extend(this._defaults,this.regional[""]);this.dpDiv=c(b('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function c(g){return g.delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a",
4359-"mouseout",function(){b(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&b(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&b(this).removeClass("ui-datepicker-next-hover")}).delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a","mouseover",function(){if(!b.datepicker._isDisabledDatepicker(j.inline?g.parent()[0]:j.input[0]))b(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),
4360-b(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&b(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!=-1&&b(this).addClass("ui-datepicker-next-hover")})}function h(g,a){b.extend(g,a);for(var c in a)if(a[c]==null||a[c]==e)g[c]=a[c];return g}b.extend(b.ui,{datepicker:{version:"1.8.13"}});var f=(new Date).getTime(),j;b.extend(a.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},
4361-_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(b){h(this._defaults,b||{});return this},_attachDatepicker:function(g,a){var c=null,f;for(f in this._defaults){var e=g.getAttribute("date:"+f);if(e){c=c||{};try{c[f]=eval(e)}catch(j){c[f]=e}}}f=g.nodeName.toLowerCase();e=f=="div"||f=="span";if(!g.id)this.uuid+=1,g.id="dp"+this.uuid;var h=this._newInst(b(g),e);h.settings=b.extend({},a||{},c||{});f=="input"?this._connectDatepicker(g,h):e&&this._inlineDatepicker(g,h)},_newInst:function(g,
4362-a){return{id:g[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:g,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:a,dpDiv:!a?this.dpDiv:c(b('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(g,a){var c=b(g);a.append=b([]);a.trigger=b([]);c.hasClass(this.markerClassName)||(this._attachments(c,a),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
4363-function(b,g,c){a.settings[g]=c}).bind("getData.datepicker",function(b,g){return this._get(a,g)}),this._autoSize(a),b.data(g,"datepicker",a))},_attachments:function(g,a){var c=this._get(a,"appendText"),f=this._get(a,"isRTL");a.append&&a.append.remove();if(c)a.append=b('<span class="'+this._appendClass+'">'+c+"</span>"),g[f?"before":"after"](a.append);g.unbind("focus",this._showDatepicker);a.trigger&&a.trigger.remove();c=this._get(a,"showOn");(c=="focus"||c=="both")&&g.focus(this._showDatepicker);
4364-if(c=="button"||c=="both"){var c=this._get(a,"buttonText"),e=this._get(a,"buttonImage");a.trigger=b(this._get(a,"buttonImageOnly")?b("<img/>").addClass(this._triggerClass).attr({src:e,alt:c,title:c}):b('<button type="button"></button>').addClass(this._triggerClass).html(e==""?c:b("<img/>").attr({src:e,alt:c,title:c})));g[f?"before":"after"](a.trigger);a.trigger.click(function(){b.datepicker._datepickerShowing&&b.datepicker._lastInput==g[0]?b.datepicker._hideDatepicker():b.datepicker._showDatepicker(g[0]);
4365-return!1})}},_autoSize:function(b){if(this._get(b,"autoSize")&&!b.inline){var a=new Date(2009,11,20),c=this._get(b,"dateFormat");if(c.match(/[DM]/)){var f=function(b){for(var a=0,g=0,c=0;c<b.length;c++)if(b[c].length>a)a=b[c].length,g=c;return g};a.setMonth(f(this._get(b,c.match(/MM/)?"monthNames":"monthNamesShort")));a.setDate(f(this._get(b,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())}b.input.attr("size",this._formatDate(b,a).length)}},_inlineDatepicker:function(a,c){var f=b(a);f.hasClass(this.markerClassName)||
4366-(f.addClass(this.markerClassName).append(c.dpDiv).bind("setData.datepicker",function(b,a,g){c.settings[a]=g}).bind("getData.datepicker",function(b,a){return this._get(c,a)}),b.data(a,"datepicker",c),this._setDate(c,this._getDefaultDate(c),!0),this._updateDatepicker(c),this._updateAlternate(c),c.dpDiv.show())},_dialogDatepicker:function(a,c,f,e,j){a=this._dialogInst;if(!a)this.uuid+=1,this._dialogInput=b('<input type="text" id="dp'+this.uuid+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),
4367-this._dialogInput.keydown(this._doKeyDown),b("body").append(this._dialogInput),a=this._dialogInst=this._newInst(this._dialogInput,!1),a.settings={},b.data(this._dialogInput[0],"datepicker",a);h(a.settings,e||{});c=c&&c.constructor==Date?this._formatDate(a,c):c;this._dialogInput.val(c);this._pos=j?j.length?j:[j.pageX,j.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/
4368-2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=f;this._inDialog=!0;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);b.blockUI&&b.blockUI(this.dpDiv);b.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var c=b(a),f=b.data(a,"datepicker");if(c.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();b.removeData(a,
4369-"datepicker");e=="input"?(f.append.remove(),f.trigger.remove(),c.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(e=="div"||e=="span")&&c.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var c=b(a),f=b.data(a,"datepicker");if(c.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input")a.disabled=!1,f.trigger.filter("button").each(function(){this.disabled=
4370-!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(e=="div"||e=="span")c=c.children("."+this._inlineClass),c.children().removeClass("ui-state-disabled"),c.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled");this._disabledInputs=b.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var c=b(a),f=b.data(a,"datepicker");if(c.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input")a.disabled=!0,f.trigger.filter("button").each(function(){this.disabled=
4371-!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(e=="div"||e=="span")c=c.children("."+this._inlineClass),c.children().addClass("ui-state-disabled"),c.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled");this._disabledInputs=b.map(this._disabledInputs,function(b){return b==a?null:b});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(b){if(!b)return!1;for(var a=0;a<this._disabledInputs.length;a++)if(this._disabledInputs[a]==
4372-b)return!0;return!1},_getInst:function(a){try{return b.data(a,"datepicker")}catch(c){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,c,f){var j=this._getInst(a);if(arguments.length==2&&typeof c=="string")return c=="defaults"?b.extend({},b.datepicker._defaults):j?c=="all"?b.extend({},j.settings):this._get(j,c):null;var o=c||{};typeof c=="string"&&(o={},o[c]=f);if(j){this._curInst==j&&this._hideDatepicker();var s=this._getDateDatepicker(a,!0),v=this._getMinMaxDate(j,
4373-"min"),t=this._getMinMaxDate(j,"max");h(j.settings,o);if(v!==null&&o.dateFormat!==e&&o.minDate===e)j.settings.minDate=this._formatDate(j,v);if(t!==null&&o.dateFormat!==e&&o.maxDate===e)j.settings.maxDate=this._formatDate(j,t);this._attachments(b(a),j);this._autoSize(j);this._setDate(j,s);this._updateAlternate(j);this._updateDatepicker(j)}},_changeDatepicker:function(b,a,c){this._optionDatepicker(b,a,c)},_refreshDatepicker:function(b){(b=this._getInst(b))&&this._updateDatepicker(b)},_setDateDatepicker:function(b,
4374-a){var c=this._getInst(b);c&&(this._setDate(c,a),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(b,a){var c=this._getInst(b);c&&!c.inline&&this._setDateFromField(c,a);return c?this._getDate(c):null},_doKeyDown:function(a){var c=b.datepicker._getInst(a.target),f=!0,e=c.dpDiv.is(".ui-datepicker-rtl");c._keyEvent=!0;if(b.datepicker._datepickerShowing)switch(a.keyCode){case 9:b.datepicker._hideDatepicker();f=!1;break;case 13:return f=b("td."+b.datepicker._dayOverClass+
4375-":not(."+b.datepicker._currentClass+")",c.dpDiv),f[0]?b.datepicker._selectDay(a.target,c.selectedMonth,c.selectedYear,f[0]):b.datepicker._hideDatepicker(),!1;case 27:b.datepicker._hideDatepicker();break;case 33:b.datepicker._adjustDate(a.target,a.ctrlKey?-b.datepicker._get(c,"stepBigMonths"):-b.datepicker._get(c,"stepMonths"),"M");break;case 34:b.datepicker._adjustDate(a.target,a.ctrlKey?+b.datepicker._get(c,"stepBigMonths"):+b.datepicker._get(c,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&
4376-b.datepicker._clearDate(a.target);f=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&b.datepicker._gotoToday(a.target);f=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)b.datepicker._adjustDate(a.target,e?1:-1,"D");f=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&b.datepicker._adjustDate(a.target,a.ctrlKey?-b.datepicker._get(c,"stepBigMonths"):-b.datepicker._get(c,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&b.datepicker._adjustDate(a.target,-7,"D");f=a.ctrlKey||a.metaKey;
4377-break;case 39:if(a.ctrlKey||a.metaKey)b.datepicker._adjustDate(a.target,e?-1:1,"D");f=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&b.datepicker._adjustDate(a.target,a.ctrlKey?+b.datepicker._get(c,"stepBigMonths"):+b.datepicker._get(c,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&b.datepicker._adjustDate(a.target,7,"D");f=a.ctrlKey||a.metaKey;break;default:f=!1}else a.keyCode==36&&a.ctrlKey?b.datepicker._showDatepicker(this):f=!1;f&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var c=
4378-b.datepicker._getInst(a.target);if(b.datepicker._get(c,"constrainInput")){var c=b.datepicker._possibleChars(b.datepicker._get(c,"dateFormat")),f=String.fromCharCode(a.charCode==e?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||f<" "||!c||c.indexOf(f)>-1}},_doKeyUp:function(a){a=b.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(b.datepicker.parseDate(b.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,b.datepicker._getFormatConfig(a)))b.datepicker._setDateFromField(a),
4379-b.datepicker._updateAlternate(a),b.datepicker._updateDatepicker(a)}catch(c){b.datepicker.log(c)}return!0},_showDatepicker:function(a){a=a.target||a;a.nodeName.toLowerCase()!="input"&&(a=b("input",a.parentNode)[0]);if(!(b.datepicker._isDisabledDatepicker(a)||b.datepicker._lastInput==a)){var c=b.datepicker._getInst(a);b.datepicker._curInst&&b.datepicker._curInst!=c&&b.datepicker._curInst.dpDiv.stop(!0,!0);var f=b.datepicker._get(c,"beforeShow");h(c.settings,f?f.apply(a,[a,c]):{});c.lastVal=null;b.datepicker._lastInput=
4380-a;b.datepicker._setDateFromField(c);if(b.datepicker._inDialog)a.value="";if(!b.datepicker._pos)b.datepicker._pos=b.datepicker._findPos(a),b.datepicker._pos[1]+=a.offsetHeight;var e=!1;b(a).parents().each(function(){e|=b(this).css("position")=="fixed";return!e});e&&b.browser.opera&&(b.datepicker._pos[0]-=document.documentElement.scrollLeft,b.datepicker._pos[1]-=document.documentElement.scrollTop);f={left:b.datepicker._pos[0],top:b.datepicker._pos[1]};b.datepicker._pos=null;c.dpDiv.empty();c.dpDiv.css({position:"absolute",
4381-display:"block",top:"-1000px"});b.datepicker._updateDatepicker(c);f=b.datepicker._checkOffset(c,f,e);c.dpDiv.css({position:b.datepicker._inDialog&&b.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!c.inline){var f=b.datepicker._get(c,"showAnim"),j=b.datepicker._get(c,"duration"),s=function(){var a=c.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var g=b.datepicker._getBorders(c.dpDiv);a.css({left:-g[0],top:-g[1],width:c.dpDiv.outerWidth(),height:c.dpDiv.outerHeight()})}};
4382-c.dpDiv.zIndex(b(a).zIndex()+1);b.datepicker._datepickerShowing=!0;if(b.effects&&b.effects[f])c.dpDiv.show(f,b.datepicker._get(c,"showOptions"),j,s);else c.dpDiv[f||"show"](f?j:null,s);(!f||!j)&&s();c.input.is(":visible")&&!c.input.is(":disabled")&&c.input.focus();b.datepicker._curInst=c}}},_updateDatepicker:function(a){var c=b.datepicker._getBorders(a.dpDiv);j=a;a.dpDiv.empty().append(this._generateHTML(a));var f=a.dpDiv.find("iframe.ui-datepicker-cover");f.length&&f.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),
4383-height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();c=this._getNumberOfMonths(a);f=c[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",17*f+"em");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==b.datepicker._curInst&&b.datepicker._datepickerShowing&&a.input&&
4384-a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(b){var a=function(b){return{thin:1,medium:2,thick:3}[b]||b};return[parseFloat(a(b.css("border-left-width"))),parseFloat(a(b.css("border-top-width")))]},_checkOffset:function(a,c,f){var e=a.dpDiv.outerWidth(),
4385-j=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,v=a.input?a.input.outerHeight():0,t=document.documentElement.clientWidth+b(document).scrollLeft(),u=document.documentElement.clientHeight+b(document).scrollTop();c.left-=this._get(a,"isRTL")?e-h:0;c.left-=f&&c.left==a.input.offset().left?b(document).scrollLeft():0;c.top-=f&&c.top==a.input.offset().top+v?b(document).scrollTop():0;c.left-=Math.min(c.left,c.left+e>t&&t>e?Math.abs(c.left+e-t):0);c.top-=Math.min(c.top,c.top+j>u&&u>j?Math.abs(j+v):
4386-0);return c},_findPos:function(a){for(var c=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||b.expr.filters.hidden(a));)a=a[c?"previousSibling":"nextSibling"];a=b(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var c=this._curInst;if(c&&!(a&&c!=b.data(a,"datepicker"))&&this._datepickerShowing){var a=this._get(c,"showAnim"),f=this._get(c,"duration"),e=function(){b.datepicker._tidyDialog(c);this._curInst=null};if(b.effects&&b.effects[a])c.dpDiv.hide(a,b.datepicker._get(c,
4387-"showOptions"),f,e);else c.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?f:null,e);a||e();(a=this._get(c,"onClose"))&&a.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._datepickerShowing=!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),b.blockUI&&(b.unblockUI(),b("body").append(this.dpDiv)));this._inDialog=!1}},_tidyDialog:function(b){b.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
4388-_checkExternalClick:function(a){b.datepicker._curInst&&(a=b(a.target),a[0].id!=b.datepicker._mainDivId&&a.parents("#"+b.datepicker._mainDivId).length==0&&!a.hasClass(b.datepicker.markerClassName)&&!a.hasClass(b.datepicker._triggerClass)&&b.datepicker._datepickerShowing&&(!b.datepicker._inDialog||!b.blockUI)&&b.datepicker._hideDatepicker())},_adjustDate:function(a,c,f){var a=b(a),e=this._getInst(a[0]);this._isDisabledDatepicker(a[0])||(this._adjustInstDate(e,c+(f=="M"?this._get(e,"showCurrentAtPos"):
4389-0),f),this._updateDatepicker(e))},_gotoToday:function(a){var a=b(a),c=this._getInst(a[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var f=new Date;c.selectedDay=f.getDate();c.drawMonth=c.selectedMonth=f.getMonth();c.drawYear=c.selectedYear=f.getFullYear()}this._notifyChange(c);this._adjustDate(a)},_selectMonthYear:function(a,c,f){var a=b(a),e=this._getInst(a[0]);e._selectingMonthYear=
4390-!1;e["selected"+(f=="M"?"Month":"Year")]=e["draw"+(f=="M"?"Month":"Year")]=parseInt(c.options[c.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var c=this._getInst(b(a)[0]);c.input&&c._selectingMonthYear&&setTimeout(function(){c.input.focus()},0);c._selectingMonthYear=!c._selectingMonthYear},_selectDay:function(a,c,f,e){var j=b(a);if(!b(e).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(j[0]))j=this._getInst(j[0]),j.selectedDay=j.currentDay=
4391-b("a",e).html(),j.selectedMonth=j.currentMonth=c,j.selectedYear=j.currentYear=f,this._selectDate(a,this._formatDate(j,j.currentDay,j.currentMonth,j.currentYear))},_clearDate:function(a){a=b(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,c){var f=this._getInst(b(a)[0]),c=c!=null?c:this._formatDate(f);f.input&&f.input.val(c);this._updateAlternate(f);var e=this._get(f,"onSelect");e?e.apply(f.input?f.input[0]:null,[c,f]):f.input&&f.input.trigger("change");f.inline?this._updateDatepicker(f):
4392-(this._hideDatepicker(),this._lastInput=f.input[0],typeof f.input[0]!="object"&&f.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var c=this._get(a,"altField");if(c){var f=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),j=this.formatDate(f,e,this._getFormatConfig(a));b(c).each(function(){b(this).val(j)})}},noWeekends:function(b){b=b.getDay();return[b>0&&b<6,""]},iso8601Week:function(b){b=new Date(b.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var a=
4393-b.getTime();b.setMonth(0);b.setDate(1);return Math.floor(Math.round((a-b)/864E5)/7)+1},parseDate:function(a,c,f){if(a==null||c==null)throw"Invalid arguments";c=typeof c=="object"?c.toString():c+"";if(c=="")return null;for(var e=(f?f.shortYearCutoff:null)||this._defaults.shortYearCutoff,e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10),j=(f?f.dayNamesShort:null)||this._defaults.dayNamesShort,h=(f?f.dayNames:null)||this._defaults.dayNames,v=(f?f.monthNamesShort:null)||this._defaults.monthNamesShort,
4394-t=(f?f.monthNames:null)||this._defaults.monthNames,u=f=-1,r=-1,m=-1,x=!1,z=function(b){(b=E+1<a.length&&a.charAt(E+1)==b)&&E++;return b},w=function(b){var a=z(b),b=c.substring(A).match(RegExp("^\\d{1,"+(b=="@"?14:b=="!"?20:b=="y"&&a?4:b=="o"?3:2)+"}"));if(!b)throw"Missing number at position "+A;A+=b[0].length;return parseInt(b[0],10)},y=function(a,f,g){var a=b.map(z(a)?g:f,function(b,a){return[[a,b]]}).sort(function(b,a){return-(b[1].length-a[1].length)}),e=-1;b.each(a,function(b,a){var f=a[1];if(c.substr(A,
4395-f.length).toLowerCase()==f.toLowerCase())return e=a[0],A+=f.length,!1});if(e!=-1)return e+1;else throw"Unknown name at position "+A;},C=function(){if(c.charAt(A)!=a.charAt(E))throw"Unexpected literal at position "+A;A++},A=0,E=0;E<a.length;E++)if(x)a.charAt(E)=="'"&&!z("'")?x=!1:C();else switch(a.charAt(E)){case "d":r=w("d");break;case "D":y("D",j,h);break;case "o":m=w("o");break;case "m":u=w("m");break;case "M":u=y("M",v,t);break;case "y":f=w("y");break;case "@":var D=new Date(w("@")),f=D.getFullYear(),
4396-u=D.getMonth()+1,r=D.getDate();break;case "!":D=new Date((w("!")-this._ticksTo1970)/1E4);f=D.getFullYear();u=D.getMonth()+1;r=D.getDate();break;case "'":z("'")?C():x=!0;break;default:C()}f==-1?f=(new Date).getFullYear():f<100&&(f+=(new Date).getFullYear()-(new Date).getFullYear()%100+(f<=e?0:-100));if(m>-1){u=1;r=m;do{e=this._getDaysInMonth(f,u-1);if(r<=e)break;u++;r-=e}while(1)}D=this._daylightSavingAdjust(new Date(f,u-1,r));if(D.getFullYear()!=f||D.getMonth()+1!=u||D.getDate()!=r)throw"Invalid date";
4397-return D},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*864E9,formatDate:function(b,a,c){if(!a)return"";var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,j=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,
4398-c=(c?c.monthNames:null)||this._defaults.monthNames,h=function(a){(a=x+1<b.length&&b.charAt(x+1)==a)&&x++;return a},t=function(b,a,c){a=""+a;if(h(b))for(;a.length<c;)a="0"+a;return a},u=function(b,a,c,f){return h(b)?f[a]:c[a]},r="",m=!1;if(a)for(var x=0;x<b.length;x++)if(m)b.charAt(x)=="'"&&!h("'")?m=!1:r+=b.charAt(x);else switch(b.charAt(x)){case "d":r+=t("d",a.getDate(),2);break;case "D":r+=u("D",a.getDay(),f,e);break;case "o":r+=t("o",(a.getTime()-(new Date(a.getFullYear(),0,0)).getTime())/864E5,
4399-3);break;case "m":r+=t("m",a.getMonth()+1,2);break;case "M":r+=u("M",a.getMonth(),j,c);break;case "y":r+=h("y")?a.getFullYear():(a.getYear()%100<10?"0":"")+a.getYear()%100;break;case "@":r+=a.getTime();break;case "!":r+=a.getTime()*1E4+this._ticksTo1970;break;case "'":h("'")?r+="'":m=!0;break;default:r+=b.charAt(x)}return r},_possibleChars:function(b){for(var a="",c=!1,f=function(a){(a=e+1<b.length&&b.charAt(e+1)==a)&&e++;return a},e=0;e<b.length;e++)if(c)b.charAt(e)=="'"&&!f("'")?c=!1:a+=b.charAt(e);
4400-else switch(b.charAt(e)){case "d":case "m":case "y":case "@":a+="0123456789";break;case "D":case "M":return null;case "'":f("'")?a+="'":c=!0;break;default:a+=b.charAt(e)}return a},_get:function(b,a){return b.settings[a]!==e?b.settings[a]:this._defaults[a]},_setDateFromField:function(b,a){if(b.input.val()!=b.lastVal){var c=this._get(b,"dateFormat"),f=b.lastVal=b.input?b.input.val():null,e,j;e=j=this._getDefaultDate(b);var h=this._getFormatConfig(b);try{e=this.parseDate(c,f,h)||j}catch(t){this.log(t),
4401-f=a?"":f}b.selectedDay=e.getDate();b.drawMonth=b.selectedMonth=e.getMonth();b.drawYear=b.selectedYear=e.getFullYear();b.currentDay=f?e.getDate():0;b.currentMonth=f?e.getMonth():0;b.currentYear=f?e.getFullYear():0;this._adjustInstDate(b)}},_getDefaultDate:function(b){return this._restrictMinMax(b,this._determineDate(b,this._get(b,"defaultDate"),new Date))},_determineDate:function(a,c,f){var g;var e=function(b){var a=new Date;a.setDate(a.getDate()+b);return a};if(g=(c=c==null||c===""?f:typeof c=="string"?
4402-function(c){try{return b.datepicker.parseDate(b.datepicker._get(a,"dateFormat"),c,b.datepicker._getFormatConfig(a))}catch(f){}for(var e=(c.toLowerCase().match(/^c/)?b.datepicker._getDate(a):null)||new Date,j=e.getFullYear(),h=e.getMonth(),e=e.getDate(),k=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,n=k.exec(c);n;){switch(n[2]||"d"){case "d":case "D":e+=parseInt(n[1],10);break;case "w":case "W":e+=parseInt(n[1],10)*7;break;case "m":case "M":h+=parseInt(n[1],10);e=Math.min(e,b.datepicker._getDaysInMonth(j,
4403-h));break;case "y":case "Y":j+=parseInt(n[1],10),e=Math.min(e,b.datepicker._getDaysInMonth(j,h))}n=k.exec(c)}return new Date(j,h,e)}(c):typeof c=="number"?isNaN(c)?f:e(c):new Date(c.getTime()))&&c.toString()=="Invalid Date"?f:c,c=g)c.setHours(0),c.setMinutes(0),c.setSeconds(0),c.setMilliseconds(0);return this._daylightSavingAdjust(c)},_daylightSavingAdjust:function(b){if(!b)return null;b.setHours(b.getHours()>12?b.getHours()+2:0);return b},_setDate:function(b,a,c){var f=!a,e=b.selectedMonth,j=b.selectedYear,
4404-a=this._restrictMinMax(b,this._determineDate(b,a,new Date));b.selectedDay=b.currentDay=a.getDate();b.drawMonth=b.selectedMonth=b.currentMonth=a.getMonth();b.drawYear=b.selectedYear=b.currentYear=a.getFullYear();(e!=b.selectedMonth||j!=b.selectedYear)&&!c&&this._notifyChange(b);this._adjustInstDate(b);b.input&&b.input.val(f?"":this._formatDate(b))},_getDate:function(b){return!b.currentYear||b.input&&b.input.val()==""?null:this._daylightSavingAdjust(new Date(b.currentYear,b.currentMonth,b.currentDay))},
4405-_generateHTML:function(a){var c=new Date,c=this._daylightSavingAdjust(new Date(c.getFullYear(),c.getMonth(),c.getDate())),e=this._get(a,"isRTL"),j=this._get(a,"showButtonPanel"),h=this._get(a,"hideIfNoPrevNext"),s=this._get(a,"navigationAsDateFormat"),v=this._getNumberOfMonths(a),t=this._get(a,"showCurrentAtPos"),u=this._get(a,"stepMonths"),r=v[0]!=1||v[1]!=1,m=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),x=this._getMinMaxDate(a,
4406-"min"),z=this._getMinMaxDate(a,"max"),t=a.drawMonth-t,w=a.drawYear;t<0&&(t+=12,w--);if(z)for(var y=this._daylightSavingAdjust(new Date(z.getFullYear(),z.getMonth()-v[0]*v[1]+1,z.getDate())),y=x&&y<x?x:y;this._daylightSavingAdjust(new Date(w,t,1))>y;)t--,t<0&&(t=11,w--);a.drawMonth=t;a.drawYear=w;var y=this._get(a,"prevText"),y=!s?y:this.formatDate(y,this._daylightSavingAdjust(new Date(w,t-u,1)),this._getFormatConfig(a)),y=this._canAdjustMonth(a,-1,w,t)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+
4407-f+".datepicker._adjustDate('#"+a.id+"', -"+u+", 'M');\" title=\""+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"e":"w")+'">'+y+"</span></a>":h?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"e":"w")+'">'+y+"</span></a>",C=this._get(a,"nextText"),C=!s?C:this.formatDate(C,this._daylightSavingAdjust(new Date(w,t+u,1)),this._getFormatConfig(a)),h=this._canAdjustMonth(a,1,w,t)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+
4408-f+".datepicker._adjustDate('#"+a.id+"', +"+u+", 'M');\" title=\""+C+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"w":"e")+'">'+C+"</span></a>":h?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+C+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"w":"e")+'">'+C+"</span></a>",u=this._get(a,"currentText"),C=this._get(a,"gotoCurrent")&&a.currentDay?m:c,u=!s?u:this.formatDate(u,C,this._getFormatConfig(a)),s=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+
4409-f+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"",j=j?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(e?s:"")+(this._isInRange(a,C)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+f+".datepicker._gotoToday('#"+a.id+"');\">"+u+"</button>":"")+(e?"":s)+"</div>":"",s=parseInt(this._get(a,"firstDay"),10),s=isNaN(s)?0:s,u=this._get(a,"showWeek"),C=this._get(a,"dayNames");this._get(a,"dayNamesShort");
4410-var A=this._get(a,"dayNamesMin"),E=this._get(a,"monthNames"),D=this._get(a,"monthNamesShort"),V=this._get(a,"beforeShowDay"),W=this._get(a,"showOtherMonths"),Y=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var aa=this._getDefaultDate(a),G="",L=0;L<v[0];L++){for(var I="",N=0;N<v[1];N++){var Z=this._daylightSavingAdjust(new Date(w,t,a.selectedDay)),J=" ui-corner-all",S="";if(r){S+='<div class="ui-datepicker-group';if(v[1]>1)switch(N){case 0:S+=" ui-datepicker-group-first";J=" ui-corner-"+
4411-(e?"right":"left");break;case v[1]-1:S+=" ui-datepicker-group-last";J=" ui-corner-"+(e?"left":"right");break;default:S+=" ui-datepicker-group-middle",J=""}S+='">'}S+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+J+'">'+(/all|left/.test(J)&&L==0?e?h:y:"")+(/all|right/.test(J)&&L==0?e?y:h:"")+this._generateMonthYearHeader(a,t,w,x,z,L>0||N>0,E,D)+'</div><table class="ui-datepicker-calendar"><thead><tr>';for(var K=u?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+
4412-"</th>":"",J=0;J<7;J++){var B=(J+s)%7;K+="<th"+((J+s+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+C[B]+'">'+A[B]+"</span></th>"}S+=K+"</tr></thead><tbody>";K=this._getDaysInMonth(w,t);if(w==a.selectedYear&&t==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,K);for(var J=(this._getFirstDayOfMonth(w,t)-s+7)%7,K=r?6:Math.ceil((J+K)/7),B=this._daylightSavingAdjust(new Date(w,t,1-J)),U=0;U<K;U++){S+="<tr>";for(var P=!u?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(B)+
4413-"</td>",J=0;J<7;J++){var M=V?V.apply(a.input?a.input[0]:null,[B]):[!0,""],O=B.getMonth()!=t,T=O&&!Y||!M[0]||x&&B<x||z&&B>z;P+='<td class="'+((J+s+6)%7>=5?" ui-datepicker-week-end":"")+(O?" ui-datepicker-other-month":"")+(B.getTime()==Z.getTime()&&t==a.selectedMonth&&a._keyEvent||aa.getTime()==B.getTime()&&aa.getTime()==Z.getTime()?" "+this._dayOverClass:"")+(T?" "+this._unselectableClass+" ui-state-disabled":"")+(O&&!W?"":" "+M[1]+(B.getTime()==m.getTime()?" "+this._currentClass:"")+(B.getTime()==
4414-c.getTime()?" ui-datepicker-today":""))+'"'+((!O||W)&&M[2]?' title="'+M[2]+'"':"")+(T?"":' onclick="DP_jQuery_'+f+".datepicker._selectDay('#"+a.id+"',"+B.getMonth()+","+B.getFullYear()+', this);return false;"')+">"+(O&&!W?"&#xa0;":T?'<span class="ui-state-default">'+B.getDate()+"</span>":'<a class="ui-state-default'+(B.getTime()==c.getTime()?" ui-state-highlight":"")+(B.getTime()==m.getTime()?" ui-state-active":"")+(O?" ui-priority-secondary":"")+'" href="#">'+B.getDate()+"</a>")+"</td>";B.setDate(B.getDate()+
4415-1);B=this._daylightSavingAdjust(B)}S+=P+"</tr>"}t++;t>11&&(t=0,w++);S+="</tbody></table>"+(r?"</div>"+(v[0]>0&&N==v[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");I+=S}G+=I}G+=j+(b.browser.msie&&parseInt(b.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=!1;return G},_generateMonthYearHeader:function(b,a,c,e,j,h,v,t){var u=this._get(b,"changeMonth"),r=this._get(b,"changeYear"),m=this._get(b,"showMonthAfterYear"),
4416-x='<div class="ui-datepicker-title">',z="";if(h||!u)z+='<span class="ui-datepicker-month">'+v[a]+"</span>";else{var v=e&&e.getFullYear()==c,w=j&&j.getFullYear()==c;z+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+f+".datepicker._selectMonthYear('#"+b.id+"', this, 'M');\" onclick=\"DP_jQuery_"+f+".datepicker._clickMonthYear('#"+b.id+"');\">";for(var y=0;y<12;y++)if((!v||y>=e.getMonth())&&(!w||y<=j.getMonth()))z+='<option value="'+y+'"'+(y==a?' selected="selected"':"")+">"+t[y]+"</option>";
4417-z+="</select>"}m||(x+=z+(h||!u||!r?"&#xa0;":""));if(!b.yearshtml)if(b.yearshtml="",h||!r)x+='<span class="ui-datepicker-year">'+c+"</span>";else{var t=this._get(b,"yearRange").split(":"),C=(new Date).getFullYear(),v=function(b){b=b.match(/c[+-].*/)?c+parseInt(b.substring(1),10):b.match(/[+-].*/)?C+parseInt(b,10):parseInt(b,10);return isNaN(b)?C:b},a=v(t[0]),t=Math.max(a,v(t[1]||"")),a=e?Math.max(a,e.getFullYear()):a,t=j?Math.min(t,j.getFullYear()):t;for(b.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+
4418-f+".datepicker._selectMonthYear('#"+b.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+f+".datepicker._clickMonthYear('#"+b.id+"');\">";a<=t;a++)b.yearshtml+='<option value="'+a+'"'+(a==c?' selected="selected"':"")+">"+a+"</option>";b.yearshtml+="</select>";x+=b.yearshtml;b.yearshtml=null}x+=this._get(b,"yearSuffix");m&&(x+=(h||!u||!r?"&#xa0;":"")+z);x+="</div>";return x},_adjustInstDate:function(b,a,c){var f=b.drawYear+(c=="Y"?a:0),e=b.drawMonth+(c=="M"?a:0),a=Math.min(b.selectedDay,this._getDaysInMonth(f,
4419-e))+(c=="D"?a:0),f=this._restrictMinMax(b,this._daylightSavingAdjust(new Date(f,e,a)));b.selectedDay=f.getDate();b.drawMonth=b.selectedMonth=f.getMonth();b.drawYear=b.selectedYear=f.getFullYear();(c=="M"||c=="Y")&&this._notifyChange(b)},_restrictMinMax:function(b,a){var c=this._getMinMaxDate(b,"min"),f=this._getMinMaxDate(b,"max"),c=c&&a<c?c:a;return f&&c>f?f:c},_notifyChange:function(b){var a=this._get(b,"onChangeMonthYear");a&&a.apply(b.input?b.input[0]:null,[b.selectedYear,b.selectedMonth+1,b])},
4420-_getNumberOfMonths:function(b){b=this._get(b,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(b,a){return this._determineDate(b,this._get(b,a+"Date"),null)},_getDaysInMonth:function(b,a){return 32-this._daylightSavingAdjust(new Date(b,a,32)).getDate()},_getFirstDayOfMonth:function(b,a){return(new Date(b,a,1)).getDay()},_canAdjustMonth:function(b,a,c,f){var e=this._getNumberOfMonths(b),c=this._daylightSavingAdjust(new Date(c,f+(a<0?a:e[0]*e[1]),1));a<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),
4421-c.getMonth()));return this._isInRange(b,c)},_isInRange:function(b,a){var c=this._getMinMaxDate(b,"min"),f=this._getMinMaxDate(b,"max");return(!c||a.getTime()>=c.getTime())&&(!f||a.getTime()<=f.getTime())},_getFormatConfig:function(b){var a=this._get(b,"shortYearCutoff"),a=typeof a!="string"?a:(new Date).getFullYear()%100+parseInt(a,10);return{shortYearCutoff:a,dayNamesShort:this._get(b,"dayNamesShort"),dayNames:this._get(b,"dayNames"),monthNamesShort:this._get(b,"monthNamesShort"),monthNames:this._get(b,
4422-"monthNames")}},_formatDate:function(b,a,c,f){if(!a)b.currentDay=b.selectedDay,b.currentMonth=b.selectedMonth,b.currentYear=b.selectedYear;a=a?typeof a=="object"?a:this._daylightSavingAdjust(new Date(f,c,a)):this._daylightSavingAdjust(new Date(b.currentYear,b.currentMonth,b.currentDay));return this.formatDate(this._get(b,"dateFormat"),a,this._getFormatConfig(b))}});b.fn.datepicker=function(a){if(!this.length)return this;if(!b.datepicker.initialized)b(document).mousedown(b.datepicker._checkExternalClick).find("body").append(b.datepicker.dpDiv),
4423+maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1};b.extend(this._defaults,this.regional[""]);this.dpDiv=e(b('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function e(a){return a.delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a",
4424+"mouseout",function(){b(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&b(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&b(this).removeClass("ui-datepicker-next-hover")}).delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a","mouseover",function(){if(!b.datepicker._isDisabledDatepicker(h.inline?a.parent()[0]:h.input[0]))b(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),
4425+b(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&b(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!=-1&&b(this).addClass("ui-datepicker-next-hover")})}function f(a,e){b.extend(a,e);for(var g in e)if(e[g]==null||e[g]==c)a[g]=e[g];return a}b.extend(b.ui,{datepicker:{version:"1.8.13"}});var g=(new Date).getTime(),h;b.extend(a.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},
4426+_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(b){f(this._defaults,b||{});return this},_attachDatepicker:function(a,c){var e=null,g;for(g in this._defaults){var h=a.getAttribute("date:"+g);if(h){e=e||{};try{e[g]=eval(h)}catch(f){e[g]=h}}}g=a.nodeName.toLowerCase();h=g=="div"||g=="span";if(!a.id)this.uuid+=1,a.id="dp"+this.uuid;var v=this._newInst(b(a),h);v.settings=b.extend({},c||{},e||{});g=="input"?this._connectDatepicker(a,v):h&&this._inlineDatepicker(a,v)},_newInst:function(a,
4427+c){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:c,dpDiv:!c?this.dpDiv:e(b('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,c){var e=b(a);c.append=b([]);c.trigger=b([]);e.hasClass(this.markerClassName)||(this._attachments(e,c),e.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
4428+function(b,a,j){c.settings[a]=j}).bind("getData.datepicker",function(b,a){return this._get(c,a)}),this._autoSize(c),b.data(a,"datepicker",c))},_attachments:function(a,c){var e=this._get(c,"appendText"),g=this._get(c,"isRTL");c.append&&c.append.remove();if(e)c.append=b('<span class="'+this._appendClass+'">'+e+"</span>"),a[g?"before":"after"](c.append);a.unbind("focus",this._showDatepicker);c.trigger&&c.trigger.remove();e=this._get(c,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);
4429+if(e=="button"||e=="both"){var e=this._get(c,"buttonText"),h=this._get(c,"buttonImage");c.trigger=b(this._get(c,"buttonImageOnly")?b("<img/>").addClass(this._triggerClass).attr({src:h,alt:e,title:e}):b('<button type="button"></button>').addClass(this._triggerClass).html(h==""?e:b("<img/>").attr({src:h,alt:e,title:e})));a[g?"before":"after"](c.trigger);c.trigger.click(function(){b.datepicker._datepickerShowing&&b.datepicker._lastInput==a[0]?b.datepicker._hideDatepicker():b.datepicker._showDatepicker(a[0]);
4430+return!1})}},_autoSize:function(b){if(this._get(b,"autoSize")&&!b.inline){var a=new Date(2009,11,20),c=this._get(b,"dateFormat");if(c.match(/[DM]/)){var e=function(b){for(var a=0,c=0,j=0;j<b.length;j++)if(b[j].length>a)a=b[j].length,c=j;return c};a.setMonth(e(this._get(b,c.match(/MM/)?"monthNames":"monthNamesShort")));a.setDate(e(this._get(b,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())}b.input.attr("size",this._formatDate(b,a).length)}},_inlineDatepicker:function(a,c){var e=b(a);e.hasClass(this.markerClassName)||
4431+(e.addClass(this.markerClassName).append(c.dpDiv).bind("setData.datepicker",function(b,a,j){c.settings[a]=j}).bind("getData.datepicker",function(b,a){return this._get(c,a)}),b.data(a,"datepicker",c),this._setDate(c,this._getDefaultDate(c),!0),this._updateDatepicker(c),this._updateAlternate(c),c.dpDiv.show())},_dialogDatepicker:function(a,c,e,g,h){a=this._dialogInst;if(!a)this.uuid+=1,this._dialogInput=b('<input type="text" id="dp'+this.uuid+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),
4432+this._dialogInput.keydown(this._doKeyDown),b("body").append(this._dialogInput),a=this._dialogInst=this._newInst(this._dialogInput,!1),a.settings={},b.data(this._dialogInput[0],"datepicker",a);f(a.settings,g||{});c=c&&c.constructor==Date?this._formatDate(a,c):c;this._dialogInput.val(c);this._pos=h?h.length?h:[h.pageX,h.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/
4433+2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=e;this._inDialog=!0;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);b.blockUI&&b.blockUI(this.dpDiv);b.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var c=b(a),e=b.data(a,"datepicker");if(c.hasClass(this.markerClassName)){var g=a.nodeName.toLowerCase();b.removeData(a,
4434+"datepicker");g=="input"?(e.append.remove(),e.trigger.remove(),c.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(g=="div"||g=="span")&&c.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var c=b(a),e=b.data(a,"datepicker");if(c.hasClass(this.markerClassName)){var g=a.nodeName.toLowerCase();if(g=="input")a.disabled=!1,e.trigger.filter("button").each(function(){this.disabled=
4435+!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(g=="div"||g=="span")c=c.children("."+this._inlineClass),c.children().removeClass("ui-state-disabled"),c.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled");this._disabledInputs=b.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var c=b(a),e=b.data(a,"datepicker");if(c.hasClass(this.markerClassName)){var g=a.nodeName.toLowerCase();if(g=="input")a.disabled=!0,e.trigger.filter("button").each(function(){this.disabled=
4436+!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(g=="div"||g=="span")c=c.children("."+this._inlineClass),c.children().addClass("ui-state-disabled"),c.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled");this._disabledInputs=b.map(this._disabledInputs,function(b){return b==a?null:b});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(b){if(!b)return!1;for(var a=0;a<this._disabledInputs.length;a++)if(this._disabledInputs[a]==
4437+b)return!0;return!1},_getInst:function(a){try{return b.data(a,"datepicker")}catch(c){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,e,g){var h=this._getInst(a);if(arguments.length==2&&typeof e=="string")return e=="defaults"?b.extend({},b.datepicker._defaults):h?e=="all"?b.extend({},h.settings):this._get(h,e):null;var o=e||{};typeof e=="string"&&(o={},o[e]=g);if(h){this._curInst==h&&this._hideDatepicker();var t=this._getDateDatepicker(a,!0),v=this._getMinMaxDate(h,
4438+"min"),s=this._getMinMaxDate(h,"max");f(h.settings,o);if(v!==null&&o.dateFormat!==c&&o.minDate===c)h.settings.minDate=this._formatDate(h,v);if(s!==null&&o.dateFormat!==c&&o.maxDate===c)h.settings.maxDate=this._formatDate(h,s);this._attachments(b(a),h);this._autoSize(h);this._setDate(h,t);this._updateAlternate(h);this._updateDatepicker(h)}},_changeDatepicker:function(b,a,c){this._optionDatepicker(b,a,c)},_refreshDatepicker:function(b){(b=this._getInst(b))&&this._updateDatepicker(b)},_setDateDatepicker:function(b,
4439+a){var c=this._getInst(b);c&&(this._setDate(c,a),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(b,a){var c=this._getInst(b);c&&!c.inline&&this._setDateFromField(c,a);return c?this._getDate(c):null},_doKeyDown:function(a){var c=b.datepicker._getInst(a.target),e=!0,g=c.dpDiv.is(".ui-datepicker-rtl");c._keyEvent=!0;if(b.datepicker._datepickerShowing)switch(a.keyCode){case 9:b.datepicker._hideDatepicker();e=!1;break;case 13:return e=b("td."+b.datepicker._dayOverClass+
4440+":not(."+b.datepicker._currentClass+")",c.dpDiv),e[0]?b.datepicker._selectDay(a.target,c.selectedMonth,c.selectedYear,e[0]):b.datepicker._hideDatepicker(),!1;case 27:b.datepicker._hideDatepicker();break;case 33:b.datepicker._adjustDate(a.target,a.ctrlKey?-b.datepicker._get(c,"stepBigMonths"):-b.datepicker._get(c,"stepMonths"),"M");break;case 34:b.datepicker._adjustDate(a.target,a.ctrlKey?+b.datepicker._get(c,"stepBigMonths"):+b.datepicker._get(c,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&
4441+b.datepicker._clearDate(a.target);e=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&b.datepicker._gotoToday(a.target);e=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)b.datepicker._adjustDate(a.target,g?1:-1,"D");e=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&b.datepicker._adjustDate(a.target,a.ctrlKey?-b.datepicker._get(c,"stepBigMonths"):-b.datepicker._get(c,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&b.datepicker._adjustDate(a.target,-7,"D");e=a.ctrlKey||a.metaKey;
4442+break;case 39:if(a.ctrlKey||a.metaKey)b.datepicker._adjustDate(a.target,g?-1:1,"D");e=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&b.datepicker._adjustDate(a.target,a.ctrlKey?+b.datepicker._get(c,"stepBigMonths"):+b.datepicker._get(c,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&b.datepicker._adjustDate(a.target,7,"D");e=a.ctrlKey||a.metaKey;break;default:e=!1}else a.keyCode==36&&a.ctrlKey?b.datepicker._showDatepicker(this):e=!1;e&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var e=
4443+b.datepicker._getInst(a.target);if(b.datepicker._get(e,"constrainInput")){var e=b.datepicker._possibleChars(b.datepicker._get(e,"dateFormat")),g=String.fromCharCode(a.charCode==c?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||g<" "||!e||e.indexOf(g)>-1}},_doKeyUp:function(a){a=b.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(b.datepicker.parseDate(b.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,b.datepicker._getFormatConfig(a)))b.datepicker._setDateFromField(a),
4444+b.datepicker._updateAlternate(a),b.datepicker._updateDatepicker(a)}catch(c){b.datepicker.log(c)}return!0},_showDatepicker:function(a){a=a.target||a;a.nodeName.toLowerCase()!="input"&&(a=b("input",a.parentNode)[0]);if(!(b.datepicker._isDisabledDatepicker(a)||b.datepicker._lastInput==a)){var c=b.datepicker._getInst(a);b.datepicker._curInst&&b.datepicker._curInst!=c&&b.datepicker._curInst.dpDiv.stop(!0,!0);var e=b.datepicker._get(c,"beforeShow");f(c.settings,e?e.apply(a,[a,c]):{});c.lastVal=null;b.datepicker._lastInput=
4445+a;b.datepicker._setDateFromField(c);if(b.datepicker._inDialog)a.value="";if(!b.datepicker._pos)b.datepicker._pos=b.datepicker._findPos(a),b.datepicker._pos[1]+=a.offsetHeight;var g=!1;b(a).parents().each(function(){g|=b(this).css("position")=="fixed";return!g});g&&b.browser.opera&&(b.datepicker._pos[0]-=document.documentElement.scrollLeft,b.datepicker._pos[1]-=document.documentElement.scrollTop);e={left:b.datepicker._pos[0],top:b.datepicker._pos[1]};b.datepicker._pos=null;c.dpDiv.empty();c.dpDiv.css({position:"absolute",
4446+display:"block",top:"-1000px"});b.datepicker._updateDatepicker(c);e=b.datepicker._checkOffset(c,e,g);c.dpDiv.css({position:b.datepicker._inDialog&&b.blockUI?"static":g?"fixed":"absolute",display:"none",left:e.left+"px",top:e.top+"px"});if(!c.inline){var e=b.datepicker._get(c,"showAnim"),h=b.datepicker._get(c,"duration"),t=function(){var a=c.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var e=b.datepicker._getBorders(c.dpDiv);a.css({left:-e[0],top:-e[1],width:c.dpDiv.outerWidth(),height:c.dpDiv.outerHeight()})}};
4447+c.dpDiv.zIndex(b(a).zIndex()+1);b.datepicker._datepickerShowing=!0;if(b.effects&&b.effects[e])c.dpDiv.show(e,b.datepicker._get(c,"showOptions"),h,t);else c.dpDiv[e||"show"](e?h:null,t);(!e||!h)&&t();c.input.is(":visible")&&!c.input.is(":disabled")&&c.input.focus();b.datepicker._curInst=c}}},_updateDatepicker:function(a){var c=b.datepicker._getBorders(a.dpDiv);h=a;a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),
4448+height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();c=this._getNumberOfMonths(a);e=c[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");e>1&&a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==b.datepicker._curInst&&b.datepicker._datepickerShowing&&a.input&&
4449+a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var g=a.yearshtml;setTimeout(function(){g===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);g=a.yearshtml=null},0)}},_getBorders:function(b){var a=function(b){return{thin:1,medium:2,thick:3}[b]||b};return[parseFloat(a(b.css("border-left-width"))),parseFloat(a(b.css("border-top-width")))]},_checkOffset:function(a,c,e){var g=a.dpDiv.outerWidth(),
4450+h=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,v=a.input?a.input.outerHeight():0,s=document.documentElement.clientWidth+b(document).scrollLeft(),u=document.documentElement.clientHeight+b(document).scrollTop();c.left-=this._get(a,"isRTL")?g-f:0;c.left-=e&&c.left==a.input.offset().left?b(document).scrollLeft():0;c.top-=e&&c.top==a.input.offset().top+v?b(document).scrollTop():0;c.left-=Math.min(c.left,c.left+g>s&&s>g?Math.abs(c.left+g-s):0);c.top-=Math.min(c.top,c.top+h>u&&u>h?Math.abs(h+v):
4451+0);return c},_findPos:function(a){for(var c=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||b.expr.filters.hidden(a));)a=a[c?"previousSibling":"nextSibling"];a=b(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var c=this._curInst;if(c&&!(a&&c!=b.data(a,"datepicker"))&&this._datepickerShowing){var a=this._get(c,"showAnim"),e=this._get(c,"duration"),g=function(){b.datepicker._tidyDialog(c);this._curInst=null};if(b.effects&&b.effects[a])c.dpDiv.hide(a,b.datepicker._get(c,
4452+"showOptions"),e,g);else c.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?e:null,g);a||g();(a=this._get(c,"onClose"))&&a.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._datepickerShowing=!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),b.blockUI&&(b.unblockUI(),b("body").append(this.dpDiv)));this._inDialog=!1}},_tidyDialog:function(b){b.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
4453+_checkExternalClick:function(a){b.datepicker._curInst&&(a=b(a.target),a[0].id!=b.datepicker._mainDivId&&a.parents("#"+b.datepicker._mainDivId).length==0&&!a.hasClass(b.datepicker.markerClassName)&&!a.hasClass(b.datepicker._triggerClass)&&b.datepicker._datepickerShowing&&(!b.datepicker._inDialog||!b.blockUI)&&b.datepicker._hideDatepicker())},_adjustDate:function(a,c,e){var a=b(a),g=this._getInst(a[0]);this._isDisabledDatepicker(a[0])||(this._adjustInstDate(g,c+(e=="M"?this._get(g,"showCurrentAtPos"):
4454+0),e),this._updateDatepicker(g))},_gotoToday:function(a){var a=b(a),c=this._getInst(a[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var e=new Date;c.selectedDay=e.getDate();c.drawMonth=c.selectedMonth=e.getMonth();c.drawYear=c.selectedYear=e.getFullYear()}this._notifyChange(c);this._adjustDate(a)},_selectMonthYear:function(a,c,e){var a=b(a),g=this._getInst(a[0]);g._selectingMonthYear=
4455+!1;g["selected"+(e=="M"?"Month":"Year")]=g["draw"+(e=="M"?"Month":"Year")]=parseInt(c.options[c.selectedIndex].value,10);this._notifyChange(g);this._adjustDate(a)},_clickMonthYear:function(a){var c=this._getInst(b(a)[0]);c.input&&c._selectingMonthYear&&setTimeout(function(){c.input.focus()},0);c._selectingMonthYear=!c._selectingMonthYear},_selectDay:function(a,c,e,g){var h=b(a);if(!b(g).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(h[0]))h=this._getInst(h[0]),h.selectedDay=h.currentDay=
4456+b("a",g).html(),h.selectedMonth=h.currentMonth=c,h.selectedYear=h.currentYear=e,this._selectDate(a,this._formatDate(h,h.currentDay,h.currentMonth,h.currentYear))},_clearDate:function(a){a=b(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,c){var e=this._getInst(b(a)[0]),c=c!=null?c:this._formatDate(e);e.input&&e.input.val(c);this._updateAlternate(e);var g=this._get(e,"onSelect");g?g.apply(e.input?e.input[0]:null,[c,e]):e.input&&e.input.trigger("change");e.inline?this._updateDatepicker(e):
4457+(this._hideDatepicker(),this._lastInput=e.input[0],typeof e.input[0]!="object"&&e.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var c=this._get(a,"altField");if(c){var e=this._get(a,"altFormat")||this._get(a,"dateFormat"),g=this._getDate(a),h=this.formatDate(e,g,this._getFormatConfig(a));b(c).each(function(){b(this).val(h)})}},noWeekends:function(b){b=b.getDay();return[b>0&&b<6,""]},iso8601Week:function(b){b=new Date(b.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var a=
4458+b.getTime();b.setMonth(0);b.setDate(1);return Math.floor(Math.round((a-b)/864E5)/7)+1},parseDate:function(a,c,e){if(a==null||c==null)throw"Invalid arguments";c=typeof c=="object"?c.toString():c+"";if(c=="")return null;for(var g=(e?e.shortYearCutoff:null)||this._defaults.shortYearCutoff,g=typeof g!="string"?g:(new Date).getFullYear()%100+parseInt(g,10),h=(e?e.dayNamesShort:null)||this._defaults.dayNamesShort,f=(e?e.dayNames:null)||this._defaults.dayNames,v=(e?e.monthNamesShort:null)||this._defaults.monthNamesShort,
4459+s=(e?e.monthNames:null)||this._defaults.monthNames,u=e=-1,r=-1,m=-1,x=!1,z=function(b){(b=E+1<a.length&&a.charAt(E+1)==b)&&E++;return b},w=function(b){var a=z(b),b=c.substring(A).match(RegExp("^\\d{1,"+(b=="@"?14:b=="!"?20:b=="y"&&a?4:b=="o"?3:2)+"}"));if(!b)throw"Missing number at position "+A;A+=b[0].length;return parseInt(b[0],10)},y=function(a,e,j){var a=b.map(z(a)?j:e,function(b,a){return[[a,b]]}).sort(function(b,a){return-(b[1].length-a[1].length)}),g=-1;b.each(a,function(b,a){var e=a[1];if(c.substr(A,
4460+e.length).toLowerCase()==e.toLowerCase())return g=a[0],A+=e.length,!1});if(g!=-1)return g+1;else throw"Unknown name at position "+A;},C=function(){if(c.charAt(A)!=a.charAt(E))throw"Unexpected literal at position "+A;A++},A=0,E=0;E<a.length;E++)if(x)a.charAt(E)=="'"&&!z("'")?x=!1:C();else switch(a.charAt(E)){case "d":r=w("d");break;case "D":y("D",h,f);break;case "o":m=w("o");break;case "m":u=w("m");break;case "M":u=y("M",v,s);break;case "y":e=w("y");break;case "@":var D=new Date(w("@")),e=D.getFullYear(),
4461+u=D.getMonth()+1,r=D.getDate();break;case "!":D=new Date((w("!")-this._ticksTo1970)/1E4);e=D.getFullYear();u=D.getMonth()+1;r=D.getDate();break;case "'":z("'")?C():x=!0;break;default:C()}e==-1?e=(new Date).getFullYear():e<100&&(e+=(new Date).getFullYear()-(new Date).getFullYear()%100+(e<=g?0:-100));if(m>-1){u=1;r=m;do{g=this._getDaysInMonth(e,u-1);if(r<=g)break;u++;r-=g}while(1)}D=this._daylightSavingAdjust(new Date(e,u-1,r));if(D.getFullYear()!=e||D.getMonth()+1!=u||D.getDate()!=r)throw"Invalid date";
4462+return D},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*864E9,formatDate:function(b,a,c){if(!a)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,g=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,
4463+c=(c?c.monthNames:null)||this._defaults.monthNames,f=function(a){(a=x+1<b.length&&b.charAt(x+1)==a)&&x++;return a},s=function(b,a,c){a=""+a;if(f(b))for(;a.length<c;)a="0"+a;return a},u=function(b,a,c,e){return f(b)?e[a]:c[a]},r="",m=!1;if(a)for(var x=0;x<b.length;x++)if(m)b.charAt(x)=="'"&&!f("'")?m=!1:r+=b.charAt(x);else switch(b.charAt(x)){case "d":r+=s("d",a.getDate(),2);break;case "D":r+=u("D",a.getDay(),e,g);break;case "o":r+=s("o",(a.getTime()-(new Date(a.getFullYear(),0,0)).getTime())/864E5,
4464+3);break;case "m":r+=s("m",a.getMonth()+1,2);break;case "M":r+=u("M",a.getMonth(),h,c);break;case "y":r+=f("y")?a.getFullYear():(a.getYear()%100<10?"0":"")+a.getYear()%100;break;case "@":r+=a.getTime();break;case "!":r+=a.getTime()*1E4+this._ticksTo1970;break;case "'":f("'")?r+="'":m=!0;break;default:r+=b.charAt(x)}return r},_possibleChars:function(b){for(var a="",c=!1,e=function(a){(a=g+1<b.length&&b.charAt(g+1)==a)&&g++;return a},g=0;g<b.length;g++)if(c)b.charAt(g)=="'"&&!e("'")?c=!1:a+=b.charAt(g);
4465+else switch(b.charAt(g)){case "d":case "m":case "y":case "@":a+="0123456789";break;case "D":case "M":return null;case "'":e("'")?a+="'":c=!0;break;default:a+=b.charAt(g)}return a},_get:function(b,a){return b.settings[a]!==c?b.settings[a]:this._defaults[a]},_setDateFromField:function(b,a){if(b.input.val()!=b.lastVal){var c=this._get(b,"dateFormat"),e=b.lastVal=b.input?b.input.val():null,g,h;g=h=this._getDefaultDate(b);var f=this._getFormatConfig(b);try{g=this.parseDate(c,e,f)||h}catch(s){this.log(s),
4466+e=a?"":e}b.selectedDay=g.getDate();b.drawMonth=b.selectedMonth=g.getMonth();b.drawYear=b.selectedYear=g.getFullYear();b.currentDay=e?g.getDate():0;b.currentMonth=e?g.getMonth():0;b.currentYear=e?g.getFullYear():0;this._adjustInstDate(b)}},_getDefaultDate:function(b){return this._restrictMinMax(b,this._determineDate(b,this._get(b,"defaultDate"),new Date))},_determineDate:function(a,c,e){var j;var g=function(b){var a=new Date;a.setDate(a.getDate()+b);return a};if(j=(c=c==null||c===""?e:typeof c=="string"?
4467+function(c){try{return b.datepicker.parseDate(b.datepicker._get(a,"dateFormat"),c,b.datepicker._getFormatConfig(a))}catch(e){}for(var g=(c.toLowerCase().match(/^c/)?b.datepicker._getDate(a):null)||new Date,h=g.getFullYear(),f=g.getMonth(),g=g.getDate(),k=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,p=k.exec(c);p;){switch(p[2]||"d"){case "d":case "D":g+=parseInt(p[1],10);break;case "w":case "W":g+=parseInt(p[1],10)*7;break;case "m":case "M":f+=parseInt(p[1],10);g=Math.min(g,b.datepicker._getDaysInMonth(h,
4468+f));break;case "y":case "Y":h+=parseInt(p[1],10),g=Math.min(g,b.datepicker._getDaysInMonth(h,f))}p=k.exec(c)}return new Date(h,f,g)}(c):typeof c=="number"?isNaN(c)?e:g(c):new Date(c.getTime()))&&c.toString()=="Invalid Date"?e:c,c=j)c.setHours(0),c.setMinutes(0),c.setSeconds(0),c.setMilliseconds(0);return this._daylightSavingAdjust(c)},_daylightSavingAdjust:function(b){if(!b)return null;b.setHours(b.getHours()>12?b.getHours()+2:0);return b},_setDate:function(b,a,c){var e=!a,g=b.selectedMonth,h=b.selectedYear,
4469+a=this._restrictMinMax(b,this._determineDate(b,a,new Date));b.selectedDay=b.currentDay=a.getDate();b.drawMonth=b.selectedMonth=b.currentMonth=a.getMonth();b.drawYear=b.selectedYear=b.currentYear=a.getFullYear();(g!=b.selectedMonth||h!=b.selectedYear)&&!c&&this._notifyChange(b);this._adjustInstDate(b);b.input&&b.input.val(e?"":this._formatDate(b))},_getDate:function(b){return!b.currentYear||b.input&&b.input.val()==""?null:this._daylightSavingAdjust(new Date(b.currentYear,b.currentMonth,b.currentDay))},
4470+_generateHTML:function(a){var c=new Date,c=this._daylightSavingAdjust(new Date(c.getFullYear(),c.getMonth(),c.getDate())),e=this._get(a,"isRTL"),h=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),t=this._get(a,"navigationAsDateFormat"),v=this._getNumberOfMonths(a),s=this._get(a,"showCurrentAtPos"),u=this._get(a,"stepMonths"),r=v[0]!=1||v[1]!=1,m=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),x=this._getMinMaxDate(a,
4471+"min"),z=this._getMinMaxDate(a,"max"),s=a.drawMonth-s,w=a.drawYear;s<0&&(s+=12,w--);if(z)for(var y=this._daylightSavingAdjust(new Date(z.getFullYear(),z.getMonth()-v[0]*v[1]+1,z.getDate())),y=x&&y<x?x:y;this._daylightSavingAdjust(new Date(w,s,1))>y;)s--,s<0&&(s=11,w--);a.drawMonth=s;a.drawYear=w;var y=this._get(a,"prevText"),y=!t?y:this.formatDate(y,this._daylightSavingAdjust(new Date(w,s-u,1)),this._getFormatConfig(a)),y=this._canAdjustMonth(a,-1,w,s)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+
4472+g+".datepicker._adjustDate('#"+a.id+"', -"+u+", 'M');\" title=\""+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"e":"w")+'">'+y+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"e":"w")+'">'+y+"</span></a>",C=this._get(a,"nextText"),C=!t?C:this.formatDate(C,this._daylightSavingAdjust(new Date(w,s+u,1)),this._getFormatConfig(a)),f=this._canAdjustMonth(a,1,w,s)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+
4473+g+".datepicker._adjustDate('#"+a.id+"', +"+u+", 'M');\" title=\""+C+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"w":"e")+'">'+C+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+C+'"><span class="ui-icon ui-icon-circle-triangle-'+(e?"w":"e")+'">'+C+"</span></a>",u=this._get(a,"currentText"),C=this._get(a,"gotoCurrent")&&a.currentDay?m:c,u=!t?u:this.formatDate(u,C,this._getFormatConfig(a)),t=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+
4474+g+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"",h=h?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(e?t:"")+(this._isInRange(a,C)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+g+".datepicker._gotoToday('#"+a.id+"');\">"+u+"</button>":"")+(e?"":t)+"</div>":"",t=parseInt(this._get(a,"firstDay"),10),t=isNaN(t)?0:t,u=this._get(a,"showWeek"),C=this._get(a,"dayNames");this._get(a,"dayNamesShort");
4475+var A=this._get(a,"dayNamesMin"),E=this._get(a,"monthNames"),D=this._get(a,"monthNamesShort"),V=this._get(a,"beforeShowDay"),W=this._get(a,"showOtherMonths"),Y=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var aa=this._getDefaultDate(a),G="",L=0;L<v[0];L++){for(var I="",N=0;N<v[1];N++){var Z=this._daylightSavingAdjust(new Date(w,s,a.selectedDay)),J=" ui-corner-all",S="";if(r){S+='<div class="ui-datepicker-group';if(v[1]>1)switch(N){case 0:S+=" ui-datepicker-group-first";J=" ui-corner-"+
4476+(e?"right":"left");break;case v[1]-1:S+=" ui-datepicker-group-last";J=" ui-corner-"+(e?"left":"right");break;default:S+=" ui-datepicker-group-middle",J=""}S+='">'}S+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+J+'">'+(/all|left/.test(J)&&L==0?e?f:y:"")+(/all|right/.test(J)&&L==0?e?y:f:"")+this._generateMonthYearHeader(a,s,w,x,z,L>0||N>0,E,D)+'</div><table class="ui-datepicker-calendar"><thead><tr>';for(var K=u?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+
4477+"</th>":"",J=0;J<7;J++){var B=(J+t)%7;K+="<th"+((J+t+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+C[B]+'">'+A[B]+"</span></th>"}S+=K+"</tr></thead><tbody>";K=this._getDaysInMonth(w,s);if(w==a.selectedYear&&s==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,K);for(var J=(this._getFirstDayOfMonth(w,s)-t+7)%7,K=r?6:Math.ceil((J+K)/7),B=this._daylightSavingAdjust(new Date(w,s,1-J)),U=0;U<K;U++){S+="<tr>";for(var P=!u?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(B)+
4478+"</td>",J=0;J<7;J++){var M=V?V.apply(a.input?a.input[0]:null,[B]):[!0,""],O=B.getMonth()!=s,T=O&&!Y||!M[0]||x&&B<x||z&&B>z;P+='<td class="'+((J+t+6)%7>=5?" ui-datepicker-week-end":"")+(O?" ui-datepicker-other-month":"")+(B.getTime()==Z.getTime()&&s==a.selectedMonth&&a._keyEvent||aa.getTime()==B.getTime()&&aa.getTime()==Z.getTime()?" "+this._dayOverClass:"")+(T?" "+this._unselectableClass+" ui-state-disabled":"")+(O&&!W?"":" "+M[1]+(B.getTime()==m.getTime()?" "+this._currentClass:"")+(B.getTime()==
4479+c.getTime()?" ui-datepicker-today":""))+'"'+((!O||W)&&M[2]?' title="'+M[2]+'"':"")+(T?"":' onclick="DP_jQuery_'+g+".datepicker._selectDay('#"+a.id+"',"+B.getMonth()+","+B.getFullYear()+', this);return false;"')+">"+(O&&!W?"&#xa0;":T?'<span class="ui-state-default">'+B.getDate()+"</span>":'<a class="ui-state-default'+(B.getTime()==c.getTime()?" ui-state-highlight":"")+(B.getTime()==m.getTime()?" ui-state-active":"")+(O?" ui-priority-secondary":"")+'" href="#">'+B.getDate()+"</a>")+"</td>";B.setDate(B.getDate()+
4480+1);B=this._daylightSavingAdjust(B)}S+=P+"</tr>"}s++;s>11&&(s=0,w++);S+="</tbody></table>"+(r?"</div>"+(v[0]>0&&N==v[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");I+=S}G+=I}G+=h+(b.browser.msie&&parseInt(b.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=!1;return G},_generateMonthYearHeader:function(b,a,c,e,h,f,v,s){var u=this._get(b,"changeMonth"),r=this._get(b,"changeYear"),m=this._get(b,"showMonthAfterYear"),
4481+x='<div class="ui-datepicker-title">',z="";if(f||!u)z+='<span class="ui-datepicker-month">'+v[a]+"</span>";else{var v=e&&e.getFullYear()==c,w=h&&h.getFullYear()==c;z+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+g+".datepicker._selectMonthYear('#"+b.id+"', this, 'M');\" onclick=\"DP_jQuery_"+g+".datepicker._clickMonthYear('#"+b.id+"');\">";for(var y=0;y<12;y++)if((!v||y>=e.getMonth())&&(!w||y<=h.getMonth()))z+='<option value="'+y+'"'+(y==a?' selected="selected"':"")+">"+s[y]+"</option>";
4482+z+="</select>"}m||(x+=z+(f||!u||!r?"&#xa0;":""));if(!b.yearshtml)if(b.yearshtml="",f||!r)x+='<span class="ui-datepicker-year">'+c+"</span>";else{var s=this._get(b,"yearRange").split(":"),C=(new Date).getFullYear(),v=function(b){b=b.match(/c[+-].*/)?c+parseInt(b.substring(1),10):b.match(/[+-].*/)?C+parseInt(b,10):parseInt(b,10);return isNaN(b)?C:b},a=v(s[0]),s=Math.max(a,v(s[1]||"")),a=e?Math.max(a,e.getFullYear()):a,s=h?Math.min(s,h.getFullYear()):s;for(b.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+
4483+g+".datepicker._selectMonthYear('#"+b.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+g+".datepicker._clickMonthYear('#"+b.id+"');\">";a<=s;a++)b.yearshtml+='<option value="'+a+'"'+(a==c?' selected="selected"':"")+">"+a+"</option>";b.yearshtml+="</select>";x+=b.yearshtml;b.yearshtml=null}x+=this._get(b,"yearSuffix");m&&(x+=(f||!u||!r?"&#xa0;":"")+z);x+="</div>";return x},_adjustInstDate:function(b,a,c){var e=b.drawYear+(c=="Y"?a:0),g=b.drawMonth+(c=="M"?a:0),a=Math.min(b.selectedDay,this._getDaysInMonth(e,
4484+g))+(c=="D"?a:0),e=this._restrictMinMax(b,this._daylightSavingAdjust(new Date(e,g,a)));b.selectedDay=e.getDate();b.drawMonth=b.selectedMonth=e.getMonth();b.drawYear=b.selectedYear=e.getFullYear();(c=="M"||c=="Y")&&this._notifyChange(b)},_restrictMinMax:function(b,a){var c=this._getMinMaxDate(b,"min"),e=this._getMinMaxDate(b,"max"),c=c&&a<c?c:a;return e&&c>e?e:c},_notifyChange:function(b){var a=this._get(b,"onChangeMonthYear");a&&a.apply(b.input?b.input[0]:null,[b.selectedYear,b.selectedMonth+1,b])},
4485+_getNumberOfMonths:function(b){b=this._get(b,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(b,a){return this._determineDate(b,this._get(b,a+"Date"),null)},_getDaysInMonth:function(b,a){return 32-this._daylightSavingAdjust(new Date(b,a,32)).getDate()},_getFirstDayOfMonth:function(b,a){return(new Date(b,a,1)).getDay()},_canAdjustMonth:function(b,a,c,e){var g=this._getNumberOfMonths(b),c=this._daylightSavingAdjust(new Date(c,e+(a<0?a:g[0]*g[1]),1));a<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),
4486+c.getMonth()));return this._isInRange(b,c)},_isInRange:function(b,a){var c=this._getMinMaxDate(b,"min"),e=this._getMinMaxDate(b,"max");return(!c||a.getTime()>=c.getTime())&&(!e||a.getTime()<=e.getTime())},_getFormatConfig:function(b){var a=this._get(b,"shortYearCutoff"),a=typeof a!="string"?a:(new Date).getFullYear()%100+parseInt(a,10);return{shortYearCutoff:a,dayNamesShort:this._get(b,"dayNamesShort"),dayNames:this._get(b,"dayNames"),monthNamesShort:this._get(b,"monthNamesShort"),monthNames:this._get(b,
4487+"monthNames")}},_formatDate:function(b,a,c,e){if(!a)b.currentDay=b.selectedDay,b.currentMonth=b.selectedMonth,b.currentYear=b.selectedYear;a=a?typeof a=="object"?a:this._daylightSavingAdjust(new Date(e,c,a)):this._daylightSavingAdjust(new Date(b.currentYear,b.currentMonth,b.currentDay));return this.formatDate(this._get(b,"dateFormat"),a,this._getFormatConfig(b))}});b.fn.datepicker=function(a){if(!this.length)return this;if(!b.datepicker.initialized)b(document).mousedown(b.datepicker._checkExternalClick).find("body").append(b.datepicker.dpDiv),
4488 b.datepicker.initialized=!0;var c=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return b.datepicker["_"+a+"Datepicker"].apply(b.datepicker,[this[0]].concat(c));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return b.datepicker["_"+a+"Datepicker"].apply(b.datepicker,[this[0]].concat(c));return this.each(function(){typeof a=="string"?b.datepicker["_"+a+"Datepicker"].apply(b.datepicker,[this].concat(c)):b.datepicker._attachDatepicker(this,
4489-a)})};b.datepicker=new a;b.datepicker.initialized=!1;b.datepicker.uuid=(new Date).getTime();b.datepicker.version="1.8.13";window["DP_jQuery_"+f]=b})(jQuery);function popup(b){newwindow=window.open(b,"name","height=400,width=600");window.focus&&newwindow.focus();return!1}function collapse(b){jQuery("#"+b).slideToggle()}function fade(b,e){e>0?jQuery("#"+b).hide().fadeIn("slow"):jQuery("#"+b).show().fadeOut("slow")}
4490-function ajax(b,e,a){query="";if(typeof e=="string")(d=jQuery(e).serialize())&&(query=d);else{pcs=[];for(i=0;i<e.length;i++)(q=jQuery("#"+e[i]).serialize())&&pcs.push(q);pcs.length>0&&(query=pcs.join("&"))}jQuery.ajax({type:"POST",url:b,data:query,success:function(b){a&&(a==":eval"?eval(b):jQuery("#"+a).html(b))}})}String.prototype.reverse=function(){return this.split("").reverse().join("")};
4491+a)})};b.datepicker=new a;b.datepicker.initialized=!1;b.datepicker.uuid=(new Date).getTime();b.datepicker.version="1.8.13";window["DP_jQuery_"+g]=b})(jQuery);function popup(b){newwindow=window.open(b,"name","height=400,width=600");window.focus&&newwindow.focus();return!1}function collapse(b){jQuery("#"+b).slideToggle()}function fade(b,c){c>0?jQuery("#"+b).hide().fadeIn("slow"):jQuery("#"+b).show().fadeOut("slow")}
4492+function ajax(b,c,a){query="";if(typeof c=="string")(d=jQuery(c).serialize())&&(query=d);else{pcs=[];for(i=0;i<c.length;i++)(q=jQuery("#"+c[i]).serialize())&&pcs.push(q);pcs.length>0&&(query=pcs.join("&"))}jQuery.ajax({type:"POST",url:b,data:query,success:function(b){a&&(a==":eval"?eval(b):jQuery("#"+a).html(b))}})}String.prototype.reverse=function(){return this.split("").reverse().join("")};
4493 function web2py_ajax_init(){jQuery(".hidden").hide();jQuery(".error").hide().slideDown("slow");jQuery(".flash").click(function(){jQuery(this).fadeOut("slow");return!1});jQuery("input.string").attr("size",50);jQuery("textarea.text").attr("cols",50).attr("rows",10);S3.i18n.language=="ja"?(jQuery("input.integer").blur(function(){$("#"+this.id+"__error").remove();if(this.value.reverse().search(/[^0-9\-]|\-(?=.)/)>-1)this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,"").reverse(),$(this).after($("<div/>",
4494 {id:this.id+"__error",text:S3.i18n.input_number,"class":"error"}))}),jQuery("input.double,input.decimal").blur(function(){$("#"+this.id+"__error").remove();if(this.value.reverse().search(/[^0-9\-\.]|[\-](?=.)|[\.](?=[0-9]*[\.])/)>-1)this.value=this.value.reverse().replace(/[^0-9\-\.]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,"").reverse(),$(this).after($("<div/>",{id:this.id+"__error",text:S3.i18n.input_number,"class":"error"}))})):(jQuery("input.integer").live("keyup",function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,
4495 "").reverse()}),jQuery("input.double,input.decimal").live("keyup",function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,"").reverse()}))}jQuery(document).ready(function(){jQuery(".flash").hide().slideDown("slow");jQuery(".flash").html()!=""&&jQuery(".flash").slideDown("slow");web2py_ajax_init()});
4496-function web2py_trap_form(b,e){jQuery("#"+e+" form").each(function(){var a=jQuery(this);a.hasClass("no_trap")||a.submit(function(){jQuery(".flash").hide().html("");web2py_ajax_page("post",b,a.serialize(),e);return!1})})}
4497-function web2py_ajax_page(b,e,a,c){jQuery.ajax({type:b,url:e,data:a,beforeSend:function(b){b.setRequestHeader("web2py-component-location",document.location);b.setRequestHeader("web2py-component-element",c)},complete:function(b){var a=b.responseText,j=b.getResponseHeader("web2py-component-content"),g=b.getResponseHeader("web2py-component-command"),b=b.getResponseHeader("web2py-component-flash"),k=jQuery("#"+c);j=="prepend"?k.prepend(a):j=="append"?k.append(a):j!="hide"&&k.html(a);web2py_trap_form(e,
4498-c);web2py_ajax_init();g&&eval(g);b&&jQuery(".flash").html(b).slideDown()}})}function web2py_component(b,e){jQuery(document).ready(function(){web2py_ajax_page("get",b,null,e)})}function web2py_comet(b,e,a,c){return"WebSocket"in window?(b=new WebSocket(b),b.onopen=a?a:function(){},b.onmessage=e,b.onclose=c?c:function(){},!0):!1}
4499+function web2py_trap_form(b,c){jQuery("#"+c+" form").each(function(){var a=jQuery(this);a.hasClass("no_trap")||a.submit(function(){jQuery(".flash").hide().html("");web2py_ajax_page("post",b,a.serialize(),c);return!1})})}
4500+function web2py_ajax_page(b,c,a,e){jQuery.ajax({type:b,url:c,data:a,beforeSend:function(b){b.setRequestHeader("web2py-component-location",document.location);b.setRequestHeader("web2py-component-element",e)},complete:function(b){var a=b.responseText,h=b.getResponseHeader("web2py-component-content"),j=b.getResponseHeader("web2py-component-command"),b=b.getResponseHeader("web2py-component-flash"),k=jQuery("#"+e);h=="prepend"?k.prepend(a):h=="append"?k.append(a):h!="hide"&&k.html(a);web2py_trap_form(c,
4501+e);web2py_ajax_init();j&&eval(j);b&&jQuery(".flash").html(b).slideDown()}})}function web2py_component(b,c){jQuery(document).ready(function(){web2py_ajax_page("get",b,null,c)})}function web2py_comet(b,c,a,e){return"WebSocket"in window?(b=new WebSocket(b),b.onopen=a?a:function(){},b.onmessage=c,b.onclose=e?e:function(){},!0):!1}
4502 jQuery(document).ready(function(){jQuery(".s3_checkbox_label").cluetip({activation:"hover",positionBy:"auto",local:!0,hideLocal:!1,showTitle:!1,topOffset:0,mouseOutClose:!0,arrows:!0,clickThrough:!0})});
4503-(function(b,e){function a(a,c){a=a?' id="'+o+a+'"':"";return b("<div"+a+(c?' style="'+c+'"':"")+"/>")}function c(b,a){a=a==="x"?L.width():L.height();return typeof b==="string"?Math.round(/%/.test(b)?a/100*parseInt(b,10):parseInt(b,10)):b}function h(b){return l.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function f(a){for(var c in a)b.isFunction(a[c])&&c.substring(0,2)!=="on"&&(a[c]=a[c].call(Q));a.rel=a.rel||Q.rel||"nofollow";a.href=a.href||b(Q).attr("href");a.title=a.title||
4504-Q.title;return a}function j(a,c){c&&c.call(Q);b.event.trigger(a)}function g(){var b,a=o+"Slideshow_",c="click."+o,f,e;l.slideshow&&G[1]&&(f=function(){K.text(l.slideshowStop).unbind(c).bind(t,function(){if(F<G.length-1||l.loop)b=setTimeout(H.next,l.slideshowSpeed)}).bind(v,function(){clearTimeout(b)}).one(c+" "+u,e);A.removeClass(a+"off").addClass(a+"on");b=setTimeout(H.next,l.slideshowSpeed)},e=function(){clearTimeout(b);K.text(l.slideshowStart).unbind([t,v,u,c].join(" ")).one(c,f);A.removeClass(a+
4505-"on").addClass(a+"off")},l.slideshowAuto?f():e())}function k(a){if(!da){Q=a;l=f(b.extend({},b.data(Q,p)));G=b(Q);F=0;l.rel!=="nofollow"&&(G=b("."+ca).filter(function(){return(b.data(this,p).rel||this.rel)===l.rel}),F=G.index(Q),F===-1&&(G=G.add(Q),F=G.length-1));if(!X){X=ba=!0;A.show();if(l.returnFocus)try{Q.blur(),b(Q).one(r,function(){try{this.focus()}catch(b){}})}catch(e){}C.css({opacity:+l.opacity,cursor:l.overlayClose?"pointer":"auto"}).show();l.w=c(l.initialWidth,"x");l.h=c(l.initialHeight,
4506-"y");H.position(0);w&&L.bind("resize."+y+" scroll."+y,function(){C.css({width:L.width(),height:L.height(),top:L.scrollTop(),left:L.scrollLeft()})}).trigger("scroll."+y);j(s,l.onOpen);S.add(U).add(B).add(K).add(J).hide();P.html(l.close).show()}H.load(!0)}}var n={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,photo:!1,href:!1,title:!1,rel:!1,opacity:0.9,
4507-preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0},p="colorbox",o="cbox",s=o+"_open",v=o+"_load",t=o+"_complete",u=o+"_cleanup",r=o+"_closed",m=o+"_purge",x=o+"_loaded",z=b.browser.msie&&!b.support.opacity,w=z&&b.browser.version<
4508-7,y=o+"_IE6",C,A,E,D,V,W,Y,aa,G,L,I,N,Z,J,S,K,B,U,P,M,O,T,R,Q,F,l,X,ba,da=!1,H,ca=o+"Element";H=b.fn[p]=b[p]=function(a,c){var f=this,e;if(!f[0]&&f.selector)return f;a=a||{};if(c)a.onComplete=c;if(!f[0]||f.selector===void 0)f=b("<a/>"),a.open=!0;f.each(function(){b.data(this,p,b.extend({},b.data(this,p)||n,a));b(this).addClass(ca)});e=a.open;b.isFunction(e)&&(e=e.call(f));e&&k(f[0]);return f};H.init=function(){L=b(e);A=a().attr({id:p,"class":z?o+"IE":""});C=a("Overlay",w?"position:absolute":"").hide();
4509-E=a("Wrapper");D=a("Content").append(I=a("LoadedContent","width:0; height:0; overflow:hidden"),Z=a("LoadingOverlay").add(a("LoadingGraphic")),J=a("Title"),S=a("Current"),B=a("Next"),U=a("Previous"),K=a("Slideshow").bind(s,g),P=a("Close"));E.append(a().append(a("TopLeft"),V=a("TopCenter"),a("TopRight")),a(!1,"clear:left").append(W=a("MiddleLeft"),D,Y=a("MiddleRight")),a(!1,"clear:left").append(a("BottomLeft"),aa=a("BottomCenter"),a("BottomRight"))).children().children().css({"float":"left"});N=a(!1,
4510+(function(b,c){function a(a,c){a=a?' id="'+o+a+'"':"";return b("<div"+a+(c?' style="'+c+'"':"")+"/>")}function e(b,a){a=a==="x"?L.width():L.height();return typeof b==="string"?Math.round(/%/.test(b)?a/100*parseInt(b,10):parseInt(b,10)):b}function f(b){return l.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function g(a){for(var c in a)b.isFunction(a[c])&&c.substring(0,2)!=="on"&&(a[c]=a[c].call(Q));a.rel=a.rel||Q.rel||"nofollow";a.href=a.href||b(Q).attr("href");a.title=a.title||
4511+Q.title;return a}function h(a,c){c&&c.call(Q);b.event.trigger(a)}function j(){var b,a=o+"Slideshow_",c="click."+o,e,g;l.slideshow&&G[1]&&(e=function(){K.text(l.slideshowStop).unbind(c).bind(s,function(){if(F<G.length-1||l.loop)b=setTimeout(H.next,l.slideshowSpeed)}).bind(v,function(){clearTimeout(b)}).one(c+" "+u,g);A.removeClass(a+"off").addClass(a+"on");b=setTimeout(H.next,l.slideshowSpeed)},g=function(){clearTimeout(b);K.text(l.slideshowStart).unbind([s,v,u,c].join(" ")).one(c,e);A.removeClass(a+
4512+"on").addClass(a+"off")},l.slideshowAuto?e():g())}function k(a){if(!da){Q=a;l=g(b.extend({},b.data(Q,n)));G=b(Q);F=0;l.rel!=="nofollow"&&(G=b("."+ca).filter(function(){return(b.data(this,n).rel||this.rel)===l.rel}),F=G.index(Q),F===-1&&(G=G.add(Q),F=G.length-1));if(!X){X=ba=!0;A.show();if(l.returnFocus)try{Q.blur(),b(Q).one(r,function(){try{this.focus()}catch(b){}})}catch(c){}C.css({opacity:+l.opacity,cursor:l.overlayClose?"pointer":"auto"}).show();l.w=e(l.initialWidth,"x");l.h=e(l.initialHeight,
4513+"y");H.position(0);w&&L.bind("resize."+y+" scroll."+y,function(){C.css({width:L.width(),height:L.height(),top:L.scrollTop(),left:L.scrollLeft()})}).trigger("scroll."+y);h(t,l.onOpen);S.add(U).add(B).add(K).add(J).hide();P.html(l.close).show()}H.load(!0)}}var p={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,photo:!1,href:!1,title:!1,rel:!1,opacity:0.9,
4514+preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0},n="colorbox",o="cbox",t=o+"_open",v=o+"_load",s=o+"_complete",u=o+"_cleanup",r=o+"_closed",m=o+"_purge",x=o+"_loaded",z=b.browser.msie&&!b.support.opacity,w=z&&b.browser.version<
4515+7,y=o+"_IE6",C,A,E,D,V,W,Y,aa,G,L,I,N,Z,J,S,K,B,U,P,M,O,T,R,Q,F,l,X,ba,da=!1,H,ca=o+"Element";H=b.fn[n]=b[n]=function(a,c){var e=this,g;if(!e[0]&&e.selector)return e;a=a||{};if(c)a.onComplete=c;if(!e[0]||e.selector===void 0)e=b("<a/>"),a.open=!0;e.each(function(){b.data(this,n,b.extend({},b.data(this,n)||p,a));b(this).addClass(ca)});g=a.open;b.isFunction(g)&&(g=g.call(e));g&&k(e[0]);return e};H.init=function(){L=b(c);A=a().attr({id:n,"class":z?o+"IE":""});C=a("Overlay",w?"position:absolute":"").hide();
4516+E=a("Wrapper");D=a("Content").append(I=a("LoadedContent","width:0; height:0; overflow:hidden"),Z=a("LoadingOverlay").add(a("LoadingGraphic")),J=a("Title"),S=a("Current"),B=a("Next"),U=a("Previous"),K=a("Slideshow").bind(t,j),P=a("Close"));E.append(a().append(a("TopLeft"),V=a("TopCenter"),a("TopRight")),a(!1,"clear:left").append(W=a("MiddleLeft"),D,Y=a("MiddleRight")),a(!1,"clear:left").append(a("BottomLeft"),aa=a("BottomCenter"),a("BottomRight"))).children().children().css({"float":"left"});N=a(!1,
4517 "position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(C,A.append(E,N));D.children().hover(function(){b(this).addClass("hover")},function(){b(this).removeClass("hover")}).addClass("hover");M=V.height()+aa.height()+D.outerHeight(!0)-D.height();O=W.width()+Y.width()+D.outerWidth(!0)-D.width();T=I.outerHeight(!0);R=I.outerWidth(!0);A.css({"padding-bottom":M,"padding-right":O}).hide();B.click(H.next);U.click(H.prev);P.click(H.close);D.children().removeClass("hover");b("."+
4518-ca).live("click",function(b){b.button!==0&&typeof b.button!=="undefined"||b.ctrlKey||b.shiftKey||b.altKey||(b.preventDefault(),k(this))});C.click(function(){l.overlayClose&&H.close()});b(document).bind("keydown",function(b){X&&l.escKey&&b.keyCode===27&&(b.preventDefault(),H.close());if(X&&l.arrowKey&&!ba&&G[1])if(b.keyCode===37&&(F||l.loop))b.preventDefault(),U.click();else if(b.keyCode===39&&(F<G.length-1||l.loop))b.preventDefault(),B.click()})};H.remove=function(){A.add(C).remove();b("."+ca).die("click").removeData(p).removeClass(ca)};
4519-H.position=function(b,a){function c(b){V[0].style.width=aa[0].style.width=D[0].style.width=b.style.width;Z[0].style.height=Z[1].style.height=D[0].style.height=W[0].style.height=Y[0].style.height=b.style.height}var f,e=Math.max(document.documentElement.clientHeight-l.h-T-M,0)/2+L.scrollTop(),j=Math.max(L.width()-l.w-R-O,0)/2+L.scrollLeft();f=A.width()===l.w+R&&A.height()===l.h+T?0:b;E[0].style.width=E[0].style.height="9999px";A.dequeue().animate({width:l.w+R,height:l.h+T,top:e,left:j},{duration:f,
4520-complete:function(){c(this);ba=!1;E[0].style.width=l.w+R+O+"px";E[0].style.height=l.h+T+M+"px";a&&a()},step:function(){c(this)}})};H.resize=function(b){if(X){b=b||{};if(b.width)l.w=c(b.width,"x")-R-O;if(b.innerWidth)l.w=c(b.innerWidth,"x");I.css({width:l.w});if(b.height)l.h=c(b.height,"y")-T-M;if(b.innerHeight)l.h=c(b.innerHeight,"y");if(!b.innerHeight&&!b.height)b=I.wrapInner("<div style='overflow:auto'></div>").children(),l.h=b.height(),b.replaceWith(b.children());I.css({height:l.h});H.position(l.transition===
4521-"none"?0:l.speed)}};H.prep=function(c){function f(a){var c,k,n,m,s=G.length,r=l.loop;H.position(a,function(){function a(){z&&A[0].style.removeAttribute("filter")}if(X){z&&e&&I.fadeIn(100);I.show();j(x);J.show().html(l.title);if(s>1&&(typeof l.current==="string"&&S.html(l.current.replace(/\{current\}/,F+1).replace(/\{total\}/,s)).show(),B[r||F<s-1?"show":"hide"]().html(l.next),U[r||F?"show":"hide"]().html(l.previous),c=F?G[F-1]:G[s-1],n=F<s-1?G[F+1]:G[0],l.slideshow&&K.show(),l.preloading)){m=b.data(n,
4522-p).href||n.href;k=b.data(c,p).href||c.href;m=b.isFunction(m)?m.call(n):m;k=b.isFunction(k)?k.call(c):k;if(h(m))b("<img/>")[0].src=m;if(h(k))b("<img/>")[0].src=k}Z.hide();l.transition==="fade"?A.fadeTo(g,1,function(){a()}):a();L.bind("resize."+o,function(){H.position(0)});j(t,l.onComplete)}})}if(X){var e,g=l.transition==="none"?0:l.speed;L.unbind("resize."+o);I.remove();I=a("LoadedContent").html(c);I.hide().appendTo(N.show()).css({width:function(){l.w=l.w||I.width();l.w=l.mw&&l.mw<l.w?l.mw:l.w;return l.w}(),
4523-overflow:l.scrolling?"auto":"hidden"}).css({height:function(){l.h=l.h||I.height();l.h=l.mh&&l.mh<l.h?l.mh:l.h;return l.h}()}).prependTo(D);N.hide();b("#"+o+"Photo").css({cssFloat:"none",marginLeft:"auto",marginRight:"auto"});if(w)b("select").not(A.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(u,function(){this.style.visibility="inherit"});l.transition==="fade"?A.fadeTo(g,0,function(){f(0)}):f(g)}};H.load=function(e){var g,k,n,s=H.prep;ba=
4524-!0;Q=G[F];e||(l=f(b.extend({},b.data(Q,p))));j(m);j(v,l.onLoad);l.h=l.height?c(l.height,"y")-T-M:l.innerHeight&&c(l.innerHeight,"y");l.w=l.width?c(l.width,"x")-R-O:l.innerWidth&&c(l.innerWidth,"x");l.mw=l.w;l.mh=l.h;if(l.maxWidth)l.mw=c(l.maxWidth,"x")-R-O,l.mw=l.w&&l.w<l.mw?l.w:l.mw;if(l.maxHeight)l.mh=c(l.maxHeight,"y")-T-M,l.mh=l.h&&l.h<l.mh?l.h:l.mh;g=l.href;Z.show();l.inline?(a().hide().insertBefore(b(g)[0]).one(m,function(){b(this).replaceWith(I.children())}),s(b(g))):l.iframe?(A.one(x,function(){var a=
4525-b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];a.name=o+ +new Date;a.src=l.href;if(!l.scrolling)a.scrolling="no";if(z)a.allowtransparency="true";b(a).appendTo(I).one(m,function(){a.src="//about:blank"})}),s(" ")):l.html?s(l.html):h(g)?(k=new Image,k.onload=function(){var a;k.onload=null;k.id=o+"Photo";b(k).css({border:"none",display:"block",cssFloat:"left"});l.scalePhotos&&(n=function(){k.height-=k.height*a;k.width-=k.width*a},l.mw&&k.width>l.mw&&(a=(k.width-
4526-l.mw)/k.width,n()),l.mh&&k.height>l.mh&&(a=(k.height-l.mh)/k.height,n()));if(l.h)k.style.marginTop=Math.max(l.h-k.height,0)/2+"px";G[1]&&(F<G.length-1||l.loop)&&b(k).css({cursor:"pointer"}).click(H.next);if(z)k.style.msInterpolationMode="bicubic";setTimeout(function(){s(k)},1)},setTimeout(function(){k.src=g},1)):g&&N.load(g,function(a,c,f){s(c==="error"?"Request unsuccessful: "+f.statusText:b(this).children())})};H.next=function(){ba||(F=F<G.length-1?F+1:0,H.load())};H.prev=function(){ba||(F=F?F-
4527-1:G.length-1,H.load())};H.close=function(){X&&!da&&(da=!0,X=!1,j(u,l.onCleanup),L.unbind("."+o+" ."+y),C.fadeTo("fast",0),A.stop().fadeTo("fast",0,function(){j(m);I.remove();A.add(C).css({opacity:1,cursor:"auto"}).hide();setTimeout(function(){da=!1;j(r,l.onClosed)},1)}))};H.element=function(){return b(Q)};H.settings=n;b(H.init)})(jQuery,this);
4528-(function(b,e){function a(){this.debug=!0;this._curInst=null;this._isInline=!1;this._disabledInputs=[];this._inDialog=this._timepickerShowing=!1;this._dialogClass="ui-timepicker-dialog";this._mainDivId="ui-timepicker-div";this._inlineClass="ui-timepicker-inline";this._currentClass="ui-timepicker-current";this._dayOverClass="ui-timepicker-days-cell-over";this.regional=[];this.regional[""]={hourText:"Hour",minuteText:"Minute",amPmText:["AM","PM"]};this._defaults={showOn:"focus",button:null,showAnim:"fadeIn",
4529-showOptions:{},appendText:"",onSelect:null,onClose:null,timeSeparator:":",showPeriod:!1,showPeriodLabels:!0,showLeadingZero:!0,showMinutesLeadingZero:!0,altField:"",defaultTime:"",onHourShow:null,onMinuteShow:null,zIndex:null};b.extend(this._defaults,this.regional[""]);this.tpDiv=b('<div id="'+this._mainDivId+'" class="ui-timepicker ui-widget ui-helper-clearfix ui-corner-all " style="display: none"></div>')}function c(a,c){b.extend(a,c);for(var g in c)if(c[g]==null||c[g]==e)a[g]=c[g];return a}b.extend(b.ui,
4530-{timepicker:{version:"0.1.3"}});var h=(new Date).getTime();b.extend(a.prototype,{markerClassName:"hasTimepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetTimepicker:function(){return this.tpDiv},setDefaults:function(b){c(this._defaults,b||{});return this},_attachTimepicker:function(a,c){var e=null,h;for(h in this._defaults){var n=a.getAttribute("time:"+h);if(n){e=e||{};try{e[h]=eval(n)}catch(p){e[h]=n}}}h=a.nodeName.toLowerCase();n=h=="div"||h=="span";if(!a.id)this.uuid+=
4531-1,a.id="tp"+this.uuid;var o=this._newInst(b(a),n);o.settings=b.extend({},c||{},e||{});h=="input"?this._connectTimepicker(a,o):n&&this._inlineTimepicker(a,o)},_newInst:function(a,c){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:c,tpDiv:!c?this.tpDiv:b('<div class="'+this._inlineClass+' ui-timepicker ui-widget ui-helper-clearfix"></div>')}},_connectTimepicker:function(a,c){var e=b(a);c.append=b([]);c.trigger=
4532-b([]);e.hasClass(this.markerClassName)||(this._attachments(e,c),e.addClass(this.markerClassName).keydown(this._doKeyDown).keyup(this._doKeyUp).bind("setData.timepicker",function(b,a,f){c.settings[a]=f}).bind("getData.timepicker",function(b,a){return this._get(c,a)}),b.data(a,"timepicker",c))},_doKeyDown:function(a){var c=!0;b.timepicker._getInst(a.target)._keyEvent=!0;if(b.timepicker._timepickerShowing)switch(a.keyCode){case 9:b.timepicker._hideTimepicker();c=!1;break;case 27:b.timepicker._hideTimepicker();
4533-break;default:c=!1}else a.keyCode==36&&a.ctrlKey?b.timepicker._showTimepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyUp:function(a){a=b.timepicker._getInst(a.target);b.timepicker._setTimeFromField(a);b.timepicker._updateTimepicker(a)},_attachments:function(a,c){var e=this._get(c,"appendText"),h=this._get(c,"isRTL");c.append&&c.append.remove();if(e)c.append=b('<span class="'+this._appendClass+'">'+e+"</span>"),a[h?"before":"after"](c.append);a.unbind("focus",this._showTimepicker);
4534-c.trigger&&c.trigger.remove();e=this._get(c,"showOn");(e=="focus"||e=="both")&&a.focus(this._showTimepicker);if(e=="button"||e=="both")e=this._get(c,"button"),b(e).click(function(){b.timepicker._timepickerShowing&&b.timepicker._lastInput==a[0]?b.timepicker._hideTimepicker():b.timepicker._showTimepicker(a[0]);return!1})},_inlineTimepicker:function(a,c){var e=b(a);e.hasClass(this.markerClassName)||(e.addClass(this.markerClassName).append(c.tpDiv).bind("setData.timepicker",function(b,a,f){c.settings[a]=
4535-f}).bind("getData.timepicker",function(b,a){return this._get(c,a)}),b.data(a,"timepicker",c),this._setTimeFromField(c),this._updateTimepicker(c),c.tpDiv.show())},_showTimepicker:function(a){a=a.target||a;a.nodeName.toLowerCase()!="input"&&(a=b("input",a.parentNode)[0]);if(!(b.timepicker._isDisabledTimepicker(a)||b.timepicker._lastInput==a)){b.timepicker._hideTimepicker();var e=b.timepicker._getInst(a);b.timepicker._curInst&&b.timepicker._curInst!=e&&b.timepicker._curInst.tpDiv.stop(!0,!0);var g=b.timepicker._get(e,
4536-"beforeShow");c(e.settings,g?g.apply(a,[a,e]):{});e.lastVal=null;b.timepicker._lastInput=a;b.timepicker._setTimeFromField(e);if(b.timepicker._inDialog)a.value="";if(!b.timepicker._pos)b.timepicker._pos=b.timepicker._findPos(a),b.timepicker._pos[1]+=a.offsetHeight;var h=!1;b(a).parents().each(function(){h|=b(this).css("position")=="fixed";return!h});h&&b.browser.opera&&(b.timepicker._pos[0]-=document.documentElement.scrollLeft,b.timepicker._pos[1]-=document.documentElement.scrollTop);g={left:b.timepicker._pos[0],
4537-top:b.timepicker._pos[1]};b.timepicker._pos=null;e.tpDiv.css({position:"absolute",display:"block",top:"-1000px"});b.timepicker._updateTimepicker(e);e._hoursClicked=!1;e._minutesClicked=!1;g=b.timepicker._checkOffset(e,g,h);e.tpDiv.css({position:b.timepicker._inDialog&&b.blockUI?"static":h?"fixed":"absolute",display:"none",left:g.left+"px",top:g.top+"px"});if(!e.inline){var g=b.timepicker._get(e,"showAnim"),n=b.timepicker._get(e,"duration"),p=b.timepicker._get(e,"zIndex"),o=function(){b.timepicker._timepickerShowing=
4538-!0;var a=b.timepicker._getBorders(e.tpDiv);e.tpDiv.find("iframe.ui-timepicker-cover").css({left:-a[0],top:-a[1],width:e.tpDiv.outerWidth(),height:e.tpDiv.outerHeight()})};p||(p=b(a).zIndex()+1);e.tpDiv.zIndex(p);if(b.effects&&b.effects[g])e.tpDiv.show(g,b.timepicker._get(e,"showOptions"),n,o);else e.tpDiv[g||"show"](g?n:null,o);(!g||!n)&&o();e.input.is(":visible")&&!e.input.is(":disabled")&&e.input.focus();b.timepicker._curInst=e}}},_updateTimepicker:function(a){var c=this,e=b.timepicker._getBorders(a.tpDiv);
4539+ca).live("click",function(b){b.button!==0&&typeof b.button!=="undefined"||b.ctrlKey||b.shiftKey||b.altKey||(b.preventDefault(),k(this))});C.click(function(){l.overlayClose&&H.close()});b(document).bind("keydown",function(b){X&&l.escKey&&b.keyCode===27&&(b.preventDefault(),H.close());if(X&&l.arrowKey&&!ba&&G[1])if(b.keyCode===37&&(F||l.loop))b.preventDefault(),U.click();else if(b.keyCode===39&&(F<G.length-1||l.loop))b.preventDefault(),B.click()})};H.remove=function(){A.add(C).remove();b("."+ca).die("click").removeData(n).removeClass(ca)};
4540+H.position=function(b,a){function c(b){V[0].style.width=aa[0].style.width=D[0].style.width=b.style.width;Z[0].style.height=Z[1].style.height=D[0].style.height=W[0].style.height=Y[0].style.height=b.style.height}var e,g=Math.max(document.documentElement.clientHeight-l.h-T-M,0)/2+L.scrollTop(),h=Math.max(L.width()-l.w-R-O,0)/2+L.scrollLeft();e=A.width()===l.w+R&&A.height()===l.h+T?0:b;E[0].style.width=E[0].style.height="9999px";A.dequeue().animate({width:l.w+R,height:l.h+T,top:g,left:h},{duration:e,
4541+complete:function(){c(this);ba=!1;E[0].style.width=l.w+R+O+"px";E[0].style.height=l.h+T+M+"px";a&&a()},step:function(){c(this)}})};H.resize=function(b){if(X){b=b||{};if(b.width)l.w=e(b.width,"x")-R-O;if(b.innerWidth)l.w=e(b.innerWidth,"x");I.css({width:l.w});if(b.height)l.h=e(b.height,"y")-T-M;if(b.innerHeight)l.h=e(b.innerHeight,"y");if(!b.innerHeight&&!b.height)b=I.wrapInner("<div style='overflow:auto'></div>").children(),l.h=b.height(),b.replaceWith(b.children());I.css({height:l.h});H.position(l.transition===
4542+"none"?0:l.speed)}};H.prep=function(c){function e(a){var c,k,p,m,r=G.length,t=l.loop;H.position(a,function(){function a(){z&&A[0].style.removeAttribute("filter")}if(X){z&&g&&I.fadeIn(100);I.show();h(x);J.show().html(l.title);if(r>1&&(typeof l.current==="string"&&S.html(l.current.replace(/\{current\}/,F+1).replace(/\{total\}/,r)).show(),B[t||F<r-1?"show":"hide"]().html(l.next),U[t||F?"show":"hide"]().html(l.previous),c=F?G[F-1]:G[r-1],p=F<r-1?G[F+1]:G[0],l.slideshow&&K.show(),l.preloading)){m=b.data(p,
4543+n).href||p.href;k=b.data(c,n).href||c.href;m=b.isFunction(m)?m.call(p):m;k=b.isFunction(k)?k.call(c):k;if(f(m))b("<img/>")[0].src=m;if(f(k))b("<img/>")[0].src=k}Z.hide();l.transition==="fade"?A.fadeTo(j,1,function(){a()}):a();L.bind("resize."+o,function(){H.position(0)});h(s,l.onComplete)}})}if(X){var g,j=l.transition==="none"?0:l.speed;L.unbind("resize."+o);I.remove();I=a("LoadedContent").html(c);I.hide().appendTo(N.show()).css({width:function(){l.w=l.w||I.width();l.w=l.mw&&l.mw<l.w?l.mw:l.w;return l.w}(),
4544+overflow:l.scrolling?"auto":"hidden"}).css({height:function(){l.h=l.h||I.height();l.h=l.mh&&l.mh<l.h?l.mh:l.h;return l.h}()}).prependTo(D);N.hide();b("#"+o+"Photo").css({cssFloat:"none",marginLeft:"auto",marginRight:"auto"});if(w)b("select").not(A.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(u,function(){this.style.visibility="inherit"});l.transition==="fade"?A.fadeTo(j,0,function(){e(0)}):e(j)}};H.load=function(c){var j,k,p,r=H.prep;ba=
4545+!0;Q=G[F];c||(l=g(b.extend({},b.data(Q,n))));h(m);h(v,l.onLoad);l.h=l.height?e(l.height,"y")-T-M:l.innerHeight&&e(l.innerHeight,"y");l.w=l.width?e(l.width,"x")-R-O:l.innerWidth&&e(l.innerWidth,"x");l.mw=l.w;l.mh=l.h;if(l.maxWidth)l.mw=e(l.maxWidth,"x")-R-O,l.mw=l.w&&l.w<l.mw?l.w:l.mw;if(l.maxHeight)l.mh=e(l.maxHeight,"y")-T-M,l.mh=l.h&&l.h<l.mh?l.h:l.mh;j=l.href;Z.show();l.inline?(a().hide().insertBefore(b(j)[0]).one(m,function(){b(this).replaceWith(I.children())}),r(b(j))):l.iframe?(A.one(x,function(){var a=
4546+b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];a.name=o+ +new Date;a.src=l.href;if(!l.scrolling)a.scrolling="no";if(z)a.allowtransparency="true";b(a).appendTo(I).one(m,function(){a.src="//about:blank"})}),r(" ")):l.html?r(l.html):f(j)?(k=new Image,k.onload=function(){var a;k.onload=null;k.id=o+"Photo";b(k).css({border:"none",display:"block",cssFloat:"left"});l.scalePhotos&&(p=function(){k.height-=k.height*a;k.width-=k.width*a},l.mw&&k.width>l.mw&&(a=(k.width-
4547+l.mw)/k.width,p()),l.mh&&k.height>l.mh&&(a=(k.height-l.mh)/k.height,p()));if(l.h)k.style.marginTop=Math.max(l.h-k.height,0)/2+"px";G[1]&&(F<G.length-1||l.loop)&&b(k).css({cursor:"pointer"}).click(H.next);if(z)k.style.msInterpolationMode="bicubic";setTimeout(function(){r(k)},1)},setTimeout(function(){k.src=j},1)):j&&N.load(j,function(a,c,e){r(c==="error"?"Request unsuccessful: "+e.statusText:b(this).children())})};H.next=function(){ba||(F=F<G.length-1?F+1:0,H.load())};H.prev=function(){ba||(F=F?F-
4548+1:G.length-1,H.load())};H.close=function(){X&&!da&&(da=!0,X=!1,h(u,l.onCleanup),L.unbind("."+o+" ."+y),C.fadeTo("fast",0),A.stop().fadeTo("fast",0,function(){h(m);I.remove();A.add(C).css({opacity:1,cursor:"auto"}).hide();setTimeout(function(){da=!1;h(r,l.onClosed)},1)}))};H.element=function(){return b(Q)};H.settings=p;b(H.init)})(jQuery,this);
4549+(function(b,c){function a(){this.debug=!0;this._curInst=null;this._isInline=!1;this._disabledInputs=[];this._inDialog=this._timepickerShowing=!1;this._dialogClass="ui-timepicker-dialog";this._mainDivId="ui-timepicker-div";this._inlineClass="ui-timepicker-inline";this._currentClass="ui-timepicker-current";this._dayOverClass="ui-timepicker-days-cell-over";this.regional=[];this.regional[""]={hourText:"Hour",minuteText:"Minute",amPmText:["AM","PM"]};this._defaults={showOn:"focus",button:null,showAnim:"fadeIn",
4550+showOptions:{},appendText:"",onSelect:null,onClose:null,timeSeparator:":",showPeriod:!1,showPeriodLabels:!0,showLeadingZero:!0,showMinutesLeadingZero:!0,altField:"",defaultTime:"",onHourShow:null,onMinuteShow:null,zIndex:null};b.extend(this._defaults,this.regional[""]);this.tpDiv=b('<div id="'+this._mainDivId+'" class="ui-timepicker ui-widget ui-helper-clearfix ui-corner-all " style="display: none"></div>')}function e(a,e){b.extend(a,e);for(var f in e)if(e[f]==null||e[f]==c)a[f]=e[f];return a}b.extend(b.ui,
4551+{timepicker:{version:"0.1.3"}});var f=(new Date).getTime();b.extend(a.prototype,{markerClassName:"hasTimepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetTimepicker:function(){return this.tpDiv},setDefaults:function(b){e(this._defaults,b||{});return this},_attachTimepicker:function(a,c){var e=null,f;for(f in this._defaults){var p=a.getAttribute("time:"+f);if(p){e=e||{};try{e[f]=eval(p)}catch(n){e[f]=p}}}f=a.nodeName.toLowerCase();p=f=="div"||f=="span";if(!a.id)this.uuid+=
4552+1,a.id="tp"+this.uuid;var o=this._newInst(b(a),p);o.settings=b.extend({},c||{},e||{});f=="input"?this._connectTimepicker(a,o):p&&this._inlineTimepicker(a,o)},_newInst:function(a,c){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:c,tpDiv:!c?this.tpDiv:b('<div class="'+this._inlineClass+' ui-timepicker ui-widget ui-helper-clearfix"></div>')}},_connectTimepicker:function(a,c){var e=b(a);c.append=b([]);c.trigger=
4553+b([]);e.hasClass(this.markerClassName)||(this._attachments(e,c),e.addClass(this.markerClassName).keydown(this._doKeyDown).keyup(this._doKeyUp).bind("setData.timepicker",function(b,a,e){c.settings[a]=e}).bind("getData.timepicker",function(b,a){return this._get(c,a)}),b.data(a,"timepicker",c))},_doKeyDown:function(a){var c=!0;b.timepicker._getInst(a.target)._keyEvent=!0;if(b.timepicker._timepickerShowing)switch(a.keyCode){case 9:b.timepicker._hideTimepicker();c=!1;break;case 27:b.timepicker._hideTimepicker();
4554+break;default:c=!1}else a.keyCode==36&&a.ctrlKey?b.timepicker._showTimepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyUp:function(a){a=b.timepicker._getInst(a.target);b.timepicker._setTimeFromField(a);b.timepicker._updateTimepicker(a)},_attachments:function(a,c){var e=this._get(c,"appendText"),f=this._get(c,"isRTL");c.append&&c.append.remove();if(e)c.append=b('<span class="'+this._appendClass+'">'+e+"</span>"),a[f?"before":"after"](c.append);a.unbind("focus",this._showTimepicker);
4555+c.trigger&&c.trigger.remove();e=this._get(c,"showOn");(e=="focus"||e=="both")&&a.focus(this._showTimepicker);if(e=="button"||e=="both")e=this._get(c,"button"),b(e).click(function(){b.timepicker._timepickerShowing&&b.timepicker._lastInput==a[0]?b.timepicker._hideTimepicker():b.timepicker._showTimepicker(a[0]);return!1})},_inlineTimepicker:function(a,c){var e=b(a);e.hasClass(this.markerClassName)||(e.addClass(this.markerClassName).append(c.tpDiv).bind("setData.timepicker",function(b,a,e){c.settings[a]=
4556+e}).bind("getData.timepicker",function(b,a){return this._get(c,a)}),b.data(a,"timepicker",c),this._setTimeFromField(c),this._updateTimepicker(c),c.tpDiv.show())},_showTimepicker:function(a){a=a.target||a;a.nodeName.toLowerCase()!="input"&&(a=b("input",a.parentNode)[0]);if(!(b.timepicker._isDisabledTimepicker(a)||b.timepicker._lastInput==a)){b.timepicker._hideTimepicker();var c=b.timepicker._getInst(a);b.timepicker._curInst&&b.timepicker._curInst!=c&&b.timepicker._curInst.tpDiv.stop(!0,!0);var f=b.timepicker._get(c,
4557+"beforeShow");e(c.settings,f?f.apply(a,[a,c]):{});c.lastVal=null;b.timepicker._lastInput=a;b.timepicker._setTimeFromField(c);if(b.timepicker._inDialog)a.value="";if(!b.timepicker._pos)b.timepicker._pos=b.timepicker._findPos(a),b.timepicker._pos[1]+=a.offsetHeight;var k=!1;b(a).parents().each(function(){k|=b(this).css("position")=="fixed";return!k});k&&b.browser.opera&&(b.timepicker._pos[0]-=document.documentElement.scrollLeft,b.timepicker._pos[1]-=document.documentElement.scrollTop);f={left:b.timepicker._pos[0],
4558+top:b.timepicker._pos[1]};b.timepicker._pos=null;c.tpDiv.css({position:"absolute",display:"block",top:"-1000px"});b.timepicker._updateTimepicker(c);c._hoursClicked=!1;c._minutesClicked=!1;f=b.timepicker._checkOffset(c,f,k);c.tpDiv.css({position:b.timepicker._inDialog&&b.blockUI?"static":k?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!c.inline){var f=b.timepicker._get(c,"showAnim"),p=b.timepicker._get(c,"duration"),n=b.timepicker._get(c,"zIndex"),o=function(){b.timepicker._timepickerShowing=
4559+!0;var a=b.timepicker._getBorders(c.tpDiv);c.tpDiv.find("iframe.ui-timepicker-cover").css({left:-a[0],top:-a[1],width:c.tpDiv.outerWidth(),height:c.tpDiv.outerHeight()})};n||(n=b(a).zIndex()+1);c.tpDiv.zIndex(n);if(b.effects&&b.effects[f])c.tpDiv.show(f,b.timepicker._get(c,"showOptions"),p,o);else c.tpDiv[f||"show"](f?p:null,o);(!f||!p)&&o();c.input.is(":visible")&&!c.input.is(":disabled")&&c.input.focus();b.timepicker._curInst=c}}},_updateTimepicker:function(a){var c=this,e=b.timepicker._getBorders(a.tpDiv);
4560 a.tpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-timepicker-cover").css({left:-e[0],top:-e[1],width:a.tpDiv.outerWidth(),height:a.tpDiv.outerHeight()}).end().find(".ui-timepicker-minute-cell").bind("click",{fromDoubleClick:!1},b.proxy(b.timepicker.selectMinutes,this)).bind("dblclick",{fromDoubleClick:!0},b.proxy(b.timepicker.selectMinutes,this)).end().find(".ui-timepicker-hour-cell").bind("click",{fromDoubleClick:!1},b.proxy(b.timepicker.selectHours,this)).bind("dblclick",{fromDoubleClick:!0},
4561 b.proxy(b.timepicker.selectHours,this)).end().find(".ui-timepicker td a").bind("mouseout",function(){b(this).removeClass("ui-state-hover");this.className.indexOf("ui-timepicker-prev")!=-1&&b(this).removeClass("ui-timepicker-prev-hover");this.className.indexOf("ui-timepicker-next")!=-1&&b(this).removeClass("ui-timepicker-next-hover")}).bind("mouseover",function(){if(!c._isDisabledTimepicker(a.inline?a.tpDiv.parent()[0]:a.input[0]))b(this).parents(".ui-timepicker-calendar").find("a").removeClass("ui-state-hover"),
4562-b(this).addClass("ui-state-hover"),this.className.indexOf("ui-timepicker-prev")!=-1&&b(this).addClass("ui-timepicker-prev-hover"),this.className.indexOf("ui-timepicker-next")!=-1&&b(this).addClass("ui-timepicker-next-hover")}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end()},_generateHTML:function(b){var a,c="",e=this._get(b,"showPeriod")==!0,h=this._get(b,"showPeriodLabels")==!0,p=this._get(b,"showLeadingZero")==!0,o=this._get(b,"amPmText"),c='<table class="ui-timepicker-table ui-widget-content ui-corner-all"><tr><td class="ui-timepicker-hours"><div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">'+
4563-this._get(b,"hourText")+'</div><table class="ui-timepicker">';c+="<tr>"+(h?'<th rowspan="2" class="periods">'+o[0]+"</th>":"");for(a=0;a<=5;a++)c+=this._generateHTMLHourCell(b,a,e,p);c+="</tr><tr>";for(a=6;a<=11;a++)c+=this._generateHTMLHourCell(b,a,e,p);c+="</tr><tr>"+(h?'<th rowspan="2" class="periods">'+o[1]+"</th>":"");for(a=12;a<=17;a++)c+=this._generateHTMLHourCell(b,a,e,p);c+="</tr><tr>";for(a=18;a<=23;a++)c+=this._generateHTMLHourCell(b,a,e,p);c+='</tr></table></td><td class="ui-timepicker-minutes">';
4564+b(this).addClass("ui-state-hover"),this.className.indexOf("ui-timepicker-prev")!=-1&&b(this).addClass("ui-timepicker-prev-hover"),this.className.indexOf("ui-timepicker-next")!=-1&&b(this).addClass("ui-timepicker-next-hover")}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end()},_generateHTML:function(b){var a,c="",e=this._get(b,"showPeriod")==!0,f=this._get(b,"showPeriodLabels")==!0,n=this._get(b,"showLeadingZero")==!0,o=this._get(b,"amPmText"),c='<table class="ui-timepicker-table ui-widget-content ui-corner-all"><tr><td class="ui-timepicker-hours"><div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">'+
4565+this._get(b,"hourText")+'</div><table class="ui-timepicker">';c+="<tr>"+(f?'<th rowspan="2" class="periods">'+o[0]+"</th>":"");for(a=0;a<=5;a++)c+=this._generateHTMLHourCell(b,a,e,n);c+="</tr><tr>";for(a=6;a<=11;a++)c+=this._generateHTMLHourCell(b,a,e,n);c+="</tr><tr>"+(f?'<th rowspan="2" class="periods">'+o[1]+"</th>":"");for(a=12;a<=17;a++)c+=this._generateHTMLHourCell(b,a,e,n);c+="</tr><tr>";for(a=18;a<=23;a++)c+=this._generateHTMLHourCell(b,a,e,n);c+='</tr></table></td><td class="ui-timepicker-minutes">';
4566 c+=this._generateHTMLMinutes(b);c+="</td></tr></table>";return c},_updateMinuteDisplay:function(a){var c=this._generateHTMLMinutes(a);a.tpDiv.find("td.ui-timepicker-minutes").html(c).find(".ui-timepicker-minute-cell").bind("click",{fromDoubleClick:!1},b.proxy(b.timepicker.selectMinutes,this)).bind("dblclick",{fromDoubleClick:!0},b.proxy(b.timepicker.selectMinutes,this))},_generateHTMLMinutes:function(b){var a,c=this._get(b,"showMinutesLeadingZero")==!0,e=this._get(b,"onMinuteShow");if(e&&e.apply(b.input?
4567 b.input[0]:null,[b.hours,b.minutes])==!1)for(a=0;a<60;a+=5)if(e.apply(b.input?b.input[0]:null,[b.hours,a])){b.minutes=a;break}e='<div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">'+this._get(b,"minuteText")+'</div><table class="ui-timepicker"><tr>';for(a=0;a<15;a+=5)e+=this._generateHTMLMinuteCell(b,a,a<10&&c?"0"+a.toString():a.toString());e+="</tr><tr>";for(a=15;a<30;a+=5)e+=this._generateHTMLMinuteCell(b,a,a.toString());e+="</tr><tr>";for(a=30;a<45;a+=5)e+=this._generateHTMLMinuteCell(b,
4568-a,a.toString());e+="</tr><tr>";for(a=45;a<60;a+=5)e+=this._generateHTMLMinuteCell(b,a,a.toString());e+="</tr></table>";return e},_generateHTMLHourCell:function(b,a,c,e){var h=a;a>12&&c&&(h=a-12);h==0&&c&&(h=12);h<10&&e&&(h="0"+h);c="";c=!0;(e=this._get(b,"onHourShow"))&&(c=e.apply(b.input?b.input[0]:null,[a]));return c=c?'<td class="ui-timepicker-hour-cell" data-timepicker-instance-id="#'+b.id.replace("\\\\","\\")+'" data-hour="'+a.toString()+'"><a href="#timepick" class="ui-state-default '+(a==b.hours?
4569-"ui-state-active":"")+'">'+h.toString()+"</a></td>":'<td><span class="ui-state-default ui-state-disabled '+(a==b.hours?" ui-state-active ":" ")+'">'+h.toString()+"</span></td>"},_generateHTMLMinuteCell:function(b,a,c){var e="",e=!0,h=this._get(b,"onMinuteShow");h&&(e=h.apply(b.input?b.input[0]:null,[b.hours,a]));return e=e?'<td class="ui-timepicker-minute-cell" data-timepicker-instance-id="#'+b.id.replace("\\\\","\\")+'" data-minute="'+a.toString()+'" ><a href="#timepick" class="ui-state-default '+
4570-(a==b.minutes?"ui-state-active":"")+'" >'+c+"</a></td>":'<td><span class="ui-state-default ui-state-disabled" >'+c+"</span></td>"},_isDisabledTimepicker:function(b){if(!b)return!1;for(var a=0;a<this._disabledInputs.length;a++)if(this._disabledInputs[a]==b)return!0;return!1},_checkOffset:function(a,c,e){var h=a.tpDiv.outerWidth(),n=a.tpDiv.outerHeight(),p=a.input?a.input.outerWidth():0,o=a.input?a.input.outerHeight():0,s=document.documentElement.clientWidth+b(document).scrollLeft(),v=document.documentElement.clientHeight+
4571-b(document).scrollTop();c.left-=this._get(a,"isRTL")?h-p:0;c.left-=e&&c.left==a.input.offset().left?b(document).scrollLeft():0;c.top-=e&&c.top==a.input.offset().top+o?b(document).scrollTop():0;c.left-=Math.min(c.left,c.left+h>s&&s>h?Math.abs(c.left+h-s):0);c.top-=Math.min(c.top,c.top+n>v&&v>n?Math.abs(n+o):0);return c},_findPos:function(a){for(var c=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[c?"previousSibling":"nextSibling"];a=b(a).offset();return[a.left,a.top]},
4572+a,a.toString());e+="</tr><tr>";for(a=45;a<60;a+=5)e+=this._generateHTMLMinuteCell(b,a,a.toString());e+="</tr></table>";return e},_generateHTMLHourCell:function(a,b,c,e){var f=b;b>12&&c&&(f=b-12);f==0&&c&&(f=12);f<10&&e&&(f="0"+f);c="";c=!0;(e=this._get(a,"onHourShow"))&&(c=e.apply(a.input?a.input[0]:null,[b]));return c=c?'<td class="ui-timepicker-hour-cell" data-timepicker-instance-id="#'+a.id.replace("\\\\","\\")+'" data-hour="'+b.toString()+'"><a href="#timepick" class="ui-state-default '+(b==a.hours?
4573+"ui-state-active":"")+'">'+f.toString()+"</a></td>":'<td><span class="ui-state-default ui-state-disabled '+(b==a.hours?" ui-state-active ":" ")+'">'+f.toString()+"</span></td>"},_generateHTMLMinuteCell:function(a,b,c){var e="",e=!0,f=this._get(a,"onMinuteShow");f&&(e=f.apply(a.input?a.input[0]:null,[a.hours,b]));return e=e?'<td class="ui-timepicker-minute-cell" data-timepicker-instance-id="#'+a.id.replace("\\\\","\\")+'" data-minute="'+b.toString()+'" ><a href="#timepick" class="ui-state-default '+
4574+(b==a.minutes?"ui-state-active":"")+'" >'+c+"</a></td>":'<td><span class="ui-state-default ui-state-disabled" >'+c+"</span></td>"},_isDisabledTimepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_checkOffset:function(a,c,e){var f=a.tpDiv.outerWidth(),p=a.tpDiv.outerHeight(),n=a.input?a.input.outerWidth():0,o=a.input?a.input.outerHeight():0,t=document.documentElement.clientWidth+b(document).scrollLeft(),v=document.documentElement.clientHeight+
4575+b(document).scrollTop();c.left-=this._get(a,"isRTL")?f-n:0;c.left-=e&&c.left==a.input.offset().left?b(document).scrollLeft():0;c.top-=e&&c.top==a.input.offset().top+o?b(document).scrollTop():0;c.left-=Math.min(c.left,c.left+f>t&&t>f?Math.abs(c.left+f-t):0);c.top-=Math.min(c.top,c.top+p>v&&v>p?Math.abs(p+o):0);return c},_findPos:function(a){for(var c=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[c?"previousSibling":"nextSibling"];a=b(a).offset();return[a.left,a.top]},
4576 _getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkExternalClick:function(a){b.timepicker._curInst&&(a=b(a.target),a[0].id!=b.timepicker._mainDivId&&a.parents("#"+b.timepicker._mainDivId).length==0&&!a.hasClass(b.timepicker.markerClassName)&&!a.hasClass(b.timepicker._triggerClass)&&b.timepicker._timepickerShowing&&(!b.timepicker._inDialog||!b.blockUI)&&b.timepicker._hideTimepicker())},
4577-_hideTimepicker:function(a){var c=this._curInst;if(c&&!(a&&c!=b.data(a,"timepicker"))&&this._timepickerShowing){var a=this._get(c,"showAnim"),e=this._get(c,"duration"),h=function(){b.timepicker._tidyDialog(c);this._curInst=null};if(b.effects&&b.effects[a])c.tpDiv.hide(a,b.timepicker._get(c,"showOptions"),e,h);else c.tpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?e:null,h);a||h();(a=this._get(c,"onClose"))&&a.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._timepickerShowing=
4578-!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),b.blockUI&&(b.unblockUI(),b("body").append(this.tpDiv)));this._inDialog=!1}},_tidyDialog:function(a){a.tpDiv.removeClass(this._dialogClass).unbind(".ui-timepicker")},_getInst:function(a){try{return b.data(a,"timepicker")}catch(c){throw"Missing instance data for this timepicker";}},_get:function(a,b){return a.settings[b]!==e?a.settings[b]:this._defaults[b]},_setTimeFromField:function(a){if(a.input.val()!=
4579-a.lastVal){var c=this._get(a,"defaultTime"),e=this._getCurrentTimeRounded(a);c!=""&&(e=c);a.inline==!1&&a.input.val()!=""&&(e=a.input.val());c=a.lastVal=e;c=this.parseTime(a,c);a.hours=c.hours;a.minutes=c.minutes;b.timepicker._updateTimepicker(a)}},_setTimeTimepicker:function(a,b){var c=this._getInst(a);c&&(this._setTime(c,b),this._updateTimepicker(c),this._updateAlternate(c))},_setTime:function(a,b,c){var e=a.hours,h=a.minutes,b=this.parseTime(a,b);a.hours=b.hours;a.minutes=b.minutes;(e!=a.hours||
4580-h!=a.minuts)&&!c&&a.input.trigger("change");this._updateTimepicker(a);this._updateSelectedValue(a)},_getCurrentTimeRounded:function(a){var b=new Date,a=this._get(a,"timeSeparator"),c=b.getMinutes(),c=Math.round(c/5)*5;return b.getHours().toString()+a+c.toString()},parseTime:function(a,b){var c={hours:-1,minutes:-1},e=this._get(a,"timeSeparator"),h=this._get(a,"amPmText"),e=b.indexOf(e);if(e==-1)return c;c.hours=parseInt(b.substr(0,e),10);c.minutes=parseInt(b.substr(e+1),10);var e=this._get(a,"showPeriod")==
4581-!0,p=b.toUpperCase();c.hours<12&&e&&p.indexOf(h[1].toUpperCase())!=-1&&(c.hours+=12);if(c.hours==12&&e&&p.indexOf(h[0].toUpperCase())!=-1)c.hours=0;return c},selectHours:function(a){var c=b(a.currentTarget),e=c.attr("data-timepicker-instance-id"),h=c.attr("data-hour"),a=a.data.fromDoubleClick,e=this._getInst(b(e)[0]);c.parents(".ui-timepicker-hours:first").find("a").removeClass("ui-state-active");c.children("a").addClass("ui-state-active");e.hours=h;this._updateSelectedValue(e);e._hoursClicked=!0;
4582-if(e._minutesClicked||a)return b.timepicker._hideTimepicker(),!1;this._get(e,"onMinuteShow")&&this._updateMinuteDisplay(e);return!1},selectMinutes:function(a){var c=b(a.currentTarget),e=c.attr("data-timepicker-instance-id"),h=c.attr("data-minute"),a=a.data.fromDoubleClick,e=this._getInst(b(e)[0]);c.parents(".ui-timepicker-minutes:first").find("a").removeClass("ui-state-active");c.children("a").addClass("ui-state-active");e.minutes=h;this._updateSelectedValue(e);e._minutesClicked=!0;(e._hoursClicked||
4583-a)&&b.timepicker._hideTimepicker();return!1},_updateSelectedValue:function(a){if(a.hours<0||a.hours>23)a.hours=12;if(a.minutes<0||a.minutes>59)a.minutes=0;var b="",c=this._get(a,"showPeriod")==!0,e=this._get(a,"showLeadingZero")==!0,h=this._get(a,"amPmText"),p=a.minutes?a.minutes:0,o=a.hours?a.hours:0;o||(displayHoyrs=0);c&&(a.hours==0&&(o=12),a.hours<12?b=h[0]:(b=h[1],o>12&&(o-=12)));c=o.toString();e&&o<10&&(c="0"+c);e=p.toString();p<10&&(e="0"+e);p=c+this._get(a,"timeSeparator")+e;b.length>0&&(p+=
4584-" "+b);a.input&&(a.input.val(p),a.input.trigger("change"));(b=this._get(a,"onSelect"))&&b.apply(a.input?a.input[0]:null,[p,a]);this._updateAlternate(a,p);return p},_updateAlternate:function(a,c){var e=this._get(a,"altField");e&&b(e).each(function(){b(this).val(c)})}});b.fn.timepicker=function(a){if(!b.timepicker.initialized)b(document).mousedown(b.timepicker._checkExternalClick).find("body").append(b.timepicker.tpDiv),b.timepicker.initialized=!0;var c=Array.prototype.slice.call(arguments,1);if(typeof a==
4585+_hideTimepicker:function(a){var c=this._curInst;if(c&&!(a&&c!=b.data(a,"timepicker"))&&this._timepickerShowing){var a=this._get(c,"showAnim"),e=this._get(c,"duration"),f=function(){b.timepicker._tidyDialog(c);this._curInst=null};if(b.effects&&b.effects[a])c.tpDiv.hide(a,b.timepicker._get(c,"showOptions"),e,f);else c.tpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?e:null,f);a||f();(a=this._get(c,"onClose"))&&a.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._timepickerShowing=
4586+!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),b.blockUI&&(b.unblockUI(),b("body").append(this.tpDiv)));this._inDialog=!1}},_tidyDialog:function(a){a.tpDiv.removeClass(this._dialogClass).unbind(".ui-timepicker")},_getInst:function(a){try{return b.data(a,"timepicker")}catch(c){throw"Missing instance data for this timepicker";}},_get:function(a,b){return a.settings[b]!==c?a.settings[b]:this._defaults[b]},_setTimeFromField:function(a){if(a.input.val()!=
4587+a.lastVal){var c=this._get(a,"defaultTime"),e=this._getCurrentTimeRounded(a);c!=""&&(e=c);a.inline==!1&&a.input.val()!=""&&(e=a.input.val());c=a.lastVal=e;c=this.parseTime(a,c);a.hours=c.hours;a.minutes=c.minutes;b.timepicker._updateTimepicker(a)}},_setTimeTimepicker:function(a,b){var c=this._getInst(a);c&&(this._setTime(c,b),this._updateTimepicker(c),this._updateAlternate(c))},_setTime:function(a,b,c){var e=a.hours,f=a.minutes,b=this.parseTime(a,b);a.hours=b.hours;a.minutes=b.minutes;(e!=a.hours||
4588+f!=a.minuts)&&!c&&a.input.trigger("change");this._updateTimepicker(a);this._updateSelectedValue(a)},_getCurrentTimeRounded:function(a){var b=new Date,a=this._get(a,"timeSeparator"),c=b.getMinutes(),c=Math.round(c/5)*5;return b.getHours().toString()+a+c.toString()},parseTime:function(a,b){var c={hours:-1,minutes:-1},e=this._get(a,"timeSeparator"),f=this._get(a,"amPmText"),e=b.indexOf(e);if(e==-1)return c;c.hours=parseInt(b.substr(0,e),10);c.minutes=parseInt(b.substr(e+1),10);var e=this._get(a,"showPeriod")==
4589+!0,n=b.toUpperCase();c.hours<12&&e&&n.indexOf(f[1].toUpperCase())!=-1&&(c.hours+=12);if(c.hours==12&&e&&n.indexOf(f[0].toUpperCase())!=-1)c.hours=0;return c},selectHours:function(a){var c=b(a.currentTarget),e=c.attr("data-timepicker-instance-id"),f=c.attr("data-hour"),a=a.data.fromDoubleClick,e=this._getInst(b(e)[0]);c.parents(".ui-timepicker-hours:first").find("a").removeClass("ui-state-active");c.children("a").addClass("ui-state-active");e.hours=f;this._updateSelectedValue(e);e._hoursClicked=!0;
4590+if(e._minutesClicked||a)return b.timepicker._hideTimepicker(),!1;this._get(e,"onMinuteShow")&&this._updateMinuteDisplay(e);return!1},selectMinutes:function(a){var c=b(a.currentTarget),e=c.attr("data-timepicker-instance-id"),f=c.attr("data-minute"),a=a.data.fromDoubleClick,e=this._getInst(b(e)[0]);c.parents(".ui-timepicker-minutes:first").find("a").removeClass("ui-state-active");c.children("a").addClass("ui-state-active");e.minutes=f;this._updateSelectedValue(e);e._minutesClicked=!0;(e._hoursClicked||
4591+a)&&b.timepicker._hideTimepicker();return!1},_updateSelectedValue:function(a){if(a.hours<0||a.hours>23)a.hours=12;if(a.minutes<0||a.minutes>59)a.minutes=0;var b="",c=this._get(a,"showPeriod")==!0,e=this._get(a,"showLeadingZero")==!0,f=this._get(a,"amPmText"),n=a.minutes?a.minutes:0,o=a.hours?a.hours:0;o||(displayHoyrs=0);c&&(a.hours==0&&(o=12),a.hours<12?b=f[0]:(b=f[1],o>12&&(o-=12)));c=o.toString();e&&o<10&&(c="0"+c);e=n.toString();n<10&&(e="0"+e);n=c+this._get(a,"timeSeparator")+e;b.length>0&&(n+=
4592+" "+b);a.input&&(a.input.val(n),a.input.trigger("change"));(b=this._get(a,"onSelect"))&&b.apply(a.input?a.input[0]:null,[n,a]);this._updateAlternate(a,n);return n},_updateAlternate:function(a,c){var e=this._get(a,"altField");e&&b(e).each(function(){b(this).val(c)})}});b.fn.timepicker=function(a){if(!b.timepicker.initialized)b(document).mousedown(b.timepicker._checkExternalClick).find("body").append(b.timepicker.tpDiv),b.timepicker.initialized=!0;var c=Array.prototype.slice.call(arguments,1);if(typeof a==
4593 "string"&&(a=="isDisabled"||a=="getTime"||a=="widget"))return b.timepicker["_"+a+"Timepicker"].apply(b.timepicker,[this[0]].concat(c));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return b.timepicker["_"+a+"Timepicker"].apply(b.timepicker,[this[0]].concat(c));return this.each(function(){typeof a=="string"?b.timepicker["_"+a+"Timepicker"].apply(b.timepicker,[this].concat(c)):b.timepicker._attachTimepicker(this,a)})};b.timepicker=new a;b.timepicker.initialized=!1;b.timepicker.uuid=
4594-(new Date).getTime();b.timepicker.version="0.1.3";window["TP_jQuery_"+h]=b})(jQuery);
4595-(function(b){b.cluetip={version:"1.0.7"};var e,a,c,h,f,j,g,k;b.fn.cluetip=function(o,s){typeof o=="object"&&(s=o,o=null);if(o=="destroy")return this.removeData("thisInfo").unbind(".cluetip");return this.each(function(v){function t(){return!1}var u=this,r=b(this),m=b.extend(!0,{},b.fn.cluetip.defaults,s||{},b.metadata?r.metadata():b.meta?r.data():{}),x=!1,z=+m.cluezIndex;r.data("thisInfo",{title:u.title,zIndex:z});var w=!1,y=0;b("#cluetip").length||(b('<div id="cluetip"><div id="cluetip-outer"><h3 id="cluetip-title"></h3><div id="cluetip-inner"></div></div><div id="cluetip-extra"></div><div id="cluetip-arrows" class="cluetip-arrows"></div></div>')[n](p).hide(),
4596-e=b("#cluetip").css({position:"absolute"}),c=b("#cluetip-outer").css({position:"relative",zIndex:z}),a=b("#cluetip-inner"),h=b("#cluetip-title"),f=b("#cluetip-arrows"),j=b('<div id="cluetip-waitimage"></div>').css({position:"absolute"}).insertBefore(e).hide());var C=m.dropShadow?+m.dropShadowSteps:0;if(!g){g=b([]);for(var A=0;A<C;A++)g=g.add(b("<div></div>").css({zIndex:z-1,opacity:0.1,top:1+A,left:1+A}));g.css({position:"absolute",backgroundColor:"#000"}).prependTo(e)}var E=r.attr(m.attribute),D=
4597-m.cluetipClass;if(!E&&!m.splitTitle&&!o)return!0;m.local&&m.localPrefix&&(E=m.localPrefix+E);m.local&&m.hideLocal&&b(E+":first").hide();var V=parseInt(m.topOffset,10),W=parseInt(m.leftOffset,10),Y,aa,G=isNaN(parseInt(m.height,10))?"auto":/\D/g.test(m.height)?m.height:m.height+"px",L,I,N,Z,J,S=parseInt(m.width,10)||275,K=S+(parseInt(e.css("paddingLeft"),10)||0)+(parseInt(e.css("paddingRight"),10)||0)+C,B=this.offsetWidth,U,P,M,O,T,R=m.attribute!="title"?r.attr(m.titleAttribute):"";m.splitTitle&&(R==
4598-void 0&&(R=""),T=R.split(m.splitTitle),R=T.shift());m.escapeTitle&&(R=R.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;"));var Q=function(h){if(!m.onActivate(r))return!1;w=!0;e.removeClass().css({width:S});E==r.attr("href")&&r.css("cursor",m.cursor);m.hoverClass&&r.addClass(m.hoverClass);I=r.offset().top;U=r.offset().left;M=h.pageX;Z=h.pageY;u.tagName.toLowerCase()!="area"&&(L=b(document).scrollTop(),O=b(window).width());if(m.positionBy=="fixed")P=B+U+W,e.css({left:P});else{P=B>U&&U>
4599-K||U+B+K+W>O?U-K-W:B+U+W;if(u.tagName.toLowerCase()=="area"||m.positionBy=="mouse"||B+K>O)M+20+K>O?(e.addClass(" cluetip-"+D),P=M-K-W>=0?M-K-W-parseInt(e.css("marginLeft"),10)+parseInt(a.css("marginRight"),10):M-K/2):P=M+W;var g=P<0?h.pageY+V:h.pageY;e.css({left:P>0&&m.positionBy!="bottomTop"?P:M+K/2>O?O/2-K/2:Math.max(M-K/2,0),zIndex:r.data("thisInfo").zIndex});f.css({zIndex:r.data("thisInfo").zIndex+1})}aa=b(window).height();if(o)typeof o=="function"&&(o=o.call(u)),a.html(o),F(g);else if(T){h=T.length;
4600-a.html(h?T[0]:"");if(h>1)for(var l=1;l<h;l++)a.append('<div class="split-body">'+T[l]+"</div>");F(g)}else if(!m.local&&E.indexOf("#")!==0)if(/\.(jpe?g|tiff?|gif|png)$/i.test(E))a.html('<img src="'+E+'" alt="'+R+'" />'),F(g);else if(x&&m.ajaxCache)a.html(x),F(g);else{var n=m.ajaxSettings.beforeSend,p=m.ajaxSettings.error,s=m.ajaxSettings.success,t=m.ajaxSettings.complete,h=b.extend(!0,{},m.ajaxSettings,{cache:!1,url:E,beforeSend:function(b){n&&n.call(u,b,e,a);c.children().empty();m.waitImage&&j.css({top:Z+
4601-20,left:M+20,zIndex:r.data("thisInfo").zIndex-1}).show()},error:function(b,c){w&&(p?p.call(u,b,c,e,a):a.html("<i>sorry, the contents could not be loaded</i>"))},success:function(b,c){x=m.ajaxProcess.call(u,b);w&&(s&&s.call(u,b,c,e,a),a.html(x))},complete:function(c,f){t&&t.call(u,c,f,e,a);var h=a[0].getElementsByTagName("img");k=h.length;for(var l=0,o=h.length;l<o;l++)h[l].complete&&k--;k&&!b.browser.opera?b(h).bind("load error",function(){k--;k<1&&(j.hide(),w&&F(g))}):(j.hide(),w&&F(g))}});b.ajax(h)}else m.local&&
4602-(h=b(E+(/#\S+$/.test(E)?"":":eq("+v+")")).clone(!0).show(),a.html(h),F(g))},F=function(j){e.addClass("cluetip-"+D);if(m.truncate){var k=a.text().slice(0,m.truncate)+"...";a.html(k)}R?h.show().html(R):m.showTitle?h.show().html("&nbsp;"):h.hide();m.sticky&&(k=b('<div id="cluetip-close"><a href="#">'+m.closeText+"</a></div>"),m.closePosition=="bottom"?k.appendTo(a):m.closePosition=="title"?k.prependTo(h):k.prependTo(a),k.bind("click.cluetip",function(){X();return!1}),m.mouseOutClose?e.bind("mouseleave.cluetip",
4603-function(){X()}):e.unbind("mouseleave.cluetip"));k="";c.css({zIndex:r.data("thisInfo").zIndex,overflow:G=="auto"?"visible":"auto",height:G});Y=G=="auto"?Math.max(e.outerHeight(),e.height()):parseInt(G,10);N=I;J=L+aa;m.positionBy=="fixed"?N=I-m.dropShadowSteps+V:P<M&&Math.max(P,0)+K>M||m.positionBy=="bottomTop"?I+Y+V>J&&Z-L>Y+V?(N=Z-Y-V,k="top"):(N=Z+V,k="bottom"):N=I+Y+V>J?Y>=aa?L:J-Y-V:r.css("display")=="block"||u.tagName.toLowerCase()=="area"||m.positionBy=="mouse"?j-V:I-m.dropShadowSteps;k==""&&
4604-(P<U?k="left":k="right");e.css({top:N+"px"}).removeClass().addClass("clue-"+k+"-"+D).addClass(" cluetip-"+D);m.arrows?(j=I-N-m.dropShadowSteps,f.css({top:/(left|right)/.test(k)&&P>=0&&j>0?j+"px":/(left|right)/.test(k)?0:""}).show()):f.hide();g.hide();e.hide()[m.fx.open](m.fx.openSpeed||0);m.dropShadow&&g.css({height:Y,width:S,zIndex:r.data("thisInfo").zIndex-1}).show();b.fn.bgiframe&&e.bgiframe();m.delayedClose>0&&(y=setTimeout(X,m.delayedClose));m.onShow.call(u,e,a)},l=function(){w=!1;j.hide();if(!m.sticky||
4605-/click|toggle/.test(m.activation))X(),clearTimeout(y);m.hoverClass&&r.removeClass(m.hoverClass)},X=function(){c.parent().hide().removeClass();m.onHide.call(u,e,a);r.removeClass("cluetip-clicked");R&&r.attr(m.titleAttribute,R);r.css("cursor","");m.arrows&&f.css({top:""})};b(document).bind("hideCluetip",function(){X()});if(/click|toggle/.test(m.activation))r.bind("click.cluetip",function(a){e.is(":hidden")||!r.is(".cluetip-clicked")?(Q(a),b(".cluetip-clicked").removeClass("cluetip-clicked"),r.addClass("cluetip-clicked")):
4606-l(a);this.blur();return!1});else if(m.activation=="focus")r.bind("focus.cluetip",function(a){Q(a)}),r.bind("blur.cluetip",function(a){l(a)});else{r[m.clickThrough?"unbind":"bind"]("click",t);var ba=function(a){if(m.tracking==!0){var b=P-a.pageX,c=N?N-a.pageY:I-a.pageY;r.bind("mousemove.cluetip",function(a){e.css({left:a.pageX+b,top:a.pageY+c})})}};b.fn.hoverIntent&&m.hoverIntent?r.hoverIntent({sensitivity:m.hoverIntent.sensitivity,interval:m.hoverIntent.interval,over:function(a){Q(a);ba(a)},timeout:m.hoverIntent.timeout,
4607+(new Date).getTime();b.timepicker.version="0.1.3";window["TP_jQuery_"+f]=b})(jQuery);
4608+(function(b){b.cluetip={version:"1.0.7"};var c,a,e,f,g,h,j,k;b.fn.cluetip=function(o,t){typeof o=="object"&&(t=o,o=null);if(o=="destroy")return this.removeData("thisInfo").unbind(".cluetip");return this.each(function(v){function s(){return!1}var u=this,r=b(this),m=b.extend(!0,{},b.fn.cluetip.defaults,t||{},b.metadata?r.metadata():b.meta?r.data():{}),x=!1,z=+m.cluezIndex;r.data("thisInfo",{title:u.title,zIndex:z});var w=!1,y=0;b("#cluetip").length||(b('<div id="cluetip"><div id="cluetip-outer"><h3 id="cluetip-title"></h3><div id="cluetip-inner"></div></div><div id="cluetip-extra"></div><div id="cluetip-arrows" class="cluetip-arrows"></div></div>')[p](n).hide(),
4609+c=b("#cluetip").css({position:"absolute"}),e=b("#cluetip-outer").css({position:"relative",zIndex:z}),a=b("#cluetip-inner"),f=b("#cluetip-title"),g=b("#cluetip-arrows"),h=b('<div id="cluetip-waitimage"></div>').css({position:"absolute"}).insertBefore(c).hide());var C=m.dropShadow?+m.dropShadowSteps:0;if(!j){j=b([]);for(var A=0;A<C;A++)j=j.add(b("<div></div>").css({zIndex:z-1,opacity:0.1,top:1+A,left:1+A}));j.css({position:"absolute",backgroundColor:"#000"}).prependTo(c)}var E=r.attr(m.attribute),D=
4610+m.cluetipClass;if(!E&&!m.splitTitle&&!o)return!0;m.local&&m.localPrefix&&(E=m.localPrefix+E);m.local&&m.hideLocal&&b(E+":first").hide();var V=parseInt(m.topOffset,10),W=parseInt(m.leftOffset,10),Y,aa,G=isNaN(parseInt(m.height,10))?"auto":/\D/g.test(m.height)?m.height:m.height+"px",L,I,N,Z,J,S=parseInt(m.width,10)||275,K=S+(parseInt(c.css("paddingLeft"),10)||0)+(parseInt(c.css("paddingRight"),10)||0)+C,B=this.offsetWidth,U,P,M,O,T,R=m.attribute!="title"?r.attr(m.titleAttribute):"";m.splitTitle&&(R==
4611+void 0&&(R=""),T=R.split(m.splitTitle),R=T.shift());m.escapeTitle&&(R=R.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;"));var Q=function(f){if(!m.onActivate(r))return!1;w=!0;c.removeClass().css({width:S});E==r.attr("href")&&r.css("cursor",m.cursor);m.hoverClass&&r.addClass(m.hoverClass);I=r.offset().top;U=r.offset().left;M=f.pageX;Z=f.pageY;u.tagName.toLowerCase()!="area"&&(L=b(document).scrollTop(),O=b(window).width());if(m.positionBy=="fixed")P=B+U+W,c.css({left:P});else{P=B>U&&U>
4612+K||U+B+K+W>O?U-K-W:B+U+W;if(u.tagName.toLowerCase()=="area"||m.positionBy=="mouse"||B+K>O)M+20+K>O?(c.addClass(" cluetip-"+D),P=M-K-W>=0?M-K-W-parseInt(c.css("marginLeft"),10)+parseInt(a.css("marginRight"),10):M-K/2):P=M+W;var j=P<0?f.pageY+V:f.pageY;c.css({left:P>0&&m.positionBy!="bottomTop"?P:M+K/2>O?O/2-K/2:Math.max(M-K/2,0),zIndex:r.data("thisInfo").zIndex});g.css({zIndex:r.data("thisInfo").zIndex+1})}aa=b(window).height();if(o)typeof o=="function"&&(o=o.call(u)),a.html(o),F(j);else if(T){f=T.length;
4613+a.html(f?T[0]:"");if(f>1)for(var l=1;l<f;l++)a.append('<div class="split-body">'+T[l]+"</div>");F(j)}else if(!m.local&&E.indexOf("#")!==0)if(/\.(jpe?g|tiff?|gif|png)$/i.test(E))a.html('<img src="'+E+'" alt="'+R+'" />'),F(j);else if(x&&m.ajaxCache)a.html(x),F(j);else{var n=m.ajaxSettings.beforeSend,p=m.ajaxSettings.error,t=m.ajaxSettings.success,s=m.ajaxSettings.complete,f=b.extend(!0,{},m.ajaxSettings,{cache:!1,url:E,beforeSend:function(b){n&&n.call(u,b,c,a);e.children().empty();m.waitImage&&h.css({top:Z+
4614+20,left:M+20,zIndex:r.data("thisInfo").zIndex-1}).show()},error:function(b,e){w&&(p?p.call(u,b,e,c,a):a.html("<i>sorry, the contents could not be loaded</i>"))},success:function(b,e){x=m.ajaxProcess.call(u,b);w&&(t&&t.call(u,b,e,c,a),a.html(x))},complete:function(e,f){s&&s.call(u,e,f,c,a);var g=a[0].getElementsByTagName("img");k=g.length;for(var l=0,o=g.length;l<o;l++)g[l].complete&&k--;k&&!b.browser.opera?b(g).bind("load error",function(){k--;k<1&&(h.hide(),w&&F(j))}):(h.hide(),w&&F(j))}});b.ajax(f)}else m.local&&
4615+(f=b(E+(/#\S+$/.test(E)?"":":eq("+v+")")).clone(!0).show(),a.html(f),F(j))},F=function(h){c.addClass("cluetip-"+D);if(m.truncate){var k=a.text().slice(0,m.truncate)+"...";a.html(k)}R?f.show().html(R):m.showTitle?f.show().html("&nbsp;"):f.hide();m.sticky&&(k=b('<div id="cluetip-close"><a href="#">'+m.closeText+"</a></div>"),m.closePosition=="bottom"?k.appendTo(a):m.closePosition=="title"?k.prependTo(f):k.prependTo(a),k.bind("click.cluetip",function(){X();return!1}),m.mouseOutClose?c.bind("mouseleave.cluetip",
4616+function(){X()}):c.unbind("mouseleave.cluetip"));k="";e.css({zIndex:r.data("thisInfo").zIndex,overflow:G=="auto"?"visible":"auto",height:G});Y=G=="auto"?Math.max(c.outerHeight(),c.height()):parseInt(G,10);N=I;J=L+aa;m.positionBy=="fixed"?N=I-m.dropShadowSteps+V:P<M&&Math.max(P,0)+K>M||m.positionBy=="bottomTop"?I+Y+V>J&&Z-L>Y+V?(N=Z-Y-V,k="top"):(N=Z+V,k="bottom"):N=I+Y+V>J?Y>=aa?L:J-Y-V:r.css("display")=="block"||u.tagName.toLowerCase()=="area"||m.positionBy=="mouse"?h-V:I-m.dropShadowSteps;k==""&&
4617+(P<U?k="left":k="right");c.css({top:N+"px"}).removeClass().addClass("clue-"+k+"-"+D).addClass(" cluetip-"+D);m.arrows?(h=I-N-m.dropShadowSteps,g.css({top:/(left|right)/.test(k)&&P>=0&&h>0?h+"px":/(left|right)/.test(k)?0:""}).show()):g.hide();j.hide();c.hide()[m.fx.open](m.fx.openSpeed||0);m.dropShadow&&j.css({height:Y,width:S,zIndex:r.data("thisInfo").zIndex-1}).show();b.fn.bgiframe&&c.bgiframe();m.delayedClose>0&&(y=setTimeout(X,m.delayedClose));m.onShow.call(u,c,a)},l=function(){w=!1;h.hide();if(!m.sticky||
4618+/click|toggle/.test(m.activation))X(),clearTimeout(y);m.hoverClass&&r.removeClass(m.hoverClass)},X=function(){e.parent().hide().removeClass();m.onHide.call(u,c,a);r.removeClass("cluetip-clicked");R&&r.attr(m.titleAttribute,R);r.css("cursor","");m.arrows&&g.css({top:""})};b(document).bind("hideCluetip",function(){X()});if(/click|toggle/.test(m.activation))r.bind("click.cluetip",function(a){c.is(":hidden")||!r.is(".cluetip-clicked")?(Q(a),b(".cluetip-clicked").removeClass("cluetip-clicked"),r.addClass("cluetip-clicked")):
4619+l(a);this.blur();return!1});else if(m.activation=="focus")r.bind("focus.cluetip",function(a){Q(a)}),r.bind("blur.cluetip",function(a){l(a)});else{r[m.clickThrough?"unbind":"bind"]("click",s);var ba=function(a){if(m.tracking==!0){var b=P-a.pageX,e=N?N-a.pageY:I-a.pageY;r.bind("mousemove.cluetip",function(a){c.css({left:a.pageX+b,top:a.pageY+e})})}};b.fn.hoverIntent&&m.hoverIntent?r.hoverIntent({sensitivity:m.hoverIntent.sensitivity,interval:m.hoverIntent.interval,over:function(a){Q(a);ba(a)},timeout:m.hoverIntent.timeout,
4620 out:function(a){l(a);r.unbind("mousemove.cluetip")}}):r.bind("mouseenter.cluetip",function(a){Q(a);ba(a)}).bind("mouseleave.cluetip",function(a){l(a);r.unbind("mousemove.cluetip")});r.bind("mouseover.cluetip",function(){r.attr("title","")}).bind("mouseleave.cluetip",function(){r.attr("title",r.data("thisInfo").title)})}})};b.fn.cluetip.defaults={width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,local:!1,localPrefix:null,hideLocal:!0,attribute:"rel",titleAttribute:"title",
4621 splitTitle:"",escapeTitle:!1,showTitle:!0,cluetipClass:"default",hoverClass:"",waitImage:!0,cursor:"help",arrows:!1,dropShadow:!0,dropShadowSteps:6,sticky:!1,mouseOutClose:!1,activation:"hover",clickThrough:!1,tracking:!1,delayedClose:0,closePosition:"top",closeText:"Close",truncate:0,fx:{open:"show",openSpeed:""},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(){return!0},onShow:function(){},onHide:function(){},ajaxCache:!0,ajaxProcess:function(a){return a=a.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm,
4622-"").replace(/<(link|meta)[^>]+>/g,"")},ajaxSettings:{dataType:"html"},debug:!1};var n="appendTo",p="body";b.cluetip.setup=function(a){if(a&&a.insertionType&&a.insertionType.match(/appendTo|prependTo|insertBefore|insertAfter/))n=a.insertionType;if(a&&a.insertionElement)p=a.insertionElement}})(jQuery);
4623-(function(b){var e=0;b.widget("ech.multiselect",{options:{header:!0,height:175,minWidth:225,classes:"",checkAllText:"Check all",uncheckAllText:"Uncheck all",noneSelectedText:"Select options",selectedText:"# selected",selectedList:0,show:"",hide:"",autoOpen:!1,multiple:!0,position:{}},_create:function(){var a=this.element.hide(),c=this.options;this.speed=b.fx.speeds._default;this._isOpen=!1;a=(this.button=b('<button type="button"><span class="ui-icon ui-icon-triangle-2-n-s"></span></button>')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(c.classes).attr({title:a.attr("title"),
4624-"aria-haspopup":!0,tabIndex:a.attr("tabIndex")}).insertAfter(a);(this.buttonlabel=b("<span />")).html(c.noneSelectedText).appendTo(a);var a=(this.menu=b("<div />")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(c.classes).insertAfter(a),e=(this.header=b("<div />")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=b("<ul />")).addClass("ui-helper-reset").html(function(){return c.header===!0?
4625-'<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>'+c.checkAllText+'</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>'+c.uncheckAllText+"</span></a></li>":typeof c.header==="string"?"<li>"+c.header+"</li>":""}).append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon ui-icon-circle-close"></span></a></li>').appendTo(e);(this.checkboxContainer=b("<ul />")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a);
4626-this._bindEvents();this.refresh(!0);c.multiple||a.addClass("ui-multiselect-single")},_init:function(){this.options.header===!1&&this.header.hide();this.options.multiple||this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide();this.options.autoOpen&&this.open();this.element.is(":disabled")&&this.disable()},refresh:function(a){var c=this.options,h=this.menu,f=this.checkboxContainer,j=[],g=[],k=this.element.attr("id")||e++;this.element.find("option").each(function(a){b(this);
4627-var e=this.parentNode,f=this.innerHTML,h=this.value,a=this.id||"ui-multiselect-"+k+"-option-"+a,v=this.disabled,t=this.selected,u=["ui-corner-all"];e.tagName.toLowerCase()==="optgroup"&&(e=e.getAttribute("label"),b.inArray(e,j)===-1&&(g.push('<li class="ui-multiselect-optgroup-label"><a href="#">'+e+"</a></li>"),j.push(e)));v&&u.push("ui-state-disabled");t&&!c.multiple&&u.push("ui-state-active");g.push('<li class="'+(v?"ui-multiselect-disabled":"")+'">');g.push('<label for="'+a+'" class="'+u.join(" ")+
4628-'">');g.push('<input id="'+a+'" name="multiselect_'+k+'" type="'+(c.multiple?"checkbox":"radio")+'" value="'+h+'" title="'+f+'"');t&&(g.push(' checked="checked"'),g.push(' aria-selected="true"'));v&&(g.push(' disabled="disabled"'),g.push(' aria-disabled="true"'));g.push(" /><span>"+f+"</span></label></li>")});f.html(g.join(""));this.labels=h.find("label");this._setButtonWidth();this._setMenuWidth();this.button[0].defaultValue=this.update();a||this._trigger("refresh")},update:function(){var a=this.options,
4629-c=this.labels.find("input"),e=c.filter(":checked"),f=e.length,a=f===0?a.noneSelectedText:b.isFunction(a.selectedText)?a.selectedText.call(this,f,c.length,e.get()):/\d/.test(a.selectedList)&&a.selectedList>0&&f<=a.selectedList?e.map(function(){return this.title}).get().join(", "):a.selectedText.replace("#",f).replace("#",c.length);this.buttonlabel.html(a);return a},_bindEvents:function(){function a(){c[c._isOpen?"close":"open"]();return!1}var c=this,e=this.button;e.find("span").bind("click.multiselect",
4630-a);e.bind({click:a,keypress:function(a){switch(a.which){case 27:case 38:case 37:c.close();break;case 39:case 40:c.open()}},mouseenter:function(){e.hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},mouseleave:function(){b(this).removeClass("ui-state-hover")},focus:function(){e.hasClass("ui-state-disabled")||b(this).addClass("ui-state-focus")},blur:function(){b(this).removeClass("ui-state-focus")}});this.header.delegate("a","click.multiselect",function(a){if(b(this).hasClass("ui-multiselect-close"))c.close();
4631-else c[b(this).hasClass("ui-multiselect-all")?"checkAll":"uncheckAll"]();a.preventDefault()});this.menu.delegate("li.ui-multiselect-optgroup-label a","click.multiselect",function(a){a.preventDefault();var e=b(this),h=e.parent().nextUntil("li.ui-multiselect-optgroup-label").find("input:visible:not(:disabled)"),k=h.get(),e=e.parent().text();c._trigger("beforeoptgrouptoggle",a,{inputs:k,label:e})!==!1&&(c._toggleChecked(h.filter(":checked").length!==h.length,h),c._trigger("optgrouptoggle",a,{inputs:k,
4632-label:e,checked:k[0].checked}))}).delegate("label","mouseenter.multiselect",function(){b(this).hasClass("ui-state-disabled")||(c.labels.removeClass("ui-state-hover"),b(this).addClass("ui-state-hover").find("input").focus())}).delegate("label","keydown.multiselect",function(a){a.preventDefault();switch(a.which){case 9:case 27:c.close();break;case 38:case 40:case 37:case 39:c._traverse(a.which,this);break;case 13:b(this).find("input")[0].click()}}).delegate('input[type="checkbox"], input[type="radio"]',
4633-"click.multiselect",function(a){var e=b(this),h=this.value,k=this.checked,n=c.element.find("option");this.disabled||c._trigger("click",a,{value:h,text:this.title,checked:k})===!1?a.preventDefault():(e.attr("aria-selected",k),n.each(function(){if(this.value===h)this.selected=k;else if(!c.options.multiple)this.selected=!1}),c.options.multiple||(c.labels.removeClass("ui-state-active"),e.closest("label").toggleClass("ui-state-active",k),c.close()),setTimeout(b.proxy(c.update,c),10))});b(document).bind("mousedown.multiselect",
4634-function(a){c._isOpen&&!b.contains(c.menu[0],a.target)&&!b.contains(c.button[0],a.target)&&a.target!==c.button[0]&&c.close()});b(this.element[0].form).bind("reset.multiselect",function(){setTimeout(function(){c.update()},10)})},_setButtonWidth:function(){var a=this.element.outerWidth(),b=this.options;if(/\d/.test(b.minWidth)&&a<b.minWidth)a=b.minWidth;this.button.width(a)},_setMenuWidth:function(){var a=this.menu,b=this.button.outerWidth()-parseInt(a.css("padding-left"),10)-parseInt(a.css("padding-right"),
4635-10)-parseInt(a.css("border-right-width"),10)-parseInt(a.css("border-left-width"),10);a.width(b||this.button.outerWidth())},_traverse:function(a,c){var e=b(c),f=a===38||a===37,e=e.parent()[f?"prevAll":"nextAll"]("li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)")[f?"last":"first"]();e.length?e.find("label").trigger("mouseover"):(e=this.menu.find("ul:last"),this.menu.find("label")[f?"last":"first"]().trigger("mouseover"),e.scrollTop(f?e.height():0))},_toggleCheckbox:function(a,b){return function(){!this.disabled&&
4636-(this[a]=b);b?this.setAttribute("aria-selected",!0):this.removeAttribute("aria-selected")}},_toggleChecked:function(a,c){var e=c&&c.length?c:this.labels.find("input"),f=this;e.each(this._toggleCheckbox("checked",a));this.update();var j=e.map(function(){return this.value}).get();this.element.find("option").each(function(){!this.disabled&&b.inArray(this.value,j)>-1&&f._toggleCheckbox("selected",a).call(this)})},_toggleDisabled:function(a){this.button.attr({disabled:a,"aria-disabled":a})[a?"addClass":
4637-"removeClass"]("ui-state-disabled");this.menu.find("input").attr({disabled:a,"aria-disabled":a}).parent()[a?"addClass":"removeClass"]("ui-state-disabled");this.element.attr({disabled:a,"aria-disabled":a})},open:function(){var a=this.button,c=this.menu,e=this.speed,f=this.options;if(!(this._trigger("beforeopen")===!1||a.hasClass("ui-state-disabled")||this._isOpen)){var j=c.find("ul:last"),g=f.show,k=a.position();b.isArray(f.show)&&(g=f.show[0],e=f.show[1]||this.speed);j.scrollTop(0).height(f.height);
4638-b.ui.position&&!b.isEmptyObject(f.position)?(f.position.of=f.position.of||a,c.show().position(f.position).hide().show(g,e)):c.css({top:k.top+a.outerHeight(),left:k.left}).show(g,e);this.labels.eq(0).trigger("mouseover").trigger("mouseenter").find("input").trigger("focus");a.addClass("ui-state-active");this._isOpen=!0;this._trigger("open")}},close:function(){if(this._trigger("beforeclose")!==!1){var a=this.options,c=a.hide,e=this.speed;b.isArray(a.hide)&&(c=a.hide[0],e=a.hide[1]||this.speed);this.menu.hide(c,
4639-e);this.button.removeClass("ui-state-active").trigger("blur").trigger("mouseleave");this._isOpen=!1;this._trigger("close")}},enable:function(){this._toggleDisabled(!1)},disable:function(){this._toggleDisabled(!0)},checkAll:function(){this._toggleChecked(!0);this._trigger("checkAll")},uncheckAll:function(){this._toggleChecked(!1);this._trigger("uncheckAll")},getChecked:function(){return this.menu.find("input").filter(":checked")},destroy:function(){b.Widget.prototype.destroy.call(this);this.button.remove();
4640-this.menu.remove();this.element.show();return this},isOpen:function(){return this._isOpen},widget:function(){return this.menu},_setOption:function(a,c){var e=this.menu;switch(a){case "header":e.find("div.ui-multiselect-header")[c?"show":"hide"]();break;case "checkAllText":e.find("a.ui-multiselect-all span").eq(-1).text(c);break;case "uncheckAllText":e.find("a.ui-multiselect-none span").eq(-1).text(c);break;case "height":e.find("ul:last").height(parseInt(c,10));break;case "minWidth":this.options[a]=
4641-parseInt(c,10);this._setButtonWidth();this._setMenuWidth();break;case "selectedText":case "selectedList":case "noneSelectedText":this.options[a]=c;this.update();break;case "classes":e.add(this.button).removeClass(this.options.classes).addClass(c)}b.Widget.prototype._setOption.apply(this,arguments)}})})(jQuery);
4642-(function(b){var e=/[\-\[\]{}()*+?.,\\^$|#\s]/g;b.widget("ech.multiselectfilter",{options:{label:"Filter:",width:null,placeholder:"Enter keywords"},_create:function(){var f;var a=this,c=this.options,e=this.instance=b(this.element).data("multiselect");this.header=e.menu.find(".ui-multiselect-header").addClass("ui-multiselect-hasfilter");f=this.wrapper=b('<div class="ui-multiselect-filter">'+(c.label.length?c.label:"")+'<input placeholder="'+c.placeholder+'" type="search"'+(/\d/.test(c.width)?'style="width:'+
4643-c.width+'px"':"")+" /></div>").prependTo(this.header),c=f;this.inputs=e.menu.find('input[type="checkbox"], input[type="radio"]');this.input=c.find("input").bind({keydown:function(a){a.which===13&&a.preventDefault()},keyup:b.proxy(a._handler,a),click:b.proxy(a._handler,a)});this.updateCache();e._toggleChecked=function(c,e){var h=e&&e.length?e:this.labels.find("input"),k=this,h=h.not(a.instance._isOpen?":disabled, :hidden":":disabled").each(this._toggleCheckbox("checked",c));this.update();var n=h.map(function(){return this.value}).get();
4644-this.element.find("option").filter(function(){!this.disabled&&b.inArray(this.value,n)>-1&&k._toggleCheckbox("selected",c).call(this)})};b(document).bind("multiselectrefresh",function(){a.updateCache();a._handler()})},_handler:function(a){var c=b.trim(this.input[0].value.toLowerCase()),h=this.rows,f=this.inputs,j=this.cache;if(c){h.hide();var g=RegExp(c.replace(e,"\\$&"),"gi");this._trigger("filter",a,b.map(j,function(a,b){if(a.search(g)!==-1)return h.eq(b).show(),f.get(b);return null}))}else h.show();
4645-this.instance.menu.find(".ui-multiselect-optgroup-label").each(function(){var a=b(this);a[a.nextUntil(".ui-multiselect-optgroup-label").filter(":visible").length?"show":"hide"]()})},updateCache:function(){this.rows=this.instance.menu.find(".ui-multiselect-checkboxes li:not(.ui-multiselect-optgroup-label)");this.cache=this.element.children().map(function(){var a=b(this);this.tagName.toLowerCase()==="optgroup"&&(a=a.children());if(!a.val().length)return null;return a.map(function(){return this.innerHTML.toLowerCase()}).get()}).get()},
4646-widget:function(){return this.wrapper},destroy:function(){b.Widget.prototype.destroy.call(this);this.input.val("").trigger("keyup");this.wrapper.remove()}})})(jQuery);$(document).ready(function(){S3FilterFieldChange({FilterField:"skill_id",Field:"competency_id",FieldResource:"competency",FieldPrefix:"hrm",url:S3.Ap.concat("/hrm/skill_competencies/"),msgNoRecords:S3.i18n.no_ratings})});
4647-jQuery.fn.fancyZoom=function(b){function e(c){if(g)return!1;g=!0;var e=$($(this).attr("href")),j=b.height,k=window.innerWidth||window.document.documentElement.clientWidth||window.document.body.clientWidth,u=window.innerHeight||window.document.documentElement.clientHeight||window.document.body.clientHeight,r=window.pageYOffset||window.document.documentElement.scrollTop||window.document.body.scrollTop,m={width:k,height:u,x:window.pageXOffset||window.document.documentElement.scrollLeft||window.document.body.scrollLeft,
4648-y:r},k=(b.width||e.width())+60,u=(j||e.height())+60,j=Math.max(m.height/2-u/2+r,0),m=m.width/2-k/2,r=c.pageY,c=c.pageX;n.attr("curTop",r);n.attr("curLeft",c);n.attr("scaleImg",b.scaleImg?"true":"false");$("#zoom").hide().css({position:"absolute",top:r+"px",left:c+"px",width:"1px",height:"1px"});h();n.hide();b.closeOnClick&&$("#zoom").click(a);b.scaleImg?(p.html(e.html()),$("#zoom_content img").css("width","100%")):p.html("");$("#zoom").animate({top:j+"px",left:m+"px",opacity:"show",width:k,height:u},
4649-500,null,function(){b.scaleImg!=!0&&p.html(e.html());f();n.show();g=!1});return!1}function a(){if(g)return!1;g=!0;$("#zoom").unbind("click");h();n.attr("scaleImg")!="true"&&p.html("");n.hide();$("#zoom").animate({top:n.attr("curTop")+"px",left:n.attr("curLeft")+"px",opacity:"hide",width:"1px",height:"1px"},500,null,function(){n.attr("scaleImg")=="true"&&p.html("");f();g=!1});return!1}function c(a){$("#zoom_table td").each(function(){var b=$(this).css("background-image").replace(/\.(png|gif|none)\"\)$/,
4650-"."+a+'")');$(this).css("background-image",b)});var b=n.children("img"),c=b.attr("src").replace(/\.(png|gif|none)$/,"."+a);b.attr("src",c)}function h(){$.browser.msie&&parseFloat($.browser.version)>=7&&c("gif")}function f(){$.browser.msie&&$.browser.version>=7&&c("png")}var j=(b=b||{})&&b.directory?b.directory:"images",g=!1;if($("#zoom").length==0){var k=$.browser.msie?"gif":"png";$("body").append('<div id="zoom" style="display:none;"> <table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> <tbody> <tr> <td class="tl" style="background:url('+
4651-j+"/tl."+k+') 0 0 no-repeat; width:20px height:20px; overflow:hidden;" /> <td class="tm" style="background:url('+j+"/tm."+k+') 0 0 repeat-x; height:20px; overflow:hidden;" /> <td class="tr" style="background:url('+j+"/tr."+k+') 100% 0 no-repeat; width:20px height:20px; overflow:hidden;" /> </tr> <tr> <td class="ml" style="background:url('+j+"/ml."+k+') 0 0 repeat-y; width:20px; overflow:hidden;" /> <td class="mm" style="background:#fff; vertical-align:top; padding:10px;"> <div id="zoom_content"> </div> </td> <td class="mr" style="background:url('+
4652-j+"/mr."+k+') 100% 0 repeat-y; width:20px; overflow:hidden;" /> </tr> <tr> <td class="bl" style="background:url('+j+"/bl."+k+') 0 100% no-repeat; width:20px height:20px; overflow:hidden;" /> <td class="bm" style="background:url('+j+"/bm."+k+') 0 100% repeat-x; height:20px; overflow:hidden;" /> <td class="br" style="background:url('+j+"/br."+k+') 100% 100% no-repeat; width:20px height:20px; overflow:hidden;" /> </tr> </tbody> </table> <a href="#" title="Close" id="zoom_close" style="position:absolute; top:0; left:0;"> <img src="'+
4653-j+"/closebox."+k+'" alt="Close" style="border:none; margin:0; padding:0;" /> </a> </div>');$("html").click(function(b){$(b.target).parents("#zoom:visible").length==0&&a()});$(document).keyup(function(b){b.keyCode==27&&$("#zoom:visible").length>0&&a()});$("#zoom_close").click(a)}$("#zoom");$("#zoom_table");var n=$("#zoom_close"),p=$("#zoom_content");$("td.ml,td.mm,td.mr");this.each(function(){$($(this).attr("href")).hide();$(this).click(e)});return this};
4654-(function(b){var e=0;b.widget("ui.menu",{defaultElement:"<ul>",delay:150,options:{position:{my:"left top",at:"right top"}},_create:function(){var a=this;this.activeMenu=this.element;this.menuId=this.element.attr("id")||"ui-menu-"+e++;this.element.find(".ui-icon").length&&this.element.addClass("ui-menu-icons");this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({id:this.menuId,role:"menu"}).bind("click.menu",function(c){var e=b(c.target).closest(".ui-menu-item:has(a)");
4655-if(a.options.disabled)return!1;e.length&&((!a.active||a.active[0]!==e[0])&&a.focus(c,e),a.select(c))}).bind("mouseover.menu",function(c){if(!a.options.disabled){var e=b(c.target).closest(".ui-menu-item");e.length&&a.focus(c,e)}}).bind("mouseout.menu",function(c){a.options.disabled||b(c.target).closest(".ui-menu-item").length&&a.blur(c)});this.refresh();this.element.attr("tabIndex",0).bind("keydown.menu",function(c){if(!a.options.disabled)switch(c.keyCode){case b.ui.keyCode.PAGE_UP:a.previousPage(c);
4656+"").replace(/<(link|meta)[^>]+>/g,"")},ajaxSettings:{dataType:"html"},debug:!1};var p="appendTo",n="body";b.cluetip.setup=function(a){if(a&&a.insertionType&&a.insertionType.match(/appendTo|prependTo|insertBefore|insertAfter/))p=a.insertionType;if(a&&a.insertionElement)n=a.insertionElement}})(jQuery);$(document).ready(function(){S3FilterFieldChange({FilterField:"skill_id",Field:"competency_id",FieldResource:"competency",FieldPrefix:"hrm",url:S3.Ap.concat("/hrm/skill_competencies/"),msgNoRecords:S3.i18n.no_ratings})});
4657+jQuery.fn.fancyZoom=function(b){function c(c){if(j)return!1;j=!0;var e=$($(this).attr("href")),h=b.height,k=window.innerWidth||window.document.documentElement.clientWidth||window.document.body.clientWidth,u=window.innerHeight||window.document.documentElement.clientHeight||window.document.body.clientHeight,r=window.pageYOffset||window.document.documentElement.scrollTop||window.document.body.scrollTop,m={width:k,height:u,x:window.pageXOffset||window.document.documentElement.scrollLeft||window.document.body.scrollLeft,
4658+y:r},k=(b.width||e.width())+60,u=(h||e.height())+60,h=Math.max(m.height/2-u/2+r,0),m=m.width/2-k/2,r=c.pageY,c=c.pageX;p.attr("curTop",r);p.attr("curLeft",c);p.attr("scaleImg",b.scaleImg?"true":"false");$("#zoom").hide().css({position:"absolute",top:r+"px",left:c+"px",width:"1px",height:"1px"});f();p.hide();b.closeOnClick&&$("#zoom").click(a);b.scaleImg?(n.html(e.html()),$("#zoom_content img").css("width","100%")):n.html("");$("#zoom").animate({top:h+"px",left:m+"px",opacity:"show",width:k,height:u},
4659+500,null,function(){b.scaleImg!=!0&&n.html(e.html());g();p.show();j=!1});return!1}function a(){if(j)return!1;j=!0;$("#zoom").unbind("click");f();p.attr("scaleImg")!="true"&&n.html("");p.hide();$("#zoom").animate({top:p.attr("curTop")+"px",left:p.attr("curLeft")+"px",opacity:"hide",width:"1px",height:"1px"},500,null,function(){p.attr("scaleImg")=="true"&&n.html("");g();j=!1});return!1}function e(a){$("#zoom_table td").each(function(){var b=$(this).css("background-image").replace(/\.(png|gif|none)\"\)$/,
4660+"."+a+'")');$(this).css("background-image",b)});var b=p.children("img"),c=b.attr("src").replace(/\.(png|gif|none)$/,"."+a);b.attr("src",c)}function f(){$.browser.msie&&parseFloat($.browser.version)>=7&&e("gif")}function g(){$.browser.msie&&$.browser.version>=7&&e("png")}var h=(b=b||{})&&b.directory?b.directory:"images",j=!1;if($("#zoom").length==0){var k=$.browser.msie?"gif":"png";$("body").append('<div id="zoom" style="display:none;"> <table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> <tbody> <tr> <td class="tl" style="background:url('+
4661+h+"/tl."+k+') 0 0 no-repeat; width:20px height:20px; overflow:hidden;" /> <td class="tm" style="background:url('+h+"/tm."+k+') 0 0 repeat-x; height:20px; overflow:hidden;" /> <td class="tr" style="background:url('+h+"/tr."+k+') 100% 0 no-repeat; width:20px height:20px; overflow:hidden;" /> </tr> <tr> <td class="ml" style="background:url('+h+"/ml."+k+') 0 0 repeat-y; width:20px; overflow:hidden;" /> <td class="mm" style="background:#fff; vertical-align:top; padding:10px;"> <div id="zoom_content"> </div> </td> <td class="mr" style="background:url('+
4662+h+"/mr."+k+') 100% 0 repeat-y; width:20px; overflow:hidden;" /> </tr> <tr> <td class="bl" style="background:url('+h+"/bl."+k+') 0 100% no-repeat; width:20px height:20px; overflow:hidden;" /> <td class="bm" style="background:url('+h+"/bm."+k+') 0 100% repeat-x; height:20px; overflow:hidden;" /> <td class="br" style="background:url('+h+"/br."+k+') 100% 100% no-repeat; width:20px height:20px; overflow:hidden;" /> </tr> </tbody> </table> <a href="#" title="Close" id="zoom_close" style="position:absolute; top:0; left:0;"> <img src="'+
4663+h+"/closebox."+k+'" alt="Close" style="border:none; margin:0; padding:0;" /> </a> </div>');$("html").click(function(b){$(b.target).parents("#zoom:visible").length==0&&a()});$(document).keyup(function(b){b.keyCode==27&&$("#zoom:visible").length>0&&a()});$("#zoom_close").click(a)}$("#zoom");$("#zoom_table");var p=$("#zoom_close"),n=$("#zoom_content");$("td.ml,td.mm,td.mr");this.each(function(){$($(this).attr("href")).hide();$(this).click(c)});return this};
4664+(function(b){var c=0;b.widget("ui.menu",{defaultElement:"<ul>",delay:150,options:{position:{my:"left top",at:"right top"}},_create:function(){var a=this;this.activeMenu=this.element;this.menuId=this.element.attr("id")||"ui-menu-"+c++;this.element.find(".ui-icon").length&&this.element.addClass("ui-menu-icons");this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({id:this.menuId,role:"menu"}).bind("click.menu",function(c){var f=b(c.target).closest(".ui-menu-item:has(a)");
4665+if(a.options.disabled)return!1;f.length&&((!a.active||a.active[0]!==f[0])&&a.focus(c,f),a.select(c))}).bind("mouseover.menu",function(c){if(!a.options.disabled){var f=b(c.target).closest(".ui-menu-item");f.length&&a.focus(c,f)}}).bind("mouseout.menu",function(c){a.options.disabled||b(c.target).closest(".ui-menu-item").length&&a.blur(c)});this.refresh();this.element.attr("tabIndex",0).bind("keydown.menu",function(c){if(!a.options.disabled)switch(c.keyCode){case b.ui.keyCode.PAGE_UP:a.previousPage(c);
4666 c.preventDefault();c.stopImmediatePropagation();break;case b.ui.keyCode.PAGE_DOWN:a.nextPage(c);c.preventDefault();c.stopImmediatePropagation();break;case b.ui.keyCode.UP:a.previous(c);c.preventDefault();c.stopImmediatePropagation();break;case b.ui.keyCode.DOWN:a.next(c);c.preventDefault();c.stopImmediatePropagation();break;case b.ui.keyCode.LEFT:a.left(c)&&c.stopImmediatePropagation();c.preventDefault();break;case b.ui.keyCode.RIGHT:a.right(c)&&c.stopImmediatePropagation();c.preventDefault();break;
4667-case b.ui.keyCode.ENTER:a.active.children("a[aria-haspopup='true']").length?a.right(c)&&c.stopImmediatePropagation():(a.select(c),c.stopImmediatePropagation());c.preventDefault();break;case b.ui.keyCode.ESCAPE:a.left(c)&&c.stopImmediatePropagation();c.preventDefault();break;default:c.stopPropagation();clearTimeout(a.filterTimer);var e=a.previousFilter||"",f=String.fromCharCode(c.keyCode),j=!1;f==e?j=!0:f=e+f;var g=function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},e=a.activeMenu.children(".ui-menu-item").filter(function(){return RegExp("^"+
4668-g(f),"i").test(b(this).children("a").text())}),e=j&&e.index(a.active.next())!=-1?a.active.nextAll(".ui-menu-item"):e;e.length||(f=String.fromCharCode(c.keyCode),e=a.activeMenu.children(".ui-menu-item").filter(function(){return RegExp("^"+g(f),"i").test(b(this).children("a").text())}));e.length?(a.focus(c,e),e.length>1?(a.previousFilter=f,a.filterTimer=setTimeout(function(){delete a.previousFilter},1E3)):delete a.previousFilter):delete a.previousFilter}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find("ul").andSelf().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").show();
4669+case b.ui.keyCode.ENTER:a.active.children("a[aria-haspopup='true']").length?a.right(c)&&c.stopImmediatePropagation():(a.select(c),c.stopImmediatePropagation());c.preventDefault();break;case b.ui.keyCode.ESCAPE:a.left(c)&&c.stopImmediatePropagation();c.preventDefault();break;default:c.stopPropagation();clearTimeout(a.filterTimer);var f=a.previousFilter||"",g=String.fromCharCode(c.keyCode),h=!1;g==f?h=!0:g=f+g;var j=function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},f=a.activeMenu.children(".ui-menu-item").filter(function(){return RegExp("^"+
4670+j(g),"i").test(b(this).children("a").text())}),f=h&&f.index(a.active.next())!=-1?a.active.nextAll(".ui-menu-item"):f;f.length||(g=String.fromCharCode(c.keyCode),f=a.activeMenu.children(".ui-menu-item").filter(function(){return RegExp("^"+j(g),"i").test(b(this).children("a").text())}));f.length?(a.focus(c,f),f.length>1?(a.previousFilter=g,a.filterTimer=setTimeout(function(){delete a.previousFilter},1E3)):delete a.previousFilter):delete a.previousFilter}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find("ul").andSelf().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").show();
4671 this.element.find(".ui-menu-item").unbind(".menu").removeClass("ui-menu-item").removeAttr("role").children("a").removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").removeAttr("id").children(".ui-icon").remove()},refresh:function(){var a=this,c=this.element.find("ul:not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr("role","menu").hide().attr("aria-hidden","true").attr("aria-expanded","false");c.add(this.element).children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role",
4672-"presentation").children("a").addClass("ui-corner-all").attr("tabIndex",-1).attr("role","menuitem").attr("id",function(b){return a.element.attr("id")+"-"+b});c.each(function(){var a=b(this),c=a.prev("a");c.attr("aria-haspopup","true").prepend('<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>');a.attr("aria-labelledby",c.attr("id"))})},focus:function(a,c){var e=this;this.blur();if(this._hasScroll()){var f=parseFloat(b.curCSS(this.element[0],"borderTopWidth",!0))||0,j=parseFloat(b.curCSS(this.element[0],
4673-"paddingTop",!0))||0,f=c.offset().top-this.element.offset().top-f-j,j=this.element.scrollTop(),g=this.element.height(),k=c.height();f<0?this.element.scrollTop(j+f):f+k>g&&this.element.scrollTop(j+f-g+k)}this.active=c.first().children("a").addClass("ui-state-focus").end();e.element.attr("aria-activedescendant",e.active.children("a").attr("id"));this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");e.timer=setTimeout(function(){e._close()},e.delay);f=b(">ul",
4674-c);f.length&&/^mouse/.test(a.type)&&e._startOpening(f);this.activeMenu=c.parent();this._trigger("focus",a,{item:c})},blur:function(){if(this.active)clearTimeout(this.timer),this.active.children("a").removeClass("ui-state-focus"),this.active=null},_startOpening:function(a){clearTimeout(this.timer);var b=this;b.timer=setTimeout(function(){b._close();b._open(a)},b.delay)},_open:function(a){clearTimeout(this.timer);this.element.find(".ui-menu").not(a.parents()).hide().attr("aria-hidden","true");var c=
4675+"presentation").children("a").addClass("ui-corner-all").attr("tabIndex",-1).attr("role","menuitem").attr("id",function(b){return a.element.attr("id")+"-"+b});c.each(function(){var a=b(this),c=a.prev("a");c.attr("aria-haspopup","true").prepend('<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>');a.attr("aria-labelledby",c.attr("id"))})},focus:function(a,c){var f=this;this.blur();if(this._hasScroll()){var g=parseFloat(b.curCSS(this.element[0],"borderTopWidth",!0))||0,h=parseFloat(b.curCSS(this.element[0],
4676+"paddingTop",!0))||0,g=c.offset().top-this.element.offset().top-g-h,h=this.element.scrollTop(),j=this.element.height(),k=c.height();g<0?this.element.scrollTop(h+g):g+k>j&&this.element.scrollTop(h+g-j+k)}this.active=c.first().children("a").addClass("ui-state-focus").end();f.element.attr("aria-activedescendant",f.active.children("a").attr("id"));this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");f.timer=setTimeout(function(){f._close()},f.delay);g=b(">ul",
4677+c);g.length&&/^mouse/.test(a.type)&&f._startOpening(g);this.activeMenu=c.parent();this._trigger("focus",a,{item:c})},blur:function(){if(this.active)clearTimeout(this.timer),this.active.children("a").removeClass("ui-state-focus"),this.active=null},_startOpening:function(a){clearTimeout(this.timer);var b=this;b.timer=setTimeout(function(){b._close();b._open(a)},b.delay)},_open:function(a){clearTimeout(this.timer);this.element.find(".ui-menu").not(a.parents()).hide().attr("aria-hidden","true");var c=
4678 b.extend({},{of:this.active},b.type(this.options.position)=="function"?this.options.position(this.active):this.options.position);a.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(c)},closeAll:function(){this.element.find("ul").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active");this.blur();this.activeMenu=this.element},_close:function(){this.active.parent().find("ul").hide().attr("aria-hidden","true").attr("aria-expanded",
4679-"false").end().find("a.ui-state-active").removeClass("ui-state-active")},left:function(a){var b=this.active&&this.active.parents("li:not(.ui-menubar-item)").first();if(b&&b.length)return this.active.parent().attr("aria-hidden","true").attr("aria-expanded","false").hide(),this.focus(a,b),!0},right:function(a){var b=this,e=this.active&&this.active.children("ul").children("li").first();if(e&&e.length)return this._open(e.parent()),setTimeout(function(){b.focus(a,e)},20),!0},next:function(a){this._move("next",
4680-".ui-menu-item","first",a)},previous:function(a){this._move("prev",".ui-menu-item","last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(a,b,e,f){this.active?(a=this.active[a+"All"](".ui-menu-item").eq(0),a.length?this.focus(f,a):this.focus(f,this.activeMenu.children(b)[e]())):this.focus(f,this.activeMenu.children(b)[e]())},nextPage:function(a){if(this._hasScroll())if(!this.active||
4681-this.last())this.focus(a,this.activeMenu.children(".ui-menu-item").first());else{var c=this.active.offset().top,e=this.element.height(),f;this.active.nextAll(".ui-menu-item").each(function(){f=b(this);return b(this).offset().top-c-e<0});this.focus(a,f)}else this.focus(a,this.activeMenu.children(".ui-menu-item")[!this.active||this.last()?"first":"last"]())},previousPage:function(a){if(this._hasScroll())if(!this.active||this.first())this.focus(a,this.activeMenu.children(".ui-menu-item").last());else{var c=
4682-this.active.offset().top,e=this.element.height(),f;this.active.prevAll(".ui-menu-item").each(function(){f=b(this);return b(this).offset().top-c+e>0});this.focus(a,f)}else this.focus(a,this.activeMenu.children(".ui-menu-item")[!this.active||this.first()?":last":":first"]())},_hasScroll:function(){return this.element.height()<this.element[b.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){var b={item:this.active};this.closeAll();this._trigger("select",a,b)}});b.ui.menu.version="@VERSION"})(jQuery);
4683-(function(b){var e=0;b.widget("ui.autocomplete",{version:"@VERSION",defaultElement:"<input>",options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var a=this,c=this.element[0].ownerDocument,e,f;this.valueMethod=this.element[this.element.is("input")?"val":"text"];this.element.addClass("ui-autocomplete-input").attr("autocomplete",
4684-"off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(a.options.disabled||a.element.attr("readonly"))f=e=!0;else{f=e=!1;var g=b.ui.keyCode;switch(c.keyCode){case g.PAGE_UP:e=!0;a._move("previousPage",c);break;case g.PAGE_DOWN:e=!0;a._move("nextPage",c);break;case g.UP:e=!0;a._move("previous",c);c.preventDefault();break;case g.DOWN:e=!0;a._move("next",c);c.preventDefault();break;case g.ENTER:case g.NUMPAD_ENTER:a.menu.active&&(e=
4685-!0,c.preventDefault());case g.TAB:if(!a.menu.active)break;a.menu.select(c);break;case g.ESCAPE:a._value(a.term);a.close(c);break;default:a._searchTimeout(c)}}}).bind("keypress.autocomplete",function(c){if(e)e=!1,c.preventDefault();else{var f=b.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c),c.preventDefault()}}}).bind("input.autocomplete",
4686-function(b){f?(f=!1,b.preventDefault()):a._searchTimeout(b)}).bind("focus.autocomplete",function(){if(!a.options.disabled)a.selectedItem=null,a.previous=a._value()}).bind("blur.autocomplete",function(b){if(!a.options.disabled)clearTimeout(a.searching),a.closing=setTimeout(function(){a.close(b);a._change(b)},150)});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=b("<ul></ul>").addClass("ui-autocomplete").appendTo(b(this.options.appendTo||"body",c)[0]).mousedown(function(c){var e=
4687-a.menu.element[0];b(c.target).closest(".ui-menu-item").length||setTimeout(function(){b(document).one("mousedown",function(c){c.target!==a.element[0]&&c.target!==e&&!b.contains(e,c.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({input:b(),focus:function(b,c){var e=c.item.data("item.autocomplete");!1!==a._trigger("focus",b,{item:e})&&/^key/.test(b.originalEvent.type)&&a._value(e.value)},select:function(b,e){var f=e.item.data("item.autocomplete"),h=a.previous;if(a.element[0]!==
4688-c.activeElement)a.element.focus(),a.previous=h,setTimeout(function(){a.previous=h;a.selectedItem=f},1);!1!==a._trigger("select",b,{item:f})&&a._value(f.value);a.term=a._value();a.close(b);a.selectedItem=f},blur:function(){a.menu.element.is(":visible")&&a._value()!==a.term&&a._value(a.term)}}).zIndex(this.element.zIndex()+1).hide().data("menu");b.fn.bgiframe&&this.menu.element.bgiframe()},_destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");
4689-this.menu.element.remove()},_setOption:function(a,c){this._super("_setOption",a,c);a==="source"&&this._initSource();a==="appendTo"&&this.menu.element.appendTo(b(c||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,c,h;b.isArray(this.options.source)?(c=this.options.source,this.source=function(a,e){e(b.ui.autocomplete.filter(c,a.term))}):typeof this.options.source==="string"?(h=this.options.source,this.source=function(c,j){a.xhr&&
4690-a.xhr.abort();a.xhr=b.ajax({url:h,data:c,dataType:"json",autocompleteRequest:++e,success:function(a){this.autocompleteRequest===e&&j(a)},error:function(){this.autocompleteRequest===e&&j([])}})}):this.source=this.options.source},_searchTimeout:function(a){var b=this;b.searching=setTimeout(function(){if(b.term!=b.element.val())b.selectedItem=null,b.search(null,a)},b.options.delay)},search:function(a,b){a=a!=null?a:this._value();this.term=this._value();if(a.length<this.options.minLength)return this.close(b);
4691+"false").end().find("a.ui-state-active").removeClass("ui-state-active")},left:function(a){var b=this.active&&this.active.parents("li:not(.ui-menubar-item)").first();if(b&&b.length)return this.active.parent().attr("aria-hidden","true").attr("aria-expanded","false").hide(),this.focus(a,b),!0},right:function(a){var b=this,c=this.active&&this.active.children("ul").children("li").first();if(c&&c.length)return this._open(c.parent()),setTimeout(function(){b.focus(a,c)},20),!0},next:function(a){this._move("next",
4692+".ui-menu-item","first",a)},previous:function(a){this._move("prev",".ui-menu-item","last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(a,b,c,g){this.active?(a=this.active[a+"All"](".ui-menu-item").eq(0),a.length?this.focus(g,a):this.focus(g,this.activeMenu.children(b)[c]())):this.focus(g,this.activeMenu.children(b)[c]())},nextPage:function(a){if(this._hasScroll())if(!this.active||
4693+this.last())this.focus(a,this.activeMenu.children(".ui-menu-item").first());else{var c=this.active.offset().top,f=this.element.height(),g;this.active.nextAll(".ui-menu-item").each(function(){g=b(this);return b(this).offset().top-c-f<0});this.focus(a,g)}else this.focus(a,this.activeMenu.children(".ui-menu-item")[!this.active||this.last()?"first":"last"]())},previousPage:function(a){if(this._hasScroll())if(!this.active||this.first())this.focus(a,this.activeMenu.children(".ui-menu-item").last());else{var c=
4694+this.active.offset().top,f=this.element.height(),g;this.active.prevAll(".ui-menu-item").each(function(){g=b(this);return b(this).offset().top-c+f>0});this.focus(a,g)}else this.focus(a,this.activeMenu.children(".ui-menu-item")[!this.active||this.first()?":last":":first"]())},_hasScroll:function(){return this.element.height()<this.element[b.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){var b={item:this.active};this.closeAll();this._trigger("select",a,b)}});b.ui.menu.version="@VERSION"})(jQuery);
4695+(function(b){var c=0;b.widget("ui.autocomplete",{version:"@VERSION",defaultElement:"<input>",options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var a=this,c=this.element[0].ownerDocument,f,g;this.valueMethod=this.element[this.element.is("input")?"val":"text"];this.element.addClass("ui-autocomplete-input").attr("autocomplete",
4696+"off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(a.options.disabled||a.element.attr("readonly"))g=f=!0;else{g=f=!1;var e=b.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:f=!0;a._move("previousPage",c);break;case e.PAGE_DOWN:f=!0;a._move("nextPage",c);break;case e.UP:f=!0;a._move("previous",c);c.preventDefault();break;case e.DOWN:f=!0;a._move("next",c);c.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:a.menu.active&&(f=
4697+!0,c.preventDefault());case e.TAB:if(!a.menu.active)break;a.menu.select(c);break;case e.ESCAPE:a._value(a.term);a.close(c);break;default:a._searchTimeout(c)}}}).bind("keypress.autocomplete",function(c){if(f)f=!1,c.preventDefault();else{var e=b.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:a._move("previousPage",c);break;case e.PAGE_DOWN:a._move("nextPage",c);break;case e.UP:a._move("previous",c);c.preventDefault();break;case e.DOWN:a._move("next",c),c.preventDefault()}}}).bind("input.autocomplete",
4698+function(b){g?(g=!1,b.preventDefault()):a._searchTimeout(b)}).bind("focus.autocomplete",function(){if(!a.options.disabled)a.selectedItem=null,a.previous=a._value()}).bind("blur.autocomplete",function(b){if(!a.options.disabled)clearTimeout(a.searching),a.closing=setTimeout(function(){a.close(b);a._change(b)},150)});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=b("<ul></ul>").addClass("ui-autocomplete").appendTo(b(this.options.appendTo||"body",c)[0]).mousedown(function(c){var e=
4699+a.menu.element[0];b(c.target).closest(".ui-menu-item").length||setTimeout(function(){b(document).one("mousedown",function(c){c.target!==a.element[0]&&c.target!==e&&!b.contains(e,c.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({input:b(),focus:function(b,c){var e=c.item.data("item.autocomplete");!1!==a._trigger("focus",b,{item:e})&&/^key/.test(b.originalEvent.type)&&a._value(e.value)},select:function(b,f){var g=f.item.data("item.autocomplete"),p=a.previous;if(a.element[0]!==
4700+c.activeElement)a.element.focus(),a.previous=p,setTimeout(function(){a.previous=p;a.selectedItem=g},1);!1!==a._trigger("select",b,{item:g})&&a._value(g.value);a.term=a._value();a.close(b);a.selectedItem=g},blur:function(){a.menu.element.is(":visible")&&a._value()!==a.term&&a._value(a.term)}}).zIndex(this.element.zIndex()+1).hide().data("menu");b.fn.bgiframe&&this.menu.element.bgiframe()},_destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");
4701+this.menu.element.remove()},_setOption:function(a,c){this._super("_setOption",a,c);a==="source"&&this._initSource();a==="appendTo"&&this.menu.element.appendTo(b(c||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,e,f;b.isArray(this.options.source)?(e=this.options.source,this.source=function(a,c){c(b.ui.autocomplete.filter(e,a.term))}):typeof this.options.source==="string"?(f=this.options.source,this.source=function(e,h){a.xhr&&
4702+a.xhr.abort();a.xhr=b.ajax({url:f,data:e,dataType:"json",autocompleteRequest:++c,success:function(a){this.autocompleteRequest===c&&h(a)},error:function(){this.autocompleteRequest===c&&h([])}})}):this.source=this.options.source},_searchTimeout:function(a){var b=this;b.searching=setTimeout(function(){if(b.term!=b.element.val())b.selectedItem=null,b.search(null,a)},b.options.delay)},search:function(a,b){a=a!=null?a:this._value();this.term=this._value();if(a.length<this.options.minLength)return this.close(b);
4703 clearTimeout(this.closing);if(this._trigger("search",b)!==!1)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){a&&(a=this._normalize(a));this._trigger("response",null,{content:a});!this.options.disabled&&a&&a.length?(this._suggest(a),this._trigger("open")):this.close();this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);
4704 this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this._trigger("close",a))},_change:function(a){this.previous!==this._value()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return b.map(a,function(a){if(typeof a==="string")return{label:a,value:a};return b.extend({label:a.label||a.value,value:a.value||a.label},a)})},_suggest:function(a){var c=this.menu.element.empty().zIndex(this.element.zIndex()+
4705-1);this._renderMenu(c,a);this.menu.blur();this.menu.refresh();c.show();this._resizeMenu();c.position(b.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new b.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,c){var e=this;b.each(c,function(b,c){e._renderItem(a,c)})},_renderItem:function(a,c){return b("<li></li>").data("item.autocomplete",c).append(b("<a></a>").text(c.label)).appendTo(a)},
4706-_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a))this._value(this.term),this.menu.blur();else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)}});b.extend(b.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(a,c){var e=RegExp(b.ui.autocomplete.escapeRegex(c),
4707-"i");return b.grep(a,function(a){return e.test(a.label||a.value||a)})}})})(jQuery);$(document).ready(function(){S3.rtl?$('div.label label[id!="delete_record__label"]').prepend(":"):$('div.label label[id!="delete_record__label"]').append(":")});
4708-var S3={gis:{},uid:function(){return(+new Date/1E3*65536+Math.random()*65535>>0).toString(16)},Utf8:{encode:function(b){for(var b=b.replace(/\r\n/g,"\n"),e="",a=0;a<b.length;a++){var c=b.charCodeAt(a);c<128?e+=String.fromCharCode(c):(c>127&&c<2048?e+=String.fromCharCode(c>>6|192):(e+=String.fromCharCode(c>>12|224),e+=String.fromCharCode(c>>6&63|128)),e+=String.fromCharCode(c&63|128))}return e},decode:function(b){for(var e="",a=0,c=c1=c2=0;a<b.length;)c=b.charCodeAt(a),c<128?(e+=String.fromCharCode(c),
4709-a++):c>191&&c<224?(c2=b.charCodeAt(a+1),e+=String.fromCharCode((c&31)<<6|c2&63),a+=2):(c2=b.charCodeAt(a+1),c3=b.charCodeAt(a+2),e+=String.fromCharCode((c&15)<<12|(c2&63)<<6|c3&63),a+=3);return e}}},popupWin=null;function openPopup(b){!popupWin||popupWin.closed?popupWin=window.open(b,"popupWin","width=640, height=480"):popupWin.focus()}
4710+1);this._renderMenu(c,a);this.menu.blur();this.menu.refresh();c.show();this._resizeMenu();c.position(b.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new b.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,c){var f=this;b.each(c,function(b,c){f._renderItem(a,c)})},_renderItem:function(a,c){return b("<li></li>").data("item.autocomplete",c).append(b("<a></a>").text(c.label)).appendTo(a)},
4711+_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a))this._value(this.term),this.menu.blur();else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)}});b.extend(b.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(a,c){var f=RegExp(b.ui.autocomplete.escapeRegex(c),
4712+"i");return b.grep(a,function(a){return f.test(a.label||a.value||a)})}})})(jQuery);
4713+(function(b){b.widget("ui.multiselect",{options:{sortable:!0,searchable:!0,doubleClickable:!0,animated:"fast",show:"slideDown",hide:"slideUp",dividerLocation:0.6,nodeComparator:function(b,a){var e=b.text(),f=a.text();return e==f?0:e<f?-1:1}},_create:function(){this.element.hide();this.id=this.element.attr("id");this.container=b('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);this.count=0;this.selectedContainer=b('<div class="selected"></div>').appendTo(this.container);
4714+this.availableContainer=b('<div class="available"></div>').appendTo(this.container);this.selectedActions=b('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+b.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+b.ui.multiselect.locale.removeAll+"</a></div>").appendTo(this.selectedContainer);this.availableActions=b('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+
4715+b.ui.multiselect.locale.addAll+"</a></div>").appendTo(this.availableContainer);this.selectedList=b('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return!1}).appendTo(this.selectedContainer);this.availableList=b('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return!1}).appendTo(this.availableContainer);var c=this;this.container.width(this.element.width()+
4716+1);this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));if(!this.options.animated)this.options.show="show",this.options.hide="hide";this._populateLists(this.element.find("option"));this.options.sortable&&
4717+this.selectedList.sortable({placeholder:"ui-state-highlight",axis:"y",update:function(){c.selectedList.find("li").each(function(){b(this).data("optionLink")&&b(this).data("optionLink").remove().appendTo(c.element)})},receive:function(a,e){e.item.data("optionLink").attr("selected",!0);c.count+=1;c._updateCount();c.selectedList.children(".ui-draggable").each(function(){b(this).removeClass("ui-draggable");b(this).data("optionLink",e.item.data("optionLink"));b(this).data("idx",e.item.data("idx"));c._applyItemState(b(this),
4718+!0)});setTimeout(function(){e.item.remove()},1)}});this.options.searchable?this._registerSearchEvents(this.availableContainer.find("input.search")):b(".search").hide();this.container.find(".remove-all").click(function(){c._populateLists(c.element.find("option").removeAttr("selected"));return!1});this.container.find(".add-all").click(function(){var a=c.element.find("option").not(":selected");c.availableList.children("li:hidden").length>1?c.availableList.children("li").each(function(c){b(this).is(":visible")&&
4719+b(a[c-1]).attr("selected","selected")}):a.attr("selected","selected");c._populateLists(c.element.find("option"));return!1})},destroy:function(){this.element.show();this.container.remove();b.Widget.prototype.destroy.apply(this,arguments)},_populateLists:function(c){this.selectedList.children(".ui-element").remove();this.availableList.children(".ui-element").remove();this.count=0;var a=this;b(c.map(function(b){var c=a._getOptionNode(this).appendTo(this.selected?a.selectedList:a.availableList).show();
4720+this.selected&&(a.count+=1);a._applyItemState(c,this.selected);c.data("idx",b);return c[0]}));this._updateCount();a._filter.apply(this.availableContainer.find("input.search"),[a.availableList])},_updateCount:function(){this.selectedContainer.find("span.count").text(this.count+" "+b.ui.multiselect.locale.itemsCount)},_getOptionNode:function(c){var c=b(c),a=b('<li class="ui-state-default ui-element" title="'+c.text()+'"><span class="ui-icon"/>'+c.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
4721+a.data("optionLink",c);return a},_cloneWithData:function(b){var a=b.clone(!1,!1);a.data("optionLink",b.data("optionLink"));a.data("idx",b.data("idx"));return a},_setSelected:function(c,a){c.data("optionLink").attr("selected",a);if(a){var e=this._cloneWithData(c);c[this.options.hide](this.options.animated,function(){b(this).remove()});e.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(e,!0);return e}else{var f=this.availableList.find("li"),g=this.options.nodeComparator,
4722+e=null,h=c.data("idx"),j=g(c,b(f[h]));if(j)for(;h>=0&&h<f.length;){if(j>0?h++:h--,j!=g(c,b(f[h]))){e=f[j>0?h:h+1];break}}else e=f[h];f=this._cloneWithData(c);e?f.insertBefore(b(e)):f.appendTo(this.availableList);c[this.options.hide](this.options.animated,function(){b(this).remove()});f.hide()[this.options.show](this.options.animated);this._applyItemState(f,!1);return f}},_applyItemState:function(b,a){a?(this.options.sortable?b.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon"):
4723+b.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),b.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus"),this._registerRemoveEvents(b.find("a.action"))):(b.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),b.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus"),this._registerAddEvents(b.find("a.action")));this._registerDoubleClickEvents(b);
4724+this._registerHoverEvents(b)},_filter:function(c){var a=b(this),e=c.children("li"),c=e.map(function(){return b(this).text().toLowerCase()}),f=b.trim(a.val().toLowerCase()),g=[];f?(e.hide(),c.each(function(a){this.indexOf(f)>-1&&g.push(a)}),b.each(g,function(){b(e[this]).show()})):e.show()},_registerDoubleClickEvents:function(b){this.options.doubleClickable&&b.dblclick(function(){b.find("a.action").click()})},_registerHoverEvents:function(c){c.removeClass("ui-state-hover");c.mouseover(function(){b(this).addClass("ui-state-hover")});
4725+c.mouseout(function(){b(this).removeClass("ui-state-hover")})},_registerAddEvents:function(c){var a=this;c.click(function(){a._setSelected(b(this).parent(),!0);a.count+=1;a._updateCount();return!1});this.options.sortable&&c.each(function(){b(this).parent().draggable({connectToSortable:a.selectedList,helper:function(){var c=a._cloneWithData(b(this)).width(b(this).width()-50);c.width(b(this).width());return c},appendTo:a.container,containment:a.container,revert:"invalid"})})},_registerRemoveEvents:function(c){var a=
4726+this;c.click(function(){a._setSelected(b(this).parent(),!1);a.count-=1;a._updateCount();return!1})},_registerSearchEvents:function(c){var a=this;c.focus(function(){b(this).addClass("ui-state-active")}).blur(function(){b(this).removeClass("ui-state-active")}).keypress(function(a){if(a.keyCode==13)return!1}).keyup(function(){a._filter.apply(this,[a.availableList])})}});b.extend(b.ui.multiselect,{locale:{addAll:"Add all",removeAll:"Remove all",itemsCount:"items selected"}})})(jQuery);
4727+$(function(){$("#auth_role_set_orgs_delegated").removeClass("list");$("#auth_role_set_orgs_delegated").addClass("multiselect");$("#auth_role_set_orgs_delegated").multiselect({dividerLocation:0.5,sortable:!1});$("#auth_org_role_set_users_assigned").multiselect({dividerLocation:0.5});$(".role_radio_noaccess").click(function(){acl=$.parseJSON(this.id);access=acl[0];reader=acl[1];editor=acl[2];$("#rs_"+access).prop("checked",!1);$("#rs_"+reader).prop("checked",!1);$("#rs_"+editor).prop("checked",!1)});
4728+$(".role_radio_reader").click(function(){acl=$.parseJSON(this.id);access=acl[0];reader=acl[1];editor=acl[2];$("#rs_"+access).attr("checked","checked");$("#rs_"+reader).attr("checked","checked");$("#rs_"+editor).prop("checked",!1)});$(".role_radio_editor").click(function(){acl=$.parseJSON(this.id);access=acl[0];reader=acl[1];editor=acl[2];$("#rs_"+access).attr("checked","checked");$("#rs_"+reader).prop("checked",!1);$("#rs_"+editor).attr("checked","checked")})});
4729+$(document).ready(function(){S3.rtl?$('div.label label[id!="delete_record__label"]').prepend(":"):$('div.label label[id!="delete_record__label"]').append(":")});
4730+var S3={gis:{},uid:function(){return(+new Date/1E3*65536+Math.random()*65535>>0).toString(16)},Utf8:{encode:function(b){for(var b=b.replace(/\r\n/g,"\n"),c="",a=0;a<b.length;a++){var e=b.charCodeAt(a);e<128?c+=String.fromCharCode(e):(e>127&&e<2048?c+=String.fromCharCode(e>>6|192):(c+=String.fromCharCode(e>>12|224),c+=String.fromCharCode(e>>6&63|128)),c+=String.fromCharCode(e&63|128))}return c},decode:function(b){for(var c="",a=0,e=c1=c2=0;a<b.length;)e=b.charCodeAt(a),e<128?(c+=String.fromCharCode(e),
4731+a++):e>191&&e<224?(c2=b.charCodeAt(a+1),c+=String.fromCharCode((e&31)<<6|c2&63),a+=2):(c2=b.charCodeAt(a+1),c3=b.charCodeAt(a+2),c+=String.fromCharCode((e&15)<<12|(c2&63)<<6|c3&63),a+=3);return c}}},popupWin=null;function openPopup(b){!popupWin||popupWin.closed?popupWin=window.open(b,"popupWin","width=640, height=480"):popupWin.focus()}
4732 $(document).ready(function(){$(".error").hide().slideDown("slow");$(".error").click(function(){$(this).fadeOut("slow");return!1});$(".warning").hide().slideDown("slow");$(".warning").click(function(){$(this).fadeOut("slow");return!1});$(".information").hide().slideDown("slow");$(".information").click(function(){$(this).fadeOut("slow");return!1});$(".confirmation").hide().slideDown("slow");$(".confirmation").click(function(){$(this).fadeOut("slow");return!1});$("input[type='checkbox'].delete").click(function(){if(this.checked&&
4733-!confirm(S3.i18n.delete_confirmation))this.checked=!1});try{$("input.datetime").focus(function(){Calendar.setup({inputField:this.id,ifFormat:S3.i18n.datetime_format,showsTime:!0,timeFormat:"24"})})}catch(b){}try{$(".zoom").fancyZoom({scaleImg:!0,closeOnClick:!0,directory:S3.Ap.concat("/static/media")})}catch(e){}S3.interactive&&$("a.delete-btn").live("click",function(a){return confirm(S3.i18n.delete_confirmation)?!0:(a.preventDefault(),!1)});$("input.date").datepicker({changeMonth:!0,changeYear:!0,
4734+!confirm(S3.i18n.delete_confirmation))this.checked=!1});try{$("input.datetime").focus(function(){Calendar.setup({inputField:this.id,ifFormat:S3.i18n.datetime_format,showsTime:!0,timeFormat:"24"})})}catch(b){}try{$(".zoom").fancyZoom({scaleImg:!0,closeOnClick:!0,directory:S3.Ap.concat("/static/media")})}catch(c){}S3.interactive&&$("a.delete-btn").live("click",function(a){return confirm(S3.i18n.delete_confirmation)?!0:(a.preventDefault(),!1)});$("input.date").datepicker({changeMonth:!0,changeYear:!0,
4735 showOn:"both",buttonImage:S3.Ap.concat("/static/img/jquery-ui/calendar.gif"),buttonImageOnly:!0,dateFormat:"yy-mm-dd",isRTL:S3.rtl});$("input.time").timepicker({hourText:S3.i18n.hour,minuteText:S3.i18n.minute});$(".hoverable").hover(function(){$(this).addClass("hovered")},function(){$(this).removeClass("hovered")});$("#modulenav li").hover(function(){var a=$(this).width(),b=$("ul",this).width();b!=null&&b<a&&$("ul",this).css({width:a.toString()+"px"});$("ul",this).css("display","block")},function(){$("ul",
4736-this).css("display","none")});$("#subnav li").hover(function(){var a=$(this).width()-2;$("ul",this).css({display:"block",width:a.toString()+"px"})},function(){$("ul",this).css("display","none")});$("a.colorbox").attr("href",function(a,b){var e="";try{e=$(this).parents("tr").attr("id").replace(/__row/,"")}catch(j){if(e=="")return b}var g=b;b.indexOf("&caller=")==-1&&(g=b+"&caller="+e);return g});$(".colorbox").click(function(){$.fn.colorbox({iframe:!0,width:"99%",height:"99%",href:this.href,title:this.title});
4737+this).css("display","none")});$("#subnav li").hover(function(){var a=$(this).width()-2;$("ul",this).css({display:"block",width:a.toString()+"px"})},function(){$("ul",this).css("display","none")});$("a.colorbox").attr("href",function(a,b){var c="";try{c=$(this).parents("tr").attr("id").replace(/__row/,"")}catch(h){if(c=="")return b}var j=b;b.indexOf("&caller=")==-1&&(j=b+"&caller="+c);return j});$(".colorbox").click(function(){$.fn.colorbox({iframe:!0,width:"99%",height:"99%",href:this.href,title:this.title});
4738 return!1});$(".tooltip").cluetip({activation:"hover",sticky:!1,splitTitle:"|"});$(".tooltipbody").cluetip({activation:"hover",sticky:!1,splitTitle:"|",showTitle:!1});var a='<img src="'+S3.Ap.concat("/static/img/cross2.png")+'" alt="close" />';$(".stickytip").cluetip({activation:"hover",sticky:!0,closePosition:"title",closeText:a,splitTitle:"|"});$(".ajaxtip").cluetip({activation:"click",sticky:!0,closePosition:"title",closeText:a,width:380});now=new Date;$("form").append("<input type='hidden' value="+
4739-now.getTimezoneOffset()+" name='_utc_offset'/>")});function s3_tb_remove(){$.fn.colorbox.close()}function S3ConfirmClick(b,e){S3.interactive&&$(b).click(function(a){confirm(e)||a.preventDefault();return!1})}function S3SetNavigateAwayConfirm(){window.onbeforeunload=function(){return S3.i18n.unsaved_changes}}function S3ClearNavigateAwayConfirm(){window.onbeforeunload=function(){}}
4740+now.getTimezoneOffset()+" name='_utc_offset'/>")});function s3_tb_remove(){$.fn.colorbox.close()}function S3ConfirmClick(b,c){S3.interactive&&$(b).click(function(a){confirm(c)||a.preventDefault();return!1})}function S3SetNavigateAwayConfirm(){window.onbeforeunload=function(){return S3.i18n.unsaved_changes}}function S3ClearNavigateAwayConfirm(){window.onbeforeunload=function(){}}
4741 function S3EnableNavigateAwayConfirm(){$(document).ready(function(){$("[class=error]").length>0&&S3SetNavigateAwayConfirm();$(":input:not(input[id=gis_location_advanced_checkbox])").keypress(S3SetNavigateAwayConfirm);$(":input:not(input[id=gis_location_advanced_checkbox])").change(S3SetNavigateAwayConfirm);$("form").submit(S3ClearNavigateAwayConfirm)})}
4742-(function(b){b.ajaxS3=function(e){var a=b.extend({},b.ajaxS3Settings,e);a.tryCount=0;e.message&&s3_showStatus(S3.i18n.ajax_get+" "+(e.message?e.message:S3.i18n.ajax_fmd)+"...",this.ajaxS3Settings.msgTimeout);a.success=function(a,b){s3_hideStatus();e.success&&e.success(a,b)};a.error=function(a,h){h=="timeout"?(this.tryCount++,this.tryCount<=this.retryLimit?(s3_showStatus(S3.i18n.ajax_get+" "+(e.message?e.message:S3.i18n.ajax_fmd)+"... "+S3.i18n.ajax_rtr+" "+this.tryCount,b.ajaxS3Settings.msgTimeout),
4743-b.ajax(this)):s3_showStatus(S3.i18n.ajax_wht+" "+(this.retryLimit+1)+" "+S3.i18n.ajax_gvn,b.ajaxS3Settings.msgTimeout,!1,!0)):a.status==500?s3_showStatus(S3.i18n.ajax_500,b.ajaxS3Settings.msgTimeout,!1,!0):s3_showStatus(S3.i18n.ajax_dwn,b.ajaxS3Settings.msgTimeout,!1,!0)};b.ajax(a)};b.postS3=function(e,a,c,h){return b.ajaxS3({type:"POST",url:e,data:a,success:c,dataType:h})};b.getS3=function(e,a,c,h,f,j){b.isFunction(a)&&(j=f,f=h,h=c,c=a,a=null);if(j)var g=!1;return b.ajaxS3({type:"GET",url:e,async:g,
4744-data:a,success:c,dataType:h,message:f})};b.getJSONS3=function(e,a,c,h,f){b.isFunction(a)&&(f=h,h=c,c=a,a=null);f||(f=!1);return b.getS3(e,a,c,"json",h,f)};b.ajaxS3Settings={timeout:1E4,msgTimeout:2E3,retryLimit:10,dataType:"json",async:!0,type:"GET"};b.ajaxS3Setup=function(e){b.extend(b.ajaxS3Settings,e)}})($);
4745-function S3StatusBar(b,e){var a=this,c=null;this.elementId="_showstatus";this.prependMultiline=!0;this.showCloseButton=!1;this.afterTimeoutText=null;this.cssClass="statusbar";this.highlightClass="statusbarhighlight";this.errorClass="statusbarerror";this.closeButtonClass="statusbarclose";this.additive=!1;$.extend(this,e);b&&(c=$(b));c||(c=$("<div id='_statusbar' class='"+a.cssClass+"'><div class='"+a.closeButtonClass+"'>"+(a.showCloseButton?" X </div></div>":"")).appen

Subscribers

People subscribed via source and target branches