├── web ├── css │ ├── asc.png │ ├── bg.png │ ├── desc.png │ ├── flick │ │ ├── images │ │ │ ├── ui-icons_0073ea_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_666666_256x240.png │ │ │ ├── ui-icons_ff0084_256x240.png │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ ├── ui-bg_flat_0_eeeeee_40x100.png │ │ │ ├── ui-bg_flat_55_ffffff_40x100.png │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_highlight-soft_100_f6f6f6_1x100.png │ │ │ ├── ui-bg_highlight-soft_25_0073ea_1x100.png │ │ │ └── ui-bg_highlight-soft_50_dddddd_1x100.png │ │ └── jquery-ui-1.8.6.custom.css │ ├── style.css │ └── jq.css ├── img │ └── spinner.gif ├── config.default.php ├── get_attachment.php ├── list_running_jobs.php ├── index.php ├── list_by_command.php ├── lib │ ├── couchReplicator.php │ ├── couchDocument.php │ ├── couch.php │ └── couchClient.php ├── list_jobs.php └── js │ ├── jquery.tablesorter.min.js │ └── jquery-1.4.4.min.js ├── refresh_view.sh ├── cronview.json ├── README └── cronologger /web/css/asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/asc.png -------------------------------------------------------------------------------- /web/css/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/bg.png -------------------------------------------------------------------------------- /web/css/desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/desc.png -------------------------------------------------------------------------------- /web/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/img/spinner.gif -------------------------------------------------------------------------------- /web/config.default.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/css/flick/images/ui-icons_0073ea_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-icons_0073ea_256x240.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-icons_666666_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-icons_666666_256x240.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-icons_ff0084_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-icons_ff0084_256x240.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_flat_55_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_flat_55_ffffff_40x100.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png -------------------------------------------------------------------------------- /web/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/cronologger/master/web/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png -------------------------------------------------------------------------------- /refresh_view.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CRONOLOGGER_SERVER=${CRONOLOGGER_SERVER:=localhost} 4 | CRONOLOGGER_DB=${CRONOLOGGER_DB:=cronologger} 5 | URL="http://${CRONOLOGGER_SERVER}:5984/${CRONOLOGGER_DB}/_design/cronview" 6 | 7 | REV=`wget -O - -q ${URL} | sed "s/.*rev//g" | awk -F\" '{ print $3}'` 8 | 9 | curl -X DELETE "${URL}?rev=${REV}" 10 | 11 | curl -s -X PUT -H "text/plain;charset=utf-8" -d @cronview.json $URL 12 | -------------------------------------------------------------------------------- /cronview.json: -------------------------------------------------------------------------------- 1 | { 2 | "_id":"_design/cronview", 3 | "language":"javascript", 4 | "views": 5 | { 6 | "by_host": 7 | { 8 | "map":"function(doc) { if (doc.hostname) emit(doc.hostname, doc) }" 9 | }, 10 | "by_job_duration": 11 | { 12 | "map":"function(doc) { if (doc.job_duration) emit(doc.job_duration, doc) }" 13 | }, 14 | "by_username": 15 | { 16 | "map":"function(doc) { if (doc.username) emit(doc.username, doc) }" 17 | }, 18 | "by_unixtime": 19 | { 20 | "map":"function(doc) { if (doc.unixtime) emit(doc.unixtime, doc) }" 21 | }, 22 | "by_commandline": 23 | { 24 | "map":"function(doc) { if (doc.command_line) emit(doc.command_line, doc) }" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /web/get_attachment.php: -------------------------------------------------------------------------------- 1 | WARNING: Configuration file config.php does not exist. Please 7 | notify your system administrator."); 8 | } else 9 | include_once('./config.php'); 10 | 11 | header("Content-Type: text/plain"); 12 | 13 | $couch_url = 'http://' . $couchdb_server . ':' . $couchdb_port; 14 | $couch_url_full = $couch_url . "/" . $couchdb_database; 15 | 16 | if ( isset($_GET['docid']) && isset($_GET['output']) ) { 17 | $attachment_url = $couch_url_full . "/" . $_GET['docid'] . "/" . $_GET['output']; 18 | if ($fp = fopen($attachment_url, "r")) { 19 | while (!feof ($fp)) { 20 | $line = fgets ($fp, 1024); 21 | print $line; 22 | } 23 | fclose($fp); 24 | } 25 | } 26 | ?> 27 | -------------------------------------------------------------------------------- /web/css/style.css: -------------------------------------------------------------------------------- 1 | table.tablesorter { 2 | font-family:arial; 3 | background-color: #eeeeee; 4 | margin:10px 0pt 15px; 5 | font-size: 10pt; 6 | width: 100%; 7 | text-align: left; 8 | } 9 | table.tablesorter thead tr th { 10 | background-color: #dddddd; 11 | border: 1px solid #FFF; 12 | font-size: 8pt; 13 | padding: 4px; 14 | } 15 | table.tablesorter tfoot tr th { 16 | background-color: #dddddd; 17 | border: 1px solid #FFF; 18 | font-size: 11pt; 19 | padding: 4px; 20 | } 21 | table.tablesorter tbody td { 22 | color: #3D3D3D; 23 | padding: 4px; 24 | background-color: #FFF; 25 | vertical-align: top; 26 | } 27 | table.tablesorter tbody tr.odd td { 28 | background-color:#F0F0F6; 29 | } 30 | table.tablesorter thead tr .headerSortUp { 31 | background-image: url(asc.png); 32 | } 33 | table.tablesorter thead tr .headerSortDown { 34 | background-image: url(desc.png); 35 | } 36 | table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp { 37 | background-color: #8dbdd8; 38 | } 39 | 40 | table.tablesorter .header { 41 | background-image: url(bg.png); 42 | background-repeat: no-repeat; 43 | border-left: 1px solid #FFF; 44 | border-right: 1px solid #000; 45 | border-top: 1px solid #FFF; 46 | padding-left: 30px; 47 | padding-top: 8px; 48 | height: auto; 49 | } 50 | -------------------------------------------------------------------------------- /web/css/jq.css: -------------------------------------------------------------------------------- 1 | body,div,h1{font-family:'trebuchet ms', verdana, arial;margin:0;padding:0;} 2 | body{background-color:#fff;color:#333;font-size:small;margin:0;padding:0;} 3 | h1{font-size:large;font-weight:400;margin:0;} 4 | h2{color:#333;font-size:small;font-weight:400;margin:0;} 5 | pre{background-color:#eee;border:1px solid #ddd;border-left-width:5px;color:#333;font-size:small;overflow-x:auto;padding:15px;} 6 | pre.normal{background-color:transparent;border:none;border-left-width:0;overflow-x:auto;} 7 | #logo{background:url(images/jq.png);display:block;float:right;height:31px;margin-right:10px;margin-top:10px;width:110px;} 8 | #main{margin:0 20px 20px;padding:0 15px 15px 0;} 9 | #content{padding:20px;} 10 | #busy{background-color:#e95555;border:1px ridge #ccc;color:#eee;display:none;padding:3px;position:absolute;right:7px;top:7px;} 11 | hr{height:1px;} 12 | code{font-size:108%;font-style:normal;padding:0;} 13 | ul{color:#333;list-style:square;} 14 | #banner{margin:20px;padding-bottom:10px;text-align:left;} 15 | #banner *{color:#232121;font-family:Georgia, Palatino, Times New Roman;font-size:30px;font-style:normal;font-weight:400;margin:0;padding:0;} 16 | #banner h1{display:block;float:left;} 17 | #banner h1 em{color:#6cf;} 18 | #banner h2{float:right;font-size:26px;margin:10px 10px -10px -10px;} 19 | #banner h3{clear:both;display:block;font-size:12px;margin-top:-20px;} 20 | #banner a{border-top:1px solid #888;display:block;font-size:14px;margin:5px 0 0;padding:10px 0 0;text-align:right;width:auto;} 21 | a.external{background-image:url(../img/external.png);background-position:center right;background-repeat:no-repeat;padding-right:12px;} 22 | form{font-size:10pt;margin-bottom:20px;width:auto;} 23 | form fieldset{padding:10px;text-align:left;width:140px;} 24 | div#main h1{border-bottom:1px solid #CDCDCD;display:block;margin-top:20px;padding:10px 0 2px;} 25 | table#tablesorter-demo {margin: 10px 0 0 0;} 26 | table#options *{font-size:small;} 27 | p.tip em {padding: 2px; background-color: #6cf; color: #FFF;} 28 | div.digg {float: right;} -------------------------------------------------------------------------------- /web/list_running_jobs.php: -------------------------------------------------------------------------------- 1 | WARNING: Configuration file config.php does not exist. Please 7 | notify your system administrator."); 8 | } else 9 | include_once('./config.php'); 10 | 11 | require_once 'lib/couch.php'; 12 | require_once 'lib/couchClient.php'; 13 | require_once 'lib/couchDocument.php'; 14 | 15 | // set a new connector to the CouchDB server 16 | $client = new couchClient ('http://' . $couchdb_server . ':' . $couchdb_port, $couchdb_database ); 17 | 18 | // view fetching, using the view option limit 19 | try { 20 | # $view = $client->limit(100)->asArray()->getView('cronview','by_host'); 21 | $client->key(-1); 22 | $view = $client->limit(100)->asArray()->getView('cronview','by_job_duration'); 23 | } catch (Exception $e) { 24 | echo "ERROR while getting view contents: ".$e->getMessage()."
\n"; 25 | } 26 | 27 | 28 | ############################################################## 29 | # Did we get any response for the key we were looking for 30 | ############################################################## 31 | if ( sizeof($view["rows"]) > 0 ) { 32 | 33 | print "

Currently Running Jobs

34 | 35 | 36 | 37 | 38 | "; 39 | 40 | foreach ( $view["rows"] as $key => $row ) { 41 | 42 | $job_time = time() - strtotime($row["value"]["time"]); 43 | 44 | print "" . 45 | "" . 46 | "" . 47 | "" . 48 | "" . 49 | "\n"; 50 | } 51 | 52 | print "
Start timeHas been running so far (secs)UsernameHostnameCommand
" . $row["value"]["time"] . "" . $job_time . "" . $row["value"]["username"] . "" . $row["value"]["hostname"] . "" . $row["value"]["command_line"] . "
"; 53 | 54 | } else { 55 | 56 | print "No jobs running"; 57 | 58 | } 59 | 60 | ?> -------------------------------------------------------------------------------- /web/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 36 | 41 | 42 | 43 | 46 |

47 | 52 | 53 |
54 | 55 |
56 | 57 |
58 | 59 |
60 | 61 |
62 | 63 |
64 |
65 | 66 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This script will archive cron or for that matter any output 2 | to a CouchDB document. There are two main drivers 3 | 4 | - Reduce the amount of cron e-mail spam 5 | - Have logs of cron jobs that can be correlated to adverse events 6 | 7 | Script will log following items 8 | 9 | - Command line used 10 | - Hostname script ran on 11 | - Username script ran on 12 | - Time started 13 | - How long the job took (job_duration) 14 | - Exit/return code of the job 15 | 16 | 17 | REQUIREMENTS 18 | ============ 19 | 20 | - CouchDB 0.10+ for storage 21 | - curl web client installed on all the nodes running cronologger 22 | 23 | INSTALLATION 24 | ============ 25 | 26 | First create a database on CouchDB. 27 | 28 | Then at top of cronologger script define the URL to CouchDB ie. 29 | 30 | URL_BASE="http://localhost:5984/cronologger" 31 | 32 | You could also define environment variables CRONOLOGGER_SERVER (defaults to localhost) 33 | and CRONOLOGGER_DB (defaults cronologger) ie. 34 | 35 | export CRONOLOGGER_SERVER=couch01 36 | export CRONOLOGGER_DB=crondb 37 | 38 | RUNNING 39 | ======= 40 | 41 | To run it simply precede a command with the cronologger command ie. 42 | 43 | cronologger /usr/local/bin/backup_db.sh 44 | 45 | That's it. Check out CouchDBs web interface 46 | 47 | http://localhost:5984/_utils/ 48 | 49 | on your CouchDB you should see an entry for the job that just ran. 50 | 51 | WEB GUI 52 | ======= 53 | 54 | There is PHP based web GUI however you have to create CouchDB views to be able 55 | to use it. You can find the view specification in cronview.json. To install/refresh the 56 | view define CRONOLOGGER_SERVER and CRONOLOGGER_DB variables and run refresh_view.sh 57 | 58 | export CRONOLOGGER_SERVER=couch01 59 | export CRONOLOGGER_DB=crondb 60 | 61 | Copy contents of the web subdirectory to your web document root ie. /var/www/html/cronologger. 62 | To configure web GUI create a config.php file which should only contain values that 63 | override the default values specified in config.default.php e.g. 64 | 65 | 70 | 71 | The web interface requires php >= 5.2, and 'allow_url_fopen = On' configured in your 72 | php.ini file. 73 | 74 | Enjoy. 75 | 76 | ########################################################################################## 77 | 78 | All the scripts are licensed under the Apache License, Version 2.0 (the "License") 79 | unless otherwise noted; you may not use this file except in compliance with the License. 80 | You may obtain a copy of the License at 81 | 82 | http://www.apache.org/licenses/LICENSE-2.0 83 | 84 | Unless required by applicable law or agreed to in writing, software distributed under the 85 | License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 86 | either express or implied. See the License for the specific language governing permissions 87 | and limitations under the License. 88 | -------------------------------------------------------------------------------- /web/list_by_command.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cronologger : Only Show Errors 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | WARNING: Configuration file config.php does not exist. Please 22 | notify your system administrator."); 23 | } else 24 | include_once('./config.php'); 25 | 26 | require_once 'lib/couch.php'; 27 | require_once 'lib/couchClient.php'; 28 | require_once 'lib/couchDocument.php'; 29 | 30 | $couch_url = 'http://' . $couchdb_server . ':' . $couchdb_port; 31 | $couch_url_full = $couch_url . "/" . $couchdb_database; 32 | 33 | // set a new connector to the CouchDB server 34 | $client = new couchClient ($couch_url , $couchdb_database); 35 | 36 | ?> 37 | 38 | key($_GET['command']); 43 | } 44 | 45 | $view = $client->limit(100)->asArray()->getView('cronview','by_commandline'); 46 | } catch (Exception $e) { 47 | echo "ERROR while getting view contents: ".$e->getMessage()."
\n"; 48 | } 49 | 50 | ############################################################## 51 | # Did we get any response for the key we were looking for 52 | ############################################################## 53 | if ( sizeof($view["rows"]) > 0 ) { 54 | 55 | print " 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | "; 64 | 65 | foreach ( $view["rows"] as $key => $row ) { 66 | if (! $row["value"]["_attachments"]["stderr"]["length"] > 0 ) { 67 | continue; 68 | } 69 | 70 | $docid = $row["value"]["_id"]; 71 | print "" . 72 | "" . 73 | "" . 74 | "" . 75 | "" . 76 | 77 | "" . 78 | "" . 79 | "" . 80 | "\n"; 81 | } 82 | 83 | print "
Start timeJob durationReturn codeUsernameHostnameCommandStdOut (Bytes)StdErr (Bytes)
" . $row["value"]["time"] . "" . $row["value"]["job_duration"] . "" . $row["value"]["return_code"] . "" . $row["value"]["username"] . "" . $row["value"]["hostname"] . " " . $row["value"]["command_line"] . "" . $row["value"]["_attachments"]["stdout"]["length"] . "" . $row["value"]["_attachments"]["stderr"]["length"] . "
"; 84 | 85 | } else { 86 | 87 | print "

No jobs running

"; 88 | 89 | } 90 | 91 | ?> 92 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /web/lib/couchReplicator.php: -------------------------------------------------------------------------------- 1 | client = $client; 29 | } 30 | 31 | /** 32 | * chainable method : tell couchdb to create target database if it doesn't exist 33 | * 34 | * @return couchReplicator $this 35 | */ 36 | public function create_target () { 37 | $this->opts['create_target'] = true; 38 | return $this; 39 | } 40 | 41 | /** 42 | * chainable method : setup a continuous replication stream 43 | * 44 | * @return couchReplicator $this 45 | */ 46 | public function continuous () { 47 | $this->opts['continuous'] = true; 48 | return $this; 49 | } 50 | 51 | /** 52 | * chainable method : cancel a continuous replication stream 53 | * 54 | * TODO: check if that works (apparently that doesn't) 55 | * 56 | * @return couchReplicator $this 57 | */ 58 | public function cancel () { 59 | $this->opts['cancel'] = true; 60 | return $this; 61 | } 62 | 63 | /** 64 | * chainable method : restrict replication to given document ids 65 | * 66 | * @param array $ids list of document ids to replicate 67 | * @return couchReplicator $this 68 | */ 69 | public function doc_ids ( array $ids ) { 70 | $this->opts['doc_ids'] = $ids; 71 | return $this; 72 | } 73 | 74 | /** 75 | * chainable method : set replication filter 76 | * 77 | * filter design doc should belong to the source database 78 | * 79 | * @param string $name replication filter name ( ex mydesign/myfilter ) 80 | * @return couchReplicator $this 81 | */ 82 | public function filter ( $name ) { 83 | $this->opts['filter'] = $name; 84 | return $this; 85 | } 86 | 87 | /** 88 | * chainable method : set query params (for example for a filtered replication) 89 | * 90 | * @param array|object $ids list of document ids to replicate 91 | * @return couchReplicator $this 92 | */ 93 | public function query_params ( $params ) { 94 | $this->opts['query_params'] = $params; 95 | return $this; 96 | } 97 | 98 | 99 | /** 100 | * replicate from local TO specified url (push replication) 101 | * 102 | * @param string $url url of the remote couchDB server 103 | * @return object couchDB server response to replication request 104 | */ 105 | public function to ( $url ) { 106 | $this->opts['source'] = $this->client->getDatabaseName(); 107 | $this->opts['target'] = $url; 108 | return $this->_launch(); 109 | } 110 | 111 | /** 112 | * replicate to local FROM specified url (push replication) 113 | * 114 | * @param string $url url of the remote couchDB server 115 | * @return object couchDB server response to replication request 116 | */ 117 | public function from ( $url ) { 118 | $this->opts['target'] = $this->client->getDatabaseName(); 119 | $this->opts['source'] = $url; 120 | return $this->_launch(); 121 | } 122 | 123 | 124 | private function _launch() { 125 | $opts = $this->opts; 126 | $this->opts = array(); 127 | // echo "posting to /_replicate"; 128 | $raw = $this->client->query( 129 | "POST", 130 | '/_replicate', 131 | array(), 132 | $opts 133 | ); 134 | // print_r($raw); 135 | $resp = couch::parseRawResponse($raw); 136 | // print_r($resp); 137 | if ( $resp['status_code'] == 200 ) { 138 | return $resp['body']; 139 | } 140 | // continuous setup returns 202 Accepted 141 | if ( array_key_exists('continuous',$opts) && $opts['continuous'] == true && $resp['status_code'] == 202 ) { 142 | return $resp['body']; 143 | } 144 | throw new couchException($raw); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /web/list_jobs.php: -------------------------------------------------------------------------------- 1 | WARNING: Configuration file config.php does not exist. Please 7 | notify your system administrator."); 8 | } else 9 | include_once('./config.php'); 10 | 11 | require_once 'lib/couch.php'; 12 | require_once 'lib/couchClient.php'; 13 | require_once 'lib/couchDocument.php'; 14 | 15 | $couch_url = 'http://' . $couchdb_server . ':' . $couchdb_port; 16 | $couch_url_full = $couch_url . "/" . $couchdb_database; 17 | 18 | // set a new connector to the CouchDB server 19 | $client = new couchClient ($couch_url , $couchdb_database); 20 | 21 | if ( isset( $_GET['showday'] ) && $_GET['showday'] != "" ) { 22 | $unixtime = strtotime($_GET['showday']); 23 | } else { 24 | $unixtime = mktime(0,0,0,date("m"), date("d"), date("Y")); 25 | } 26 | 27 | $time_prev = $unixtime - 86400; 28 | $prev_timeperiod = date('Y-m-d', $time_prev); 29 | $time_after = $unixtime + 86400; 30 | $next_timeperiod = date('Y-m-d', $time_after); 31 | 32 | ?> 33 | 34 |
"); return false;'> <---- Go to 35 | ---->"); return false;'> 36 | 37 | startkey($start_time); 43 | $client->endkey($end_time); 44 | $view = $client->limit(100)->asArray()->getView('cronview','by_unixtime'); 45 | } catch (Exception $e) { 46 | echo "ERROR while getting view contents: ".$e->getMessage()."
\n"; 47 | } 48 | 49 | ############################################################## 50 | # Did we get any response for the key we were looking for 51 | ############################################################## 52 | if ( sizeof($view["rows"]) > 0 ) { 53 | 54 | if ( isset( $_GET['search_type'] ) && $_GET['search_type'] == "errors" ) { 55 | 56 | print "

