From 84abeaf492bb9906eed76dd37fd72506eea6ce46 Mon Sep 17 00:00:00 2001 From: oliver Date: Thu, 30 Apr 2015 17:54:20 +0200 Subject: [PATCH] implement editor for questtype ?Drag&Drop? --- configs/AppConfig.inc | 12 +- locale/de_DE/LC_MESSAGES/The Legend of Z.mo | Bin 25930 -> 26385 bytes locale/de_DE/LC_MESSAGES/The Legend of Z.po | 231 ++++++++----- models/MediaModel.inc | 27 +- .../DragndropQuesttypeController.inc | 319 +++++++++++++++++- .../dragndrop/DragndropQuesttypeModel.inc | 224 +++++++++++- questtypes/dragndrop/html/edittask.tpl | 255 +++++++++++++- www/css/desktop.css | 10 +- www/js/jquery-ui.min.js | 7 + 9 files changed, 981 insertions(+), 104 deletions(-) create mode 100644 www/js/jquery-ui.min.js diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc index 9c992234..da8a97b9 100644 --- a/configs/AppConfig.inc +++ b/configs/AppConfig.inc @@ -135,7 +135,17 @@ 'mimetype' => 'image/jpeg', 'size' => 1048576 ) - ) + ), + 'questtypes' => array( + array( + 'mimetype' => 'image/jpeg', + 'size' => 524288 + ), + array( + 'mimetype' => 'image/png', + 'size' => 1048576 + ) + ) ); diff --git a/locale/de_DE/LC_MESSAGES/The Legend of Z.mo b/locale/de_DE/LC_MESSAGES/The Legend of Z.mo index 0c8ddb6842a847821fb3b2181ce6a1a7a6e9d5af..6d7cf4146d328011e86597b8a02c07e3ae59fd85 100644 GIT binary patch delta 8935 zcmZwM30zfm-pBES$l?MhDjFzW0Yz2;QN%sP6mSLC)R0YJx-4?RF;g$Lm^x`D){~~r zlUj|II!5)FV@+lDq^T_~jcKNhlkL)!X=={%`QG!tO|N-9=k@ye{%_~Mo^vkE96s#x z=rJGnxzLu6SzIf9EUPOz+get)7M8WYi%KmkrH5q&Vk)-6fhM1Yk>tmjyc64yug54{ ziVoa{>h~Z<;AhwwZ()LExvel-Gp02HgK+|Cpu3Fa7)rht)zO2f_FGUB+l_v>7j^$@ zsP;#(Bc8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BFaC zMBbm6PGnNPjyOPcqudQku|3{HC_Uif45$9zmapfGWp3fwK!W6PV#qv3E`WGfRiu3P zp{yKANfH<5wU|%+DuF&{zdd9`Vc9!?TF`ywL}BToiLVA`j3m#)r&h2YK7_O zL&LAEyZ{$c4ku!)ZUbH>b`xI{encalcgAZ8r8|i()G7T=Tp(IezLRKS^*7-xVw~>4 z?P^KNBi0aYtoBi55wN+n-{{fSWWLx?Tp zM__C9kVU3GZ6#Acw6i*2@+a-#1RO>zB_BK0)i_TBrF(R0JXQDo3 z{w=S%iXAb&6)R$WJ=gJIH5ILhJ$gcFP2CF^MdYi3U@YXgwizX zp2jzcVb-n}o}#SOk^EjfO#I6KnVObxe^BLn?N$Uqtb)-xlt(r<8LNM-uyul*|GCL~sl Wny}NSGO^@SpNg=_?J5c;ANU_cZEQ^d diff --git a/locale/de_DE/LC_MESSAGES/The Legend of Z.po b/locale/de_DE/LC_MESSAGES/The Legend of Z.po index 96ddc4a2..0e9da04f 100644 --- a/locale/de_DE/LC_MESSAGES/The Legend of Z.po +++ b/locale/de_DE/LC_MESSAGES/The Legend of Z.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: The Legend of Z\n" -"POT-Creation-Date: 2015-04-19 14:15+0100\n" -"PO-Revision-Date: 2015-04-20 21:06+0100\n" +"POT-Creation-Date: 2015-04-30 18:44+0100\n" +"PO-Revision-Date: 2015-04-30 18:45+0100\n" "Last-Translator: \n" "Language-Team: \n" "Language: de_DE\n" @@ -18,31 +18,31 @@ msgstr "" "X-Poedit-SearchPath-2: controllers\n" #: controllers/CharactersController.inc:402 -#: controllers/UsersController.inc:333 views/ajax/characters/index.tpl:10 +#: controllers/UsersController.inc:339 views/ajax/characters/index.tpl:10 #: views/ajax/users/index.tpl:10 views/html/characters/index.tpl:48 #: views/html/characters/manage.tpl:35 views/html/characters/manage.tpl:50 #: views/html/characters/manage.tpl:58 views/html/userroles/user.tpl:5 -#: views/html/users/index.tpl:29 views/html/users/manage.tpl:28 +#: views/html/users/index.tpl:33 views/html/users/manage.tpl:28 #: views/html/users/manage.tpl:41 views/html/users/manage.tpl:49 msgid "Admin" msgstr "Administrator" #: controllers/CharactersController.inc:408 -#: controllers/UsersController.inc:339 views/ajax/characters/index.tpl:12 +#: controllers/UsersController.inc:345 views/ajax/characters/index.tpl:12 #: views/ajax/users/index.tpl:12 views/html/characters/index.tpl:49 #: views/html/characters/manage.tpl:36 views/html/characters/manage.tpl:51 #: views/html/characters/manage.tpl:59 views/html/userroles/user.tpl:7 -#: views/html/users/index.tpl:30 views/html/users/manage.tpl:29 +#: views/html/users/index.tpl:34 views/html/users/manage.tpl:29 #: views/html/users/manage.tpl:42 views/html/users/manage.tpl:50 msgid "Moderator" msgstr "Moderator" #: controllers/CharactersController.inc:414 -#: controllers/UsersController.inc:345 views/ajax/characters/index.tpl:14 +#: controllers/UsersController.inc:351 views/ajax/characters/index.tpl:14 #: views/ajax/users/index.tpl:14 views/html/characters/index.tpl:50 #: views/html/characters/manage.tpl:37 views/html/characters/manage.tpl:53 #: views/html/characters/manage.tpl:61 views/html/userroles/user.tpl:9 -#: views/html/users/index.tpl:31 views/html/users/manage.tpl:30 +#: views/html/users/index.tpl:35 views/html/users/manage.tpl:30 #: views/html/users/manage.tpl:44 views/html/users/manage.tpl:52 msgid "User" msgstr "Benutzer" @@ -101,6 +101,7 @@ msgstr "" #: questtypes/bossfight/html/edittask.tpl:17 #: questtypes/choiceinput/html/edittask.tpl:83 +#: questtypes/dragndrop/html/edittask.tpl:144 #: questtypes/multiplechoice/html/edittask.tpl:79 #: questtypes/textinput/html/edittask.tpl:44 #: views/html/achievements/conditions.tpl:151 @@ -190,6 +191,137 @@ msgstr "vertikal" msgid "horizontal" msgstr "horizontal" +#: questtypes/dragndrop/html/edittask.tpl:11 +#: questtypes/dragndrop/html/edittask.tpl:104 +#: questtypes/submit/html/quest.tpl:8 +#: views/html/charactergroupsquests/manage.tpl:37 +#, php-format +msgid "Error during file upload: %s" +msgstr "Fehler beim Dateiupload: %s" + +#: questtypes/dragndrop/html/edittask.tpl:13 +#: questtypes/dragndrop/html/edittask.tpl:106 +#: questtypes/submit/html/quest.tpl:4 +#: views/html/charactergroupsquests/manage.tpl:39 +#, php-format +msgid "File has wrong type “%s”" +msgstr "Der Dateityp „%s“ ist nicht erlaubt" + +#: questtypes/dragndrop/html/edittask.tpl:15 +#: questtypes/dragndrop/html/edittask.tpl:108 +#: questtypes/submit/html/quest.tpl:6 +#: views/html/charactergroupsquests/manage.tpl:41 +msgid "File exceeds size maximum" +msgstr "Die Datei ist zu groß" + +#: questtypes/dragndrop/html/edittask.tpl:17 +#: questtypes/dragndrop/html/edittask.tpl:110 +#: views/html/charactergroupsquests/manage.tpl:43 +msgid "File invalid" +msgstr "Die Datei ist ungültig" + +#: questtypes/dragndrop/html/edittask.tpl:31 +#, php-format +msgid "Step %d" +msgstr "Schritt %d" + +#: questtypes/dragndrop/html/edittask.tpl:31 +#: views/html/achievements/conditions.tpl:22 +#: views/html/achievements/conditions.tpl:31 +#: views/html/achievements/conditions.tpl:59 +#: views/html/achievements/conditions.tpl:89 +#: views/html/achievements/conditions.tpl:98 +#: views/html/achievements/conditions.tpl:126 +msgid "Field" +msgstr "Feld" + +#: questtypes/dragndrop/html/edittask.tpl:36 +msgid "Upload background image" +msgstr "Hintergrundbild hochladen" + +#: questtypes/dragndrop/html/edittask.tpl:38 +#: questtypes/dragndrop/html/edittask.tpl:136 +#: questtypes/submit/html/quest.tpl:17 views/html/achievements/create.tpl:66 +#: views/html/achievements/edit.tpl:68 +#: views/html/charactergroups/creategroup.tpl:64 +#: views/html/charactergroups/editgroup.tpl:65 +#: views/html/charactergroupsquests/create.tpl:66 +#: views/html/charactergroupsquests/edit.tpl:67 +#: views/html/charactergroupsquests/manage.tpl:72 +#: views/html/charactertypes/edit.tpl:135 views/html/questgroups/create.tpl:65 +#: views/html/questgroups/edit.tpl:53 views/html/quests/create.tpl:62 +#: views/html/quests/edit.tpl:65 views/html/seminaries/create.tpl:60 +#: views/html/seminaries/edit.tpl:62 +msgid "Allowed file types" +msgstr "Erlaubte Dateiformate" + +#: questtypes/dragndrop/html/edittask.tpl:41 +#: questtypes/dragndrop/html/edittask.tpl:139 +#: questtypes/submit/html/quest.tpl:20 views/html/achievements/create.tpl:69 +#: views/html/achievements/edit.tpl:71 +#: views/html/charactergroups/creategroup.tpl:67 +#: views/html/charactergroups/editgroup.tpl:68 +#: views/html/charactergroupsquests/create.tpl:69 +#: views/html/charactergroupsquests/edit.tpl:70 +#: views/html/charactergroupsquests/manage.tpl:72 +#: views/html/charactertypes/edit.tpl:138 views/html/questgroups/create.tpl:68 +#: views/html/questgroups/edit.tpl:56 views/html/quests/create.tpl:65 +#: views/html/quests/edit.tpl:68 views/html/seminaries/create.tpl:63 +#: views/html/seminaries/edit.tpl:65 +#, php-format +msgid "%s-files" +msgstr "%s-Dateien" + +#: questtypes/dragndrop/html/edittask.tpl:41 +#: questtypes/dragndrop/html/edittask.tpl:139 +#: questtypes/submit/html/quest.tpl:20 views/html/achievements/create.tpl:69 +#: views/html/achievements/edit.tpl:71 +#: views/html/charactergroups/creategroup.tpl:67 +#: views/html/charactergroups/editgroup.tpl:68 +#: views/html/charactergroupsquests/create.tpl:69 +#: views/html/charactergroupsquests/edit.tpl:70 +#: views/html/charactergroupsquests/manage.tpl:72 +#: views/html/charactertypes/edit.tpl:138 views/html/questgroups/create.tpl:68 +#: views/html/questgroups/edit.tpl:56 views/html/quests/create.tpl:65 +#: views/html/quests/edit.tpl:68 views/html/seminaries/create.tpl:63 +#: views/html/seminaries/edit.tpl:65 +msgid "max." +msgstr "max." + +#: questtypes/dragndrop/html/edittask.tpl:45 +#: questtypes/dragndrop/html/edittask.tpl:80 +msgid "next step" +msgstr "nächster Schritt" + +#: questtypes/dragndrop/html/edittask.tpl:48 +#: questtypes/dragndrop/html/edittask.tpl:83 +#, php-format +msgid "Step %d:" +msgstr "Schritt %d" + +#: questtypes/dragndrop/html/edittask.tpl:48 +msgid "Drop-items" +msgstr "Drop-Elemente" + +#: questtypes/dragndrop/html/edittask.tpl:63 +#: questtypes/dragndrop/html/edittask.tpl:184 +msgid "Size" +msgstr "Größe" + +#: questtypes/dragndrop/html/edittask.tpl:67 +#: questtypes/dragndrop/html/edittask.tpl:188 +msgid "Position" +msgstr "Position" + +#: questtypes/dragndrop/html/edittask.tpl:79 +#: questtypes/dragndrop/html/edittask.tpl:143 +msgid "previous step" +msgstr "vorheriger Schritt" + +#: questtypes/dragndrop/html/edittask.tpl:83 +msgid "Drag-items" +msgstr "Drag-Elemente" + #: questtypes/multiplechoice/html/edittask.tpl:12 #: questtypes/multiplechoice/html/edittask.tpl:44 #, php-format @@ -234,66 +366,6 @@ msgstr "Frage %d von %d" msgid "solve Question" msgstr "Frage lösen" -#: questtypes/submit/html/quest.tpl:4 -#: views/html/charactergroupsquests/manage.tpl:39 -#, php-format -msgid "File has wrong type “%s”" -msgstr "Der Dateityp „%s“ ist nicht erlaubt" - -#: questtypes/submit/html/quest.tpl:6 -#: views/html/charactergroupsquests/manage.tpl:41 -msgid "File exceeds size maximum" -msgstr "Die Datei ist zu groß" - -#: questtypes/submit/html/quest.tpl:8 -#: views/html/charactergroupsquests/manage.tpl:37 -#, php-format -msgid "Error during file upload: %s" -msgstr "Fehler beim Dateiupload: %s" - -#: questtypes/submit/html/quest.tpl:17 views/html/achievements/create.tpl:66 -#: views/html/achievements/edit.tpl:68 -#: views/html/charactergroups/creategroup.tpl:64 -#: views/html/charactergroups/editgroup.tpl:65 -#: views/html/charactergroupsquests/create.tpl:66 -#: views/html/charactergroupsquests/edit.tpl:67 -#: views/html/charactergroupsquests/manage.tpl:72 -#: views/html/charactertypes/edit.tpl:135 views/html/questgroups/create.tpl:65 -#: views/html/questgroups/edit.tpl:53 views/html/quests/create.tpl:62 -#: views/html/quests/edit.tpl:65 views/html/seminaries/create.tpl:60 -#: views/html/seminaries/edit.tpl:62 -msgid "Allowed file types" -msgstr "Erlaubte Dateiformate" - -#: questtypes/submit/html/quest.tpl:20 views/html/achievements/create.tpl:69 -#: views/html/achievements/edit.tpl:71 -#: views/html/charactergroups/creategroup.tpl:67 -#: views/html/charactergroups/editgroup.tpl:68 -#: views/html/charactergroupsquests/create.tpl:69 -#: views/html/charactergroupsquests/edit.tpl:70 -#: views/html/charactergroupsquests/manage.tpl:72 -#: views/html/charactertypes/edit.tpl:138 views/html/questgroups/create.tpl:68 -#: views/html/questgroups/edit.tpl:56 views/html/quests/create.tpl:65 -#: views/html/quests/edit.tpl:68 views/html/seminaries/create.tpl:63 -#: views/html/seminaries/edit.tpl:65 -#, php-format -msgid "%s-files" -msgstr "%s-Dateien" - -#: questtypes/submit/html/quest.tpl:20 views/html/achievements/create.tpl:69 -#: views/html/achievements/edit.tpl:71 -#: views/html/charactergroups/creategroup.tpl:67 -#: views/html/charactergroups/editgroup.tpl:68 -#: views/html/charactergroupsquests/create.tpl:69 -#: views/html/charactergroupsquests/edit.tpl:70 -#: views/html/charactergroupsquests/manage.tpl:72 -#: views/html/charactertypes/edit.tpl:138 views/html/questgroups/create.tpl:68 -#: views/html/questgroups/edit.tpl:56 views/html/quests/create.tpl:65 -#: views/html/quests/edit.tpl:68 views/html/seminaries/create.tpl:63 -#: views/html/seminaries/edit.tpl:65 -msgid "max." -msgstr "max." - #: questtypes/submit/html/quest.tpl:28 msgid "Your submissions" msgstr "Deine Lösungsvorschläge" @@ -411,7 +483,7 @@ msgstr "Texteingabe" msgid "%d XPs" msgstr "%d XP" -#: views/ajax/users/index.tpl:20 views/html/users/index.tpl:28 +#: views/ajax/users/index.tpl:20 views/html/users/index.tpl:32 #: views/html/users/manage.tpl:31 views/html/users/user.tpl:22 #, php-format msgid "registered on %s" @@ -443,15 +515,6 @@ msgstr "Bedingungen" msgid "Date" msgstr "Datum" -#: views/html/achievements/conditions.tpl:22 -#: views/html/achievements/conditions.tpl:31 -#: views/html/achievements/conditions.tpl:59 -#: views/html/achievements/conditions.tpl:89 -#: views/html/achievements/conditions.tpl:98 -#: views/html/achievements/conditions.tpl:126 -msgid "Field" -msgstr "Feld" - #: views/html/achievements/conditions.tpl:28 #: views/html/achievements/conditions.tpl:29 #: views/html/achievements/conditions.tpl:39 @@ -973,6 +1036,7 @@ msgstr "Icon" #: views/html/charactertypes/create.tpl:41 #: views/html/charactertypes/create.tpl:42 #: views/html/charactertypes/edit.tpl:41 views/html/charactertypes/edit.tpl:42 +#: views/html/users/index.tpl:21 views/html/users/index.tpl:22 #: views/html/users/user.tpl:23 msgid "Name" msgstr "Name" @@ -1193,10 +1257,6 @@ msgstr "%s-Quest bearbeiten" msgid "Media" msgstr "Medien" -#: views/html/charactergroupsquests/manage.tpl:43 -msgid "File invalid" -msgstr "Die Datei ist ungültig" - #: views/html/charactergroupsquests/manage.tpl:68 msgid "delete selected" msgstr "markierte löschen" @@ -1345,17 +1405,17 @@ msgid "Date of registration" msgstr "Registrierungsdatum" #: views/html/characters/index.tpl:37 views/html/quests/index.tpl:50 -#: views/html/users/index.tpl:22 +#: views/html/users/index.tpl:26 msgid "Apply filters" msgstr "Filter anwenden" #: views/html/characters/index.tpl:61 views/html/quests/index.tpl:82 -#: views/html/users/index.tpl:39 +#: views/html/users/index.tpl:48 msgid "Show more" msgstr "Weitere anzeigen" #: views/html/characters/index.tpl:62 views/html/quests/index.tpl:83 -#: views/html/users/index.tpl:40 +#: views/html/users/index.tpl:49 msgid "Show all" msgstr "Alle anzeigen" @@ -2112,6 +2172,7 @@ msgstr "Nachname" #: views/html/users/create.tpl:92 views/html/users/create.tpl:93 #: views/html/users/edit.tpl:100 views/html/users/edit.tpl:101 +#: views/html/users/index.tpl:23 views/html/users/index.tpl:24 #: views/html/users/register.tpl:93 views/html/users/register.tpl:94 #: views/html/users/user.tpl:24 msgid "E‑mail address" diff --git a/models/MediaModel.inc b/models/MediaModel.inc index 826641c7..cb0e4004 100644 --- a/models/MediaModel.inc +++ b/models/MediaModel.inc @@ -580,7 +580,6 @@ } - /** * Copy Achievement media. * @@ -602,6 +601,32 @@ $userId ); } + + + /** + * Gather some information about a Seminary medium. + * + * The infos are organized in an associative array and contain the + * following keys: width and height + * + * @param int $seminarymediaId ID of Seminary media to get infos for + * @return array List of infos for Seminary medium + */ + public function getSeminarymediaInfos($seminarymediaId) + { + // Create filename + $filename = ROOT.DS.\nre\configs\AppConfig::$dirs['seminarymedia'].DS.$seminarymediaId; + + // Get infos + $infos = array(); + $im = new \Imagick($filename); + $infos['width'] = $im->getImageWidth(); + $infos['height'] = $im->getImageHeight(); + + + // Return infos + return $infos; + } diff --git a/questtypes/dragndrop/DragndropQuesttypeController.inc b/questtypes/dragndrop/DragndropQuesttypeController.inc index b2569237..0bf08a41 100644 --- a/questtypes/dragndrop/DragndropQuesttypeController.inc +++ b/questtypes/dragndrop/DragndropQuesttypeController.inc @@ -25,6 +25,12 @@ * @var array */ public $models = array('media'); + /** + * Required components + * + * @var array + */ + public $components = array('validation'); @@ -222,19 +228,304 @@ } - /** - * TODO Action: edittask. - * - * Edit the task of a Quest. - * - * @param array $seminary Current Seminary data - * @param array $questgroup Current Questgroup data - * @param array $quest Current Quest data - */ - public function edittask($seminary, $questgroup, $quest) - { - } - - } + /** + * Action: edittask. + * + * Edit the task of a Quest. + * + * @param array $seminary Current Seminary data + * @param array $questgroup Current Questgroup data + * @param array $quest Current Quest data + */ + public function edittask($seminary, $questgroup, $quest) + { + // Get Drag&Drop field + $dndField = $this->Dragndrop->getDragndrop($quest['id']); + if(!is_null($dndField)) { + $dndField['media'] = $this->Media->getSeminaryMediaById($dndField['questmedia_id']); + } + + // Get Drop-items + $drops = array(); + if(!is_null($dndField)) { + $drops = $this->Dragndrop->getDrops($dndField['quest_id']); + } + + // Get Drag-items + $drags = array(); + if(!is_null($dndField)) + { + $drags = $this->Dragndrop->getDrags($dndField['quest_id']); + foreach($drags as &$drag) + { + $drag['media'] = $this->Media->getSeminaryMediaById($drag['questmedia_id']); + $drag['drops'] = array_map(function($d) { return $d['id']; }, $this->Dragndrop->getDropsForDrag($drag['id'])); + } + } + + // Get allowed mimetypes + $mimetypes = \nre\configs\AppConfig::$mimetypes['questtypes']; + + // Values + $step = 0; + $steps = 2; + $validation = true; + $dragsValidation = true; + + // Save submitted data + if($this->request->getRequestMethod() == 'POST') + { + // Get current step + $step = max(0, min(2, intval($this->request->getPostParam('step')))); + + // Drag&Drop-field (background image) + if($step == 0) + { + // Validate zone + $zone = null; + if(!empty($_FILES) && array_key_exists('zone', $_FILES) && $_FILES['zone']['error'] != UPLOAD_ERR_NO_FILE) + { + $zone = $_FILES['zone']; + + // Check error + if($zone['error'] !== UPLOAD_ERR_OK) { + $validation = $this->Validation->addValidationResult($validation, 'zone', 'error', $zone['error']); + } + + // Check mimetype + $mediaMimetype = null; + $zone['mimetype'] = \hhu\z\Utils::getMimetype($zone['tmp_name'], $zone['type']); + foreach($mimetypes as &$mimetype) { + if($mimetype['mimetype'] == $zone['mimetype']) { + $mediaMimetype = $mimetype; + break; + } + } + if(is_null($mediaMimetype)) { + $validation = $this->Validation->addValidationResult($validation, 'zone', 'mimetype', $zone['mimetype']); + } + elseif($zone['size'] > $mediaMimetype['size']) { + $validation = $this->Validation->addValidationResult($validation, 'zone', 'size', $mediaMimetype['size']); + } + } + + // Set zone + if($validation === true) + { + // Upload background image + $mediaId = $this->Media->createQuestMedia( + $this->Auth->getUserId(), + $seminary['id'], + sprintf('quest-dnd-%s', $quest['url']), + '', + $zone['mimetype'], + $zone['tmp_name'] + ); + if($mediaId !== false) + { + // Create Drag&Drop zone + $this->Dragndrop->createDragndrop( + $this->Auth->getUserId(), + $quest['id'], + $mediaId + ); + } + + // Reload Drag&Drop field + $dndField = $this->Dragndrop->getDragndrop($quest['id']); + $dndField['media'] = $this->Media->getSeminaryMediaById($dndField['questmedia_id']); + } + } + // Drop-items + elseif($step == 1) + { + // Get new Drop-items and organize them + $dropsNew = array(); + $dropsUpdate = array(); + foreach($this->request->getPostParam('drops') as $drop) + { + if(array_key_exists('id', $drop)) { + $dropsUpdate[$drop['id']] = $drop; + } + else { + $dropsNew[] = $drop; + } + } + + // Update Drop-items + foreach($drops as $drop) + { + if(array_key_exists($drop['id'], $dropsUpdate)) + { + $drop = $dropsUpdate[$drop['id']]; + $this->Dragndrop->editDrop($drop['id'], $drop['width'], $drop['height'], $drop['x'], $drop['y']); + } + else { + $this->Dragndrop->deleteDrop($drop['id']); + } + } + // Add new Drop-items + foreach($dropsNew as $drop) { + $this->Dragndrop->addDrop($dndField['quest_id'], $drop['width'], $drop['height'], $drop['x'], $drop['y']); + } + + // Reload Drop-items + $drops = $this->Dragndrop->getDrops($dndField['quest_id']); + } + // Drag-items + elseif($step == 2) + { + // Get new Drop-items and organize them + $dragsNew = array(); + $dragsUpdate = array(); + foreach($this->request->getPostParam('drags') as $index => $drag) + { + // Get file + if(array_key_exists($index, $_FILES['drags']['error']) && $_FILES['drags']['error'][$index] !== UPLOAD_ERR_NO_FILE) + { + $drag['file'] = array( + 'name' => $_FILES['drags']['name'][$index], + 'type' => $_FILES['drags']['type'][$index], + 'tmp_name' => $_FILES['drags']['tmp_name'][$index], + 'error' => $_FILES['drags']['error'][$index], + 'size' => $_FILES['drags']['size'][$index] + ); + + // Validate file + $dragValidation = true; + + // Check error + if($drag['file']['error'] !== UPLOAD_ERR_OK) { + $dragValidation = $this->Validation->addValidationResult($dragValidation, 'file', 'error', $drag['file']['error']); + } + + // Check mimetype + $dragMimetype = null; + $drag['file']['mimetype'] = \hhu\z\Utils::getMimetype($drag['file']['tmp_name'], $drag['file']['type']); + foreach($mimetypes as &$mimetype) { + if($mimetype['mimetype'] == $drag['file']['mimetype']) { + $dragMimetype = $mimetype; + break; + } + } + if(is_null($dragMimetype)) { + $dragValidation = $this->Validation->addValidationResult($dragValidation, 'file', 'mimetype', $drag['file']['mimetype']); + } + elseif($drag['file']['size'] > $dragMimetype['size']) { + $dragValidation = $this->Validation->addValidationResult($dragValidation, 'file', 'size', $dragMimetype['size']); + } + + // Add validation result + if($dragValidation !== true) + { + if(!is_array($dragsValidation)) { + $dragsValidation = array(); + } + $dragsValidation[$index] = $dragValidation; + } + + // Upload Drag-item file + if($dragValidation === true) + { + $drag['file']['media_id'] = $this->Media->createQuestMedia( + $this->Auth->getUserId(), + $seminary['id'], + sprintf('quest-dnd-%s-%s', substr($quest['url'], 0, 25), substr($drag['file']['name'], 0, 25)), + '', + $drag['file']['mimetype'], + $drag['file']['tmp_name'] + ); + } + } + + // Add to array + if(array_key_exists('id', $drag)) { + $dragsUpdate[$drag['id']] = $drag; + } + else { + $dragsNew[] = $drag; + } + } + + // Update Drag-items + foreach($drags as $drag) + { + if(array_key_exists($drag['id'], $dragsUpdate)) + { + $drag = $dragsUpdate[$drag['id']]; + // Edit Drag-items + if(array_key_exists('file', $drag) && array_key_exists('media_id', $drag['file'])) { + $this->Dragndrop->editDrag($drag['id'], $drag['file']['media_id']); + } + // Set correct Drop-items for Drag-item + $this->Dragndrop->setDropsForDrag( + $this->Auth->getUserId(), + $drag['id'], + array_key_exists('drops', $drag) ? array_keys($drag['drops']) : array() + ); + } + else { + $this->Dragndrop->deleteDrag($drag['id']); + } + } + // Add new Drag-items + foreach($dragsNew as $drag) + { + if(array_key_exists('file', $drag) && array_key_exists('media_id', $drag['file'])) + { + // Create Drag-item + $dragId = $this->Dragndrop->addDrag($dndField['quest_id'], $drag['file']['media_id']); + + // Set Drop-items for Drag-item + $this->Dragndrop->setDropsForDrag( + $this->Auth->getUserId(), + $dragId, + array_key_exists('drops', $drag) ? array_keys($drag['drops']) : array() + ); + } + } + + // Reload Drag-items + $drags = $this->Dragndrop->getDrags($dndField['quest_id']); + foreach($drags as &$drag) + { + $drag['media'] = $this->Media->getSeminaryMediaById($drag['questmedia_id']); + $drag['drops'] = array_map(function($d) { return $d['id']; }, $this->Dragndrop->getDropsForDrag($drag['id'])); + } + } + + // Go to next/previous step + if(!is_null($this->request->getPostParam('prev'))) { + $step--; + } + else { + $step++; + } + + // Redirect after last step + if($step > $steps) + { + if($validation === true && $dragsValidation === true) { + $this->redirect($this->linker->link(array('quest', $seminary['url'], $questgroup['url'], $quest['url']), 1)); + } + else { + $step--; + } + } + } + + + // Pass data to view + $this->set('seminary', $seminary); + $this->set('zone', $dndField); + $this->set('drops', $drops); + $this->set('drags', $drags); + $this->set('mimetypes', $mimetypes); + $this->set('step', $step); + $this->set('validation', $validation); + $this->set('dragsValidation', $dragsValidation); + } + + } ?> diff --git a/questtypes/dragndrop/DragndropQuesttypeModel.inc b/questtypes/dragndrop/DragndropQuesttypeModel.inc index cc3db7e0..9806cce8 100644 --- a/questtypes/dragndrop/DragndropQuesttypeModel.inc +++ b/questtypes/dragndrop/DragndropQuesttypeModel.inc @@ -128,6 +128,33 @@ + /** + * Create a new Drag&Drop field for a Quest. + * + * @param int $userId ID of creating user + * @param int $questId ID of Quest to create Drag&Drop field for + * @param int $questmediaId ID of Questmedia to use for the field + */ + public function createDragndrop($userId, $questId, $questmediaId) + { + // Get image measurements + $infos = $this->Media->getSeminarymediaInfos($questmediaId); + + // Create field + $this->db->query( + 'INSERT INTO questtypes_dragndrop '. + '(quest_id, created_user_id, questmedia_id, width, height) '. + 'VALUES '. + '(?, ?, ?, ?, ?) '. + 'ON DUPLICATE KEY UPDATE '. + 'questmedia_id = ?, width = ?, height = ?', + 'iiiiiiii', + $questId, $userId, $questmediaId, $infos['width'], $infos['height'], + $questmediaId, $infos['width'], $infos['height'] + ); + } + + /** * Get Drag&Drop-field. * @@ -161,13 +188,151 @@ public function getDrops($dragndropId) { return $this->db->query( - 'SELECT id, top, `left`, width, height '. //, questtypes_dragndrop_drag_id '. + 'SELECT id, top, `left`, width, height '. 'FROM questtypes_dragndrop_drops '. 'WHERE questtypes_dragndrop_id = ?', 'i', $dragndropId ); } + + + /** + * Get Drop-items for a Drag-item + * + * @param int $dragId ID of Drag-item to get Drop-items for + * @return array List of Drop-items + */ + public function getDropsForDrag($dragId) + { + return $this->db->query( + 'SELECT drops.id, top, `left`, width, height '. + 'FROM questtypes_dragndrop_drops_drags AS drops_drags '. + 'INNER JOIN questtypes_dragndrop_drops AS drops ON drops.id = drops_drags.questtypes_dragndrop_drop_id '. + 'WHERE drops_drags.questtypes_dragndrop_drag_id = ?', + 'i', + $dragId + ); + } + + + /** + * Set correct Drop-items for a Drag-item. + * + * @param int $userId ID of creating user + * @param int $dragId ID of Drag-item to set Drop-items for + * @param array $dropIds List of Drop-items to set for Drag-item + */ + public function setDropsForDrag($userId, $dragId, $dropIds) + { + // Set new Drop-items + if(!empty($dropIds)) + { + $this->db->query( + sprintf( + 'INSERT INTO questtypes_dragndrop_drops_drags '. + '(questtypes_dragndrop_drop_id, questtypes_dragndrop_drag_id, created_user_id) '. + 'SELECT questtypes_dragndrop_drops.id, ?, ? '. + 'FROM questtypes_dragndrop_drops '. + 'WHERE questtypes_dragndrop_drops.questtypes_dragndrop_id = ('. + 'SELECT questtypes_dragndrop_drags.questtypes_dragndrop_id '. + 'FROM questtypes_dragndrop_drags '. + 'WHERE questtypes_dragndrop_drags.id = ?'. + ') AND questtypes_dragndrop_drops.id IN (%s) '. + 'ON DUPLICATE KEY UPDATE '. + 'questtypes_dragndrop_drops_drags.created = questtypes_dragndrop_drops_drags.created', + implode(',', array_map(function($id) { return intval($id); }, $dropIds)) + ), + 'iii', + $dragId, $userId, + $dragId + ); + + // Remove old Drop-items + $this->db->query( + sprintf( + 'DELETE FROM questtypes_dragndrop_drops_drags '. + 'WHERE questtypes_dragndrop_drag_id = ? AND questtypes_dragndrop_drop_id NOT IN (%s)', + implode(',', array_map(function($id) { return intval($id); }, $dropIds)) + ), + 'i', + $dragId + ); + } + else + { + // Remove all Drop-items + $this->db->query( + 'DELETE FROM questtypes_dragndrop_drops_drags '. + 'WHERE questtypes_dragndrop_drag_id = ?', + 'i', + $dragId + ); + } + } + + + /** + * Create a new Drop-item for a Drag&Drop-field. + * + * @param int $dragndropId ID of Drag&Drop-field to create Drop-item for + * @param int $width Width of Drop-item + * @param int $height Height of Drop-item + * @param int $x X-coordinate of Drop-item + * @param int $y Y-coordinate of Drop-item + * @return int ID of newly created Drop-item + */ + public function addDrop($dragndropId, $width, $height, $x, $y) + { + $this->db->query( + 'INSERT INTO questtypes_dragndrop_drops '. + '(questtypes_dragndrop_id, top, `left`, width, height) '. + 'VALUES '. + '(?, ?, ?, ?, ?)', + 'iiiii', + $dragndropId, $y, $x, $width, $height + ); + + return $this->db->getInsertId(); + } + + + /** + * Edit Drop-item. + * + * @param int $dropId ID of Drop-item to edit + * @param int $width New width of Drop-item + * @param int $height New height of Drop-item + * @param int $x New X-coordinate of Drop-item + * @param int $y New Y-coordinate of Drop-item + */ + public function editDrop($dropId, $width, $height, $x, $y) + { + $this->db->query( + 'UPDATE questtypes_dragndrop_drops '. + 'SET top = ?, `left` = ?, width = ?, height = ? '. + 'WHERE id = ?', + 'iiiii', + $y, $x, $width, $height, + $dropId + ); + } + + + /** + * Delete a Drop-item. + * + * @param int $dropId ID of Drop-item to delete + */ + public function deleteDrop($dropId) + { + $this->db->query( + 'DELETE FROM questtypes_dragndrop_drops '. + 'WHERE id = ?', + 'i', + $dropId + ); + } /** @@ -195,6 +360,63 @@ $dragndropId ); } + + + /** + * Create a new Drag-item. + * + * @param int $dragndropId ID of Drag&Drop-field to add Drag-item for + * @param int $questmediaId ID of Questmedia to use for this Drag-item + * @return int ID of newly created Drag-item + */ + public function addDrag($dragndropId, $questmediaId) + { + $this->db->query( + 'INSERT INTO questtypes_dragndrop_drags '. + '(questtypes_dragndrop_id, questmedia_id) '. + 'VALUES '. + '(?, ?) ', + 'ii', + $dragndropId, $questmediaId + ); + + return $this->db->getInsertId(); + } + + + /** + * Edit Drag-item. + * + * @param int $dragId ID of Drag-item to edit + * @param int $questmediaId ID of new Questmedia to use for this Drag-item + */ + public function editDrag($dragId, $questmediaId) + { + $this->db->query( + 'UPDATE questtypes_dragndrop_drags '. + 'SET questmedia_id = ? '. + 'WHERE id = ?', + 'ii', + $questmediaId, + $dragId + ); + } + + + /** + * Delete a Drag-item. + * + * @param int $dragId ID of Drag-item to delete + */ + public function deleteDrag($dragId) + { + $this->db->query( + 'DELETE FROM questtypes_dragndrop_drags '. + 'WHERE id = ?', + 'i', + $dragId + ); + } /** diff --git a/questtypes/dragndrop/html/edittask.tpl b/questtypes/dragndrop/html/edittask.tpl index c65158e7..1bbc76e1 100644 --- a/questtypes/dragndrop/html/edittask.tpl +++ b/questtypes/dragndrop/html/edittask.tpl @@ -1 +1,254 @@ -

TODO

+ +
    + &$settings) : ?> +
  • +
      + $value) : ?> +
    • + +
    • + +
    +
  • + +
