├── .gitignore ├── application ├── modules │ └── mygengo │ │ ├── views │ │ └── scripts │ │ │ ├── index │ │ │ ├── 404.phtml │ │ │ └── index.phtml │ │ │ ├── comments │ │ │ └── index.phtml │ │ │ ├── jobs │ │ │ ├── revision.phtml │ │ │ ├── index.phtml │ │ │ ├── revise.phtml │ │ │ ├── _comments.phtml │ │ │ ├── _job.phtml │ │ │ ├── show.phtml │ │ │ ├── reject.phtml │ │ │ ├── review.phtml │ │ │ └── new.phtml │ │ │ └── account │ │ │ └── index.phtml │ │ ├── controllers │ │ ├── IndexController.php │ │ ├── CommentsController.php │ │ ├── AccountController.php │ │ └── JobsController.php │ │ ├── configs │ │ └── mygengo.ini │ │ ├── models │ │ ├── Service.php │ │ ├── Jobs.php │ │ ├── Account.php │ │ ├── Api.php │ │ └── Job.php │ │ └── Bootstrap.php └── layouts │ └── scripts │ └── mygengo.phtml ├── library ├── public │ ├── stylesheets │ │ └── mygengo │ │ │ ├── override.css │ │ │ ├── scaffold.css │ │ │ ├── mugen.css │ │ │ ├── base.css │ │ │ └── style.css │ └── javascripts │ │ └── jquery.js ├── Add │ ├── Layoutloader.php │ └── BaseController.php └── myGengo │ ├── Exception.php │ ├── Crypto.php │ ├── Api │ ├── Account.php │ ├── Service.php │ ├── Jobs.php │ └── Job.php │ ├── Config.php │ ├── Client.php │ └── Api.php └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .hg/ -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/index/404.phtml: -------------------------------------------------------------------------------- 1 |

404

2 | -------------------------------------------------------------------------------- /library/public/stylesheets/mygengo/override.css: -------------------------------------------------------------------------------- 1 | /* Override here any style defined by web-app-theme */ -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/index/index.phtml: -------------------------------------------------------------------------------- 1 |

Mygengo Dashboard

2 | 3 | Welcome to myGengo dashboard! -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/comments/index.phtml: -------------------------------------------------------------------------------- 1 |

View script for controller Comments and script/action name index
-------------------------------------------------------------------------------- /application/modules/mygengo/controllers/IndexController.php: -------------------------------------------------------------------------------- 1 | Job: job_id ?> 2 |

3 | Source: 4 |
5 | revision->body_tgt ?> 6 |

7 | Back 8 | -------------------------------------------------------------------------------- /application/modules/mygengo/controllers/CommentsController.php: -------------------------------------------------------------------------------- 1 | Jobs listing 2 | 3 | 4 | jobs as $job): ?> 5 | partial('jobs/_job.phtml', array('job' => $job)) ?> 6 | 7 |
8 | 9 |
10 | Create a job 11 | -------------------------------------------------------------------------------- /application/modules/mygengo/configs/mygengo.ini: -------------------------------------------------------------------------------- 1 | ;; api url (must end with forward slash) 2 | baseurl=http://api.mygengo.com/v1/ 3 | 4 | ;; returned format 5 | format=json 6 | 7 | ;; set to 1 to echo urls and other debug messages; 0 to turn off 8 | debug=1 9 | 10 | ;; your api public and secret keys 11 | api_key="" 12 | private_key="" 13 | 14 | group_id= 15 | job_id= 16 | rev_id= 17 | 18 | ;; local timezone @see http://www.php.net/manual/en/timezones.php 19 | timezone=Asia/Tokyo -------------------------------------------------------------------------------- /application/modules/mygengo/controllers/AccountController.php: -------------------------------------------------------------------------------- 1 | view->balance = Mygengo_Model_Account::getBalance(array()); 9 | $this->view->stats = Mygengo_Model_Account::getStats(array()); 10 | $this->view->user_since = new Zend_Date(Mygengo_Model_Account::getStats(array())->user_since); 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/account/index.phtml: -------------------------------------------------------------------------------- 1 |

Account Info

2 | 3 |
4 |
5 |

Credit balance

6 | balance ?> credits 7 |
8 |
9 | 10 |
11 |
12 |

Account Stats

13 |

14 | Credits spent: 15 | stats->credits_spent ?> 16 |

17 |

18 | User Since: 19 | user_since ?> 20 |

21 |
22 |
23 | Top Up -------------------------------------------------------------------------------- /application/modules/mygengo/models/Service.php: -------------------------------------------------------------------------------- 1 | getLanguagePair('json'); 10 | #check_for_errors(); 11 | $response = self::parseRequest($service); 12 | return $response; 13 | } 14 | 15 | static function languages() { 16 | $service = myGengo_Api::factory('service'); 17 | $service->getLanguages('json'); 18 | #check_for_errors(); 19 | $response = self::parseRequest($service); 20 | return $response; 21 | } 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/jobs/revise.phtml: -------------------------------------------------------------------------------- 1 | job ?> 2 | 3 |

Revise

4 |
5 |
6 | Comment 7 |
8 | 9 |
10 | 11 |
12 | 13 | Back 14 | -------------------------------------------------------------------------------- /application/modules/mygengo/models/Jobs.php: -------------------------------------------------------------------------------- 1 | getJobs(array(), 'json'); 10 | self::check_for_errors($jobs); 11 | $response = self::parseRequest($jobs); 12 | return $response; 13 | } 14 | 15 | static function by_group($group_id = 1) { 16 | $jobs = myGengo_Api::factory('jobs'); 17 | $jobs->getGroupedJobs($group_id, 'json'); 18 | self::check_for_errors($jobs); 19 | $response = self::parseRequest($jobs); 20 | return $response; 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /application/modules/mygengo/models/Account.php: -------------------------------------------------------------------------------- 1 | getBalance('json', self::setParams($params)); 9 | self::check_for_errors($account); 10 | $response = self::parseRequest($account); 11 | return $response->credits; 12 | } 13 | 14 | static function getStats($params) { 15 | $account = myGengo_Api::factory('account'); 16 | $account->getStats('json', self::setParams($params)); 17 | self::check_for_errors($account); 18 | $response = self::parseRequest($account); 19 | return $response; 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /library/Add/Layoutloader.php: -------------------------------------------------------------------------------- 1 | getActionController() 8 | -> getInvokeArg('bootstrap'); 9 | $config = $bootstrap -> getOptions(); 10 | $module = $this -> getRequest() 11 | -> getModuleName(); 12 | 13 | //если в application.ini для запрашиваемого модуля прописан layout 14 | //например blog.resources.layout.layout = blog, то устанавливаем его. 15 | if(isset($config[$module]['resources']['layout']['layout'])){ 16 | $layoutScript = $config[$module]['resources']['layout']['layout']; 17 | $this -> getActionController() 18 | -> getHelper('layout') 19 | -> setLayout($layoutScript); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/jobs/_comments.phtml: -------------------------------------------------------------------------------- 1 | job ?> 2 |
3 | comments) > 0) {?> 4 |

Comments

5 | 6 | comments as $comment) { ?> 7 | 8 |
9 | body ?> 10 |
11 | by author ?> 12 | | 13 | ctime) ?> 14 | 15 |
16 | 17 | No comments 18 | 19 | 20 |
21 | 22 |

Post comment