Displaying jobs that ran on " . date("Y-m-d", $unixtime) ." and had errors

"; 57 | 58 | } 59 | 60 | print " 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | "; 69 | 70 | foreach ( $view["rows"] as $key => $row ) { 71 | 72 | if ( isset( $_GET['search_type'] ) && $_GET['search_type'] == "errors" ) { 73 | if (! $row["value"]["_attachments"]["stderr"]["length"] > 0 ) { 74 | continue; 75 | } 76 | } 77 | 78 | $docid = $row["value"]["_id"]; 79 | print "" . 80 | "" . 81 | "" . 82 | "" . 83 | "" . 84 | "" . 85 | "" . 86 | "" . 87 | "\n"; 88 | } // end of foreach ( $view["rows"] as $key => $row ) 89 | 90 | print "
Start timeJob durationReturn codeUsernameHostnameCommandStdOut (Bytes)StdErr (Bytes)
" . $row["value"]["time"] . "" . $row["value"]["job_duration"] . "" . $row["value"]["return_code"] . "" . $row["value"]["username"] . "" . $row["value"]["hostname"] . "" . $row["value"]["command_line"] . "" . $row["value"]["_attachments"]["stdout"]["length"] . "" . $row["value"]["_attachments"]["stderr"]["length"] . "
"; 91 | 92 | } else { 93 | 94 | print "

No jobs to display