+ +
+ +
+ : + +
+
+ + + +

:

+
    + +
  • 0) : ?>(  MiB)
  • + +
+
+ + +
+ +
+ &$drop) : ?> +
+ + + +
+ +
+
    + &$drop) : ?> +
  1. + + + + x + px +
    + + x + px +
    + +
  2. + +
  3. + +
  4. +
+
+ + + +
+ +
+ &$drop) : ?> +
+ +
+ +
+
    + &$drag) : ?> +
  • + +
      + &$settings) : ?> +
    • +
        + $value) : ?> +
      • + +
      • + +
      +
    • + +
    + + + + + &$drop) : ?> + checked="checked" /> + + +
    + +
  • + +
  • + +
  • +
+

:

+
    + +
  • 0) : ?>(  MiB)
  • + +
+
+ + + + +
+ + + diff --git a/www/css/desktop.css b/www/css/desktop.css index 2a827543..e90df0c1 100644 --- a/www/css/desktop.css +++ b/www/css/desktop.css @@ -355,8 +355,16 @@ input[type="submit"][disabled]{text-shadow:1px 2px #d48c4e;background:#f9ac69;bo .opponent .fa{font-size:1.25em;color:#c7135b;padding-right:0} .bossfight .option{background:#fff;margin-bottom:10px;padding:15px 15px 5px;border-radius:3px} -#dragZone{background:#eae8e4;box-sizing:border-box;padding:5px 5px 0 5px} +#dropZone.dev div{text-align:center;background-color:rgba(255,255,0,0.6)} +#dropZone.dev i.move{cursor:grab} +#dropZone.dev i.resize{position:absolute;right:0;bottom:0;padding:0;cursor:nwse-resize} .drop{background:#eae8e4} +#drops li{position:relative;margin:10px 0 10px 30px} +#drops span.lstidx{position:absolute;top:2px;left:-30px} +#drops span.lstidx:after{content:'.'} +#drops input[type="number"]{width:70px} +#dragZone{background:#eae8e4;box-sizing:border-box;padding:5px 5px 0 5px} +#drags > li{list-style-type:initial;margin:10px 0 10px 30px} /** Media Queries **/ diff --git a/www/js/jquery-ui.min.js b/www/js/jquery-ui.min.js new file mode 100644 index 00000000..65891b80 --- /dev/null +++ b/www/js/jquery-ui.min.js @@ -0,0 +1,7 @@ +/*! jQuery UI - v1.11.4 - 2015-04-28 +* http://jqueryui.com +* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, resizable.js +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var s=0,n=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,a=n.call(arguments,1),o=0,r=a.length;r>o;o++)for(i in a[o])s=a[o][i],a[o].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(a){var o="string"==typeof a,r=n.call(arguments,1),h=this;return o?this.each(function(){var i,n=e.data(this,s);return"instance"===a?(h=n,!1):n?e.isFunction(n[a])&&"_"!==a.charAt(0)?(i=n[a].apply(n,r),i!==n&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+a+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+a+"'")}):(r.length&&(a=e.widget.extend.apply(null,[a].concat(r))),this.each(function(){var t=e.data(this,s);t?(t.option(a||{}),t._init&&t._init()):e.data(this,s,new i(a,this))})),h}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=s++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var a=!1;e(document).mouseup(function(){a=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!a){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),a=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),a=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("
"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.widthi?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(N,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("
").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.lefti[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n +})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent(),a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=e(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("
"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidthe.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("
"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0};e(n.alsoResize).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable}); \ No newline at end of file