23 |
24 |
25 | Comment: 26 |
27 | 28 |
29 | 30 |
31 |
-------------------------------------------------------------------------------- /library/Add/BaseController.php: -------------------------------------------------------------------------------- 1 | getParam('bootstrap'); 11 | 12 | // modules resource ArrayObject contains all bootstrap classes 13 | // then get the bootstrap for this module (moduleconfig) 14 | $this->_bootstrap = $bootstrap->getResource('modules') 15 | ->offsetGet('mygengo'); 16 | 17 | $api_key = $this->_bootstrap->getOption('api_key'); 18 | $api_sig = $this->_bootstrap->getOption('private_key'); 19 | 20 | # Initialize static fields from config file 21 | Mygengo_Model_Api::set_api_key($api_key); 22 | Mygengo_Model_Api::set_api_sig($api_sig); 23 | Mygengo_Model_Api::$flash = $this->_helper->flashMessenger; 24 | } 25 | 26 | public function postDispatch() { 27 | $this->view->messages = $this->_helper->flashMessenger->getMessages(); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /library/myGengo/Exception.php: -------------------------------------------------------------------------------- 1 | file = $file; 31 | } 32 | 33 | public function setLine($line) 34 | { 35 | $this->line = $line; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /library/public/stylesheets/mygengo/scaffold.css: -------------------------------------------------------------------------------- 1 | body { background-color: #fff; color: #333; } 2 | 3 | body, p, ol, ul, td { 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | } 8 | 9 | pre { 10 | background-color: #eee; 11 | padding: 10px; 12 | font-size: 11px; 13 | } 14 | 15 | a { color: #000; } 16 | a:visited { color: #666; } 17 | a:hover { color: #fff; background-color:#000; } 18 | 19 | div.field, div.actions { 20 | margin-bottom: 10px; 21 | } 22 | 23 | #notice { 24 | color: green; 25 | } 26 | 27 | .field_with_errors { 28 | padding: 2px; 29 | background-color: red; 30 | display: table; 31 | } 32 | 33 | #error_explanation { 34 | width: 450px; 35 | border: 2px solid red; 36 | padding: 7px; 37 | padding-bottom: 0; 38 | margin-bottom: 20px; 39 | background-color: #f0f0f0; 40 | } 41 | 42 | #error_explanation h2 { 43 | text-align: left; 44 | font-weight: bold; 45 | padding: 5px 5px 5px 15px; 46 | font-size: 12px; 47 | margin: -7px; 48 | margin-bottom: 0px; 49 | background-color: #c00; 50 | color: #fff; 51 | } 52 | 53 | #error_explanation ul li { 54 | font-size: 12px; 55 | list-style: square; 56 | } 57 | -------------------------------------------------------------------------------- /application/modules/mygengo/Bootstrap.php: -------------------------------------------------------------------------------- 1 | 'Mygengo_', 13 | 'basePath' => dirname(__FILE__), 14 | )); 15 | 16 | return $autoloader; 17 | } 18 | 19 | /** 20 | * Test to show returned values will go into container 21 | * then they can be accessed by this resource method's name 22 | * without the '_init' prefix that is (moduledata) 23 | */ 24 | protected function _initModuleData() 25 | { 26 | $data = array(1,2,3,4,5,6,7,8,9,0); 27 | return $data; 28 | } 29 | 30 | /** 31 | * Init config settings and resoure for this module 32 | * 33 | */ 34 | protected function _initModuleConfig() 35 | { 36 | // load ini file 37 | $iniOptions = new Zend_Config_Ini(dirname(__FILE__) . '/configs/mygengo.ini'); 38 | // Set this bootstrap options 39 | $this->setOptions($iniOptions->toArray()); 40 | } 41 | 42 | 43 | } -------------------------------------------------------------------------------- /library/myGengo/Crypto.php: -------------------------------------------------------------------------------- 1 | job ?> 2 | 3 | 4 | Job # 5 | job_id ?> 6 |
7 | slug?> 8 | 9 | 10 | status?> 11 |
12 | tier?> 13 | 14 | 15 | comments) ?> comments 16 |
17 | lc_src?> » lc_tgt?> 18 | 19 | 20 | credits ?> credits 21 |
22 | unit_count ?> words 23 | 24 | 25 | ctime)?> 26 |
27 | eta ?> 28 | 29 | 30 | Actions 31 |
32 | Cancel 33 | status == 'reviewable'):?> 34 | Review 35 | 36 | View 37 | 38 | -------------------------------------------------------------------------------- /application/modules/mygengo/models/Api.php: -------------------------------------------------------------------------------- 1 | gmdate('U'), 'api_key' => self::$api_key); 13 | ksort($params); 14 | $query = http_build_query($params); 15 | $params['api_sig'] = myGengo_Crypto::sign($query, self::$api_sig); 16 | return $params; 17 | } 18 | 19 | public static function setPostParams($params) { 20 | $params = array('ts' => gmdate('U'), 'api_key' => self::$api_key, 21 | '_method' => 'post', 'data' => json_encode($data)); 22 | ksort($params); 23 | $query = http_build_query($params); 24 | $params['api_sig'] = myGengo_Crypto::sign($query, self::$api_sig); 25 | return $params; 26 | } 27 | 28 | public function parseRequest($client) { 29 | $tmp = json_decode($client->getResponseBody()); 30 | return $tmp->response; 31 | } 32 | 33 | public function set_api_key($api_key) { 34 | self::$api_key = $api_key; 35 | } 36 | 37 | public function set_api_sig($api_sig) { 38 | self::$api_sig = $api_sig; 39 | } 40 | 41 | public static function check_for_errors($client) { 42 | $response = json_decode($client->getResponseBody()); 43 | if (!is_null($response) && $response->opstat != 'ok') { 44 | // self::add_to_messages($response->err->msg); 45 | self::$flash->addMessage($response->err->msg); 46 | } 47 | return true; 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/jobs/show.phtml: -------------------------------------------------------------------------------- 1 | job ?> 2 | 3 |
4 |

Job: job_id?>(slug?>)

5 |
6 | 7 | 8 | partial('jobs/_job.phtml', array('job' => $job)) ?> 9 |
10 | 11 |
12 |
13 | Body 14 |
15 | 16 |
17 |
18 | status == 'approved') {?> 19 |
20 | Body TGT 21 |
22 | 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |

Feedback

31 |

32 | Rating: 33 | feedback->rating ?> 34 |

35 |

36 | For translator: 37 | feedback->for_translator ?> 38 |

39 |
40 |
41 | 42 |
43 |

Revisions

44 | 53 |
54 | 55 | partial('jobs/_comments.phtml', array('job' => $job)) ?> 56 | -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/jobs/reject.phtml: -------------------------------------------------------------------------------- 1 | job ?> 2 | 3 |

Rejection form

4 |
5 |
6 | Job #16775 7 |
8 |
9 | Whould you like to cancel the translation? 10 |
11 | 12 | Yes, please cancel and refund me 13 |
14 | 15 | No, please have another translator finish the job 16 |
17 |
18 | Rejection reason 19 |
20 | 21 | Poor quality of translation 22 |
23 | 24 | Missing of incomplete translation 25 |
26 | 27 | Other (please describe below) 28 |
29 |
30 | Comment 31 |
32 | 33 |
34 |
35 | Captcha 36 |
37 | 38 |
39 | 40 | | 41 | Back 42 | 43 |
-------------------------------------------------------------------------------- /library/myGengo/Api/Account.php: -------------------------------------------------------------------------------- 1 | setParamsNotId($format, $params); 40 | $baseurl = $this->config->get('baseurl', null, true); 41 | $baseurl .= "account/balance"; 42 | $this->response = $this->client->get($baseurl, $format, $params); 43 | } 44 | 45 | /** 46 | * account/stats (GET) 47 | * Retrieves account stats, such as orders made. 48 | * 49 | * @param string $format The response format, xml or json 50 | * @param array|string $params If passed should contain all the 51 | * necessary parameters for the request including the api_key and 52 | * api_sig 53 | */ 54 | public function getStats($format = null, $params = null) 55 | { 56 | $this->setParamsNotId($format, $params); 57 | $baseurl = $this->config->get('baseurl', null, true); 58 | $baseurl .= "account/stats"; 59 | $this->response = $this->client->get($baseurl, $format, $params); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /application/layouts/scripts/mygengo.phtml: -------------------------------------------------------------------------------- 1 | doctype (); 3 | ?> 4 | 5 | headMeta (); ?> 6 | headTitle (); ?> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 31 |
32 |
33 | messages)) : ?> 34 | messages as $message) : ?> 35 |
36 |

escape($message); ?>