"; 95 | 96 | } 97 | 98 | ?> 99 | 104 | -------------------------------------------------------------------------------- /cronologger: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # if cronologger fails, pass through the command so it still runs. 4 | trap "$*" ERR 5 | 6 | ######################################################################### 7 | # License: Apache 8 | # Author: Vladimir Vuksan 9 | # Version: 0.2 10 | # Purpose: This script will archive cron or for that matter any output 11 | # to a CouchDB document. There are two main drivers 12 | # - Reduce the amount of cron e-mail spam 13 | # - Have logs of cron jobs that can be correlated to adverse events 14 | ######################################################################### 15 | 16 | ######################################################################### 17 | # WHAT YOU NEED TO CHANGE. 18 | # Location of Cronologit CouchDB database 19 | # The settings can be sourced from /etc/cronologger.conf or 20 | # you could supply them as environmental variables e.g. 21 | # export CRONOLOGGER_SERVER=bla.domain.com 22 | # export CRONOLOGGER_DB=cronologger 23 | # Otherwise it defaults to http://localhost:5984/cronologger 24 | ######################################################################### 25 | 26 | [ -e /etc/cronologger.conf ] && . /etc/cronologger.conf 27 | 28 | CRONOLOGGER_SERVER=${CRONOLOGGER_SERVER:=localhost} 29 | CRONOLOGGER_DB=${CRONOLOGGER_DB:=cronologger} 30 | URL_BASE="http://${CRONOLOGGER_SERVER}:5984/${CRONOLOGGER_DB}" 31 | 32 | ################################################### 33 | # BELOW SHOULD LIKELY NOT BE CHANGED 34 | ################################################### 35 | set -eu 36 | 37 | STDOUT=`mktemp` 38 | STDERR=`mktemp` 39 | 40 | ################################################################ 41 | # Record UNIX time when job started 42 | ################################################################ 43 | UNIX_TIME_START=`date "+%s"` 44 | TIME_START=`date "+%Y-%m-%d %T"` 45 | TIME_START_NOSPACES=`date "+%Y%m%d%H%M%S"` 46 | TEMP_FILE=`mktemp` 47 | TEMP_FILE2=`mktemp` 48 | 49 | # Get the FQDN of the host we are running on 50 | HOST=`hostname` 51 | 52 | ############################################################### 53 | # Calculate command sum. This should make doing searches 54 | # much easier. I thought about using MD5 but it 55 | # seemed too long so I am using sum. Change if you wish 56 | # by commenting the line below and uncommenting the line 57 | # below it 58 | ############################################################### 59 | SUM=`echo "$@" | sum | cut -f1 -d" "` 60 | # SUM=`echo "$@" | md5sum -t | cut -f1 -d" "` 61 | 62 | # Document URL. Key contains time, host and command sum 63 | URL="$URL_BASE/${TIME_START_NOSPACES}_${HOST}_${SUM}" 64 | ############################################################### 65 | # Generate Document JSON 66 | # Since the job is in progress we'll set job_duration to -1 67 | # We'll update it once the job finishes 68 | ############################################################### 69 | cat < $TEMP_FILE 70 | { 71 | "hostname": "${HOST}", 72 | "username": "${USER}", 73 | "command_line": "$@", 74 | "unixtime": ${UNIX_TIME_START}, 75 | "job_duration": -1, 76 | "time": "${TIME_START}", 77 | "command_sum": "${SUM}", 78 | } 79 | EOF 80 | 81 | # Create a document 82 | REV=`curl -s -X PUT ${URL} -d @$TEMP_FILE | sed "s/.*rev//g" | awk -F\" '{ print $3}'` 83 | 84 | # Get the resulting JSON since we want to change the job duration once the job_duration 85 | # is finished. 86 | curl -s -o $TEMP_FILE2 ${URL} 87 | 88 | ################################################################ 89 | # Run the command and redirect output 90 | ################################################################ 91 | trap - ERR # if we get to here we no longer need our handler. 92 | set +e 93 | "$@" > $STDOUT 2> $STDERR 94 | # Capture command return code 95 | RETURN_CODE=$? 96 | set -e 97 | 98 | ############################################################### 99 | # Calculate job duration 100 | ############################################################### 101 | UNIX_TIME_END=`date "+%s"` 102 | JOB_DURATION=$((UNIX_TIME_END-UNIX_TIME_START)) 103 | 104 | # Replace the job_duration in the JSON with the actual job duration. Also add the re 105 | sed -i "s/\"job_duration\":-1/\"job_duration\":$JOB_DURATION, \"return_code\": $RETURN_CODE/g" $TEMP_FILE2 106 | 107 | # Update the document to reflect the job duration 108 | REV=`curl -s -X PUT ${URL} -d @$TEMP_FILE2 | sed "s/.*rev//g" | awk -F\" '{ print $3}'` 109 | # Add the standard out attachment 110 | REV=`curl -s -X PUT -H 'Content-Type: text/plain' --data-binary @$STDOUT "$URL/stdout?rev=${REV}"| sed "s/.*rev//g" | awk -F\" '{ print $3}'` 111 | # Add the standard error attachment 112 | REV=`curl -s -X PUT -H 'Content-Type: text/plain' --data-binary @$STDERR "$URL/stderr?rev=${REV}"| sed "s/.*rev//g" | awk -F\" '{ print $3}'` 113 | 114 | # Clean up 115 | rm -f "$STDOUT" "$STDERR" "$TEMP_FILE" "$TEMP_FILE2" 116 | -------------------------------------------------------------------------------- /web/js/jquery.tablesorter.min.js: -------------------------------------------------------------------------------- 1 | 2 | (function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;ib)?1:0));};function sortTextDesc(a,b){return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i__couch_data = new stdClass(); 35 | $this->__couch_data->client = $client; 36 | $this->__couch_data->fields = new stdClass(); 37 | $this->__couch_data->autocommit = true; 38 | } 39 | 40 | /** 41 | * load a CouchDB document from the CouchDB server 42 | * 43 | * @param string $id CouchDB document ID 44 | * @return couchDocument $this 45 | */ 46 | public function load ( $id ) { 47 | if ( !strlen($id) ) throw new InvalidArgumentException("No id given"); 48 | $this->__couch_data->fields = $this->__couch_data->client->getDoc($id); 49 | return $this; 50 | } 51 | 52 | /** 53 | * Set the auto-commit mode (default true) 54 | * 55 | * If set to false, you should explicitely call the record() method : 56 | * 57 | * $couchdoc->setAutocommit(false); 58 | * $couchdoc->somefield = "foo"; 59 | * $couchdoc->someotherfield = "bar"; 60 | * $couchdoc->record(); 61 | * 62 | * 63 | * @param boolean $commit turn on or off the autocommit feature 64 | * @return couchDocument $this 65 | */ 66 | public function setAutocommit($commit) { 67 | $this->__couch_data->autocommit = (boolean)true; 68 | return $this; 69 | } 70 | 71 | /** 72 | * get current auto-commit state (on or off) 73 | * 74 | * @return boolean true if auto-commit is enabled 75 | */ 76 | public function getAutocommit() { 77 | return $this->__couch_data->autocommit; 78 | } 79 | 80 | /** 81 | * load a CouchDB document from a PHP object 82 | * 83 | * note that this method clones the object given in argument 84 | * 85 | * @param object $doc CouchDB document (should have $doc->_id , $doc->_rev, ...) 86 | * @return couchDocument $this 87 | */ 88 | public function loadFromObject($doc) { 89 | $this->__couch_data->fields = clone $doc; 90 | return $this; 91 | } 92 | 93 | /** 94 | * load a document in a couchDocument object and return it 95 | * 96 | * @static 97 | * @param couchClient $client couchClient instance 98 | * @param string $id id of the document to load 99 | * @return couchDocument couch document loaded with data of document $id 100 | */ 101 | public static function getInstance(couchClient $client,$id) { 102 | $back = new couchDocument($client); 103 | return $back->load($id); 104 | } 105 | 106 | /** 107 | * returns all defined keys in this document 108 | * 109 | * @return array list of keys available in this document 110 | */ 111 | public function getKeys ( ) { 112 | return array_keys(get_object_vars($this->__couch_data->fields)); 113 | } 114 | 115 | /** 116 | * returns all fields (key => values) of this document 117 | * 118 | * @return object all fields of the document 119 | */ 120 | public function getFields () { 121 | return clone $this->__couch_data->fields; 122 | } 123 | 124 | /** 125 | * returns document URI 126 | * 127 | * example : couch.server.com:5984/mydb/thisdoc 128 | * 129 | * @return string document URI 130 | */ 131 | public function getUri() { 132 | return $this->__couch_data->client->getDatabaseUri().'/'.$this->id(); 133 | } 134 | 135 | /** 136 | * returns document id (or null) 137 | * 138 | * @return string document id 139 | */ 140 | public function id() { 141 | return $this->get('_id'); 142 | } 143 | 144 | /** 145 | * returns value of field $key 146 | * 147 | * @param string $key field name 148 | * @return mixed field value (or null) 149 | */ 150 | public function get ( $key ) { 151 | //echo "get for $key\n"; 152 | $key = (string)$key; 153 | if (!strlen($key) ) throw new InvalidArgumentException("No key given"); 154 | return property_exists( $this->__couch_data->fields,$key ) ? $this->__couch_data->fields->$key : NULL; 155 | } 156 | 157 | /** 158 | * PHP magic method : getter 159 | * 160 | * @see get() 161 | */ 162 | public function __get ( $key ) { 163 | return $this->get($key); 164 | } 165 | 166 | /** 167 | * set one field to a value 168 | * 169 | * does not update the database 170 | * 171 | * @param string $key field name 172 | * @param mixed $value field value 173 | * @return boolean TRUE 174 | */ 175 | protected function setOne ($key, $value ) { 176 | $key = (string)$key; 177 | if ( !strlen($key) ) throw new InvalidArgumentException("property name can't be empty"); 178 | if ( $key == '_rev' ) throw new InvalidArgumentException("Can't set _rev field"); 179 | if ( $key == '_id' AND $this->get('_id') ) throw new InvalidArgumentException("Can't set _id field because it's already set"); 180 | if ( substr($key,0,1) == '_' AND !in_array($key,couchClient::$allowed_underscored_properties) ) 181 | throw new InvalidArgumentException("Property $key can't begin with an underscore"); 182 | //echo "setting $key to ".print_r($value,TRUE)."
\n"; 183 | $this->__couch_data->fields->$key = $value; 184 | return TRUE; 185 | } 186 | 187 | /** 188 | * record the object to the database 189 | * 190 | * 191 | */ 192 | public function record() { 193 | foreach ( couchClient::$underscored_properties_to_remove_on_storage as $key ) { 194 | if ( property_exists($this->__couch_data->fields,$key) ) { 195 | unset( $this->__couch_data->fields->$key ); 196 | } 197 | } 198 | $response = $this->__couch_data->client->storeDoc($this->__couch_data->fields); 199 | $this->__couch_data->fields->_id = $response->id; 200 | $this->__couch_data->fields->_rev = $response->rev; 201 | } 202 | 203 | /** 204 | * set document fields 205 | * 206 | * this method store the object in the database ! 207 | * 208 | * there is 2 ways to use it. Set one field : 209 | * 210 | * $this->set('some_field','some value'); 211 | * 212 | * 213 | * or set multiple fields in one go : 214 | * 215 | * $this->set( array('some_field'=>'some value','some_other_field'=>'another value') ); 216 | * 217 | * 218 | * @param string|array $key 219 | * @param mixed $value 220 | * 221 | */ 222 | public function set ( $key , $value = NULL ) { 223 | 224 | if ( func_num_args() == 1 ) { 225 | if ( !is_array($key) AND !is_object($key) ) throw new InvalidArgumentException("When second argument is null, first argument should ba an array or an object"); 226 | foreach ( $key as $one_key => $one_value ) { 227 | $this->setOne($one_key,$one_value); 228 | } 229 | } else { 230 | $this->setOne($key,$value); 231 | } 232 | if ( $this->__couch_data->autocommit ) { 233 | $this->record(); 234 | } 235 | return TRUE; 236 | } 237 | 238 | /** 239 | * PHP automagic setter 240 | * 241 | * modify a document property and store to the Server 242 | * 243 | * @link http://php.net/__set 244 | * 245 | * @param string $key name of the property to set 246 | * @param mixed $value property value 247 | */ 248 | public function __set( $key , $value ) { 249 | return $this->set($key,$value); 250 | } 251 | 252 | /** 253 | * PHP automagic isset'er 254 | * 255 | * 256 | * @link http://php.net/__isset 257 | * 258 | * @param string $key name of the property to test 259 | */ 260 | public function __isset($key) { 261 | return property_exists($this->__couch_data->fields,$key); 262 | } 263 | 264 | /** 265 | * deletes a document property 266 | * 267 | * @param string $key the key to remove 268 | * @return boolean whether the removal process ran successfully 269 | */ 270 | public function remove($key) { 271 | $key = (string)$key; 272 | if ( !strlen($key) ) throw new InvalidArgumentException("Can't remove a key without name"); 273 | if ( $key == '_id' OR $key == '_rev' ) return FALSE; 274 | if ( isset($this->$key) ) { 275 | unset($this->__couch_data->fields->$key); 276 | $this->record(); 277 | } 278 | return TRUE; 279 | } 280 | 281 | /** 282 | * PHP automagic unset'er 283 | * 284 | * @see remove() 285 | * @param string $key the property to delete 286 | * @return boolean whether the removal process ran successfully 287 | */ 288 | public function __unset($key) { 289 | return $this->remove($key); 290 | } 291 | 292 | /** 293 | * Replicates document on another couchDB database 294 | * 295 | * @param string $url the database to replicate to ( eg. "http://localhost:5984/foo" or "foo" ) 296 | * @param boolean $create_target if set to true, target database will be created if needed 297 | * @return boolean tell if document replication succeded 298 | */ 299 | public function replicateTo($url, $create_target = false) { 300 | echo "replicateTo : ".$this->_id.", $url\n"; 301 | if ( !isset($this->_id) ) { 302 | throw new InvalidArgumentException("Can't replicate a document without id"); 303 | } 304 | if ( !class_exists("couchReplicator") ) { 305 | return false; 306 | } 307 | $r = new couchReplicator($this->__couch_data->client); 308 | if ( $create_target ) { 309 | $r->create_target(); 310 | } 311 | try { 312 | $res = $r ->doc_ids( array( $this->_id ) ) 313 | ->to($url); 314 | } catch ( Exception $e ) { 315 | return false; 316 | } 317 | print_r($res); 318 | return true; 319 | } 320 | 321 | 322 | /** 323 | * Replicates document on another couchDB database 324 | * 325 | * @param string $id id of the document to replicate 326 | * @param string $url the database to replicate from ( eg. "http://localhost:5984/foo" or "foo" ) 327 | * @param boolean $create_target if set to true, target database will be created if needed 328 | * @return boolean tell if document replication succeded 329 | */ 330 | public function replicateFrom($id, $url, $create_target = false) { 331 | echo "replicateFrom : $id, $url\n"; 332 | if ( !class_exists("couchReplicator") ) { 333 | return false; 334 | } 335 | $r = new couchReplicator($this->__couch_data->client); 336 | if ( $create_target ) { 337 | $r->create_target(); 338 | } 339 | $r->doc_ids( array( $id ) )->from($url); 340 | $this->load($id); 341 | return true; 342 | } 343 | 344 | /** 345 | * Attach a file to a document 346 | * 347 | * 348 | * @param string $file the attachment file (local storage) 349 | * @param string $content_type the attachment content-type (defaults to 'application/octet-stream') 350 | * @param string $filename the attachment filename. If not specified, the basename of "$file" will be used 351 | * @return object CouchDB attachment storage response 352 | */ 353 | public function storeAttachment($file, $content_type = 'application/octet-stream',$filename = null) { 354 | $back = $this->__couch_data->client->storeAttachment($this,$file,$content_type,$filename); 355 | $this->load($this->_id); 356 | return $back; 357 | } 358 | 359 | /** 360 | * Attach data as a document attachment 361 | * 362 | * 363 | * @param string $data the attachment contents 364 | * @param string $filename the attachment filename. 365 | * @param string $content_type the attachment content-type (defaults to 'application/octet-stream') 366 | * @return object CouchDB attachment storage response 367 | */ 368 | public function storeAsAttachment ($data,$filename,$content_type = 'application/octet-stream') { 369 | $back = $this->__couch_data->client->storeAsAttachment($this,$data,$filename,$content_type); 370 | $this->load($this->_id); 371 | return $back; 372 | } 373 | 374 | /** 375 | * Deletes an attachment 376 | * 377 | * @param string $attachment_name name of the document attachment 378 | * @return object CouchDB attachment removal response 379 | */ 380 | public function deleteAttachment ($attachment_name) { 381 | $back = $this->__couch_data->client->deleteAttachment( $this , $attachment_name ); 382 | $this->load($this->_id); 383 | return $back; 384 | } 385 | 386 | /** 387 | * returns the URI of a document attachment 388 | * 389 | * @param string $attachment_name the name of the attachment (relative to the document) 390 | * @return string the attachment URI 391 | */ 392 | public function getAttachmentUri ($attachment_name ) { 393 | return $this->getUri().'/'.$attachment_name; 394 | } 395 | 396 | /** 397 | * just a proxy method to couchClient->getShow() 398 | * 399 | * @param string $id name of the design document containing the show function 400 | * @param string $name name of the show function 401 | * @param array $additionnal_params other parameters to send to couchServer 402 | * @return mixed CouchDB show response 403 | */ 404 | public function show ( $id,$name,$additionnal_params = array() ) { 405 | return $this->__couch_data->client->getShow($id,$name,$this->_id,$additionnal_params); 406 | } 407 | 408 | /** 409 | * just a proxy method to couchClient->updateDoc 410 | * 411 | * @param string $id name of the design document containing the update function 412 | * @param string $name name of the update function 413 | * @param array $additionnal_params other parameters to send to couch 414 | * @return mixed couchDB update response 415 | */ 416 | public function update( $id,$name,$additionnal_params = array() ) { 417 | if ( !$this->_id ) return false; 418 | $back = $this->__couch_data->client->updateDoc($id,$name, $additionnal_params, $this->_id); 419 | // we should reload document to be sure that we have an up-to-date version 420 | $this->load($this->_id); 421 | return $back; 422 | } 423 | } -------------------------------------------------------------------------------- /web/lib/couch.php: -------------------------------------------------------------------------------- 1 | dsn = preg_replace('@/+$@','',$dsn); 64 | $this->options = $options; 65 | $this->dsn_parsed = parse_url($this->dsn); 66 | if ( !isset($this->dsn_parsed['port']) ) { 67 | $this->dsn_parsed['port'] = 80; 68 | } 69 | if ( function_exists('curl_init') ) $this->curl = TRUE; 70 | } 71 | 72 | /** 73 | * return a part of the data source name 74 | * 75 | * @param string $part part to return 76 | * @return string DSN part 77 | */ 78 | public function dsn_part($part) { 79 | if ( isset($this->dsn_parsed[$part]) ) { 80 | return $this->dsn_parsed[$part]; 81 | } 82 | } 83 | 84 | /** 85 | * parse a CouchDB server response and sends back an array 86 | * the array contains keys : 87 | * status_code : the HTTP status code returned by the server 88 | * status_message : the HTTP message related to the status code 89 | * body : the response body (if any). If CouchDB server response Content-Type is application/json 90 | * the body will by json_decode()d 91 | * 92 | * @static 93 | * @param string $raw_data data sent back by the server 94 | * @param boolean $json_as_array is true, the json response will be decoded as an array. Is false, it's decoded as an object 95 | * @return array CouchDB response 96 | */ 97 | public static function parseRawResponse($raw_data, $json_as_array = FALSE) { 98 | if ( !strlen($raw_data) ) throw new InvalidArgumentException("no data to parse"); 99 | if ( !substr_compare($raw_data, "HTTP/1.1 100 Continue\r\n\r\n", 0, 25) ) { 100 | $raw_data = substr($raw_data, 25); 101 | } 102 | $response = array('body'=>null); 103 | list($headers, $body) = explode("\r\n\r\n", $raw_data,2); 104 | // echo "Headers : $headers , Body : $body\n"; 105 | $headers_array=explode("\n",$headers); 106 | $status_line = reset($headers_array); 107 | $status_array = explode(' ',$status_line,3); 108 | $response['status_code'] = trim($status_array[1]); 109 | $response['status_message'] = trim($status_array[2]); 110 | if ( strlen($body) ) { 111 | $response['body'] = preg_match('@Content-Type:\s+application/json@i',$headers) ? json_decode($body,$json_as_array) : $body ; 112 | } 113 | return $response; 114 | } 115 | 116 | /** 117 | *send a query to the CouchDB server 118 | * 119 | * @param string $method HTTP method to use (GET, POST, ...) 120 | * @param string $url URL to fetch 121 | * @param array $parameters additionnal parameters to send with the request 122 | * @param string|array|object $data request body 123 | * 124 | * @return string|false server response on success, false on error 125 | */ 126 | public function query ( $method, $url, $parameters = array() , $data = NULL ) { 127 | if ( $this->curl ) return $this->_curl_query($method,$url,$parameters, $data); 128 | else return $this->_socket_query($method,$url,$parameters, $data); 129 | } 130 | 131 | /** 132 | * record a file located on the disk as a CouchDB attachment 133 | * 134 | * @param string $url CouchDB URL to store the file to 135 | * @param string $file path to the on-disk file 136 | * @param string $content_type attachment content_type 137 | * 138 | * @return string server response 139 | */ 140 | public function storeFile ( $url, $file, $content_type ) { 141 | if ( $this->curl ) return $this->_curl_storeFile($url,$file,$content_type); 142 | else return $this->_socket_storeFile($url,$file,$content_type); 143 | } 144 | 145 | /** 146 | * store some data as a CouchDB attachment 147 | * 148 | * @param string $url CouchDB URL to store the file to 149 | * @param string $data data to send as the attachment content 150 | * @param string $content_type attachment content_type 151 | * 152 | * @return string server response 153 | */ 154 | public function storeAsFile($url,$data,$content_type) { 155 | if ( $this->curl ) return $this->_curl_storeAsFile($url,$data,$content_type); 156 | else return $this->_socket_storeAsFile($url,$data,$content_type); 157 | 158 | } 159 | 160 | /** 161 | *send a query to the CouchDB server 162 | * 163 | * In a continuous query, the server send headers, and then a JSON object per line. 164 | * On each line received, the $callable callback is fired, with two arguments : 165 | * 166 | * - the JSON object decoded as a PHP object 167 | * 168 | * - a couchClient instance to use to make queries inside the callback 169 | * 170 | * If the callable returns the boolean FALSE , continuous reading stops. 171 | * 172 | * @param callable $callable PHP function name / callable array ( see http://php.net/is_callable ) 173 | * @param string $method HTTP method to use (GET, POST, ...) 174 | * @param string $url URL to fetch 175 | * @param array $parameters additionnal parameters to send with the request 176 | * @param string|array|object $data request body 177 | * 178 | * @return string|false server response on success, false on error 179 | */ 180 | public function continuousQuery($callable,$method,$url,$parameters = array(),$data = null) { 181 | if ( !in_array($method, $this->HTTP_METHODS ) ) 182 | throw new Exception("Bad HTTP method: $method"); 183 | if ( !is_callable($callable) ) 184 | throw new InvalidArgumentException("callable argument have to success to is_callable PHP function"); 185 | if ( is_array($parameters) AND count($parameters) ) 186 | $url = $url.'?'.http_build_query($parameters); 187 | 188 | $request = $this->_socket_buildRequest($method,$url,$data); 189 | if ( !$this->_connect() ) return FALSE; 190 | fwrite($this->socket, $request); 191 | $response = ''; 192 | $code=0; 193 | $headers = false; 194 | while (!feof($this->socket)&& !$headers) { 195 | $response.=fgets($this->socket); 196 | if (preg_match("/\r\n\r\n$/",$response) ) { 197 | $headers = true; 198 | } 199 | } 200 | $headers = explode("\n",trim($response)); 201 | $split=explode(" ",trim(reset($headers))); 202 | $code = $split[1]; 203 | unset($split); 204 | 205 | $c = clone $this; 206 | 207 | while ($this->socket && !feof($this->socket)) { 208 | $e = NULL; 209 | $e2 = NULL; 210 | $read = array($this->socket); 211 | if (false === ($num_changed_streams = stream_select($read, $e, $e2, 1))) { 212 | $this->socket = null; 213 | } elseif ($num_changed_streams > 0) { 214 | $line = fgets($this->socket); 215 | if ( strlen(trim($line)) ) { 216 | $break = call_user_func($callable,json_decode($line),$c); 217 | if ( $break === FALSE ) { 218 | fclose($this->socket); 219 | } 220 | } 221 | } 222 | } 223 | return $code; 224 | } 225 | 226 | /** 227 | *send a query to the CouchDB server 228 | * 229 | * @param string $method HTTP method to use (GET, POST, ...) 230 | * @param string $url URL to fetch 231 | * @param array $parameters additionnal parameters to send with the request 232 | * @param string|array|object $data request body 233 | * 234 | * @return string|false server response on success, false on error 235 | */ 236 | public function _socket_query ( $method, $url, $parameters = array() , $data = NULL ) { 237 | if ( !in_array($method, $this->HTTP_METHODS ) ) 238 | throw new Exception("Bad HTTP method: $method"); 239 | 240 | if ( is_array($parameters) AND count($parameters) ) 241 | $url = $url.'?'.http_build_query($parameters); 242 | 243 | $request = $this->_socket_buildRequest($method,$url,$data); 244 | if ( !$this->_connect() ) return FALSE; 245 | $raw_response = $this->_execute($request); 246 | $this->_disconnect(); 247 | 248 | //log_message('debug',"COUCH : Executed query $method $url"); 249 | //log_message('debug',"COUCH : ".$raw_response); 250 | return $raw_response; 251 | } 252 | 253 | 254 | /** 255 | * returns first lines of request headers 256 | * 257 | * lines : 258 | * 259 | * VERB HTTP/1.0 260 | * Host: my.super.server.com 261 | * Authorization: Basic... 262 | * Accept: application/json,text/html,text/plain,* /* 263 | * 264 | * 265 | * @param string $method HTTP method to use 266 | * @param string $url the request URL 267 | * @return string start of HTTP request 268 | */ 269 | protected function _socket_startRequestHeaders($method,$url) { 270 | $req = "$method $url HTTP/1.0\r\nHost: ".$this->dsn_part('host')."\r\n"; 271 | if ( $this->dsn_part('user') && $this->dsn_part('pass') ) { 272 | $req .= 'Authorization: Basic '.base64_encode($this->dsn_part('user').':'. 273 | $this->dsn_part('pass'))."\r\n"; 274 | } 275 | $req.="Accept: application/json,text/html,text/plain,*/*\r\n"; 276 | 277 | return $req; 278 | } 279 | 280 | /** 281 | * build HTTP request to send to the server 282 | * 283 | * @param string $method HTTP method to use 284 | * @param string $url the request URL 285 | * @param string|object|array $data the request body. If it's an array or an object, $data is json_encode()d 286 | * @return string HTTP request 287 | */ 288 | protected function _socket_buildRequest($method,$url,$data) { 289 | if ( is_object($data) OR is_array($data) ) 290 | $data = json_encode($data); 291 | $req = $this->_socket_startRequestHeaders($method,$url); 292 | 293 | if ( $method == 'COPY') { 294 | $req .= 'Destination: '.$data."\r\n\r\n"; 295 | } elseif ($data) { 296 | $req .= 'Content-Length: '.strlen($data)."\r\n"; 297 | $req .= 'Content-Type: application/json'."\r\n\r\n"; 298 | $req .= $data."\r\n"; 299 | } else { 300 | $req .= "\r\n"; 301 | } 302 | return $req; 303 | } 304 | 305 | /** 306 | * record a file located on the disk as a CouchDB attachment 307 | * uses PHP socket API 308 | * 309 | * @param string $url CouchDB URL to store the file to 310 | * @param string $file path to the on-disk file 311 | * @param string $content_type attachment content_type 312 | * 313 | * @return string server response 314 | */ 315 | protected function _socket_storeFile($url,$file,$content_type) { 316 | 317 | if ( !strlen($url) ) throw new InvalidArgumentException("Attachment URL can't be empty"); 318 | if ( !strlen($file) OR !is_file($file) OR !is_readable($file) ) throw new InvalidArgumentException("Attachment file does not exist or is not readable"); 319 | if ( !strlen($content_type) ) throw new InvalidArgumentException("Attachment Content Type can't be empty"); 320 | $req = $this->_socket_startRequestHeaders('PUT',$url); 321 | $req .= 'Content-Length: '.filesize($file)."\r\n" 322 | .'Content-Type: '.$content_type."\r\n\r\n"; 323 | $fstream=fopen($file,'r'); 324 | $this->_connect(); 325 | fwrite($this->socket, $req); 326 | stream_copy_to_stream($fstream,$this->socket); 327 | $response = ''; 328 | while(!feof($this->socket)) 329 | $response .= fgets($this->socket); 330 | $this->_disconnect(); 331 | fclose($fstream); 332 | return $response; 333 | } 334 | 335 | 336 | /** 337 | * store some data as a CouchDB attachment 338 | * uses PHP socket API 339 | * 340 | * @param string $url CouchDB URL to store the file to 341 | * @param string $data data to send as the attachment content 342 | * @param string $content_type attachment content_type 343 | * 344 | * @return string server response 345 | */ 346 | public function _socket_storeAsFile($url,$data,$content_type) { 347 | if ( !strlen($url) ) throw new InvalidArgumentException("Attachment URL can't be empty"); 348 | if ( !strlen($content_type) ) throw new InvalidArgumentException("Attachment Content Type can't be empty"); 349 | 350 | $req = $this->_socket_startRequestHeaders('PUT',$url); 351 | $req .= 'Content-Length: '.strlen($data)."\r\n" 352 | .'Content-Type: '.$content_type."\r\n\r\n"; 353 | $this->_connect(); 354 | fwrite($this->socket, $req); 355 | fwrite($this->socket, $data); 356 | $response = ''; 357 | while(!feof($this->socket)) 358 | $response .= fgets($this->socket); 359 | $this->_disconnect(); 360 | return $response; 361 | } 362 | 363 | /** 364 | *open the connection to the CouchDB server 365 | * 366 | *This function can throw an Exception if it fails 367 | * 368 | * @return boolean wheter the connection is successful 369 | */ 370 | protected function _connect() { 371 | $ssl = $this->dsn_part('scheme') == 'https' ? 'ssl://' : ''; 372 | $this->socket = @fsockopen($ssl.$this->dsn_part('host'), $this->dsn_part('port'), $err_num, $err_string); 373 | if(!$this->socket) { 374 | throw new Exception('Could not open connection to '.$this->dsn_part('host').':'.$this->dsn_part('port').': '.$err_string.' ('.$err_num.')'); 375 | return FALSE; 376 | } 377 | return TRUE; 378 | } 379 | 380 | /** 381 | *send the HTTP request to the server and read the response 382 | * 383 | * @param string $request HTTP request to send 384 | * @return string $response HTTP response from the CouchDB server 385 | */ 386 | protected function _execute($request) { 387 | fwrite($this->socket, $request); 388 | $response = ''; 389 | while(!feof($this->socket)) 390 | $response .= fgets($this->socket); 391 | return $response; 392 | } 393 | 394 | /** 395 | *closes the connection to the server 396 | * 397 | * 398 | */ 399 | protected function _disconnect() { 400 | @fclose($this->socket); 401 | $this->socket = NULL; 402 | } 403 | 404 | 405 | /** 406 | * build HTTP request to send to the server 407 | * uses PHP cURL API 408 | * 409 | * @param string $method HTTP method to use 410 | * @param string $url the request URL 411 | * @param string|object|array $data the request body. If it's an array or an object, $data is json_encode()d 412 | * @return resource CURL request resource 413 | */ 414 | protected function _curl_buildRequest($method,$url,$data) { 415 | $http = curl_init($url); 416 | $http_headers = array('Accept: application/json,text/html,text/plain,*/*') ; 417 | if ( is_object($data) OR is_array($data) ) 418 | $data = json_encode($data); 419 | 420 | curl_setopt($http, CURLOPT_CUSTOMREQUEST, $method); 421 | 422 | if ( $method == 'COPY') { 423 | $http_headers[] = "Destination: $data"; 424 | } elseif ($data) { 425 | curl_setopt($http, CURLOPT_POSTFIELDS, $data); 426 | } 427 | curl_setopt($http, CURLOPT_HTTPHEADER,$http_headers); 428 | return $http; 429 | } 430 | 431 | 432 | /** 433 | *send a query to the CouchDB server 434 | * uses PHP cURL API 435 | * 436 | * @param string $method HTTP method to use (GET, POST, ...) 437 | * @param string $url URL to fetch 438 | * @param array $parameters additionnal parameters to send with the request 439 | * @param string|array|object $data request body 440 | * 441 | * @return string|false server response on success, false on error 442 | */ 443 | public function _curl_query ( $method, $url, $parameters = array() , $data = NULL ) { 444 | // echo "_curl_query : $method $url ".print_r($parameters,true)." , ".print_r($data,true); 445 | if ( !in_array($method, $this->HTTP_METHODS ) ) 446 | throw new Exception("Bad HTTP method: $method"); 447 | 448 | $url = $this->dsn.$url; 449 | if ( is_array($parameters) AND count($parameters) ) 450 | $url = $url.'?'.http_build_query($parameters); 451 | // echo $url; 452 | $http = $this->_curl_buildRequest($method,$url,$data); 453 | curl_setopt($http,CURLOPT_HEADER, true); 454 | curl_setopt($http,CURLOPT_RETURNTRANSFER, true); 455 | curl_setopt($http,CURLOPT_FOLLOWLOCATION, true); 456 | 457 | $response = curl_exec($http); 458 | curl_close($http); 459 | // echo $response; 460 | 461 | return $response; 462 | //log_message('debug',"COUCH : Executed query $method $url"); 463 | //log_message('debug',"COUCH : ".$raw_response); 464 | 465 | } 466 | 467 | /** 468 | * record a file located on the disk as a CouchDB attachment 469 | * uses PHP cURL API 470 | * 471 | * @param string $url CouchDB URL to store the file to 472 | * @param string $file path to the on-disk file 473 | * @param string $content_type attachment content_type 474 | * 475 | * @return string server response 476 | */ 477 | public function _curl_storeFile ( $url, $file, $content_type ) { 478 | if ( !strlen($url) ) throw new InvalidArgumentException("Attachment URL can't be empty"); 479 | if ( !strlen($file) OR !is_file($file) OR !is_readable($file) ) throw new InvalidArgumentException("Attachment file does not exist or is not readable"); 480 | if ( !strlen($content_type) ) throw new InvalidArgumentException("Attachment Content Type can't be empty"); 481 | $url = $this->dsn.$url; 482 | $http = curl_init($url); 483 | $http_headers = array('Accept: application/json,text/html,text/plain,*/*','Content-Type: '.$content_type,'Expect: ') ; 484 | curl_setopt($http, CURLOPT_PUT, 1); 485 | curl_setopt($http, CURLOPT_HTTPHEADER,$http_headers); 486 | curl_setopt($http, CURLOPT_UPLOAD, true); 487 | curl_setopt($http, CURLOPT_HEADER, true); 488 | curl_setopt($http, CURLOPT_RETURNTRANSFER, true); 489 | curl_setopt($http, CURLOPT_FOLLOWLOCATION, true); 490 | $fstream=fopen($file,'r'); 491 | curl_setopt($http, CURLOPT_INFILE, $fstream); 492 | curl_setopt($http, CURLOPT_INFILESIZE, filesize($file)); 493 | $response = curl_exec($http); 494 | fclose($fstream); 495 | curl_close($http); 496 | return $response; 497 | } 498 | 499 | /** 500 | * store some data as a CouchDB attachment 501 | * uses PHP cURL API 502 | * 503 | * @param string $url CouchDB URL to store the file to 504 | * @param string $data data to send as the attachment content 505 | * @param string $content_type attachment content_type 506 | * 507 | * @return string server response 508 | */ 509 | public function _curl_storeAsFile($url,$data,$content_type) { 510 | if ( !strlen($url) ) throw new InvalidArgumentException("Attachment URL can't be empty"); 511 | if ( !strlen($content_type) ) throw new InvalidArgumentException("Attachment Content Type can't be empty"); 512 | $url = $this->dsn.$url; 513 | $http = curl_init($url); 514 | $http_headers = array('Accept: application/json,text/html,text/plain,*/*','Content-Type: '.$content_type,'Expect: ','Content-Length: '.strlen($data)) ; 515 | curl_setopt($http, CURLOPT_CUSTOMREQUEST, 'PUT'); 516 | curl_setopt($http, CURLOPT_HTTPHEADER,$http_headers); 517 | curl_setopt($http, CURLOPT_HEADER, true); 518 | curl_setopt($http, CURLOPT_RETURNTRANSFER, true); 519 | curl_setopt($http, CURLOPT_FOLLOWLOCATION, true); 520 | curl_setopt($http, CURLOPT_POSTFIELDS, $data); 521 | $response = curl_exec($http); 522 | curl_close($http); 523 | return $response; 524 | } 525 | 526 | } 527 | 528 | -------------------------------------------------------------------------------- /web/css/flick/jquery-ui-1.8.6.custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery UI CSS Framework 1.8.6 3 | * 4 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Theming/API 9 | */ 10 | 11 | /* Layout helpers 12 | ----------------------------------*/ 13 | .ui-helper-hidden { display: none; } 14 | .ui-helper-hidden-accessible { position: absolute; left: -99999999px; } 15 | .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } 16 | .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } 17 | .ui-helper-clearfix { display: inline-block; } 18 | /* required comment for clearfix to work in Opera \*/ 19 | * html .ui-helper-clearfix { height:1%; } 20 | .ui-helper-clearfix { display:block; } 21 | /* end clearfix */ 22 | .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } 23 | 24 | 25 | /* Interaction Cues 26 | ----------------------------------*/ 27 | .ui-state-disabled { cursor: default !important; } 28 | 29 | 30 | /* Icons 31 | ----------------------------------*/ 32 | 33 | /* states and images */ 34 | .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } 35 | 36 | 37 | /* Misc visuals 38 | ----------------------------------*/ 39 | 40 | /* Overlays */ 41 | .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } 42 | 43 | 44 | /* 45 | * jQuery UI CSS Framework 1.8.6 46 | * 47 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 48 | * Dual licensed under the MIT or GPL Version 2 licenses. 49 | * http://jquery.org/license 50 | * 51 | * http://docs.jquery.com/UI/Theming/API 52 | * 53 | * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Helvetica,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=2px&bgColorHeader=dddddd&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=50&borderColorHeader=dddddd&fcHeader=444444&iconColorHeader=0073ea&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=dddddd&fcContent=444444&iconColorContent=ff0084&bgColorDefault=f6f6f6&bgTextureDefault=03_highlight_soft.png&bgImgOpacityDefault=100&borderColorDefault=dddddd&fcDefault=0073ea&iconColorDefault=666666&bgColorHover=0073ea&bgTextureHover=03_highlight_soft.png&bgImgOpacityHover=25&borderColorHover=0073ea&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=dddddd&fcActive=ff0084&iconColorActive=454545&bgColorHighlight=ffffff&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=cccccc&fcHighlight=444444&iconColorHighlight=0073ea&bgColorError=ffffff&bgTextureError=01_flat.png&bgImgOpacityError=55&borderColorError=ff0084&fcError=222222&iconColorError=ff0084&bgColorOverlay=eeeeee&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=80&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=60&thicknessShadow=4px&offsetTopShadow=-4px&offsetLeftShadow=-4px&cornerRadiusShadow=0px 54 | */ 55 | 56 | 57 | /* Component containers 58 | ----------------------------------*/ 59 | .ui-widget { font-family: Helvetica, Arial, sans-serif; font-size: 1.1em; } 60 | .ui-widget .ui-widget { font-size: 1em; } 61 | .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Helvetica, Arial, sans-serif; font-size: 1em; } 62 | .ui-widget-content { border: 1px solid #dddddd; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #444444; } 63 | .ui-widget-content a { color: #444444; } 64 | .ui-widget-header { border: 1px solid #dddddd; background: #dddddd url(images/ui-bg_highlight-soft_50_dddddd_1x100.png) 50% 50% repeat-x; color: #444444; font-weight: bold; } 65 | .ui-widget-header a { color: #444444; } 66 | 67 | /* Interaction states 68 | ----------------------------------*/ 69 | .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #dddddd; background: #f6f6f6 url(images/ui-bg_highlight-soft_100_f6f6f6_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #0073ea; } 70 | .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #0073ea; text-decoration: none; } 71 | .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 #0073ea; background: #0073ea url(images/ui-bg_highlight-soft_25_0073ea_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; } 72 | .ui-state-hover a, .ui-state-hover a:hover { color: #ffffff; text-decoration: none; } 73 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #dddddd; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #ff0084; } 74 | .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ff0084; text-decoration: none; } 75 | .ui-widget :active { outline: none; } 76 | 77 | /* Interaction Cues 78 | ----------------------------------*/ 79 | .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #cccccc; background: #ffffff url(images/ui-bg_flat_55_ffffff_40x100.png) 50% 50% repeat-x; color: #444444; } 80 | .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #444444; } 81 | .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #ff0084; background: #ffffff url(images/ui-bg_flat_55_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } 82 | .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #222222; } 83 | .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #222222; } 84 | .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } 85 | .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } 86 | .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } 87 | 88 | /* Icons 89 | ----------------------------------*/ 90 | 91 | /* states and images */ 92 | .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_ff0084_256x240.png); } 93 | .ui-widget-content .ui-icon {background-image: url(images/ui-icons_ff0084_256x240.png); } 94 | .ui-widget-header .ui-icon {background-image: url(images/ui-icons_0073ea_256x240.png); } 95 | .ui-state-default .ui-icon { background-image: url(images/ui-icons_666666_256x240.png); } 96 | .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } 97 | .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } 98 | .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_0073ea_256x240.png); } 99 | .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ff0084_256x240.png); } 100 | 101 | /* positioning */ 102 | .ui-icon-carat-1-n { background-position: 0 0; } 103 | .ui-icon-carat-1-ne { background-position: -16px 0; } 104 | .ui-icon-carat-1-e { background-position: -32px 0; } 105 | .ui-icon-carat-1-se { background-position: -48px 0; } 106 | .ui-icon-carat-1-s { background-position: -64px 0; } 107 | .ui-icon-carat-1-sw { background-position: -80px 0; } 108 | .ui-icon-carat-1-w { background-position: -96px 0; } 109 | .ui-icon-carat-1-nw { background-position: -112px 0; } 110 | .ui-icon-carat-2-n-s { background-position: -128px 0; } 111 | .ui-icon-carat-2-e-w { background-position: -144px 0; } 112 | .ui-icon-triangle-1-n { background-position: 0 -16px; } 113 | .ui-icon-triangle-1-ne { background-position: -16px -16px; } 114 | .ui-icon-triangle-1-e { background-position: -32px -16px; } 115 | .ui-icon-triangle-1-se { background-position: -48px -16px; } 116 | .ui-icon-triangle-1-s { background-position: -64px -16px; } 117 | .ui-icon-triangle-1-sw { background-position: -80px -16px; } 118 | .ui-icon-triangle-1-w { background-position: -96px -16px; } 119 | .ui-icon-triangle-1-nw { background-position: -112px -16px; } 120 | .ui-icon-triangle-2-n-s { background-position: -128px -16px; } 121 | .ui-icon-triangle-2-e-w { background-position: -144px -16px; } 122 | .ui-icon-arrow-1-n { background-position: 0 -32px; } 123 | .ui-icon-arrow-1-ne { background-position: -16px -32px; } 124 | .ui-icon-arrow-1-e { background-position: -32px -32px; } 125 | .ui-icon-arrow-1-se { background-position: -48px -32px; } 126 | .ui-icon-arrow-1-s { background-position: -64px -32px; } 127 | .ui-icon-arrow-1-sw { background-position: -80px -32px; } 128 | .ui-icon-arrow-1-w { background-position: -96px -32px; } 129 | .ui-icon-arrow-1-nw { background-position: -112px -32px; } 130 | .ui-icon-arrow-2-n-s { background-position: -128px -32px; } 131 | .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } 132 | .ui-icon-arrow-2-e-w { background-position: -160px -32px; } 133 | .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } 134 | .ui-icon-arrowstop-1-n { background-position: -192px -32px; } 135 | .ui-icon-arrowstop-1-e { background-position: -208px -32px; } 136 | .ui-icon-arrowstop-1-s { background-position: -224px -32px; } 137 | .ui-icon-arrowstop-1-w { background-position: -240px -32px; } 138 | .ui-icon-arrowthick-1-n { background-position: 0 -48px; } 139 | .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } 140 | .ui-icon-arrowthick-1-e { background-position: -32px -48px; } 141 | .ui-icon-arrowthick-1-se { background-position: -48px -48px; } 142 | .ui-icon-arrowthick-1-s { background-position: -64px -48px; } 143 | .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } 144 | .ui-icon-arrowthick-1-w { background-position: -96px -48px; } 145 | .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } 146 | .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } 147 | .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } 148 | .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } 149 | .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } 150 | .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } 151 | .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } 152 | .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } 153 | .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } 154 | .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } 155 | .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } 156 | .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } 157 | .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } 158 | .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } 159 | .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } 160 | .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } 161 | .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } 162 | .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } 163 | .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } 164 | .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } 165 | .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } 166 | .ui-icon-arrow-4 { background-position: 0 -80px; } 167 | .ui-icon-arrow-4-diag { background-position: -16px -80px; } 168 | .ui-icon-extlink { background-position: -32px -80px; } 169 | .ui-icon-newwin { background-position: -48px -80px; } 170 | .ui-icon-refresh { background-position: -64px -80px; } 171 | .ui-icon-shuffle { background-position: -80px -80px; } 172 | .ui-icon-transfer-e-w { background-position: -96px -80px; } 173 | .ui-icon-transferthick-e-w { background-position: -112px -80px; } 174 | .ui-icon-folder-collapsed { background-position: 0 -96px; } 175 | .ui-icon-folder-open { background-position: -16px -96px; } 176 | .ui-icon-document { background-position: -32px -96px; } 177 | .ui-icon-document-b { background-position: -48px -96px; } 178 | .ui-icon-note { background-position: -64px -96px; } 179 | .ui-icon-mail-closed { background-position: -80px -96px; } 180 | .ui-icon-mail-open { background-position: -96px -96px; } 181 | .ui-icon-suitcase { background-position: -112px -96px; } 182 | .ui-icon-comment { background-position: -128px -96px; } 183 | .ui-icon-person { background-position: -144px -96px; } 184 | .ui-icon-print { background-position: -160px -96px; } 185 | .ui-icon-trash { background-position: -176px -96px; } 186 | .ui-icon-locked { background-position: -192px -96px; } 187 | .ui-icon-unlocked { background-position: -208px -96px; } 188 | .ui-icon-bookmark { background-position: -224px -96px; } 189 | .ui-icon-tag { background-position: -240px -96px; } 190 | .ui-icon-home { background-position: 0 -112px; } 191 | .ui-icon-flag { background-position: -16px -112px; } 192 | .ui-icon-calendar { background-position: -32px -112px; } 193 | .ui-icon-cart { background-position: -48px -112px; } 194 | .ui-icon-pencil { background-position: -64px -112px; } 195 | .ui-icon-clock { background-position: -80px -112px; } 196 | .ui-icon-disk { background-position: -96px -112px; } 197 | .ui-icon-calculator { background-position: -112px -112px; } 198 | .ui-icon-zoomin { background-position: -128px -112px; } 199 | .ui-icon-zoomout { background-position: -144px -112px; } 200 | .ui-icon-search { background-position: -160px -112px; } 201 | .ui-icon-wrench { background-position: -176px -112px; } 202 | .ui-icon-gear { background-position: -192px -112px; } 203 | .ui-icon-heart { background-position: -208px -112px; } 204 | .ui-icon-star { background-position: -224px -112px; } 205 | .ui-icon-link { background-position: -240px -112px; } 206 | .ui-icon-cancel { background-position: 0 -128px; } 207 | .ui-icon-plus { background-position: -16px -128px; } 208 | .ui-icon-plusthick { background-position: -32px -128px; } 209 | .ui-icon-minus { background-position: -48px -128px; } 210 | .ui-icon-minusthick { background-position: -64px -128px; } 211 | .ui-icon-close { background-position: -80px -128px; } 212 | .ui-icon-closethick { background-position: -96px -128px; } 213 | .ui-icon-key { background-position: -112px -128px; } 214 | .ui-icon-lightbulb { background-position: -128px -128px; } 215 | .ui-icon-scissors { background-position: -144px -128px; } 216 | .ui-icon-clipboard { background-position: -160px -128px; } 217 | .ui-icon-copy { background-position: -176px -128px; } 218 | .ui-icon-contact { background-position: -192px -128px; } 219 | .ui-icon-image { background-position: -208px -128px; } 220 | .ui-icon-video { background-position: -224px -128px; } 221 | .ui-icon-script { background-position: -240px -128px; } 222 | .ui-icon-alert { background-position: 0 -144px; } 223 | .ui-icon-info { background-position: -16px -144px; } 224 | .ui-icon-notice { background-position: -32px -144px; } 225 | .ui-icon-help { background-position: -48px -144px; } 226 | .ui-icon-check { background-position: -64px -144px; } 227 | .ui-icon-bullet { background-position: -80px -144px; } 228 | .ui-icon-radio-off { background-position: -96px -144px; } 229 | .ui-icon-radio-on { background-position: -112px -144px; } 230 | .ui-icon-pin-w { background-position: -128px -144px; } 231 | .ui-icon-pin-s { background-position: -144px -144px; } 232 | .ui-icon-play { background-position: 0 -160px; } 233 | .ui-icon-pause { background-position: -16px -160px; } 234 | .ui-icon-seek-next { background-position: -32px -160px; } 235 | .ui-icon-seek-prev { background-position: -48px -160px; } 236 | .ui-icon-seek-end { background-position: -64px -160px; } 237 | .ui-icon-seek-start { background-position: -80px -160px; } 238 | /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ 239 | .ui-icon-seek-first { background-position: -80px -160px; } 240 | .ui-icon-stop { background-position: -96px -160px; } 241 | .ui-icon-eject { background-position: -112px -160px; } 242 | .ui-icon-volume-off { background-position: -128px -160px; } 243 | .ui-icon-volume-on { background-position: -144px -160px; } 244 | .ui-icon-power { background-position: 0 -176px; } 245 | .ui-icon-signal-diag { background-position: -16px -176px; } 246 | .ui-icon-signal { background-position: -32px -176px; } 247 | .ui-icon-battery-0 { background-position: -48px -176px; } 248 | .ui-icon-battery-1 { background-position: -64px -176px; } 249 | .ui-icon-battery-2 { background-position: -80px -176px; } 250 | .ui-icon-battery-3 { background-position: -96px -176px; } 251 | .ui-icon-circle-plus { background-position: 0 -192px; } 252 | .ui-icon-circle-minus { background-position: -16px -192px; } 253 | .ui-icon-circle-close { background-position: -32px -192px; } 254 | .ui-icon-circle-triangle-e { background-position: -48px -192px; } 255 | .ui-icon-circle-triangle-s { background-position: -64px -192px; } 256 | .ui-icon-circle-triangle-w { background-position: -80px -192px; } 257 | .ui-icon-circle-triangle-n { background-position: -96px -192px; } 258 | .ui-icon-circle-arrow-e { background-position: -112px -192px; } 259 | .ui-icon-circle-arrow-s { background-position: -128px -192px; } 260 | .ui-icon-circle-arrow-w { background-position: -144px -192px; } 261 | .ui-icon-circle-arrow-n { background-position: -160px -192px; } 262 | .ui-icon-circle-zoomin { background-position: -176px -192px; } 263 | .ui-icon-circle-zoomout { background-position: -192px -192px; } 264 | .ui-icon-circle-check { background-position: -208px -192px; } 265 | .ui-icon-circlesmall-plus { background-position: 0 -208px; } 266 | .ui-icon-circlesmall-minus { background-position: -16px -208px; } 267 | .ui-icon-circlesmall-close { background-position: -32px -208px; } 268 | .ui-icon-squaresmall-plus { background-position: -48px -208px; } 269 | .ui-icon-squaresmall-minus { background-position: -64px -208px; } 270 | .ui-icon-squaresmall-close { background-position: -80px -208px; } 271 | .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } 272 | .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } 273 | .ui-icon-grip-solid-vertical { background-position: -32px -224px; } 274 | .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } 275 | .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } 276 | .ui-icon-grip-diagonal-se { background-position: -80px -224px; } 277 | 278 | 279 | /* Misc visuals 280 | ----------------------------------*/ 281 | 282 | /* Corner radius */ 283 | .ui-corner-tl { -moz-border-radius-topleft: 2px; -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; } 284 | .ui-corner-tr { -moz-border-radius-topright: 2px; -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; } 285 | .ui-corner-bl { -moz-border-radius-bottomleft: 2px; -webkit-border-bottom-left-radius: 2px; border-bottom-left-radius: 2px; } 286 | .ui-corner-br { -moz-border-radius-bottomright: 2px; -webkit-border-bottom-right-radius: 2px; border-bottom-right-radius: 2px; } 287 | .ui-corner-top { -moz-border-radius-topleft: 2px; -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; -moz-border-radius-topright: 2px; -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; } 288 | .ui-corner-bottom { -moz-border-radius-bottomleft: 2px; -webkit-border-bottom-left-radius: 2px; border-bottom-left-radius: 2px; -moz-border-radius-bottomright: 2px; -webkit-border-bottom-right-radius: 2px; border-bottom-right-radius: 2px; } 289 | .ui-corner-right { -moz-border-radius-topright: 2px; -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; -moz-border-radius-bottomright: 2px; -webkit-border-bottom-right-radius: 2px; border-bottom-right-radius: 2px; } 290 | .ui-corner-left { -moz-border-radius-topleft: 2px; -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; -moz-border-radius-bottomleft: 2px; -webkit-border-bottom-left-radius: 2px; border-bottom-left-radius: 2px; } 291 | .ui-corner-all { -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; } 292 | 293 | /* Overlays */ 294 | .ui-widget-overlay { background: #eeeeee url(images/ui-bg_flat_0_eeeeee_40x100.png) 50% 50% repeat-x; opacity: .80;filter:Alpha(Opacity=80); } 295 | .ui-widget-shadow { margin: -4px 0 0 -4px; padding: 4px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; }/* 296 | * jQuery UI Resizable 1.8.6 297 | * 298 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 299 | * Dual licensed under the MIT or GPL Version 2 licenses. 300 | * http://jquery.org/license 301 | * 302 | * http://docs.jquery.com/UI/Resizable#theming 303 | */ 304 | .ui-resizable { position: relative;} 305 | .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} 306 | .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } 307 | .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } 308 | .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } 309 | .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } 310 | .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } 311 | .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } 312 | .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } 313 | .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } 314 | .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* 315 | * jQuery UI Selectable 1.8.6 316 | * 317 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 318 | * Dual licensed under the MIT or GPL Version 2 licenses. 319 | * http://jquery.org/license 320 | * 321 | * http://docs.jquery.com/UI/Selectable#theming 322 | */ 323 | .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } 324 | /* 325 | * jQuery UI Accordion 1.8.6 326 | * 327 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 328 | * Dual licensed under the MIT or GPL Version 2 licenses. 329 | * http://jquery.org/license 330 | * 331 | * http://docs.jquery.com/UI/Accordion#theming 332 | */ 333 | /* IE/Win - Fix animation bug - #4615 */ 334 | .ui-accordion { width: 100%; } 335 | .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } 336 | .ui-accordion .ui-accordion-li-fix { display: inline; } 337 | .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } 338 | .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } 339 | .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } 340 | .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } 341 | .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; } 342 | .ui-accordion .ui-accordion-content-active { display: block; }/* 343 | * jQuery UI Autocomplete 1.8.6 344 | * 345 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 346 | * Dual licensed under the MIT or GPL Version 2 licenses. 347 | * http://jquery.org/license 348 | * 349 | * http://docs.jquery.com/UI/Autocomplete#theming 350 | */ 351 | .ui-autocomplete { position: absolute; cursor: default; } 352 | 353 | /* workarounds */ 354 | * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ 355 | 356 | /* 357 | * jQuery UI Menu 1.8.6 358 | * 359 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 360 | * Dual licensed under the MIT or GPL Version 2 licenses. 361 | * http://jquery.org/license 362 | * 363 | * http://docs.jquery.com/UI/Menu#theming 364 | */ 365 | .ui-menu { 366 | list-style:none; 367 | padding: 2px; 368 | margin: 0; 369 | display:block; 370 | float: left; 371 | } 372 | .ui-menu .ui-menu { 373 | margin-top: -3px; 374 | } 375 | .ui-menu .ui-menu-item { 376 | margin:0; 377 | padding: 0; 378 | zoom: 1; 379 | float: left; 380 | clear: left; 381 | width: 100%; 382 | } 383 | .ui-menu .ui-menu-item a { 384 | text-decoration:none; 385 | display:block; 386 | padding:.2em .4em; 387 | line-height:1.5; 388 | zoom:1; 389 | } 390 | .ui-menu .ui-menu-item a.ui-state-hover, 391 | .ui-menu .ui-menu-item a.ui-state-active { 392 | font-weight: normal; 393 | margin: -1px; 394 | } 395 | /* 396 | * jQuery UI Button 1.8.6 397 | * 398 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 399 | * Dual licensed under the MIT or GPL Version 2 licenses. 400 | * http://jquery.org/license 401 | * 402 | * http://docs.jquery.com/UI/Button#theming 403 | */ 404 | .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 */ 405 | .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ 406 | button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ 407 | .ui-button-icons-only { width: 3.4em; } 408 | button.ui-button-icons-only { width: 3.7em; } 409 | 410 | /*button text element */ 411 | .ui-button .ui-button-text { display: block; line-height: 1.4; } 412 | .ui-button-text-only .ui-button-text { padding: .4em 1em; } 413 | .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } 414 | .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } 415 | .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } 416 | .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } 417 | /* no icon support for input elements, provide padding by default */ 418 | input.ui-button { padding: .4em 1em; } 419 | 420 | /*button icon element(s) */ 421 | .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; } 422 | .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } 423 | .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; } 424 | .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; } 425 | .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } 426 | 427 | /*button sets*/ 428 | .ui-buttonset { margin-right: 7px; } 429 | .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } 430 | 431 | /* workarounds */ 432 | button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ 433 | /* 434 | * jQuery UI Dialog 1.8.6 435 | * 436 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 437 | * Dual licensed under the MIT or GPL Version 2 licenses. 438 | * http://jquery.org/license 439 | * 440 | * http://docs.jquery.com/UI/Dialog#theming 441 | */ 442 | .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } 443 | .ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; } 444 | .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } 445 | .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } 446 | .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } 447 | .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } 448 | .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } 449 | .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; } 450 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } 451 | .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } 452 | .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } 453 | .ui-draggable .ui-dialog-titlebar { cursor: move; } 454 | /* 455 | * jQuery UI Slider 1.8.6 456 | * 457 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 458 | * Dual licensed under the MIT or GPL Version 2 licenses. 459 | * http://jquery.org/license 460 | * 461 | * http://docs.jquery.com/UI/Slider#theming 462 | */ 463 | .ui-slider { position: relative; text-align: left; } 464 | .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } 465 | .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } 466 | 467 | .ui-slider-horizontal { height: .8em; } 468 | .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } 469 | .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } 470 | .ui-slider-horizontal .ui-slider-range-min { left: 0; } 471 | .ui-slider-horizontal .ui-slider-range-max { right: 0; } 472 | 473 | .ui-slider-vertical { width: .8em; height: 100px; } 474 | .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } 475 | .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } 476 | .ui-slider-vertical .ui-slider-range-min { bottom: 0; } 477 | .ui-slider-vertical .ui-slider-range-max { top: 0; }/* 478 | * jQuery UI Tabs 1.8.6 479 | * 480 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 481 | * Dual licensed under the MIT or GPL Version 2 licenses. 482 | * http://jquery.org/license 483 | * 484 | * http://docs.jquery.com/UI/Tabs#theming 485 | */ 486 | .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") */ 487 | .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } 488 | .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; } 489 | .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } 490 | .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } 491 | .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; } 492 | .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... */ 493 | .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } 494 | .ui-tabs .ui-tabs-hide { display: none !important; } 495 | /* 496 | * jQuery UI Datepicker 1.8.6 497 | * 498 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 499 | * Dual licensed under the MIT or GPL Version 2 licenses. 500 | * http://jquery.org/license 501 | * 502 | * http://docs.jquery.com/UI/Datepicker#theming 503 | */ 504 | .ui-datepicker { width: 17em; padding: .2em .2em 0; } 505 | .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } 506 | .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } 507 | .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } 508 | .ui-datepicker .ui-datepicker-prev { left:2px; } 509 | .ui-datepicker .ui-datepicker-next { right:2px; } 510 | .ui-datepicker .ui-datepicker-prev-hover { left:1px; } 511 | .ui-datepicker .ui-datepicker-next-hover { right:1px; } 512 | .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; } 513 | .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } 514 | .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } 515 | .ui-datepicker select.ui-datepicker-month-year {width: 100%;} 516 | .ui-datepicker select.ui-datepicker-month, 517 | .ui-datepicker select.ui-datepicker-year { width: 49%;} 518 | .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } 519 | .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } 520 | .ui-datepicker td { border: 0; padding: 1px; } 521 | .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } 522 | .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; } 523 | .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } 524 | .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } 525 | 526 | /* with multiple calendars */ 527 | .ui-datepicker.ui-datepicker-multi { width:auto; } 528 | .ui-datepicker-multi .ui-datepicker-group { float:left; } 529 | .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } 530 | .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } 531 | .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } 532 | .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } 533 | .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } 534 | .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } 535 | .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } 536 | .ui-datepicker-row-break { clear:both; width:100%; } 537 | 538 | /* RTL support */ 539 | .ui-datepicker-rtl { direction: rtl; } 540 | .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } 541 | .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } 542 | .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } 543 | .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } 544 | .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } 545 | .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } 546 | .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } 547 | .ui-datepicker-rtl .ui-datepicker-group { float:right; } 548 | .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } 549 | .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } 550 | 551 | /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ 552 | .ui-datepicker-cover { 553 | display: none; /*sorry for IE5*/ 554 | display/**/: block; /*sorry for IE5*/ 555 | position: absolute; /*must have*/ 556 | z-index: -1; /*must have*/ 557 | filter: mask(); /*must have*/ 558 | top: -4px; /*must have*/ 559 | left: -4px; /*must have*/ 560 | width: 200px; /*must have*/ 561 | height: 200px; /*must have*/ 562 | }/* 563 | * jQuery UI Progressbar 1.8.6 564 | * 565 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 566 | * Dual licensed under the MIT or GPL Version 2 licenses. 567 | * http://jquery.org/license 568 | * 569 | * http://docs.jquery.com/UI/Progressbar#theming 570 | */ 571 | .ui-progressbar { height:2em; text-align: left; } 572 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } -------------------------------------------------------------------------------- /web/lib/couchClient.php: -------------------------------------------------------------------------------- 1 | array ("name" => "since", "filter" => "int"), 51 | "heartbeat" => array ("name" => "heartbeat", "filter" => "int"), 52 | "style" => array ("name" => "style", "filter"=>null), 53 | "conflicts" => array ("name" => "conflicts", "filter"=>"staticValue", "staticValue"=> "true"), 54 | "revs" => array ("name" => "revs", "filter"=>"staticValue", "staticValue"=> "true"), 55 | "revs_info" => array ("name" => "revs_info", "filter"=>"staticValue", "staticValue"=> "true"), 56 | "rev" => array ("name" => "rev", "filter"=>null), 57 | "key" => array ("name" => "key", "filter"=> "jsonEncode"), 58 | "keys" => array ("name" => "keys", "filter"=> "ensureArray"), 59 | "startkey" => array ("name" => "startkey", "filter"=> "jsonEncode"), 60 | "endkey" => array ("name" => "endkey", "filter"=> "jsonEncode"), 61 | "startkey_docid" => array ("name" => "startkey_docid", "filter"=> "string"), 62 | "endkey_docid" => array ("name" => "endkey_docid", "filter"=> "string"), 63 | "limit" => array ("name" => "limit", "filter"=> "int"), 64 | "stale" => array ("name" => "stale", "filter"=>"staticValue", "staticValue"=> "ok"), 65 | "descending" => array ("name" => "descending", "filter"=>"jsonEncodeBoolean"), 66 | "skip" => array ("name" => "skip", "filter"=> "int"), 67 | "group" => array ("name" => "group", "filter"=>"jsonEncodeBoolean"), 68 | "group_level" => array ("name" => "group_level", "filter"=>"int"), 69 | "reduce" => array ("name" => "reduce", "filter"=>"jsonEncodeBoolean"), 70 | "include_docs" => array ("name" => "include_docs", "filter"=>"jsonEncodeBoolean"), 71 | "inclusive_end" => array ("name" => "inclusive_end", "filter"=>"jsonEncodeBoolean") 72 | ); 73 | 74 | 75 | /** 76 | * @var bool option to return couchdb view results as couchDocuments objects 77 | */ 78 | protected $results_as_cd = false; 79 | 80 | /** 81 | * @var boolean tell if documents shall be returned as arrays instead of objects 82 | */ 83 | protected $results_as_array = false; 84 | 85 | 86 | /** 87 | * @var array list of properties beginning with '_' and allowed in CouchDB objects in a "store" type operation 88 | */ 89 | public static $allowed_underscored_properties = array('_id','_rev','_attachments'); 90 | 91 | /** 92 | * @var array list of properties beginning with '_' and that should be removed from CouchDB objects in a "store" type operation 93 | */ 94 | public static $underscored_properties_to_remove_on_storage = array('_conflicts','_revisions','_revs_info'); 95 | 96 | /** 97 | * class constructor 98 | * 99 | * @param string $dsn CouchDB server data source name (eg. http://localhost:5984) 100 | * @param integer $port CouchDB server port 101 | * @param string $dbname CouchDB database name 102 | */ 103 | public function __construct($dsn, $dbname) { 104 | $this->useDatabase($dbname); 105 | parent::__construct($dsn); 106 | 107 | } 108 | 109 | /** 110 | * helper method to execute the following algorithm : 111 | * 112 | * query the couchdb server 113 | * test the status_code 114 | * return the response body on success, throw an exception on failure 115 | * 116 | * @param string $method HTTP method (GET, POST, ...) 117 | * @param string $url URL to fetch 118 | * @param $array $allowed_status_code the list of HTTP response status codes that prove a successful request 119 | * @param array $parameters additionnal parameters to send with the request 120 | * @param string|object|array $data the request body. If it's an array or an object, $data is json_encode()d 121 | */ 122 | protected function _queryAndTest ( $method, $url,$allowed_status_codes, $parameters = array(),$data = NULL ) { 123 | // print_r($method.' '.$url."\n"); 124 | // print_r($parameters); 125 | $raw = $this->query($method,$url,$parameters,$data); 126 | // echo $raw."\n"; 127 | $response = $this->parseRawResponse($raw, $this->results_as_array); 128 | $this->results_as_array = false; 129 | // print_r($response); 130 | if ( in_array($response['status_code'], $allowed_status_codes) ) { 131 | return $response['body']; 132 | } 133 | throw new couchException($raw); 134 | return FALSE; 135 | } 136 | 137 | function __call($name, $args) { 138 | if ( !array_key_exists($name,$this->query_defs) ) { 139 | throw new Exception("Method $name does not exist"); 140 | } 141 | if ( $this->query_defs[$name]['filter'] == 'int' ) { 142 | $this->query_parameters[ $this->query_defs[$name]['name'] ] = (int)reset($args); 143 | } elseif ( $this->query_defs[$name]['filter'] == 'staticValue' ) { 144 | $this->query_parameters[ $this->query_defs[$name]['name'] ] = $this->query_defs[$name]['staticValue']; 145 | } elseif ( $this->query_defs[$name]['filter'] == 'jsonEncode' ) { 146 | $this->query_parameters[ $this->query_defs[$name]['name'] ] = json_encode(reset($args)); 147 | } elseif ( $this->query_defs[$name]['filter'] == 'ensureArray' ) { 148 | if ( is_array(reset($args)) ) { 149 | $this->query_parameters[ $this->query_defs[$name]['name'] ] = reset($args); 150 | } 151 | } elseif ( $this->query_defs[$name]['filter'] == 'string' ) { 152 | $this->query_parameters[ $this->query_defs[$name]['name'] ] = (string)reset($args); 153 | } elseif ( $this->query_defs[$name]['filter'] == 'jsonEncodeBoolean' ) { 154 | $this->query_parameters[ $this->query_defs[$name]['name'] ] = json_encode((boolean)reset($args)); 155 | } 156 | // print_r($this->query_parameters); 157 | return $this; 158 | } 159 | 160 | /** 161 | * set the name of the couchDB database to work on 162 | * 163 | * @param string $dbname name of the database 164 | * @return couchClient $this 165 | */ 166 | public function useDatabase( $dbname ) { 167 | if ( !strlen($dbname) ) throw new InvalidArgumentException("Database name can't be empty"); 168 | if ( !$this->isValidDatabaseName($dbname) ) throw new InvalidArgumentException('Database name contains invalid characters. Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed.'); 169 | $this->dbname = $dbname; 170 | return $this; 171 | } 172 | 173 | /** 174 | * Tests a CouchDB database name and tell if it's a valid one 175 | * 176 | * 177 | * @param string $dbname name of the database to test 178 | * @return boolean true if the database name is correct 179 | */ 180 | public static function isValidDatabaseName ( $dbname ) { 181 | if ( preg_match ( "@^[a-z][a-z0-9_\$\(\)\+\-/]*$@",$dbname) ) return true; 182 | return false; 183 | } 184 | 185 | 186 | /** 187 | *list all databases on the CouchDB server 188 | * 189 | * @return object databases list 190 | */ 191 | public function listDatabases ( ) { 192 | return $this->_queryAndTest ('GET', '/_all_dbs', array(200)); 193 | } 194 | 195 | /** 196 | *create the database 197 | * 198 | * @return object creation infos 199 | */ 200 | public function createDatabase ( ) { 201 | return $this->_queryAndTest ('PUT', '/'.urlencode($this->dbname), array(201)); 202 | } 203 | 204 | /** 205 | *delete the database 206 | * 207 | * @return object creation infos 208 | */ 209 | public function deleteDatabase ( ) { 210 | return $this->_queryAndTest ('DELETE', '/'.urlencode($this->dbname), array(200)); 211 | } 212 | 213 | /** 214 | *get database infos 215 | * 216 | * @return object database infos 217 | */ 218 | public function getDatabaseInfos ( ) { 219 | return $this->_queryAndTest ('GET', '/'.urlencode($this->dbname), array(200)); 220 | } 221 | 222 | /** 223 | *return database uri 224 | * 225 | * example : http://couch.server.com:5984/mydb 226 | * 227 | * @return string database URI 228 | */ 229 | public function getDatabaseUri() { 230 | return $this->dsn.'/'.$this->dbname; 231 | } 232 | 233 | /** 234 | * return database name 235 | * 236 | * @return string database name 237 | */ 238 | public function getDatabaseName () { 239 | return $this->dbname; 240 | } 241 | 242 | /** 243 | * returns CouchDB server URI 244 | * 245 | * example : http://couch.server.com:5984 246 | * 247 | * @return string CouchDB Server URL 248 | */ 249 | public function getServerUri () { 250 | return $this->dsn; 251 | } 252 | 253 | /** 254 | * test if the database already exists 255 | * 256 | * @return boolean wether or not the database exist 257 | */ 258 | public function databaseExists () { 259 | try { 260 | $back = $this->getDatabaseInfos(); 261 | return TRUE; 262 | } catch ( Exception $e ) { 263 | // if status code = 404 database does not exist 264 | if ( $e->getCode() == 404 ) return FALSE; 265 | // we met another exception so we throw it 266 | throw $e; 267 | } 268 | } 269 | 270 | 271 | /** 272 | * launch a compact operation on the database 273 | * 274 | * 275 | * @return object CouchDB's compact response ( usually {"ok":true} ) 276 | */ 277 | public function compactDatabase () { 278 | return $this->_queryAndTest ( "POST", '/'.urlencode($this->dbname).'/_compact', array(202) ); 279 | } 280 | 281 | /** 282 | * launch a cleanup operation on database views 283 | * 284 | * 285 | * @return object CouchDB's cleanup views response ( usually {"ok":true} ) 286 | */ 287 | public function cleanupDatabaseViews () { 288 | return $this->_queryAndTest ( "POST", '/'.urlencode($this->dbname).'/_view_cleanup', array(202) ); 289 | } 290 | 291 | /** 292 | *CouchDb changes option 293 | * 294 | * 295 | * @link http://books.couchdb.org/relax/reference/change-notifications 296 | * @param string $value feed type 297 | * @param callable $continuous_callback in case of a continuous feed, the callback to be executed on new event reception 298 | * @return couchClient $this 299 | */ 300 | public function feed($value,$continuous_callback = null) { 301 | if ( $value == 'longpoll' ) { 302 | $this->query_parameters['feed'] = $value; 303 | }elseif ( $value == 'continuous' ) { 304 | $this->query_parameters['feed'] = $value; 305 | $this->query_parameters['continuous_feed'] = $continuous_callback; 306 | } elseif (!empty($this->query_parameters['feed']) ) { 307 | unset($this->query_parameters['feed']); 308 | } 309 | return $this; 310 | } 311 | 312 | 313 | /** 314 | *CouchDb changes option 315 | * 316 | * 317 | * @link http://books.couchdb.org/relax/reference/change-notifications 318 | * @param string $value designdocname/filtername 319 | * @return couchClient $this 320 | */ 321 | public function filter($value,$additional_query_options = array() ) { 322 | if ( strlen(trim($value)) ) { 323 | $this->query_parameters['filter']=trim($value); 324 | $this->query_parameters = array_merge($additional_query_options,$this->query_parameters); 325 | } 326 | return $this; 327 | } 328 | 329 | /** 330 | * fetch database changes 331 | * 332 | * @return object CouchDB changes response 333 | */ 334 | public function getChanges() { 335 | if ( !empty($this->query_parameters['feed']) && $this->query_parameters['feed'] == 'continuous' ) { 336 | // return $this->_continuousChanges(); 337 | $url = '/'.urlencode($this->dbname).'/_changes'; 338 | $opts = $this->query_parameters; 339 | $this->query_parameters = array(); 340 | $callable = $opts['continuous_feed']; 341 | unset($opts['continuous_feed']); 342 | return $this->continuousQuery($callable,'GET',$url,$opts); 343 | } 344 | $url = '/'.urlencode($this->dbname).'/_changes'; 345 | $opts = $this->query_parameters; 346 | $this->query_parameters = array(); 347 | return $this->_queryAndTest ('GET', $url, array(200,201),$opts); 348 | } 349 | 350 | 351 | /** 352 | * fetch multiple revisions at once 353 | * 354 | * @link http://wiki.apache.org/couchdb/HTTP_Document_API 355 | * @param array|all $value array of revisions to fetch, or special keyword all 356 | * @return couchClient $this 357 | */ 358 | public function open_revs ($value) { 359 | if ( is_string($value) && $value == 'all' ) { 360 | $this->query_parameters['open_revs'] = "all"; 361 | } elseif ( is_array($value) ) { 362 | $this->query_parameters['open_revs'] = json_encode($value); 363 | } 364 | return $this; 365 | } 366 | 367 | /** 368 | * fetch a CouchDB document 369 | * 370 | * @param string $id document id 371 | * @return object CouchDB document 372 | */ 373 | public function getDoc ($id) { 374 | if ( !strlen($id) ) 375 | throw new InvalidArgumentException ("Document ID is empty"); 376 | 377 | if ( preg_match('/^_design/',$id) ) 378 | $url = '/'.urlencode($this->dbname).'/_design/'.urlencode(str_replace('_design/','',$id)); 379 | else 380 | $url = '/'.urlencode($this->dbname).'/'.urlencode($id); 381 | 382 | $doc_query = $this->query_parameters; 383 | $this->query_parameters = array(); 384 | 385 | $back = $this->_queryAndTest ('GET', $url, array(200),$doc_query); 386 | if ( !$this->results_as_cd ) { 387 | return $back; 388 | } 389 | $this->results_as_cd = false; 390 | $c = new couchDocument($this); 391 | return $c->loadFromObject($back); 392 | } 393 | 394 | /** 395 | * store a CouchDB document 396 | * 397 | * @param object $doc document to store 398 | * @return object CouchDB document storage response 399 | */ 400 | public function storeDoc ( $doc ) { 401 | if ( !is_object($doc) ) throw new InvalidArgumentException ("Document should be an object"); 402 | foreach ( array_keys(get_object_vars($doc)) as $key ) { 403 | if ( in_array($key,couchClient::$underscored_properties_to_remove_on_storage) ) { 404 | unset($doc->$key); 405 | } 406 | elseif ( substr($key,0,1) == '_' AND !in_array($key,couchClient::$allowed_underscored_properties) ) 407 | throw new InvalidArgumentException("Property $key can't begin with an underscore"); 408 | } 409 | $method = 'POST'; 410 | $url = '/'.urlencode($this->dbname); 411 | if ( !empty($doc->_id) ) { 412 | $method = 'PUT'; 413 | $url.='/'.urlencode($doc->_id); 414 | } 415 | return $this->_queryAndTest ($method, $url, array(200,201),array(),$doc); 416 | } 417 | 418 | /** 419 | * store many CouchDB documents 420 | * 421 | * @link http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API 422 | * @param object $docs array of documents to store 423 | * @param boolean $all_or_nothing set the bulk update type to "all or nothing" 424 | * @return object CouchDB bulk document storage response 425 | */ 426 | public function storeDocs ( $docs, $all_or_nothing = false ) { 427 | if ( !is_array($docs) ) throw new InvalidArgumentException ("docs parameter should be an array"); 428 | /* 429 | create the query content 430 | */ 431 | $request = array('docs'=>array()); 432 | foreach ( $docs as $doc ) { 433 | if ( $doc instanceof couchDocument ) { 434 | $request['docs'][] = $doc->getFields(); 435 | } else { 436 | $request['docs'][] = $doc; 437 | } 438 | } 439 | if ( $all_or_nothing ) { 440 | $request['all_or_nothing'] = true; 441 | } 442 | 443 | $url = '/'.urlencode($this->dbname).'/_bulk_docs'; 444 | return $this->_queryAndTest ('POST', $url, array(200,201),array(),$request); 445 | } 446 | 447 | 448 | /** 449 | * delete many CouchDB documents in a single HTTP request 450 | * 451 | * @link http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API 452 | * @param object $docs array of documents to delete 453 | * @param boolean $all_or_nothing set the bulk update type to "all or nothing" 454 | * @return object CouchDB bulk document storage response 455 | */ 456 | public function deleteDocs ( $docs, $all_or_nothing = false ) { 457 | if ( !is_array($docs) ) throw new InvalidArgumentException ("docs parameter should be an array"); 458 | /* 459 | create the query content 460 | */ 461 | $request = array('docs'=>array()); 462 | foreach ( $docs as $doc ) { 463 | $destDoc = null; 464 | if ( $doc instanceof couchDocument ) $destDoc = $doc->getFields(); 465 | else $destDoc = $doc; 466 | 467 | if ( is_array($destDoc) ) $destDoc['_deleted'] = true; 468 | else $destDoc->_deleted = true; 469 | $request['docs'][] = $destDoc; 470 | } 471 | if ( $all_or_nothing ) { 472 | $request['all_or_nothing'] = true; 473 | } 474 | 475 | $url = '/'.urlencode($this->dbname).'/_bulk_docs'; 476 | return $this->_queryAndTest ('POST', $url, array(200,201),array(),$request); 477 | } 478 | 479 | 480 | /** 481 | * update a couchDB document through an Update Handler 482 | * 483 | * @link http://wiki.apache.org/couchdb/Document_Update_Handlers 484 | * @param string $ddoc_id name of the design doc containing the update handler definition (without _design) 485 | * @param string $handler_name name of the update handler 486 | * @param array|object $params parameters to send to the update handler 487 | * @param string $doc_id id of the document to update (can be null) 488 | */ 489 | public function updateDoc ( $ddoc_id, $handler_name, $params, $doc_id = null ) { 490 | if ( !is_array($params) && !is_object($params) ) throw new InvalidArgumentException ("params parameter should be an array or an object"); 491 | if ( is_object($params) ) $params = (array)$params; 492 | $method = 'PUT'; 493 | $url = '/'.urlencode($this->dbname).'/_design/'.urlencode($ddoc_id).'/_update/'.$handler_name.'/'; 494 | if ( $doc_id ) $url .= urlencode($doc_id); 495 | return $this->_queryAndTest ($method, $url, array(200,201),$params); 496 | } 497 | 498 | /** 499 | * copy a CouchDB document 500 | * 501 | * @param string $id id of the document to copy 502 | * @param string $new_id id of the new document 503 | * @return object CouchDB document storage response 504 | */ 505 | public function copyDoc($id,$new_id) { 506 | if ( !strlen($id) ) 507 | throw new InvalidArgumentException ("Document ID is empty"); 508 | if ( !strlen($new_id) ) 509 | throw new InvalidArgumentException ("New document ID is empty"); 510 | 511 | $method = 'COPY'; 512 | $url = '/'.urlencode($this->dbname); 513 | $url.='/'.urlencode($id); 514 | return $this->_queryAndTest ($method, $url, array(200,201),array(),$new_id); 515 | } 516 | 517 | /** 518 | * store a CouchDB attachment 519 | * 520 | * in this case the attachment content is in a PHP variable 521 | * 522 | * @param object $doc doc to store the attachment in 523 | * @param string $data attachment content 524 | * @param string $filename attachment name 525 | * @param string $content_type attachment content type 526 | * @return object CouchDB attachment storage response 527 | */ 528 | public function storeAsAttachment ($doc,$data,$filename,$content_type = 'application/octet-stream') { 529 | if ( !is_object($doc) ) throw new InvalidArgumentException ("Document should be an object"); 530 | if ( !$doc->_id ) throw new InvalidArgumentException ("Document should have an ID"); 531 | $url = '/'.urlencode($this->dbname).'/'.urlencode($doc->_id).'/'.urlencode($filename); 532 | if ( $doc->_rev ) $url.='?rev='.$doc->_rev; 533 | $raw = $this->storeAsFile($url,$data,$content_type); 534 | $response = $this->parseRawResponse($raw, $this->results_as_array); 535 | $this->results_as_array = false; 536 | return $response['body']; 537 | } 538 | 539 | /** 540 | * store a CouchDB attachment 541 | * 542 | * in this case the attachment is a file on the harddrive 543 | * 544 | * @param object $doc doc to store the attachment in 545 | * @param string $file file to attach (complete path on the harddrive) 546 | * @param string $filename attachment name 547 | * @param string $content_type attachment content type 548 | * @return object CouchDB attachment storage response 549 | */ 550 | public function storeAttachment ($doc,$file,$content_type = 'application/octet-stream',$filename = null) { 551 | if ( !is_object($doc) ) throw new InvalidArgumentException ("Document should be an object"); 552 | if ( !$doc->_id ) throw new InvalidArgumentException ("Document should have an ID"); 553 | if ( !is_file($file) ) throw new InvalidArgumentException ("File $file does not exist"); 554 | $url = '/'.urlencode($this->dbname).'/'.urlencode($doc->_id).'/'; 555 | $url .= empty($filename) ? basename($file) : $filename ; 556 | if ( $doc->_rev ) $url.='?rev='.$doc->_rev; 557 | $raw = $this->storeFile($url,$file,$content_type); 558 | $response = $this->parseRawResponse($raw, $this->results_as_array); 559 | return $response['body']; 560 | } 561 | 562 | /** 563 | * delete a CouchDB attachment from a document 564 | * 565 | * @param object $doc CouchDB document 566 | * @param string $attachment_name name of the attachment to delete 567 | * @return object CouchDB attachment removal response 568 | */ 569 | public function deleteAttachment ($doc,$attachment_name ) { 570 | if ( !is_object($doc) ) throw new InvalidArgumentException ("Document should be an object"); 571 | if ( !$doc->_id ) throw new InvalidArgumentException ("Document should have an ID"); 572 | if ( !strlen($attachment_name) ) throw new InvalidArgumentException ("Attachment name not set"); 573 | $url = '/'.urlencode($this->dbname). 574 | '/'.urlencode($doc->_id). 575 | '/'.urlencode($attachment_name); 576 | return $this->_queryAndTest ('DELETE', $url, array(200),array('rev'=>$doc->_rev)); 577 | } 578 | 579 | /** 580 | * remove a document from the database 581 | * 582 | * @param object $doc document to remove 583 | * @return object CouchDB document removal response 584 | */ 585 | public function deleteDoc ( $doc ) { 586 | if ( !is_object($doc) ) throw new InvalidArgumentException ("Document should be an object"); 587 | if ( empty($doc->_id) OR empty($doc->_rev) ) { 588 | throw new Exception("Document should contain _id and _rev"); 589 | return FALSE; 590 | } 591 | $url = '/'.urlencode($this->dbname).'/'.urlencode($doc->_id).'?rev='.urlencode($doc->_rev); 592 | return $this->_queryAndTest ('DELETE', $url, array(200)); 593 | } 594 | 595 | /** 596 | * returns couchDB results as couchDocuments objects 597 | * 598 | * implies include_docs(true) 599 | * 600 | * cannot be used in conjunction with asArray() 601 | * 602 | * when view result is parsed, view documents are translated to objects and sent back 603 | * 604 | * @view results_as_couchDocuments() 605 | * @return couchClient $this 606 | * 607 | */ 608 | public function asCouchDocuments() { 609 | $this->results_as_cd = true; 610 | $this->results_as_array = false; 611 | return $this; 612 | } 613 | 614 | /** 615 | * returns couchDB results as array 616 | * 617 | * cannot be used in conjunction with asCouchDocuments() 618 | * 619 | * @return couchClient $this 620 | */ 621 | public function asArray() { 622 | $this->results_as_array = true; 623 | $this->results_as_cd = false; 624 | return $this; 625 | } 626 | 627 | /** 628 | * lookup $this->view_query and prepare view request 629 | * 630 | * 631 | * @return array [ HTTP method , array of view options, data ] 632 | */ 633 | protected function _prepare_view_query() { 634 | $view_query = $this->query_parameters; 635 | $this->query_parameters = array(); 636 | $method = 'GET'; 637 | $data = null; 638 | if ( isset($view_query['keys']) ) { 639 | $method = 'POST'; 640 | $data = json_encode(array('keys'=>$view_query['keys'])); 641 | unset($view_query['keys']); 642 | } 643 | return array ( $method, $view_query, $data ); 644 | } 645 | 646 | /** 647 | * request a view from the CouchDB server 648 | * 649 | * @link http://wiki.apache.org/couchdb/HTTP_view_API 650 | * @param string $id design document name (without _design) 651 | * @param string $name view name 652 | * @return object CouchDB view query response 653 | */ 654 | public function getView ( $id, $name ) { 655 | if ( !$id OR !$name ) throw new InvalidArgumentException("You should specify view id and name"); 656 | $url = '/'.urlencode($this->dbname).'/_design/'.urlencode($id).'/_view/'.urlencode($name); 657 | if ( $this->results_as_cd ) $this->include_docs(true); 658 | $results_as_cd = $this->results_as_cd; 659 | $this->results_as_cd = false; 660 | 661 | list($method, $view_query, $data) = $this->_prepare_view_query(); 662 | 663 | if ( ! $results_as_cd ) 664 | return $this->_queryAndTest ($method, $url, array(200),$view_query,$data); 665 | 666 | return $this->resultsToCouchDocuments ( 667 | $this->_queryAndTest ($method, $url, array(200),$view_query,$data) 668 | ); 669 | } 670 | /** 671 | * returns couchDB view results as couchDocuments objects 672 | * 673 | * - for string view keys, the object is found on "view key" index 674 | * ex : view returns 675 | * [ "client" : null , "client2" : null ] 676 | * is translated to : 677 | * array ( 'client' => array(couchDocument) , 'client2' => array(couchDocument) ) 678 | * 679 | * - for array view keys, the object key in the result array is the last key of the view 680 | * ex : view returns 681 | * [ [ "#44556643", "client" ] : null , [ "#65745767566","client2" : null ] 682 | * is translated to : 683 | * array ( 'client' => array(couchDocument) , 'client2' => array(couchDocument) ) 684 | * 685 | * @param stdClass couchDb view resultset 686 | * @return array array of couchDocument objects 687 | */ 688 | public function resultsToCouchDocuments ( $results ) { 689 | if ( !$results->rows or !is_array($results->rows) ) return FALSE; 690 | $back = array(); 691 | foreach ( $results->rows as $row ) { // should have $row->key & $row->doc 692 | if ( !$row->key or !$row->doc ) return false; 693 | // create couchDocument 694 | $cd = new couchDocument($this); 695 | $cd->loadFromObject($row->doc); 696 | 697 | // set key name 698 | if ( is_string($row->key) ) $key = $row->key; 699 | elseif ( is_array($row->key) ) { 700 | if ( !is_array(end($row->key)) && !is_object(end($row->key)) ) 701 | $key = end($row->key); 702 | else 703 | continue; 704 | } 705 | 706 | // set value in result array 707 | if ( isset($back[$key]) ) { 708 | if ( is_array($back[$key]) ) $back[$key][] = $cd; 709 | else $back[$key] = array($back[$key],$cd); 710 | } else { 711 | $back[$key] = $cd; 712 | } 713 | } 714 | return $back; 715 | } 716 | 717 | /** 718 | * request a list from the CouchDB server 719 | * 720 | * @link http://wiki.apache.org/couchdb/Formatting_with_Show_and_List 721 | * @param string $id design document name (without _design) 722 | * @param string $name list name 723 | * @param string $view_name view name 724 | * @param array $additionnal_parameters some other parameters to send in the query 725 | * @return object CouchDB list query response 726 | */ 727 | public function getList ( $id, $name, $view_name, $additionnal_parameters = array() ) { 728 | if ( !$id OR !$name ) throw new InvalidArgumentException("You should specify list id and name"); 729 | if ( !$view_name ) throw new InvalidArgumentException("You should specify view name"); 730 | $url = '/'.urlencode($this->dbname).'/_design/'.urlencode($id).'/_list/'.urlencode($name).'/'.urlencode($view_name); 731 | $this->results_as_cd = false; 732 | list($method, $view_query, $data) = $this->_prepare_view_query(); 733 | 734 | if ( is_array($additionnal_parameters) && count($additionnal_parameters) ) { 735 | $view_query = array_merge($additionnal_parameters,$view_query); 736 | } 737 | return $this->_queryAndTest ($method, $url, array(200),$view_query,$data); 738 | } 739 | 740 | /** 741 | * request a list from the CouchDB server 742 | * 743 | * Beginning in CouchDB 0.11, the design doc where the list function is defined can be different from 744 | * the design doc where the view function is defined 745 | * 746 | * So if you got a design doc "_design/example1" with a defined view "view1", and 747 | * a design doc "_design/example2" with a defined list "list1", you can query the view view1 748 | * and then pass it through the list list1 by using : 749 | * 750 | * getForeignList("example2","list1","example1","view1"); 751 | * 752 | * @link http://wiki.apache.org/couchdb/Formatting_with_Show_and_List 753 | * @param string $id the name of the design document containing the list (without _design) 754 | * @param string $name list name 755 | * @param string $view_id the name of the design document containing the view (without _design) 756 | * @param string $view_name view name 757 | * @param array $additionnal_parameters some other parameters to send in the query 758 | * @return object CouchDB list query response 759 | */ 760 | public function getForeignList ( $id, $name, $view_id, $view_name, $additionnal_parameters = array() ) { 761 | if ( !$id OR !$name ) throw new InvalidArgumentException("You should specify list id and name"); 762 | if ( !$view_id OR !$view_name ) throw new InvalidArgumentException("You should specify view id and view name"); 763 | $url = '/'.urlencode($this->dbname). 764 | '/_design/'.urlencode($id).'/_list/'.urlencode($name). 765 | '/'.urlencode($view_id).'/'.urlencode($view_name); 766 | $this->results_as_cd = false; 767 | list($method, $view_query, $data) = $this->_prepare_view_query(); 768 | 769 | if ( is_array($additionnal_parameters) && count($additionnal_parameters) ) { 770 | $view_query = array_merge($additionnal_parameters,$view_query); 771 | } 772 | return $this->_queryAndTest ($method, $url, array(200),$view_query,$data); 773 | } 774 | 775 | /** 776 | * request a show from the CouchDB server 777 | * 778 | * @link http://wiki.apache.org/couchdb/Formatting_with_Show_and_List 779 | * @param string $id design document name (without _design) 780 | * @param string $name show name 781 | * @param string $doc_id id of the couchDB document (can be null !) 782 | * @param array $additionnal_parameters some other parameters to send in the query 783 | * @return object CouchDB list query response 784 | */ 785 | public function getShow ( $id, $name, $doc_id = null, $additionnal_parameters = array() ) { 786 | if ( !$id OR !$name ) throw new InvalidArgumentException("You should specify list id and name"); 787 | $url = '/'.urlencode($this->dbname).'/_design/'.urlencode($id).'/_show/'.urlencode($name); 788 | if ( $doc_id ) $url.='/'.urlencode($doc_id); 789 | return $this->_queryAndTest ('GET', $url, array(200), $additionnal_parameters); 790 | } 791 | 792 | /** 793 | * request design doc views informations from the CouchDB server 794 | * 795 | * @link http://wiki.apache.org/couchdb/HTTP_view_API 796 | * @param string $id design document name (without _design) 797 | * @return object CouchDB view infos response 798 | */ 799 | public function getViewInfos ( $id ) { 800 | if ( !$id OR !$name ) throw new InvalidArgumentException("You should specify view id and name"); 801 | $url = '/'.urlencode($this->dbname).'/_design/'.urlencode($id).'/_info'; 802 | return $this->_queryAndTest ("GET", $url, array(200)); 803 | } 804 | 805 | 806 | /** 807 | * launch a compact operation on a database design document 808 | * 809 | * to compact views defined in _design/thedoc , use compactViews ("thedoc") 810 | * 811 | * @param string $id design document name (without _design) 812 | * @return object CouchDB's compact response ( usually {"ok":true} ) 813 | */ 814 | public function compactViews ( $id ) { 815 | $id = preg_replace("@^_design/@","",$id); 816 | // print_r("calling $id"); 817 | return $this->_queryAndTest ( "POST", '/'.urlencode($this->dbname).'/_compact/'.urlencode($id), array(202) ); 818 | } 819 | 820 | 821 | /** 822 | * launch a compact operation on all database design documents 823 | * 824 | * to compact views defined in _design/thedoc , use compactViews ("thedoc") 825 | * 826 | * @return void 827 | */ 828 | public function compactAllViews () { 829 | $response = $this->startkey('_design/')->endkey('_design/~~~~~~~~~~~')->getAllDocs(); 830 | // print_r($response); 831 | if ( property_exists($response,'rows') && is_array($response->rows) ) { 832 | foreach ( $response->rows as $view_row ) { 833 | $this->compactViews($view_row->key); 834 | } 835 | } 836 | } 837 | 838 | 839 | /** 840 | * returns all documents contained in the database 841 | * 842 | * 843 | * @return object CouchDB _all_docs response 844 | */ 845 | public function getAllDocs ( ) { 846 | $url = '/'.urlencode($this->dbname).'/_all_docs'; 847 | list($method, $view_query, $data) = $this->_prepare_view_query(); 848 | return $this->_queryAndTest ($method, $url, array(200),$view_query,$data); 849 | } 850 | 851 | /** 852 | * returns all documents contained associated with a sequence number 853 | * 854 | * Warning : in 0.11 this is deprecated in favor of _changes 855 | * 856 | * @return object CouchDB _all_docs_by_seq response 857 | */ 858 | public function getAllDocsBySeq () { 859 | $url = '/'.urlencode($this->dbname).'/_all_docs_by_seq'; 860 | list($method, $view_query, $data) = $this->_prepare_view_query(); 861 | return $this->_queryAndTest ($method, $url, array(200),$view_query,$data); 862 | } 863 | 864 | /** 865 | * returns a/some universally unique identifier(s) 866 | * 867 | * 868 | * @param integer $count the number of uuids to return 869 | * @return array|false an array of uuids on success, false on failure. 870 | */ 871 | public function getUuids($count = 1) { 872 | $count=(int)$count; 873 | if ( $count < 1 ) throw new InvalidArgumentException("Uuid count should be greater than 0"); 874 | 875 | // that changed on 0.11 ? 876 | // $url = '/'.urlencode($this->dbname).'/_uuids?count='+$count; 877 | $url = '/_uuids'; 878 | 879 | $back = $this->_queryAndTest ('GET', $url, array(200), array("count"=>$count) ); 880 | if ( $back && property_exists($back,'uuids') ) { 881 | return $back->uuids; 882 | } 883 | return false; 884 | } 885 | 886 | } 887 | 888 | /** 889 | * customized Exception class for CouchDB errors 890 | * 891 | * this class uses : the Exception message to store the HTTP message sent by the server 892 | * the Exception code to store the HTTP status code sent by the server 893 | * and adds a method getBody() to fetch the body sent by the server (if any) 894 | * 895 | */ 896 | class couchException extends Exception { 897 | // couchDB response once parsed 898 | protected $couch_response = array(); 899 | 900 | /** 901 | *class constructor 902 | * 903 | * @param string $raw_response HTTP response from the CouchDB server 904 | */ 905 | function __construct($raw_response) { 906 | $this->couch_response = couch::parseRawResponse($raw_response); 907 | if ( is_object($this->couch_response['body']) and isset($this->couch_response['body']->reason) ) 908 | $message = $this->couch_response['status_message'] . ' - ' . $this->couch_response['body']->reason; 909 | else 910 | $message = $this->couch_response['status_message']; 911 | parent::__construct($message , $this->couch_response['status_code']); 912 | } 913 | 914 | /** 915 | * returns CouchDB server response body (if any) 916 | * 917 | * if the response's "Content-Type" is set to "application/json", the 918 | * body is json_decode()d 919 | * 920 | * @return string|object|null CouchDB server response 921 | */ 922 | function getBody() { 923 | return $this->couch_response['body']; 924 | } 925 | } 926 | 927 | -------------------------------------------------------------------------------- /web/js/jquery-1.4.4.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery JavaScript Library v1.4.4 3 | * http://jquery.com/ 4 | * 5 | * Copyright 2010, John Resig 6 | * Dual licensed under the MIT or GPL Version 2 licenses. 7 | * http://jquery.org/license 8 | * 9 | * Includes Sizzle.js 10 | * http://sizzlejs.com/ 11 | * Copyright 2010, The Dojo Foundation 12 | * Released under the MIT, BSD, and GPL Licenses. 13 | * 14 | * Date: Thu Nov 11 19:04:53 2010 -0500 15 | */ 16 | (function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= 17 | h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, 19 | "`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, 20 | e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, 21 | "margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ 22 | a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, 23 | C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, 24 | s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, 25 | j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, 26 | toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== 27 | -1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; 28 | if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", 30 | b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& 31 | !F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& 32 | l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), 38 | k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, 39 | scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= 40 | false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= 41 | 1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
t
";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= 42 | "none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= 43 | c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); 44 | else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; 52 | if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, 54 | attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& 55 | b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; 56 | c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, 57 | arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= 58 | d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ 59 | c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== 61 | 8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== 62 | "click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ 63 | d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= 71 | B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== 72 | "file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== 73 | 0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); 78 | (function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; 80 | break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, 81 | q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= 82 | l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, 89 | m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== 90 | true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== 91 | g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- 92 | 0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== 94 | i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; 95 | if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, 96 | g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); 99 | n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& 100 | function(){var g=k,i=t.createElement("div");i.innerHTML="

";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| 101 | p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= 102 | t.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? 103 | function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= 106 | h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): 107 | c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, 108 | 2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, 109 | b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& 110 | e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, 111 | ""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= 112 | c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, 113 | wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, 114 | prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(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,false,function(b){this.parentNode.insertBefore(b, 115 | this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); 116 | return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; 117 | else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", 121 | prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| 122 | b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- 123 | 1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); 124 | d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, 125 | jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, 126 | zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), 127 | h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); 128 | if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= 129 | d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; 130 | e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, 131 | ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== 132 | "object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& 133 | !this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, 134 | getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", 135 | script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| 136 | !T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= 137 | false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; 138 | A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", 139 | b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& 140 | c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| 141 | c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= 142 | encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", 143 | [b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), 144 | e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); 145 | if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", 146 | 3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, 151 | d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* 152 | Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.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=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} 153 | var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; 154 | this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| 155 | this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= 156 | c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, 164 | e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& 165 | c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); 166 | c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ 167 | b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); 168 | --------------------------------------------------------------------------------