diff --git a/.travis.yml b/.travis.yml index 2f34dac4a7..51df866df3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,7 @@ compiler: script: - echo -e "\n\n>>> Building uWSGI binary" - - /usr/bin/python uwsgiconfig.py --build base - - echo -e "\n\n>>> Building python25 plugin" - - /usr/bin/python2.5 -V - - /usr/bin/python2.5 uwsgiconfig.py --plugin plugins/python base python25 + - /usr/bin/python uwsgiconfig.py --build travis - echo -e "\n\n>>> Building python26 plugin" - /usr/bin/python2.6 -V - /usr/bin/python2.6 uwsgiconfig.py --plugin plugins/python base python26 @@ -41,7 +38,7 @@ script: before_install: - sudo add-apt-repository -y ppa:fkrull/deadsnakes - sudo apt-get update -qq - - sudo apt-get install -qqyf python2.5-dev python2.6-dev python2.7-dev python3.1-dev python3.2-dev python3.3-dev rubygems1.8 ruby1.8-dev ruby1.9.1-dev + - sudo apt-get install -qqyf python2.6-dev python2.7-dev python3.1-dev python3.2-dev python3.3-dev rubygems1.8 ruby1.8-dev ruby1.9.1-dev - sudo apt-get install -qqyf libxml2-dev libpcre3-dev libcap2-dev - sudo apt-get install -qqyf curl diff --git a/ChangeLog b/ChangeLog index 4ff148053d..4222d37f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ *** current *** + * 1.5 + +- added --not-alarm-log +- support for TCP_FASTOPEN (Linux-only) +- improved emperor reloading +- added --get +- Legion subsystem +- emperor_zeromq plugin +- SNI support +- distributed SSL session cache + +*** november 2012 *** + * 1.4 - gevent improvements diff --git a/buildconf/travis.ini b/buildconf/travis.ini new file mode 100644 index 0000000000..95b39e22f3 --- /dev/null +++ b/buildconf/travis.ini @@ -0,0 +1,3 @@ +[uwsgi] +main_plugin = +inherit = base diff --git a/core/alarm.c b/core/alarm.c index 0fba913e7a..3df689ff12 100644 --- a/core/alarm.c +++ b/core/alarm.c @@ -136,7 +136,7 @@ static struct uwsgi_alarm_instance *uwsgi_alarm_get_instance(char *name) { } -static int uwsgi_alarm_log_add(char *alarms, char *regexp) { +static int uwsgi_alarm_log_add(char *alarms, char *regexp, int negate) { struct uwsgi_alarm_log *old_ual = NULL, *ual = uwsgi.alarm_logs; while (ual) { @@ -148,6 +148,7 @@ static int uwsgi_alarm_log_add(char *alarms, char *regexp) { if (uwsgi_regexp_build(regexp, &ual->pattern, &ual->pattern_extra)) { return -1; } + ual->negate = negate; if (old_ual) { old_ual->next = ual; @@ -223,7 +224,7 @@ void uwsgi_alarms_init() { *space = 0; char *regexp = space + 1; // here the log-alarm is created - if (uwsgi_alarm_log_add(line, regexp)) { + if (uwsgi_alarm_log_add(line, regexp, usl->custom)) { uwsgi_log("invalid log-alarm: %s\n", usl->value); exit(1); } @@ -239,7 +240,12 @@ void uwsgi_alarm_log_check(char *msg, size_t len) { struct uwsgi_alarm_log *ual = uwsgi.alarm_logs; while (ual) { if (uwsgi_regexp_match(ual->pattern, ual->pattern_extra, msg, len) >= 0) { - uwsgi_alarm_log_run(ual, msg, len); + if (!ual->negate) { + uwsgi_alarm_log_run(ual, msg, len); + } + else { + break; + } } ual = ual->next; } diff --git a/core/buffer.c b/core/buffer.c index 03e2f56bdb..855283ac91 100644 --- a/core/buffer.c +++ b/core/buffer.c @@ -77,6 +77,41 @@ int uwsgi_buffer_append(struct uwsgi_buffer *ub, char *buf, size_t len) { return 0; } +int uwsgi_buffer_u16le(struct uwsgi_buffer *ub, uint16_t num) { + uint8_t buf[2]; + buf[0] = (uint8_t) (num & 0xff); + buf[1] = (uint8_t) ((num >> 8) & 0xff); + return uwsgi_buffer_append(ub, (char *) buf, 2); +} + +int uwsgi_buffer_num64(struct uwsgi_buffer *ub, int64_t num) { + char buf[sizeof(UMAX64_STR)+1]; + int ret = snprintf(buf, sizeof(UMAX64_STR)+1, "%lld", (long long) num); + if (ret <= 0 || ret > (int) (sizeof(UMAX64_STR)+1)) { + return -1; + } + return uwsgi_buffer_append(ub, buf, ret); +} + +int uwsgi_buffer_append_keyval(struct uwsgi_buffer *ub, char *key, uint16_t keylen, char *val, uint64_t vallen) { + if (uwsgi_buffer_u16le(ub, keylen)) return -1; + if (uwsgi_buffer_append(ub, key, keylen)) return -1; + if (uwsgi_buffer_u16le(ub, vallen)) return -1; + return uwsgi_buffer_append(ub, val, vallen); +} + +int uwsgi_buffer_append_keynum(struct uwsgi_buffer *ub, char *key, uint16_t keylen, int64_t num) { + char buf[sizeof(UMAX64_STR)+1]; + int ret = snprintf(buf, (sizeof(UMAX64_STR)+1), "%lld", (long long) num); + if (ret <= 0 || ret > (int) (sizeof(UMAX64_STR)+1)) { + return -1; + } + if (uwsgi_buffer_u16le(ub, keylen)) return -1; + if (uwsgi_buffer_append(ub, key, keylen)) return -1; + if (uwsgi_buffer_u16le(ub, ret)) return -1; + return uwsgi_buffer_append(ub, buf, ret); +} + void uwsgi_buffer_destroy(struct uwsgi_buffer *ub) { if (ub->buf) free(ub->buf); diff --git a/core/cache.c b/core/cache.c index 3eaf1d66ca..d8890cd41e 100644 --- a/core/cache.c +++ b/core/cache.c @@ -2,10 +2,9 @@ extern struct uwsgi_server uwsgi; -void uwsgi_init_cache() { +static void cache_send_udp_command(char *, uint16_t, char *, uint16_t, uint64_t, uint8_t); - if (!uwsgi.cache_blocksize) - uwsgi.cache_blocksize = UMAX16; +void uwsgi_init_cache() { uwsgi.cache_hashtable = (uint64_t *) mmap(NULL, sizeof(uint64_t) * UMAX16, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); if (!uwsgi.cache_hashtable) { @@ -86,6 +85,28 @@ void uwsgi_init_cache() { uwsgi.cache_lock = uwsgi_rwlock_init("cache"); uwsgi_log("*** Cache subsystem initialized: %lluMB (key: %llu bytes, keys: %llu bytes, data: %llu bytes) preallocated ***\n", (unsigned long long) ((uwsgi.cache_blocksize * uwsgi.cache_max_items) + (sizeof(struct uwsgi_cache_item) * uwsgi.cache_max_items)) / (1024 * 1024), (unsigned long long) sizeof(struct uwsgi_cache_item), (unsigned long long) (sizeof(struct uwsgi_cache_item) * uwsgi.cache_max_items), (unsigned long long) (uwsgi.cache_blocksize * uwsgi.cache_max_items)); + + struct uwsgi_string_list *usl = uwsgi.cache_udp_node; + while(usl) { + char *port = strchr(usl->value, ':'); + if (!port) { + uwsgi_log("[cache-udp-node] invalid udp address: %s\n", usl->value); + exit(1); + } + // no need to zero the memory, socket_to_in_addr will do that + struct sockaddr_in *sin = uwsgi_malloc(sizeof(struct sockaddr_in)); + usl->custom = socket_to_in_addr(usl->value, port, 0, sin); + usl->custom_ptr = sin; + uwsgi_log("added cache udp node %s\n", usl->value); + usl = usl->next; + } + + uwsgi.cache_udp_node_socket = socket(AF_INET, SOCK_DGRAM, 0); + if (uwsgi.cache_udp_node_socket < 0) { + uwsgi_error("[cache-udp-node] socket()"); + exit(1); + } + uwsgi_socket_nb(uwsgi.cache_udp_node_socket); } uint32_t djb33x_hash(char *key, int keylen) { @@ -132,7 +153,7 @@ static inline uint64_t uwsgi_cache_get_index(char *key, uint16_t keylen) { uci = &uwsgi.cache_items[slot]; rounds++; if (rounds > uwsgi.cache_max_items) { - uwsgi_log("ALARM !!! cache-loop (and potential deadlock) detected slot = %llu prev = %llu next = %llu\n", uci->next, slot, uci->prev, uci->next); + uwsgi_log("ALARM !!! cache-loop (and potential deadlock) detected slot = %lu prev = %lu next = %lu\n", slot, uci->prev, uci->next); // terrible case: the whole uWSGI stack can deadlock, leaving only the master alive // if the master is avalable, trigger a brutal reload if (uwsgi.master_process) { @@ -168,13 +189,16 @@ char *uwsgi_cache_get(char *key, uint16_t keylen, uint64_t * valsize) { return NULL; *valsize = uwsgi.cache_items[index].valsize; uwsgi.cache_items[index].hits++; + ushared->cache_hits++; return uwsgi.cache + (index * uwsgi.cache_blocksize); } + ushared->cache_miss++; + return NULL; } -int uwsgi_cache_del(char *key, uint16_t keylen, uint64_t index) { +int uwsgi_cache_del(char *key, uint16_t keylen, uint64_t index, uint16_t flags) { struct uwsgi_cache_item *uci; int ret = -1; @@ -216,8 +240,14 @@ int uwsgi_cache_del(char *key, uint16_t keylen, uint64_t index) { uci->prev = 0; uci->next = 0; uci->expires = 0; + + ushared->cache_items--; } + if (uwsgi.cache_udp_node && ret == 0 && !(flags & UWSGI_CACHE_FLAG_LOCAL)) { + cache_send_udp_command(key, keylen, NULL, 0, 0, 11); + } + return ret; } @@ -258,6 +288,7 @@ int uwsgi_cache_set(char *key, uint16_t keylen, char *val, uint64_t vallen, uint if (uwsgi.shared->cache_first_available_item >= uwsgi.cache_max_items && !uwsgi.shared->cache_unused_stack_ptr) { uwsgi_log("*** DANGER cache is FULL !!! ***\n"); + ushared->cache_full++; goto end; } @@ -276,7 +307,7 @@ int uwsgi_cache_set(char *key, uint16_t keylen, char *val, uint64_t vallen, uint } } uci = &uwsgi.cache_items[index]; - if (expires) + if (expires && !(flags & UWSGI_CACHE_FLAG_ABSEXPIRE)) expires += uwsgi_now(); uci->expires = expires; uci->djbhash = djb33x_hash(key, keylen); @@ -311,10 +342,12 @@ int uwsgi_cache_set(char *key, uint16_t keylen, char *val, uint64_t vallen, uint ucii->next = index; uci->prev = last_index; } + + ushared->cache_items++ ; } else if (flags & UWSGI_CACHE_FLAG_UPDATE) { uci = &uwsgi.cache_items[index]; - if (expires) { + if (expires && !(flags & UWSGI_CACHE_FLAG_ABSEXPIRE)) { expires += uwsgi_now(); uci->expires = expires; } @@ -322,12 +355,90 @@ int uwsgi_cache_set(char *key, uint16_t keylen, char *val, uint64_t vallen, uint uci->valsize = vallen; ret = 0; } + + if (uwsgi.cache_udp_node && ret == 0 && !(flags & UWSGI_CACHE_FLAG_LOCAL)) { + cache_send_udp_command(key, keylen, val, vallen, expires, 10); + } + end: return ret; } + +static void cache_send_udp_command(char *key, uint16_t keylen, char *val, uint16_t vallen, uint64_t expires, uint8_t cmd) { + + struct uwsgi_header uh; + uint8_t u_k[2]; + uint8_t u_v[2]; + uint8_t u_e[2]; + uint16_t vallen16 = vallen; + struct iovec iov[7]; + struct msghdr mh; + + memset(&mh, 0, sizeof(struct msghdr)); + mh.msg_iov = iov; + mh.msg_iovlen = 3; + + if (cmd == 10) { + mh.msg_iovlen = 7; + } + + iov[0].iov_base = &uh; + iov[0].iov_len = 4; + + u_k[0] = (uint8_t) (keylen & 0xff); + u_k[1] = (uint8_t) ((keylen >> 8) & 0xff); + + iov[1].iov_base = u_k; + iov[1].iov_len = 2; + + iov[2].iov_base = key; + iov[2].iov_len = keylen; + + uh.pktsize = 2 + keylen; + + if (cmd == 10) { + u_v[0] = (uint8_t) (vallen16 & 0xff); + u_v[1] = (uint8_t) ((vallen16 >> 8) & 0xff); + + iov[3].iov_base = u_v; + iov[3].iov_len = 2; + + iov[4].iov_base = val; + iov[4].iov_len = vallen16; + + char es[sizeof(UMAX64_STR) + 1]; + uint16_t es_size = uwsgi_long2str2n(expires, es, sizeof(UMAX64_STR)); + + u_e[0] = (uint8_t) (es_size & 0xff); + u_e[1] = (uint8_t) ((es_size >> 8) & 0xff); + + iov[5].iov_base = u_e; + iov[5].iov_len = 2; + + iov[6].iov_base = es; + iov[6].iov_len = es_size; + + uh.pktsize += 2 + vallen16 + 2 + es_size; + } + + uh.modifier1 = 111; + uh.modifier2 = cmd; + + struct uwsgi_string_list *usl = uwsgi.cache_udp_node; + while(usl) { + mh.msg_name = usl->custom_ptr; + mh.msg_namelen = usl->custom; + if (sendmsg(uwsgi.cache_udp_node_socket, &mh, 0) <= 0) { + uwsgi_error("[cache-udp-node] sendmsg()"); + } + usl = usl->next; + } + +} + /* THIS PART IS HEAVILY OPTIMIZED: PERFORMANCE NOT ELEGANCE !!! */ void *cache_thread_loop(void *fd_ptr) { @@ -470,3 +581,114 @@ void uwsgi_cache_rlock() { void uwsgi_cache_rwunlock() { uwsgi.lock_ops.rwunlock(uwsgi.cache_lock); } + +void *cache_udp_server_loop(void *noarg) { + // block all signals + sigset_t smask; + sigfillset(&smask); + pthread_sigmask(SIG_BLOCK, &smask, NULL); + + int queue = event_queue_init(); + struct uwsgi_string_list *usl = uwsgi.cache_udp_server; + while(usl) { + if (strchr(usl->value, ':')) { + int fd = bind_to_udp(usl->value, 0, 0); + if (fd < 0) { + uwsgi_log("[cache-udp-server] cannot bind to %s\n", usl->value); + exit(1); + } + uwsgi_socket_nb(fd); + event_queue_add_fd_read(queue, fd); + uwsgi_log("*** cache udp server running on %s ***\n", usl->value); + } + usl = usl->next; + } + + // allocate 64k chunk to receive messages + char *buf = uwsgi_malloc(UMAX16); + + for(;;) { + uint16_t pktsize = 0, ss = 0; + int interesting_fd = -1; + int rlen = event_queue_wait(queue, -1, &interesting_fd); + if (rlen <= 0) continue; + if (interesting_fd < 0) continue; + ssize_t len = read(interesting_fd, buf, UMAX16); + if (len <= 7) { + uwsgi_error("[cache-udp-server] read()"); + } + if (buf[0] != 111) continue; + memcpy(&pktsize, buf+1, 2); + if (pktsize != len-4) continue; + + memcpy(&ss, buf + 4, 2); + if (4+ss > pktsize) continue; + uint16_t keylen = ss; + char *key = buf + 6; + + // cache set/update + if (buf[3] == 10) { + if (keylen + 2 + 2 > pktsize) continue; + memcpy(&ss, buf + 6 + keylen, 2); + if (4+keylen+ss > pktsize) continue; + uint16_t vallen = ss; + char *val = buf + 8 + keylen; + uint64_t expires = 0; + if (2 + keylen + 2 + vallen + 2 < pktsize) { + memcpy(&ss, buf + 8 + keylen + vallen , 2); + if (6+keylen+vallen+ss > pktsize) continue; + expires = uwsgi_str_num(buf + 10 + keylen+vallen, ss); + } + uwsgi_wlock(uwsgi.cache_lock); + if (uwsgi_cache_set(key, keylen, val, vallen, expires, UWSGI_CACHE_FLAG_UPDATE|UWSGI_CACHE_FLAG_LOCAL|UWSGI_CACHE_FLAG_ABSEXPIRE)) { + uwsgi_log("[cache-udp-server] unable to update cache\n"); + } + uwsgi_rwunlock(uwsgi.cache_lock); + } + // cache del + else if (buf[3] == 11) { + uwsgi_wlock(uwsgi.cache_lock); + if (uwsgi_cache_del(key, keylen, 0, UWSGI_CACHE_FLAG_LOCAL)) { + uwsgi_log("[cache-udp-server] unable to update cache\n"); + } + uwsgi_rwunlock(uwsgi.cache_lock); + } + } + + return NULL; +} + +void *cache_sweeper_loop(void *noarg) { + + int i; + // block all signals + sigset_t smask; + sigfillset(&smask); + pthread_sigmask(SIG_BLOCK, &smask, NULL); + + if (!uwsgi.cache_expire_freq) + uwsgi.cache_expire_freq = 3; + + // remove expired cache items TODO use rb_tree timeouts + for (;;) { + sleep(uwsgi.cache_expire_freq); + uint64_t freed_items = 0; + // skip the first slot + for (i = 1; i < (int) uwsgi.cache_max_items; i++) { + uwsgi_wlock(uwsgi.cache_lock); + if (uwsgi.cache_items[i].expires) { + if (uwsgi.cache_items[i].expires < (uint64_t) uwsgi.current_time) { + uwsgi_cache_del(NULL, 0, i, UWSGI_CACHE_FLAG_LOCAL); + freed_items++; + } + } + uwsgi_rwunlock(uwsgi.cache_lock); + } + if (uwsgi.cache_report_freed_items && freed_items > 0) { + uwsgi_log("freed %llu cache items\n", (unsigned long long) freed_items); + } + }; + + return NULL; +} + diff --git a/core/daemons.c b/core/daemons.c index 37cacb5736..a8796d6766 100644 --- a/core/daemons.c +++ b/core/daemons.c @@ -30,6 +30,16 @@ extern struct uwsgi_server uwsgi; */ void uwsgi_daemons_smart_check() { + static time_t last_run = 0; + + time_t now = uwsgi_now(); + + if (now - last_run <= 0) { + return; + } + + last_run = now; + struct uwsgi_daemon *ud = uwsgi.daemons; while (ud) { if (ud->pidfile) { @@ -41,14 +51,14 @@ void uwsgi_daemons_smart_check() { } else { ud->pidfile_checks++; - if (ud->pidfile_checks >= (uint64_t) ud->freq) { + if (ud->pidfile_checks >= (unsigned int) ud->freq) { uwsgi_log("[uwsgi-daemons] found changed pidfile for \"%s\" (old_pid: %d new_pid: %d)\n", ud->command, (int) ud->pid, (int) checked_pid); uwsgi_spawn_daemon(ud); } } } else if (checked_pid != ud->pid) { - uwsgi_log("[uwsgi-daemons] found changed pidfile for \"%s\" (old_pid: %d new_pid: %d)\n", ud->command, (int) ud->pid, (int) checked_pid); + uwsgi_log("[uwsgi-daemons] found changed pid for \"%s\" (old_pid: %d new_pid: %d)\n", ud->command, (int) ud->pid, (int) checked_pid); ud->pid = checked_pid; } // all ok, pidfile and process found @@ -183,6 +193,7 @@ void uwsgi_spawn_daemon(struct uwsgi_daemon *ud) { else { // close uwsgi sockets uwsgi_close_all_sockets(); + uwsgi_close_all_fds(); if (ud->daemonize) { /* refork... */ @@ -204,7 +215,7 @@ void uwsgi_spawn_daemon(struct uwsgi_daemon *ud) { exit(1); } if (devnull != 0) { - if (dup2(devnull, 0)) { + if (dup2(devnull, 0) < 0) { uwsgi_error("dup2()"); exit(1); } diff --git a/core/emperor.c b/core/emperor.c index e4e1917553..db72e049c3 100644 --- a/core/emperor.c +++ b/core/emperor.c @@ -325,7 +325,7 @@ static void emperor_stats() { while (c_ui) { - uwsgi_log("vassal instance %s (last modified %d) status %d loyal %d zerg %d\n", c_ui->name, c_ui->last_mod, c_ui->status, c_ui->loyal, c_ui->zerg); + uwsgi_log("vassal instance %s (last modified %lld) status %d loyal %d zerg %d\n", c_ui->name, (long long) c_ui->last_mod, c_ui->status, c_ui->loyal, c_ui->zerg); c_ui = c_ui->ui_next; } @@ -417,18 +417,29 @@ void emperor_stop(struct uwsgi_instance *c_ui) { void emperor_respawn(struct uwsgi_instance *c_ui, time_t mod) { + struct uwsgi_header uh; + // reload the uWSGI instance + if (write(c_ui->pipe[0], "\1", 1) != 1) { + uwsgi_error("write()"); + } + + // push the config to the config pipe (if needed) if (c_ui->use_config) { - if (write(c_ui->pipe[0], "\0", 1) != 1) { - uwsgi_error("write()"); + uh.modifier1 = 115; + uh.pktsize = c_ui->config_len; + uh.modifier2 = 0; + if (write(c_ui->pipe_config[0], &uh, 4) != 4) { + uwsgi_error("[uwsgi-emperor] write() header config"); } - } - else { - if (write(c_ui->pipe[0], "\1", 1) != 1) { - uwsgi_error("write()"); + else { + if (write(c_ui->pipe_config[0], c_ui->config, c_ui->config_len) != (long) c_ui->config_len) { + uwsgi_error("[uwsgi-emperor] write() config"); + } } } + c_ui->respawns++; c_ui->last_mod = mod; c_ui->last_run = uwsgi_now(); @@ -454,7 +465,7 @@ void emperor_add(struct uwsgi_emperor_scanner *ues, char *name, time_t born, cha #endif if (strlen(name) > (0xff - 1)) { - uwsgi_log("[emperor] invalid vassal name\n", name); + uwsgi_log("[emperor] invalid vassal name: %s\n", name); return; } @@ -565,10 +576,19 @@ void emperor_add(struct uwsgi_emperor_scanner *ues, char *name, time_t born, cha } if (n_ui->use_config) { - if (write(n_ui->pipe_config[0], n_ui->config, n_ui->config_len) <= 0) { - uwsgi_error("write()"); - } - close(n_ui->pipe_config[0]); + struct uwsgi_header uh; + uh.modifier1 = 115; + uh.pktsize = n_ui->config_len; + uh.modifier2 = 0; + if (write(n_ui->pipe_config[0], &uh, 4) != 4) { + uwsgi_error("[uwsgi-emperor] write() header config"); + } + else { + if (write(n_ui->pipe_config[0], n_ui->config, n_ui->config_len) != (long) n_ui->config_len) { + uwsgi_error("[uwsgi-emperor] write() config"); + } + } + } return; } @@ -709,7 +729,7 @@ void emperor_add(struct uwsgi_emperor_scanner *ues, char *name, time_t born, cha exit(1); } if (stdin_fd != 0) { - if (dup2(stdin_fd, 0)) { + if (dup2(stdin_fd, 0) < 0) { uwsgi_error("dup2()"); exit(1); } @@ -784,6 +804,8 @@ void uwsgi_imperial_monitor_directory_init(struct uwsgi_emperor_scanner *ues) { exit(1); } + ues->arg = uwsgi.emperor_absolute_dir; + } struct uwsgi_imperial_monitor *imperial_monitor_get_by_id(char *scheme) { @@ -988,9 +1010,9 @@ void emperor_loop() { } // check if a monitor is mapped to that file descriptor - if (uwsgi_emperor_scanner_event(interesting_fd)) + if (uwsgi_emperor_scanner_event(interesting_fd)) { continue; - + } ui_current = emperor_get_by_fd(interesting_fd); if (ui_current) { @@ -998,9 +1020,7 @@ void emperor_loop() { ssize_t rlen = read(interesting_fd, &byte, 1); if (rlen <= 0) { // SAFE - if (!ui_current->config_len) { - emperor_del(ui_current); - } + emperor_del(ui_current); } else { if (byte == 17) { @@ -1380,16 +1400,25 @@ void uwsgi_emperor_simple_do(struct uwsgi_emperor_scanner *ues, char *name, char } // check if mtime is changed and the uWSGI instance must be reloaded if (ts > ui_current->last_mod) { - // make a new config (free the old one) - free(ui_current->config); - ui_current->config = config; - ui_current->config_len = strlen(config); - // always respawn (no need for amqp-style rules) + // make a new config (free the old one) if needed + if (config) { + if (ui_current->config) + free(ui_current->config); + ui_current->config = uwsgi_str(config); + ui_current->config_len = strlen(ui_current->config); + } + // reload the instance emperor_respawn(ui_current, ts); } } else { // make a copy of the config as it will be freed - emperor_add(ues, name, ts, uwsgi_str(config), strlen((const char *) config), uid, gid); + char *new_config = NULL; + size_t new_config_len = 0; + if (config) { + new_config = uwsgi_str(config); + new_config_len = strlen(new_config); + } + emperor_add(ues, name, ts, new_config, new_config_len, uid, gid); } } diff --git a/core/ini.c b/core/ini.c index 38e51d8cdf..d00aab356e 100644 --- a/core/ini.c +++ b/core/ini.c @@ -109,7 +109,7 @@ void uwsgi_ini_config(char *file, char *magic_table[]) { } if (file[0] != 0) { - uwsgi_log("[uWSGI] getting INI configuration from %s\n", file); + uwsgi_log_initial("[uWSGI] getting INI configuration from %s\n", file); } ini = uwsgi_open_and_read(file, &len, 1, magic_table); diff --git a/core/init.c b/core/init.c index fa56949acc..dce57273d6 100644 --- a/core/init.c +++ b/core/init.c @@ -14,6 +14,7 @@ void uwsgi_init_default() { uwsgi.signal_socket = -1; uwsgi.my_signal_socket = -1; uwsgi.cache_server_fd = -1; + uwsgi.cache_blocksize = UMAX16; uwsgi.stats_fd = -1; uwsgi.stats_pusher_default_freq = 3; @@ -76,6 +77,7 @@ void uwsgi_init_default() { #ifdef UWSGI_SSL // 1 day of tolerance uwsgi.subscriptions_sign_check_tolerance = 3600 * 24; + uwsgi.ssl_sessions_timeout = 300; #endif #ifdef UWSGI_ALARM @@ -85,6 +87,7 @@ void uwsgi_init_default() { #ifdef UWSGI_MULTICAST uwsgi.multicast_ttl = 1; + uwsgi.multicast_loop = 1; #endif } @@ -262,7 +265,7 @@ void uwsgi_setup_workers() { } total_memory *= (uwsgi.numproc + uwsgi.master_process); - uwsgi_log("mapped %llu bytes (%llu KB) for %d cores\n", total_memory, total_memory / 1024, uwsgi.cores * uwsgi.numproc); + uwsgi_log("mapped %lu bytes (%lu KB) for %d cores\n", total_memory, total_memory / 1024, uwsgi.cores * uwsgi.numproc); } diff --git a/core/json.c b/core/json.c index 4a33c6e07f..cd8916e950 100644 --- a/core/json.c +++ b/core/json.c @@ -45,7 +45,7 @@ void uwsgi_json_config(char *file, char *magic_table[]) { } } - uwsgi_log("[uWSGI] getting JSON configuration from %s\n", file); + uwsgi_log_initial("[uWSGI] getting JSON configuration from %s\n", file); json_data = uwsgi_open_and_read(file, &len, 1, magic_table); diff --git a/core/legion.c b/core/legion.c new file mode 100644 index 0000000000..ddd0c4a129 --- /dev/null +++ b/core/legion.c @@ -0,0 +1,604 @@ +#include "../uwsgi.h" + +extern struct uwsgi_server uwsgi; +/* + + uWSGI Legions subsystem + + A Legion is a group of uWSGI instances sharing a single object. This single + object can be owned only by the instance with the higher valor. Such an instance is the + Lord of the Legion. There can only be one (and only one) Lord for each Legion. + If a member of a Legion spawns with an higher valor than the current Lord, it became the new Lord. + + If two (or more) member of a legion have the same valor, an error condition will be triggered (TODO fallback to something more useful) + + { "legion": "legion1", "valor": "100", "unix": "1354533245", "lord": "1354533245", "name": "foobar" } + + Legions options (the legion1 is formed by 4 nodes, only one node will get the ip address, this is an ip takeover implementation) + + // became a member of a legion (each legion uses a shared secret) + legion = legion1 192.168.0.1:4001 100 algo:mysecret + // the other members of the legion + legion-node = legion1 192.168.0.2:4001 + legion-node = legion1 192.168.0.3:4001 + legion-node = legion1 192.168.0.4:4001 + + legion-lord = legion1 iptakeover:action=up,addr=192.168.0.100 + legion-unlord = legion1 iptakeover:action=down,addr=192.168.0.100 + + legion-lord = legion1 cmd:foobar.sh up + legion-unlord = legion1 cmd:foobar.sh down + + TODO + some option could benefit from the legions subsystem, expecially in clustered environments + Cron-tasks for example could be run only by the lord and so on... + + + +*/ + +struct uwsgi_legion *uwsgi_legion_get_by_socket(int fd) { + struct uwsgi_legion *ul = uwsgi.legions; + while(ul) { + if (ul->socket == fd) { + return ul; + } + ul = ul->next; + } + + return NULL; +} + +struct uwsgi_legion *uwsgi_legion_get_by_name(char *name) { + struct uwsgi_legion *ul = uwsgi.legions; + while(ul) { + if (!strcmp(name, ul->legion)) { + return ul; + } + ul = ul->next; + } + + return NULL; +} + + +void uwsgi_parse_legion(char *key, uint16_t keylen, char *value, uint16_t vallen, void *data) { + struct uwsgi_legion *ul = (struct uwsgi_legion *) data; + + if (!uwsgi_strncmp(key, keylen, "legion", 6)) { + ul->legion = value; + ul->legion_len = vallen; + } + else if (!uwsgi_strncmp(key, keylen, "valor", 5)) { + ul->valor = uwsgi_str_num(value, vallen); + } + else if (!uwsgi_strncmp(key, keylen, "name", 4)) { + ul->name = value; + ul->name_len = vallen; + } + else if (!uwsgi_strncmp(key, keylen, "pid", 3)) { + ul->pid = uwsgi_str_num(value, vallen); + } +} + +static void legions_check_lord() { + + struct uwsgi_legion *legion = uwsgi.legions; + while(legion) { + time_t now = uwsgi_now(); + + if (!legion->last_seen_lord) { + legion->last_seen_lord = now; + } + + if (legion->lord) { + goto next; + } + + if (now - legion->last_seen_lord > uwsgi.legion_tolerance) { + uwsgi_log("[uwsgi-legion] i am now the Lord of the Legion %s\n", legion->legion); + // triggering lord hooks + struct uwsgi_string_list *usl = legion->lord_hooks; + while(usl) { + int ret = uwsgi_legion_action_call("lord", legion, usl); + if (ret) { + uwsgi_log("[uwsgi-legion] ERROR, lord hook returned: %d\n", ret); + } + usl = usl->next; + } + legion->lord = now; + } + +next: + legion = legion->next; + } +} + + +static void *legion_loop(void *foobar) { + + time_t last_round = uwsgi_now(); + + unsigned char *crypted_buf = uwsgi_malloc(UMAX16-EVP_MAX_BLOCK_LENGTH-4); + unsigned char *clear_buf = uwsgi_malloc(UMAX16); + + struct uwsgi_legion legion_msg; + + if (!uwsgi.legion_freq) uwsgi.legion_freq = 3; + if (!uwsgi.legion_tolerance) uwsgi.legion_tolerance = 15; + + for(;;) { + int timeout = uwsgi.legion_freq; + time_t now = uwsgi_now(); + if (now > last_round) { + timeout -= (now - last_round); + if (timeout < 0) { + timeout = 0; + } + } + last_round = now; + // wait for event + int interesting_fd = -1; + int rlen = event_queue_wait(uwsgi.legion_queue, timeout, &interesting_fd); + + now = uwsgi_now(); + if (timeout == 0 || rlen == 0 || (now - last_round) >= timeout) { + struct uwsgi_legion *legions = uwsgi.legions; + while(legions) { + uwsgi_legion_announce(legions); + legions = legions->next; + } + last_round = now; + } + + legions_check_lord(); + + if (rlen > 0) { + struct uwsgi_legion *ul = uwsgi_legion_get_by_socket(interesting_fd); + if (!ul) continue; + // ensure the first 4 bytes are valid + ssize_t len = read(ul->socket, crypted_buf, (UMAX16-EVP_MAX_BLOCK_LENGTH-4)); + if (len < 0) { + uwsgi_error("[uwsgi-legion] read()"); + continue; + } + else if (len < 4) { + uwsgi_log("[uwsgi-legion] invalid packet size: %d\n", (int) len); + continue; + } + + struct uwsgi_header *uh = (struct uwsgi_header *) crypted_buf; + + if (uh->modifier1 != 109) { + uwsgi_log("[uwsgi-legion] invalid modifier1"); + continue; + } + + int d_len = 0; + int d2_len = 0; + // decrypt packet using the secret + if (EVP_DecryptInit_ex(ul->decrypt_ctx, NULL, NULL, NULL, NULL) <= 0) { + uwsgi_error("[uwsgi-legion] EVP_DecryptInit_ex()"); + continue; + } + + if (EVP_DecryptUpdate(ul->decrypt_ctx, clear_buf, &d_len, crypted_buf+4, len-4) <= 0) { + uwsgi_error("[uwsgi-legion] EVP_DecryptUpdate()"); + continue; + } + + if (EVP_DecryptFinal_ex(ul->decrypt_ctx, clear_buf + d_len, &d2_len) <= 0) { + ERR_print_errors_fp(stderr); + uwsgi_log("[uwsgi-legion] EVP_DecryptFinal_ex()\n"); + continue; + } + + d_len += d2_len; + + if (d_len != uh->pktsize) { + uwsgi_log("[uwsgi-legion] invalid packet size\n"); + continue; + } + + // parse packet + memset(&legion_msg, 0, sizeof(struct uwsgi_legion)); + if (uwsgi_hooked_parse((char *)clear_buf, d_len, uwsgi_parse_legion, &legion_msg)) { + uwsgi_log("[uwsgi-legion] invalid packet\n"); + continue; + } + + if (uwsgi_strncmp(ul->legion, ul->legion_len, legion_msg.legion, legion_msg.legion_len)) { + uwsgi_log("[uwsgi-legion] invalid legion name\n"); + continue; + } + + // check for loop packets... (expecially when in multicast mode) + if (!uwsgi_strncmp(uwsgi.hostname, uwsgi.hostname_len, legion_msg.name, legion_msg.name_len)) { + if (legion_msg.pid == ul->pid) { + if (legion_msg.valor == ul->valor) { + continue; + } + } + } + + if (ul->lord > 0) { + if (legion_msg.valor > ul->valor) { + uwsgi_log("[uwsgi-legion] a new Lord (name: %.*s pid: %d) raised for Legion %s...\n", legion_msg.name_len, legion_msg.name, (int) legion_msg.pid, ul->legion); + // no more lord, trigger unlord hooks + struct uwsgi_string_list *usl = ul->unlord_hooks; + while(usl) { + int ret = uwsgi_legion_action_call("unlord", ul, usl); + if (ret) { + uwsgi_log("[uwsgi-legion] ERROR, unlord hook returned: %d\n", ret); + } + usl = usl->next; + } + ul->last_seen_lord = uwsgi_now(); + ul->lord = 0; + continue; + } + } + + if (legion_msg.valor > ul->valor) { + // a lord + ul->last_seen_lord = uwsgi_now(); + } + else if (legion_msg.valor == ul->valor) { + uwsgi_log("[uwsgi-legion] a node with the same valor announced itself !!!\n"); + } + } + } + + return NULL; +} + +int uwsgi_legion_action_call(char *phase, struct uwsgi_legion *ul, struct uwsgi_string_list *usl) { + struct uwsgi_legion_action *ula = uwsgi_legion_action_get(usl->custom_ptr); + if (!ula) { + uwsgi_log("[uwsgi-legion] ERROR unable to find legion_action \"%s\"\n", (char *) usl->custom_ptr); + return -1; + } + + uwsgi_log("[uwsgi-legion] (phase: %s legion: %s) calling %s\n", phase, ul->legion, usl->value); + return ula->func(ul, usl->value+usl->custom); +} + +static int legion_action_cmd(struct uwsgi_legion *ul, char *arg) { + return uwsgi_run_command_and_wait(NULL, arg); +} + +void uwsgi_start_legions() { + pthread_t legion_loop_t; + + if (!uwsgi.legions) return; + + // register embedded actions + uwsgi_legion_action_register("cmd", legion_action_cmd); + + uwsgi.legion_queue = event_queue_init(); + struct uwsgi_legion *legion = uwsgi.legions; + while(legion) { + char *colon = strchr(legion->addr, ':'); + if (colon) { + legion->socket = bind_to_udp(legion->addr, 0, 0); + } + else { + legion->socket = bind_to_unix_dgram(legion->addr); + } + if (legion->socket < 0 || event_queue_add_fd_read(uwsgi.legion_queue, legion->socket)) { + uwsgi_log("[uwsgi-legion] unable to activate legion %s\n", legion->legion); + exit(1); + } + uwsgi_socket_nb(legion->socket); + legion->pid = uwsgi.mypid; + struct uwsgi_string_list *usl = legion->setup_hooks; + while(usl) { + int ret = uwsgi_legion_action_call("setup", legion, usl); + if (ret) { + uwsgi_log("[uwsgi-legion] ERROR, setup hook returned: %d\n", ret); + } + usl = usl->next; + } + legion = legion->next; + } + + if (pthread_create(&legion_loop_t, NULL, legion_loop, NULL)) { + uwsgi_error("pthread_create()"); + uwsgi_log("unable to run the legion server !!!\n"); + } + else { + uwsgi_log("legion manager thread enabled\n"); + } + +} + +void uwsgi_legion_add(struct uwsgi_legion *ul) { + struct uwsgi_legion *old_legion=NULL,*legion = uwsgi.legions; + while(legion) { + old_legion = legion; + legion = legion->next; + } + + if (old_legion) { + old_legion->next = ul; + } + else { + uwsgi.legions = ul; + } +} + +int uwsgi_legion_announce(struct uwsgi_legion *ul) { + struct uwsgi_buffer *ub = uwsgi_buffer_new(4096); + + if (uwsgi_buffer_append_keyval(ub, "legion", 6, ul->legion, ul->legion_len)) goto err; + if (uwsgi_buffer_append_keynum(ub, "valor", 5, ul->valor)) goto err; + if (uwsgi_buffer_append_keynum(ub, "unix", 4, uwsgi_now())) goto err; + if (uwsgi_buffer_append_keynum(ub, "lord", 4, ul->lord ? ul->lord : 0)) goto err; + if (uwsgi_buffer_append_keyval(ub, "name", 4, uwsgi.hostname, uwsgi.hostname_len)) goto err; + if (uwsgi_buffer_append_keynum(ub, "pid", 3, ul->pid)) goto err; + + unsigned char *encrypted = uwsgi_malloc(ub->pos + 4 + EVP_MAX_BLOCK_LENGTH); + if (EVP_EncryptInit_ex(ul->encrypt_ctx, NULL, NULL, NULL, NULL) <= 0) { + uwsgi_error("[uwsgi-legion] EVP_EncryptInit_ex()"); + goto err; + } + + int e_len = 0; + + if (EVP_EncryptUpdate(ul->encrypt_ctx, encrypted+4, &e_len, (unsigned char *)ub->buf, ub->pos) <= 0) { + uwsgi_error("[uwsgi-legion] EVP_EncryptUpdate()"); + goto err; + } + + int tmplen = 0; + if (EVP_EncryptFinal_ex(ul->encrypt_ctx, encrypted+4+e_len, &tmplen) <= 0) { + uwsgi_error("[uwsgi-legion] EVP_EncryptFinal_ex()"); + goto err; + } + + e_len += tmplen; + uint16_t pktsize = ub->pos; + encrypted[0] = 109; + encrypted[1] = (unsigned char) (pktsize & 0xff); + encrypted[2] = (unsigned char) ((pktsize >> 8) & 0xff); + encrypted[3] = 0; + + struct uwsgi_string_list *usl = ul->nodes; + while(usl) { + if (sendto(ul->socket, encrypted, e_len + 4, 0, usl->custom_ptr, usl->custom) != e_len + 4) { + uwsgi_error("[uwsgi-legion] sendto()"); + } + usl = usl->next; + } + + uwsgi_buffer_destroy(ub); + free(encrypted); + return 0; +err: + uwsgi_buffer_destroy(ub); + return -1; +} + +void uwsgi_opt_legion_node(char *opt, char *value, void *foobar) { + + char *legion = uwsgi_str(value); + + char *space = strchr(legion, ' '); + if (!space) { + uwsgi_log("invalid legion-node syntax, must be \n"); + exit(1); + } + *space = 0; + + struct uwsgi_legion *ul = uwsgi_legion_get_by_name(legion); + if (!ul) { + uwsgi_log("unknown legion: %s\n", legion); + exit(1); + } + + struct uwsgi_string_list *usl = uwsgi_string_new_list(&ul->nodes, space+1); + char *port = strchr(usl->value, ':'); + if (!port) { + uwsgi_log("[uwsgi-legion] invalid udp address: %s\n", usl->value); + exit(1); + } + // no need to zero the memory, socket_to_in_addr will do that + struct sockaddr_in *sin = uwsgi_malloc(sizeof(struct sockaddr_in)); + usl->custom = socket_to_in_addr(usl->value, port, 0, sin); + usl->custom_ptr = sin; +} + +void uwsgi_opt_legion_hook(char *opt, char *value, void *foobar) { + + char *legion = uwsgi_str(value); + + char *space = strchr(legion, ' '); + if (!space) { + uwsgi_log("invalid %s syntax, must be \n", opt); + exit(1); + } + *space = 0; + + struct uwsgi_legion *ul = uwsgi_legion_get_by_name(legion); + if (!ul) { + uwsgi_log("unknown legion: %s\n", legion); + exit(1); + } + + struct uwsgi_string_list *usl = NULL; + + if (!strcmp(opt, "legion-lord")) { + usl = uwsgi_string_new_list(&ul->lord_hooks, space+1); + } + else if (!strcmp(opt, "legion-unlord")) { + usl = uwsgi_string_new_list(&ul->unlord_hooks, space+1); + } + else if (!strcmp(opt, "legion-setup")) { + usl = uwsgi_string_new_list(&ul->setup_hooks, space+1); + } + else if (!strcmp(opt, "legion-death")) { + usl = uwsgi_string_new_list(&ul->death_hooks, space+1); + } + + if (!usl) return; + + char *port = strchr(usl->value, ':'); + if (!port) { + uwsgi_log("[uwsgi-legion] invalid %s action: %s\n", opt, usl->value); + exit(1); + } + + // pointer to action plugin + usl->custom_ptr = uwsgi_concat2n(usl->value, port-usl->value, "", 0); + // add that to check the plugin value + usl->custom = port-usl->value+1; +} + + +void uwsgi_opt_legion(char *opt, char *value, void *foobar) { + + // legion addr valor algo:secret + char *legion = uwsgi_str(value); + char *space = strchr(legion, ' '); + if (!space) { + uwsgi_log("invalid legion syntax, must be \n"); + exit(1); + } + *space = 0; + char *addr = space+1; + + space = strchr(addr, ' '); + if (!space) { + uwsgi_log("invalid legion syntax, must be \n"); + exit(1); + } + *space = 0; + char *valor = space+1; + + space = strchr(valor, ' '); + if (!space) { + uwsgi_log("invalid legion syntax, must be \n"); + exit(1); + } + *space = 0; + char *algo_secret = space+1; + + char *colon = strchr(algo_secret, ':'); + if (!colon) { + uwsgi_log("invalid legion syntax, must be \n"); + exit(1); + } + *colon = 0; + char *secret = colon+1; + + if (!uwsgi.ssl_initialized) { + uwsgi_ssl_init(); + } + + EVP_CIPHER_CTX *ctx = uwsgi_malloc(sizeof(EVP_CIPHER_CTX)); + EVP_CIPHER_CTX_init(ctx); + + const EVP_CIPHER *cipher = EVP_get_cipherbyname(algo_secret); + if (!cipher) { + uwsgi_log("[uwsgi-legion] unable to find algorithm/cipher %s\n", algo_secret); + exit(1); + } + + int cipher_len = EVP_CIPHER_key_length(cipher); + size_t s_len = strlen(secret); + if ((unsigned int)cipher_len > s_len) { + char *secret_tmp = uwsgi_malloc(cipher_len); + memcpy(secret_tmp, secret, s_len); + memset(secret_tmp + s_len, 0, cipher_len - s_len); + secret = secret_tmp; + } + +/* + TODO find a wat to manage iv + char *iv = uwsgi_ssl_rand(strlen(secret)); + if (!iv) { + uwsgi_log("[uwsgi-legion] unable to generate iv for legion %s\n", legion); + exit(1); + } +*/ + + if (EVP_EncryptInit_ex(ctx, cipher, NULL, (const unsigned char *)secret, (const unsigned char *) "12345678") <= 0) {// (const unsigned char *) iv) <= 0) { + uwsgi_error("EVP_EncryptInit_ex()"); + exit(1); + } + + EVP_CIPHER_CTX *ctx2 = uwsgi_malloc(sizeof(EVP_CIPHER_CTX)); + EVP_CIPHER_CTX_init(ctx2); + + if (EVP_DecryptInit_ex(ctx2, cipher, NULL, (const unsigned char *)secret, (const unsigned char *) "12345678") <= 0) { + uwsgi_error("EVP_DecryptInit_ex()"); + exit(1); + } + + // we use shared memory, as we want to export legion status to the api + struct uwsgi_legion *ul = uwsgi_calloc_shared(sizeof(struct uwsgi_legion)); + ul->legion = legion; + ul->legion_len = strlen(ul->legion); + + ul->valor = strtol(valor, (char **) NULL, 10); + ul->addr = addr; + + ul->encrypt_ctx = ctx; + ul->decrypt_ctx = ctx2; + + uwsgi_legion_add(ul); +} + +struct uwsgi_legion_action *uwsgi_legion_action_get(char *name) { + struct uwsgi_legion_action *ula = uwsgi.legion_actions; + while(ula) { + if (!strcmp(name, ula->name)) { + return ula; + } + ula = ula->next; + } + return NULL; +} + +void uwsgi_legion_action_register(char *name, int (*func)(struct uwsgi_legion *, char *)) { + if (uwsgi_legion_action_get(name)) { + uwsgi_log("[uwsgi-legion] action \"%s\" is already registered !!!\n", name); + return; + } + + struct uwsgi_legion_action *old_ula = NULL,*ula = uwsgi.legion_actions; + while(ula) { + old_ula = ula; + ula = ula->next; + } + + ula = uwsgi_calloc(sizeof(struct uwsgi_legion_action)); + ula->name = name; + ula->func = func; + + if (old_ula) { + old_ula->next = ula; + } + else { + uwsgi.legion_actions = ula; + } +} + + +void uwsgi_legion_atexit(void) { + struct uwsgi_legion *legion = uwsgi.legions; + while(legion) { + if (getpid() != legion->pid) goto next; + struct uwsgi_string_list *usl = legion->death_hooks; + while(usl) { + int ret = uwsgi_legion_action_call("death", legion, usl); + if (ret) { + uwsgi_log("[uwsgi-legion] ERROR, death hook returned: %d\n", ret); + } + usl = usl->next; + } +next: + legion = legion->next; + } + +} diff --git a/core/master.c b/core/master.c index 14a480bba6..f0e1dc6bac 100644 --- a/core/master.c +++ b/core/master.c @@ -85,7 +85,7 @@ void uwsgi_master_manage_udp(int udp_fd) { // else a simple udp logger if (!udp_managed) { - uwsgi_log("[udp:%s:%d] %.*s", udp_client_addr, ntohs(udp_client.sin_port), rlen, uwsgi.wsgi_req->buffer); + uwsgi_log("[udp:%s:%d] %.*s", udp_client_addr, ntohs(udp_client.sin_port), (int) rlen, uwsgi.wsgi_req->buffer); } } } @@ -352,40 +352,6 @@ void *logger_thread_loop(void *noarg) { return NULL; } -void *cache_sweeper_loop(void *noarg) { - - int i; - // block all signals - sigset_t smask; - sigfillset(&smask); - pthread_sigmask(SIG_BLOCK, &smask, NULL); - - if (!uwsgi.cache_expire_freq) - uwsgi.cache_expire_freq = 3; - - // remove expired cache items TODO use rb_tree timeouts - for (;;) { - sleep(uwsgi.cache_expire_freq); - uint64_t freed_items = 0; - // skip the first slot - for (i = 1; i < (int) uwsgi.cache_max_items; i++) { - uwsgi_wlock(uwsgi.cache_lock); - if (uwsgi.cache_items[i].expires) { - if (uwsgi.cache_items[i].expires < (uint64_t) uwsgi.current_time) { - uwsgi_cache_del(NULL, 0, i); - freed_items++; - } - } - uwsgi_rwunlock(uwsgi.cache_lock); - } - if (uwsgi.cache_report_freed_items && freed_items > 0) { - uwsgi_log("freed %llu cache items\n", (unsigned long long) freed_items); - } - }; - - return NULL; -} - void uwsgi_subscribe(char *subscription, uint8_t cmd) { int subfile_size; @@ -602,6 +568,7 @@ int master_loop(char **argv, char **environ) { pthread_t logger_thread; pthread_t cache_sweeper; + pthread_t cache_udp_server; #ifdef UWSGI_UDP int udp_fd = -1; @@ -697,6 +664,10 @@ int master_loop(char **argv, char **environ) { #endif } +#ifdef UWSGI_SSL + uwsgi_start_legions(); +#endif + if (uwsgi.cache_max_items > 0 && !uwsgi.cache_no_expire) { if (pthread_create(&cache_sweeper, NULL, cache_sweeper_loop, NULL)) { uwsgi_error("pthread_create()"); @@ -707,6 +678,16 @@ int master_loop(char **argv, char **environ) { } } + if (uwsgi.cache_max_items > 0 && uwsgi.cache_udp_server) { + if (pthread_create(&cache_udp_server, NULL, cache_udp_server_loop, NULL)) { + uwsgi_error("pthread_create()"); + uwsgi_log("unable to run the cache udp server !!!\n"); + } + else { + uwsgi_log("cache udp server thread enabled\n"); + } + } + uwsgi.wsgi_req->buffer = uwsgi.workers[0].cores[0].buffer; @@ -1597,7 +1578,7 @@ int master_loop(char **argv, char **environ) { } // manage_next_request is zero, but killed by signal... else if (WIFSIGNALED(waitpid_status)) { - uwsgi_log("DAMN ! worker %d (pid: %d) MISTERIOUSLY killed by signal :( trying respawn ...\n", uwsgi.mywid, (int) diedpid, (int) WTERMSIG(waitpid_status)); + uwsgi_log("DAMN ! worker %d (pid: %d) MISTERIOUSLY killed by signal %d :( trying respawn ...\n", uwsgi.mywid, (int) diedpid, (int) WTERMSIG(waitpid_status)); } if (uwsgi.workers[uwsgi.mywid].cheaped == 1) { diff --git a/core/master_utils.c b/core/master_utils.c index 73009ea933..0159f62777 100644 --- a/core/master_utils.c +++ b/core/master_utils.c @@ -307,43 +307,44 @@ void uwsgi_reload(char **argv) { uwsgi_sock = uwsgi_sock->next; } + if (found) continue; - if (!found) { - if (uwsgi.has_emperor) { - if (i == uwsgi.emperor_fd) { - found = 1; - } + if (uwsgi.has_emperor) { + if (i == uwsgi.emperor_fd) { + continue; + } + + if (i == uwsgi.emperor_fd_config) { + continue; } } if (uwsgi.log_master) { if (uwsgi.original_log_fd > -1) { if (i == uwsgi.original_log_fd) { - found = 1; + continue; } } if (uwsgi.shared->worker_log_pipe[0] > -1) { if (i == uwsgi.shared->worker_log_pipe[0]) { - found = 1; + continue; } } if (uwsgi.shared->worker_log_pipe[1] > -1) { if (i == uwsgi.shared->worker_log_pipe[1]) { - found = 1; + continue; } } } - if (!found) { #ifdef __APPLE__ - fcntl(i, F_SETFD, FD_CLOEXEC); + fcntl(i, F_SETFD, FD_CLOEXEC); #else - close(i); + close(i); #endif - } } #ifdef UWSGI_AS_SHARED_LIBRARY @@ -861,6 +862,38 @@ struct uwsgi_stats *uwsgi_master_generate_stats() { if (uwsgi_stats_comma(us)) goto end; + if (uwsgi.cache_max_items > 0) { + if (uwsgi_stats_key(us, "cache")) + goto end; + + if (uwsgi_stats_object_open(us)) + goto end; + + if (uwsgi_stats_keylong_comma(us, "max_items", (unsigned long long) uwsgi.cache_max_items)) + goto end; + + if (uwsgi_stats_keylong_comma(us, "blocksize", (unsigned long long) uwsgi.cache_blocksize)) + goto end; + + if (uwsgi_stats_keylong_comma(us, "items", (unsigned long long) ushared->cache_items)) + goto end; + + if (uwsgi_stats_keylong_comma(us, "hits", (unsigned long long) ushared->cache_hits)) + goto end; + + if (uwsgi_stats_keylong_comma(us, "miss", (unsigned long long) ushared->cache_miss)) + goto end; + + if (uwsgi_stats_keylong(us, "full", (unsigned long long) ushared->cache_full)) + goto end; + + if (uwsgi_stats_object_close(us)) + goto end; + + if (uwsgi_stats_comma(us)) + goto end; + } + if (uwsgi_stats_key(us, "sockets")) goto end; diff --git a/core/mule.c b/core/mule.c index 1a71708dd2..b003d88b4c 100644 --- a/core/mule.c +++ b/core/mule.c @@ -198,7 +198,7 @@ void uwsgi_mule_handler() { } } if (!found) - uwsgi_log("*** mule %d received a %d bytes message ***\n", uwsgi.muleid, len); + uwsgi_log("*** mule %d received a %ld bytes message ***\n", uwsgi.muleid, (long) len); } } } diff --git a/core/offload.c b/core/offload.c index bf2d3e769f..2bd4829443 100644 --- a/core/offload.c +++ b/core/offload.c @@ -331,7 +331,7 @@ static int uwsgi_offload_net_transfer(struct uwsgi_thread *ut, struct uwsgi_offl } } else if (fd == uor->s) { - rlen = read(uor->fd, uor->buf, 4096); + rlen = read(uor->s, uor->buf, 4096); if (rlen > 0) { uor->to_write = rlen; uor->pos = 0; diff --git a/core/plugins.c b/core/plugins.c index 14600750fe..8986e3f31a 100644 --- a/core/plugins.c +++ b/core/plugins.c @@ -76,8 +76,8 @@ void *uwsgi_load_plugin(int modifier, char *plugin, char *has_option) { char *plugin_filename = NULL; int need_free = 0; - char *plugin_name = plugin; - char *plugin_symbol_name_start = plugin; + char *plugin_name = uwsgi_strip(uwsgi_str(plugin)); + char *plugin_symbol_name_start = plugin_name; struct uwsgi_plugin *up; char linkpath_buf[1024], linkpath[1024]; diff --git a/core/protocol.c b/core/protocol.c index e16b59d09a..0bcc8a6617 100644 --- a/core/protocol.c +++ b/core/protocol.c @@ -784,7 +784,8 @@ int uwsgi_parse_vars(struct wsgi_request *wsgi_req) { wsgi_req->method = ptrbuf; wsgi_req->method_len = strsize; } - else if (!uwsgi.log_x_forwarded_for && !uwsgi_strncmp("REMOTE_ADDR", 11, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) { + else if ((!uwsgi.log_x_forwarded_for || uwsgi_strncmp("HTTP_X_FORWARDED_FOR", 20, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) + && !uwsgi_strncmp("REMOTE_ADDR", 11, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) { wsgi_req->remote_addr = ptrbuf; wsgi_req->remote_addr_len = strsize; } @@ -1375,7 +1376,7 @@ int uwsgi_hooked_parse_dict_dgram(int fd, char *buffer, size_t len, uint8_t modi #ifdef UWSGI_DEBUG - uwsgi_log("RLEN: %d\n", rlen); + uwsgi_log("RLEN: %ld\n", (long) rlen); #endif // check for valid dict 4(header) 2(non-zero key)+1 2(value) @@ -1414,7 +1415,7 @@ int uwsgi_hooked_parse_dict_dgram(int fd, char *buffer, size_t len, uint8_t modi #ifdef UWSGI_DEBUG - uwsgi_log("%p %p %d\n", ptrbuf, bufferend, bufferend - ptrbuf); + uwsgi_log("%p %p %ld\n", ptrbuf, bufferend, bufferend - ptrbuf); #endif uwsgi_hooked_parse(ptrbuf, bufferend - ptrbuf, hook, data); diff --git a/core/queue.c b/core/queue.c index 907574b2ef..ed36ae1f29 100644 --- a/core/queue.c +++ b/core/queue.c @@ -65,7 +65,7 @@ void uwsgi_init_queue() { uwsgi.queue_lock = uwsgi_rwlock_init("queue"); - uwsgi_log("*** Queue subsystem initialized: %dMB preallocated ***\n", (uwsgi.queue_blocksize * uwsgi.queue_size) / (1024 * 1024)); + uwsgi_log("*** Queue subsystem initialized: %luMB preallocated ***\n", (uwsgi.queue_blocksize * uwsgi.queue_size) / (1024 * 1024)); } char *uwsgi_queue_get(uint64_t index, uint64_t * size) { diff --git a/core/setup_utils.c b/core/setup_utils.c index 9b2f8516e1..cbdfa0c5ad 100644 --- a/core/setup_utils.c +++ b/core/setup_utils.c @@ -113,6 +113,8 @@ void uwsgi_setup_inherited_sockets() { if (uwsgi.has_emperor) { if (j == uwsgi.emperor_fd) continue; + if (j == uwsgi.emperor_fd_config) + continue; } if (uwsgi.shared->worker_log_pipe[0] > -1) { diff --git a/core/socket.c b/core/socket.c index de5c287d44..ef29402530 100644 --- a/core/socket.c +++ b/core/socket.c @@ -178,7 +178,6 @@ int bind_to_udp(char *socket_name, int multicast, int broadcast) { #ifdef UWSGI_MULTICAST struct ip_mreq mc; - uint8_t loop = 1; #endif udp_port = strchr(socket_name, ':'); @@ -262,7 +261,7 @@ int bind_to_udp(char *socket_name, int multicast, int broadcast) { #ifdef UWSGI_MULTICAST if (multicast) { uwsgi_log("[uWSGI] joining multicast group: %s:%d\n", socket_name, ntohs(uws_addr.sin_port)); - if (setsockopt(serverfd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop))) { + if (setsockopt(serverfd, IPPROTO_IP, IP_MULTICAST_LOOP, &uwsgi.multicast_loop, sizeof(uwsgi.multicast_loop))) { uwsgi_error("setsockopt()"); } @@ -586,6 +585,19 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) { #endif } + if (uwsgi.tcp_fast_open) { +#ifdef TCP_FASTOPEN + if (setsockopt(serverfd, SOL_TCP, TCP_FASTOPEN, (const void *) &uwsgi.tcp_fast_open, sizeof(int)) < 0) { + uwsgi_error("TCP_FASTOPEN setsockopt()"); + } + else { + uwsgi_log("TCP_FASTOPEN enabled on %s\n", socket_name); + } +#else + uwsgi_log("!!! your system does not support TCP_FASTOPEN !!!\n"); +#endif + } + if (uwsgi.so_send_timeout) { struct timeval tv; tv.tv_sec = uwsgi.so_send_timeout; @@ -632,7 +644,7 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) { #ifdef __linux__ long somaxconn = uwsgi_num_from_file("/proc/sys/net/core/somaxconn"); if (somaxconn > 0 && uwsgi.listen_queue > somaxconn) { - uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%i).\n", somaxconn); + uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%li).\n", somaxconn); uwsgi_nuclear_blast(); } #endif @@ -707,7 +719,16 @@ int timed_connect(struct pollfd *fdpoll, const struct sockaddr *addr, int addr_s } #endif - ret = connect(fdpoll->fd, addr, addr_size); +#ifdef MSG_FASTOPEN + if (addr->sa_family == AF_INET && uwsgi.tcp_fast_open_client) { + ret = sendto(fdpoll->fd, "", 0, MSG_FASTOPEN, addr, addr_size); + } + else { +#endif + ret = connect(fdpoll->fd, addr, addr_size); +#ifdef MSG_FASTOPEN + } +#endif if (async) { if (ret < 0 && errno != EINPROGRESS) { @@ -1611,7 +1632,7 @@ void uwsgi_map_sockets() { exit(1); } if (fd != uwsgi_sock->fd) { - if (dup2(fd, uwsgi_sock->fd)) { + if (dup2(fd, uwsgi_sock->fd) < 0) { uwsgi_error("dup2()"); exit(1); } @@ -1723,7 +1744,7 @@ void uwsgi_bind_sockets() { exit(1); } if (fd != 0) { - if (dup2(fd, 0)) { + if (dup2(fd, 0) < 0) { uwsgi_error("dup2()"); exit(1); } diff --git a/core/spooler.c b/core/spooler.c index 45cfeb02ee..d6a36f192b 100644 --- a/core/spooler.c +++ b/core/spooler.c @@ -245,7 +245,7 @@ int spool_request(struct uwsgi_spooler *uspool, char *filename, int rn, int core close(fd); if (!uwsgi.spooler_quiet) - uwsgi_log("[spooler] written %d bytes to file %s\n", size + body_len + 4, filename); + uwsgi_log("[spooler] written %lu bytes to file %s\n", (unsigned long) size + body_len + 4, filename); // and here waiting threads can continue uwsgi_unlock(uspool->lock); @@ -538,7 +538,7 @@ void spooler_manage_task(struct uwsgi_spooler *uspool, char *dir, char *task) { uspool->tasks++; if (ret == -2) { if (!uwsgi.spooler_quiet) - uwsgi_log("[spooler %s pid: %d] done with task %s after %d seconds\n", uspool->dir, (int) uwsgi.mypid, task, uwsgi_now() - now); + uwsgi_log("[spooler %s pid: %d] done with task %s after %lld seconds\n", uspool->dir, (int) uwsgi.mypid, task, (long long) uwsgi_now() - now); destroy_spool(dir, task); } // re-spool it diff --git a/core/ssl.c b/core/ssl.c new file mode 100644 index 0000000000..f480100ffc --- /dev/null +++ b/core/ssl.c @@ -0,0 +1,377 @@ +#include "../uwsgi.h" +#include + +extern struct uwsgi_server uwsgi; +/* + +ssl additional datas are retrieved via indexes. + +You can create an index with SSL_CTX_get_ex_new_index and +set data in it with SSL_CTX_set_ex_data + +*/ + +void uwsgi_ssl_init(void) { + OPENSSL_config(NULL); + SSL_library_init(); + SSL_load_error_strings(); + OpenSSL_add_all_algorithms(); + uwsgi.ssl_initialized = 1; +} + +void uwsgi_ssl_info_cb(SSL const *ssl, int where, int ret) { + if (where & SSL_CB_HANDSHAKE_DONE) { + if (ssl->s3) { + ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS; + } + } +} + +int uwsgi_ssl_verify_callback(int ok, X509_STORE_CTX * x509_store) { + return 1; +} + +int uwsgi_ssl_session_new_cb(SSL *ssl, SSL_SESSION *sess) { + char session_blob[4096]; + int len = i2d_SSL_SESSION(sess, NULL); + if (len > 4096) { + if (uwsgi.ssl_verbose) { + uwsgi_log("[uwsgi-ssl] unable to store session of size %d\n", len); + } + return 0; + } + + unsigned char *p = (unsigned char *) session_blob; + i2d_SSL_SESSION(sess, &p); + + // ok let's write the value to the cache + uwsgi_wlock(uwsgi.cache_lock); + if (uwsgi_cache_set((char *) sess->session_id, sess->session_id_length, session_blob, len, uwsgi.ssl_sessions_timeout, 0)) { + if (uwsgi.ssl_verbose) { + uwsgi_log("[uwsgi-ssl] unable to store session of size %d in the cache\n", len); + } + } + uwsgi_rwunlock(uwsgi.cache_lock); + return 0; +} + +SSL_SESSION *uwsgi_ssl_session_get_cb(SSL *ssl, unsigned char *key, int keylen, int *copy) { + + uint64_t valsize = 0; + + *copy = 0; + uwsgi_rlock(uwsgi.cache_lock); + char *value = uwsgi_cache_get((char *)key, keylen, &valsize); + if (!value) { + uwsgi_rwunlock(uwsgi.cache_lock); + if (uwsgi.ssl_verbose) { + uwsgi_log("[uwsgi-ssl] cache miss\n"); + } + return NULL; + } + SSL_SESSION *sess = d2i_SSL_SESSION(NULL, (const unsigned char **)&value, valsize); + uwsgi_rwunlock(uwsgi.cache_lock); + return sess; +} + +void uwsgi_ssl_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess) { + uwsgi_wlock(uwsgi.cache_lock); + if (uwsgi_cache_del((char *) sess->session_id, sess->session_id_length, 0, 0)) { + if (uwsgi.ssl_verbose) { + uwsgi_log("[uwsgi-ssl] error removing cache item\n"); + } + } + uwsgi_rwunlock(uwsgi.cache_lock); +} + +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME +static int uwsgi_sni_cb(SSL *ssl, int *ad, void *arg) { + const char *servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); + if (!servername) return SSL_TLSEXT_ERR_NOACK; + size_t servername_len = strlen(servername); + + struct uwsgi_string_list *usl = uwsgi.sni; + while(usl) { + if (!uwsgi_strncmp(usl->value, usl->len, (char *)servername, servername_len)) { + SSL_set_SSL_CTX(ssl, usl->custom_ptr); + return SSL_TLSEXT_ERR_OK; + } + usl = usl->next; + } + +#ifdef UWSGI_PCRE + struct uwsgi_regexp_list *url = uwsgi.sni_regexp; + while(url) { + if (uwsgi_regexp_match(url->pattern, url->pattern_extra, (char *)servername, servername_len) >= 0) { + SSL_set_SSL_CTX(ssl, url->custom_ptr); + return SSL_TLSEXT_ERR_OK; + } + url = url->next; + } +#endif + + return SSL_TLSEXT_ERR_NOACK; +} +#endif + +SSL_CTX *uwsgi_ssl_new_server_context(char *name, char *crt, char *key, char *ciphers, char *client_ca) { + + SSL_CTX *ctx = SSL_CTX_new(SSLv23_server_method()); + if (!ctx) { + uwsgi_log("[uwsgi-ssl] unable to initialize context \"%s\"\n", name); + return NULL; + } + + // this part is taken from nginx and stud, removing unneeded functionality + // stud (for me) has made the best choice on choosing DH approach + + long ssloptions = SSL_OP_NO_SSLv2 | SSL_OP_ALL | SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; +// disable compression (if possibile) +#ifdef SSL_OP_NO_COMPRESSION + ssloptions |= SSL_OP_NO_COMPRESSION; +#endif + +// release/reuse buffers as soon as possibile +#ifdef SSL_MODE_RELEASE_BUFFERS + SSL_CTX_set_mode(ctx, SSL_MODE_RELEASE_BUFFERS); +#endif + + if (SSL_CTX_use_certificate_chain_file(ctx, crt) <= 0) { + uwsgi_log("[uwsgi-ssl] unable to assign certificate %s for context \"%s\"\n", crt, name); + SSL_CTX_free(ctx); + return NULL; + } + +// this part is based from stud + BIO *bio = BIO_new_file(crt, "r"); + if (bio) { + DH *dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); + BIO_free(bio); + if (dh) { + SSL_CTX_set_tmp_dh(ctx, dh); + DH_free(dh); +#if OPENSSL_VERSION_NUMBER >= 0x0090800fL +#ifndef OPENSSL_NO_ECDH +#ifdef NID_X9_62_prime256v1 + EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + SSL_CTX_set_tmp_ecdh(ctx, ecdh); + EC_KEY_free(ecdh); +#endif +#endif +#endif + } + } + + if (SSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM) <= 0) { + uwsgi_log("[uwsgi-ssl] unable to assign key %s for context \"%s\"\n", key, name); + SSL_CTX_free(ctx); + return NULL; + } + + + // if ciphers are specified, prefer server ciphers + if (ciphers && strlen(ciphers) > 0) { + if (SSL_CTX_set_cipher_list(ctx, ciphers) == 0) { + uwsgi_log("[uwsgi-ssl] unable to set requested ciphers (%s) for context \"%s\"\n", ciphers, name); + SSL_CTX_free(ctx); + return NULL; + } + + ssloptions |= SSL_OP_CIPHER_SERVER_PREFERENCE; + } + + // set session context (if possibile), this is required for client certificate authentication + if (name) { + SSL_CTX_set_session_id_context(ctx, (unsigned char *) name, strlen(name)); + } + + if (client_ca) { + if (client_ca[0] == '!') { + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, uwsgi_ssl_verify_callback); + client_ca++; + } + else { + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, uwsgi_ssl_verify_callback); + } + // in the future we should allow to set the verify depth + SSL_CTX_set_verify_depth(ctx, 1); + if (SSL_CTX_load_verify_locations(ctx, client_ca, NULL) == 0) { + uwsgi_log("[uwsgi-ssl] unable to set ssl verify locations (%s) for context \"%s\"\n", client_ca, name); + SSL_CTX_free(ctx); + return NULL; + } + STACK_OF(X509_NAME) * list = SSL_load_client_CA_file(client_ca); + if (!list) { + uwsgi_log("unable to load client CA certificate (%s) for context \"%s\"\n", client_ca, name); + SSL_CTX_free(ctx); + return NULL; + } + + SSL_CTX_set_client_CA_list(ctx, list); + } + + + SSL_CTX_set_info_callback(ctx, uwsgi_ssl_info_cb); +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME + SSL_CTX_set_tlsext_servername_callback(ctx, uwsgi_sni_cb); +#endif + + // disable session caching by default + SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); + + if (uwsgi.ssl_sessions_use_cache) { + + if (!uwsgi.cache_max_items) { + uwsgi_log("you have to enable uWSGI cache to use it as SSL session store !!!\n"); + exit(1); + } + + if (uwsgi.cache_blocksize < 4096) { + uwsgi_log("cache blocksize for SSL session store must be at least 4096 bytes\n"); + exit(1); + } + + SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER| + SSL_SESS_CACHE_NO_INTERNAL| + SSL_SESS_CACHE_NO_AUTO_CLEAR); + + ssloptions |= SSL_OP_NO_TICKET; + + // just for fun + SSL_CTX_sess_set_cache_size(ctx, 0); + + // set the callback for ssl sessions + SSL_CTX_sess_set_new_cb(ctx, uwsgi_ssl_session_new_cb); + SSL_CTX_sess_set_get_cb(ctx, uwsgi_ssl_session_get_cb); + SSL_CTX_sess_set_remove_cb(ctx, uwsgi_ssl_session_remove_cb); + } + + SSL_CTX_set_timeout(ctx, uwsgi.ssl_sessions_timeout); + + SSL_CTX_set_options(ctx, ssloptions); + + + return ctx; +} + + +char *uwsgi_rsa_sign(char *algo_key, char *message, size_t message_len, unsigned int *s_len) { + + // openssl could not be initialized + if (!uwsgi.ssl_initialized) { + uwsgi_ssl_init(); + } + + *s_len = 0; + EVP_PKEY *pk = NULL; + + char *algo = uwsgi_str(algo_key); + char *colon = strchr(algo, ':'); + if (!colon) { + uwsgi_log("invalid RSA signature syntax, must be: :\n"); + free(algo); + return NULL; + } + + *colon = 0; + char *keyfile = colon + 1; + char *signature = NULL; + + FILE *kf = fopen(keyfile, "r"); + if (!kf) { + uwsgi_error_open(keyfile); + free(algo); + return NULL; + } + + if (PEM_read_PrivateKey(kf, &pk, NULL, NULL) == 0) { + uwsgi_log("unable to load private key: %s\n", keyfile); + free(algo); + fclose(kf); + return NULL; + } + + fclose(kf); + + EVP_MD_CTX *ctx = EVP_MD_CTX_create(); + if (!ctx) { + free(algo); + EVP_PKEY_free(pk); + return NULL; + } + + const EVP_MD *md = EVP_get_digestbyname(algo); + if (!md) { + uwsgi_log("unknown digest algo: %s\n", algo); + free(algo); + EVP_PKEY_free(pk); + EVP_MD_CTX_destroy(ctx); + return NULL; + } + + *s_len = EVP_PKEY_size(pk); + signature = uwsgi_malloc(*s_len); + + if (EVP_SignInit_ex(ctx, md, NULL) == 0) { + ERR_print_errors_fp(stderr); + free(signature); + signature = NULL; + *s_len = 0; + goto clear; + } + + if (EVP_SignUpdate(ctx, message, message_len) == 0) { + ERR_print_errors_fp(stderr); + free(signature); + signature = NULL; + *s_len = 0; + goto clear; + } + + + if (EVP_SignFinal(ctx, (unsigned char *) signature, s_len, pk) == 0) { + ERR_print_errors_fp(stderr); + free(signature); + signature = NULL; + *s_len = 0; + goto clear; + } + +clear: + free(algo); + EVP_PKEY_free(pk); + EVP_MD_CTX_destroy(ctx); + return signature; + +} + +char *uwsgi_sanitize_cert_filename(char *base, char *key, uint16_t keylen) { + uint16_t i; + char *filename = uwsgi_concat4n(base, strlen(base), "/", 1, key, keylen, ".pem\0", 5); + + for (i = strlen(base) + 1; i < (strlen(base) + 1) + keylen; i++) { + if (filename[i] >= '0' && filename[i] <= '9') + continue; + if (filename[i] >= 'A' && filename[i] <= 'Z') + continue; + if (filename[i] >= 'a' && filename[i] <= 'z') + continue; + if (filename[i] == '.') + continue; + if (filename[i] == '-') + continue; + if (filename[i] == '_') + continue; + filename[i] = '_'; + } + + return filename; +} + +char *uwsgi_ssl_rand(size_t len) { + unsigned char *buf = uwsgi_calloc(len+1); + if (RAND_bytes(buf, len) <= 0) { + return NULL; + } + return (char *) buf; +} diff --git a/core/utils.c b/core/utils.c index e04e5688cc..c3be311d34 100644 --- a/core/utils.c +++ b/core/utils.c @@ -229,7 +229,7 @@ char *uwsgi_get_cwd() { if (getcwd(cwd, newsize) == NULL && errno == ERANGE) { newsize += 256; - uwsgi_log("need a bigger buffer (%d bytes) for getcwd(). doing reallocation.\n", newsize); + uwsgi_log("need a bigger buffer (%lu bytes) for getcwd(). doing reallocation.\n", (unsigned long) newsize); free(cwd); cwd = uwsgi_malloc(newsize); if (getcwd(cwd, newsize) == NULL) { @@ -1128,12 +1128,6 @@ void sanitize_args() { } } -#ifdef UWSGI_HTTP - if (uwsgi.http && !uwsgi.http_only) { - uwsgi.vacuum = 1; - } -#endif - if (uwsgi.write_errors_exception_only) { uwsgi.ignore_sigpipe = 1; uwsgi.ignore_write_errors = 1; @@ -1145,6 +1139,19 @@ void sanitize_args() { exit(1); } + if (uwsgi.cheaper && uwsgi.cheaper_count) { + if (uwsgi.cheaper_initial < uwsgi.cheaper_count) { + uwsgi_log("warning: invalid cheaper-initial value (%d), must be equal or higher than cheaper (%d), using %d as initial number of workers\n", + uwsgi.cheaper_initial, uwsgi.cheaper_count, uwsgi.cheaper_count); + uwsgi.cheaper_initial = uwsgi.cheaper_count; + } + else if (uwsgi.cheaper_initial > uwsgi.numproc) { + uwsgi_log("warning: invalid cheaper-initial value (%d), must be lower or equal than worker count (%d), using %d as initial number of workers\n", + uwsgi.cheaper_initial, uwsgi.numproc, uwsgi.numproc); + uwsgi.cheaper_initial = uwsgi.numproc; + } + } + if (uwsgi.auto_snapshot > 0 && uwsgi.auto_snapshot > uwsgi.numproc) { uwsgi_log("invalid auto-snapshot value: must be <= than processes\n"); exit(1); @@ -2463,29 +2470,50 @@ char *uwsgi_open_and_read(char *url, int *size, int add_zero, char *magic_table[ uwsgi_log("this is not a vassal instance\n"); exit(1); } - char *tmp_buffer[4096]; - ssize_t rlen = 1; + ssize_t rlen; *size = 0; - while (rlen > 0) { - rlen = read(uwsgi.emperor_fd_config, tmp_buffer, 4096); - if (rlen > 0) { - *size += rlen; - buffer = realloc(buffer, *size); - if (!buffer) { - uwsgi_error("realloc()"); - exit(1); - } - memcpy(buffer + (*size - rlen), tmp_buffer, rlen); + struct uwsgi_header uh; + size_t remains = 4; + char *ptr = (char *) &uh; + while(remains) { + int ret = uwsgi_waitfd(uwsgi.emperor_fd_config, 5); + if (ret <= 0) { + uwsgi_log("[uwsgi-vassal] error waiting for config header %s !!!\n", url); + exit(1); + } + rlen = read(uwsgi.emperor_fd_config, ptr, remains); + if (rlen <= 0) { + uwsgi_log("[uwsgi-vassal] error reading config header from !!!\n", url); + exit(1); } + ptr+=rlen; + remains-=rlen; } - close(uwsgi.emperor_fd_config); - uwsgi.emperor_fd_config = -1; - if (add_zero) { - *size = *size + 1; - buffer = realloc(buffer, *size); - buffer[*size - 1] = 0; + remains = uh.pktsize; + if (!remains) { + uwsgi_log("[uwsgi-vassal] invalid config from %s\n", url); + exit(1); + } + + buffer = uwsgi_calloc(remains + add_zero); + ptr = buffer; + while (remains) { + int ret = uwsgi_waitfd(uwsgi.emperor_fd_config, 5); + if (ret <= 0) { + uwsgi_log("[uwsgi-vassal] error waiting for config %s !!!\n", url); + exit(1); + } + rlen = read(uwsgi.emperor_fd_config, ptr, remains); + if (rlen <= 0) { + uwsgi_log("[uwsgi-vassal] error reading config from !!!\n", url); + exit(1); + } + ptr+=rlen; + remains-=rlen; } + + *size = uh.pktsize + add_zero; } #ifdef UWSGI_EMBED_CONFIG else if (url[0] == 0) { @@ -2894,7 +2922,7 @@ size_t uwsgi_str_num(char *str, int len) { int i; size_t num = 0; - size_t delta = pow(10, len); + uint64_t delta = pow(10, len); for (i = 0; i < len; i++) { delta = delta / 10; @@ -3274,10 +3302,46 @@ pid_t uwsgi_run_command(char *command, int *stdin_fd, int stdout_fd) { } uwsgi_close_all_sockets(); + //uwsgi_close_all_fds(); + int i; + for (i = 3; i < (int) uwsgi.max_fd; i++) { + if (stdin_fd) { + if (i == stdin_fd[0] || i == stdin_fd[1]) { + continue; + } + } + if (stdout_fd > -1) { + if (i == stdout_fd) { + continue; + } + } +#ifdef __APPLE__ + fcntl(i, F_SETFD, FD_CLOEXEC); +#else + close(i); +#endif + } + + if (stdin_fd) { close(stdin_fd[1]); } + else { + if (!uwsgi_valid_fd(0)) { + int in_fd = open("/dev/null", O_RDONLY); + if (in_fd < 0) { + uwsgi_error_open("/dev/null"); + } + else { + if (in_fd != 0) { + if (dup2(in_fd, 0) < 0) { + uwsgi_error("dup2()"); + } + } + } + } + } if (stdout_fd > -1 && stdout_fd != 1) { if (dup2(stdout_fd, 1) < 0) { @@ -4071,17 +4135,37 @@ struct uwsgi_app *uwsgi_add_app(int id, uint8_t modifier1, char *mountpoint, int char *uwsgi_check_touches(struct uwsgi_string_list *touch_list) { + // touch->value - file path + // touch->custom - file timestamp + // touch->custom2 - 0 if file exists, 1 if it does not exists + struct uwsgi_string_list *touch = touch_list; while (touch) { struct stat tr_st; if (stat(touch->value, &tr_st)) { - uwsgi_log("unable to stat() %s, events will be triggered as soon as the file is created\n", touch->value); + if (touch->custom && !touch->custom2) { +#ifdef UWSGI_DEBUG + uwsgi_log("[uwsgi-check-touches] File %s was removed\n", touch->value); +#endif + touch->custom2 = 1; + return touch->value; + } + else if (!touch->custom && !touch->custom2) { + uwsgi_log("unable to stat() %s, events will be triggered as soon as the file is created\n", touch->value); + touch->custom2 = 1; + } touch->custom = 0; } else { - if (!touch->custom) + if (!touch->custom && touch->custom2) { +#ifdef UWSGI_DEBUG + uwsgi_log("[uwsgi-check-touches] File was created: %s\n", touch->value); +#endif touch->custom = (uint64_t) tr_st.st_mtime; - if ((uint64_t) tr_st.st_mtime > touch->custom) { + touch->custom2 = 0; + return touch->value; + } + else if (touch->custom && (uint64_t) tr_st.st_mtime > touch->custom) { #ifdef UWSGI_DEBUG uwsgi_log("[uwsgi-check-touches] modification detected on %s: %llu -> %llu\n", touch->value, (unsigned long long) touch->custom, (unsigned long long) tr_st.st_mtime); #endif @@ -4141,7 +4225,7 @@ void uwsgi_setup_post_buffering() { if (uwsgi.post_buffering_bufsize < uwsgi.post_buffering) { uwsgi.post_buffering_bufsize = uwsgi.post_buffering; - uwsgi_log("setting request body buffering size to %d bytes\n", uwsgi.post_buffering_bufsize); + uwsgi_log("setting request body buffering size to %lu bytes\n", (unsigned long) uwsgi.post_buffering_bufsize); } } @@ -4263,262 +4347,6 @@ char *uwsgi_expand_path(char *dir, int dir_len, char *ptr) { return dst; } -#ifdef UWSGI_SSL - -/* - -ssl additional datas are retrieved via indexes. - -You can create an index with SSL_CTX_get_ex_new_index and -set data in it with SSL_CTX_set_ex_data - -*/ - -void uwsgi_ssl_init(void) { - OPENSSL_config(NULL); - SSL_library_init(); - SSL_load_error_strings(); - OpenSSL_add_all_algorithms(); - uwsgi.ssl_initialized = 1; -} - -void uwsgi_ssl_info_cb(SSL const *ssl, int where, int ret) { - if (where & SSL_CB_HANDSHAKE_DONE) { - if (ssl->s3) { - ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS; - } - } -} - -int uwsgi_ssl_verify_callback(int ok, X509_STORE_CTX * x509_store) { - return 1; -} - -SSL_CTX *uwsgi_ssl_new_server_context(char *name, char *crt, char *key, char *ciphers, char *client_ca) { - - SSL_CTX *ctx = SSL_CTX_new(SSLv23_server_method()); - if (!ctx) { - uwsgi_log("unable to initialize ssl context\n"); - exit(1); - } - - // this part is taken from nginx and stud, removing unneeded functionality - // stud (for me) has made the best choice on choosing DH approach - - long ssloptions = SSL_OP_NO_SSLv2 | SSL_OP_ALL | SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; -// disable compression (if possibile) -#ifdef SSL_OP_NO_COMPRESSION - ssloptions |= SSL_OP_NO_COMPRESSION; -#endif - SSL_CTX_set_options(ctx, ssloptions); - -// release/reuse buffers as soon as possibile -#ifdef SSL_MODE_RELEASE_BUFFERS - SSL_CTX_set_mode(ctx, SSL_MODE_RELEASE_BUFFERS); -#endif - - if (SSL_CTX_use_certificate_chain_file(ctx, crt) <= 0) { - uwsgi_log("unable to assign ssl certificate %s\n", crt); - exit(1); - } - -// this part is based from stud - BIO *bio = BIO_new_file(crt, "r"); - if (bio) { - DH *dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); - BIO_free(bio); - if (dh) { - SSL_CTX_set_tmp_dh(ctx, dh); - DH_free(dh); -#if OPENSSL_VERSION_NUMBER >= 0x0090800fL -#ifndef OPENSSL_NO_ECDH -#ifdef NID_X9_62_prime256v1 - EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - SSL_CTX_set_tmp_ecdh(ctx, ecdh); - EC_KEY_free(ecdh); -#endif -#endif -#endif - } - } - - if (SSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM) <= 0) { - uwsgi_log("unable to assign key certificate %s\n", key); - exit(1); - } - - // if ciphers are specified, prefer server ciphers - if (ciphers && strlen(ciphers) > 0) { - if (SSL_CTX_set_cipher_list(ctx, ciphers) == 0) { - uwsgi_log("unable to set ssl requested ciphers: %s\n", ciphers); - exit(1); - } - - SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); - } - - // set session context (if possibile), this is required for client certificate authentication - if (name) { - SSL_CTX_set_session_id_context(ctx, (unsigned char *) name, strlen(name)); - } - - if (client_ca) { - if (client_ca[0] == '!') { - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, uwsgi_ssl_verify_callback); - client_ca++; - } - else { - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, uwsgi_ssl_verify_callback); - } - // in the future we should allow to set the verify depth - SSL_CTX_set_verify_depth(ctx, 1); - if (SSL_CTX_load_verify_locations(ctx, client_ca, NULL) == 0) { - uwsgi_log("unable to set ssl verify locations for: %s\n", client_ca); - exit(1); - } - STACK_OF(X509_NAME) * list = SSL_load_client_CA_file(client_ca); - if (!list) { - uwsgi_log("unable to load client CA certificate: %s\n", client_ca); - exit(1); - } - - SSL_CTX_set_client_CA_list(ctx, list); - } - - - SSL_CTX_set_info_callback(ctx, uwsgi_ssl_info_cb); - - // disable session caching by default - SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); - -/* - SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER); -#ifdef UWSGI_DEBUG - uwsgi_log("[uwsgi-ssl] initialized ssl session cache: %s\n", name); -#endif - //SSL_CTX_set_timeout - //SSL_CTX_sess_set_cache_size - } -*/ - - return ctx; -} - - -char *uwsgi_rsa_sign(char *algo_key, char *message, size_t message_len, unsigned int *s_len) { - - // openssl could not be initialized - if (!uwsgi.ssl_initialized) { - uwsgi_ssl_init(); - } - - *s_len = 0; - EVP_PKEY *pk = NULL; - - char *algo = uwsgi_str(algo_key); - char *colon = strchr(algo, ':'); - if (!colon) { - uwsgi_log("invalid RSA signature syntax, must be: :\n"); - free(algo); - return NULL; - } - - *colon = 0; - char *keyfile = colon + 1; - char *signature = NULL; - - FILE *kf = fopen(keyfile, "r"); - if (!kf) { - uwsgi_error_open(keyfile); - free(algo); - return NULL; - } - - if (PEM_read_PrivateKey(kf, &pk, NULL, NULL) == 0) { - uwsgi_log("unable to load private key: %s\n", keyfile); - free(algo); - fclose(kf); - return NULL; - } - - fclose(kf); - - EVP_MD_CTX *ctx = EVP_MD_CTX_create(); - if (!ctx) { - free(algo); - EVP_PKEY_free(pk); - return NULL; - } - - const EVP_MD *md = EVP_get_digestbyname(algo); - if (!md) { - uwsgi_log("unknown digest algo: %s\n", algo); - free(algo); - EVP_PKEY_free(pk); - EVP_MD_CTX_destroy(ctx); - return NULL; - } - - *s_len = EVP_PKEY_size(pk); - signature = uwsgi_malloc(*s_len); - - if (EVP_SignInit_ex(ctx, md, NULL) == 0) { - ERR_print_errors_fp(stderr); - free(signature); - signature = NULL; - *s_len = 0; - goto clear; - } - - if (EVP_SignUpdate(ctx, message, message_len) == 0) { - ERR_print_errors_fp(stderr); - free(signature); - signature = NULL; - *s_len = 0; - goto clear; - } - - - if (EVP_SignFinal(ctx, (unsigned char *) signature, s_len, pk) == 0) { - ERR_print_errors_fp(stderr); - free(signature); - signature = NULL; - *s_len = 0; - goto clear; - } - -clear: - free(algo); - EVP_PKEY_free(pk); - EVP_MD_CTX_destroy(ctx); - return signature; - -} - -char *uwsgi_sanitize_cert_filename(char *base, char *key, uint16_t keylen) { - uint16_t i; - char *filename = uwsgi_concat4n(base, strlen(base), "/", 1, key, keylen, ".pem\0", 5); - - for (i = strlen(base) + 1; i < (strlen(base) + 1) + keylen; i++) { - if (filename[i] >= '0' && filename[i] <= '9') - continue; - if (filename[i] >= 'A' && filename[i] <= 'Z') - continue; - if (filename[i] >= 'a' && filename[i] <= 'z') - continue; - if (filename[i] == '.') - continue; - if (filename[i] == '-') - continue; - if (filename[i] == '_') - continue; - filename[i] = '_'; - } - - return filename; -} - -#endif ssize_t uwsgi_pipe(int src, int dst, int timeout) { char buf[8192]; @@ -5039,3 +4867,48 @@ int uwsgi_plugin_modifier1(char *plugin) { free(symbol_name); return ret; } + +char *uwsgi_strip(char *src) { + char *dst = src ; + size_t len = strlen(src); + int i; + + for(i=0;i<(ssize_t)len;i++) { + if (src[i] == ' ' || src[i] == '\t') { + dst++; + } + } + + len -= (dst-src); + + for(i=len;i>=0;i--) { + if (dst[i] == ' ' || dst[i] == '\t') { + dst[i] = 0; + } + else { + break; + } + } + + return dst; +} + +int uwsgi_valid_fd(int fd) { + int ret = fcntl(fd, F_GETFL); + if (ret == 0) { + return 1; + } + return 0; +} + +void uwsgi_close_all_fds(void) { + int i; + for (i = 3; i < (int) uwsgi.max_fd; i++) { +#ifdef __APPLE__ + fcntl(i, F_SETFD, FD_CLOEXEC); +#else + close(i); +#endif + } +} + diff --git a/core/uwsgi.c b/core/uwsgi.c index 1ebea24dac..a49ad78a80 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -60,6 +60,7 @@ static struct uwsgi_option uwsgi_base_options[] = { {"skip-zero", no_argument, 0, "skip check of file descriptor 0", uwsgi_opt_true, &uwsgi.skip_zero, 0}, {"set", required_argument, 'S', "set a custom placeholder", uwsgi_opt_set_placeholder, NULL, UWSGI_OPT_IMMEDIATE}, + {"get", required_argument, 0, "print the specified option value and exit", uwsgi_opt_add_string_list, &uwsgi.get_list, UWSGI_OPT_NO_INITIAL}, {"declare-option", required_argument, 0, "declare a new uWSGI custom option", uwsgi_opt_add_custom_option, NULL, UWSGI_OPT_IMMEDIATE}, {"for", required_argument, 0, "(opt logic) for cycle", uwsgi_opt_logic, (void *) uwsgi_logic_opt_for, UWSGI_OPT_IMMEDIATE}, @@ -184,6 +185,8 @@ static struct uwsgi_option uwsgi_base_options[] = { {"cache-no-expire", no_argument, 0, "disable auto sweep of expired items", uwsgi_opt_true, &uwsgi.cache_no_expire, 0}, {"cache-expire-freq", required_argument, 0, "set the frequency of cache sweeper scans (default 3 seconds)", uwsgi_opt_set_int, &uwsgi.cache_expire_freq, 0}, {"cache-report-freed-items", no_argument, 0, "constantly report the cache item freed by the sweeper (use only for debug)", uwsgi_opt_true, &uwsgi.cache_report_freed_items, 0}, + {"cache-udp-server", required_argument, 0, "bind the cache udp server (used only for set/update/delete) to the specified socket", uwsgi_opt_add_string_list, &uwsgi.cache_udp_server, UWSGI_OPT_MASTER}, + {"cache-udp-node", required_argument, 0, "send cache update/deletion to the specified cache udp server", uwsgi_opt_add_string_list, &uwsgi.cache_udp_node, UWSGI_OPT_MASTER}, {"queue", required_argument, 0, "enable shared queue", uwsgi_opt_set_int, &uwsgi.queue_size, 0}, {"queue-blocksize", required_argument, 0, "set queue blocksize", uwsgi_opt_set_int, &uwsgi.queue_store_sync, 0}, @@ -320,12 +323,22 @@ static struct uwsgi_option uwsgi_base_options[] = { #ifdef UWSGI_MULTICAST {"multicast", required_argument, 0, "subscribe to specified multicast group", uwsgi_opt_set_str, &uwsgi.multicast_group, UWSGI_OPT_MASTER}, {"multicast-ttl", required_argument, 0, "set multicast ttl", uwsgi_opt_set_int, &uwsgi.multicast_ttl, 0}, + {"multicast-loop", required_argument, 0, "set multicast loop (default 1)", uwsgi_opt_set_int, &uwsgi.multicast_loop, 0}, {"cluster", required_argument, 0, "join specified uWSGI cluster", uwsgi_opt_set_str, &uwsgi.cluster, UWSGI_OPT_MASTER}, {"cluster-nodes", required_argument, 0, "get nodes list from the specified cluster", uwsgi_opt_true, &uwsgi.cluster_nodes, UWSGI_OPT_MASTER | UWSGI_OPT_CLUSTER}, {"cluster-reload", required_argument, 0, "send a reload message to the cluster", uwsgi_opt_cluster_reload, NULL, UWSGI_OPT_IMMEDIATE}, {"cluster-log", required_argument, 0, "send a log line to the cluster", uwsgi_opt_cluster_log, NULL, UWSGI_OPT_IMMEDIATE}, #endif + #ifdef UWSGI_SSL + {"legion", required_argument, 0, "became a member of a legion", uwsgi_opt_legion, NULL, UWSGI_OPT_MASTER}, + {"legion-node", required_argument, 0, "add a node to a legion", uwsgi_opt_legion_node, NULL, UWSGI_OPT_MASTER}, + {"legion-freq", required_argument, 0, "set the frequency of legion packets", uwsgi_opt_set_int, &uwsgi.legion_freq, UWSGI_OPT_MASTER}, + {"legion-tolerance", required_argument, 0, "set the tolerance of legion subsystem", uwsgi_opt_set_int, &uwsgi.legion_tolerance, UWSGI_OPT_MASTER}, + {"legion-lord", required_argument, 0, "action to call on Lord election", uwsgi_opt_legion_hook, NULL, UWSGI_OPT_MASTER}, + {"legion-unlord", required_argument, 0, "action to call on Lord dismiss", uwsgi_opt_legion_hook, NULL, UWSGI_OPT_MASTER}, + {"legion-setup", required_argument, 0, "action to call on legion setup", uwsgi_opt_legion_hook, NULL, UWSGI_OPT_MASTER}, + {"legion-death", required_argument, 0, "action to call on legion death (shutdown of the instance)", uwsgi_opt_legion_hook, NULL, UWSGI_OPT_MASTER}, {"subscriptions-sign-check", required_argument, 0, "set digest algorithm and certificate directory for secured subscription system", uwsgi_opt_scd, NULL, UWSGI_OPT_MASTER}, {"subscriptions-sign-check-tolerance", required_argument, 0, "set the maximum tolerance (in seconds) of clock skew for secured subscription system", uwsgi_opt_set_int, &uwsgi.subscriptions_sign_check_tolerance, UWSGI_OPT_MASTER}, #endif @@ -343,6 +356,14 @@ static struct uwsgi_option uwsgi_base_options[] = { #endif #ifdef UWSGI_SSL {"ssl-verbose", no_argument, 0, "be verbose about SSL errors", uwsgi_opt_true, &uwsgi.ssl_verbose, 0}, + {"ssl-sessions-use-cache", no_argument, 0, "use uWSGI cache for ssl sessions storage", uwsgi_opt_true, &uwsgi.ssl_sessions_use_cache, 0}, + {"ssl-session-use-cache", no_argument, 0, "use uWSGI cache for ssl sessions storage", uwsgi_opt_true, &uwsgi.ssl_sessions_use_cache, 0}, + {"ssl-sessions-timeout", required_argument, 0, "set SSL sessions timeout (default: 300 seconds)", uwsgi_opt_set_int, &uwsgi.ssl_sessions_timeout, 0}, + {"ssl-session-timeout", required_argument, 0, "set SSL sessions timeout (default: 300 seconds)", uwsgi_opt_set_int, &uwsgi.ssl_sessions_timeout, 0}, + {"sni", required_argument, 0, "add an SNI-governed SSL context", uwsgi_opt_sni, NULL, 0}, +#ifdef UWSGI_PCRE + {"sni-regexp", required_argument, 0, "add an SNI-governed SSL context (the key is a regexp)", uwsgi_opt_sni, NULL, 0}, +#endif #endif {"check-interval", required_argument, 0, "set the interval (in seconds) of master checks", uwsgi_opt_set_dyn, (void *) UWSGI_OPTION_MASTER_INTERVAL, 0}, {"forkbomb-delay", required_argument, 0, "sleep for the specified number of seconds when a forkbomb is detected", uwsgi_opt_set_int, &uwsgi.forkbomb_delay, UWSGI_OPT_MASTER}, @@ -378,6 +399,9 @@ static struct uwsgi_option uwsgi_base_options[] = { {"alarm", required_argument, 0, "create a new alarm, syntax: ", uwsgi_opt_add_string_list, &uwsgi.alarm_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER}, {"alarm-freq", required_argument, 0, "tune the anti-loop alam system (default 3 seconds)", uwsgi_opt_set_int, &uwsgi.alarm_freq, 0}, {"log-alarm", required_argument, 0, "raise the specified alarm when a log line matches the specified regexp, syntax: [,alarm...] ", uwsgi_opt_add_string_list, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER}, + {"alarm-log", required_argument, 0, "raise the specified alarm when a log line matches the specified regexp, syntax: [,alarm...] ", uwsgi_opt_add_string_list, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER}, + {"not-log-alarm", required_argument, 0, "skip the specified alarm when a log line matches the specified regexp, syntax: [,alarm...] ", uwsgi_opt_add_string_list_custom, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER}, + {"not-alarm-log", required_argument, 0, "skip the specified alarm when a log line matches the specified regexp, syntax: [,alarm...] ", uwsgi_opt_add_string_list_custom, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER}, {"alarm-list", no_argument, 0, "list enabled alarms", uwsgi_opt_true, &uwsgi.alarms_list, 0}, {"alarms-list", no_argument, 0, "list enabled alarms", uwsgi_opt_true, &uwsgi.alarms_list, 0}, #endif @@ -472,6 +496,7 @@ static struct uwsgi_option uwsgi_base_options[] = { #endif {"offload-threads", required_argument, 0, "set the number of offload threads to spawn (per-worker, default 0)", uwsgi_opt_set_int, &uwsgi.offload_threads, 0}, + {"offload-thread", required_argument, 0, "set the number of offload threads to spawn (per-worker, default 0)", uwsgi_opt_set_int, &uwsgi.offload_threads, 0}, {"file-serve-mode", required_argument, 0, "set static file serving mode", uwsgi_opt_fileserve_mode, NULL, UWSGI_OPT_MIME}, {"fileserve-mode", required_argument, 0, "set static file serving mode", uwsgi_opt_fileserve_mode, NULL, UWSGI_OPT_MIME}, @@ -492,6 +517,10 @@ static struct uwsgi_option uwsgi_base_options[] = { {"ns-net", required_argument, 0, "add network namespace", uwsgi_opt_set_str, &uwsgi.ns_net, 0}, #endif {"reuse-port", no_argument, 0, "enable REUSE_PORT flag on socket (BSD only)", uwsgi_opt_true, &uwsgi.reuse_port, 0}, + {"tcp-fast-open", required_argument, 0, "enable TCP_FASTOPEN flag on TCP sockets with the specified qlen value", uwsgi_opt_set_int, &uwsgi.tcp_fast_open, 0}, + {"tcp-fastopen", required_argument, 0, "enable TCP_FASTOPEN flag on TCP sockets with the specified qlen value", uwsgi_opt_set_int, &uwsgi.tcp_fast_open, 0}, + {"tcp-fast-open-client", no_argument, 0, "use sendto(..., MSG_FASTOPEN, ...) instead of connect() if supported", uwsgi_opt_true, &uwsgi.tcp_fast_open_client, 0}, + {"tcp-fastopen-client", no_argument, 0, "use sendto(..., MSG_FASTOPEN, ...) instead of connect() if supported", uwsgi_opt_true, &uwsgi.tcp_fast_open_client, 0}, {"zerg", required_argument, 0, "attach to a zerg server", uwsgi_opt_add_string_list, &uwsgi.zerg_node, 0}, {"zerg-fallback", no_argument, 0, "fallback to normal sockets if the zerg server is not available", uwsgi_opt_true, &uwsgi.zerg_fallback, 0}, {"zerg-server", required_argument, 0, "enable the zerg server on the specified UNIX socket", uwsgi_opt_set_str, &uwsgi.zerg_server, UWSGI_OPT_MASTER}, @@ -1155,24 +1184,24 @@ void stats(int signum) { if (uwsgi.mywid == 0) { show_config(); - uwsgi_log("\tworkers total requests: %llu\n", uwsgi.workers[0].requests); + uwsgi_log("\tworkers total requests: %lu\n", uwsgi.workers[0].requests); uwsgi_log("-----------------\n"); for (j = 1; j <= uwsgi.numproc; j++) { for (i = 0; i < uwsgi.workers[j].apps_cnt; i++) { ua = &uwsgi.workers[j].apps[i]; if (ua) { - uwsgi_log("\tworker %d app %d [%.*s] requests: %d exceptions: %d\n", j, i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions); + uwsgi_log("\tworker %d app %d [%.*s] requests: %lu exceptions: %lu\n", j, i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions); } } uwsgi_log("-----------------\n"); } } else { - uwsgi_log("worker %d total requests: %llu\n", uwsgi.mywid, uwsgi.workers[0].requests); + uwsgi_log("worker %d total requests: %lu\n", uwsgi.mywid, uwsgi.workers[0].requests); for (i = 0; i < uwsgi.workers[uwsgi.mywid].apps_cnt; i++) { ua = &uwsgi.workers[uwsgi.mywid].apps[i]; if (ua) { - uwsgi_log("\tapp %d [%.*s] requests: %d exceptions: %d\n", i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions); + uwsgi_log("\tapp %d [%.*s] requests: %lu exceptions: %lu\n", i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions); } } uwsgi_log("-----------------\n"); @@ -1687,6 +1716,10 @@ int main(int argc, char *argv[], char *envp[]) { atexit(uwsgi_exec_atexit); // call plugin specific exit hooks atexit(uwsgi_plugins_atexit); +#ifdef UWSGI_SSL + // call legions death hooks + atexit(uwsgi_legion_atexit); +#endif // allocate main shared memory uwsgi.shared = (struct uwsgi_shared *) uwsgi_calloc_shared(sizeof(struct uwsgi_shared)); @@ -1808,6 +1841,21 @@ int main(int argc, char *argv[], char *envp[]) { // ok, the options dictionary is available, lets manage it uwsgi_configure(); + // --get management + struct uwsgi_string_list *get_list = uwsgi.get_list; + while(get_list) { + char *v = uwsgi_get_exported_opt(get_list->value); + if (v) { + fprintf(stdout, "%s\n", v); + } + get_list = get_list->next; + } + + if (uwsgi.get_list) { + exit(0); + } + + // initial log setup (files and daemonization) uwsgi_setup_log(); @@ -2301,7 +2349,7 @@ int uwsgi_start(void *v_argv) { (void) pthread_attr_init(&uwsgi.threads_attr); if (uwsgi.threads_stacksize) { if (pthread_attr_setstacksize(&uwsgi.threads_attr, uwsgi.threads_stacksize * 1024) == 0) { - uwsgi_log("threads stack size set to %dk\n", uwsgi.threads_stacksize); + uwsgi_log("threads stack size set to %luk\n", (unsigned long) uwsgi.threads_stacksize); } else { uwsgi_log("!!! unable to set requested threads stacksize !!!\n"); @@ -2690,7 +2738,7 @@ int uwsgi_start(void *v_argv) { } if (uwsgi.sockets->fd != 0) { - if (dup2(uwsgi.sockets->fd, 0)) { + if (dup2(uwsgi.sockets->fd, 0) < 0) { uwsgi_error("dup2()"); } } @@ -3294,6 +3342,91 @@ void uwsgi_opt_add_string_list(char *opt, char *value, void *list) { uwsgi_string_new_list(ptr, value); } +void uwsgi_opt_add_addr_list(char *opt, char *value, void *list) { + struct uwsgi_string_list **ptr = (struct uwsgi_string_list **) list; + int af = AF_INET; +#ifdef UWSGI_IPV6 + void *ip = uwsgi_malloc(16); + if (strchr(value, ':')) { + af = AF_INET6; + } +#else + void *ip = uwsgi_malloc(4); +#endif + + if (inet_pton(af, value, ip) <= 0) { + uwsgi_log("%s: invalid address\n", opt); + uwsgi_error("uwsgi_opt_add_addr_list()"); + exit(1); + } + + struct uwsgi_string_list *usl = uwsgi_string_new_list(ptr, ip); + usl->custom = af; + usl->custom_ptr = value; +} + + +void uwsgi_opt_add_string_list_custom(char *opt, char *value, void *list) { + struct uwsgi_string_list **ptr = (struct uwsgi_string_list **) list; + struct uwsgi_string_list *usl = uwsgi_string_new_list(ptr, value); + usl->custom = 1; +} + +#ifdef UWSGI_SSL +void uwsgi_opt_sni(char *opt, char *value, void *foobar) { + char *client_ca = NULL; + char *v = uwsgi_str(value); + + char *space = strchr(v, ' '); + if (!space) { + uwsgi_log("invalid %s syntax, must be sni_keycrt,key[,ciphers,client_ca]\n", opt); + exit(1); + } + *space = 0; + char *crt = space+1; + char *key = strchr(crt, ','); + if (!key) { + uwsgi_log("invalid %s syntax, must be sni_keycrt,key[,ciphers,client_ca]\n", opt); + exit(1); + } + *key = '\0'; key++; + + char *ciphers = strchr(key, ','); + if (ciphers) { + *ciphers = '\0'; ciphers++; + client_ca = strchr(ciphers, ','); + if (client_ca) { + *client_ca = '\0'; client_ca++; + } + } + + if (!uwsgi.ssl_initialized) { + uwsgi_ssl_init(); + } + + SSL_CTX *ctx = uwsgi_ssl_new_server_context(v, crt, key, ciphers, client_ca); + if (!ctx) { + uwsgi_log("[uwsgi-ssl] DANGER unable to initialize context for \"%s\"\n", v); + free(v); + return; + } + +#ifdef UWSGI_PCRE + if (!strcmp(opt, "sni-regexp")) { + struct uwsgi_regexp_list *url = uwsgi_regexp_new_list(&uwsgi.sni_regexp, v); + url->custom_ptr = ctx; + } + else { +#endif + struct uwsgi_string_list *usl = uwsgi_string_new_list(&uwsgi.sni, v); + usl->custom_ptr = ctx; +#ifdef UWSGI_PCRE + } +#endif + +} +#endif + #ifdef UWSGI_PCRE void uwsgi_opt_add_regexp_list(char *opt, char *value, void *list) { struct uwsgi_regexp_list **ptr = (struct uwsgi_regexp_list **) list; @@ -3553,7 +3686,7 @@ void uwsgi_opt_static_map(char *opt, char *value, void *static_maps) { docroot[0] = 0; docroot++; uwsgi_dyn_dict_new(maps, mountpoint, strlen(mountpoint), docroot, strlen(docroot)); - uwsgi_log("[uwsgi-static] added mapping for %s => %s\n", mountpoint, docroot); + uwsgi_log_initial("[uwsgi-static] added mapping for %s => %s\n", mountpoint, docroot); uwsgi.build_mime_dict = 1; } @@ -3799,7 +3932,7 @@ void uwsgi_opt_add_custom_option(char *opt, char *value, void *none) { char *copy = uwsgi_str(value); char *equal = strchr(copy, '='); if (!equal) { - uwsgi_log("invalid %s syntax, must be newoption=template\n"); + uwsgi_log("invalid %s syntax, must be newoption=template\n", value); exit(1); } *equal = 0; diff --git a/core/xmlconf.c b/core/xmlconf.c index eb723d403c..4313689f30 100644 --- a/core/xmlconf.c +++ b/core/xmlconf.c @@ -47,7 +47,7 @@ void uwsgi_xml_config(char *filename, struct wsgi_request *wsgi_req, char *magic exit(1); } - uwsgi_log("[uWSGI] parsing config file %s\n", filename); + uwsgi_log_initial("[uWSGI] parsing config file %s\n", filename); element = xmlDocGetRootElement(doc); if (element == NULL) { diff --git a/core/yaml.c b/core/yaml.c index 27b3b5af03..a43fb300e2 100644 --- a/core/yaml.c +++ b/core/yaml.c @@ -122,7 +122,7 @@ void uwsgi_yaml_config(char *file, char *magic_table[]) { } } - uwsgi_log("[uWSGI] getting YAML configuration from %s\n", file); + uwsgi_log_initial("[uWSGI] getting YAML configuration from %s\n", file); yaml = uwsgi_open_and_read(file, &len, 1, magic_table); @@ -137,7 +137,7 @@ void uwsgi_yaml_config(char *file, char *magic_table[]) { exit(1); } - yaml_parser_set_input_string(&parser, (const unsigned char *) yaml, (size_t) len - 1); + yaml_parser_set_input_string(&parser, (unsigned char *) yaml, (size_t) len - 1); while (parsing) { if (!yaml_parser_scan(&parser, &token)) { diff --git a/django/uwsgi_admin/__init__.py b/django/uwsgi_admin/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/django/uwsgi_admin/templates/uwsgi.html b/django/uwsgi_admin/templates/uwsgi.html deleted file mode 100644 index 86a55cd010..0000000000 --- a/django/uwsgi_admin/templates/uwsgi.html +++ /dev/null @@ -1,90 +0,0 @@ -{% extends "admin/base_site.html" %} - -{% load i18n %} - - -{% block breadcrumbs %} - -{% endblock %} - - -{% block content %} -
-

uWSGI status

-masterpid: {{masterpid}}
-started_on: {{started_on}}
-buffer size: {{buffer_size}}
-workers: {{numproc}}
-total requests: {{total_requests}}
- -
- -
- - - - - - - - - - - - - - - - -{% for w in workers %} - - - - - - - - - - - -{% endfor %} - -
workers
idpidrequestsrunning time (milliseconds)loadlast spawnrespawn countaddress space (vsz)resident memory (rss)
{{w.id}}{{w.pid}}{{w.requests}}{{w.running_time}}{{w.load|floatformat:2}} %{{w.last_spawn_str}}{{w.respawn_count}}{{w.vsz|filesizeformat}}{{w.rss|filesizeformat}}
-
- -
- - - - - - - - - -{% for j in jobs %} - - - - -{% endfor %} - -
spooler jobs
job filenameenvironment
{{j.file}}{{j.env}}
-
- -{% if masterpid %} -
-
-{% csrf_token %} - -
-{% endif %} - -
- -{% endblock %} - diff --git a/django/uwsgi_admin/urls.py b/django/uwsgi_admin/urls.py deleted file mode 100644 index 0597e926b4..0000000000 --- a/django/uwsgi_admin/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -import sys, os -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from django.conf.urls.defaults import * - -urlpatterns = patterns('uwsgi_admin.views', - (r'^$', 'index'), - (r'^reload/$', 'reload') - ) - diff --git a/django/uwsgi_admin/views.py b/django/uwsgi_admin/views.py deleted file mode 100644 index 22c997966d..0000000000 --- a/django/uwsgi_admin/views.py +++ /dev/null @@ -1,42 +0,0 @@ -import uwsgi -import time -from django.shortcuts import render_to_response -from django.template import RequestContext -from django.contrib.admin.views.decorators import staff_member_required -from django.core.urlresolvers import reverse -from django.http import HttpResponseRedirect - - -def index(request): - workers = uwsgi.workers() - total_load = time.time() - uwsgi.started_on - for w in workers: - w['load'] = (100 * (w['running_time']/1000))/total_load - w['last_spawn_str'] = time.ctime(w['last_spawn']) - - jobs = [] - if 'spooler' in uwsgi.opt: - spooler_jobs = uwsgi.spooler_jobs() - for j in spooler_jobs: - jobs.append({'file': j, 'env': uwsgi.parsefile(j)}) - - return render_to_response('uwsgi.html', {'masterpid': uwsgi.masterpid(), - 'started_on': time.ctime(uwsgi.started_on), - 'buffer_size': uwsgi.buffer_size, - 'total_requests': uwsgi.total_requests(), - 'numproc': uwsgi.numproc, - 'workers': workers, - 'jobs': jobs, - }, RequestContext(request, {})) -index = staff_member_required(index) - -def reload(request): - if uwsgi.masterpid() > 0: - uwsgi.reload() - request.user.message_set.create(message="uWSGI reloaded") - else: - request.user.message_set.create(message="The uWSGI master process is not active") - - return HttpResponseRedirect(reverse(index)) - -reload = staff_member_required(reload) diff --git a/django/uwsgitemplate.py b/django/uwsgitemplate.py deleted file mode 100644 index 525c155d76..0000000000 --- a/django/uwsgitemplate.py +++ /dev/null @@ -1,29 +0,0 @@ -from django.template.base import TemplateDoesNotExist -from django.template.loader import BaseLoader -from django.conf import settings - -try: - import uwsgi - on_uwsgi = True -except: - on_uwsgi = False - - - - -class Loader(BaseLoader): - - is_usable = on_uwsgi - - def symbolize(self, name): - return name.replace('.','_').replace('/','_').replace('-','_') - - def load_template_source(self, template_name, template_dirs=None): - filename = 'templates_' + self.symbolize(template_name) - for app in settings.INSTALLED_APPS: - try: - symbol = "%s_%s" % (self.symbolize(app), filename) - return (uwsgi.embedded_data(symbol), "sym://%s" % symbol) - except: - pass - raise TemplateDoesNotExist(template_name) diff --git a/plugins/cache/cache.c b/plugins/cache/cache.c index a160288ff0..9dec2d4565 100644 --- a/plugins/cache/cache.c +++ b/plugins/cache/cache.c @@ -63,7 +63,7 @@ int uwsgi_cache_request(struct wsgi_request *wsgi_req) { case 2: // del if (wsgi_req->uh.pktsize > 0) { - uwsgi_cache_del(wsgi_req->buffer, wsgi_req->uh.pktsize, 0); + uwsgi_cache_del(wsgi_req->buffer, wsgi_req->uh.pktsize, 0, 0); } break; case 3: diff --git a/plugins/carbon/carbon.c b/plugins/carbon/carbon.c index f0a3f41228..6fa81e08ed 100644 --- a/plugins/carbon/carbon.c +++ b/plugins/carbon/carbon.c @@ -82,7 +82,7 @@ void carbon_post_init() { // set next update to now()+retry_delay, this way we will have first flush just after start u_carbon.last_update = uwsgi_now() - u_carbon.freq + u_carbon.retry_delay; - uwsgi_log("[carbon] carbon plugin started, %is frequency, %is timeout, max retries %i, retry delay %is", + uwsgi_log("[carbon] carbon plugin started, %is frequency, %is timeout, max retries %i, retry delay %is\n", u_carbon.freq, u_carbon.timeout, u_carbon.max_retries, u_carbon.retry_delay); } @@ -137,7 +137,7 @@ void carbon_push_stats(int retry_cycle) { u_carbon.need_retry = 1; u_carbon.next_retry = uwsgi_now() + u_carbon.retry_delay; } else { - uwsgi_log("[carbon] Maximum number of retries for %s (1)\n", + uwsgi_log("[carbon] Maximum number of retries for %s (%d)\n", usl->value, u_carbon.max_retries); usl->healthy = 0; usl->errors = 0; diff --git a/plugins/cheaper_busyness/cheaper_busyness.c b/plugins/cheaper_busyness/cheaper_busyness.c index cb3e45836c..f55927118b 100644 --- a/plugins/cheaper_busyness/cheaper_busyness.c +++ b/plugins/cheaper_busyness/cheaper_busyness.c @@ -78,7 +78,7 @@ void set_next_cheap_time(void) { // to have quicker recovery from big but short load spikes // otherwise we might wait a lot before cheaping all emergency workers if (uwsgi_cheaper_busyness_global.verbose) - uwsgi_log("[busyness] %d emergency worker(s) running, using %d seconds cheaper timer\n", + uwsgi_log("[busyness] %d emergency worker(s) running, using %llu seconds cheaper timer\n", uwsgi_cheaper_busyness_global.emergency_workers, uwsgi.cheaper_overload*uwsgi_cheaper_busyness_global.backlog_multi); uwsgi_cheaper_busyness_global.next_cheap = now + uwsgi.cheaper_overload*uwsgi_cheaper_busyness_global.backlog_multi*1000000; } else { @@ -95,7 +95,7 @@ void decrease_multi(void) { // will decrease multiplier but only down to initial value if (uwsgi_cheaper_busyness_global.cheap_multi > uwsgi_cheaper_busyness_global.min_multi) { uwsgi_cheaper_busyness_global.cheap_multi--; - uwsgi_log("[busyness] decreasing cheaper multiplier to %d\n", uwsgi_cheaper_busyness_global.cheap_multi); + uwsgi_log("[busyness] decreasing cheaper multiplier to %llu\n", uwsgi_cheaper_busyness_global.cheap_multi); } } @@ -157,7 +157,7 @@ int cheaper_busyness_algo(void) { // store initial multiplier so we don't loose its initial value uwsgi_cheaper_busyness_global.min_multi = uwsgi_cheaper_busyness_global.cheap_multi; // since this is first run we will print current values - uwsgi_log("[busyness] settings: min=%d%%, max=%d%%, overload=%d, multiplier=%d, respawn penalty=%d\n", + uwsgi_log("[busyness] settings: min=%llu%%, max=%llu%%, overload=%llu, multiplier=%llu, respawn penalty=%llu\n", uwsgi_cheaper_busyness_global.busyness_min, uwsgi_cheaper_busyness_global.busyness_max, uwsgi.cheaper_overload, uwsgi_cheaper_busyness_global.cheap_multi, uwsgi_cheaper_busyness_global.penalty); #ifdef __linux__ @@ -171,7 +171,7 @@ int cheaper_busyness_algo(void) { if (uwsgi_cheaper_busyness_global.next_cheap == 0) set_next_cheap_time(); - int64_t active_workers = 0; + int active_workers = 0; uint64_t total_busyness = 0; uint64_t avg_busyness = 0; @@ -195,7 +195,7 @@ int cheaper_busyness_algo(void) { if (percent > 100) percent = 100; total_busyness += percent; if (uwsgi_cheaper_busyness_global.verbose && active_workers > 1) - uwsgi_log("[busyness] worker nr %d %ds average busyness is at %d%%\n", + uwsgi_log("[busyness] worker nr %d %llus average busyness is at %llu%%\n", i+1, uwsgi.cheaper_overload, percent); } uwsgi_cheaper_busyness_global.last_values[i] = uwsgi.workers[i+1].running_time; @@ -204,7 +204,7 @@ int cheaper_busyness_algo(void) { avg_busyness = (active_workers ? total_busyness / active_workers : 0); if (uwsgi_cheaper_busyness_global.verbose) uwsgi_log("[busyness] %ds average busyness of %d worker(s) is at %d%%\n", - uwsgi.cheaper_overload, active_workers, avg_busyness); + (int) uwsgi.cheaper_overload, (int) active_workers, (int) avg_busyness); if (avg_busyness > uwsgi_cheaper_busyness_global.busyness_max) { @@ -229,7 +229,7 @@ int cheaper_busyness_algo(void) { // worker was cheaped and then spawned back in less than current multiplier*cheaper_overload seconds // we will increase the multiplier so that next time worker will need to wait longer before being cheaped uwsgi_cheaper_busyness_global.cheap_multi += uwsgi_cheaper_busyness_global.penalty; - uwsgi_log("[busyness] worker(s) respawned to fast, increasing chpeaper multiplier to %d (+%d)\n", + uwsgi_log("[busyness] worker(s) respawned to fast, increasing chpeaper multiplier to %llu (+%llu)\n", uwsgi_cheaper_busyness_global.cheap_multi, uwsgi_cheaper_busyness_global.penalty); } else { decrease_multi(); @@ -237,10 +237,10 @@ int cheaper_busyness_algo(void) { set_next_cheap_time(); - uwsgi_log("[busyness] %ds average busyness is at %d%%, will spawn %d new worker(s)\n", + uwsgi_log("[busyness] %llus average busyness is at %llu%%, will spawn %d new worker(s)\n", uwsgi.cheaper_overload, avg_busyness, decheaped); } else { - uwsgi_log("[busyness] %ds average busyness is at %d%% but we already started maximum number of workers (%d)\n", + uwsgi_log("[busyness] %llus average busyness is at %llu%% but we already started maximum number of workers (%d)\n", uwsgi.cheaper_overload, avg_busyness, uwsgi.numproc); } @@ -267,8 +267,8 @@ int cheaper_busyness_algo(void) { if (uwsgi_cheaper_busyness_global.last_action == 2) decrease_multi(); set_next_cheap_time(); - uwsgi_log("[busyness] %ds average busyness is at %d%%, cheap one of %d running workers\n", - uwsgi.cheaper_overload, avg_busyness, active_workers); + uwsgi_log("[busyness] %llus average busyness is at %llu%%, cheap one of %d running workers\n", + uwsgi.cheaper_overload, avg_busyness, (int) active_workers); // store timestamp uwsgi_cheaper_busyness_global.last_cheaped = uwsgi_micros(); @@ -280,7 +280,7 @@ int cheaper_busyness_algo(void) { return -1; } else if (uwsgi_cheaper_busyness_global.verbose) - uwsgi_log("[busyness] need to wait %d more second(s) to cheap worker\n", (uwsgi_cheaper_busyness_global.next_cheap - now)/1000000); + uwsgi_log("[busyness] need to wait %llu more second(s) to cheap worker\n", (uwsgi_cheaper_busyness_global.next_cheap - now)/1000000); } } else { @@ -301,14 +301,14 @@ int cheaper_busyness_algo(void) { // time needed to cheap them, than a lot min + +extern struct uwsgi_server uwsgi; + +// this is the command manager +static void uwsgi_imperial_monitor_zeromq_cmd(struct uwsgi_emperor_scanner *ues) { + int64_t more = 0; + size_t more_size = sizeof(more); + int i; + zmq_msg_t msg[5]; + + zmq_msg_init(&msg[0]); + zmq_msg_init(&msg[1]); + zmq_msg_init(&msg[2]); + zmq_msg_init(&msg[3]); + zmq_msg_init(&msg[4]); + + for(i=0;i<5;i++) { +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3,0,0) + zmq_recvmsg(ues->data, &msg[i], ZMQ_DONTWAIT); +#else + zmq_recv(ues->data, &msg[i], ZMQ_NOBLOCK); +#endif + if (zmq_getsockopt(ues->data, ZMQ_RCVMORE, &more, &more_size)) { + uwsgi_error("zmq_getsockopt()"); + break; + } + if (!more && i < 4) break; + } + + if (i < 1) { + uwsgi_log("[emperor-zeromq] bad message received (command and instance name required)\n"); + return; + } + + char *ez_cmd = zmq_msg_data(&msg[0]); + size_t ez_cmd_len = zmq_msg_size(&msg[0]); + + char *ez_name = zmq_msg_data(&msg[1]); + size_t ez_name_len = zmq_msg_size(&msg[1]); + + char *ez_config = NULL; + size_t ez_config_len = 0; + + char *ez_uid = NULL; + size_t ez_uid_len = 0; + + char *ez_gid = NULL; + size_t ez_gid_len = 0; + + // config + if (i > 1) { + ez_config = zmq_msg_data(&msg[2]); + ez_config_len = zmq_msg_size(&msg[2]); + } + + // uid + if (i > 2) { + ez_uid = zmq_msg_data(&msg[3]); + ez_uid_len = zmq_msg_size(&msg[3]); + } + + // gid + if (i > 3) { + ez_gid = zmq_msg_data(&msg[4]); + ez_gid_len = zmq_msg_size(&msg[4]); + } + + char *name = uwsgi_concat2n(ez_name, ez_name_len, "", 0); + + // ok let's start checking commands + if (!uwsgi_strncmp(ez_cmd, ez_cmd_len, "touch", 5)) { + + char *config = NULL; + if (ez_config_len > 0) { + config = uwsgi_concat2n(ez_config, ez_config_len, "", 0); + } + + uid_t vassal_uid = 0; + gid_t vassal_gid = 0; + if (ez_uid_len > 0) { + vassal_uid = uwsgi_str_num(ez_uid, ez_uid_len); + } + if (ez_gid_len > 0) { + vassal_gid = uwsgi_str_num(ez_gid, ez_gid_len); + } + + uwsgi_emperor_simple_do(ues, name, config, uwsgi_now(), vassal_uid, vassal_gid); + if (config) { + free(config); + } + } + // destroy an instance + else if (!uwsgi_strncmp(ez_cmd, ez_cmd_len, "destroy", 6)) { + struct uwsgi_instance *ui = emperor_get(name); + if (!ui) { + uwsgi_log("[emperor-zeromq] unknown instance \"%s\"\n", name); + } + else { + emperor_stop(ui); + } + } + else { + uwsgi_log("[emperor-zeromq] unkonwn command \"%.*s\"\n", (int)ez_cmd_len, ez_cmd); + } + + free(name); + + zmq_msg_close(&msg[0]); + zmq_msg_close(&msg[1]); + zmq_msg_close(&msg[2]); + zmq_msg_close(&msg[3]); + zmq_msg_close(&msg[4]); +} + +// this is the event manager +static void uwsgi_imperial_monitor_zeromq_event(struct uwsgi_emperor_scanner *ues) { + + for(;;) { + uint32_t zmq_events = 0; + size_t opt_len = sizeof(uint32_t); + + int ret = zmq_getsockopt(ues->data, ZMQ_EVENTS, &zmq_events, &opt_len); + if (ret < 0) { + uwsgi_error("zmq_getsockopt()"); + return; + } + + if (zmq_events & ZMQ_POLLIN) { + uwsgi_imperial_monitor_zeromq_cmd(ues); + continue; + } + break; + } + +} + + +// initialize the zmq PULL socket +static void uwsgi_imperial_monitor_zeromq_init(struct uwsgi_emperor_scanner *ues) { + + void *context = uwsgi_zeromq_init(); + + ues->data = zmq_socket(context, ZMQ_PULL); + if (!ues->data) { + uwsgi_error("zmq_socket()"); + exit(1); + } + + if (zmq_bind(ues->data, ues->arg+6)) { + uwsgi_error("zmq_socket()"); + exit(1); + } + + size_t zmq_socket_len = sizeof(int); + if (zmq_getsockopt(ues->data, ZMQ_FD, &ues->fd, &zmq_socket_len) < 0) { + uwsgi_error("zmq_getsockopt()"); + exit(1); + } + + ues->event_func = uwsgi_imperial_monitor_zeromq_event; + + event_queue_add_fd_read(uwsgi.emperor_queue, ues->fd); +} + + +// noop +static void uwsgi_imperial_monitor_zeromq(struct uwsgi_emperor_scanner *ues) { + return; +} + + +void emperor_zeromq_init(void) { + uwsgi_register_imperial_monitor("zmq", uwsgi_imperial_monitor_zeromq_init, uwsgi_imperial_monitor_zeromq); +} + + + +struct uwsgi_plugin emperor_zeromq_plugin = { + .name = "emperor_zeromq", + .on_load = emperor_zeromq_init, +}; + +#else +#error the uWSGI ZeroMQ imperial monitor requires uWSGI zeromq support +#endif diff --git a/plugins/emperor_zeromq/uwsgiplugin.py b/plugins/emperor_zeromq/uwsgiplugin.py new file mode 100644 index 0000000000..5b4211e5fa --- /dev/null +++ b/plugins/emperor_zeromq/uwsgiplugin.py @@ -0,0 +1,7 @@ + +NAME='emperor_zeromq' +CFLAGS = [] +LDFLAGS = [] +LIBS = [] + +GCC_LIST = ['emperor_zeromq'] diff --git a/plugins/gevent/gevent.c b/plugins/gevent/gevent.c index 251c5c19a5..d3fcd71704 100644 --- a/plugins/gevent/gevent.c +++ b/plugins/gevent/gevent.c @@ -253,6 +253,8 @@ ssize_t uwsgi_gevent_hook_input_read(struct wsgi_request *wsgi_req, char *tmp_bu UWSGI_RELEASE_GIL; ssize_t rlen = read(wsgi_req->poll.fd, tmp_buf+*tmp_pos, remains); if (rlen <= 0) { + if (rlen < 0) + uwsgi_error("[uwsgi-gevent] read()"); UWSGI_GET_GIL stop_the_watchers_and_clear return -1; diff --git a/plugins/http/http.c b/plugins/http/http.c index 407df13259..9de622563a 100644 --- a/plugins/http/http.c +++ b/plugins/http/http.c @@ -22,8 +22,10 @@ struct uwsgi_http { int keepalive; #ifdef UWSGI_SSL + char *https_session_context; int https_export_cert; #endif + struct uwsgi_string_list *stud_prefix; } uhttp; @@ -68,7 +70,14 @@ void uwsgi_opt_https(char *opt, char *value, void *cr) { } // initialize ssl context - ugs->ctx = uwsgi_ssl_new_server_context(uwsgi_concat3(ucr->short_name, "-", ugs->name),crt, key, ciphers, client_ca); + char *name = uhttp.https_session_context; + if (!name) { + name = uwsgi_concat3(ucr->short_name, "-", ugs->name); + } + ugs->ctx = uwsgi_ssl_new_server_context(name, crt, key, ciphers, client_ca); + if (!ugs->ctx) { + exit(1); + } // set the ssl mode ugs->mode = UWSGI_HTTP_SSL; @@ -102,6 +111,7 @@ struct uwsgi_option http_options[] = { #ifdef UWSGI_SSL {"https", required_argument, 0, "add an https router/server on the specified address with specified certificate and key", uwsgi_opt_https, &uhttp, 0}, {"https-export-cert", no_argument, 0, "export uwsgi variable HTTPS_CC containing the raw client certificate", uwsgi_opt_true, &uhttp.https_export_cert, 0}, + {"https-session-context", required_argument, 0, "set the session id context to the specified value", uwsgi_opt_set_str, &uhttp.https_session_context, 0}, {"http-to-https", required_argument, 0, "add an http router/server on the specified address and redirect all of the requests to https", uwsgi_opt_http_to_https, &uhttp, 0}, #endif {"http-processes", required_argument, 0, "set the number of http processes to spawn", uwsgi_opt_set_int, &uhttp.cr.processes, 0}, @@ -134,6 +144,7 @@ struct uwsgi_option http_options[] = { {"http-stats-server", required_argument, 0, "run the http router stats server", uwsgi_opt_set_str, &uhttp.cr.stats_server, 0}, {"http-ss", required_argument, 0, "run the http router stats server", uwsgi_opt_set_str, &uhttp.cr.stats_server, 0}, {"http-harakiri", required_argument, 0, "enable http router harakiri", uwsgi_opt_set_int, &uhttp.cr.harakiri, 0}, + {"http-stud-prefix", required_argument, 0, "expect a stud prefix (1byte family + 4/16 bytes address) on connections from the specified address", uwsgi_opt_add_addr_list, &uhttp.stud_prefix, 0}, {0, 0, 0, 0, 0, 0, 0}, }; @@ -175,6 +186,11 @@ struct http_session { size_t post_buf_len; off_t post_buf_pos; + // 1 (family) + 4/16 (addr) + char stud_prefix[17]; + size_t stud_prefix_remains; + size_t stud_prefix_pos; + }; @@ -399,9 +415,9 @@ int http_parse(struct http_session *h_session, size_t http_req_len) { while (ptr < watermark) { if (*ptr == '\r') { if (ptr + 1 >= watermark) - return 0; + break; if (*(ptr + 1) != '\n') - return 0; + break; // multiline header ? if (ptr + 2 < watermark) { if (*(ptr + 2) == ' ' || *(ptr + 2) == '\t') { @@ -518,6 +534,18 @@ ssize_t hr_read_ssl_body(struct corerouter_session * cs) { if (cs->event_hook_write) { uwsgi_cr_hook_write(cs, NULL); } + int ret2 = SSL_pending(hs->ssl); + if (ret2 > 0) { + if (uwsgi_buffer_fix(hs->post_buf, hs->post_buf->len + ret2 )) { + uwsgi_log("[uwsgi-https] cannot fix the buffer to %d\n", hs->post_buf->len + ret2); + return -1; + } + if (SSL_read(hs->ssl, hs->post_buf->buf + ret, ret2) != ret2) { + uwsgi_log("[uwsgi-https] SSL_read() on %d bytes of pending data failed\n", ret2); + return -1; + } + ret += ret2; + } hs->post_buf_len = ret; hs->post_buf_pos = 0; uwsgi_cr_hook_read(cs, NULL); @@ -908,7 +936,10 @@ ssize_t hr_recv_http_ssl(struct corerouter_session * cs) { // be sure buffer does not grow over 64k cs->buffer->limit = UMAX16; // try to always leave 4k available - if (uwsgi_buffer_ensure(cs->buffer, uwsgi.page_size)) return -1; + if (uwsgi_buffer_ensure(cs->buffer, uwsgi.page_size)) { + uwsgi_log("[uwsgi-https] cannot ensure the buffer (size: %d)\n", cs->buffer->len); + return -1; + } struct http_session *hs = (struct http_session *) cs; int ret = SSL_read(hs->ssl, cs->buffer->buf + cs->buffer_pos, cs->buffer->len - cs->buffer_pos); if (ret > 0) { @@ -919,8 +950,12 @@ ssize_t hr_recv_http_ssl(struct corerouter_session * cs) { } int ret2 = SSL_pending(hs->ssl); if (ret2 > 0) { - if (uwsgi_buffer_fix(cs->buffer, cs->buffer->len + ret2 )) return -1; + if (uwsgi_buffer_fix(cs->buffer, cs->buffer->len + ret2 )) { + uwsgi_log("[uwsgi-https] cannot fix the buffer to %d\n", cs->buffer->len + ret2 ); + return -1; + } if (SSL_read(hs->ssl, cs->buffer->buf + cs->buffer_pos + ret, ret2) != ret2) { + uwsgi_log("[uwsgi-https] SSL_read() on %d bytes of pending data failed\n", ret2); return -1; } ret += ret2; @@ -1063,6 +1098,31 @@ void hr_session_close(struct corerouter_session *cs) { } } +static ssize_t hr_recv_stud4(struct corerouter_session * cs) { + struct http_session *hs = (struct http_session *) cs; + ssize_t len = read(cs->fd, hs->stud_prefix + hs->stud_prefix_pos, hs->stud_prefix_remains - hs->stud_prefix_pos); + if (len < 0) { + cr_try_again; + uwsgi_error("hr_recv_stud4()"); + return -1; + } + + hs->stud_prefix_pos += len; + + if (hs->stud_prefix_pos == hs->stud_prefix_remains) { + if (hs->stud_prefix[0] != AF_INET) { + uwsgi_log("[uwsgi-http] invalid stud prefix\n"); + return -1; + } + // set the passed ip address + memcpy(&hs->ip_addr, hs->stud_prefix + 1, 4); + uwsgi_cr_hook_read(cs, hr_recv_http); + } + + return len; + +} + #ifdef UWSGI_SSL void hr_session_ssl_close(struct corerouter_session *cs) { hr_session_close(cs); @@ -1093,6 +1153,17 @@ void http_alloc_session(struct uwsgi_corerouter *ucr, struct uwsgi_gateway_socke cs->modifier1 = uhttp.modifier1; if (sa && sa->sa_family == AF_INET) { hs->ip_addr = ((struct sockaddr_in *) sa)->sin_addr.s_addr; + + struct uwsgi_string_list *usl = uhttp.stud_prefix; + while(usl) { + if (!memcmp(&hs->ip_addr, usl->value, 4)) { + hs->stud_prefix_remains = 5; + uwsgi_cr_hook_read(cs, hr_recv_stud4); + break; + } + usl = usl->next; + } + } hs->rnrn = 0; @@ -1114,7 +1185,9 @@ void http_alloc_session(struct uwsgi_corerouter *ucr, struct uwsgi_gateway_socke } else { #endif - uwsgi_cr_hook_read(cs, hr_recv_http); + if (!cs->event_hook_read) { + uwsgi_cr_hook_read(cs, hr_recv_http); + } cs->close = hr_session_close; #ifdef UWSGI_SSL } diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c index ea69cc6ec6..6a2a2a9d3d 100644 --- a/plugins/lua/lua_plugin.c +++ b/plugins/lua/lua_plugin.c @@ -323,7 +323,7 @@ static int uwsgi_lua_input(lua_State *L) { sum = lua_tonumber(L, 2); if (n > 1) { - uwsgi_log("requested %d bytes\n", sum); + uwsgi_log("requested %ld bytes\n", (long) sum); } buf = uwsgi_malloc(sum); @@ -666,7 +666,7 @@ uint16_t uwsgi_lua_rpc(void * func, uint8_t argc, char **argv, uint16_t argvs[], sv = lua_tolstring(L, -1, &sl); - uwsgi_log("sv = %s sl = %d\n", sv, sl); + uwsgi_log("sv = %s sl = %lu\n", sv, (unsigned long) sl); if (sl <= 0xffff) { memcpy(buffer, sv, sl); return sl; diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c index efa02bbea2..53d62892a7 100644 --- a/plugins/php/php_plugin.c +++ b/plugins/php/php_plugin.c @@ -23,6 +23,7 @@ struct uwsgi_php { struct uwsgi_string_list *set; struct uwsgi_string_list *append_config; struct uwsgi_regexp_list *app_bypass; + struct uwsgi_string_list *vars; char *docroot; char *app; char *app_qs; @@ -53,6 +54,7 @@ struct uwsgi_option uwsgi_php_options[] = { {"php-app", required_argument, 0, "force the php file to run at each request", uwsgi_opt_set_str, &uphp.app, 0}, {"php-app-qs", required_argument, 0, "when in app mode force QUERY_STRING to the specified value + REQUEST_URI", uwsgi_opt_set_str, &uphp.app_qs, 0}, {"php-app-bypass", required_argument, 0, "if the regexp matches the uri the --php-app is bypassed", uwsgi_opt_add_regexp_list, &uphp.app_bypass, 0}, + {"php-var", required_argument, 0, "add/overwrite a CGI variable at each request", uwsgi_opt_add_string_list, &uphp.vars, 0}, {"php-dump-config", no_argument, 0, "dump php config (if modified via --php-set or append options)", uwsgi_opt_true, &uphp.dump_config, 0}, {0, 0, 0, 0, 0, 0, 0}, @@ -311,6 +313,16 @@ static void sapi_uwsgi_register_variables(zval *track_vars_array TSRMLS_DC) php_register_variable_safe("PHP_SELF", wsgi_req->script_name, wsgi_req->script_name_len, track_vars_array TSRMLS_CC); + struct uwsgi_string_list *usl = uphp.vars; + while(usl) { + char *equal = strchr(usl->value, '='); + if (equal) { + php_register_variable_safe( estrndup(usl->value, equal-usl->value), + equal+1, strlen(equal+1), track_vars_array TSRMLS_CC); + } + usl = usl->next; + } + } @@ -371,7 +383,7 @@ PHP_FUNCTION(uwsgi_cache_del) { } uwsgi_wlock(uwsgi.cache_lock); - if (uwsgi_cache_del(key, keylen, 0)) { + if (uwsgi_cache_del(key, keylen, 0, 0)) { uwsgi_rwunlock(uwsgi.cache_lock); RETURN_TRUE; } @@ -665,6 +677,16 @@ int uwsgi_php_init(void) { uwsgi_log("--- end of PHP custom config ---\n"); } + // fix docroot + if (uphp.docroot) { + char *orig_docroot = uphp.docroot; + uphp.docroot = uwsgi_expand_path(uphp.docroot, strlen(uphp.docroot), NULL); + if (!uphp.docroot) { + uwsgi_log("unable to set php docroot to %s\n", orig_docroot); + exit(1); + } + } + uwsgi_sapi_module.startup(&uwsgi_sapi_module); // filling http status codes @@ -930,7 +952,6 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) { secure3: - if (wsgi_req->document_root[wsgi_req->document_root_len-1] == '/') { wsgi_req->script_name = real_filename + (wsgi_req->document_root_len-1); } diff --git a/plugins/psgi/psgi_loader.c b/plugins/psgi/psgi_loader.c index 369d806b37..fb1d562676 100644 --- a/plugins/psgi/psgi_loader.c +++ b/plugins/psgi/psgi_loader.c @@ -197,7 +197,7 @@ XS(XS_error_print) { if (items > 1) { body = SvPV(ST(1), blen); - uwsgi_log("%.*s", blen, body); + uwsgi_log("%.*s", (int) blen, body); } XSRETURN(0); diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 2f20c3d948..e9ba4cb49e 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -3277,7 +3277,7 @@ PyObject *py_uwsgi_cache_clear(PyObject * self, PyObject * args) { for (i = 1; i < uwsgi.cache_max_items; i++) { UWSGI_RELEASE_GIL uwsgi_wlock(uwsgi.cache_lock); - uwsgi_cache_del(NULL, 0, i); + uwsgi_cache_del(NULL, 0, i, 0); uwsgi_rwunlock(uwsgi.cache_lock); UWSGI_GET_GIL } @@ -3305,7 +3305,7 @@ PyObject *py_uwsgi_cache_del(PyObject * self, PyObject * args) { else if (uwsgi.cache_max_items) { UWSGI_RELEASE_GIL uwsgi_wlock(uwsgi.cache_lock); - if (uwsgi_cache_del(key, keylen, 0)) { + if (uwsgi_cache_del(key, keylen, 0, 0)) { uwsgi_rwunlock(uwsgi.cache_lock); UWSGI_GET_GIL Py_INCREF(Py_None); diff --git a/plugins/python/wsgi_handlers.c b/plugins/python/wsgi_handlers.c index 6238cf159c..d958daac3b 100644 --- a/plugins/python/wsgi_handlers.c +++ b/plugins/python/wsgi_handlers.c @@ -180,11 +180,11 @@ static PyObject *uwsgi_Input_read(uwsgi_Input *self, PyObject *args) { ssize_t rlen = up.hook_wsgi_input_read(self->wsgi_req, tmp_buf, remains, &tmp_pos); if (rlen < 0) { free(tmp_buf); - return PyErr_Format(PyExc_IOError, "error reading for wsgi.input data: Content-Length %llu requested %llu received %llu", (unsigned long long) self->wsgi_req->post_cl, (unsigned long long) (remains + tmp_pos), (unsigned long long) tmp_pos); + return PyErr_Format(PyExc_IOError, "error reading for wsgi.input data: Content-Length %llu requested %llu received %llu pos %llu+%llu", (unsigned long long) self->wsgi_req->post_cl, (unsigned long long) remains, (unsigned long long) tmp_pos, (unsigned long long) self->pos, (unsigned long long) tmp_pos); } - else if (tmp_pos == 0) { + else if (rlen == 0) { free(tmp_buf); - return PyErr_Format(PyExc_IOError, "error waiting for wsgi.input data: Content-Length %llu requested %llu received %llu", (unsigned long long) self->wsgi_req->post_cl, (unsigned long long) (remains + tmp_pos), (unsigned long long) tmp_pos); + return PyErr_Format(PyExc_IOError, "error waiting for wsgi.input data: Content-Length %llu requested %llu received %llu pos %llu+%llu", (unsigned long long) self->wsgi_req->post_cl, (unsigned long long) remains, (unsigned long long) tmp_pos, (unsigned long long) self->pos, (unsigned long long) tmp_pos); } self->pos += tmp_pos; diff --git a/plugins/rack/rack_api.c b/plugins/rack/rack_api.c index 1436ad8506..a3e6b0059c 100644 --- a/plugins/rack/rack_api.c +++ b/plugins/rack/rack_api.c @@ -348,7 +348,7 @@ VALUE rack_uwsgi_cache_del(VALUE *class, VALUE rbkey) { size_t keylen = RSTRING_LEN(rbkey); uwsgi_wlock(uwsgi.cache_lock); - if (uwsgi_cache_del(key, keylen, 0)) { + if (uwsgi_cache_del(key, keylen, 0, 0)) { uwsgi_rwunlock(uwsgi.cache_lock); return Qfalse; } diff --git a/plugins/rack/rack_plugin.c b/plugins/rack/rack_plugin.c index 2cbc259b37..0377cc4fc8 100644 --- a/plugins/rack/rack_plugin.c +++ b/plugins/rack/rack_plugin.c @@ -869,7 +869,7 @@ int uwsgi_rack_request(struct wsgi_request *wsgi_req) { if (TYPE(ret) == T_ARRAY) { if (RARRAY_LEN(ret) != 3) { - uwsgi_log("Invalid RACK response size: %d\n", RARRAY_LEN(ret)); + uwsgi_log("Invalid RACK response size: %ld\n", RARRAY_LEN(ret)); return -1; } diff --git a/plugins/router_http/router_http.c b/plugins/router_http/router_http.c index 5c5c75c082..eff044b4a1 100644 --- a/plugins/router_http/router_http.c +++ b/plugins/router_http/router_http.c @@ -12,13 +12,24 @@ int uwsgi_routing_func_http(struct wsgi_request *wsgi_req, struct uwsgi_route *u // get the http address from the route char *addr = ur->data; + char *uri = NULL; + uint16_t uri_len = 0; + if (ur->data3_len) { + uri = uwsgi_regexp_apply_ovec(wsgi_req->uri, wsgi_req->uri_len, ur->data3, ur->data3_len, ur->ovector, ur->ovn); + uri_len = strlen(uri); + } + + // convert the wsgi_request to an http proxy request - struct uwsgi_buffer *ub = uwsgi_to_http(wsgi_req, ur->data2, ur->data2_len); + struct uwsgi_buffer *ub = uwsgi_to_http(wsgi_req, ur->data2, ur->data2_len, uri, uri_len); if (!ub) { + if (uri) free(uri); uwsgi_log("unable to generate http request for %s\n", addr); return UWSGI_ROUTE_NEXT; } + if (uri) free(uri); + // ok now if have offload threads, directly use them if (wsgi_req->socket->can_offload) { if (!uwsgi_offload_request_net_do(wsgi_req, addr, ub)) { @@ -86,6 +97,12 @@ int uwsgi_router_http(struct uwsgi_route *ur, char *args) { *comma = 0; ur->data_len = strlen(ur->data); ur->data2 = comma+1; + comma = strchr(ur->data2, ','); + if (comma) { + *comma = 0; + ur->data3 = comma+1; + ur->data3_len = strlen(ur->data3); + } ur->data2_len = strlen(ur->data2); } return 0; diff --git a/plugins/router_rewrite/router_rewrite.c b/plugins/router_rewrite/router_rewrite.c index 46230e9493..e068293dbb 100644 --- a/plugins/router_rewrite/router_rewrite.c +++ b/plugins/router_rewrite/router_rewrite.c @@ -5,6 +5,8 @@ extern struct uwsgi_server uwsgi; int uwsgi_routing_func_rewrite(struct wsgi_request *wsgi_req, struct uwsgi_route *ur) { + char *tmp_qs = NULL; + char **subject = (char **) (((char *)(wsgi_req))+ur->subject); uint16_t *subject_len = (uint16_t *) (((char *)(wsgi_req))+ur->subject_len); @@ -18,10 +20,21 @@ int uwsgi_routing_func_rewrite(struct wsgi_request *wsgi_req, struct uwsgi_route path_info_len = query_string - path_info; query_string++; query_string_len = strlen(query_string); - + if (wsgi_req->query_string_len > 0) { + tmp_qs = uwsgi_concat4n(query_string, query_string_len, "&", 1, wsgi_req->query_string, wsgi_req->query_string_len, "", 0); + query_string = tmp_qs; + query_string_len = strlen(query_string); + } } + // over engineering, could be requiredin the future... else { - query_string = ""; + if (wsgi_req->query_string_len > 0) { + query_string = wsgi_req->query_string; + query_string_len = wsgi_req->query_string_len; + } + else { + query_string = ""; + } } char *ptr = uwsgi_req_append(wsgi_req, "PATH_INFO", 9, path_info, path_info_len); @@ -39,12 +52,14 @@ int uwsgi_routing_func_rewrite(struct wsgi_request *wsgi_req, struct uwsgi_route wsgi_req->query_string_len = query_string_len; free(path_info); + if (tmp_qs) free(tmp_qs); if (ur->custom) return UWSGI_ROUTE_CONTINUE; return UWSGI_ROUTE_NEXT; clear: free(path_info); + if (tmp_qs) free(tmp_qs); return UWSGI_ROUTE_BREAK; } diff --git a/proto/http.c b/proto/http.c index 89bef89b68..42d987a4c7 100644 --- a/proto/http.c +++ b/proto/http.c @@ -393,14 +393,19 @@ void uwsgi_httpize_var(char *buf, size_t len) { } } -struct uwsgi_buffer *uwsgi_to_http(struct wsgi_request *wsgi_req, char *host, uint16_t host_len) { +struct uwsgi_buffer *uwsgi_to_http(struct wsgi_request *wsgi_req, char *host, uint16_t host_len, char *uri, uint16_t uri_len) { struct uwsgi_buffer *ub = uwsgi_buffer_new(4096); if (uwsgi_buffer_append(ub, wsgi_req->method, wsgi_req->method_len)) goto clear; if (uwsgi_buffer_append(ub, " ", 1)) goto clear; - if (uwsgi_buffer_append(ub, wsgi_req->uri, wsgi_req->uri_len)) goto clear; + if (uri_len && uri) { + if (uwsgi_buffer_append(ub, uri, uri_len)) goto clear; + } + else { + if (uwsgi_buffer_append(ub, wsgi_req->uri, wsgi_req->uri_len)) goto clear; + } if (uwsgi_buffer_append(ub, " HTTP/1.0\r\n", 11)) goto clear; @@ -447,11 +452,22 @@ struct uwsgi_buffer *uwsgi_to_http(struct wsgi_request *wsgi_req, char *host, ui if (uwsgi_buffer_append(ub, "\r\n", 2)) goto clear; } + if (wsgi_req->content_type_len > 0) { + if (uwsgi_buffer_append(ub, "Content-Type: ", 14)) goto clear; + if (uwsgi_buffer_append(ub, wsgi_req->content_type, wsgi_req->content_type_len)) goto clear; + if (uwsgi_buffer_append(ub, "\r\n", 2)) goto clear; + } + + if (wsgi_req->post_cl > 0) { + if (uwsgi_buffer_append(ub, "Content-Length: ", 16)) goto clear; + if (uwsgi_buffer_num64(ub, (int64_t) wsgi_req->post_cl)) goto clear; + if (uwsgi_buffer_append(ub, "\r\n", 2)) goto clear; + } + // append required headers if (uwsgi_buffer_append(ub, "Connection: close\r\n", 19)) goto clear; if (uwsgi_buffer_append(ub, "X-Forwarded-For: ", 17)) goto clear; - if (x_forwarded_for_len > 0) { if (uwsgi_buffer_append(ub, x_forwarded_for, x_forwarded_for_len)) goto clear; if (uwsgi_buffer_append(ub, ", ", 2)) goto clear; diff --git a/tests/travis.sh b/tests/travis.sh index 5e386ff789..4b8f840812 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -95,12 +95,12 @@ test_rack() { while read PV ; do test_python $PV -done < <(cat .travis.yml | grep "plugins/python base" | awk '{print $7}') +done < <(cat .travis.yml | grep "plugins/python base" | sed s_".*plugins/python base "_""_g) while read RV ; do test_rack $RV -done < <(cat .travis.yml | grep "plugins/rack base" | awk '{print $8}') +done < <(cat .travis.yml | grep "plugins/rack base" | sed s_".*plugins/rack base "_""_g) echo "${bldgre}>>> $SUCCESS SUCCESSFUL PLUGIN(S)${txtrst}" diff --git a/uwsgi.h b/uwsgi.h index 62b24a495a..5697bf8ac9 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -37,7 +37,7 @@ extern "C" { #define thunder_lock if (uwsgi.threads > 1 && !uwsgi.is_et) {pthread_mutex_lock(&uwsgi.thunder_mutex);} #define thunder_unlock if (uwsgi.threads > 1 && !uwsgi.is_et) {pthread_mutex_unlock(&uwsgi.thunder_mutex);} -#define uwsgi_check_scheme(file) (!uwsgi_startswith(file, "http://", 7) || !uwsgi_startswith(file, "data://", 7) || !uwsgi_startswith(file, "sym://", 6) || !uwsgi_startswith(file, "fd://", 5) || !uwsgi_startswith(file, "exec://", 7) || !uwsgi_startswith(file, "section://", 10)) +#define uwsgi_check_scheme(file) (!uwsgi_startswith(file, "emperor://", 10) || !uwsgi_startswith(file, "http://", 7) || !uwsgi_startswith(file, "data://", 7) || !uwsgi_startswith(file, "sym://", 6) || !uwsgi_startswith(file, "fd://", 5) || !uwsgi_startswith(file, "exec://", 7) || !uwsgi_startswith(file, "section://", 10)) #define ushared uwsgi.shared @@ -132,6 +132,11 @@ extern char UWSGI_EMBED_CONFIG_END; #endif #endif #include +#ifdef __linux__ +#ifndef MSG_FASTOPEN +#define MSG_FASTOPEN 0x20000000 +#endif +#endif #undef _GNU_SOURCE #include @@ -149,6 +154,11 @@ extern char UWSGI_EMBED_CONFIG_END; #include #include #include +#ifdef __linux__ +#ifndef TCP_FASTOPEN +#define TCP_FASTOPEN 23 +#endif +#endif #include #ifdef __FreeBSD__ @@ -286,6 +296,8 @@ extern int pivot_root(const char *new_root, const char *put_old); #define UWSGI_CACHE_MAX_KEY_SIZE 2048 #define UWSGI_CACHE_FLAG_UNGETTABLE 0x0001 #define UWSGI_CACHE_FLAG_UPDATE 0x0002 +#define UWSGI_CACHE_FLAG_LOCAL 0x0004 +#define UWSGI_CACHE_FLAG_ABSEXPIRE 0x0008 #define uwsgi_cache_update_start(x, y, z) uwsgi_cache_set(x, y, "", 0, CACHE_FLAG_UNGETTABLE) @@ -309,6 +321,7 @@ struct uwsgi_string_list { size_t len; uint64_t custom; uint64_t custom2; + void *custom_ptr; struct uwsgi_string_list *next; }; @@ -502,6 +515,35 @@ struct uwsgi_logger { struct uwsgi_logger *next; }; +#ifdef UWSGI_SSL +struct uwsgi_legion { + char *legion; + uint16_t legion_len; + uint64_t valor; + char *addr; + time_t lord; + time_t last_seen_lord; + char *name; + uint16_t name_len; + pid_t pid; + int socket; + EVP_CIPHER_CTX *encrypt_ctx; + EVP_CIPHER_CTX *decrypt_ctx; + struct uwsgi_string_list *nodes; + struct uwsgi_string_list *lord_hooks; + struct uwsgi_string_list *unlord_hooks; + struct uwsgi_string_list *setup_hooks; + struct uwsgi_string_list *death_hooks; + struct uwsgi_legion *next; +}; + +struct uwsgi_legion_action { + char *name; + int (*func)(struct uwsgi_legion *, char *); + struct uwsgi_legion_action *next; +}; +#endif + struct uwsgi_queue_header { uint64_t pos; uint64_t pull_pos; @@ -850,6 +892,9 @@ struct uwsgi_route { void *data2; size_t data2_len; + void *data3; + size_t data3_len; + // 64bit value for custom usage uint64_t custom; @@ -905,6 +950,7 @@ struct uwsgi_alarm_ll { struct uwsgi_alarm_log { pcre *pattern; pcre_extra *pattern_extra; + int negate; struct uwsgi_alarm_ll *alarms; struct uwsgi_alarm_log *next; }; @@ -1216,6 +1262,8 @@ struct uwsgi_server { // quiet startup int no_initial_output; + struct uwsgi_string_list *get_list; + // enable threads int has_threads; int no_threads_wait; @@ -1261,6 +1309,8 @@ struct uwsgi_server { uint64_t master_cycles; int reuse_port; + int tcp_fast_open; + int tcp_fast_open_client; // enable lazy mode int lazy; @@ -1588,6 +1638,7 @@ struct uwsgi_server { #ifdef UWSGI_MULTICAST int multicast_ttl; + int multicast_loop; char *multicast_group; #endif @@ -1833,6 +1884,10 @@ struct uwsgi_server { int cache_expire_freq; int cache_report_freed_items; + struct uwsgi_string_list *cache_udp_server; + struct uwsgi_string_list *cache_udp_node; + int cache_udp_node_socket; + char *cache_server; int cache_server_threads; int cache_server_fd; @@ -1886,6 +1941,20 @@ struct uwsgi_server { #ifdef UWSGI_SSL int ssl_initialized; int ssl_verbose; + int ssl_sessions_use_cache; + int ssl_sessions_timeout; +#ifdef UWSGI_PCRE + struct uwsgi_regexp_list *sni_regexp; +#endif + struct uwsgi_string_list *sni; +#endif + +#ifdef UWSGI_SSL + struct uwsgi_legion *legions; + struct uwsgi_legion_action *legion_actions; + int legion_queue; + int legion_freq; + int legion_tolerance; #endif #ifdef __linux__ @@ -2009,6 +2078,10 @@ struct uwsgi_shared { uint64_t cache_first_available_item; uint64_t cache_unused_stack_ptr; + uint64_t cache_hits; + uint64_t cache_miss; + uint64_t cache_items; + uint64_t cache_full; int worker_signal_pipe[2]; @@ -2410,7 +2483,7 @@ ssize_t uwsgi_send_message(int, uint8_t, uint8_t, char *, uint16_t, int, ssize_t char *uwsgi_cluster_best_node(void); int uwsgi_cache_set(char *, uint16_t, char *, uint64_t, uint64_t, uint16_t); -int uwsgi_cache_del(char *, uint16_t, uint64_t); +int uwsgi_cache_del(char *, uint16_t, uint64_t, uint16_t); char *uwsgi_cache_get(char *, uint16_t, uint64_t *); uint32_t uwsgi_cache_exists(char *, uint16_t); @@ -2993,6 +3066,8 @@ void uwsgi_opt_set_str(char *, char *, void *); void uwsgi_opt_set_logger(char *, char *, void *); void uwsgi_opt_set_str_spaced(char *, char *, void *); void uwsgi_opt_add_string_list(char *, char *, void *); +void uwsgi_opt_add_addr_list(char *, char *, void *); +void uwsgi_opt_add_string_list_custom(char *, char *, void *); void uwsgi_opt_add_dyn_dict(char *, char *, void *); #ifdef UWSGI_PCRE void uwsgi_opt_pcre_jit(char *, char *, void *); @@ -3018,6 +3093,10 @@ void uwsgi_opt_load(char *, char *, void *); void uwsgi_opt_cluster_log(char *, char *, void *); void uwsgi_opt_cluster_reload(char *, char *, void *); +#ifdef UWSGI_SSL +void uwsgi_opt_sni(char *, char *, void *); +#endif + void uwsgi_opt_flock(char *, char *, void *); void uwsgi_opt_flock_wait(char *, char *, void *); #ifdef UWSGI_INI @@ -3364,9 +3443,13 @@ int uwsgi_buffer_append(struct uwsgi_buffer *, char *, size_t); int uwsgi_buffer_fix(struct uwsgi_buffer *, size_t); int uwsgi_buffer_ensure(struct uwsgi_buffer *, size_t); void uwsgi_buffer_destroy(struct uwsgi_buffer *); +int uwsgi_buffer_u16le(struct uwsgi_buffer *, uint16_t); +int uwsgi_buffer_num64(struct uwsgi_buffer *, int64_t); +int uwsgi_buffer_append_keyval(struct uwsgi_buffer *, char *, uint16_t, char *, uint64_t); +int uwsgi_buffer_append_keynum(struct uwsgi_buffer *, char *, uint16_t, int64_t); void uwsgi_httpize_var(char *, size_t); -struct uwsgi_buffer *uwsgi_to_http(struct wsgi_request *, char *, uint16_t); +struct uwsgi_buffer *uwsgi_to_http(struct wsgi_request *, char *, uint16_t, char *, uint16_t); ssize_t uwsgi_pipe(int, int, int); ssize_t uwsgi_pipe_sized(int, int, size_t, int); @@ -3476,11 +3559,34 @@ void uwsgi_cache_wlock(void); void uwsgi_cache_rlock(void); void uwsgi_cache_rwunlock(void); +void *cache_sweeper_loop(void *); +void *cache_udp_server_loop(void *); + void uwsgi_user_lock(int); void uwsgi_user_unlock(int); void simple_loop_run_int(int); +char *uwsgi_strip(char *); + +#ifdef UWSGI_SSL +void uwsgi_opt_legion(char *, char *, void *); +void uwsgi_opt_legion_node(char *, char *, void *); +void uwsgi_opt_legion_hook(char *, char *, void *); +void uwsgi_legion_add(struct uwsgi_legion *); +char *uwsgi_ssl_rand(size_t); +void uwsgi_start_legions(void); +int uwsgi_legion_announce(struct uwsgi_legion *); +struct uwsgi_legion_action *uwsgi_legion_action_get(char *); +void uwsgi_legion_action_register(char *, int (*)(struct uwsgi_legion *, char *)); +int uwsgi_legion_action_call(char *, struct uwsgi_legion *, struct uwsgi_string_list *); +void uwsgi_legion_atexit(void); +#endif + +struct uwsgi_option *uwsgi_opt_get(char *); +int uwsgi_valid_fd(int); +void uwsgi_close_all_fds(void); + void uwsgi_check_emperor(void); #ifdef UWSGI_AS_SHARED_LIBRARY int uwsgi_init(int, char **, char **); diff --git a/uwsgicc/__init__.py b/uwsgicc/__init__.py deleted file mode 100644 index 9ea610e994..0000000000 --- a/uwsgicc/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -from uwsgicc import app - -import uwsgi - -def hello_world(name): - return "Hello World %s" % name - -uwsgi.register_rpc("hello", hello_world) - -uwsgi.set_warning_message("uWSGI is running the Control Center") - -application = app diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_flat_0_000000_40x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_flat_0_000000_40x100.png deleted file mode 100644 index abdc01082b..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_flat_0_000000_40x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png deleted file mode 100644 index 5b5dab2ab7..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_flat_100_ffffff_40x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_flat_100_ffffff_40x100.png deleted file mode 100644 index ac8b229af9..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_flat_100_ffffff_40x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_glass_55_d9e99f_1x400.png b/uwsgicc/static/css/custom-theme/images/ui-bg_glass_55_d9e99f_1x400.png deleted file mode 100644 index 24e5e57ca3..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_glass_55_d9e99f_1x400.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_highlight-hard_30_222222_1x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_highlight-hard_30_222222_1x100.png deleted file mode 100644 index c1b6fba257..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_highlight-hard_30_222222_1x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_highlight-soft_30_222222_1x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_highlight-soft_30_222222_1x100.png deleted file mode 100644 index 7ee62322e8..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_highlight-soft_30_222222_1x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_65_ffffff_1x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_65_ffffff_1x100.png deleted file mode 100644 index 5d8a1d6b74..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_65_ffffff_1x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_75_b1d630_1x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_75_b1d630_1x100.png deleted file mode 100644 index 0322070f95..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_75_b1d630_1x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png b/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png deleted file mode 100644 index 0e05810fff..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-icons_000000_256x240.png b/uwsgicc/static/css/custom-theme/images/ui-icons_000000_256x240.png deleted file mode 100644 index 7c211aa089..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-icons_000000_256x240.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-icons_2e83ff_256x240.png b/uwsgicc/static/css/custom-theme/images/ui-icons_2e83ff_256x240.png deleted file mode 100644 index 09d1cdc856..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-icons_2e83ff_256x240.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-icons_b1d630_256x240.png b/uwsgicc/static/css/custom-theme/images/ui-icons_b1d630_256x240.png deleted file mode 100644 index b6a1ab7b73..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-icons_b1d630_256x240.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/images/ui-icons_cd0a0a_256x240.png b/uwsgicc/static/css/custom-theme/images/ui-icons_cd0a0a_256x240.png deleted file mode 100644 index 2ab019b73e..0000000000 Binary files a/uwsgicc/static/css/custom-theme/images/ui-icons_cd0a0a_256x240.png and /dev/null differ diff --git a/uwsgicc/static/css/custom-theme/jquery-ui-1.8.14.custom.css b/uwsgicc/static/css/custom-theme/jquery-ui-1.8.14.custom.css deleted file mode 100644 index ace8a0da9e..0000000000 --- a/uwsgicc/static/css/custom-theme/jquery-ui-1.8.14.custom.css +++ /dev/null @@ -1,568 +0,0 @@ -/* - * jQuery UI CSS Framework 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { cursor: default !important; } - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - - -/* - * jQuery UI CSS Framework 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - * - * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=lucida%20grande,%20helvetica,%20arial&fwDefault=normal&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=222222&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=30&borderColorHeader=555555&fcHeader=ffffff&iconColorHeader=b1d630&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=100&borderColorContent=555555&fcContent=222222&iconColorContent=b1d630&bgColorDefault=222222&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=30&borderColorDefault=ffffff&fcDefault=ffffff&iconColorDefault=b1d630&bgColorHover=b1d630&bgTextureHover=05_inset_soft.png&bgImgOpacityHover=75&borderColorHover=ffffff&fcHover=222222&iconColorHover=000000&bgColorActive=ffffff&bgTextureActive=05_inset_soft.png&bgImgOpacityActive=65&borderColorActive=555555&fcActive=222222&iconColorActive=b1d630&bgColorHighlight=d9e99f&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=b1d630&fcHighlight=222222&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=05_inset_soft.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=000000&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=80&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px - */ - - -/* Component containers -----------------------------------*/ -.ui-widget { font-family: lucida grande, helvetica, arial; font-size: 1.1em; } -.ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: lucida grande, helvetica, arial; font-size: 1em; } -.ui-widget-content { border: 1px solid #555555; background: #ffffff url(images/ui-bg_flat_100_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } -.ui-widget-content a { color: #222222; } -.ui-widget-header { border: 1px solid #555555; background: #222222 url(images/ui-bg_highlight-soft_30_222222_1x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } -.ui-widget-header a { color: #ffffff; } - -/* Interaction states -----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #ffffff; background: #222222 url(images/ui-bg_highlight-hard_30_222222_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #ffffff; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #ffffff; background: #b1d630 url(images/ui-bg_inset-soft_75_b1d630_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #222222; } -.ui-state-hover a, .ui-state-hover a:hover { color: #222222; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #555555; background: #ffffff url(images/ui-bg_inset-soft_65_ffffff_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #222222; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #222222; text-decoration: none; } -.ui-widget :active { outline: none; } - -/* Interaction Cues -----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #b1d630; background: #d9e99f url(images/ui-bg_glass_55_d9e99f_1x400.png) 50% 50% repeat-x; color: #222222; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #222222; } -.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; } -.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_b1d630_256x240.png); } -.ui-widget-content .ui-icon {background-image: url(images/ui-icons_b1d630_256x240.png); } -.ui-widget-header .ui-icon {background-image: url(images/ui-icons_b1d630_256x240.png); } -.ui-state-default .ui-icon { background-image: url(images/ui-icons_b1d630_256x240.png); } -.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_000000_256x240.png); } -.ui-state-active .ui-icon {background-image: url(images/ui-icons_b1d630_256x240.png); } -.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } -.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } - -/* positioning */ -.ui-icon-carat-1-n { background-position: 0 0; } -.ui-icon-carat-1-ne { background-position: -16px 0; } -.ui-icon-carat-1-e { background-position: -32px 0; } -.ui-icon-carat-1-se { background-position: -48px 0; } -.ui-icon-carat-1-s { background-position: -64px 0; } -.ui-icon-carat-1-sw { background-position: -80px 0; } -.ui-icon-carat-1-w { background-position: -96px 0; } -.ui-icon-carat-1-nw { background-position: -112px 0; } -.ui-icon-carat-2-n-s { background-position: -128px 0; } -.ui-icon-carat-2-e-w { background-position: -144px 0; } -.ui-icon-triangle-1-n { background-position: 0 -16px; } -.ui-icon-triangle-1-ne { background-position: -16px -16px; } -.ui-icon-triangle-1-e { background-position: -32px -16px; } -.ui-icon-triangle-1-se { background-position: -48px -16px; } -.ui-icon-triangle-1-s { background-position: -64px -16px; } -.ui-icon-triangle-1-sw { background-position: -80px -16px; } -.ui-icon-triangle-1-w { background-position: -96px -16px; } -.ui-icon-triangle-1-nw { background-position: -112px -16px; } -.ui-icon-triangle-2-n-s { background-position: -128px -16px; } -.ui-icon-triangle-2-e-w { background-position: -144px -16px; } -.ui-icon-arrow-1-n { background-position: 0 -32px; } -.ui-icon-arrow-1-ne { background-position: -16px -32px; } -.ui-icon-arrow-1-e { background-position: -32px -32px; } -.ui-icon-arrow-1-se { background-position: -48px -32px; } -.ui-icon-arrow-1-s { background-position: -64px -32px; } -.ui-icon-arrow-1-sw { background-position: -80px -32px; } -.ui-icon-arrow-1-w { background-position: -96px -32px; } -.ui-icon-arrow-1-nw { background-position: -112px -32px; } -.ui-icon-arrow-2-n-s { background-position: -128px -32px; } -.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } -.ui-icon-arrow-2-e-w { background-position: -160px -32px; } -.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } -.ui-icon-arrowstop-1-n { background-position: -192px -32px; } -.ui-icon-arrowstop-1-e { background-position: -208px -32px; } -.ui-icon-arrowstop-1-s { background-position: -224px -32px; } -.ui-icon-arrowstop-1-w { background-position: -240px -32px; } -.ui-icon-arrowthick-1-n { background-position: 0 -48px; } -.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } -.ui-icon-arrowthick-1-e { background-position: -32px -48px; } -.ui-icon-arrowthick-1-se { background-position: -48px -48px; } -.ui-icon-arrowthick-1-s { background-position: -64px -48px; } -.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } -.ui-icon-arrowthick-1-w { background-position: -96px -48px; } -.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } -.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } -.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } -.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } -.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } -.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } -.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } -.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } -.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } -.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } -.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } -.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } -.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } -.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } -.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } -.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } -.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } -.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } -.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } -.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } -.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } -.ui-icon-arrow-4 { background-position: 0 -80px; } -.ui-icon-arrow-4-diag { background-position: -16px -80px; } -.ui-icon-extlink { background-position: -32px -80px; } -.ui-icon-newwin { background-position: -48px -80px; } -.ui-icon-refresh { background-position: -64px -80px; } -.ui-icon-shuffle { background-position: -80px -80px; } -.ui-icon-transfer-e-w { background-position: -96px -80px; } -.ui-icon-transferthick-e-w { background-position: -112px -80px; } -.ui-icon-folder-collapsed { background-position: 0 -96px; } -.ui-icon-folder-open { background-position: -16px -96px; } -.ui-icon-document { background-position: -32px -96px; } -.ui-icon-document-b { background-position: -48px -96px; } -.ui-icon-note { background-position: -64px -96px; } -.ui-icon-mail-closed { background-position: -80px -96px; } -.ui-icon-mail-open { background-position: -96px -96px; } -.ui-icon-suitcase { background-position: -112px -96px; } -.ui-icon-comment { background-position: -128px -96px; } -.ui-icon-person { background-position: -144px -96px; } -.ui-icon-print { background-position: -160px -96px; } -.ui-icon-trash { background-position: -176px -96px; } -.ui-icon-locked { background-position: -192px -96px; } -.ui-icon-unlocked { background-position: -208px -96px; } -.ui-icon-bookmark { background-position: -224px -96px; } -.ui-icon-tag { background-position: -240px -96px; } -.ui-icon-home { background-position: 0 -112px; } -.ui-icon-flag { background-position: -16px -112px; } -.ui-icon-calendar { background-position: -32px -112px; } -.ui-icon-cart { background-position: -48px -112px; } -.ui-icon-pencil { background-position: -64px -112px; } -.ui-icon-clock { background-position: -80px -112px; } -.ui-icon-disk { background-position: -96px -112px; } -.ui-icon-calculator { background-position: -112px -112px; } -.ui-icon-zoomin { background-position: -128px -112px; } -.ui-icon-zoomout { background-position: -144px -112px; } -.ui-icon-search { background-position: -160px -112px; } -.ui-icon-wrench { background-position: -176px -112px; } -.ui-icon-gear { background-position: -192px -112px; } -.ui-icon-heart { background-position: -208px -112px; } -.ui-icon-star { background-position: -224px -112px; } -.ui-icon-link { background-position: -240px -112px; } -.ui-icon-cancel { background-position: 0 -128px; } -.ui-icon-plus { background-position: -16px -128px; } -.ui-icon-plusthick { background-position: -32px -128px; } -.ui-icon-minus { background-position: -48px -128px; } -.ui-icon-minusthick { background-position: -64px -128px; } -.ui-icon-close { background-position: -80px -128px; } -.ui-icon-closethick { background-position: -96px -128px; } -.ui-icon-key { background-position: -112px -128px; } -.ui-icon-lightbulb { background-position: -128px -128px; } -.ui-icon-scissors { background-position: -144px -128px; } -.ui-icon-clipboard { background-position: -160px -128px; } -.ui-icon-copy { background-position: -176px -128px; } -.ui-icon-contact { background-position: -192px -128px; } -.ui-icon-image { background-position: -208px -128px; } -.ui-icon-video { background-position: -224px -128px; } -.ui-icon-script { background-position: -240px -128px; } -.ui-icon-alert { background-position: 0 -144px; } -.ui-icon-info { background-position: -16px -144px; } -.ui-icon-notice { background-position: -32px -144px; } -.ui-icon-help { background-position: -48px -144px; } -.ui-icon-check { background-position: -64px -144px; } -.ui-icon-bullet { background-position: -80px -144px; } -.ui-icon-radio-off { background-position: -96px -144px; } -.ui-icon-radio-on { background-position: -112px -144px; } -.ui-icon-pin-w { background-position: -128px -144px; } -.ui-icon-pin-s { background-position: -144px -144px; } -.ui-icon-play { background-position: 0 -160px; } -.ui-icon-pause { background-position: -16px -160px; } -.ui-icon-seek-next { background-position: -32px -160px; } -.ui-icon-seek-prev { background-position: -48px -160px; } -.ui-icon-seek-end { background-position: -64px -160px; } -.ui-icon-seek-start { background-position: -80px -160px; } -/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ -.ui-icon-seek-first { background-position: -80px -160px; } -.ui-icon-stop { background-position: -96px -160px; } -.ui-icon-eject { background-position: -112px -160px; } -.ui-icon-volume-off { background-position: -128px -160px; } -.ui-icon-volume-on { background-position: -144px -160px; } -.ui-icon-power { background-position: 0 -176px; } -.ui-icon-signal-diag { background-position: -16px -176px; } -.ui-icon-signal { background-position: -32px -176px; } -.ui-icon-battery-0 { background-position: -48px -176px; } -.ui-icon-battery-1 { background-position: -64px -176px; } -.ui-icon-battery-2 { background-position: -80px -176px; } -.ui-icon-battery-3 { background-position: -96px -176px; } -.ui-icon-circle-plus { background-position: 0 -192px; } -.ui-icon-circle-minus { background-position: -16px -192px; } -.ui-icon-circle-close { background-position: -32px -192px; } -.ui-icon-circle-triangle-e { background-position: -48px -192px; } -.ui-icon-circle-triangle-s { background-position: -64px -192px; } -.ui-icon-circle-triangle-w { background-position: -80px -192px; } -.ui-icon-circle-triangle-n { background-position: -96px -192px; } -.ui-icon-circle-arrow-e { background-position: -112px -192px; } -.ui-icon-circle-arrow-s { background-position: -128px -192px; } -.ui-icon-circle-arrow-w { background-position: -144px -192px; } -.ui-icon-circle-arrow-n { background-position: -160px -192px; } -.ui-icon-circle-zoomin { background-position: -176px -192px; } -.ui-icon-circle-zoomout { background-position: -192px -192px; } -.ui-icon-circle-check { background-position: -208px -192px; } -.ui-icon-circlesmall-plus { background-position: 0 -208px; } -.ui-icon-circlesmall-minus { background-position: -16px -208px; } -.ui-icon-circlesmall-close { background-position: -32px -208px; } -.ui-icon-squaresmall-plus { background-position: -48px -208px; } -.ui-icon-squaresmall-minus { background-position: -64px -208px; } -.ui-icon-squaresmall-close { background-position: -80px -208px; } -.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } -.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } -.ui-icon-grip-solid-vertical { background-position: -32px -224px; } -.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } -.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } -.ui-icon-grip-diagonal-se { background-position: -80px -224px; } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -khtml-border-top-left-radius: 5px; border-top-left-radius: 5px; } -.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -khtml-border-top-right-radius: 5px; border-top-right-radius: 5px; } -.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -khtml-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; } -.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; -khtml-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; } - -/* Overlays */ -.ui-widget-overlay { background: #000000 url(images/ui-bg_flat_0_000000_40x100.png) 50% 50% repeat-x; opacity: .80;filter:Alpha(Opacity=80); } -.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* - * jQuery UI Resizable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming - */ -.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } -/* - * jQuery UI Accordion 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion#theming - */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } -.ui-accordion .ui-accordion-li-fix { display: inline; } -.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } -.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } -.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } -.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; } -/* - * jQuery UI Autocomplete 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu 1.8.14 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button#theming - */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ -button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3.4em; } -button.ui-button-icons-only { width: 3.7em; } - -/*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .4em 1em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } -.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } -.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } -/* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } - -/*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } -.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } - -/*button sets*/ -.ui-buttonset { margin-right: 7px; } -.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } - -/* workarounds */ -button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -/* - * jQuery UI Dialog 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog#theming - */ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } -.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* - * jQuery UI Slider 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs#theming - */ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } -/* - * jQuery UI Datepicker 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker#theming - */ -.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } -.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } -.ui-datepicker .ui-datepicker-prev { left:2px; } -.ui-datepicker .ui-datepicker-next { right:2px; } -.ui-datepicker .ui-datepicker-prev-hover { left:1px; } -.ui-datepicker .ui-datepicker-next-hover { right:1px; } -.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } -.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } -.ui-datepicker select.ui-datepicker-month-year {width: 100%;} -.ui-datepicker select.ui-datepicker-month, -.ui-datepicker select.ui-datepicker-year { width: 49%;} -.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } -.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } -.ui-datepicker td { border: 0; padding: 1px; } -.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } -.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } - -/* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } - -/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ -.ui-datepicker-cover { - display: none; /*sorry for IE5*/ - display/**/: block; /*sorry for IE5*/ - position: absolute; /*must have*/ - z-index: -1; /*must have*/ - filter: mask(); /*must have*/ - top: -4px; /*must have*/ - left: -4px; /*must have*/ - width: 200px; /*must have*/ - height: 200px; /*must have*/ -}/* - * jQuery UI Progressbar 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar#theming - */ -.ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/uwsgicc/static/js/jquery-1.5.1.min.js b/uwsgicc/static/js/jquery-1.5.1.min.js deleted file mode 100644 index 6437874c69..0000000000 --- a/uwsgicc/static/js/jquery-1.5.1.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.5.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Wed Feb 23 13:55:29 2011 -0500 - */ -(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="
a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="
";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div
","
"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file diff --git a/uwsgicc/static/js/jquery-ui-1.8.14.custom.min.js b/uwsgicc/static/js/jquery-ui-1.8.14.custom.min.js deleted file mode 100644 index f9e4f1e840..0000000000 --- a/uwsgicc/static/js/jquery-ui-1.8.14.custom.min.js +++ /dev/null @@ -1,789 +0,0 @@ -/*! - * jQuery UI 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14", -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}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus(); -b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this, -"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection", -function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth, -outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b); -return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e= -0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?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= -false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); -;/* - * jQuery UI Position 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Position - */ -(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, -left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= -k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= -m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= -d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= -a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), -g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); -;/* - * jQuery UI Draggable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Draggables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== -"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= -this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;this.helper= -this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;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};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}); -this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true}, -_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.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";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b= -false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration, -10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle|| -!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&& -a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent= -this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"), -10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={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 a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top, -(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!= -"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"), -10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+ -this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&& -!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.leftg[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.topg[3])?h:!(h-this.offset.click.topg[2])?e:!(e-this.offset.click.left=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= -i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), -top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= -this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", -nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== -String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); -this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy(); -var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a= -false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"}); -this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff= -{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis]; -if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false}, -_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f, -{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight: -Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(cb.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left= -null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+ -a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+ -c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]); -b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.14"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(), -10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top- -f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType? -e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a= -e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing, -step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= -e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset; -var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left: -a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top- -d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition, -f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, -display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b= -e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height= -d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); -;/* - * jQuery UI Selectable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), -selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, -c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", -c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= -this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); -this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;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 a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== -"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&& -!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);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","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; -this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= -document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); -return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], -e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); -c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;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 b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(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();d.extend(this,{helper:null, -dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, -toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); -if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), -this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= -this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= -d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| -0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", -a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- -f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- -this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, -this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", -a,this._uiHash());for(e=0;e li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); -a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); -if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", -function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a= -this.options;if(a.icons){c("").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.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 a=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"); -this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=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");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); -b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); -a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ -c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; -if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); -if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(), -e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight|| -e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false", -"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?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)}}});c.extend(c.ui.accordion,{version:"1.8.14", -animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/); -f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide", -paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); -;/* - * jQuery UI Autocomplete 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.position.js - */ -(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g= -false;var f=d.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();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= -a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)}; -this.menu=d("
    ").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&& -a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"); -d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&& -b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source= -this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, -"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); -(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", --1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id"); -this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},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(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b, -this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| -this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| -this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("");e.secondary&&a.append("");if(!this.options.text){d.push(f?"ui-button-icons-only": -"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")=== -"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"); -b.Widget.prototype.destroy.call(this)}})})(jQuery); -;/* - * jQuery UI Dialog 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.button.js - * jquery.ui.draggable.js - * jquery.ui.mouse.js - * jquery.ui.position.js - * jquery.ui.resizable.js - */ -(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, -position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
    ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ -b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), -h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id", -e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); -a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!== -b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+= -1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target=== -f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
    ").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a, -function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", -handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition, -originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize", -f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "): -[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f); -if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"): -e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a= -this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height- -b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.14",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "), -create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), -height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); -b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(a.range==="min"||a.range==="max"?" ui-slider-range-"+a.range:""))}for(var j=c.length;j"); -this.handles=c.add(d(e.join("")).appendTo(b.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle", -g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!b.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");i=b._start(g,l);if(i===false)return}break}m=b.options.step;i=b.options.values&&b.options.values.length? -(h=b.values(l)):(h=b.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=b._valueMin();break;case d.ui.keyCode.END:h=b._valueMax();break;case d.ui.keyCode.PAGE_UP:h=b._trimAlignValue(i+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(i-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===b._valueMax())return;h=b._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===b._valueMin())return;h=b._trimAlignValue(i- -m);break}b._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(g,k);b._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy(); -return this},_mouseCapture:function(b){var a=this.options,c,f,e,j,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(a.range===true&&this.values(1)===a.min){g+=1;e=d(this.handles[g])}if(this._start(b,g)===false)return false; -this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();a=e.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-e.width()/2,top:b.pageY-a.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(b){var a= -this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a;if(this.orientation==="horizontal"){a= -this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a); -c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var f;if(this.options.values&&this.options.values.length){f=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>f||a===1&&c1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, -_refreshValue:function(){var b=this.options.range,a=this.options,c=this,f=!this._animateOff?a.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},a.animate); -if(h===1)c.range[f?"animate":"css"]({width:e-g+"%"},{queue:false,duration:a.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},a.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:a.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, -1)[f?"animate":"css"]({width:e+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.14"})})(jQuery); -;/* - * jQuery UI Tabs 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& -e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= -d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| -(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); -this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= -this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); -if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); -this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ -g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", -function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; -this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= --1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; -d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= -d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, -e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); -j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); -if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, -this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, -load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, -"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, -url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.14"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k'))}function N(a){return a.bind("mouseout",function(b){b= -d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");b.addClass("ui-state-hover"); -b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.14"}});var A=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){H(this._defaults, -a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){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:b,dpDiv:!b?this.dpDiv:N(d('
    '))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]= -h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c= -this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f==""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a, -"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker", -function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput); -a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/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=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus", -this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b= -b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5", -cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a); -d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c= -d.datepicker._get(b,"beforeShow");H(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c= -{left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover"); -if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv); -J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"); -a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&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(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]|| -c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+ -i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b= -this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute", -left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&& -d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth= -b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear= -!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a); -a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a)); -d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()% -100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=B+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},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))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= -a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), -b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= -this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+s+"":f?"":''+s+"";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
    '+(c?h:"")+(this._isInRange(a,s)?'":"")+(c?"":h)+"
    ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),B= -this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right": -"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='
    '+(/all|left/.test(t)&&x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,B,v)+'
    ';var z=j?'": -"";for(t=0;t<7;t++){var r=(t+h)%7;z+="=5?' class="ui-datepicker-week-end"':"")+'>'+q[r]+""}y+=z+"";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q";var R=!j?"":'";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&ro;R+='";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+""}g++;if(g>11){g=0;m++}y+="
    '+this._get(a,"weekHeader")+"
    '+ -this._get(a,"calculateWeek")(r)+""+(F&&!D?" ":L?''+r.getDate()+"":''+ -r.getDate()+"")+"
    "+(l?""+(i[0]>0&&G==i[1]-1?'
    ':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"), -l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
    ',o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&&l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()): -g;for(a.yearshtml+='";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
    ";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c== -"Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear"); -if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); -c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, -"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= -function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, -[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.14";window["DP_jQuery_"+A]=d})(jQuery); -;/* - * jQuery UI Progressbar 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
    ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); -this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* -this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.14"})})(jQuery); -;/* - * jQuery UI Effects 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; -f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, -[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.14",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); -c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, -a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); -a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", -"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* -((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= -e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= -e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ -e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); -;/* - * jQuery UI Effects Fade 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Fold 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], -10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); -;/* - * jQuery UI Effects Highlight 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& -this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Pulsate 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); -b.dequeue()})})}})(jQuery); -; \ No newline at end of file diff --git a/uwsgicc/templates/index.html b/uwsgicc/templates/index.html deleted file mode 100644 index 700fdcfda7..0000000000 --- a/uwsgicc/templates/index.html +++ /dev/null @@ -1,448 +0,0 @@ - - - - -uWSGI {{uwsgi.version}} Control Center - - - - - - - - - - - - -
    -
    - - -

    uWSGI {{uwsgi.version}} Control Center

    -
    -information | options | logs | signals | workers | applications | rpc {% if uwsgi.cluster() %}| cluster{% endif %} -
    - -{% with messages = get_flashed_messages() %} - {% if messages %} -
    -
      - {% for message in messages %} -
    • {{ message }}
    • - {% endfor %} -
    -
    - {% endif %} -{% endwith %} - - -

    Information

    -
    -hostname: {{ hostname }}
    -nodename: {{uwsgi.cluster_node_name()}}
    -uid: {{ uid }}
    -gid: {{ gid }}
    -cwd: {{ cwd }}
    -mode: {{uwsgi.mode}}
    -loop: {{uwsgi.loop}}
    -started_on: {{uwsgi.started_on|unixtime}}
    -workers: {{uwsgi.numproc}}
    -cores: {{ uwsgi.cores }}
    -masterpid: {{uwsgi.masterpid()}}
    -cluster: {{uwsgi.cluster()}}
    -{% if uwsgi.opt['spooler'] %} -spooler pid: {{uwsgi.spooler_pid()}}
    -{% endif %} - -{% if uwsgi.has_threads == 1 %} ---- threads enabled ---
    -{% endif %} - - - -
    - - - -

    Options

    -
    -{% for k in uwsgi.opt.keys() %} - {{k}}: {{uwsgi.opt[k]}}
    -{% endfor %} - - - -
    - - -

    Logs (size: {{ uwsgi.logsize() }} bytes)

    -
    -
    - - -
    - - - -
    - - -

    Signals

    -
    -
    - - -
    - - - -
    - - - -

    Workers

    -
    - - - - - - - - - - -{% if 'memory-report' in uwsgi.opt %} - - -{% endif %} - - -{% for w in uwsgi.workers() %} - - - - - - - - - -{% if 'memory-report' in uwsgi.opt %} - - -{% endif %} - - -{% endfor %} -
    #pidstatusrequestsexceptionssignalsrunning timeavg response timerssvsz# respawn
    {{w.id}}{{w.pid}}{{w.status}}{{w.requests}}{{w.exceptions}}{{w.signals}}{{w.running_time/1000}}{{w.avg_rt/1000}}{{(w.rss/1000/1000)|round(2,'floor')}}MB{{(w.vsz/1000/1000)|round(2,'floor')}}MB{{w.respawn_count}}
    -
    - - -
    - - -

    Applications

    -
    -{% for w in uwsgi.workers() %} -worker {{w.id}} - - - - - - - - - - - -{% for app in w.apps %} - - - - - - - - - - -{% endfor %} -
    #modifier1mountpointinterpretercallablechdirrequestsexceptions
    {{app.id}}{{app.modifier1}}{{app.mountpoint}}{{app.interpreter}}{{app.callable}}{{app.chdir}}{{app.requests}}{{app.exceptions}}
    -

    -{% endfor %} -
    - - -
    - - - -
    - - - - -
    -
    -node address (leave empty for local rpc): function: args (separated by space, optional):
    -
    -
    - -
    -
      - {% for r in uwsgi.rpc_list() %} -
    • {{ r }}
    • - {% endfor %} -
    -
    - -
    - -
    - - - - -{% if uwsgi.cluster() %} - -

    Cluster nodes

    -
    -best is {{ uwsgi.cluster_best_node() }}

    - - - - - -{% for ucn in uwsgi.cluster_nodes() %} - - - - - - - - - - - - - - - -{% endfor %} - - - - - - - -
    hostnamesocket
    {{ uwsgi.cluster_node_name(ucn) }}{{ ucn }}
    - - - -
    - - - -
    - - -
    All cluster nodes -
    - - -
    -
    -
    - - -
    -
    -
    - -
    -
    -
    - - -
    - -{% endif %} - - diff --git a/uwsgicc/uwsgicc.py b/uwsgicc/uwsgicc.py deleted file mode 100644 index af0303e245..0000000000 --- a/uwsgicc/uwsgicc.py +++ /dev/null @@ -1,52 +0,0 @@ -import uwsgi -from flask import Flask, render_template, request, url_for, redirect, flash -import time -import os -import socket - -app = Flask(__name__) -app.debug = True -app.secret_key = os.urandom(24) - -@app.template_filter('unixtime') -def unixtime(s): - return time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(s)) - - -@app.route("/") -def index(): - return render_template("index.html", uwsgi=uwsgi, hostname=socket.gethostname(), uid=os.getuid(), gid=os.getgid(), cwd=os.getcwd()) - -@app.route("/log", methods=['POST']) -def log(): - uwsgi.log(request.form['message']) - flash("log message written") - return redirect(url_for('index')) - -@app.route("/sig", methods=['POST']) -def sig(): - try: - uwsgi.signal(int(request.form['signum'])) - flash("uwsgi signal sent") - except: - flash("unable to send signal") - return redirect(url_for('index')) - -@app.route("/rpc", methods=['POST']) -def rpc(): - node = str(request.form['node']) - - fargs = str(request.form['args']) - - args = fargs.split() - - - if len(args) > 0: - ret = uwsgi.rpc(str(node), str(request.form['func']), *map(str, args)) - else: - ret = uwsgi.rpc(str(node), str(request.form['func'])) - - #flash("rpc \"%s\" returned: %s" % (request.form['func'], ret) ) - - return ret - #return redirect(url_for('index')) diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 14a9349750..333794e1aa 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -33,15 +33,20 @@ CPP = os.environ.get('CPP', 'cpp') -CPUCOUNT = 1 try: - import multiprocessing - CPUCOUNT = multiprocessing.cpu_count() + CPUCOUNT = int(os.environ.get('CPUCOUNT', -1)) except: + CPUCOUNT = -1 + +if CPUCOUNT < 1: try: - CPUCOUNT = int(os.sysconf('SC_NPROCESSORS_ONLN')) + import multiprocessing + CPUCOUNT = multiprocessing.cpu_count() except: - pass + try: + CPUCOUNT = int(os.sysconf('SC_NPROCESSORS_ONLN')) + except: + CPUCOUNT = 1 binary_list = [] @@ -340,12 +345,16 @@ def build_uwsgi(uc, print_only=False): pass for cfile in up.GCC_LIST: - if not cfile.endswith('.a'): + if cfile.endswith('.a'): + gcc_list.append(cfile) + elif not cfile.endswith('.c') and not cfile.endswith('.cc') and not cfile.endswith('.m'): compile(' '.join(uniq_warnings(p_cflags)), last_cflags_ts, path + '/' + cfile + '.o', path + '/' + cfile + '.c') gcc_list.append('%s/%s' % (path, cfile)) else: - gcc_list.append(cfile) + compile(' '.join(uniq_warnings(p_cflags)), last_cflags_ts, + path + '/' + cfile + '.o', path + '/' + cfile) + gcc_list.append('%s/%s' % (path, cfile)) libs += up.LIBS @@ -1003,11 +1012,15 @@ def get_gcll(self): self.cflags.append("-DUWSGI_SSL") self.libs.append('-lssl') self.libs.append('-lcrypto') + self.gcc_list.append('core/ssl') + self.gcc_list.append('core/legion') report['ssl'] = True else: self.cflags.append("-DUWSGI_SSL") self.libs.append('-lssl') self.libs.append('-lcrypto') + self.gcc_list.append('core/ssl') + self.gcc_list.append('core/legion') report['ssl'] = True