37 |
38 | 39 | 40 |
41 |
42 | layout ()->content; ?> 43 |
44 |
45 | 50 |
51 |
52 |
53 | 54 | -------------------------------------------------------------------------------- /library/myGengo/Api/Service.php: -------------------------------------------------------------------------------- 1 | setParamsNotId($format, $params); 41 | $baseurl = $this->config->get('baseurl', null, true); 42 | $baseurl .= "translate/service/languages"; 43 | $this->response = $this->client->get($baseurl, $format, $params); 44 | } 45 | 46 | /** 47 | * translate/service/language_pairs (GET) 48 | * 49 | * Returns supported translation language pairs, tiers, and credit 50 | * prices. 51 | * 52 | * @param string $format The response format, xml or json 53 | * @param array|string $params If passed should contain all the 54 | * necessary parameters for the request including the api_key and 55 | * api_sig 56 | */ 57 | public function getLanguagePair($format = null, $params = null) 58 | { 59 | $this->setParamsNotId($format, $params); 60 | $baseurl = $this->config->get('baseurl', null, true); 61 | $baseurl .= "translate/service/language_pairs"; 62 | $this->response = $this->client->get($baseurl, $format, $params); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/jobs/review.phtml: -------------------------------------------------------------------------------- 1 | job ?> 2 |

Job review page

3 | 4 |
5 |
6 | Job #job_id ?> 7 |
8 |
9 |

10 | Original text 11 |
12 | 13 |

14 |
15 |
16 |

17 | Preview 18 |
19 | 20 |

21 |
22 |
23 | Please rate the translation 24 |
25 | Bad 26 | 27 | 1 28 | 29 | 2 30 | 31 | 3 32 | 33 | 4 34 | 35 | 5 36 | Good 37 |
38 |
39 | for_translator 40 |
41 | 42 |
43 |
44 | for_mygengo 45 |
46 | 47 |
48 |
49 | Can myGengo use this translation publicly in its examples? 50 |
51 | 52 | Yes, you can use this translation as public example of myGengo service. 53 |
54 | 55 | partial('jobs/_comments.phtml', array('job' => $job)) ?> 56 | 57 | 58 | | 59 | Reject 60 | | 61 | Request corrections 62 |
63 | -------------------------------------------------------------------------------- /library/myGengo/Config.php: -------------------------------------------------------------------------------- 1 | data = parse_ini_file($configpath); 34 | } 35 | else { 36 | $this->data = array(); 37 | } 38 | } 39 | 40 | public function __get($name) 41 | { 42 | return $this->get($name, null); 43 | } 44 | 45 | public function __set($name, $value) 46 | { 47 | $this->set($name, $value); 48 | } 49 | 50 | public function __isset($name) 51 | { 52 | if (array_key_exists($name, $this->data)) 53 | { 54 | return !empty($this->data[$name]); 55 | } 56 | return false; 57 | } 58 | 59 | public function __unset($name) 60 | { 61 | if (array_key_exists($name, $this->data)) 62 | { 63 | unset($this->data[$name]); 64 | } 65 | } 66 | 67 | public function get($name, $default = null, $must_exists = false) 68 | { 69 | if (array_key_exists($name, $this->data)) 70 | { 71 | if ($must_exists && empty($this->data[$name])) 72 | { 73 | throw new myGengo_Exception("Configuration field: {$name} is missing or empty."); 74 | } 75 | return $this->data[$name]; 76 | } 77 | if ($must_exists) 78 | { 79 | throw new myGengo_Exception("Configuration field: {$name} is missing or empty."); 80 | } 81 | return $default; 82 | } 83 | 84 | public function set($name, $value) 85 | { 86 | $this->data[$name] = $value; 87 | } 88 | 89 | public static function getInstance() 90 | { 91 | if (null === self::$instance) 92 | { 93 | self::$instance = new self(); 94 | } 95 | return self::$instance; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /application/modules/mygengo/views/scripts/jobs/new.phtml: -------------------------------------------------------------------------------- 1 |

New translation order

2 | 3 |
4 |
5 | Slug 6 |
7 | 8 |
9 |
10 |
11 | Text 12 |
13 | 14 |
15 |
16 |
17 |
18 | Translate from 19 |
20 | 25 |
26 |
27 | Translate to 28 |
29 | 34 |
35 |
36 | Tier 37 |
38 | 39 | Machine 40 | 41 | Standard 42 | 43 | Pro 44 | 45 | Ultra 46 |
47 | 52 |
53 | 57 |
58 |
59 | 60 | 61 | As group 62 |
63 |
64 | 65 | 66 | Auto approve and publish jobs 67 |
68 |
69 | Callback Url 70 |
71 | 72 |
73 |
74 | 75 |
76 |
77 |
78 |
-------------------------------------------------------------------------------- /library/public/stylesheets/mygengo/mugen.css: -------------------------------------------------------------------------------- 1 | .mygengo-box { 2 | border: 1px dashed #000; 3 | margin: 5px; 4 | padding: 5px 0px 5px 15px; 5 | width: 400px; 6 | } 7 | 8 | .hidden { 9 | display: none; 10 | } 11 | 12 | .clear { 13 | clear: all; 14 | } 15 | 16 | .mygengo-form { 17 | 18 | } 19 | 20 | .mygengo-form div{ 21 | } 22 | 23 | .mygengo-form div.float{ 24 | float: left; 25 | margin-right: 15px; 26 | } 27 | .mygengo-form div.left{ 28 | float: left; 29 | margin-right: 15px; 30 | } 31 | 32 | 33 | .mygento-comments { 34 | 35 | } 36 | 37 | .mygengo-revisions { 38 | 39 | } 40 | 41 | table td { 42 | padding: 6px 6px; 43 | border-bottom: 1px solid #cccccc; 44 | font-size: 1em; 45 | line-height: 1.4em; 46 | vertical-align: top; 47 | } 48 | 49 | .general { 50 | margin: 1.4em 0; } 51 | .general h2 { 52 | font-size: 1.1em; 53 | margin: 0; } 54 | 55 | table.general { 56 | width: 100%; 57 | margin: 0.5em auto 1em auto; 58 | border-top: 1px solid #cccccc; 59 | background: white; } 60 | table.general thead th { 61 | font-weight: normal; 62 | font-size: 0.95em; 63 | line-height: 1em; 64 | padding: 4px 6px; 65 | border-bottom: 1px solid #cccccc; 66 | background-color: #dddddd; 67 | page-break-before: auto; 68 | white-space: nowrap; 69 | text-align: left; } 70 | table.general thead th.right_align { 71 | text-align: right; } 72 | table.general thead th a { 73 | color: #006699; 74 | text-decoration: none; 75 | border: 0; } 76 | table.general thead.tabular th { 77 | font-weight: normal; 78 | font-size: 9px; 79 | text-transform: uppercase; 80 | line-height: 1em; 81 | padding: 5px 6px; 82 | background-color: #dddddd; } 83 | table.general thead.tabular th.flag_label { 84 | padding: 5px 2px; } 85 | table.general tr.highlight { 86 | background-color: #ecf7ff; 87 | cursor: pointer; } 88 | table.general tr.normal { 89 | background: transparent; } 90 | table.general td { 91 | padding: 6px 6px; 92 | border-bottom: 1px solid #cccccc; 93 | font-size: 1em; 94 | line-height: 1.4em; 95 | vertical-align: top; } 96 | table.general td.grouping_header { 97 | font-weight: bold; 98 | font-size: 0.9em; 99 | line-height: 1.1em; 100 | padding: 4px 6px; 101 | border-bottom: 1px solid #cccccc; 102 | color: #999999; 103 | background-color: #f6f6f6; } 104 | table.general td.header { 105 | padding: 0.4em 0.5em; 106 | vertical-align: bottom; 107 | border-bottom: 1px solid #cccccc; 108 | background-color: #eeeeee; } 109 | table.general td.right_align { 110 | text-align: right; 111 | white-space: nowrap; } 112 | table.general td.upper { 113 | text-transform: uppercase; } 114 | table.general tbody td.grouping_header { 115 | padding: 6px; } 116 | table.general tfoot td { 117 | border: 0; } 118 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | ZF-Mygengo is Zend Framework module for MyGengo() 3 | 4 | ## Installation 5 | Copy archive contents in your zend framework application folder 6 | 7 | Add few configuration options to your `configs/application.ini` 8 | 9 | resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 10 | resources.modules[] = "" 11 | autoloaderNamespaces[] = "Add_" 12 | autoloaderNamespaces[] = "myGengo_" 13 | mygengo.resources.layout.layout = "mygengo" 14 | 15 | Set up your Api and Private key in `application/modules/mygengo/configs/mygengo.ini` 16 | 17 | ## Quickstart from scratch 18 | 19 | * Start by downloading ZendFramework from Official Site() 20 | I have downloaded version "Zend Framework 1.11.3 Full" 21 | * Unpack contents to a directory where you can quick access in example `~/Sites/zf` 22 | * Now either add `~/Sites/zf/bin` to your PATH or run it via relative path 23 | * Create quickstart project 24 | 25 | cd ~/Sites 26 | sh ./zf/bin/zf.sh create project quickstart 27 | 28 | * Add symlink to a Zend framework library 29 | 30 | cd quickstart/library 31 | ln -s ~/Sites/zf/library/Zend . 32 | 33 | * Enable layout 34 | 35 | cd ~/Sites/quickstart 36 | sh ../zf/bin/zf.sh enable layout 37 | 38 | * Checkout source zf-mygengo source code 39 | 40 | cd ~/Sites 41 | git clone git@github.com:shell/zf-mygengo.git 42 | 43 | or download it from download section 44 | 45 | * Unpack contents in your quickstart folder 46 | 47 | cp -R zf-mygengo/* quickstart/ 48 | 49 | * Put your API and Private Key to `quickstart/application/modules/configs/mygengo.ini` 50 | 51 | * Add following options to [Production] section in `quickstart/application/configs/application.ini` 52 | 53 | resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 54 | resources.modules[] = "" 55 | autoloaderNamespaces[] = "Add_" 56 | autoloaderNamespaces[] = "myGengo_" 57 | mygengo.resources.layout.layout = "mygengo" 58 | 59 | * create assets directory public/images/mygengo 60 | 61 | cd quickstart 62 | mkdir -p public/images/mygengo 63 | 64 | * Configure your server's htdocs to `~/Sites` or as in my case /Applications/MAMP/htdocs 65 | 66 | * You're all set to go! Check out page() 67 | 68 | 69 | ## Usage 70 | Module uses `application/layouts/scripts/mygengo.phtml` layout 71 | 72 | By default routes will be nested in /mygengo path 73 | Example () 74 | 75 | ## Screencasts 76 | Installation() 77 | 78 | Usage() 79 | 80 | ## TODO 81 | * placeholder 82 | 83 | ## Author 84 | Copyright (c) 2011 Vladimir Penkin 85 | -------------------------------------------------------------------------------- /application/modules/mygengo/models/Job.php: -------------------------------------------------------------------------------- 1 | getJob($job_id, 'json'); 8 | self::check_for_errors($job); 9 | $response = self::parseRequest($job); 10 | return $response->job; 11 | } 12 | 13 | static function create($params) { 14 | $job = myGengo_Api::factory('job'); 15 | $job->postJob($params); 16 | self::check_for_errors($job); 17 | $response = self::parseRequest($job); 18 | return $response; 19 | } 20 | 21 | static function revise($job_id, $comment) { 22 | $job = myGengo_Api::factory('job'); 23 | $job->revise($job_id, $comment); 24 | self::check_for_errors($job); 25 | $response = self::parseRequest($job); 26 | return $response; 27 | } 28 | 29 | static function approve($id, $params) { 30 | $job = myGengo_Api::factory('job'); 31 | $job->approve($id, $params); 32 | self::check_for_errors($job); 33 | $response = self::parseRequest($job); 34 | return $response; 35 | } 36 | 37 | static function reject($id, $params) { 38 | $job = myGengo_Api::factory('job'); 39 | $job->reject($id, $params); 40 | self::check_for_errors($job); 41 | $response = self::parseRequest($job); 42 | return $response; 43 | } 44 | 45 | static function delete($job_id) { 46 | $job = myGengo_Api::factory('job'); 47 | $job->cancel($job_id, 'json'); 48 | self::check_for_errors($job); 49 | $response = self::parseRequest($job); 50 | return $response; 51 | } 52 | 53 | static function preview($id) { 54 | $job = myGengo_Api::factory('job'); 55 | $job->previewJob($id); 56 | self::check_for_errors($job); 57 | $stream = $job->getResponseBody(); 58 | 59 | $fn = md5(count($stream)).'.jpg'; 60 | $fpath = dirname(__FILE__) . '/../../../../public/images/mygengo/' . $fn; 61 | // die($fpath); 62 | $fh = fopen($fpath, 'w'); 63 | fwrite($fh, $stream); 64 | fclose($fh); 65 | 66 | return $fn; 67 | } 68 | 69 | static function create_comment($id, $body) { 70 | $job = myGengo_Api::factory('job'); 71 | $job->postComment($id, $body); 72 | self::check_for_errors($job); 73 | $response = self::parseRequest($job); 74 | return $response; 75 | } 76 | 77 | static function comments($job_id) { 78 | $job = myGengo_Api::factory('job'); 79 | $job->getComments($job_id, 'json'); 80 | self::check_for_errors($job); 81 | $response = self::parseRequest($job); 82 | return $response->thread; 83 | } 84 | 85 | static function feedback($job_id) { 86 | $job = myGengo_Api::factory('job'); 87 | $job->getFeedback($job_id, 'json'); 88 | self::check_for_errors($job); 89 | $response = self::parseRequest($job); 90 | return $response->feedback; 91 | } 92 | 93 | static function revisions($job_id) { 94 | $job = myGengo_Api::factory('job'); 95 | $job->getRevisions($job_id, 'json'); 96 | self::check_for_errors($job); 97 | $response = self::parseRequest($job); 98 | return is_array($response->revisions) ? $response->revisions : array($response->revisions); 99 | } 100 | 101 | static function revision($job_id, $id) { 102 | $job = myGengo_Api::factory('job'); 103 | $job->getRevision($job_id, $id, 'json'); 104 | self::check_for_errors($job); 105 | $response = self::parseRequest($job); 106 | return $response->revision; 107 | } 108 | 109 | 110 | } -------------------------------------------------------------------------------- /library/myGengo/Client.php: -------------------------------------------------------------------------------- 1 | config = myGengo_Config::getInstance(); 30 | $config = array('maxredirects' => 5, 31 | 'useragent' => 'phpMyGengo 1.0', 32 | 'timeout' => 10, 33 | 'keepalive' => false); 34 | $this->client = new Zend_Http_Client(null, $config); 35 | } 36 | 37 | public function get($url, $format = null, array $params = null) 38 | { 39 | $this->client->resetParameters(true); 40 | return $this->request($url, Zend_Http_Client::GET, $format, $params); 41 | } 42 | 43 | public function post($url, $format = null, array $params = null) 44 | { 45 | $this->client->resetParameters(true); 46 | return $this->request($url, Zend_Http_Client::POST, $format, $params); 47 | } 48 | 49 | public function put($url, $format = null, array $params = null) 50 | { 51 | $this->client->resetParameters(true); 52 | return $this->request($url, Zend_Http_Client::PUT, $format, $params); 53 | } 54 | 55 | public function delete($url, $format = null, array $params = null) 56 | { 57 | $this->client->resetParameters(true); 58 | return $this->request($url, Zend_Http_Client::DELETE, $format, $params); 59 | } 60 | 61 | protected function request($url, $method, $format = null, $params = null) 62 | { 63 | $method = strtoupper($method); 64 | $methods = array('GET','POST','PUT','DELETE'); 65 | if (! in_array($method, $methods)) 66 | { 67 | throw new myGengo_Exception("HTTP method: {$method} not supported"); 68 | } 69 | if (! is_null($format) && is_string($format)) 70 | { 71 | $format = strtolower($format); 72 | $formats = array('json', 'xml'); 73 | if (! in_array($format, $formats)) 74 | { 75 | throw new myGengo_Exception("Invalid response format: {$format}, accepted formats are: json or xml."); 76 | } 77 | switch ($format) 78 | { 79 | case 'xml': 80 | $this->client->setHeaders('Accept', 'application/xml'); 81 | break; 82 | case 'json': 83 | $this->client->setHeaders('Accept', 'application/json'); 84 | break; 85 | } 86 | } 87 | if (! is_null($params)) 88 | { 89 | switch ($method) 90 | { 91 | case 'DELETE': 92 | case 'GET': 93 | $this->client->setParameterGet($params); 94 | break; 95 | case 'POST': 96 | $this->client->setParameterPost($params); 97 | break; 98 | case 'PUT': 99 | if (is_array($params)) 100 | { 101 | $params = http_build_query($params); 102 | } 103 | $this->client->setRawData($params, Zend_Http_Client::ENC_URLENCODED); 104 | break; 105 | } 106 | } 107 | try { 108 | $this->client->setUri($url); 109 | if ($this->config->get('debug', false)) 110 | { 111 | $response = $this->client->request($method); 112 | /*echo $this->client->getUri(true); 113 | echo "\n"; 114 | echo $this->client->getLastRequest(); 115 | echo "\n";*/ 116 | return $response; 117 | } 118 | return $this->client->request($method); 119 | } 120 | catch (Exception $ex) { 121 | throw new myGengo_Exception($ex->getMessage(), $ex->getCode()); 122 | } 123 | } 124 | 125 | public static function getInstance() 126 | { 127 | if (null === self::$instance) 128 | { 129 | self::$instance = new self(); 130 | } 131 | return self::$instance; 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /library/myGengo/Api.php: -------------------------------------------------------------------------------- 1 | config = myGengo_Config::getInstance(); 30 | if (! is_null($api_key)) 31 | { 32 | $this->config->api_key = $api_key; 33 | } 34 | if (! is_null($private_key)) 35 | { 36 | $this->config->private_key = $private_key; 37 | } 38 | $this->client = myGengo_Client::getInstance(); 39 | $this->response = null; 40 | } 41 | 42 | /** 43 | * @param string $api_key Overwrite or set the api_key 44 | * @return void 45 | */ 46 | public function setApiKey($api_key) 47 | { 48 | $this->config->set('api_key', $api_key); 49 | } 50 | 51 | /** 52 | * @param string $private_key Overwrite or set the private_key 53 | * @return void 54 | */ 55 | public function setPrivateKey($private_key) 56 | { 57 | $this->config->set('private_key', $private_key); 58 | } 59 | 60 | /** 61 | * @param string $format Overwrite or set the requested response 62 | * format (xml or json) 63 | * @return void 64 | */ 65 | public function setResponseFormat($format) 66 | { 67 | $format = strtolower($format); 68 | $valid = array('xml', 'json'); 69 | if (! in_array($format, $valid)) 70 | { 71 | throw new myGengo_Exception("Invalid response format: {$format}, accepted formats are: xml or json."); 72 | } 73 | $this->config->format = $format; 74 | } 75 | 76 | /** 77 | * @param string $url Overwrite or set the api base url 78 | * @return void 79 | */ 80 | public function setBaseUrl($url) 81 | { 82 | // make sure it ends with forward slash 83 | $this->config->baseurl = rtrim($url, '\//') . '/'; 84 | } 85 | 86 | /** 87 | * @param bool $raw True or False (false by default) 88 | * @return string If $raw is true the raw body (as transfered on 89 | * wire) will be returned, if false the decoded body 90 | */ 91 | public function getResponseBody($raw = false) 92 | { 93 | $this->checkResponse(); 94 | if ($raw) 95 | { 96 | return $this->response->getRawBody(); 97 | } 98 | return $this->response->getBody(); 99 | } 100 | 101 | /** 102 | * @return int The HTTP response status code 103 | */ 104 | public function getResponseCode() 105 | { 106 | $this->checkResponse(); 107 | return $this->response->getStatus(); 108 | } 109 | 110 | /** 111 | * @param string $key The HTTP header to return 112 | * @return string The requested HTTP header or null if header does 113 | * not exists 114 | */ 115 | public function getResponseHeader($key) 116 | { 117 | $this->checkResponse(); 118 | return $this->response->getHeader($key); 119 | } 120 | 121 | /** 122 | * @param bool $as_array True or false (false by default) 123 | */ 124 | public function getResponseHeaders($as_array = false) 125 | { 126 | $this->checkResponse(); 127 | if ($as_array) 128 | { 129 | return $this->response->getHeaders(); 130 | } 131 | return $this->response->getHeadersAsString(); 132 | } 133 | 134 | protected function checkResponse() 135 | { 136 | if (is_null($this->response)) 137 | { 138 | throw new myGengo_Exception("A valid response is not yet available, please make a request first."); 139 | } 140 | } 141 | 142 | public function __toString() 143 | { 144 | if (is_null($this->response)) 145 | { 146 | return ''; 147 | } 148 | return $this->response->__toString(); 149 | } 150 | 151 | /** 152 | * @param string $client The name of the clinet to instantiate (job, jobs, account or service) 153 | * @param string $api_key user api key 154 | * @param string $private_key user secret key 155 | * @return myGengo_Api A myGengo Api client 156 | */ 157 | public static function factory($client, $api_key = null, $private_key = null) 158 | { 159 | switch ($client) 160 | { 161 | case 'job': 162 | return new myGengo_Api_Job($api_key, $private_key); 163 | case 'jobs': 164 | return new myGengo_Api_Jobs($api_key, $private_key); 165 | case 'account': 166 | return new myGengo_Api_Account($api_key, $private_key); 167 | case 'service': 168 | return new myGengo_Api_Service($api_key, $private_key); 169 | } 170 | throw new myGengo_Exception("Invalid client: {$client}, accepted clients are: job,jobs,account and service."); 171 | } 172 | 173 | /** 174 | * Set the passed parameters that are null with default 175 | * configuration values 176 | */ 177 | protected function setParams(&$id, &$format, &$params) 178 | { 179 | if (is_null($id)) 180 | { 181 | $id = $this->config->get('job_id', null, true); 182 | } 183 | if (is_null($format)) 184 | { 185 | $format = $this->config->get('format', null, true); 186 | } 187 | if (is_null($params)) 188 | { 189 | $private_key = $this->config->get('private_key', null, true); 190 | $params = array(); 191 | $params['ts'] = gmdate('U'); 192 | $params['api_key'] = $this->config->get('api_key', null, true); 193 | ksort($params); 194 | $query = http_build_query($params); 195 | $params['api_sig'] = myGengo_Crypto::sign($query, $private_key); 196 | } 197 | } 198 | 199 | /** 200 | * Set the passed parameters that are null with default 201 | * configuration values 202 | */ 203 | protected function setParamsNotId(&$format, &$params) 204 | { 205 | $hack = 0; 206 | $this->setParams($hack, $format, $params); 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /library/public/stylesheets/mygengo/base.css: -------------------------------------------------------------------------------- 1 | * {margin:0;padding:0} 2 | .clear { clear: both; height: 0; } 3 | 4 | .wat-cf:after { 5 | content: "."; 6 | display: block; 7 | height: 0; 8 | clear: both; 9 | visibility: hidden; 10 | } 11 | 12 | .wat-cf {display: inline-block;} 13 | 14 | /* Hides from IE-mac \*/ 15 | * html .wat-cf {height: 1%;} 16 | .wat-cf {display: block;} 17 | /* End hide from IE-mac */ 18 | 19 | h1 { margin: 15px 0; font-size: 22px; font-weight: normal; } 20 | h2 { font-size: 22px; margin: 15px 0; font-weight: normal;} 21 | h3 { font-size: 18px; margin: 10px 0; font-weight: normal;} 22 | h4 { font-size: 16px; margin: 10px 0; font-weight: normal;} 23 | hr {height: 1px; border: 0; } 24 | p { margin: 15px 0;} 25 | a img { border: none; } 26 | 27 | body { 28 | font-size: 12px; 29 | font-family: sans-serif; 30 | } 31 | 32 | #container { 33 | min-width: 960px; 34 | } 35 | 36 | #header, #wrapper { 37 | padding: 0 20px; 38 | } 39 | 40 | #header { 41 | position: relative; 42 | padding-top: 1px; 43 | } 44 | 45 | #header h1 { 46 | margin: 0; 47 | padding: 10px 0; 48 | font-size: 26px; 49 | } 50 | 51 | #header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { 52 | text-decoration: none; 53 | } 54 | 55 | #main { 56 | width: 70%; 57 | float: left; 58 | } 59 | 60 | .actions-bar { 61 | padding: 10px 1px; 62 | } 63 | 64 | .actions-bar .actions { 65 | float: left; 66 | } 67 | 68 | 69 | .actions-bar .pagination { 70 | float: right; 71 | padding: 1px 0; 72 | } 73 | 74 | #sidebar { 75 | width: 25%; 76 | float: right; 77 | } 78 | 79 | #sidebar h3 { 80 | padding: 10px 15px; 81 | margin: 0; 82 | font-size: 13px; 83 | } 84 | 85 | #sidebar .block { 86 | margin-bottom: 20px; 87 | padding-bottom: 10px; 88 | } 89 | 90 | #sidebar .block .content { 91 | padding: 0 15px; 92 | } 93 | 94 | #sidebar ul.navigation li a:link, #sidebar ul.navigation li a:visited { 95 | display: block; 96 | padding: 10px 15px; 97 | } 98 | 99 | #sidebar .block .sidebar-block, #sidebar .notice { 100 | padding:10px; 101 | } 102 | 103 | #wrapper { 104 | padding-top: 20px; 105 | } 106 | 107 | #main .block { 108 | margin-bottom: 20px; 109 | padding-top: 1px; 110 | } 111 | 112 | #main .block .content .inner { 113 | padding: 0 15px 15px; 114 | } 115 | 116 | #main .main p.first { 117 | margin-top: 0; 118 | } 119 | 120 | #user-navigation { 121 | position: absolute; 122 | top: 0px; 123 | right: 20px; 124 | } 125 | 126 | #main-navigation { 127 | width: 100%; 128 | } 129 | 130 | #user-navigation ul, #main-navigation ul, .secondary-navigation ul, #sidebar ul.navigation { 131 | margin: 0; 132 | padding: 0; 133 | list-style-type: none; 134 | } 135 | 136 | #user-navigation ul li, #main-navigation ul li, .secondary-navigation ul li { 137 | float: left; 138 | } 139 | 140 | #main-navigation ul li { 141 | margin-right: 5px; 142 | } 143 | 144 | #user-navigation ul li { 145 | padding: 5px 10px; 146 | } 147 | 148 | #main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, 149 | .secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, 150 | #user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { 151 | text-decoration: none; 152 | } 153 | 154 | #main-navigation ul li a { 155 | font-size: 14px; 156 | line-height: 14px; 157 | display: block; 158 | padding: 8px 15px; 159 | } 160 | 161 | .secondary-navigation { 162 | font-size: 13px; 163 | border-bottom-width: 10px; 164 | border-bottom-style: solid; 165 | } 166 | 167 | .secondary-navigation ul li a { 168 | display: block; 169 | padding: 10px 15px; 170 | } 171 | 172 | #footer { 173 | padding-bottom: 20px; 174 | } 175 | 176 | /* pagination */ 177 | 178 | .pagination a, .pagination span, .pagination em { 179 | padding: 2px 5px; 180 | margin-right: 5px; 181 | display: block; 182 | float: left; 183 | border-style: solid; 184 | border-width: 1px; 185 | } 186 | 187 | .pagination em { 188 | font-weight: bold; 189 | } 190 | 191 | .pagination a { 192 | text-decoration: none; 193 | } 194 | 195 | /* tables */ 196 | .table { 197 | width: 100%; 198 | border-collapse: collapse; 199 | margin-bottom: 15px; 200 | } 201 | 202 | .table th { 203 | padding: 10px; 204 | font-weight: bold; 205 | text-align: left; 206 | } 207 | 208 | .table th.first { 209 | width: 30px; 210 | } 211 | 212 | .table th.last { 213 | width: 200px; 214 | } 215 | 216 | .table .checkbox { 217 | margin-left: 10px; 218 | } 219 | 220 | .table td { 221 | padding: 10px; 222 | } 223 | 224 | .table td.last { 225 | text-align: right; 226 | } 227 | 228 | /* forms */ 229 | 230 | input.checkbox { 231 | margin: 0; 232 | padding: 0; 233 | } 234 | 235 | .form .group { 236 | margin-bottom: 15px; 237 | } 238 | 239 | .form div.left { 240 | width: 20%; 241 | float: left; 242 | } 243 | 244 | .form div.right { 245 | width: 75%; 246 | float: right; 247 | } 248 | 249 | .form .columns .column { 250 | width: 48%; 251 | } 252 | 253 | .form .columns .left { 254 | float: left; 255 | } 256 | 257 | .form .columns .right { 258 | float: right; 259 | } 260 | 261 | .form label.label, .form input.text_field, .form textarea.text_area { 262 | font-size: 1.2em; 263 | padding: 1px 0; 264 | margin: 0; 265 | } 266 | 267 | .form label.right { 268 | text-align: right; 269 | } 270 | 271 | .form input.checkbox, .form input.radio { 272 | margin-right: 5px; 273 | } 274 | 275 | .form label.checkbox, .form label.radio { 276 | line-height: 1.5em; 277 | } 278 | 279 | .form label.label { 280 | display: block; 281 | padding-bottom: 2px; 282 | font-weight: bold; 283 | } 284 | 285 | .form div.fieldWithErrors label.label { 286 | display: inline; 287 | } 288 | 289 | .form .fieldWithErrors .error { 290 | color: red; 291 | } 292 | 293 | .form input.text_field, .form textarea.text_area { 294 | width: 100%; 295 | border-width: 1px; 296 | border-style: solid; 297 | } 298 | 299 | /* lists */ 300 | 301 | ul.list { 302 | margin: 0; 303 | padding: 0; 304 | list-style-type: none; 305 | } 306 | 307 | ul.list li { 308 | clear: left; 309 | padding-bottom: 5px; 310 | } 311 | 312 | ul.list li .left { 313 | float: left; 314 | } 315 | 316 | ul.list li .left .avatar { 317 | width: 50px; 318 | height: 50px; 319 | } 320 | 321 | ul.list li .item { 322 | margin-left: 80px; 323 | } 324 | 325 | ul.list li .item .avatar { 326 | float: left; 327 | margin: 0 5px 5px 0; 328 | width: 30px; 329 | height: 30px; 330 | } 331 | 332 | /* box */ 333 | 334 | #box { 335 | width: 500px; 336 | margin: 50px auto; 337 | } 338 | 339 | #box .block { 340 | margin-bottom: 20px; 341 | } 342 | 343 | #box .block h2 { 344 | padding: 10px 15px; 345 | margin: 0; 346 | } 347 | 348 | #box .block .content { 349 | padding: 10px 20px; 350 | } 351 | 352 | /* Inspired by http://particletree.com/features/rediscovering-the-button-element */ 353 | 354 | a.button:link, a.button:visited, a.button:hover, a.button:active, button.button { 355 | color: #222; 356 | display:block; 357 | float:left; 358 | margin:0 7px 0 0; 359 | background-color: #eee; 360 | border:1px solid #bfbfbf; 361 | font-size: 1em; 362 | line-height: 1.3em; 363 | font-weight:bold; 364 | cursor:pointer; 365 | padding:5px 10px 6px 7px; 366 | text-decoration: none; 367 | } 368 | 369 | button.button { 370 | width:auto; 371 | overflow:visible; 372 | padding:4px 10px 3px 7px; /* IE6 */ 373 | } 374 | button.button[type] { 375 | padding:5px 10px 5px 7px; /* Firefox */ 376 | line-height:17px; /* Safari */ 377 | } 378 | 379 | *:first-child+html button.button[type] { 380 | padding:4px 10px 3px 7px; /* IE7 */ 381 | } 382 | 383 | button.button img, a.button img { 384 | margin:0 3px -3px 0 !important; 385 | padding:0; 386 | border:none; 387 | width:16px; 388 | height:16px; 389 | } 390 | 391 | button.button:hover, a.button:hover { 392 | background-color:#dedede; 393 | } 394 | 395 | button.button:active, a.button:active { 396 | background-color:#e5e5e5; 397 | } -------------------------------------------------------------------------------- /application/modules/mygengo/controllers/JobsController.php: -------------------------------------------------------------------------------- 1 | job_id); 12 | $job->comments = Mygengo_Model_Job::comments($job_i->job_id); 13 | $jobs []= $job; 14 | } 15 | 16 | $this->view->jobs = $jobs; 17 | } 18 | 19 | public function newAction() { 20 | $languages = Mygengo_Model_Service::languages(); 21 | $language_pairs = Mygengo_Model_Service::language_pairs(); 22 | $lc_src = array(); 23 | $lc_tgt = array(); 24 | 25 | foreach($language_pairs as $lp) { 26 | 27 | if (!in_array($lp->lc_src, $lc_src)) { 28 | foreach ($languages as $k => $v) { 29 | if ($v->lc == $lp->lc_src) { 30 | $lc_src = array_merge($lc_src, array($v->lc => $v->language)); 31 | } 32 | } 33 | } 34 | if (!in_array($lp->lc_tgt, $lc_src)) { 35 | foreach ($languages as $k => $v) { 36 | if ($v->lc == $lp->lc_tgt) { 37 | $lc_tgt = array_merge($lc_tgt, array($v->lc => $v->language)); 38 | } 39 | } 40 | } 41 | } 42 | 43 | $this->view->lc_src = $lc_src; 44 | $this->view->lc_tgt = $lc_tgt; 45 | } 46 | 47 | public function createAction() { 48 | $job = $this->getRequest()->getParam('job'); 49 | if (!is_null($job)) { 50 | if (empty($job['callback_url'])) { 51 | $job = array_remove_keys($job, 'callback_url'); 52 | } 53 | Mygengo_Model_Job::create($job); 54 | $this->_helper->_redirector->gotoSimple('index','jobs'); 55 | } else { 56 | throw new Zend_Controller_Action_Exception('Not found', 404); 57 | } 58 | } 59 | 60 | public function showAction() { 61 | $job_id = $this->getRequest()->getParam('id'); 62 | if (!is_null($job_id)) { 63 | $job = Mygengo_Model_Job::find($job_id); 64 | $job->comments = Mygengo_Model_Job::comments($job_id); 65 | $job->feedback = Mygengo_Model_Job::feedback($job_id); 66 | $job->revisions = Mygengo_Model_Job::revisions($job_id); 67 | // var_dump($job->revisions); 68 | $this->view->job = $job; 69 | } else { 70 | throw new Zend_Controller_Action_Exception('Not found', 404); 71 | } 72 | } 73 | 74 | public function revisionAction() { 75 | $job_id = $this->getRequest()->getParam('id'); 76 | $rev_id = $this->getRequest()->getParam('rev_id'); 77 | if (!is_null($job_id) && !is_null($rev_id)) { 78 | $revision = Mygengo_Model_Job::revision($job_id, $rev_id); 79 | 80 | $this->view->job_id = $job_id; 81 | $this->view->revision = $revision; 82 | } else { 83 | throw new Zend_Controller_Action_Exception('Not found', 404); 84 | } 85 | } 86 | 87 | public function cancelAction() { 88 | $job_id = $this->getRequest()->getParam('id'); 89 | 90 | if (!is_null($job_id)) { 91 | Mygengo_Model_Job::delete($job_id); 92 | $this->_helper->_redirector->gotoSimple('index','jobs'); 93 | } else { 94 | throw new Zend_Controller_Action_Exception('Not found', 404); 95 | } 96 | } 97 | 98 | public function reviewAction() { 99 | $job_id = $this->getRequest()->getParam('id'); 100 | if (!is_null($job_id)) { 101 | $job = Mygengo_Model_Job::find($job_id); 102 | if (!is_null($job) && $job->status == 'reviewable') { 103 | $preview = Mygengo_Model_Job::preview($job_id); 104 | $job->comments = Mygengo_Model_Job::comments($job_id); 105 | 106 | $this->view->job = $job; 107 | $this->view->preview = $preview; 108 | } else { 109 | throw new Zend_Controller_Action_Exception('Not viewewable', 404); 110 | } 111 | } else { 112 | throw new Zend_Controller_Action_Exception('Not found', 404); 113 | } 114 | } 115 | 116 | public function rejectAction() { 117 | $job_id = $this->getRequest()->getParam('id'); 118 | if (!is_null($job_id)) { 119 | $job = Mygengo_Model_Job::find($job_id); 120 | if (!is_null($job) && $job->status == 'reviewable') { 121 | $preview = Mygengo_Model_Job::preview($job_id); 122 | $job->comments = Mygengo_Model_Job::comments($job_id); 123 | 124 | $this->view->job = $job; 125 | $this->view->preview = $preview; 126 | } else { 127 | throw new Zend_Controller_Action_Exception('Not viewewable', 404); 128 | } 129 | } else { 130 | throw new Zend_Controller_Action_Exception('Not found', 404); 131 | } 132 | 133 | } 134 | 135 | public function reviseAction() { 136 | $job_id = $this->getRequest()->getParam('id'); 137 | if (!is_null($job_id)) { 138 | $job = Mygengo_Model_Job::find($job_id); 139 | if (!is_null($job) && $job->status == 'reviewable') { 140 | $preview = Mygengo_Model_Job::preview($job_id); 141 | $job->comments = Mygengo_Model_Job::comments($job_id); 142 | 143 | $this->view->job = $job; 144 | $this->view->preview = $preview; 145 | } else { 146 | throw new Zend_Controller_Action_Exception('Not viewewable', 404); 147 | } 148 | } else { 149 | throw new Zend_Controller_Action_Exception('Not found', 404); 150 | } 151 | } 152 | 153 | public function approveAction() { 154 | $id = $this->getRequest()->getParam('id'); 155 | $payload = $this->getRequest()->getParam('job'); 156 | if (!is_null($id)) { 157 | try { 158 | Mygengo_Model_Job::approve($id, $payload); 159 | } catch (myGengo_Exception $e) { 160 | $this->_helper->flashMessenger->addMessage($e->getMessage()); 161 | } 162 | $this->_helper->_redirector->gotoSimple('show','jobs', null, array('id' => $id)); 163 | } else { 164 | throw new Zend_Controller_Action_Exception('Not found', 404); 165 | } 166 | } 167 | 168 | public function revisepostAction() { 169 | $job_id = $this->getRequest()->getParam('id'); 170 | $comment = $this->getRequest()->getParam('comment'); 171 | if (!is_null($job_id) && !is_null($comment)) { 172 | try { 173 | Mygengo_Model_Job::revise($job_id, $comment); 174 | } catch (myGengo_Exception $e) { 175 | $this->_helper->flashMessenger->addMessage($e->getMessage()); 176 | } 177 | $this->_helper->_redirector->gotoSimple('show','jobs', null, array('id' => $job_id)); 178 | } else { 179 | throw new Zend_Controller_Action_Exception('Not found', 404); 180 | } 181 | } 182 | 183 | public function rejectpostAction() { 184 | $id = $this->getRequest()->getParam('id'); 185 | $payload = $this->getRequest()->getParam('job'); 186 | if (!is_null($id)) { 187 | try{ 188 | Mygengo_Model_Job::reject($id, $payload); 189 | } catch (myGengo_Exception $e) { 190 | $this->_helper->flashMessenger->addMessage($e->getMessage()); 191 | } 192 | $this->_helper->_redirector->gotoSimple('show','jobs', null, array('id' => $id)); 193 | } else { 194 | throw new Zend_Controller_Action_Exception('Not found', 404); 195 | } 196 | } 197 | 198 | public function createcommentAction() { 199 | $id = $this->getRequest()->getParam('id'); 200 | $body = $this->getRequest()->getParam('body'); 201 | if (!is_null($id)) { 202 | try { 203 | Mygengo_Model_Job::create_comment($id, $body); 204 | } catch (myGengo_Exception $e) { 205 | $this->_helper->flashMessenger->addMessage($e->getMessage()); 206 | } 207 | $this->_helper->_redirector->gotoSimple('show','jobs', null, array('id' => $id)); 208 | } else { 209 | throw new Zend_Controller_Action_Exception('Not found', 404); 210 | } 211 | 212 | } 213 | 214 | } 215 | 216 | 217 | function array_remove_keys($array, $keys = array()) { 218 | 219 | // If array is empty or not an array at all, don't bother 220 | // doing anything else. 221 | if(empty($array) || (! is_array($array))) { 222 | return $array; 223 | } 224 | 225 | // If $keys is a comma-separated list, convert to an array. 226 | if(is_string($keys)) { 227 | $keys = explode(',', $keys); 228 | } 229 | 230 | // At this point if $keys is not an array, we can't do anything with it. 231 | if(! is_array($keys)) { 232 | return $array; 233 | } 234 | 235 | // array_diff_key() expected an associative array. 236 | $assocKeys = array(); 237 | foreach($keys as $key) { 238 | $assocKeys[$key] = true; 239 | } 240 | 241 | return array_diff_key($array, $assocKeys); 242 | } 243 | -------------------------------------------------------------------------------- /library/public/stylesheets/mygengo/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Drastic Dark 4 | by Juan Maria Martinez Arce 5 | juan[at]insignia4u.com 6 | 7 | light grey: #cfcfcf 8 | medium grey: #36393d 9 | dark grey: #1a1a1a 10 | interactive action yellow #ffff88 11 | red #cc0000 12 | light blue #E6EEFC 13 | dark blue #0B43A8 14 | 15 | */ 16 | 17 | .small { 18 | font-size: 11px; 19 | font-style: normal; 20 | font-weight: normal; 21 | text-transform: normal; 22 | letter-spacing: normal; 23 | line-height: 1.4em; 24 | } 25 | 26 | .gray { 27 | color:#999999; 28 | font-family: Georgia, serif; 29 | font-size: 13px; 30 | font-style: italic; 31 | font-weight: normal; 32 | text-transform: normal; 33 | letter-spacing: normal; 34 | line-height: 1.6em; 35 | } 36 | 37 | .hightlight { 38 | background-color: #ffff88; 39 | font-weight: bold; 40 | color: #36393d; 41 | } 42 | 43 | a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #36393d; } 44 | a { -moz-outline: none; } 45 | 46 | body { 47 | color: #222; 48 | background: #cfcfcf; 49 | font-family: helvetica, arial, sans-serif; 50 | } 51 | 52 | hr { 53 | background: #f0f0ee; 54 | color: #f0f0ee; 55 | } 56 | 57 | #header { 58 | background: #36393d; 59 | } 60 | 61 | #header h1 { 62 | padding: 15px 0; 63 | font-size: 28px; 64 | font-style: normal; 65 | font-weight: bold; 66 | text-transform: normal; 67 | letter-spacing: -1px; 68 | line-height: 1.2em; 69 | } 70 | 71 | #header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { 72 | color: #FFF; 73 | } 74 | 75 | #user-navigation { 76 | top: auto; 77 | bottom: 5px; 78 | right: 25px; 79 | } 80 | 81 | #user-navigation a.logout { 82 | background: #cc0000; 83 | padding: 1px 4px; 84 | -moz-border-radius: 4px; 85 | -webkit-border-radius: 3px; 86 | } 87 | 88 | #main .block .content { 89 | background: #FFF; 90 | padding-top: 1px; 91 | } 92 | 93 | #main .block .content h2 { 94 | margin-left: 15px; 95 | font-size: 22px; 96 | font-style: normal; 97 | font-weight: bold; 98 | text-transform: normal; 99 | letter-spacing: -1px; 100 | line-height: 1.2em; 101 | } 102 | 103 | #main .block .content p { 104 | font-size: 13px; 105 | font-style: normal; 106 | font-weight: normal; 107 | text-transform: normal; 108 | letter-spacing: normal; 109 | line-height: 1.45em; 110 | } 111 | 112 | #sidebar .block { 113 | background: #FFF; 114 | } 115 | 116 | #sidebar .block h4 { 117 | font-weight: bold; 118 | } 119 | 120 | #sidebar .notice { 121 | background: #E6EEFC; 122 | } 123 | 124 | #sidebar .notice h4 { 125 | color: #0B43A8; 126 | } 127 | 128 | #sidebar h3 { 129 | background: #36393d; 130 | color: #FFF; 131 | border-bottom: 5px solid #1a1a1a; 132 | } 133 | 134 | #main-navigation ul li { 135 | padding-left: 15px; 136 | } 137 | 138 | #main-navigation ul li a { 139 | padding: 8px 0; 140 | } 141 | 142 | #main-navigation ul li.active { 143 | padding: 0; 144 | margin-left: 15px; 145 | } 146 | 147 | #main-navigation ul li.active { 148 | margin-left: 15px; 149 | } 150 | 151 | #main-navigation ul li.active a { 152 | padding: 8px 15px; 153 | } 154 | 155 | #sidebar ul li a:link, #sidebar ul li a:visited { 156 | background: #FFF; 157 | border-bottom: 1px solid #F0F0EE; 158 | text-decoration: none; 159 | } 160 | 161 | #sidebar ul li a:hover, #sidebar ul li a:active { 162 | background: #666666; 163 | color: #ffffff;; 164 | } 165 | 166 | #main-navigation { 167 | background: #1a1a1a; 168 | } 169 | 170 | #main-navigation ul li { 171 | background: #1a1a1a; 172 | margin-right: 0; 173 | } 174 | 175 | #main-navigation ul li.active { 176 | background: #f0f0ee; 177 | } 178 | 179 | #main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, 180 | .secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, 181 | #user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { 182 | text-decoration: none; 183 | color: #FFF; 184 | } 185 | 186 | .secondary-navigation li a:hover { 187 | background: #666666; 188 | } 189 | 190 | #main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { 191 | color: #1a1a1a; 192 | } 193 | 194 | .secondary-navigation { 195 | background: #36393d; 196 | border-bottom-color: #1a1a1a; 197 | } 198 | 199 | .secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover { 200 | background-color: #1a1a1a; 201 | } 202 | 203 | #footer .block { 204 | color: #FFF; 205 | background: #1a1a1a; 206 | } 207 | 208 | #footer .block p { 209 | margin: 0; 210 | padding: 10px; 211 | } 212 | 213 | /* pagination */ 214 | 215 | .pagination a, .pagination span { 216 | background: #cfcfcf; 217 | -moz-border-radius: 3px; 218 | border: 1px solid #c1c1c1; 219 | } 220 | 221 | .pagination em { 222 | background: #36393d; 223 | color: #FFF; 224 | border: 1px solid #36393d; 225 | } 226 | 227 | .pagination a { 228 | color: #1a1a1a; 229 | } 230 | 231 | .pagination a:hover { 232 | border: 1px solid #666; 233 | } 234 | 235 | /* tables */ 236 | 237 | .table th { 238 | background: #36393d; 239 | color: #FFF; 240 | } 241 | 242 | .table td { 243 | border-bottom:1px solid #F0F0EE; 244 | } 245 | 246 | .table tr.even { 247 | background: #ebebeb; 248 | } 249 | 250 | /* forms */ 251 | 252 | .form label.label { 253 | color: #666666; 254 | } 255 | 256 | .form input.text_field, .form textarea.text_area { 257 | width: 100%; 258 | border: 1px solid #cfcfcf; 259 | } 260 | 261 | .form input.button { 262 | background: #cfcfcf; 263 | -moz-border-radius: 5px; 264 | border: 1px solid #c1c1c1; 265 | padding: 2px 5px; 266 | cursor: pointer; 267 | color: #36393d; 268 | font-weight: bold; 269 | font-size: 11px; 270 | } 271 | 272 | .form input.button:hover { 273 | border: 1px solid #666; 274 | } 275 | 276 | .form .description { 277 | font-style: italic; 278 | color: #8C8C8C; 279 | font-size: .9em; 280 | } 281 | 282 | .form .navform a { 283 | color: #cc0000; 284 | } 285 | 286 | /* flash-messages */ 287 | .flash .message { 288 | -moz-border-radius: 3px; 289 | -webkit-border-radius: 3px; 290 | text-align:center; 291 | margin: 0 auto 15px; 292 | 293 | } 294 | 295 | .flash .message p { 296 | margin:8px; 297 | } 298 | .flash .error { 299 | border: 1px solid #fbb; 300 | background-color: #fdd; 301 | } 302 | .flash .warning { 303 | border: 1px solid #fffaaa; 304 | background-color: #ffffcc; 305 | } 306 | .flash .notice { 307 | border: 1px solid #1FDF00; 308 | background-color: #BBFFB6; 309 | } 310 | 311 | /* lists */ 312 | 313 | ul.list li { 314 | border-bottom-color: #F0F0EE; 315 | border-bottom-width: 1px; 316 | border-bottom-style: solid; 317 | } 318 | 319 | ul.list li .item .avatar { 320 | border-color: #F0F0EE; 321 | border-width: 1px; 322 | border-style: solid; 323 | padding: 2px; 324 | } 325 | 326 | /* box */ 327 | 328 | #box .block { 329 | background: #FFF; 330 | } 331 | 332 | #box .block h2 { 333 | background: #36393d; 334 | color: #FFF; 335 | } 336 | 337 | 338 | /* rounded borders */ 339 | 340 | #main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li, 341 | #footer .block, .form input.button, #box .block, #box .block h2 { 342 | -moz-border-radius-topleft: 4px; 343 | -webkit-border-top-left-radius: 4px; 344 | -moz-border-radius-topright: 4px; 345 | -webkit-border-top-right-radius: 4px; 346 | } 347 | 348 | .secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first { 349 | -moz-border-radius-topleft: 4px; 350 | -webkit-border-top-left-radius: 4px; 351 | } 352 | 353 | .table th.last { 354 | -moz-border-radius-topright: 4px; 355 | -webkit-border-top-right-radius: 4px; 356 | } 357 | 358 | .secondary-navigation ul li.first { 359 | -moz-border-radius-topleft: 4px; 360 | -webkit-border-top-left-radius: 4px; 361 | } 362 | 363 | #sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block { 364 | -moz-border-radius-bottomleft: 4px; 365 | -webkit-border-bottom-left-radius: 4px; 366 | -moz-border-radius-bottomright: 4px; 367 | -webkit-border-bottom-right-radius: 4px; 368 | } 369 | 370 | .secondary-navigation { 371 | border-bottom-width: 5px; 372 | } 373 | 374 | -------------------------------------------------------------------------------- /library/myGengo/Api/Jobs.php: -------------------------------------------------------------------------------- 1 | $jobs, 43 | 'as_group' => ($as_group)? 1 : 0, 44 | 'process' => 1); 45 | 46 | // create the query 47 | $params = array('api_key' => $this->config->get('api_key', null, true), '_method' => 'post', 48 | 'ts' => gmdate('U'), 49 | 'data' => json_encode($data)); 50 | // sort and sign 51 | ksort($params); 52 | $enc_params = json_encode($params); 53 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 54 | 55 | $format = $this->config->get('format', null, true); 56 | $baseurl = $this->config->get('baseurl', null, true); 57 | $baseurl .= 'translate/jobs'; 58 | $this->response = $this->client->post($baseurl, $format, $params); 59 | } 60 | 61 | /** 62 | * translate/jobs (GET) 63 | * 64 | * Retrieves a list of resources for the most recent jobs filtered 65 | * by the given parameters. 66 | * 67 | * @param string $format The response format, xml or json 68 | * @param array|string $params If passed should contain all the 69 | * necessary parameters for the request including the api_key and 70 | * api_sig 71 | */ 72 | public function getJobs($ids = null, $format = null, $params = null) 73 | { 74 | $this->setParamsNotId($format, $params); 75 | $baseurl = $this->config->get('baseurl', null, true); 76 | $baseurl .= 'translate/jobs'; 77 | if (!is_null($ids)) 78 | { 79 | $baseurl .= '/' . implode(',', $ids); 80 | } 81 | 82 | $this->response = $this->client->get($baseurl, $format, $params); 83 | } 84 | 85 | /** 86 | * translate/jobs/{id} (GET) 87 | * 88 | * Retrieves the group of jobs that were previously submitted 89 | * together. 90 | * 91 | * @param int $id The id of the job group to retrieve 92 | * @param string $format The response format, xml or json 93 | * @param array|string $params If passed should contain all the 94 | * necessary parameters for the request including the api_key and 95 | * api_sig 96 | */ 97 | public function getGroupedJobs($id = null, $format = null, $params = null) 98 | { 99 | $this->setParams($id, $format, $params); 100 | $baseurl = $this->config->get('baseurl', null, true); 101 | $baseurl .= "translate/jobs/group/{$id}"; 102 | $this->response = $this->client->get($baseurl, $format, $params); 103 | } 104 | 105 | /** 106 | * translate/jobs (PUT) 107 | * 108 | * Updates jobs to translate. returns these jobs back to the translators for revisions. 109 | * 110 | * @param array|array|string $jobs (required) the payloads to identify the jobs sent back for revisions: 111 | * - "comment" (required) the reason to the translator for sending the job back for revisions. 112 | * AND 113 | * One of the following format for job identification (note: all jobs must have the same format): 114 | * - "job_id" the job's id 115 | OR 116 | * - "body_src", the original body of text to be translated, 117 | * - "lc_src", the source language code, 118 | * - "lc_tgt", the target language code. 119 | * 120 | */ 121 | public function revise($jobs) 122 | { 123 | // pack the jobs 124 | $data = array('action' => 'revise'); 125 | $first_job = current($jobs); 126 | if (isset($first_job['job_id'])) 127 | { 128 | $data['job_ids'] = $jobs; 129 | } 130 | else 131 | $data['jobs'] = $jobs; 132 | 133 | // create the query 134 | $params = array('api_key' => $this->config->get('api_key', null, true), 135 | 'ts' => gmdate('U'), 136 | 'data' => json_encode($data)); 137 | // sort and sign 138 | ksort($params); 139 | $enc_params = json_encode($params); 140 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 141 | 142 | $format = $this->config->get('format', null, true); 143 | $this->setParamsNotId($format, $params); 144 | $baseurl = $this->config->get('baseurl', null, true); 145 | $baseurl .= "translate/jobs"; 146 | $this->response = $this->client->put($baseurl, $format, $params); 147 | } 148 | 149 | /** 150 | * translate/jobs (PUT) 151 | * 152 | * Updates jobs to translate. Approves jobs. 153 | * 154 | * @param array|array|string $jobs (required) the payloads to identify the jobs sent back for revisions: 155 | * - "rating" (optional) the reason to the translator for sending the job back for revisions. 156 | * - "for_translator" (optional) - comments for the translator 157 | * - "for_mygengo" (optional) - comments for myGengo staff (private) 158 | * - "public" (optional) - 1 (true) / 0 (false, default); whether myGengo can share this feedback publicly 159 | * AND 160 | * One of the following format for job identification (note: all jobs must have the same format): 161 | * - "job_id" the job's id 162 | OR 163 | * - "body_src", the original body of text to be translated, 164 | * - "lc_src", the source language code, 165 | * - "lc_tgt", the target language code. 166 | * 167 | */ 168 | public function approve($jobs) 169 | { 170 | $data = array('action' => 'approve'); 171 | $first_job = current($jobs); 172 | if (isset($first_job['job_id'])) 173 | { 174 | $data['job_ids'] = $jobs; 175 | } 176 | else 177 | { 178 | $data['jobs'] = $jobs; 179 | } 180 | 181 | // create the query 182 | $params = array('api_key' => $this->config->get('api_key', null, true), 183 | 'ts' => gmdate('U'), 184 | 'data' => json_encode($data)); 185 | // sort and sign 186 | ksort($params); 187 | $enc_params = json_encode($params); 188 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 189 | 190 | $format = $this->config->get('format', null, true); 191 | $this->setParamsNotId($format, $params); 192 | $baseurl = $this->config->get('baseurl', null, true); 193 | $baseurl .= "translate/jobs"; 194 | $this->response = $this->client->put($baseurl, $format, $params); 195 | } 196 | 197 | /** 198 | * translate/jobs (PUT) 199 | * 200 | * Updates jobs to translate. returns these jobs back to the translators for revisions. 201 | * 202 | * @param array|array|string $jobs (required) the payloads to identify the jobs sent back for revisions: 203 | * - reason (required) - "quality", "incomplete", "other" 204 | * - comment (required) 205 | * - captcha (required) - the captcha image text. Each job in a "reviewable" state will 206 | * - have a captcha_url value, which is a URL to an image. This 207 | * - captcha value is required only if a job is to be rejected. 208 | * - follow_up (optional) - "requeue" (default) or "cancel" 209 | * AND 210 | * One of the following format for job identification (note: all jobs must have the same format): 211 | * - "job_id" the job's id 212 | OR 213 | * - "body_src", the original body of text to be translated, 214 | * - "lc_src", the source language code, 215 | * - "lc_tgt", the target language code. 216 | * 217 | */ 218 | public function reject($jobs) 219 | { 220 | $data = array('action' => 'reject'); 221 | $first_job = current($jobs); 222 | if (isset($first_job['job_id'])) 223 | { 224 | $data['job_ids'] = $jobs; 225 | } 226 | else 227 | $data['jobs'] = $jobs; 228 | 229 | // create the query 230 | $params = array('api_key' => $this->config->get('api_key', null, true), 231 | 'ts' => gmdate('U'), 232 | 'data' => json_encode($data)); 233 | // sort and sign 234 | ksort($params); 235 | $enc_params = json_encode($params); 236 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 237 | 238 | $format = $this->config->get('format', null, true); 239 | $this->setParamsNotId($format, $params); 240 | $baseurl = $this->config->get('baseurl', null, true); 241 | $baseurl .= "translate/jobs"; 242 | $this->response = $this->client->put($baseurl, $format, $params); 243 | } 244 | 245 | /** 246 | * translate/job/{id} (DELETE) 247 | * 248 | * Cancels the jobs. You can only cancel a job if it has not been 249 | * started already by a translator. 250 | * 251 | * @param array|int (required) $ids Array of ids of the jobs to cancel 252 | */ 253 | public function cancel($ids) 254 | { 255 | $data = array('job_ids' => $ids); 256 | $params = array('api_key' => $this->config->get('api_key', null, true), 'ts' => gmdate('U'), 'data'=> json_encode($data)); 257 | ksort($params); 258 | $query = http_build_query($params); 259 | $hmac = hash_hmac('sha1', $query, $this->config->get('private_key', null, true)); 260 | $params['api_sig'] = $hmac; 261 | 262 | $format = $this->config->get('format', null, true); 263 | $this->setParamsNotId($format, $params); 264 | $baseurl = $this->config->get('baseurl', null, true); 265 | $baseurl .= "translate/jobs"; 266 | $this->response = $this->client->delete($baseurl, $format, $params); 267 | } 268 | } 269 | -------------------------------------------------------------------------------- /library/myGengo/Api/Job.php: -------------------------------------------------------------------------------- 1 | setParams($id, $format, $params); 42 | $baseurl = $this->config->get('baseurl', null, true); 43 | $baseurl .= "translate/job/{$id}"; 44 | $this->response = $this->client->get($baseurl, $format, $params); 45 | } 46 | 47 | /** 48 | * translate/job/{id}/comments (GET) 49 | * 50 | * Retrieves the comment thread for a job 51 | * 52 | * @param int $id The id of the job to retrieve 53 | * @param string $format The response format, xml or json 54 | * @param array|string $params If passed should contain all the 55 | * necessary parameters for the request including the api_key and 56 | * api_sig 57 | */ 58 | public function getComments($id = null, $format = null, $params = null) 59 | { 60 | $this->setParams($id, $format, $params); 61 | $baseurl = $this->config->get('baseurl', null, true); 62 | $baseurl .= "translate/job/{$id}/comments"; 63 | $this->response = $this->client->get($baseurl, $format, $params); 64 | } 65 | 66 | /** 67 | * translate/job/{id}/feedback (GET) 68 | * 69 | * Retrieves the feedback 70 | * 71 | * @param int $id The id of the job to retrieve 72 | * @param string $format The response format, xml or json 73 | * @param array|string $params If passed should contain all the 74 | * necessary parameters for the request including the api_key and 75 | * api_sig 76 | */ 77 | public function getFeedback($id = null, $format = null, $params = null) 78 | { 79 | $this->setParams($id, $format, $params); 80 | $baseurl = $this->config->get('baseurl', null, true); 81 | $baseurl .= "translate/job/{$id}/feedback"; 82 | $this->response = $this->client->get($baseurl, $format, $params); 83 | } 84 | 85 | /** 86 | * translate/job/{id}/revisions (GET) 87 | * 88 | * Gets list of revision resources for a job. 89 | * 90 | * @param int $id The id of the job to retrieve 91 | * @param string $format The response format, xml or json 92 | * @param array|string $params If passed should contain all the 93 | * necessary parameters for the request including the api_key and 94 | * api_sig 95 | */ 96 | public function getRevisions($id = null, $format = null, $params = null) 97 | { 98 | $this->setParams($id, $format, $params); 99 | $baseurl = $this->config->get('baseurl', null, true); 100 | $baseurl .= "translate/job/{$id}/revisions"; 101 | $this->response = $this->client->get($baseurl, $format, $params); 102 | } 103 | 104 | /** 105 | * translate/job/{id}/revision/{rev_id} 106 | * 107 | * Gets specific revision for a job. 108 | * 109 | * @param int $id The id of the job to retrieve 110 | * @param int $rev_id The id of the revision to retrieve 111 | * @param string $format The response format, xml or json 112 | * @param array|string $params If passed should contain all the 113 | * necessary parameters for the request including the api_key and 114 | * api_sig 115 | */ 116 | public function getRevision($id = null, $rev_id = null, $format = null, $params = null) 117 | { 118 | $this->setParams($id, $format, $params); 119 | if (is_null($rev_id)) 120 | { 121 | $rev_id = $this->config->get('rev_id', null, true); 122 | } 123 | $baseurl = $this->config->get('baseurl', null, true); 124 | $baseurl .= "translate/job/{$id}/revision/{$rev_id}"; 125 | $this->response = $this->client->get($baseurl, $format, $params); 126 | } 127 | 128 | /** 129 | * translate/job/{id} (PUT) 130 | * 131 | * Updates a job to translate. returns this job back to the translator for revisions. 132 | * 133 | * @param int $id The id of the job to revise 134 | * @param string $comment (required) the reason to the translator for sending the job back for revisions. 135 | */ 136 | public function revise($id, $comment) 137 | { 138 | if (!(empty($id) || empty($comment))) 139 | { 140 | // pack the jobs 141 | $data = array('action' => 'revise', 'comment' => $comment); 142 | 143 | // create the query 144 | $params = array('api_key' => $this->config->get('api_key', null, true), 145 | 'ts' => gmdate('U'), 146 | 'data' => json_encode($data)); 147 | // sort and sign 148 | ksort($params); 149 | $enc_params = json_encode($params); 150 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 151 | } 152 | else 153 | { 154 | throw new myGengo_Exception( 155 | sprintf('In method %s: "id" and "comment" are required', __METHOD__) 156 | ); 157 | } 158 | 159 | $format = $this->config->get('format', null, true); 160 | $this->setParams($id, $format, $params); 161 | $baseurl = $this->config->get('baseurl', null, true); 162 | $baseurl .= "translate/job/{$id}"; 163 | $this->response = $this->client->put($baseurl, $format, $params); 164 | } 165 | 166 | /** 167 | * translate/job/{id} (PUT) 168 | * 169 | * Updates a job to translate. Approves job. 170 | * 171 | * @param int $id The id of the job to approve 172 | * @param array|string $args contains the parameters for the approval: 173 | * rating (required) - 1 (poor) to 5 (fantastic) 174 | * for_translator (optional) - comments for the translator 175 | * for_mygengo (optional) - comments for myGengo staff (private) 176 | * public (optional) - 1 (true) / 0 (false, default); whether myGengo can share this feedback publicly 177 | */ 178 | public function approve($id, $args) 179 | { 180 | if (!is_null($id)) 181 | { 182 | if (isset($args['rating']) && !(is_numeric($args['rating']) && $args['rating'] >= 1 && $args['rating'] <= 5)) { 183 | throw new myGengo_Exception( 184 | sprintf('In method %s: "params" must contain a valid rating', __METHOD__) 185 | ); 186 | } 187 | 188 | // pack the jobs 189 | $data = array('action' => 'approve', 'public' => (isset($args['public']) && !empty($public))? 1 : 0); 190 | if (!is_null($args['rating'])) 191 | { 192 | $data['rating'] = $args['rating']; 193 | } 194 | if (!is_null($args['for_translator'])) 195 | { 196 | $data['for_translator'] = $args['for_translator']; 197 | } 198 | if (!is_null($args['for_mygengo'])) 199 | { 200 | $data['for_mygengo'] = $args['for_mygengo']; 201 | } 202 | 203 | // create the query 204 | $params = array('api_key' => $this->config->get('api_key', null, true), 205 | 'ts' => gmdate('U'), 206 | 'data' => json_encode($data)); 207 | // sort and sign 208 | ksort($params); 209 | $enc_params = json_encode($params); 210 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 211 | } 212 | else 213 | { 214 | throw new myGengo_Exception( 215 | sprintf('In method %s: "id" is required.', __METHOD__) 216 | ); 217 | } 218 | 219 | $format = $this->config->get('format', null, true); 220 | $this->setParams($id, $format, $params); 221 | $baseurl = $this->config->get('baseurl', null, true); 222 | $baseurl .= "translate/job/{$id}"; 223 | $this->response = $this->client->put($baseurl, $format, $params); 224 | } 225 | 226 | /** 227 | * translate/job/{id} (PUT) 228 | * 229 | * Updates a job to translate. rejects the translation 230 | * 231 | * @param int $id The id of the job to reject 232 | * @param string $format The response format, xml or json 233 | * @param array|string $args contains the parameters for the rejection: 234 | * reason (required) - "quality", "incomplete", "other" 235 | * comment (required) 236 | * captcha (required) - the captcha image text. Each job in a "reviewable" state will 237 | * have a captcha_url value, which is a URL to an image. This 238 | * captcha value is required only if a job is to be rejected. 239 | * follow_up (optional) - "requeue" (default) or "cancel" 240 | */ 241 | public function reject($id, $args) 242 | { 243 | if (!empty($id) && isset($args['reason']) && isset($args['comment']) && isset($args['captcha'])) 244 | { 245 | $reason = $args['reason']; 246 | $comment = $args['comment']; 247 | $captcha = $args['captcha']; 248 | 249 | $valid_reasons = array("quality", "incomplete", "other"); 250 | if (!in_array($reason, $valid_reasons)) 251 | { 252 | throw new myGengo_Exception( 253 | sprintf('In method %s: "params" must contain a valid reason', __METHOD__) 254 | ); 255 | } 256 | // pack the jobs 257 | $data = array('action' => 'reject', 'reason' => $reason, 'comment' => $comment, 'captcha' => $captcha); 258 | 259 | $valid_follow_ups = array("requeue", "cancel"); 260 | if (isset($args['follow_up'])) 261 | { 262 | if (!in_array($args['follow_up'], $valid_follow_ups)) 263 | { 264 | throw new myGengo_Exception( 265 | sprintf('In method %s: if set, "params" must contain a valid follow up', __METHOD__) 266 | ); 267 | } 268 | $data['follow_up'] = $args['follow_up']; 269 | } 270 | 271 | // create the query 272 | $params = array('api_key' => $this->config->get('api_key', null, true), 273 | 'ts' => gmdate('U'), 274 | 'data' => json_encode($data)); 275 | // sort and sign 276 | ksort($params); 277 | $enc_params = json_encode($params); 278 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 279 | } 280 | else 281 | { 282 | throw new myGengo_Exception( 283 | sprintf('In method %s: "id" is required and "args" must contain a reason, a comment and a captcha', __METHOD__) 284 | ); 285 | } 286 | 287 | $format = $this->config->get('format', null, true); 288 | $this->setParams($id, $format, $params); 289 | $baseurl = $this->config->get('baseurl', null, true); 290 | $baseurl .= "translate/job/{$id}"; 291 | $this->response = $this->client->put($baseurl, $format, $params); 292 | } 293 | 294 | /** 295 | * translate/job 296 | * 297 | * Post a new job for translation 298 | * 299 | * @param array|string a job payload. 300 | * @param string $format The response format, xml or json 301 | * @param array|string $params Should contain all the 302 | * necessary parameters for the request including the api_key and 303 | * api_sig 304 | */ 305 | public function postJob($job, $format = null, $params = null) 306 | { 307 | // XXX: there is no check that $job is a valid payload. 308 | if (!is_null($job)) // If $job is not null, I override $params. 309 | { 310 | // pack the jobs 311 | $data = array('job' => $job); 312 | 313 | // create the query 314 | $params = array('api_key' => $this->config->get('api_key', null, true), '_method' => 'post', 315 | 'ts' => gmdate('U'), 316 | 'data' => json_encode($data)); 317 | // sort and sign 318 | ksort($params); 319 | $enc_params = json_encode($params); 320 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 321 | } 322 | 323 | $baseurl = $this->config->get('baseurl', null, true); 324 | $baseurl .= 'translate/job'; 325 | if (is_null($format)) 326 | { 327 | $format = $this->config->get('format', null, true); 328 | } 329 | $this->response = $this->client->post($baseurl, $format, $params); 330 | } 331 | 332 | /** 333 | * translate/job/{id}/comment (POST) 334 | * 335 | * Submits a new comment to the job's comment thread. 336 | * 337 | * @param int $id The id of the job to comment on 338 | * @param string $body The comment's actual contents. 339 | * @param string $format The response format, xml or json 340 | * @param array|string $params If passed should contain all the 341 | * necessary parameters for the request including the api_key and 342 | * api_sig 343 | */ 344 | public function postComment($id = null, $body = null, $format = null, $params = null) 345 | { 346 | if (!(is_null($id) || is_null($body))) // If nor the id or the body are null, we override params. 347 | { 348 | // pack the jobs 349 | $data = array('body' => $body); 350 | 351 | // create the query 352 | $params = array('api_key' => $this->config->get('api_key', null, true), '_method' => 'post', 353 | 'ts' => gmdate('U'), 354 | 'data' => json_encode($data)); 355 | // sort and sign 356 | ksort($params); 357 | $enc_params = json_encode($params); 358 | $params['api_sig'] = myGengo_Crypto::sign($enc_params, $this->config->get('private_key', null, true)); 359 | } 360 | 361 | if (empty($params)) { 362 | throw new myGengo_Exception( 363 | sprintf('In method %s: "params" must contain a valid "body" parameter as the comment', __METHOD__) 364 | ); 365 | } 366 | $this->setParams($id, $format, $params); 367 | $baseurl = $this->config->get('baseurl', null, true); 368 | $baseurl .= "translate/job/{$id}/comment"; 369 | $this->response = $this->client->post($baseurl, $format, $params); 370 | } 371 | 372 | /** 373 | * translate/job/{id} (DELETE) 374 | * 375 | * Cancels the job. You can only cancel a job if it has not been 376 | * started already by a translator. 377 | * 378 | * @param int $id The id of the job to cancel 379 | * @param string $format The response format, xml or json 380 | * @param array|string $params If passed should contain all the 381 | * necessary parameters for the request including the api_key and 382 | * api_sig 383 | */ 384 | public function cancel($id, $format = null, $params = null) 385 | { 386 | $this->setParams($id, $format, $params); 387 | $baseurl = $this->config->get('baseurl', null, true); 388 | $baseurl .= "translate/job/{$id}"; 389 | $this->response = $this->client->delete($baseurl, $format, $params); 390 | } 391 | 392 | /** 393 | * translate/job/{id}/preview (GET) 394 | * 395 | * Renders a JPEG preview of the translated text 396 | * N.B. - if the request is valid, a raw JPEG stream is returned. 397 | * 398 | * @param int $id The id of the job, if not passed it should be in config 399 | * @param string $format The response format, xml or json (in case of error) 400 | * @param array|string $params If passed should contain all the 401 | * necessary parameters for the request including the api_key and 402 | * api_sig 403 | */ 404 | public function previewJob($id = null, $format = null, $params = null) 405 | { 406 | $this->setParams($id, $format, $params); 407 | $baseurl = $this->config->get('baseurl', null, true); 408 | $baseurl .= "translate/job/{$id}/preview"; 409 | $this->response = $this->client->get($baseurl, $format, $params); 410 | } 411 | } 412 | 413 | -------------------------------------------------------------------------------- /library/public/javascripts/jquery.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery JavaScript Library v1.4.2 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: Sat Feb 13 22:33:48 2010 -0500 15 | */ 16 | (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(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 X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, 21 | Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& 22 | (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, 23 | a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== 24 | "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, 25 | function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; 34 | var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, 35 | parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= 36 | false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= 37 | s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, 38 | applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; 39 | else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, 40 | a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== 41 | w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, 42 | cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= 47 | c.inArray(c(this).val(),u)>=0});if(!u.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},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); 48 | a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, 49 | function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); 50 | k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), 51 | C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= 53 | e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& 54 | f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; 55 | if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", 63 | e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.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 fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, 64 | "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, 65 | d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 71 | e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); 72 | t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| 73 | g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, 80 | CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, 81 | g);return false}else if(n.match.POS.test(g[0])||n.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===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,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, 82 | 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"===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)}}, 83 | setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= 84 | h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== 86 | "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, 87 | h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& 90 | q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; 91 | if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); 92 | (function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: 93 | function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= 96 | {},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== 97 | "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){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},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", 98 | d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,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")? 99 | a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== 100 | 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===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 Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= 102 | c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).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}, 103 | 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)})}, 104 | 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, 105 | 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,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}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); 106 | return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, 107 | ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); 111 | return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", 112 | ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= 113 | c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? 114 | c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= 115 | function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= 116 | Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, 117 | "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= 118 | a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= 119 | a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== 120 | "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, 121 | 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&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), 122 | function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},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,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, 123 | global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& 124 | e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? 125 | "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== 126 | false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= 127 | false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", 128 | c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| 129 | d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); 130 | g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== 131 | 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== 132 | "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; 133 | if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== 139 | "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+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]|| 140 | c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; 141 | this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},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;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= 142 | this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, 143 | e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,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=c.timers,b=0;b
"; 149 | a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); 150 | c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, 151 | d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- 152 | f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&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(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": 153 | "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in 154 | e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); 155 | --------------------------------------------------------------------------------