Commit 6be5bc685cf1c4969b21cf37ef0bc2715922c42b
1 parent
b2f39ae4
Merged in from DEV trunk...
KTS-2625 "Fatal error occurs when attempting to archiving a folder." Fixed. Archive function was using a folder object in place of a document object. Reviewed by: Jonathan Byrne Committed by: Megan Watson KTS-2622 "Copying a folder containing Checkout documents results in the copied documents also being checked out like the originals." Fixed. Added code to cancel the checkout. Committed by: Megan Watson Reviewed by: Jonathan Byrne KTC-189 "Deleting a fieldset does not remove all instances of itself and existing field and document type associations" Fixed. On deleting the fieldset it checks for any document type associations and removes them. KTS-2487 "Deleting an assigned fieldset causes a fatal error" Fixed. Removing the document type associations fixes the error on viewing the document. Committed by: Megan Watson Reviewed by: Jonathan Byrne KTS-1447 "Add a delete "bin" icon to "Items that require your attention..." Dashboard item and don't delete the item automatically" Fixed. Removed the delete call on viewing the document/folder/etc. Added the standard delete icon next the the 'Clear Alert' link. Committed by: Megan Watson Reviewed by: Jonathan Byrne KTS-2627 "Compress all javascript includes and remove orphaned includes." Fixed. All large js file compressed and includes removed. Committed By: Jalaloedien Abrahams Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7602 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
52 changed files
with
1441 additions
and
7224 deletions
lib/dashboard/Notification.inc.php
| @@ -5,32 +5,32 @@ | @@ -5,32 +5,32 @@ | ||
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | 8 | + * |
| 9 | * This program is free software; you can redistribute it and/or modify it under | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | * the terms of the GNU General Public License version 3 as published by the | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | * Free Software Foundation. | 11 | * Free Software Foundation. |
| 12 | - * | 12 | + * |
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | * details. | 16 | * details. |
| 17 | - * | 17 | + * |
| 18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | 20 | + * |
| 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | 23 | + * |
| 24 | * The interactive user interfaces in modified source and object code versions | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | * of this program must display Appropriate Legal Notices, as required under | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | * Section 5 of the GNU General Public License version 3. | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | 27 | + * |
| 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | * these Appropriate Legal Notices must retain the display of the "Powered by | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | - * copyright notice. | 32 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 33 | + * copyright notice. | ||
| 34 | * Contributor( s): ______________________________________ | 34 | * Contributor( s): ______________________________________ |
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| @@ -58,7 +58,7 @@ class KTNotification extends KTEntity { | @@ -58,7 +58,7 @@ class KTNotification extends KTEntity { | ||
| 58 | /** primary key value */ | 58 | /** primary key value */ |
| 59 | var $iId = -1; | 59 | var $iId = -1; |
| 60 | var $iUserId; | 60 | var $iUserId; |
| 61 | - | 61 | + |
| 62 | // sType and sLabel provide the title of the dashboard alert. | 62 | // sType and sLabel provide the title of the dashboard alert. |
| 63 | var $sLabel; // a simple label - e.g. the document's title, or so forth. | 63 | var $sLabel; // a simple label - e.g. the document's title, or so forth. |
| 64 | var $sType; // namespaced item type. (e.g. ktcore/subscriptions, word/officeupload) | 64 | var $sType; // namespaced item type. (e.g. ktcore/subscriptions, word/officeupload) |
| @@ -73,34 +73,34 @@ class KTNotification extends KTEntity { | @@ -73,34 +73,34 @@ class KTNotification extends KTEntity { | ||
| 73 | var $iData2; | 73 | var $iData2; |
| 74 | // sData1 and sData2 are 255-length character fields | 74 | // sData1 and sData2 are 255-length character fields |
| 75 | var $sData1; | 75 | var $sData1; |
| 76 | - var $sData2; | 76 | + var $sData2; |
| 77 | // sText1 is a 65535-length text field | 77 | // sText1 is a 65535-length text field |
| 78 | - var $sText1; | ||
| 79 | - | 78 | + var $sText1; |
| 79 | + | ||
| 80 | var $_bUsePearError = true; | 80 | var $_bUsePearError = true; |
| 81 | - | 81 | + |
| 82 | function getId() { return $this->iId; } | 82 | function getId() { return $this->iId; } |
| 83 | - | ||
| 84 | - function getLabel() { return $this->sLabel; } | 83 | + |
| 84 | + function getLabel() { return $this->sLabel; } | ||
| 85 | function setLabel($sLabel) { $this->sLabel = $sLabel; } | 85 | function setLabel($sLabel) { $this->sLabel = $sLabel; } |
| 86 | - function getType() { return $this->sType; } | 86 | + function getType() { return $this->sType; } |
| 87 | function setType($sType) { $this->sType = $sType; } | 87 | function setType($sType) { $this->sType = $sType; } |
| 88 | - | ||
| 89 | - function getIntData1() { return $this->iData1; } | 88 | + |
| 89 | + function getIntData1() { return $this->iData1; } | ||
| 90 | function setIntData1($iData1) { $this->iData1 = $iData1; } | 90 | function setIntData1($iData1) { $this->iData1 = $iData1; } |
| 91 | - function getIntData2() { return $this->iData2; } | 91 | + function getIntData2() { return $this->iData2; } |
| 92 | function setIntData2($iData2) { $this->iData2 = $iData2; } | 92 | function setIntData2($iData2) { $this->iData2 = $iData2; } |
| 93 | - function getStrData1() { return $this->sData1; } | 93 | + function getStrData1() { return $this->sData1; } |
| 94 | function setStrData1($sData1) { $this->sData1 = $sData1; } | 94 | function setStrData1($sData1) { $this->sData1 = $sData1; } |
| 95 | - function getStrData2() { return $this->sData2; } | ||
| 96 | - function setStrData2($sData2) { $this->sData2 = $sData2; } | ||
| 97 | - function getTextData1() { return $this->sText1; } | ||
| 98 | - function setTextData1($mValue) { $this->sText1 = $mValue; } | 95 | + function getStrData2() { return $this->sData2; } |
| 96 | + function setStrData2($sData2) { $this->sData2 = $sData2; } | ||
| 97 | + function getTextData1() { return $this->sText1; } | ||
| 98 | + function setTextData1($mValue) { $this->sText1 = $mValue; } | ||
| 99 | 99 | ||
| 100 | var $_aFieldToSelect = array( | 100 | var $_aFieldToSelect = array( |
| 101 | "iId" => "id", | 101 | "iId" => "id", |
| 102 | "iUserId" => "user_id", | 102 | "iUserId" => "user_id", |
| 103 | - "sLabel" => "label", | 103 | + "sLabel" => "label", |
| 104 | "sType" => "type", | 104 | "sType" => "type", |
| 105 | "dCreationDate" => "creation_date", | 105 | "dCreationDate" => "creation_date", |
| 106 | "iData1" => "data_int_1", | 106 | "iData1" => "data_int_1", |
| @@ -109,7 +109,7 @@ class KTNotification extends KTEntity { | @@ -109,7 +109,7 @@ class KTNotification extends KTEntity { | ||
| 109 | "sData2" => "data_str_2", | 109 | "sData2" => "data_str_2", |
| 110 | "sText1" => "data_text_1", | 110 | "sText1" => "data_text_1", |
| 111 | ); | 111 | ); |
| 112 | - | 112 | + |
| 113 | function _table () { | 113 | function _table () { |
| 114 | return KTUtil::getTableName('notifications'); | 114 | return KTUtil::getTableName('notifications'); |
| 115 | } | 115 | } |
| @@ -118,11 +118,11 @@ class KTNotification extends KTEntity { | @@ -118,11 +118,11 @@ class KTNotification extends KTEntity { | ||
| 118 | $notificationRegistry =& KTNotificationRegistry::getSingleton(); | 118 | $notificationRegistry =& KTNotificationRegistry::getSingleton(); |
| 119 | $handler = $notificationRegistry->getHandler($this->sType); | 119 | $handler = $notificationRegistry->getHandler($this->sType); |
| 120 | 120 | ||
| 121 | - if (is_null($handler)) { return null; } | ||
| 122 | - | 121 | + if (is_null($handler)) { return null; } |
| 122 | + | ||
| 123 | return $handler->handleNotification($this); | 123 | return $handler->handleNotification($this); |
| 124 | } | 124 | } |
| 125 | - | 125 | + |
| 126 | function &getHandler() { | 126 | function &getHandler() { |
| 127 | $notificationRegistry =& KTNotificationRegistry::getSingleton(); | 127 | $notificationRegistry =& KTNotificationRegistry::getSingleton(); |
| 128 | $handler =& $notificationRegistry->getHandler($this->sType); | 128 | $handler =& $notificationRegistry->getHandler($this->sType); |
| @@ -131,10 +131,10 @@ class KTNotification extends KTEntity { | @@ -131,10 +131,10 @@ class KTNotification extends KTEntity { | ||
| 131 | 131 | ||
| 132 | // Static function | 132 | // Static function |
| 133 | function &get($iId) { return KTEntityUtil::get('KTNotification', $iId); } | 133 | function &get($iId) { return KTEntityUtil::get('KTNotification', $iId); } |
| 134 | - function &getList($sWhereClause = null, $aOptions = null ) { | 134 | + function &getList($sWhereClause = null, $aOptions = null ) { |
| 135 | if(!is_array($aOptions)) $aOptions = array($aOptions); | 135 | if(!is_array($aOptions)) $aOptions = array($aOptions); |
| 136 | $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'creation_date DESC'); | 136 | $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'creation_date DESC'); |
| 137 | - return KTEntityUtil::getList2('KTNotification', $sWhereClause, $aOptions); | 137 | + return KTEntityUtil::getList2('KTNotification', $sWhereClause, $aOptions); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | function &createFromArray($aOptions) { return KTEntityUtil::createFromArray('KTNotification', $aOptions); } | 140 | function &createFromArray($aOptions) { return KTEntityUtil::createFromArray('KTNotification', $aOptions); } |
| @@ -151,14 +151,15 @@ class KTNotificationHandler extends KTStandardDispatcher { | @@ -151,14 +151,15 @@ class KTNotificationHandler extends KTStandardDispatcher { | ||
| 151 | function handleNotification($oKTNotification) { | 151 | function handleNotification($oKTNotification) { |
| 152 | $oTemplating =& KTTemplating::getSingleton(); | 152 | $oTemplating =& KTTemplating::getSingleton(); |
| 153 | $oTemplate = $oTemplating->loadTemplate("kt3/notifications/generic"); | 153 | $oTemplate = $oTemplating->loadTemplate("kt3/notifications/generic"); |
| 154 | - $aTemplateData = array("context" => $oKTNotification,); | 154 | + |
| 155 | + $aTemplateData = array("context" => $oKTNotification, "oKTConfig" => $oKTConfig); | ||
| 155 | return $oTemplate->render($aTemplateData); | 156 | return $oTemplate->render($aTemplateData); |
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | function do_main() { | 159 | function do_main() { |
| 159 | $this->resolveNotification($this->notification); | 160 | $this->resolveNotification($this->notification); |
| 160 | } | 161 | } |
| 161 | - | 162 | + |
| 162 | // called to resolve the notification (typically from /notify.php?id=xxxxx | 163 | // called to resolve the notification (typically from /notify.php?id=xxxxx |
| 163 | function resolveNotification($oKTNotification) { | 164 | function resolveNotification($oKTNotification) { |
| 164 | $_SESSION['KTErrorMessage'][] = _kt("This notification handler does not support publication."); | 165 | $_SESSION['KTErrorMessage'][] = _kt("This notification handler does not support publication."); |
| @@ -172,10 +173,10 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -172,10 +173,10 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 172 | /* Subscription Notifications | 173 | /* Subscription Notifications |
| 173 | * | 174 | * |
| 174 | * Subscriptions are a large part of the notification volume. | 175 | * Subscriptions are a large part of the notification volume. |
| 175 | - * That said, notifications cater to a larger group, so there is some | 176 | + * That said, notifications cater to a larger group, so there is some |
| 176 | * degree of mismatch between the two. | 177 | * degree of mismatch between the two. |
| 177 | * | 178 | * |
| 178 | - * Mapping the needs of subscriptions onto the provisions of notifications | 179 | + * Mapping the needs of subscriptions onto the provisions of notifications |
| 179 | * works as: | 180 | * works as: |
| 180 | * | 181 | * |
| 181 | * $oKTN->label: object name [e.g. Document Name] | 182 | * $oKTN->label: object name [e.g. Document Name] |
| @@ -183,9 +184,9 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -183,9 +184,9 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 183 | * $oKTN->strData2: _location_ name. (e.g. folder of the subscription.) | 184 | * $oKTN->strData2: _location_ name. (e.g. folder of the subscription.) |
| 184 | * $oKTN->intData1: object id (e.g. document_id, folder_id) | 185 | * $oKTN->intData1: object id (e.g. document_id, folder_id) |
| 185 | * $oKTN->intData2: actor id (e.g. user_id) | 186 | * $oKTN->intData2: actor id (e.g. user_id) |
| 186 | - * | 187 | + * |
| 187 | */ | 188 | */ |
| 188 | - | 189 | + |
| 189 | var $notificationType = 'ktcore/subscriptions'; | 190 | var $notificationType = 'ktcore/subscriptions'; |
| 190 | 191 | ||
| 191 | var $_eventObjectMap = array( | 192 | var $_eventObjectMap = array( |
| @@ -202,7 +203,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -202,7 +203,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 202 | "ArchivedDocument" => 'document', // can go through and request un-archival (?) | 203 | "ArchivedDocument" => 'document', // can go through and request un-archival (?) |
| 203 | "RestoredArchivedDocument" => 'document', | 204 | "RestoredArchivedDocument" => 'document', |
| 204 | "DiscussDocument" => 'document', | 205 | "DiscussDocument" => 'document', |
| 205 | - ); | 206 | + ); |
| 206 | 207 | ||
| 207 | function KTSubscriptionNotification() { | 208 | function KTSubscriptionNotification() { |
| 208 | $this->_eventTypeNames = array( | 209 | $this->_eventTypeNames = array( |
| @@ -218,7 +219,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -218,7 +219,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 218 | "MovedDocument" => _kt('Document moved'), | 219 | "MovedDocument" => _kt('Document moved'), |
| 219 | "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?) | 220 | "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?) |
| 220 | "RestoredArchivedDocument" => _kt('Document restored'), | 221 | "RestoredArchivedDocument" => _kt('Document restored'), |
| 221 | - "DiscussDocument" => _kt('Document Discussions updated'), | 222 | + "DiscussDocument" => _kt('Document Discussions updated'), |
| 222 | ); | 223 | ); |
| 223 | //parent::KTNotificationHandler(); | 224 | //parent::KTNotificationHandler(); |
| 224 | } | 225 | } |
| @@ -233,9 +234,9 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -233,9 +234,9 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 233 | 'has_actor' => false, | 234 | 'has_actor' => false, |
| 234 | 'notify_id' => $oKTNotification->getId(), | 235 | 'notify_id' => $oKTNotification->getId(), |
| 235 | ); | 236 | ); |
| 236 | - | 237 | + |
| 237 | $info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name']; | 238 | $info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name']; |
| 238 | - | 239 | + |
| 239 | if ($info['actor_id'] !== null) { | 240 | if ($info['actor_id'] !== null) { |
| 240 | $oTempUser = User::get($info['actor_id']); | 241 | $oTempUser = User::get($info['actor_id']); |
| 241 | if (PEAR::isError($oTempUser) || ($oTempUser == false)) { | 242 | if (PEAR::isError($oTempUser) || ($oTempUser == false)) { |
| @@ -246,31 +247,31 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -246,31 +247,31 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 246 | $info['has_actor'] = true; | 247 | $info['has_actor'] = true; |
| 247 | } | 248 | } |
| 248 | } | 249 | } |
| 249 | - | 250 | + |
| 250 | if ($info['object_id'] !== null) { | 251 | if ($info['object_id'] !== null) { |
| 251 | $info['object'] = $this->_getEventObject($info['event_type'], $info['object_id']); | 252 | $info['object'] = $this->_getEventObject($info['event_type'], $info['object_id']); |
| 252 | } | 253 | } |
| 253 | - | 254 | + |
| 254 | return $info; | 255 | return $info; |
| 255 | } | 256 | } |
| 256 | - | 257 | + |
| 257 | // resolve the object type based on the alert type. | 258 | // resolve the object type based on the alert type. |
| 258 | function _getEventObject($sAlertType, $id) { | 259 | function _getEventObject($sAlertType, $id) { |
| 259 | $t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); | 260 | $t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); |
| 260 | - | 261 | + |
| 261 | if ($t == 'document') { | 262 | if ($t == 'document') { |
| 262 | $o = Document::get($id); | 263 | $o = Document::get($id); |
| 263 | - if (PEAR::isError($o) || ($o == false)) { return null; | 264 | + if (PEAR::isError($o) || ($o == false)) { return null; |
| 264 | } else { return $o; } | 265 | } else { return $o; } |
| 265 | } else if ($t == 'folder') { | 266 | } else if ($t == 'folder') { |
| 266 | $o = Folder::get($id); | 267 | $o = Folder::get($id); |
| 267 | - if (PEAR::isError($o) || ($o == false)) { return null; | 268 | + if (PEAR::isError($o) || ($o == false)) { return null; |
| 268 | } else { return $o; } | 269 | } else { return $o; } |
| 269 | } else { | 270 | } else { |
| 270 | return null; | 271 | return null; |
| 271 | } | 272 | } |
| 272 | } | 273 | } |
| 273 | - | 274 | + |
| 274 | function _getEventObjectType($sAlertType) { | 275 | function _getEventObjectType($sAlertType) { |
| 275 | return KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); | 276 | return KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); |
| 276 | } | 277 | } |
| @@ -286,21 +287,21 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -286,21 +287,21 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 286 | /* | 287 | /* |
| 287 | "iId" => "id", | 288 | "iId" => "id", |
| 288 | "iUserId" => "user_id", | 289 | "iUserId" => "user_id", |
| 289 | - "sLabel" => "label", | 290 | + "sLabel" => "label", |
| 290 | "sType" => "type", | 291 | "sType" => "type", |
| 291 | "dCreationDate" => "creation_date", | 292 | "dCreationDate" => "creation_date", |
| 292 | "iData1" => "data_int_1", | 293 | "iData1" => "data_int_1", |
| 293 | "iData2" => "data_int_2", | 294 | "iData2" => "data_int_2", |
| 294 | "sData1" => "data_str_1", | 295 | "sData1" => "data_str_1", |
| 295 | "sData2" => "data_str_2", | 296 | "sData2" => "data_str_2", |
| 296 | - | 297 | + |
| 297 | 'object_name' => $oKTNotification->getLabel(), | 298 | 'object_name' => $oKTNotification->getLabel(), |
| 298 | 'event_type' => $oKTNotification->getStrData1(), | 299 | 'event_type' => $oKTNotification->getStrData1(), |
| 299 | 'location_name' => $oKTNotification->getStrData2(), | 300 | 'location_name' => $oKTNotification->getStrData2(), |
| 300 | 'object_id' => $oKTNotification->getIntData1(), | 301 | 'object_id' => $oKTNotification->getIntData1(), |
| 301 | 'actor_id' => $oKTNotification->getIntData2(), | 302 | 'actor_id' => $oKTNotification->getIntData2(), |
| 302 | - 'has_actor' => false, | ||
| 303 | - | 303 | + 'has_actor' => false, |
| 304 | + | ||
| 304 | */ | 305 | */ |
| 305 | $creationInfo['sLabel'] = $aOptions['target_name']; | 306 | $creationInfo['sLabel'] = $aOptions['target_name']; |
| 306 | $creationInfo['sData1'] = $aOptions['event_type']; | 307 | $creationInfo['sData1'] = $aOptions['event_type']; |
| @@ -312,20 +313,23 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -312,20 +313,23 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 312 | $creationInfo['dCreationDate'] = getCurrentDateTime(); // erk. | 313 | $creationInfo['dCreationDate'] = getCurrentDateTime(); // erk. |
| 313 | 314 | ||
| 314 | global $default; | 315 | global $default; |
| 315 | - | 316 | + |
| 316 | //$default->log->debug('subscription notification: from ' . print_r($aOptions, true)); | 317 | //$default->log->debug('subscription notification: from ' . print_r($aOptions, true)); |
| 317 | $default->log->debug('subscription notification: using ' . print_r($creationInfo, true)); | 318 | $default->log->debug('subscription notification: using ' . print_r($creationInfo, true)); |
| 318 | - | 319 | + |
| 319 | $oNotification =& KTNotification::createFromArray($creationInfo); | 320 | $oNotification =& KTNotification::createFromArray($creationInfo); |
| 320 | - | ||
| 321 | - | 321 | + |
| 322 | + | ||
| 322 | $default->log->debug('subscription notification: created ' . print_r($oNotification, true)); | 323 | $default->log->debug('subscription notification: created ' . print_r($oNotification, true)); |
| 323 | - | 324 | + |
| 324 | return $oNotification; // $res. | 325 | return $oNotification; // $res. |
| 325 | } | 326 | } |
| 326 | - | ||
| 327 | - | ||
| 328 | - | 327 | + |
| 328 | + /** | ||
| 329 | + * View the notification, and clear if requested | ||
| 330 | + * | ||
| 331 | + * @param unknown_type $oKTNotification | ||
| 332 | + */ | ||
| 329 | function resolveNotification($oKTNotification) { | 333 | function resolveNotification($oKTNotification) { |
| 330 | $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); | 334 | $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); |
| 331 | if ($notify_action == 'clear') { | 335 | if ($notify_action == 'clear') { |
| @@ -333,38 +337,38 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -333,38 +337,38 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 333 | $oKTNotification->delete(); | 337 | $oKTNotification->delete(); |
| 334 | exit(redirect(generateControllerLink('dashboard'))); | 338 | exit(redirect(generateControllerLink('dashboard'))); |
| 335 | } | 339 | } |
| 336 | - | 340 | + |
| 337 | // otherwise, we want to redirect the to object represented by the item. | 341 | // otherwise, we want to redirect the to object represented by the item. |
| 338 | // - viewDocument and viewFolder are the appropriate items. | 342 | // - viewDocument and viewFolder are the appropriate items. |
| 339 | - // - object_id | 343 | + // - object_id |
| 340 | $info = $this->_getSubscriptionData($oKTNotification); | 344 | $info = $this->_getSubscriptionData($oKTNotification); |
| 341 | - | 345 | + |
| 342 | $object_type = $this->_getEventObjectType($info['event_type']); | 346 | $object_type = $this->_getEventObjectType($info['event_type']); |
| 343 | - | 347 | + |
| 344 | if ($object_type == '') { | 348 | if ($object_type == '') { |
| 345 | - $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; | 349 | + $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; |
| 346 | exit(redirect(generateControllerLink('dashboard'))); | 350 | exit(redirect(generateControllerLink('dashboard'))); |
| 347 | - } | ||
| 348 | - | 351 | + } |
| 352 | + | ||
| 349 | if ($object_type == 'document') { | 353 | if ($object_type == 'document') { |
| 350 | if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. | 354 | if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. |
| 351 | $params = 'fDocumentId=' . $info['object_id']; | 355 | $params = 'fDocumentId=' . $info['object_id']; |
| 352 | $url = generateControllerLink('viewDocument', $params); | 356 | $url = generateControllerLink('viewDocument', $params); |
| 353 | - $oKTNotification->delete(); // clear the alert. | 357 | + //$oKTNotification->delete(); // clear the alert. |
| 354 | exit(redirect($url)); | 358 | exit(redirect($url)); |
| 355 | - } | 359 | + } |
| 356 | } else if ($object_type == 'folder') { | 360 | } else if ($object_type == 'folder') { |
| 357 | if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. | 361 | if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. |
| 358 | $params = 'fFolderId=' . $info['object_id']; | 362 | $params = 'fFolderId=' . $info['object_id']; |
| 359 | $url = generateControllerLink('browse', $params); | 363 | $url = generateControllerLink('browse', $params); |
| 360 | - $oKTNotification->delete(); // clear the alert. | 364 | + //$oKTNotification->delete(); // clear the alert. |
| 361 | exit(redirect($url)); | 365 | exit(redirect($url)); |
| 362 | - } | 366 | + } |
| 363 | } | 367 | } |
| 364 | - $_SESSION['KTErrorMessage'][] = sprintf('This notification has no "target". Please inform the %s developers that there is a target bug with type: ' . $info['event_type'], APP_NAME); | 368 | + $_SESSION['KTErrorMessage'][] = sprintf('This notification has no "target". Please inform the %s developers that there is a target bug with type: ' . $info['event_type'], APP_NAME); |
| 365 | exit(redirect(generateControllerLink('dashboard'))); | 369 | exit(redirect(generateControllerLink('dashboard'))); |
| 366 | } | 370 | } |
| 367 | - | 371 | + |
| 368 | } | 372 | } |
| 369 | 373 | ||
| 370 | class KTWorkflowNotification extends KTNotificationHandler { | 374 | class KTWorkflowNotification extends KTNotificationHandler { |
| @@ -374,41 +378,41 @@ class KTWorkflowNotification extends KTNotificationHandler { | @@ -374,41 +378,41 @@ class KTWorkflowNotification extends KTNotificationHandler { | ||
| 374 | foreach ($aNotifications as $oNotification) { | 378 | foreach ($aNotifications as $oNotification) { |
| 375 | $oNotification->delete(); | 379 | $oNotification->delete(); |
| 376 | } | 380 | } |
| 377 | - | 381 | + |
| 378 | } | 382 | } |
| 379 | 383 | ||
| 380 | - function & newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) { | ||
| 381 | - $aInfo = array(); | 384 | + function & newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) { |
| 385 | + $aInfo = array(); | ||
| 382 | $aInfo['sData1'] = $oState->getName(); | 386 | $aInfo['sData1'] = $oState->getName(); |
| 383 | $aInfo['sData2'] = $sComments; | 387 | $aInfo['sData2'] = $sComments; |
| 384 | $aInfo['iData1'] = $oDocument->getId(); | 388 | $aInfo['iData1'] = $oDocument->getId(); |
| 385 | $aInfo['iData2'] = $oActor->getId(); | 389 | $aInfo['iData2'] = $oActor->getId(); |
| 386 | $aInfo['sType'] = 'ktcore/workflow'; | 390 | $aInfo['sType'] = 'ktcore/workflow'; |
| 387 | - $aInfo['dCreationDate'] = getCurrentDateTime(); | 391 | + $aInfo['dCreationDate'] = getCurrentDateTime(); |
| 388 | $aInfo['iUserId'] = $oUser->getId(); | 392 | $aInfo['iUserId'] = $oUser->getId(); |
| 389 | $aInfo['sLabel'] = $oDocument->getName(); | 393 | $aInfo['sLabel'] = $oDocument->getName(); |
| 390 | - | 394 | + |
| 391 | $oNotification = KTNotification::createFromArray($aInfo); | 395 | $oNotification = KTNotification::createFromArray($aInfo); |
| 392 | - | 396 | + |
| 393 | $handler = new KTWorkflowNotification(); | 397 | $handler = new KTWorkflowNotification(); |
| 394 | - | 398 | + |
| 395 | if ($oUser->getEmailNotification() && (strlen($oUser->getEmail()) > 0)) { | 399 | if ($oUser->getEmailNotification() && (strlen($oUser->getEmail()) > 0)) { |
| 396 | $emailContent = $handler->handleNotification($oNotification); | 400 | $emailContent = $handler->handleNotification($oNotification); |
| 397 | $emailSubject = sprintf(_kt('Workflow Notification: %s'), $oDocument->getName()); | 401 | $emailSubject = sprintf(_kt('Workflow Notification: %s'), $oDocument->getName()); |
| 398 | $oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent); | 402 | $oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent); |
| 399 | $oEmail->send(); | 403 | $oEmail->send(); |
| 400 | } | 404 | } |
| 401 | - | 405 | + |
| 402 | return $oNotification; | 406 | return $oNotification; |
| 403 | } | 407 | } |
| 404 | 408 | ||
| 405 | - function handleNotification($oKTNotification) { | 409 | + function handleNotification($oKTNotification) { |
| 406 | $oTemplating =& KTTemplating::getSingleton(); | 410 | $oTemplating =& KTTemplating::getSingleton(); |
| 407 | $oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/workflow_notification'); | 411 | $oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/workflow_notification'); |
| 408 | - | 412 | + |
| 409 | $oDoc = Document::get($oKTNotification->getIntData1()); | 413 | $oDoc = Document::get($oKTNotification->getIntData1()); |
| 410 | $isBroken = (PEAR::isError($oDoc) || ($oDoc->getStatusID() != LIVE)); | 414 | $isBroken = (PEAR::isError($oDoc) || ($oDoc->getStatusID() != LIVE)); |
| 411 | - | 415 | + |
| 412 | $oTemplate->setData(array( | 416 | $oTemplate->setData(array( |
| 413 | 'context' => $this, | 417 | 'context' => $this, |
| 414 | 'document_id' => $oKTNotification->getIntData1(), | 418 | 'document_id' => $oKTNotification->getIntData1(), |
| @@ -421,7 +425,7 @@ class KTWorkflowNotification extends KTNotificationHandler { | @@ -421,7 +425,7 @@ class KTWorkflowNotification extends KTNotificationHandler { | ||
| 421 | )); | 425 | )); |
| 422 | return $oTemplate->render(); | 426 | return $oTemplate->render(); |
| 423 | } | 427 | } |
| 424 | - | 428 | + |
| 425 | function resolveNotification($oKTNotification) { | 429 | function resolveNotification($oKTNotification) { |
| 426 | $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); | 430 | $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); |
| 427 | if ($notify_action == 'clear') { | 431 | if ($notify_action == 'clear') { |
| @@ -429,10 +433,10 @@ class KTWorkflowNotification extends KTNotificationHandler { | @@ -429,10 +433,10 @@ class KTWorkflowNotification extends KTNotificationHandler { | ||
| 429 | $oKTNotification->delete(); | 433 | $oKTNotification->delete(); |
| 430 | exit(redirect(generateControllerLink('dashboard'))); | 434 | exit(redirect(generateControllerLink('dashboard'))); |
| 431 | } | 435 | } |
| 432 | - | 436 | + |
| 433 | $params = 'fDocumentId=' . $oKTNotification->getIntData1(); | 437 | $params = 'fDocumentId=' . $oKTNotification->getIntData1(); |
| 434 | $url = generateControllerLink('viewDocument', $params); | 438 | $url = generateControllerLink('viewDocument', $params); |
| 435 | - $oKTNotification->delete(); // clear the alert. | 439 | + //$oKTNotification->delete(); // clear the alert. |
| 436 | exit(redirect($url)); | 440 | exit(redirect($url)); |
| 437 | } | 441 | } |
| 438 | } | 442 | } |
lib/documentmanagement/documentutil.inc.php
| @@ -10,32 +10,32 @@ | @@ -10,32 +10,32 @@ | ||
| 10 | * KnowledgeTree Open Source Edition | 10 | * KnowledgeTree Open Source Edition |
| 11 | * Document Management Made Simple | 11 | * Document Management Made Simple |
| 12 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 12 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 13 | - * | 13 | + * |
| 14 | * This program is free software; you can redistribute it and/or modify it under | 14 | * This program is free software; you can redistribute it and/or modify it under |
| 15 | * the terms of the GNU General Public License version 3 as published by the | 15 | * the terms of the GNU General Public License version 3 as published by the |
| 16 | * Free Software Foundation. | 16 | * Free Software Foundation. |
| 17 | - * | 17 | + * |
| 18 | * This program is distributed in the hope that it will be useful, but WITHOUT | 18 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 19 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 19 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 20 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 20 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 21 | * details. | 21 | * details. |
| 22 | - * | 22 | + * |
| 23 | * You should have received a copy of the GNU General Public License | 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 24 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 25 | - * | 25 | + * |
| 26 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 26 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 27 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | 27 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 28 | - * | 28 | + * |
| 29 | * The interactive user interfaces in modified source and object code versions | 29 | * The interactive user interfaces in modified source and object code versions |
| 30 | * of this program must display Appropriate Legal Notices, as required under | 30 | * of this program must display Appropriate Legal Notices, as required under |
| 31 | * Section 5 of the GNU General Public License version 3. | 31 | * Section 5 of the GNU General Public License version 3. |
| 32 | - * | 32 | + * |
| 33 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 33 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 34 | * these Appropriate Legal Notices must retain the display of the "Powered by | 34 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 35 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 35 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 36 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 36 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 37 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 38 | - * copyright notice. | 37 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 38 | + * copyright notice. | ||
| 39 | * Contributor( s): ______________________________________ | 39 | * Contributor( s): ______________________________________ |
| 40 | */ | 40 | */ |
| 41 | 41 | ||
| @@ -191,17 +191,17 @@ class KTDocumentUtil { | @@ -191,17 +191,17 @@ class KTDocumentUtil { | ||
| 191 | 191 | ||
| 192 | return true; | 192 | return true; |
| 193 | } | 193 | } |
| 194 | - | 194 | + |
| 195 | function archive($oDocument, $sReason) { | 195 | function archive($oDocument, $sReason) { |
| 196 | - | 196 | + |
| 197 | $this->startTransaction(); | 197 | $this->startTransaction(); |
| 198 | $oDocument->setStatusID(ARCHIVED); | 198 | $oDocument->setStatusID(ARCHIVED); |
| 199 | $res = $oDocument->update(); | 199 | $res = $oDocument->update(); |
| 200 | - | 200 | + |
| 201 | if (PEAR::isError($res) || ($res === false)) { | 201 | if (PEAR::isError($res) || ($res === false)) { |
| 202 | return PEAR::raiseError(_kt('There was a database error while trying to archive this file')); | 202 | return PEAR::raiseError(_kt('There was a database error while trying to archive this file')); |
| 203 | } | 203 | } |
| 204 | - | 204 | + |
| 205 | $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt('Document archived: %s'), $sReason), 'ktcore.transactions.update'); | 205 | $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt('Document archived: %s'), $sReason), 'ktcore.transactions.update'); |
| 206 | $oDocumentTransaction->create(); | 206 | $oDocumentTransaction->create(); |
| 207 | 207 | ||
| @@ -222,12 +222,12 @@ class KTDocumentUtil { | @@ -222,12 +222,12 @@ class KTDocumentUtil { | ||
| 222 | return $ret; | 222 | return $ret; |
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | - | 225 | + |
| 226 | // fire subscription alerts for the archived document | 226 | // fire subscription alerts for the archived document |
| 227 | $oSubscriptionEvent = new SubscriptionEvent(); | 227 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 228 | $oFolder = Folder::get($oDocument->getFolderID()); | 228 | $oFolder = Folder::get($oDocument->getFolderID()); |
| 229 | $oSubscriptionEvent->ArchivedDocument($oDocument, $oFolder); | 229 | $oSubscriptionEvent->ArchivedDocument($oDocument, $oFolder); |
| 230 | - | 230 | + |
| 231 | return true; | 231 | return true; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| @@ -904,6 +904,10 @@ class KTDocumentUtil { | @@ -904,6 +904,10 @@ class KTDocumentUtil { | ||
| 904 | $res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId()); | 904 | $res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId()); |
| 905 | if (PEAR::isError($res)) { return $res; } | 905 | if (PEAR::isError($res)) { return $res; } |
| 906 | 906 | ||
| 907 | + $oNewDocument->setIsCheckedOut(false); | ||
| 908 | + $oNewDocument->setCheckedOutUserID(-1); | ||
| 909 | + | ||
| 910 | + | ||
| 907 | // finally, copy the actual file. | 911 | // finally, copy the actual file. |
| 908 | $oStorage =& KTStorageManagerUtil::getSingleton(); | 912 | $oStorage =& KTStorageManagerUtil::getSingleton(); |
| 909 | $res = $oStorage->copy($oDocument, $oNewDocument); | 913 | $res = $oStorage->copy($oDocument, $oNewDocument); |
| @@ -967,7 +971,7 @@ class KTDocumentUtil { | @@ -967,7 +971,7 @@ class KTDocumentUtil { | ||
| 967 | return $ret; | 971 | return $ret; |
| 968 | } | 972 | } |
| 969 | } | 973 | } |
| 970 | - | 974 | + |
| 971 | // fire subscription alerts for the copied document | 975 | // fire subscription alerts for the copied document |
| 972 | $oSubscriptionEvent = new SubscriptionEvent(); | 976 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 973 | $oFolder = Folder::get($oDocument->getFolderID()); | 977 | $oFolder = Folder::get($oDocument->getFolderID()); |
| @@ -1077,7 +1081,7 @@ class KTDocumentUtil { | @@ -1077,7 +1081,7 @@ class KTDocumentUtil { | ||
| 1077 | return $ret; | 1081 | return $ret; |
| 1078 | } | 1082 | } |
| 1079 | } | 1083 | } |
| 1080 | - | 1084 | + |
| 1081 | // fire subscription alerts for the moved document | 1085 | // fire subscription alerts for the moved document |
| 1082 | $oSubscriptionEvent = new SubscriptionEvent(); | 1086 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 1083 | $oSubscriptionEvent->MoveDocument($oDocument, $oFolder, $oOriginalFolder); | 1087 | $oSubscriptionEvent->MoveDocument($oDocument, $oFolder, $oOriginalFolder); |
lib/documentmanagement/observers.inc.php
| @@ -70,9 +70,6 @@ class JavascriptObserver { | @@ -70,9 +70,6 @@ class JavascriptObserver { | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | function start() { | 72 | function start() { |
| 73 | - $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js'); | ||
| 74 | - $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js'); | ||
| 75 | - $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js'); | ||
| 76 | $this->context->oPage->requireJSResource('resources/js/add_document.js'); | 73 | $this->context->oPage->requireJSResource('resources/js/add_document.js'); |
| 77 | $this->context->oRedirector =& $this; | 74 | $this->context->oRedirector =& $this; |
| 78 | $this->context->handleOutput('<div id="kt-add-document-target"> </div>'); | 75 | $this->context->handleOutput('<div id="kt-add-document-target"> </div>'); |
lib/templating/kt3template.inc.php
| @@ -130,7 +130,7 @@ class KTPage { | @@ -130,7 +130,7 @@ class KTPage { | ||
| 130 | $aJS[] = 'thirdpartyjs/MochiKit/MochiKitPacked.js'; | 130 | $aJS[] = 'thirdpartyjs/MochiKit/MochiKitPacked.js'; |
| 131 | $aJS[] = 'resources/js/kt-utility.js'; | 131 | $aJS[] = 'resources/js/kt-utility.js'; |
| 132 | $aJS[] = 'presentation/i18nJavascript.php'; | 132 | $aJS[] = 'presentation/i18nJavascript.php'; |
| 133 | - $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners.inc.js'; | 133 | + $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners_lite.inc.js'; |
| 134 | $aJS[] = 'resources/js/loader.js'; | 134 | $aJS[] = 'resources/js/loader.js'; |
| 135 | $aJS[] = 'thirdpartyjs/yui/tools/tools.js'; | 135 | $aJS[] = 'thirdpartyjs/yui/tools/tools.js'; |
| 136 | $aJS[] = 'thirdpartyjs/yui/connection/connection.js'; | 136 | $aJS[] = 'thirdpartyjs/yui/connection/connection.js'; |
plugins/ktcore/KTBulkActions.php
| @@ -5,32 +5,32 @@ | @@ -5,32 +5,32 @@ | ||
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | 8 | + * |
| 9 | * This program is free software; you can redistribute it and/or modify it under | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | * the terms of the GNU General Public License version 3 as published by the | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | * Free Software Foundation. | 11 | * Free Software Foundation. |
| 12 | - * | 12 | + * |
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | * details. | 16 | * details. |
| 17 | - * | 17 | + * |
| 18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | 20 | + * |
| 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | 23 | + * |
| 24 | * The interactive user interfaces in modified source and object code versions | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | * of this program must display Appropriate Legal Notices, as required under | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | * Section 5 of the GNU General Public License version 3. | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | 27 | + * |
| 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | * these Appropriate Legal Notices must retain the display of the "Powered by | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | - * copyright notice. | 32 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 33 | + * copyright notice. | ||
| 34 | * Contributor( s): ______________________________________ | 34 | * Contributor( s): ______________________________________ |
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| @@ -484,9 +484,9 @@ class KTBulkArchiveAction extends KTBulkAction { | @@ -484,9 +484,9 @@ class KTBulkArchiveAction extends KTBulkAction { | ||
| 484 | 484 | ||
| 485 | function perform_action($oEntity) { | 485 | function perform_action($oEntity) { |
| 486 | if(is_a($oEntity, 'Document')) { | 486 | if(is_a($oEntity, 'Document')) { |
| 487 | - | 487 | + |
| 488 | $res = KTDocumentUtil::archive($oEntity, $this->sReason); | 488 | $res = KTDocumentUtil::archive($oEntity, $this->sReason); |
| 489 | - | 489 | + |
| 490 | if(PEAR::isError($res)){ | 490 | if(PEAR::isError($res)){ |
| 491 | return $res; | 491 | return $res; |
| 492 | } | 492 | } |
| @@ -530,9 +530,13 @@ class KTBulkArchiveAction extends KTBulkAction { | @@ -530,9 +530,13 @@ class KTBulkArchiveAction extends KTBulkAction { | ||
| 530 | if(!empty($aDocuments)){ | 530 | if(!empty($aDocuments)){ |
| 531 | foreach($aDocuments as $sDocumentId){ | 531 | foreach($aDocuments as $sDocumentId){ |
| 532 | $oDocument = Document::get($sDocumentId); | 532 | $oDocument = Document::get($sDocumentId); |
| 533 | - | ||
| 534 | - $res = KTDocumentUtil::archive($oEntity, $this->sReason); | ||
| 535 | - | 533 | + |
| 534 | + if(PEAR::isError($oDocument)){ | ||
| 535 | + return $oDocument; | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + $res = KTDocumentUtil::archive($oDocument, $this->sReason); | ||
| 539 | + | ||
| 536 | if(PEAR::isError($res)){ | 540 | if(PEAR::isError($res)){ |
| 537 | return $res; | 541 | return $res; |
| 538 | } | 542 | } |
| @@ -548,7 +552,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -548,7 +552,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 548 | var $_sPermission = 'ktcore.permissions.read'; | 552 | var $_sPermission = 'ktcore.permissions.read'; |
| 549 | var $_bMutator = true; | 553 | var $_bMutator = true; |
| 550 | var $bNotifications = true; | 554 | var $bNotifications = true; |
| 551 | - | 555 | + |
| 552 | function getDisplayName() { | 556 | function getDisplayName() { |
| 553 | return _kt('Export'); | 557 | return _kt('Export'); |
| 554 | } | 558 | } |
| @@ -580,7 +584,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -580,7 +584,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 580 | $this->startTransaction(); | 584 | $this->startTransaction(); |
| 581 | $oKTConfig =& KTConfig::getSingleton(); | 585 | $oKTConfig =& KTConfig::getSingleton(); |
| 582 | $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); | 586 | $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); |
| 583 | - | 587 | + |
| 584 | $this->bNotifications = ($oKTConfig->get('export/enablenotifications', 'on') == 'on') ? true : false; | 588 | $this->bNotifications = ($oKTConfig->get('export/enablenotifications', 'on') == 'on') ? true : false; |
| 585 | 589 | ||
| 586 | $result = parent::do_performaction(); | 590 | $result = parent::do_performaction(); |
| @@ -600,7 +604,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -600,7 +604,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 600 | )); | 604 | )); |
| 601 | 605 | ||
| 602 | $this->commitTransaction(); | 606 | $this->commitTransaction(); |
| 603 | - | 607 | + |
| 604 | $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode)); | 608 | $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode)); |
| 605 | $str = sprintf('<p>' . _kt('Go <a href="%s">here</a> to download the zip file if you are not automatically redirected there') . "</p>\n", $url); | 609 | $str = sprintf('<p>' . _kt('Go <a href="%s">here</a> to download the zip file if you are not automatically redirected there') . "</p>\n", $url); |
| 606 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); | 610 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); |
| @@ -611,9 +615,9 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -611,9 +615,9 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 611 | document.location.href = "%s"; | 615 | document.location.href = "%s"; |
| 612 | } | 616 | } |
| 613 | callLater(1, kt_bulkexport_redirect); | 617 | callLater(1, kt_bulkexport_redirect); |
| 614 | - | 618 | + |
| 615 | </script>', $url); | 619 | </script>', $url); |
| 616 | - | 620 | + |
| 617 | return $str; | 621 | return $str; |
| 618 | } | 622 | } |
| 619 | 623 | ||
| @@ -627,14 +631,14 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -627,14 +631,14 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 627 | $oDocumentTransaction = new DocumentTransaction($oDocument, "Document part of bulk export", 'ktstandard.transactions.bulk_export', array()); | 631 | $oDocumentTransaction = new DocumentTransaction($oDocument, "Document part of bulk export", 'ktstandard.transactions.bulk_export', array()); |
| 628 | $oDocumentTransaction->create(); | 632 | $oDocumentTransaction->create(); |
| 629 | } | 633 | } |
| 630 | - | 634 | + |
| 631 | // fire subscription alerts for the downloaded document - if global config is set | 635 | // fire subscription alerts for the downloaded document - if global config is set |
| 632 | if($this->bNotifications){ | 636 | if($this->bNotifications){ |
| 633 | $oSubscriptionEvent = new SubscriptionEvent(); | 637 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 634 | $oFolder = Folder::get($oDocument->getFolderID()); | 638 | $oFolder = Folder::get($oDocument->getFolderID()); |
| 635 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); | 639 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); |
| 636 | } | 640 | } |
| 637 | - | 641 | + |
| 638 | $this->oZip->addDocumentToZip($oDocument); | 642 | $this->oZip->addDocumentToZip($oDocument); |
| 639 | 643 | ||
| 640 | }else if(is_a($oEntity, 'Folder')) { | 644 | }else if(is_a($oEntity, 'Folder')) { |
| @@ -695,12 +699,12 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -695,12 +699,12 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 695 | 699 | ||
| 696 | function do_downloadZipFile() { | 700 | function do_downloadZipFile() { |
| 697 | $sCode = $this->oValidator->validateString($_REQUEST['exportcode']); | 701 | $sCode = $this->oValidator->validateString($_REQUEST['exportcode']); |
| 698 | - | 702 | + |
| 699 | $folderName = $this->oFolder->getName(); | 703 | $folderName = $this->oFolder->getName(); |
| 700 | $this->oZip = new ZipFolder($folderName); | 704 | $this->oZip = new ZipFolder($folderName); |
| 701 | - | 705 | + |
| 702 | $res = $this->oZip->downloadZipFile($sCode); | 706 | $res = $this->oZip->downloadZipFile($sCode); |
| 703 | - | 707 | + |
| 704 | if(PEAR::isError($res)){ | 708 | if(PEAR::isError($res)){ |
| 705 | $this->addErrorMessage($res->getMessage()); | 709 | $this->addErrorMessage($res->getMessage()); |
| 706 | redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); | 710 | redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); |
| @@ -798,7 +802,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | @@ -798,7 +802,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | ||
| 798 | 802 | ||
| 799 | $oKTConfig =& KTConfig::getSingleton(); | 803 | $oKTConfig =& KTConfig::getSingleton(); |
| 800 | $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); | 804 | $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); |
| 801 | - | 805 | + |
| 802 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); | 806 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); |
| 803 | $sReturn = sprintf('<p>' . _kt('Return to the original <a href="%s">folder</a>') . "</p>\n", $folderurl); | 807 | $sReturn = sprintf('<p>' . _kt('Return to the original <a href="%s">folder</a>') . "</p>\n", $folderurl); |
| 804 | 808 | ||
| @@ -809,7 +813,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | @@ -809,7 +813,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | ||
| 809 | $folderName = $this->oFolder->getName(); | 813 | $folderName = $this->oFolder->getName(); |
| 810 | $this->oZip = new ZipFolder($folderName); | 814 | $this->oZip = new ZipFolder($folderName); |
| 811 | $res = $this->oZip->checkConvertEncoding(); | 815 | $res = $this->oZip->checkConvertEncoding(); |
| 812 | - | 816 | + |
| 813 | if(PEAR::isError($res)){ | 817 | if(PEAR::isError($res)){ |
| 814 | $this->addErrorMessage($res->getMessage()); | 818 | $this->addErrorMessage($res->getMessage()); |
| 815 | return $sReturn; | 819 | return $sReturn; |
| @@ -836,7 +840,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | @@ -836,7 +840,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | ||
| 836 | $this->commitTransaction(); | 840 | $this->commitTransaction(); |
| 837 | 841 | ||
| 838 | if($this->bDownload){ | 842 | if($this->bDownload){ |
| 839 | - | 843 | + |
| 840 | $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode)); | 844 | $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode)); |
| 841 | $str = sprintf('<p>' . _kt('Go <a href="%s">here</a> to download the zip file if you are not automatically redirected there') . "</p>\n", $url); | 845 | $str = sprintf('<p>' . _kt('Go <a href="%s">here</a> to download the zip file if you are not automatically redirected there') . "</p>\n", $url); |
| 842 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); | 846 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); |
| @@ -847,9 +851,9 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | @@ -847,9 +851,9 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | ||
| 847 | document.location.href = "%s"; | 851 | document.location.href = "%s"; |
| 848 | } | 852 | } |
| 849 | callLater(1, kt_bulkexport_redirect); | 853 | callLater(1, kt_bulkexport_redirect); |
| 850 | - | 854 | + |
| 851 | </script>', $url); | 855 | </script>', $url); |
| 852 | - | 856 | + |
| 853 | return $str; | 857 | return $str; |
| 854 | } | 858 | } |
| 855 | return $result; | 859 | return $result; |
| @@ -938,15 +942,15 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | @@ -938,15 +942,15 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | ||
| 938 | } | 942 | } |
| 939 | return true; | 943 | return true; |
| 940 | } | 944 | } |
| 941 | - | 945 | + |
| 942 | function do_downloadZipFile() { | 946 | function do_downloadZipFile() { |
| 943 | $sCode = $this->oValidator->validateString($_REQUEST['exportcode']); | 947 | $sCode = $this->oValidator->validateString($_REQUEST['exportcode']); |
| 944 | - | 948 | + |
| 945 | $folderName = $this->oFolder->getName(); | 949 | $folderName = $this->oFolder->getName(); |
| 946 | $this->oZip = new ZipFolder($folderName); | 950 | $this->oZip = new ZipFolder($folderName); |
| 947 | - | 951 | + |
| 948 | $res = $this->oZip->downloadZipFile($sCode); | 952 | $res = $this->oZip->downloadZipFile($sCode); |
| 949 | - | 953 | + |
| 950 | if(PEAR::isError($res)){ | 954 | if(PEAR::isError($res)){ |
| 951 | $this->addErrorMessage($res->getMessage()); | 955 | $this->addErrorMessage($res->getMessage()); |
| 952 | redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); | 956 | redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); |
plugins/ktcore/admin/documentFieldsv2.php
| @@ -6,32 +6,32 @@ | @@ -6,32 +6,32 @@ | ||
| 6 | * KnowledgeTree Open Source Edition | 6 | * KnowledgeTree Open Source Edition |
| 7 | * Document Management Made Simple | 7 | * Document Management Made Simple |
| 8 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 8 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 9 | - * | 9 | + * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License version 3 as published by the | 11 | * the terms of the GNU General Public License version 3 as published by the |
| 12 | * Free Software Foundation. | 12 | * Free Software Foundation. |
| 13 | - * | 13 | + * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 17 | * details. | 17 | * details. |
| 18 | - * | 18 | + * |
| 19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | - * | 21 | + * |
| 22 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 22 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 23 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | 23 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 24 | - * | 24 | + * |
| 25 | * The interactive user interfaces in modified source and object code versions | 25 | * The interactive user interfaces in modified source and object code versions |
| 26 | * of this program must display Appropriate Legal Notices, as required under | 26 | * of this program must display Appropriate Legal Notices, as required under |
| 27 | * Section 5 of the GNU General Public License version 3. | 27 | * Section 5 of the GNU General Public License version 3. |
| 28 | - * | 28 | + * |
| 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 30 | * these Appropriate Legal Notices must retain the display of the "Powered by | 30 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | - * copyright notice. | 33 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 34 | + * copyright notice. | ||
| 35 | * Contributor( s): ______________________________________ | 35 | * Contributor( s): ______________________________________ |
| 36 | * | 36 | * |
| 37 | */ | 37 | */ |
| @@ -49,7 +49,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -49,7 +49,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 49 | function predispatch() { | 49 | function predispatch() { |
| 50 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Field Management')); | 50 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Field Management')); |
| 51 | $this->persistParams(array('fFieldsetId')); | 51 | $this->persistParams(array('fFieldsetId')); |
| 52 | - | 52 | + |
| 53 | $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); | 53 | $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); |
| 54 | if (PEAR::isError($this->oFieldset)) { | 54 | if (PEAR::isError($this->oFieldset)) { |
| 55 | $this->oFieldset = null; | 55 | $this->oFieldset = null; |
| @@ -63,7 +63,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -63,7 +63,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 63 | 63 | ||
| 64 | function do_main () { | 64 | function do_main () { |
| 65 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/list'); | 65 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/list'); |
| 66 | - | 66 | + |
| 67 | $oTemplate->setData(array( | 67 | $oTemplate->setData(array( |
| 68 | 'context' => $this, | 68 | 'context' => $this, |
| 69 | 'fieldsets' => KTFieldset::getList('disabled != true'), | 69 | 'fieldsets' => KTFieldset::getList('disabled != true'), |
| @@ -80,10 +80,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -80,10 +80,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 80 | 'cancel_action' => 'main', | 80 | 'cancel_action' => 'main', |
| 81 | 'fail_action' => 'newfieldset', | 81 | 'fail_action' => 'newfieldset', |
| 82 | 'action' => 'create', | 82 | 'action' => 'create', |
| 83 | - 'context' => $this, | 83 | + 'context' => $this, |
| 84 | )); | 84 | )); |
| 85 | - | ||
| 86 | - | 85 | + |
| 86 | + | ||
| 87 | // construct the widget set. | 87 | // construct the widget set. |
| 88 | // we use a slight variation here, because "type" is only present in certain circumstances. | 88 | // we use a slight variation here, because "type" is only present in certain circumstances. |
| 89 | $widgets = array( | 89 | $widgets = array( |
| @@ -98,16 +98,16 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -98,16 +98,16 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 98 | 'name' => 'description', | 98 | 'name' => 'description', |
| 99 | 'required' => true, | 99 | 'required' => true, |
| 100 | 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), | 100 | 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), |
| 101 | - )), | 101 | + )), |
| 102 | ); | 102 | ); |
| 103 | if ($this->bHaveConditional) { | 103 | if ($this->bHaveConditional) { |
| 104 | - | 104 | + |
| 105 | // FIXME get this from some external source. | 105 | // FIXME get this from some external source. |
| 106 | $type_vocab = array( | 106 | $type_vocab = array( |
| 107 | 'normal' => _kt("Normal"), | 107 | 'normal' => _kt("Normal"), |
| 108 | - 'conditional' => _kt("Conditional"), | 108 | + 'conditional' => _kt("Conditional"), |
| 109 | ); | 109 | ); |
| 110 | - | 110 | + |
| 111 | $widgets[] = array('ktcore.widgets.selection', array( | 111 | $widgets[] = array('ktcore.widgets.selection', array( |
| 112 | 'label' => _kt("Fieldset Type"), | 112 | 'label' => _kt("Fieldset Type"), |
| 113 | 'use_simple' => false, | 113 | 'use_simple' => false, |
| @@ -119,20 +119,20 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -119,20 +119,20 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 119 | 'vocab' => $type_vocab, | 119 | 'vocab' => $type_vocab, |
| 120 | )); | 120 | )); |
| 121 | } | 121 | } |
| 122 | - | 122 | + |
| 123 | $widgets[] = array('ktcore.widgets.boolean',array( | 123 | $widgets[] = array('ktcore.widgets.boolean',array( |
| 124 | 'label' => _kt("Generic"), | 124 | 'label' => _kt("Generic"), |
| 125 | 'name' => 'generic', | 125 | 'name' => 'generic', |
| 126 | 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), | 126 | 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), |
| 127 | )); | 127 | )); |
| 128 | - | 128 | + |
| 129 | $oForm->setWidgets($widgets); | 129 | $oForm->setWidgets($widgets); |
| 130 | - | 130 | + |
| 131 | // similarly, we construct validators here. | 131 | // similarly, we construct validators here. |
| 132 | $validators = array( | 132 | $validators = array( |
| 133 | array('ktcore.validators.string', array( | 133 | array('ktcore.validators.string', array( |
| 134 | 'test' => 'name', | 134 | 'test' => 'name', |
| 135 | - 'output' => 'name', | 135 | + 'output' => 'name', |
| 136 | )), | 136 | )), |
| 137 | array('ktcore.validators.string', array( | 137 | array('ktcore.validators.string', array( |
| 138 | 'test' => 'description', | 138 | 'test' => 'description', |
| @@ -143,65 +143,65 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -143,65 +143,65 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 143 | 'output' => 'generic', | 143 | 'output' => 'generic', |
| 144 | )), | 144 | )), |
| 145 | ); | 145 | ); |
| 146 | - | 146 | + |
| 147 | if ($this->bHaveConditional) { | 147 | if ($this->bHaveConditional) { |
| 148 | $validators[] = array('ktcore.validators.string', array( | 148 | $validators[] = array('ktcore.validators.string', array( |
| 149 | 'test' => 'fieldset_type', | 149 | 'test' => 'fieldset_type', |
| 150 | 'output' => 'fieldset_type', | 150 | 'output' => 'fieldset_type', |
| 151 | )); | 151 | )); |
| 152 | } | 152 | } |
| 153 | - | 153 | + |
| 154 | $oForm->setValidators($validators); | 154 | $oForm->setValidators($validators); |
| 155 | - | 155 | + |
| 156 | return $oForm; | 156 | return $oForm; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | function do_newfieldset() { | 159 | function do_newfieldset() { |
| 160 | $this->oPage->setBreadcrumbDetails(_kt("Create New Fieldset")); | 160 | $this->oPage->setBreadcrumbDetails(_kt("Create New Fieldset")); |
| 161 | $oForm = $this->form_create(); | 161 | $oForm = $this->form_create(); |
| 162 | - | 162 | + |
| 163 | return $oForm->render(); | 163 | return $oForm->render(); |
| 164 | } | 164 | } |
| 165 | - | 165 | + |
| 166 | function do_create() { | 166 | function do_create() { |
| 167 | $oForm = $this->form_create(); | 167 | $oForm = $this->form_create(); |
| 168 | $res = $oForm->validate(); | 168 | $res = $oForm->validate(); |
| 169 | - | 169 | + |
| 170 | $data = $res['results']; | 170 | $data = $res['results']; |
| 171 | $errors = $res['errors']; | 171 | $errors = $res['errors']; |
| 172 | $extra_errors = array(); | 172 | $extra_errors = array(); |
| 173 | - | 173 | + |
| 174 | if (!empty($data['name'])) { | 174 | if (!empty($data['name'])) { |
| 175 | $oFieldset = KTFieldset::getByName($data['name']); | 175 | $oFieldset = KTFieldset::getByName($data['name']); |
| 176 | if (!PEAR::isError($oFieldset)) { | 176 | if (!PEAR::isError($oFieldset)) { |
| 177 | // means we're looking at an existing name | 177 | // means we're looking at an existing name |
| 178 | $extra_errors['name'] = _kt("There is already a fieldset with that name."); | 178 | $extra_errors['name'] = _kt("There is already a fieldset with that name."); |
| 179 | - } | 179 | + } |
| 180 | } | 180 | } |
| 181 | - | 181 | + |
| 182 | $is_conditional = false; | 182 | $is_conditional = false; |
| 183 | // FIXME this is inelegant. get it from somewhere else. | 183 | // FIXME this is inelegant. get it from somewhere else. |
| 184 | if ($this->bHaveConditional && ($data['fieldset_type'] == 'conditional')) { | 184 | if ($this->bHaveConditional && ($data['fieldset_type'] == 'conditional')) { |
| 185 | $is_conditional = true; | 185 | $is_conditional = true; |
| 186 | } | 186 | } |
| 187 | - | ||
| 188 | - | 187 | + |
| 188 | + | ||
| 189 | if (!empty($errors) || !empty($extra_errors)) { | 189 | if (!empty($errors) || !empty($extra_errors)) { |
| 190 | return $oForm->handleError(null, $extra_errors); | 190 | return $oForm->handleError(null, $extra_errors); |
| 191 | } | 191 | } |
| 192 | - | 192 | + |
| 193 | // we also need a namespace. | 193 | // we also need a namespace. |
| 194 | $temp_name = $data['name']; | 194 | $temp_name = $data['name']; |
| 195 | $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); | 195 | $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); |
| 196 | $oOldFieldset = KTFieldset::getByNamespace($namespace); | 196 | $oOldFieldset = KTFieldset::getByNamespace($namespace); |
| 197 | - | 197 | + |
| 198 | while (!PEAR::isError($oOldFieldset)) { | 198 | while (!PEAR::isError($oOldFieldset)) { |
| 199 | $temp_name .= '_'; | 199 | $temp_name .= '_'; |
| 200 | $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); | 200 | $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); |
| 201 | - $oOldFieldset = KTFieldset::getByNamespace($namespace); | 201 | + $oOldFieldset = KTFieldset::getByNamespace($namespace); |
| 202 | } | 202 | } |
| 203 | - | ||
| 204 | - // we now know its a non-conflicting one. | 203 | + |
| 204 | + // we now know its a non-conflicting one. | ||
| 205 | // FIXME handle conditional fieldsets, which should be ... a different object. | 205 | // FIXME handle conditional fieldsets, which should be ... a different object. |
| 206 | $oFieldset = KTFieldset::createFromArray(array( | 206 | $oFieldset = KTFieldset::createFromArray(array( |
| 207 | "name" => $data['name'], | 207 | "name" => $data['name'], |
| @@ -212,29 +212,29 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -212,29 +212,29 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 212 | "isGeneric" => $data['generic'], | 212 | "isGeneric" => $data['generic'], |
| 213 | "isComplete" => false, | 213 | "isComplete" => false, |
| 214 | "isComplex" => false, | 214 | "isComplex" => false, |
| 215 | - "isSystem" => false, | 215 | + "isSystem" => false, |
| 216 | )); | 216 | )); |
| 217 | if (PEAR::isError($oFieldset)) { | 217 | if (PEAR::isError($oFieldset)) { |
| 218 | return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage())); | 218 | return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage())); |
| 219 | } | 219 | } |
| 220 | - | 220 | + |
| 221 | $this->successRedirectTo('edit',_kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId())); | 221 | $this->successRedirectTo('edit',_kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId())); |
| 222 | - } | 222 | + } |
| 223 | 223 | ||
| 224 | function getTypesForFieldset($oFieldset) { | 224 | function getTypesForFieldset($oFieldset) { |
| 225 | if ($oFieldset->getIsGeneric()) { | 225 | if ($oFieldset->getIsGeneric()) { |
| 226 | return _kt('All types use this generic fieldset.'); | 226 | return _kt('All types use this generic fieldset.'); |
| 227 | } | 227 | } |
| 228 | - | 228 | + |
| 229 | $types = $oFieldset->getAssociatedTypes(); | 229 | $types = $oFieldset->getAssociatedTypes(); |
| 230 | if (PEAR::isError($types)) { | 230 | if (PEAR::isError($types)) { |
| 231 | return _kt('Error retrieving list of types.'); | 231 | return _kt('Error retrieving list of types.'); |
| 232 | } | 232 | } |
| 233 | - if (empty($types)) { | 233 | + if (empty($types)) { |
| 234 | return _kt('None'); | 234 | return _kt('None'); |
| 235 | } | 235 | } |
| 236 | $aNames = array(); | 236 | $aNames = array(); |
| 237 | - foreach ($types as $oType) { | 237 | + foreach ($types as $oType) { |
| 238 | if (!PEAR::isError($oType)) { | 238 | if (!PEAR::isError($oType)) { |
| 239 | $aNames[] = $oType->getName(); | 239 | $aNames[] = $oType->getName(); |
| 240 | } | 240 | } |
| @@ -247,30 +247,30 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -247,30 +247,30 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 247 | // here we engage in some major evil. | 247 | // here we engage in some major evil. |
| 248 | // we check for the subevent var | 248 | // we check for the subevent var |
| 249 | // and subdispatch if appropriate. | 249 | // and subdispatch if appropriate. |
| 250 | - // | 250 | + // |
| 251 | // saves a little code-duplication (actually, a lot of code-duplication) | 251 | // saves a little code-duplication (actually, a lot of code-duplication) |
| 252 | - | 252 | + |
| 253 | // FIXME this is essentially a stub for the fieldset-delegation code. | 253 | // FIXME this is essentially a stub for the fieldset-delegation code. |
| 254 | if ($this->oFieldset->getIsConditional()) { | 254 | if ($this->oFieldset->getIsConditional()) { |
| 255 | require_once('fieldsets/conditional.inc.php'); | 255 | require_once('fieldsets/conditional.inc.php'); |
| 256 | - $oSubDispatcher = new ConditionalFieldsetManagementDispatcher; | 256 | + $oSubDispatcher = new ConditionalFieldsetManagementDispatcher; |
| 257 | } else { | 257 | } else { |
| 258 | require_once('fieldsets/basic.inc.php'); | 258 | require_once('fieldsets/basic.inc.php'); |
| 259 | $oSubDispatcher = new BasicFieldsetManagementDispatcher; | 259 | $oSubDispatcher = new BasicFieldsetManagementDispatcher; |
| 260 | } | 260 | } |
| 261 | - | 261 | + |
| 262 | $subevent_var = 'fieldset_action'; | 262 | $subevent_var = 'fieldset_action'; |
| 263 | $subevent = KTUtil::arrayGet($_REQUEST, $subevent_var); | 263 | $subevent = KTUtil::arrayGet($_REQUEST, $subevent_var); |
| 264 | if (!empty($subevent)) { | 264 | if (!empty($subevent)) { |
| 265 | // do nothing, since this will handle everything | 265 | // do nothing, since this will handle everything |
| 266 | $this_url = KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")); | 266 | $this_url = KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")); |
| 267 | - $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url); | 267 | + $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url); |
| 268 | exit(0); | 268 | exit(0); |
| 269 | } else { | 269 | } else { |
| 270 | // what we want is the "additional info" section | 270 | // what we want is the "additional info" section |
| 271 | $additional = $oSubDispatcher->describe_fieldset($this->oFieldset); | 271 | $additional = $oSubDispatcher->describe_fieldset($this->oFieldset); |
| 272 | } | 272 | } |
| 273 | - | 273 | + |
| 274 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/edit'); | 274 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/edit'); |
| 275 | $oTemplate->setData(array( | 275 | $oTemplate->setData(array( |
| 276 | 'context' => $this, | 276 | 'context' => $this, |
| @@ -279,9 +279,19 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -279,9 +279,19 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 279 | )); | 279 | )); |
| 280 | return $oTemplate->render(); | 280 | return $oTemplate->render(); |
| 281 | } | 281 | } |
| 282 | - | 282 | + |
| 283 | function do_delete() { | 283 | function do_delete() { |
| 284 | $this->startTransaction(); | 284 | $this->startTransaction(); |
| 285 | + | ||
| 286 | + // check if fieldset is associated with a document type - remove association | ||
| 287 | + $types = $this->oFieldset->getAssociatedTypes(); | ||
| 288 | + $sFieldSetId = $this->oFieldset->getId(); | ||
| 289 | + if(!PEAR::isError($types) AND !empty($types)){ | ||
| 290 | + foreach($types as $oType){ | ||
| 291 | + $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $sFieldSetId); | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + | ||
| 285 | $res = $this->oFieldset->delete('true'); | 295 | $res = $this->oFieldset->delete('true'); |
| 286 | $this->oValidator->notErrorFalse($res, array( | 296 | $this->oValidator->notErrorFalse($res, array( |
| 287 | 'redirect_to' => array('main', ''), | 297 | 'redirect_to' => array('main', ''), |
| @@ -289,7 +299,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -289,7 +299,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 289 | )); | 299 | )); |
| 290 | $this->successRedirectToMain(_kt('Fieldset deleted')); | 300 | $this->successRedirectToMain(_kt('Fieldset deleted')); |
| 291 | } | 301 | } |
| 292 | - | 302 | + |
| 293 | function form_edit() { | 303 | function form_edit() { |
| 294 | $oForm = new KTForm; | 304 | $oForm = new KTForm; |
| 295 | $oForm->setOptions(array( | 305 | $oForm->setOptions(array( |
| @@ -299,10 +309,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -299,10 +309,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 299 | 'cancel_action' => 'edit', | 309 | 'cancel_action' => 'edit', |
| 300 | 'fail_action' => 'editfieldset', | 310 | 'fail_action' => 'editfieldset', |
| 301 | 'action' => 'savefieldset', | 311 | 'action' => 'savefieldset', |
| 302 | - 'context' => $this, | 312 | + 'context' => $this, |
| 303 | )); | 313 | )); |
| 304 | - | ||
| 305 | - | 314 | + |
| 315 | + | ||
| 306 | // construct the widget set. | 316 | // construct the widget set. |
| 307 | // we use a slight variation here, because "type" is only present in certain circumstances. | 317 | // we use a slight variation here, because "type" is only present in certain circumstances. |
| 308 | $widgets = array( | 318 | $widgets = array( |
| @@ -318,24 +328,24 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -318,24 +328,24 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 318 | 'name' => 'description', | 328 | 'name' => 'description', |
| 319 | 'required' => true, | 329 | 'required' => true, |
| 320 | 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), | 330 | 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), |
| 321 | - 'value' => sanitizeForHTML($this->oFieldset->getDescription()), | ||
| 322 | - )), | 331 | + 'value' => sanitizeForHTML($this->oFieldset->getDescription()), |
| 332 | + )), | ||
| 323 | ); | 333 | ); |
| 324 | - | 334 | + |
| 325 | $widgets[] = array('ktcore.widgets.boolean',array( | 335 | $widgets[] = array('ktcore.widgets.boolean',array( |
| 326 | 'label' => _kt("Generic"), | 336 | 'label' => _kt("Generic"), |
| 327 | 'name' => 'generic', | 337 | 'name' => 'generic', |
| 328 | 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), | 338 | 'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."), |
| 329 | - 'value' => $this->oFieldset->getIsGeneric(), | 339 | + 'value' => $this->oFieldset->getIsGeneric(), |
| 330 | )); | 340 | )); |
| 331 | - | 341 | + |
| 332 | $oForm->setWidgets($widgets); | 342 | $oForm->setWidgets($widgets); |
| 333 | - | 343 | + |
| 334 | // similarly, we construct validators here. | 344 | // similarly, we construct validators here. |
| 335 | $validators = array( | 345 | $validators = array( |
| 336 | array('ktcore.validators.string', array( | 346 | array('ktcore.validators.string', array( |
| 337 | 'test' => 'name', | 347 | 'test' => 'name', |
| 338 | - 'output' => 'name', | 348 | + 'output' => 'name', |
| 339 | )), | 349 | )), |
| 340 | array('ktcore.validators.string', array( | 350 | array('ktcore.validators.string', array( |
| 341 | 'test' => 'description', | 351 | 'test' => 'description', |
| @@ -346,22 +356,22 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -346,22 +356,22 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 346 | 'output' => 'generic', | 356 | 'output' => 'generic', |
| 347 | )), | 357 | )), |
| 348 | ); | 358 | ); |
| 349 | - | 359 | + |
| 350 | $oForm->setValidators($validators); | 360 | $oForm->setValidators($validators); |
| 351 | - | 361 | + |
| 352 | return $oForm; | 362 | return $oForm; |
| 353 | } | 363 | } |
| 354 | - | ||
| 355 | - function do_editfieldset() { | 364 | + |
| 365 | + function do_editfieldset() { | ||
| 356 | $oForm = $this->form_edit(); | 366 | $oForm = $this->form_edit(); |
| 357 | $this->oPage->setBreadcrumbDetails(_kt('edit fieldset')); | 367 | $this->oPage->setBreadcrumbDetails(_kt('edit fieldset')); |
| 358 | return $oForm->renderPage(_kt("Edit Fieldset")); | 368 | return $oForm->renderPage(_kt("Edit Fieldset")); |
| 359 | } | 369 | } |
| 360 | - | ||
| 361 | - function do_savefieldset() { | 370 | + |
| 371 | + function do_savefieldset() { | ||
| 362 | $oForm = $this->form_edit(); | 372 | $oForm = $this->form_edit(); |
| 363 | $res = $oForm->validate(); | 373 | $res = $oForm->validate(); |
| 364 | - | 374 | + |
| 365 | $data = $res['results']; | 375 | $data = $res['results']; |
| 366 | $errors = $res['errors']; | 376 | $errors = $res['errors']; |
| 367 | $extra_errors = array(); | 377 | $extra_errors = array(); |
| @@ -371,18 +381,18 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -371,18 +381,18 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 371 | $extra_errors['name'][] = _kt("A fieldset with that name already exists."); | 381 | $extra_errors['name'][] = _kt("A fieldset with that name already exists."); |
| 372 | } | 382 | } |
| 373 | } | 383 | } |
| 374 | - | 384 | + |
| 375 | if (!empty($errors) || !empty($extra_errors)) { | 385 | if (!empty($errors) || !empty($extra_errors)) { |
| 376 | return $oForm->handleError(null, $extra_errors); | 386 | return $oForm->handleError(null, $extra_errors); |
| 377 | } | 387 | } |
| 378 | - | 388 | + |
| 379 | $this->startTransaction(); | 389 | $this->startTransaction(); |
| 380 | - | 390 | + |
| 381 | $this->oFieldset->setName($data['name']); | 391 | $this->oFieldset->setName($data['name']); |
| 382 | - $this->oFieldset->setDescription($data['description']); | 392 | + $this->oFieldset->setDescription($data['description']); |
| 383 | $bGeneric = $data['generic']; | 393 | $bGeneric = $data['generic']; |
| 384 | if ($bGeneric != $this->oFieldset->getIsGeneric() && $bGeneric == true) { | 394 | if ($bGeneric != $this->oFieldset->getIsGeneric() && $bGeneric == true) { |
| 385 | - // delink it from all doctypes. | 395 | + // delink it from all doctypes. |
| 386 | $aTypes = $this->oFieldset->getAssociatedTypes(); | 396 | $aTypes = $this->oFieldset->getAssociatedTypes(); |
| 387 | foreach ($aTypes as $oType) { | 397 | foreach ($aTypes as $oType) { |
| 388 | $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $this->oFieldset->getId()); | 398 | $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $this->oFieldset->getId()); |
| @@ -392,17 +402,17 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | @@ -392,17 +402,17 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { | ||
| 392 | } | 402 | } |
| 393 | } | 403 | } |
| 394 | } | 404 | } |
| 395 | - | ||
| 396 | - $this->oFieldset->setIsGeneric($data['generic']); | ||
| 397 | - | 405 | + |
| 406 | + $this->oFieldset->setIsGeneric($data['generic']); | ||
| 407 | + | ||
| 398 | $res = $this->oFieldset->update(); | 408 | $res = $this->oFieldset->update(); |
| 399 | if (PEAR::isError($res)) { | 409 | if (PEAR::isError($res)) { |
| 400 | $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); | 410 | $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); |
| 401 | exit(0); | 411 | exit(0); |
| 402 | } | 412 | } |
| 403 | - | 413 | + |
| 404 | return $this->successRedirectTo('edit', _kt("Fieldset details updated.")); | 414 | return $this->successRedirectTo('edit', _kt("Fieldset details updated.")); |
| 405 | - } | 415 | + } |
| 406 | } | 416 | } |
| 407 | 417 | ||
| 408 | ?> | 418 | ?> |
plugins/ktcore/admin/fieldsets/basic.inc.php
| @@ -608,8 +608,6 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { | @@ -608,8 +608,6 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { | ||
| 608 | $renderedTree = $this->_evilTreeRenderer($fieldTree); | 608 | $renderedTree = $this->_evilTreeRenderer($fieldTree); |
| 609 | 609 | ||
| 610 | $this->oPage->setTitle(_kt('Edit Lookup Tree')); | 610 | $this->oPage->setTitle(_kt('Edit Lookup Tree')); |
| 611 | - | ||
| 612 | - //$this->oPage->requireJSResource('thirdparty/js/MochiKit/Base.js'); | ||
| 613 | 611 | ||
| 614 | if ($current_node == 0) { $category_name = 'Root'; } | 612 | if ($current_node == 0) { $category_name = 'Root'; } |
| 615 | else { | 613 | else { |
plugins/ktstandard/KTBulkExportPlugin.php
| @@ -106,8 +106,6 @@ class KTBulkExportAction extends KTFolderAction { | @@ -106,8 +106,6 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 106 | exit(0); | 106 | exit(0); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | - $this->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js'); | ||
| 110 | - $this->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js'); | ||
| 111 | $this->oPage->template = "kt3/minimal_page"; | 109 | $this->oPage->template = "kt3/minimal_page"; |
| 112 | $this->handleOutput(""); | 110 | $this->handleOutput(""); |
| 113 | 111 |
sql/mysql/install/rebuild.bat
| @@ -14,7 +14,7 @@ mysqladmin -u root -p -f drop %INPUT% | @@ -14,7 +14,7 @@ mysqladmin -u root -p -f drop %INPUT% | ||
| 14 | ECHO ---- Creating database %INPUT% ---- | 14 | ECHO ---- Creating database %INPUT% ---- |
| 15 | mysqladmin -u root -p create %INPUT% | 15 | mysqladmin -u root -p create %INPUT% |
| 16 | ECHO ---- Creating structure for database %INPUT% ---- | 16 | ECHO ---- Creating structure for database %INPUT% ---- |
| 17 | -mysql -u root %INPUT%<structure.sql | 17 | +mysql -u root -p %INPUT%<structure.sql |
| 18 | ECHO ---- Inserting data into database %INPUT% ---- | 18 | ECHO ---- Inserting data into database %INPUT% ---- |
| 19 | mysql -u root -p %INPUT%< data.sql | 19 | mysql -u root -p %INPUT%< data.sql |
| 20 | ECHO ---- Creating user information for database %INPUT% ---- | 20 | ECHO ---- Creating user information for database %INPUT% ---- |
templates/kt3/document/edit.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | - | ||
| 7 | <!-- unforunate, but (currently) necessary --> | 1 | <!-- unforunate, but (currently) necessary --> |
| 8 | 2 | ||
| 9 | {$context->oPage->requireJSResource('resources/js/taillog.js')} | 3 | {$context->oPage->requireJSResource('resources/js/taillog.js')} |
templates/kt3/notifications/subscriptions.AddDocument.smarty
| 1 | <dt class="actionitem subscription">{$info.title|sanitize}</dt> | 1 | <dt class="actionitem subscription">{$info.title|sanitize}</dt> |
| 2 | <dd class="actionmessage"> | 2 | <dd class="actionmessage"> |
| 3 | + | ||
| 3 | <!-- could break this up. --> | 4 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" was added{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}to "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 5 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" was added{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}to "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 6 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 10 | - {/if} | ||
| 11 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 7 | + <div style="float:left; position: relative;"> |
| 8 | + {if !$is_broken} | ||
| 9 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 10 | + {else} | ||
| 11 | + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 12 | + {/if} | ||
| 13 | + | ||
| 14 | + | | ||
| 15 | + | ||
| 16 | + </div> | ||
| 17 | + <div> | ||
| 18 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 19 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 20 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 21 | + | ||
| 22 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 23 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 24 | + </div> | ||
| 12 | </div> | 25 | </div> |
| 13 | </dd> | 26 | </dd> |
templates/kt3/notifications/subscriptions.AddFolder.smarty
| @@ -3,11 +3,22 @@ | @@ -3,11 +3,22 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" was added{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}to "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" was added{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}to "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | + <div style="float:left; position: relative;"> | ||
| 6 | {if !$is_broken} | 7 | {if !$is_broken} |
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Folder{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Folder is no longer available{/i18n}</span> | ||
| 10 | - {/if} | ||
| 11 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Folder{/i18n}</a> |
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Folder is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 12 | + | | ||
| 13 | + | ||
| 14 | + </div> | ||
| 15 | + <div> | ||
| 16 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 17 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 18 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 19 | + | ||
| 20 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | ||
| 21 | + </div> | ||
| 22 | + | ||
| 12 | </div> | 23 | </div> |
| 13 | </dd> | 24 | </dd> |
templates/kt3/notifications/subscriptions.ArchivedDocument.smarty
| @@ -3,6 +3,9 @@ | @@ -3,6 +3,9 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#"{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}from "#location_name#"{/i18n}{/if} {i18n}was archived{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#"{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}from "#location_name#"{/i18n}{/if} {i18n}was archived{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 7 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 8 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 6 | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 9 | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> |
| 7 | </div> | 10 | </div> |
| 8 | </dd> | 11 | </dd> |
templates/kt3/notifications/subscriptions.CheckInDocument.smarty
| @@ -3,11 +3,18 @@ | @@ -3,11 +3,18 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been checked in{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}{if ($info.location_name !== null)}, {i18n arg_location_name=$info.location_name}in the folder "#location_name#"{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been checked in{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}{if ($info.location_name !== null)}, {i18n arg_location_name=$info.location_name}in the folder "#location_name#"{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 10 | - {/if} | ||
| 11 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + <div style="float:left; position: relative;"> |
| 7 | + {if !$is_broken} | ||
| 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 12 | + | | ||
| 13 | + </div> | ||
| 14 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 15 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 16 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 17 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 18 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 12 | </div> | 19 | </div> |
| 13 | </dd> | 20 | </dd> |
templates/kt3/notifications/subscriptions.CheckOutDocument.smarty
| @@ -3,11 +3,18 @@ | @@ -3,11 +3,18 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been checked out{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}{if ($info.location_name !== null)}, {i18n arg_location_name=$info.location_name}from the folder "#location_name#"{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been checked out{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}{if ($info.location_name !== null)}, {i18n arg_location_name=$info.location_name}from the folder "#location_name#"{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 10 | - {/if} | ||
| 11 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + <div style="float:left; position: relative;"> |
| 7 | + {if !$is_broken} | ||
| 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 12 | + | | ||
| 13 | + </div> | ||
| 14 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 15 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 16 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 17 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 18 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 12 | </div> | 19 | </div> |
| 13 | </dd> | 20 | </dd> |
templates/kt3/notifications/subscriptions.DiscussDocument.smarty
| @@ -7,11 +7,20 @@ | @@ -7,11 +7,20 @@ | ||
| 7 | The discussion around document "{$info.object_name|sanitize}" has been updated. | 7 | The discussion around document "{$info.object_name|sanitize}" has been updated. |
| 8 | {/if} | 8 | {/if} |
| 9 | <div class="actionoptions"> | 9 | <div class="actionoptions"> |
| 10 | - {if !$is_broken} | ||
| 11 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 12 | - {else} | ||
| 13 | - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 14 | - {/if} | ||
| 15 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 10 | + <div style="float:left; position: relative;"> |
| 11 | + {if !$is_broken} | ||
| 12 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 13 | + {else} | ||
| 14 | + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 15 | + {/if} | ||
| 16 | + | | ||
| 17 | + </div> | ||
| 18 | + | ||
| 19 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 20 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 21 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 22 | + | ||
| 23 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 24 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 16 | </div> | 25 | </div> |
| 17 | </dd> | 26 | </dd> |
templates/kt3/notifications/subscriptions.ModifyDocument.smarty
| @@ -3,11 +3,20 @@ | @@ -3,11 +3,20 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been changed{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}in the folder "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been changed{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}in the folder "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 10 | - {/if} | ||
| 11 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + <div style="float:left; position: relative;"> |
| 7 | + {if !$is_broken} | ||
| 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a> | ||
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 12 | + | | ||
| 13 | + </div> | ||
| 14 | + | ||
| 15 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 16 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 17 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 18 | + | ||
| 19 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 20 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 12 | </div> | 21 | </div> |
| 13 | </dd> | 22 | </dd> |
templates/kt3/notifications/subscriptions.MoveDocument.smarty
| @@ -3,12 +3,21 @@ | @@ -3,12 +3,21 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been moved{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}to the folder "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been moved{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}to the folder "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Location{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Location is no longer available{/i18n}</span> | ||
| 10 | - {/if} | 6 | + <div style="float:left; position: relative;"> |
| 7 | + {if !$is_broken} | ||
| 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Location{/i18n}</a> | ||
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Location is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 11 | 12 | ||
| 12 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 13 | + | |
| 14 | + </div> | ||
| 15 | + | ||
| 16 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 17 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 18 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 19 | + | ||
| 20 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 21 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 13 | </div> | 22 | </div> |
| 14 | </dd> | 23 | </dd> |
templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty
| @@ -3,11 +3,20 @@ | @@ -3,11 +3,20 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been removed{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}from the folder "#location_name#"{/i18n} ({i18n}to which you are subscribed{/i18n}){/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been removed{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}from the folder "#location_name#"{/i18n} ({i18n}to which you are subscribed{/i18n}){/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Folder is no longer available{/i18n}</span> | ||
| 10 | - {/if} | ||
| 11 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + <div style="float:left; position: relative;"> |
| 7 | + {if !$is_broken} | ||
| 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a> | ||
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Folder is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 12 | + | | ||
| 13 | + </div> | ||
| 14 | + | ||
| 15 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 16 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 17 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 18 | + | ||
| 19 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 20 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 12 | </div> | 21 | </div> |
| 13 | </dd> | 22 | </dd> |
templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty
| @@ -3,12 +3,21 @@ | @@ -3,12 +3,21 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" has been removed{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}from "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" has been removed{/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}from "#location_name#"{/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - {if !$is_broken} | ||
| 7 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a> | ||
| 8 | - {else} | ||
| 9 | - <span class="descriptiveText">{i18n}Location is no longer available{/i18n}</span> | ||
| 10 | - {/if} | 6 | + <div style="float:left; position: relative;"> |
| 7 | + {if !$is_broken} | ||
| 8 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a> | ||
| 9 | + {else} | ||
| 10 | + <span class="descriptiveText">{i18n}Location is no longer available{/i18n}</span> | ||
| 11 | + {/if} | ||
| 11 | 12 | ||
| 12 | - | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 13 | + | |
| 14 | + <div> | ||
| 15 | + | ||
| 16 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 17 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 18 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 19 | + | ||
| 20 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 21 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 13 | </div> | 22 | </div> |
| 14 | </dd> | 23 | </dd> |
templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
| @@ -3,6 +3,12 @@ | @@ -3,6 +3,12 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" to which you were subscribed, has been removed{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" to which you were subscribed, has been removed{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + |
| 7 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 8 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 9 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 10 | + | ||
| 11 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 12 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 7 | </div> | 13 | </div> |
| 8 | </dd> | 14 | </dd> |
templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
| @@ -3,6 +3,12 @@ | @@ -3,6 +3,12 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" to which you were subscribed, has been removed{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. | 4 | {i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" to which you were subscribed, has been removed{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}. |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + |
| 7 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 8 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 9 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 10 | + | ||
| 11 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 12 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 7 | </div> | 13 | </div> |
| 8 | </dd> | 14 | </dd> |
templates/kt3/notifications/subscriptions.RestoreDocument.smarty
| @@ -3,6 +3,12 @@ | @@ -3,6 +3,12 @@ | ||
| 3 | <!-- could break this up. --> | 3 | <!-- could break this up. --> |
| 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been restored by an administrator.{/i18n} | 4 | {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been restored by an administrator.{/i18n} |
| 5 | <div class="actionoptions"> | 5 | <div class="actionoptions"> |
| 6 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 6 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" |
| 7 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 8 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 9 | + | ||
| 10 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 11 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 12 | + | ||
| 7 | </div> | 13 | </div> |
| 8 | </dd> | 14 | </dd> |
templates/kt3/notifications/subscriptions.generic.smarty
| 1 | <dt class="actionitem subscription">{$info.title|sanitize}</dt> | 1 | <dt class="actionitem subscription">{$info.title|sanitize}</dt> |
| 2 | <dd class="actionmessage"> | 2 | <dd class="actionmessage"> |
| 3 | <div class="actionoptions"> | 3 | <div class="actionoptions"> |
| 4 | - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 4 | + |
| 5 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 6 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 7 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 8 | + | ||
| 9 | + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`¬ify_action=clear"}" | ||
| 10 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">{i18n}Clear Alert{/i18n}</a> | ||
| 5 | </div> | 11 | </div> |
| 6 | </dd> | 12 | </dd> |
templates/ktcore/action/checkout_final.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 4 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 5 | - | ||
| 6 | {capture assign=sLocation}action=checkout_final&fDocumentId={$context->oDocument->getId()}&reason={$reason|escape:'url'}{/capture} | 1 | {capture assign=sLocation}action=checkout_final&fDocumentId={$context->oDocument->getId()}&reason={$reason|escape:'url'}{/capture} |
| 7 | 2 | ||
| 8 | {capture assign=sJavascript} | 3 | {capture assign=sJavascript} |
templates/ktcore/assist/assist_notification.smarty
| @@ -4,11 +4,20 @@ | @@ -4,11 +4,20 @@ | ||
| 4 | user, <b>#user#</b>, has requested help on the document <b>#name#</b>, and you are | 4 | user, <b>#user#</b>, has requested help on the document <b>#name#</b>, and you are |
| 5 | the owner or an admin of this document.{/i18n} | 5 | the owner or an admin of this document.{/i18n} |
| 6 | <div class="actionoptions"> | 6 | <div class="actionoptions"> |
| 7 | - {if !$is_broken} | ||
| 8 | - <a href="{ktLink base="notify.php" query="id=`$notify_id`"}">{i18n}View Help Request{/i18n}</a> | ||
| 9 | - {else} | ||
| 10 | - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 11 | - {/if} | ||
| 12 | - | <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 7 | + <div style="float:left; position: relative;"> |
| 8 | + {if !$is_broken} | ||
| 9 | + <a href="{ktLink base="notify.php" query="id=`$notify_id`"}">{i18n}View Help Request{/i18n}</a> | ||
| 10 | + {else} | ||
| 11 | + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span> | ||
| 12 | + {/if} | ||
| 13 | + | | ||
| 14 | + </div> | ||
| 15 | + | ||
| 16 | + <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=clear"} | ||
| 17 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 18 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 19 | + | ||
| 20 | + <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=clear"} | ||
| 21 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}"">{i18n}Clear Alert{/i18n}</a> | ||
| 13 | </div> | 22 | </div> |
| 14 | </dd> | 23 | </dd> |
templates/ktcore/assist/assist_notification_details.smarty
| @@ -12,7 +12,16 @@ | @@ -12,7 +12,16 @@ | ||
| 12 | </dl> | 12 | </dl> |
| 13 | 13 | ||
| 14 | <div class="actionoptions"> | 14 | <div class="actionoptions"> |
| 15 | - <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=view"}">{i18n}View Document{/i18n}</a> | ||
| 16 | - | <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=clear"}">{i18n}Clear Alert{/i18n}</a> | 15 | + <div style="float:left; position: relative;"> |
| 16 | + <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=view"}">{i18n}View Document{/i18n}</a> | ||
| 17 | + | | ||
| 18 | + </div> | ||
| 19 | + | ||
| 20 | + <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=clear"} | ||
| 21 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}" | ||
| 22 | + class="ktAction ktInline ktDelete" style="position: relative;" >{i18n}Clear Alert{/i18n}</a> | ||
| 23 | + | ||
| 24 | + <a href="{ktLink base="notify.php" query="id=`$notify_id`¬ify_action=clear"} | ||
| 25 | + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}"">{i18n}Clear Alert{/i18n}</a> | ||
| 17 | </div> | 26 | </div> |
| 18 | 27 |
templates/ktcore/boolean_search_change.smarty
| 1 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} | ||
| 2 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} | ||
| 3 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 4 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 5 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} | ||
| 6 | {$context->oPage->requireJSResource("resources/js/taillog.js")} | 1 | {$context->oPage->requireJSResource("resources/js/taillog.js")} |
| 7 | {$context->oPage->requireJSResource("resources/js/constructed_search.js")} | 2 | {$context->oPage->requireJSResource("resources/js/constructed_search.js")} |
| 8 | {$context->oPage->requireJSResource("resources/js/constructed_search_postprocess.js")} | 3 | {$context->oPage->requireJSResource("resources/js/constructed_search_postprocess.js")} |
templates/ktcore/boolean_search_edit.smarty
| 1 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} | ||
| 2 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} | ||
| 3 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 4 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 5 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} | ||
| 6 | {$context->oPage->requireJSResource("resources/js/taillog.js")} | 1 | {$context->oPage->requireJSResource("resources/js/taillog.js")} |
| 7 | {$context->oPage->requireJSResource("resources/js/constructed_search.js")} | 2 | {$context->oPage->requireJSResource("resources/js/constructed_search.js")} |
| 8 | {$context->oPage->requireJSResource("resources/js/constructed_search_postprocess.js")} | 3 | {$context->oPage->requireJSResource("resources/js/constructed_search_postprocess.js")} |
templates/ktcore/document/add.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | - | ||
| 7 | <!-- unforunate, but (currently) necessary --> | 1 | <!-- unforunate, but (currently) necessary --> |
| 8 | 2 | ||
| 9 | {$context->oPage->requireJSResource('resources/js/taillog.js')} | 3 | {$context->oPage->requireJSResource('resources/js/taillog.js')} |
| @@ -50,6 +44,11 @@ function startupMetadata() { | @@ -50,6 +44,11 @@ function startupMetadata() { | ||
| 50 | document_type_changed(); | 44 | document_type_changed(); |
| 51 | } | 45 | } |
| 52 | 46 | ||
| 47 | +function progressIndicator(){ | ||
| 48 | + var indicator = document.getElementById(); | ||
| 49 | + indicator.style.display = "block"; | ||
| 50 | +} | ||
| 51 | + | ||
| 53 | addLoadEvent(startupMetadata); | 52 | addLoadEvent(startupMetadata); |
| 54 | {/literal} | 53 | {/literal} |
| 55 | {/capture} | 54 | {/capture} |
templates/ktcore/document/admin/deletedlist.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 4 | - | ||
| 5 | {$context->oPage->requireJSResource('resources/js/toggleselect.js')} | 1 | {$context->oPage->requireJSResource('resources/js/toggleselect.js')} |
| 6 | {$context->oPage->requireJSResource('resources/js/expungeList.js')} | 2 | {$context->oPage->requireJSResource('resources/js/expungeList.js')} |
| 7 | 3 |
templates/ktcore/document/edit.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | - | ||
| 7 | <!-- unforunate, but (currently) necessary --> | 1 | <!-- unforunate, but (currently) necessary --> |
| 8 | 2 | ||
| 9 | {$context->oPage->requireJSResource('resources/js/taillog.js')} | 3 | {$context->oPage->requireJSResource('resources/js/taillog.js')} |
templates/ktcore/folder/bulkImport.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | - | ||
| 7 | {$context->oPage->requireJSResource('resources/js/taillog.js')} | 1 | {$context->oPage->requireJSResource('resources/js/taillog.js')} |
| 8 | {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} | 2 | {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} |
| 9 | 3 |
templates/ktcore/folder/bulkUpload.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | - | ||
| 7 | {$context->oPage->requireJSResource('resources/js/taillog.js')} | 1 | {$context->oPage->requireJSResource('resources/js/taillog.js')} |
| 8 | {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} | 2 | {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} |
| 9 | 3 |
templates/ktcore/folder/roles_managegroups.smarty
| 1 | <h2>{i18n arg_rolename=$rolename}Allocate Groups to Role: #rolename#{/i18n}</h2> | 1 | <h2>{i18n arg_rolename=$rolename}Allocate Groups to Role: #rolename#{/i18n}</h2> |
| 2 | 2 | ||
| 3 | {$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')} | 3 | {$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')} |
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 6 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 7 | 4 | ||
| 8 | <p class="descriptiveText">{i18n}Groups must be allocated to roles to ensure that the workflow transition this role is supposed to support can be acted upon by a user.{/i18n}</p> | 5 | <p class="descriptiveText">{i18n}Groups must be allocated to roles to ensure that the workflow transition this role is supposed to support can be acted upon by a user.{/i18n}</p> |
| 9 | 6 |
templates/ktcore/folder/roles_manageusers.smarty
| 1 | <h2>{i18n}Allocate User to Role{/i18n}</h2> | 1 | <h2>{i18n}Allocate User to Role{/i18n}</h2> |
| 2 | 2 | ||
| 3 | {$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')} | 3 | {$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')} |
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 6 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 7 | 4 | ||
| 8 | <p class="descriptiveText">{i18n}Add or remove users for this role. {/i18n}</p> | 5 | <p class="descriptiveText">{i18n}Add or remove users for this role. {/i18n}</p> |
| 9 | 6 |
templates/ktcore/forms/widgets/collection.smarty
| @@ -7,12 +7,6 @@ | @@ -7,12 +7,6 @@ | ||
| 7 | <link rel="stylesheet" type="text/css" href="{$rootUrl}/resources/css/kt-headings.css" /> | 7 | <link rel="stylesheet" type="text/css" href="{$rootUrl}/resources/css/kt-headings.css" /> |
| 8 | <!--[if lt IE 7]><style type="text/css" media="all">@import url({$rootUrl}/resources/css/kt-ie-icons.css);</style><![endif]--> | 8 | <!--[if lt IE 7]><style type="text/css" media="all">@import url({$rootUrl}/resources/css/kt-ie-icons.css);</style><![endif]--> |
| 9 | 9 | ||
| 10 | -<script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Base.js"> </script> | ||
| 11 | -<script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Iter.js"> </script> | ||
| 12 | -<script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/DOM.js"> </script> | ||
| 13 | -<script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Logging.js"> </script> | ||
| 14 | -<script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Async.js"> </script> | ||
| 15 | -<script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Signal.js"> </script> | ||
| 16 | <script type="text/javascript" src="{$rootUrl}/resources/js/kt-utility.js"> </script> | 10 | <script type="text/javascript" src="{$rootUrl}/resources/js/kt-utility.js"> </script> |
| 17 | <script type="text/javascript" src="{$rootUrl}/resources/js/toggleselect.js"> </script> | 11 | <script type="text/javascript" src="{$rootUrl}/resources/js/toggleselect.js"> </script> |
| 18 | <script type="text/javascript" src="{$rootUrl}/presentation/i18nJavascript.php"> </script> | 12 | <script type="text/javascript" src="{$rootUrl}/presentation/i18nJavascript.php"> </script> |
templates/ktcore/login.smarty
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | 11 | ||
| 12 | <link rel="stylesheet" href="{$rootUrl}/resources/css/kt-ie-icons.css" type="text/css" /> | 12 | <link rel="stylesheet" href="{$rootUrl}/resources/css/kt-ie-icons.css" type="text/css" /> |
| 13 | 13 | ||
| 14 | - <script type="text/javascript" src="{$rootUrl}/thirdpartyjs/curvycorners/rounded_corners.inc.js"> </script> | 14 | + <script type="text/javascript" src="{$rootUrl}/thirdpartyjs/curvycorners/rounded_corners_lite.inc.js"> </script> |
| 15 | <script type="text/javascript" src="{$rootUrl}/resources/js/login_loader.js"> </script> | 15 | <script type="text/javascript" src="{$rootUrl}/resources/js/login_loader.js"> </script> |
| 16 | </head> | 16 | </head> |
| 17 | <body> | 17 | <body> |
| @@ -45,6 +45,7 @@ | @@ -45,6 +45,7 @@ | ||
| 45 | </select> | 45 | </select> |
| 46 | <div class="form_actions"> | 46 | <div class="form_actions"> |
| 47 | <input type="submit" value="{i18n}login{/i18n}" /> | 47 | <input type="submit" value="{i18n}login{/i18n}" /> |
| 48 | + <p class="smaller"><a href="#" onclick="showBox();">Forgot Password?</a></p> | ||
| 48 | </div> | 49 | </div> |
| 49 | </form> | 50 | </form> |
| 50 | </div> | 51 | </div> |
| @@ -54,24 +55,72 @@ | @@ -54,24 +55,72 @@ | ||
| 54 | </div> | 55 | </div> |
| 55 | {/if} | 56 | {/if} |
| 56 | <p class="descriptiveText version"> | 57 | <p class="descriptiveText version"> |
| 57 | - {i18n arg_appname="$appname"}#appname# Version{/i18n} {$versionName}<br/> | ||
| 58 | - {i18n}<a href="http://www.knowledgetree.com/">Document Management Software</a>{/i18n}<br> | ||
| 59 | - {i18n}© 2007 <a href="http://www.knowledgetree.com/">The Jam Warehouse Software (Pty) Ltd.</a>{/i18n}<br><br> | ||
| 60 | - {if ($smallVersion == 'OSS')} | ||
| 61 | - {i18n}This program is free software and published under the <a href=" http://www.gnu.org/licenses/">GNU General Public License version 3</a>{/i18n}<br> | ||
| 62 | - {else} | ||
| 63 | - {i18n}All rights reserved.{/i18n}<br> | ||
| 64 | - {/if} | 58 | + {i18n}Access to this service is subject to the KnowledgeTreeLive <a href="http://www.knowledgetree.com/about/legal/live">Terms and Conditions</a> of use.{/i18n}<br/> |
| 59 | + {i18n}© 2007 <a href="http://www.knowledgetree.com/">The Jam Warehouse Software (Pty) Ltd.</a> All Rights Reserved{/i18n} | ||
| 65 | </p> | 60 | </p> |
| 66 | - | ||
| 67 | - | ||
| 68 | <div id="bottomspacer"></div> | 61 | <div id="bottomspacer"></div> |
| 69 | <div class="floatClear"></div> | 62 | <div class="floatClear"></div> |
| 70 | </div> | 63 | </div> |
| 64 | + <div id="forgot_box"> | ||
| 65 | + <form name="forgot_form" action="" method="POST"> | ||
| 66 | + <table width="80%"> | ||
| 67 | + <tr> | ||
| 68 | + <td><div class="close_box" id="close_box" onclick="hideBox();" onmouseover="glow();" onmouseout="unglow();">Close</div></td> | ||
| 69 | + </tr> | ||
| 70 | + <tr> | ||
| 71 | + <input type="hidden" value="request_password_reset" name="request_password_reset" id="request_password_reset"> | ||
| 72 | + <td>Please note that this feature is only used to reset the ADMIN password. System users should contact admin to reset their password.</td> | ||
| 73 | + </tr> | ||
| 74 | + <!--<tr> | ||
| 75 | + <td><label for="company_name">Company Name</label> | ||
| 76 | + <input type="text" id="company_name" name="company_name"></input></td> | ||
| 77 | + </tr>--> | ||
| 78 | + <tr> | ||
| 79 | + <td><label for="email">Email Address</label> | ||
| 80 | + <input type="text" id="email" name="email"></input></td> | ||
| 81 | + </tr> | ||
| 82 | + <tr> | ||
| 83 | + <td class="form_actions"><input type="submit" value="{i18n}submit{/i18n}" /></td> | ||
| 84 | + <td></td> | ||
| 85 | + </tr> | ||
| 86 | + </table> | ||
| 87 | + </form> | ||
| 88 | + </div> | ||
| 89 | + <div id="reset_box"> | ||
| 90 | + <form name="reset_form" action="" method="POST"> | ||
| 91 | + <table width="80%"> | ||
| 92 | + <tr> | ||
| 93 | + <input type="hidden" name="perform_password_reset" value="perform_password_reset" id="perform_password_reset"> | ||
| 94 | + <td>Please note that this feature is only used to reset the ADMIN password. System users should contact admin to reset their password.</td> | ||
| 95 | + </tr> | ||
| 96 | + <tr> | ||
| 97 | + <td><label for="full_name">Full Name</label> | ||
| 98 | + <input type="text" id="full_name" name="full_name"></input></td> | ||
| 99 | + </tr> | ||
| 100 | + <tr> | ||
| 101 | + <td><label for="email">Email Address</label> | ||
| 102 | + <input type="text" id="email" name="email"></input></td> | ||
| 103 | + </tr> | ||
| 104 | + <tr> | ||
| 105 | + <td><label for="new_password">New password</label> | ||
| 106 | + <input type="password" id="new_password" name="new_password"></input></td> | ||
| 107 | + </tr> | ||
| 108 | + <tr> | ||
| 109 | + <td><label for="new_password_repeat">Repeat new password</label> | ||
| 110 | + <input type="password" id="new_password_repeat" name="new_password_repeat"></input></td> | ||
| 111 | + </tr> | ||
| 112 | + <tr> | ||
| 113 | + <td class="form_actions"><input type="submit" value="{i18n}submit{/i18n}" /></td> | ||
| 114 | + <td></td> | ||
| 115 | + </tr> | ||
| 116 | + </table> | ||
| 117 | + </form> | ||
| 118 | + </div> | ||
| 119 | + {if $reset_password == true} | ||
| 120 | + <script type="text/javascript">showResetBox();</script> | ||
| 121 | + {else} | ||
| 122 | + <script type="text/javascript">hideResetBox();</script> | ||
| 123 | + {/if} | ||
| 71 | </div> | 124 | </div> |
| 72 | - | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - | ||
| 76 | </body> | 125 | </body> |
| 77 | </html> | 126 | </html> |
templates/ktcore/metadata/admin/edit_lookuptree.smarty
| 1 | {$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')} | 1 | {$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')} |
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 3 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 4 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 5 | 2 | ||
| 6 | <h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Edit Lookup Tree{/i18n}:<br />{$field->getName()}</h2> | 3 | <h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Edit Lookup Tree{/i18n}:<br />{$field->getName()}</h2> |
| 7 | 4 |
templates/ktcore/metadata/conditional/conditional_overview.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | {$context->oPage->requireJSResource('resources/js/taillog.js')} | 1 | {$context->oPage->requireJSResource('resources/js/taillog.js')} |
| 7 | {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} | 2 | {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} |
| 8 | 3 |
templates/ktcore/metadata/conditional/editcomplex.smarty
| @@ -35,13 +35,6 @@ | @@ -35,13 +35,6 @@ | ||
| 35 | {/capture} | 35 | {/capture} |
| 36 | {$context->oPage->requireCSSStandalone($sCSS)} | 36 | {$context->oPage->requireCSSStandalone($sCSS)} |
| 37 | 37 | ||
| 38 | -<!-- include the mochikit js --> | ||
| 39 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} | ||
| 40 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 41 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} | ||
| 42 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} | ||
| 43 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 44 | - | ||
| 45 | {$context->oPage->requireJSResource("resources/js/taillog.js")} | 38 | {$context->oPage->requireJSResource("resources/js/taillog.js")} |
| 46 | {$context->oPage->requireJSResource("resources/js/conditional_complex_edit.js")} | 39 | {$context->oPage->requireJSResource("resources/js/conditional_complex_edit.js")} |
| 47 | 40 |
templates/ktcore/metadata/conditional/editsimple.smarty
| @@ -46,11 +46,6 @@ td { vertical-align: top; } | @@ -46,11 +46,6 @@ td { vertical-align: top; } | ||
| 46 | {$context->oPage->requireCSSStandalone($sCSS)} | 46 | {$context->oPage->requireCSSStandalone($sCSS)} |
| 47 | 47 | ||
| 48 | <!-- include the mochikit js --> | 48 | <!-- include the mochikit js --> |
| 49 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} | ||
| 50 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} | ||
| 51 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 52 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} | ||
| 53 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 54 | 49 | ||
| 55 | {$context->oPage->requireJSResource("resources/js/taillog.js")} | 50 | {$context->oPage->requireJSResource("resources/js/taillog.js")} |
| 56 | {$context->oPage->requireJSResource("resources/js/conditional_simple_edit.js")} | 51 | {$context->oPage->requireJSResource("resources/js/conditional_simple_edit.js")} |
templates/ktcore/principals/groups_sourceusers.smarty
| 1 | <h2>{i18n arg_name=$group->getName()}Manage Users in #name#{/i18n}</h2> | 1 | <h2>{i18n arg_name=$group->getName()}Manage Users in #name#{/i18n}</h2> |
| 2 | 2 | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 4 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 5 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 6 | - | ||
| 7 | <p class="descriptiveText">{i18n}Users may be associated with Groups which are then used to grant these users security privileges.{/i18n}</p> | 3 | <p class="descriptiveText">{i18n}Users may be associated with Groups which are then used to grant these users security privileges.{/i18n}</p> |
| 8 | 4 | ||
| 9 | 5 |
templates/ktcore/widget_fieldset_conditional.smarty
| 1 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} | ||
| 2 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} | ||
| 3 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} | ||
| 4 | -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} | ||
| 5 | - | ||
| 6 | {capture assign=sJS} | 1 | {capture assign=sJS} |
| 7 | var innerUrl = {$rootUrl}; | 2 | var innerUrl = {$rootUrl}; |
| 8 | {literal} | 3 | {literal} |
templates/ktstandard/authentication/ldapsearchuser.smarty
| 1 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 3 | -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 4 | - | ||
| 5 | {$context->oPage->requireJSResource('resources/js/toggleselect.js')} | 1 | {$context->oPage->requireJSResource('resources/js/toggleselect.js')} |
| 6 | 2 | ||
| 7 | <form method="POST" action="{$smarty.server.PHP_SELF}"> | 3 | <form method="POST" action="{$smarty.server.PHP_SELF}"> |
thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js
| 1 | -/** | ||
| 2 | - * $RCSfile$ | ||
| 3 | - * $Revision$ | ||
| 4 | - * $Date$ | ||
| 5 | - * | ||
| 6 | - * @author Moxiecode | ||
| 7 | - * @copyright Copyright ยฉ 2004, Moxiecode Systems AB, All rights reserved. | ||
| 8 | - */ | ||
| 9 | - function TinyMCE(){this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.dialogCounter=0;this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip.php")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1)?'_src':'';src=src.substring(0,src.lastIndexOf('/'));tinyMCE.baseURL=src;break;}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL;}this.defParam("mode","none");this.defParam("theme","advanced");this.defParam("plugins","",true);this.defParam("language","en");this.defParam("docs_language",this.settings['language']);this.defParam("elements","");this.defParam("textarea_trigger","mce_editable");this.defParam("valid_elements","+a[name|href|target|title|class],strong/b[class],em/i[class],strike[class],u[class],+p[dir|class|align],ol,ul,li,br,img[class|src|border=0|alt|title|hspace|vspace|width|height|align],sub,sup,blockquote[dir|style],table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class|align],address[class|align],h1[dir|class|align],h2[dir|class|align],h3[dir|class|align],h4[dir|class|align],h5[dir|class|align],h6[dir|class|align],hr");this.defParam("extended_valid_elements","");this.defParam("invalid_elements","");this.defParam("encoding","");this.defParam("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE.prototype.convertURL"));this.defParam("save_callback","");this.defParam("debug",false);this.defParam("force_br_newlines",false);this.defParam("force_p_newlines",true);this.defParam("add_form_submit_trigger",true);this.defParam("relative_urls",true);this.defParam("remove_script_host",true);this.defParam("focus_alert",true);this.defParam("document_base_url",this.documentURL);this.defParam("visual",true);this.defParam("visual_table_class","mceVisualAid");this.defParam("setupcontent_callback","");this.defParam("fix_content_duplication",true);this.defParam("custom_undo_redo",true);this.defParam("custom_undo_redo_levels",-1);this.defParam("custom_undo_redo_keyboard_shortcuts",true);this.defParam("verify_css_classes",false);this.defParam("trim_span_elements",true);this.defParam("verify_html",true);this.defParam("apply_source_formatting",false);this.defParam("directionality","ltr");this.defParam("auto_cleanup_word",false);this.defParam("cleanup_on_startup",false);this.defParam("inline_styles",false);this.defParam("convert_newlines_to_brs",false);this.defParam("auto_reset_designmode",false);this.defParam("entities","160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute");this.defParam("entity_encoding","named");this.defParam("cleanup_callback","");this.defParam("add_unload_trigger",true);this.defParam("ask",false);this.defParam("nowrap",false);this.defParam("auto_resize",false);this.defParam("auto_focus",false);this.defParam("cleanup",true);this.defParam("remove_linebreaks",true);this.defParam("button_tile_map",false);this.defParam("submit_patch",true);this.defParam("browsers","msie,safari,gecko");this.defParam("dialog_type","window");if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;var baseHREF=tinyMCE.settings['document_base_url'];if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.blockRegExp=new RegExp("^(h1|h2|h3|h4|h5|h6|p|div|address|pre|form|table|li|ol|ul|td)$","i");this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isMSIE)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("content_css",false)){var cssPath=tinyMCE.getParam("content_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['content_css']=this.documentBasePath+"/"+cssPath;else this.settings['content_css']=cssPath;}else this.settings['content_css']=tinyMCE.baseURL+"/themes/"+theme+"/editor_content.css";if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath;}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath;}else this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/editor_ui.css";if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg);}this._initCleanup();if(this.configs.length==0){if(this.isSafari)alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");tinyMCE.addEvent(window,"load",TinyMCE.prototype.onLoad);if(tinyMCE.isMSIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE.prototype.unloadHandler);}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var themePlugins=tinyMCE.getParam('plugins','',true,',');if(this.settings['plugins']!=''){for(var i=0;i<themePlugins.length;i++)this.loadScript(tinyMCE.baseURL+'/plugins/'+themePlugins[i]+'/editor_plugin'+tinyMCE.srcMode+'.js');}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;};TinyMCE.prototype.loadScript=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<link href="'+url+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(tinyMCE.isMSIE)var styleSheet=doc.createStyleSheet(css_file);else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))headArr[0].appendChild(elm);}};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"(","(","gi");htm=tinyMCE.regexpReplace(htm,")",")","gi");htm=tinyMCE.regexpReplace(htm,";",";","gi");htm=tinyMCE.regexpReplace(htm,""",""","gi");htm=tinyMCE.regexpReplace(htm,"^","^","gi");if(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._convertOnClick=function(node){if(tinyMCE.isMSIE5)return;var elms=node.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var onclick=elms[i].getAttribute('onclick');if(onclick&&onclick!=""){elms[i].removeAttribute("onclick");elms[i].setAttribute("mce_onclick",tinyMCE.cleanupEventStr(""+onclick));elms[i].onclick=null;}}};TinyMCE.prototype.resetForm=function(form_index){var formObj=document.forms[form_index];for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();for(var i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name){inst.getBody().innerHTML=formObj.elements[i].value;return;}}}};TinyMCE.prototype.execInstanceCommand=function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id);if(inst){if(typeof(focus)=="undefined")focus=true;if(focus)inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();this.selectedInstance=inst;tinyMCE.execCommand(command,user_interface,value);}};TinyMCE.prototype.execCommand=function(command,user_interface,value){user_interface=user_interface?user_interface:false;value=value?value:null;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();switch(command){case 'mceHelp':window.open(tinyMCE.themeURL+"/docs/"+this.settings['docs_language']+"/index.htm","mceHelp","menubar=yes,toolbar=yes,scrollbars=yes,left=20,top=20,width=550,height=600");return;case 'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.contentWindow.focus();return;case "mceAddControl":case "mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case "mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value['element'],value['document']);return;case "mceRemoveControl":case "mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case "mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance)this.selectedInstance.execCommand(command,user_interface,value);else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert']);};TinyMCE.prototype.eventPatch=function(editor_id){if(typeof(tinyMCE)=="undefined")return true;for(var i=0;i<document.frames.length;i++){if(document.frames[i].event){var event=document.frames[i].event;event.target=event.srcElement;event.target.editor_id=document.frames[i].editor_id;TinyMCE.prototype.handleEvent(event);return;}}};TinyMCE.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE.prototype.addEventHandlers=function(editor_id){if(tinyMCE.isMSIE){var doc=document.frames[editor_id].document;document.frames[editor_id].editor_id=editor_id;tinyMCE.addEvent(doc,"keypress",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE.prototype.eventPatch);}else{var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();inst.switchSettings();doc.editor_id=editor_id;tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE.prototype._createIFrame=function(replace_element){var iframe=document.createElement("iframe");var id=replace_element.getAttribute("id");iframe.setAttribute("id",id);iframe.setAttribute("className","mceEditorArea");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",tinyMCE.settings['area_width']);iframe.setAttribute("height",tinyMCE.settings['area_height']);iframe.setAttribute("allowtransparency","true");if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isMSIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=tinyMCE.settings['area_width'];iframe.style.height=tinyMCE.settings['area_height'];if(tinyMCE.isMSIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isMSIE)return window.frames[id];else return iframe;};TinyMCE.prototype.setupContent=function(editor_id){var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;inst.switchSettings();if(!tinyMCE.isMSIE&&doc.title!="blank_page"){doc.location.href=tinyMCE.baseURL+"/blank.htm";window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return;}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return;}tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.executeCallback('init_instance_callback','_initInstance',0,inst);if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isMSIE)doc.documentElement.editorId=editor_id;base=doc.createElement("base");base.setAttribute('href',tinyMCE.settings['base_href']);head.appendChild(base);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi");}content=tinyMCE._customCleanup("insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"paste",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings['force_p_newlines'])content=content.replace(new RegExp('<>','g'),"");if(tinyMCE.settings['cleanup_on_startup'])inst.getBody().innerHTML=tinyMCE._cleanupHTML(doc,this.settings,contentElement);else{content=tinyMCE.regexpReplace(content,"<strong","<b","gi");content=tinyMCE.regexpReplace(content,"<em","<i","gi");content=tinyMCE.regexpReplace(content,"</strong>","</b>","gi");content=tinyMCE.regexpReplace(content,"</em>","</i>","gi");inst.getBody().innerHTML=content;}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}tinyMCE._convertOnClick(inst.getBody());var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual']);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);inst.startContent=inst.getBody().innerHTML;tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup("insert_to_editor_dom",inst.contentWindow.document.body);};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i<form_obj.elements.length;i++){var elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true;}};TinyMCE.prototype.handleEvent=function(e){if(typeof(tinyMCE)=="undefined")return true;switch(e.type){case "submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();return;case "reset":var formObj=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10);}return;case "paste":if(tinyMCE.settings['auto_cleanup_word']){var editorId=e.target.editorId;if(!editorId)editorId=e.target.ownerDocument.editorId;if(editorId)window.setTimeout("tinyMCE.execInstanceCommand('"+editorId+"', 'mceCleanupWord', false, null);",1);}break;case "beforecut":case "beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");break;case "keypress":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(tinyMCE.selectedInstance._insertPara(e)){e.preventDefault();return false;}}if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){e.preventDefault();return false;}}if(!tinyMCE.isMSIE&&e.ctrlKey&&tinyMCE.settings['custom_undo_redo']){if(e.charCode==120||e.charCode==118){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");return;}if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.charCode==122){tinyMCE.selectedInstance.execCommand("Undo");e.preventDefault();return false;}if(e.charCode==121){tinyMCE.selectedInstance.execCommand("Redo");e.preventDefault();return false;}}if(e.charCode==98){tinyMCE.selectedInstance.execCommand("Bold");e.preventDefault();return false;}if(e.charCode==105){tinyMCE.selectedInstance.execCommand("Italic");e.preventDefault();return false;}if(e.charCode==117){tinyMCE.selectedInstance.execCommand("Underline");e.preventDefault();return false;}}if(tinyMCE.settings['custom_undo_redo']){var keys=new Array(13,45,36,35,33,34,37,38,39,40);var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){tinyMCE.selectedInstance.typing=false;posKey=true;break;}}if(!tinyMCE.selectedInstance.typing&&!posKey){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;}}if(tinyMCE.isMSIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual']);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(13,45,36,35,33,34,37,38,39,40);var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){tinyMCE.selectedInstance.typing=false;posKey=true;break;}}if(!tinyMCE.selectedInstance.typing&&!posKey&&(e.keyCode<16||e.keyCode>18&&e.keyCode!=255)){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;tinyMCE.triggerNodeChange(false);}if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(!tinyMCE.selectedInstance.typing){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;}if(e.type=="keyup")tinyMCE.triggerNodeChange(false);return true;}}var ctrlKeys=new Array(66,73,85,86,88);for(var i=0;i<keys.length;i++){if(ctrlKeys[i]==e.keyCode&&e.ctrlKey){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return true;}}if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.keyCode==90&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Undo");tinyMCE.triggerNodeChange(false);e.returnValue=false;e.cancelBubble=true;return false;}if(e.keyCode==89&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Redo");tinyMCE.triggerNodeChange(false);e.returnValue=false;e.cancelBubble=true;return false;}}}var keys=new Array(13,45,36,35,33,34,37,38,39,40);var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break;}}if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);break;case "mousedown":case "mouseup":case "click":case "focus":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var targetBody=tinyMCE.getParentElement(e.target,"body");for(var instanceName in tinyMCE.instances){var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody()==targetBody){tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");tinyMCE.selectedInstance.typing=false;break;}}if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(e.target.nodeName.toLowerCase()=="a"&&e.type=="click"&&e.altKey){var evalCode=""+tinyMCE.cleanupEventStr(e.target.getAttribute("mce_onclick"));eval(evalCode.replace('return false;',''));}if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href)window.setTimeout('tinyMCE.getInstanceById("'+inst.editorId+'").fixBrokenURLs();',10);return false;break;}};TinyMCE.prototype.switchClass=function(element,class_name,lock_state){var lockChanged=false;if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};TinyMCE.prototype.restoreAndSwitchClass=function(element,class_name){if(element!=null&&!element.classLock){this.restoreClass(element);this.switchClass(element,class_name);}};TinyMCE.prototype.switchClassSticky=function(element_name,class_name,lock_state){var element,lockChanged=false;if(!this.stickyClassesLookup[element_name])this.stickyClassesLookup[element_name]=document.getElementById(element_name);element=this.stickyClassesLookup[element_name];if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;}};TinyMCE.prototype.restoreClass=function(element){if(element!=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};TinyMCE.prototype.setClassLock=function(element,lock_state){if(element!=null)element.classLock=lock_state;};TinyMCE.prototype.addEvent=function(obj,name,handler){if(tinyMCE.isMSIE){obj.attachEvent("on"+name,handler);}else obj.addEventListener(name,handler,false);};TinyMCE.prototype.submitPatch=function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.oldSubmit();};TinyMCE.prototype.onLoad=function(){for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.oldSubmit=form.submit;form.submit=TinyMCE.prototype.submitPatch;}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case "exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(trigger=="false")continue;if(tinyMCE.settings['ask']&&element){elementRefAr[elementRefAr.length]=element;continue;}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i]);}break;case "specific_textareas":case "textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var trigger=nodeList.item(i).getAttribute(tinyMCE.settings['textarea_trigger']);if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=nodeList.item(i);}break;}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE.prototype.confirmAdd(e,settings);},10);});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE.prototype.confirmAdd(null,settings);});}}else tinyMCE.addMCEControl(element,elementId);}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selectNode(inst.getBody(),true,true);inst.contentWindow.focus();},10);}tinyMCE.executeCallback('oninit','_oninit',0);}};TinyMCE.prototype.removeMCEControl=function(editor_id){var inst=tinyMCE.getInstanceById(editor_id);if(inst){inst.switchSettings();editor_id=inst.editorId;var html=tinyMCE.getContent(editor_id);var tmpInstances=new Array();for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(instanceName!=editor_id)tmpInstances[instanceName]=instance;}tinyMCE.instances=tmpInstances;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var replaceElement=document.getElementById(editor_id+"_parent");var oldTargetElement=inst.oldTargetElement;var targetName=oldTargetElement.nodeName.toLowerCase();if(targetName=="textarea"||targetName=="input"){replaceElement.parentNode.removeChild(replaceElement);oldTargetElement.style.display="inline";oldTargetElement.value=html;}else{oldTargetElement.innerHTML=html;replaceElement.parentNode.insertBefore(oldTargetElement,replaceElement);replaceElement.parentNode.removeChild(replaceElement);}}};TinyMCE.prototype._cleanupElementName=function(element_name,element){element_name=element_name.toLowerCase();if(element_name=="body")return null;if(tinyMCE.cleanup_verify_html){for(var i=0;i<tinyMCE.cleanup_invalidElements.length;i++){if(tinyMCE.cleanup_invalidElements[i]==element_name)return null;}var validElement=false;var elementAttribs=null;for(var i=0;i<tinyMCE.cleanup_validElements.length&&!elementAttribs;i++){for(var x=0,n=tinyMCE.cleanup_validElements[i][0].length;x<n;x++){var elmMatch=tinyMCE.cleanup_validElements[i][0][x];if(elmMatch.charAt(0)=='+')elmMatch=elmMatch.substring(1);if(elmMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){elmMatch=elmMatch.replace(new RegExp('\\?','g'),'(\\S?)');elmMatch=elmMatch.replace(new RegExp('\\+','g'),'(\\S+)');elmMatch=elmMatch.replace(new RegExp('\\*','g'),'(\\S*)');elmMatch="^"+elmMatch+"$";if(element_name.match(new RegExp(elmMatch,'g'))){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;break;}}if(element_name==elmMatch){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;element_name=elementAttribs[0][0];break;}}}if(!validElement)return null;}if(!tinyMCE.isMSIE){if(element_name=="strong"&&!tinyMCE.cleanup_on_save)element_name="b";else if(element_name=="em"&&!tinyMCE.cleanup_on_save)element_name="i";}if(tinyMCE.isMSIE){if(element_name=="table"){var attribValue=element.style.pixelWidth==0?element.getAttribute("width"):element.style.pixelWidth;element.setAttribute("width",attribValue);attribValue=element.style.pixelHeight==0?element.getAttribute("height"):element.style.pixelHeight;element.setAttribute("height",attribValue);}}var elmData=new Object();elmData.element_name=element_name;elmData.valid_attribs=elementAttribs;return elmData;};TinyMCE.prototype._fixInlineStyles=function(elm){var eName=elm.nodeName;if(elm.nodeName=="FONT"){if((c=tinyMCE.getAttrib(elm,"color"))!=""){elm.style.color=c;}}if(eName=="TABLE"||eName=="TD"||eName=="IMG"){var value;value=tinyMCE.isMSIE?elm.width:elm.getAttribute("width");if(value&&value!=""){if(typeof(value)!="string"||!value.indexOf("%"))value+="px";elm.style.width=value;}value=tinyMCE.isMSIE?elm.height:elm.getAttribute("height");if(value&&value!=""){if(typeof(value)!="string"||!value.indexOf("%"))value+="px";elm.style.height=value;}value=tinyMCE.isMSIE?elm.border:elm.getAttribute("border");if(value&&value!=""&&(value!="0"&&eName!="TABLE")){elm.style.borderWidth=value+"px";}}value=elm.getAttribute("align");if(value&&value!=""){if(elm.nodeName.toLowerCase()=="img"){if(tinyMCE.isMSIE)elm.style.styleFloat=value;else elm.style.cssFloat=value;}else elm.style.textAlign=value;}value=elm.getAttribute("vspace");if(value&&value!=""){elm.style.marginTop=value+"px";elm.style.marginBottom=value+"px";}value=elm.getAttribute("hspace");if(value&&value!=""){elm.style.marginLeft=value+"px";elm.style.marginRight=value+"px";}};TinyMCE.prototype._cleanupAttribute=function(valid_attributes,element_name,attribute_node,element_node){var attribName=attribute_node.nodeName.toLowerCase();var attribValue=attribute_node.nodeValue;var attribMustBeValue=null;var verified=false;if(tinyMCE.cleanup_inline_styles&&(element_name=="table"||element_name=="td"||element_name=="img")){if(attribName=="width"||attribName=="height"||attribName=="border"||attribName=="align"||attribName=="valign"||attribName=="hspace"||attribName=="vspace")return null;}if(attribName.indexOf('moz_')!=-1)return null;if(!tinyMCE.isMSIE&&(attribName=="mce_real_href"||attribName=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;}else return null;}if(attribName=="mce_onclick")verified=true;if(tinyMCE.cleanup_verify_html&&!verified){for(var i=1;i<valid_attributes.length;i++){var attribMatch=valid_attributes[i][0];var re=null;if(attribMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){attribMatch=attribMatch.replace(new RegExp('\\?','g'),'(\\S?)');attribMatch=attribMatch.replace(new RegExp('\\+','g'),'(\\S+)');attribMatch=attribMatch.replace(new RegExp('\\*','g'),'(\\S*)');attribMatch="^"+attribMatch+"$";re=new RegExp(attribMatch,'g');}if((re&&attribName.match(re)!=null)||attribName==attribMatch){verified=true;attribMustBeValue=valid_attributes[i][3];break;}}if((element_name=="table"||element_name=="td")&&attribName=="style")verified=true;if(!verified)return false;}else verified=true;switch(attribName){case "size":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.size;break;case "color":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.color;break;case "width":if(tinyMCE.isMSIE)attribValue=element_node.width;break;case "height":if(tinyMCE.isMSIE)attribValue=element_node.height;break;case "border":if(tinyMCE.isMSIE)attribValue=element_node.border;break;case "class":if(element_name=="table"||element_name=="td"){if(tinyMCE.cleanup_visual_table_class!="")attribValue=tinyMCE.getVisualAidClass(attribValue,!tinyMCE.cleanup_on_save);}if(!tinyMCE._verifyClass(element_node)||attribValue=="")return null;break;case "style":attribValue=element_node.style.cssText.toLowerCase();if(tinyMCE.isMSIE){var border=element_node.style.border;var bt=element_node.style.borderTop;var bl=element_node.style.borderLeft;var br=element_node.style.borderRight;var bb=element_node.style.borderBottom;if(border!=""&&(bt==border&&bl==border&&br==border&&bb==border)){attribValue=tinyMCE.regexpReplace(attribValue,'border-top: '+border+'?; ?','');attribValue=tinyMCE.regexpReplace(attribValue,'border-left: '+border+'?; ?','');attribValue=tinyMCE.regexpReplace(attribValue,'border-right: '+border+'?; ?','');attribValue=tinyMCE.regexpReplace(attribValue,'border-bottom: '+border+'?;( ?)','border: '+border+';$1');}}break;case "onclick":case "mce_onclick":if(tinyMCE.isMSIE5)break;if(tinyMCE.cleanup_on_save){if(element_node.getAttribute("mce_onclick")){attribName="onclick";attribValue=""+element_node.getAttribute("mce_onclick");}}else{if(attribName=="onclick"&&!tinyMCE.cleanup_on_save)return null;}break;case "href":case "src":if(!tinyMCE.isMSIE&&attribName=="href"&&element_node.getAttribute("mce_real_href"))attribValue=element_node.getAttribute("mce_real_href");if(!tinyMCE.isMSIE&&attribName=="src"&&element_node.getAttribute("mce_real_src"))attribValue=element_node.getAttribute("mce_real_src");if(tinyMCE.isGecko&&!tinyMCE.settings['relative_urls'])attribValue=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],attribValue);attribValue=eval(tinyMCE.cleanup_urlconverter_callback+"(attribValue, element_node, tinyMCE.cleanup_on_save);");break;case "colspan":case "rowspan":if(attribValue=="1")return null;break;case "_moz-userdefined":case "editorid":case "editor_id":case "mce_real_href":case "mce_real_src":return null;}if(attribMustBeValue!=null){var isCorrect=false;for(var i=0;i<attribMustBeValue.length;i++){if(attribValue==attribMustBeValue[i]){isCorrect=true;break;}}if(!isCorrect)return null;}var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;};TinyMCE.prototype._verifyClass=function(node){if(tinyMCE.isGecko){var className=node.getAttribute('class');if(!className)return false;}if(tinyMCE.isMSIE)var className=node.getAttribute('className');if(tinyMCE.cleanup_verify_css_classes&&tinyMCE.cleanup_on_save){var csses=tinyMCE.getCSSClasses();nonDefinedCSS=true;for(var c=0;c<csses.length;c++){if(csses[c]==className){nonDefinedCSS=false;break;}}if(nonDefinedCSS&&className.indexOf('mce_')!=0){node.removeAttribute('className');node.removeAttribute('class');return false;}}return true;};TinyMCE.prototype.cleanupNode=function(node){var output="";switch(node.nodeType){case 1:var elementData=tinyMCE._cleanupElementName(node.nodeName,node);var elementName=elementData?elementData.element_name:null;var elementValidAttribs=elementData?elementData.valid_attribs:null;var elementAttribs="";var openTag=false;if(elementName!=null&&elementName.charAt(0)=='+'){elementName=elementName.substring(1);openTag=true;}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var lookup=tinyMCE.cleanup_elementLookupTable;for(var i=0;i<lookup.length;i++){if(lookup[i]==node)return output;}lookup[lookup.length]=node;}if(!elementName){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return output;}if(node.style&&(node.style.cssText.indexOf('mso-')!=-1&&tinyMCE.settings['auto_cleanup_word'])||node.style.cssText==""){node.style.cssText="";node.removeAttribute("style");}if(tinyMCE.cleanup_inline_styles)tinyMCE._fixInlineStyles(node);if(elementValidAttribs){for(var a=1;a<elementValidAttribs.length;a++){var attribName,attribDefaultValue,attribForceValue,attribValue;attribName=elementValidAttribs[a][0];attribDefaultValue=elementValidAttribs[a][1];attribForceValue=elementValidAttribs[a][2];if(attribDefaultValue!=null||attribForceValue!=null){var attribValue=node.getAttribute(attribName);if(node.getAttribute(attribName)==null||node.getAttribute(attribName)=="")attribValue=attribDefaultValue;attribValue=attribForceValue?attribForceValue:attribValue;if(attribValue=="{$uid}")attribValue="uid_"+(tinyMCE.cleanup_idCount++);if(attribName=="class")attribValue=tinyMCE.getVisualAidClass(attribValue,tinyMCE.cleanup_on_save);node.setAttribute(attribName,attribValue);}}}if(elementName=="span"&&tinyMCE.cleanup_trim_span_elements){var re=new RegExp('^[ \t]+','g');var onlyWhiteSpace=true;for(var a=0;a<node.childNodes.length;a++){var tmpNode=node.childNodes[a];if((tmpNode.nodeType==3&&!tmpNode.nodeValue.match(re))||tmpNode.nodeName.toLowerCase()!="span"){onlyWhiteSpace=false;break;}}tinyMCE._verifyClass(node);var numAttribs=0;for(var i=0;i<node.attributes.length;i++){if(node.attributes[i].specified)numAttribs++;}if(onlyWhiteSpace||numAttribs==0){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return output;}}if(elementName=="table"&&!node.hasChildNodes())return "";if(tinyMCE.isGecko&&elementName=="img"){var w=node.style.width;if(w!=null&&w!="")node.setAttribute("width",w);var h=node.style.height;if(h!=null&&h!="")node.setAttribute("height",h);}if(node.attributes.length>0){for(var i=0;i<node.attributes.length;i++){if(node.attributes[i].specified){var attrib=tinyMCE._cleanupAttribute(elementValidAttribs,elementName,node.attributes[i],node);if(attrib)elementAttribs+=" "+attrib.name+"="+'"'+attrib.value+'"';}}}if(tinyMCE.isMSIE&&elementName=="input"){if(node.type){if(!elementAttribs.match(/type=/g))elementAttribs+=" type="+'"'+node.type+'"';}if(node.value){if(!elementAttribs.match(/value=/g))elementAttribs+=" value="+'"'+node.value+'"';}}if((elementName=="p"||elementName=="td")&&(node.innerHTML==""||node.innerHTML==" "))return "<"+elementName+elementAttribs+">"+this.convertStringToXML(String.fromCharCode(160))+"</"+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+"</"+elementName+">";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="<div"+elementAttribs+">";else output+="<"+elementName+elementAttribs+">";for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="</div><br />";else output+="</"+elementName+">";}else{if(openTag)output+="<"+elementName+elementAttribs+"></"+elementName+">";else{output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName.toLowerCase()=="script")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "<!--"+node.nodeValue+"-->";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i<html_data.length;i++){var chr=html_data.charCodeAt(i);if(tinyMCE.settings['entity_encoding']=="numeric"){if(chr>127)output+='&#'+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i<extendedValidElements.length;i++){var elementName=this._getCleanupElementName(extendedValidElements[i]);var skipAdd=false;for(var x=0;x<validElements.length;x++){if(this._getCleanupElementName(validElements[x])==elementName){validElements[x]=extendedValidElements[i];skipAdd=true;break;}}if(!skipAdd)validElements[validElements.length]=extendedValidElements[i];}for(var i=0;i<validElements.length;i++){var item=validElements[i];item=item.replace('[','|');item=item.replace(']','');var attribs=item.split('|');for(var x=0;x<attribs.length;x++)attribs[x]=attribs[x].toLowerCase();attribs[0]=attribs[0].split('/');for(var x=1;x<attribs.length;x++){var attribName=attribs[x];var attribDefault=null;var attribForce=null;var attribMustBe=null;if((pos=attribName.indexOf('='))!=-1){attribDefault=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf(':'))!=-1){attribForce=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf('<'))!=-1){attribMustBe=attribName.substring(pos+1).split('?');attribName=attribName.substring(0,pos);}attribs[x]=new Array(attribName,attribDefault,attribForce,attribMustBe);}validElements[i]=attribs;}var invalidElements=tinyMCE.settings['invalid_elements'].split(',');for(var i=0;i<invalidElements.length;i++)invalidElements[i]=invalidElements[i].toLowerCase();tinyMCE.settings['cleanup_validElements']=validElements;tinyMCE.settings['cleanup_invalidElements']=invalidElements;tinyMCE.settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)tinyMCE.settings['cleanup_entities']['c'+entities[i]]=entities[i+1];};TinyMCE.prototype._cleanupHTML=function(doc,config,element,visual,on_save){if(!tinyMCE.settings['cleanup'])return element.innerHTML;tinyMCE._customCleanup(on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);tinyMCE.cleanup_validElements=tinyMCE.settings['cleanup_validElements'];tinyMCE.cleanup_entities=tinyMCE.settings['cleanup_entities'];tinyMCE.cleanup_invalidElements=tinyMCE.settings['cleanup_invalidElements'];tinyMCE.cleanup_verify_html=tinyMCE.settings['verify_html'];tinyMCE.cleanup_force_br_newlines=tinyMCE.settings['force_br_newlines'];tinyMCE.cleanup_urlconverter_callback=tinyMCE.settings['urlconverter_callback'];tinyMCE.cleanup_verify_css_classes=tinyMCE.settings['verify_css_classes'];tinyMCE.cleanup_visual_table_class=tinyMCE.settings['visual_table_class'];tinyMCE.cleanup_apply_source_formatting=tinyMCE.settings['apply_source_formatting'];tinyMCE.cleanup_trim_span_elements=tinyMCE.settings['trim_span_elements'];tinyMCE.cleanup_inline_styles=tinyMCE.settings['inline_styles'];tinyMCE.cleanup_visual_aid=visual;tinyMCE.cleanup_on_save=on_save;tinyMCE.cleanup_idCount=0;tinyMCE.cleanup_elementLookupTable=new Array();var startTime=new Date().getTime();tinyMCE._convertOnClick(element);if(tinyMCE.isMSIE){element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'<p>[ \n\r]*<hr id=null>[ \n\r]*</p>','<hr />','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'<!([^-(DOCTYPE)]* )|<!/[^-]*>','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])alert("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'<p><hr /></p>','<hr />');html=tinyMCE.regexpReplace(html,'<p> </p><hr /><p> </p>','<hr />');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('<o:p _moz-userdefined="" />','g'),"");if(tinyMCE.settings['apply_source_formatting']){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n</$1$2>\n");html=html.replace(new RegExp('<br />','g'),"<br />\n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('<p> </p>','g');html=html.replace(re,"<br />");}if(tinyMCE.settings['force_p_newlines']){var re=new RegExp('<>','g');html=html.replace(re,"");}if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');html=tinyMCE._customCleanup(on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk=="<br/>"||chk=="<br>"||chk=="<p> </p>"||chk=="<p> </p>"||chk=="<p></p>")html="";if(tinyMCE.settings["preformatted"])return "<pre>"+html+"</pre>";return html;};TinyMCE.prototype.setAttrib=function(element,name,value,no_fix_value){if(!no_fix_value&&value!=null){var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(value!=null&&value!="")element.setAttribute(name,value);else element.removeAttribute(name);if(value!=null&&value!="")element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){this.execCommand("mceAddUndoLevel");if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'mce_onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="#mce_temp_url#">'+this.selectedInstance.getSelectedHTML()+'</a>');}else this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i<elementArray.length;i++){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");tinyMCE.setAttrib(elementArray[i],'href',href);tinyMCE.setAttrib(elementArray[i],'mce_real_href',href);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'mce_onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class);}tinyMCE.linkElement=elementArray[0];}if(this.linkElement){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, this.linkElement);");tinyMCE.setAttrib(this.linkElement,'href',href);tinyMCE.setAttrib(this.linkElement,'mce_real_href',href);tinyMCE.setAttrib(this.linkElement,'target',target);tinyMCE.setAttrib(this.linkElement,'title',title);tinyMCE.setAttrib(this.linkElement,'mce_onclick',onclick);tinyMCE.setAttrib(this.linkElement,'class',style_class);}};TinyMCE.prototype.insertImage=function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){if(src=="")return;this.execCommand("mceAddUndoLevel");if(!this.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="#mce_temp_url#" />');else this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x<n;x++){var childElements=this.getElementsByAttributeValue(node.childNodes[x],element_name,attrib,value);for(var i=0,m=childElements.length;i<m;i++)elements[elements.length]=childElements[i];}}return elements;};TinyMCE.prototype.isBlockElement=function(node){return node!=null&&node.nodeType==1&&this.blockRegExp.test(node.nodeName);};TinyMCE.prototype.getParentBlockElement=function(node){while(node){if(this.blockRegExp.test(node.nodeName))return node;node=node.parentNode;}return null;};TinyMCE.prototype.getNodeTree=function(node,node_array,type,node_name){if(typeof(type)=="undefined"||node.nodeType==type&&(typeof(node_name)=="undefined"||node.nodeName.toLowerCase()==node_name.toLowerCase()))node_array[node_array.length]=node;if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)tinyMCE.getNodeTree(node.childNodes[i],node_array,type,node_name);}return node_array;};TinyMCE.prototype.getParentElement=function(node,names,attrib_name,attrib_value){if(typeof(names)=="undefined"){if(node.nodeType==1)return node;while((node=node.parentNode)!=null&&node.nodeType!=1);return node;}var namesAr=names.split(',');if(node==null)return null;do{for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase()||names=="*"){if(typeof(attrib_name)=="undefined")return node;else if(node.getAttribute(attrib_name)){if(typeof(attrib_value)=="undefined"){if(node.getAttribute(attrib_name)!="")return node;}else if(node.getAttribute(attrib_name)==attrib_value)return node;}}}}while(node=node.parentNode);return null;};TinyMCE.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;var fileProto=(prot=="file:");url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isMSIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(!tinyMCE.settings['relative_urls']){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return "#"+urlParts['anchor'];}if(on_save&&tinyMCE.settings['relative_urls']){var urlParts=tinyMCE.parseURL(url);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(!urlParts['port']||urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],url);}if(!fileProto&&tinyMCE.settings['remove_script_host']){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1);if(!tinyMCE.settings['relative_urls']&&url.indexOf('://')==-1&&url.charAt(0)!='/')url='/'+url;}return url;};TinyMCE.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break;}pos=i;urlParts['host']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos);}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos);}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos);}}return urlParts;};TinyMCE.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var strTok1;var strTok2;var breakPoint=0;var outputString="";base_url=base_url.substring(0,base_url.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=url_to_relative.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return url_to_relative;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outputString+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outputString+="/"+strTok2[i];else outputString+=strTok2[i];}return outputString;};TinyMCE.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=TinyMCE.prototype.parseURL(base_url);var relURL=TinyMCE.prototype.parseURL(relative_url);if(relative_url==""||relative_url.charAt(0)=='/'||relative_url.indexOf('://')!=-1||relative_url.indexOf('mailto:')!=-1||relative_url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(relative_url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";if(baseURL['protocol'])start+=baseURL['protocol']+"://";if(baseURL['host'])start+=baseURL['host'];if(baseURL['port'])start+=":"+baseURL['port'];if(relURL['query'])end+="?"+relURL['query'];if(relURL['anchor'])end+="#"+relURL['anchor'];if(relative_url.charAt(relative_url.length-1)=="/")end+="/";return start+absPath+end;};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i];}value=outArray;}return value;};TinyMCE.prototype.getLang=function(name,default_value,parse_entities){var value=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name];if(parse_entities){var el=document.createElement("div");el.innerHTML=value;value=el.innerHTML;}return value;};TinyMCE.prototype.replaceVar=function(replace_haystack,replace_var,replace_str){var re=new RegExp('{\\\$'+replace_var+'}','g');return replace_haystack.replace(re,replace_str);};TinyMCE.prototype.replaceVars=function(replace_haystack,replace_vars){for(var key in replace_vars){var value=replace_vars[key];replace_haystack=tinyMCE.replaceVar(replace_haystack,key,value);}return replace_haystack;};TinyMCE.prototype.triggerNodeChange=function(focus,setup_content){if(tinyMCE.settings['handleNodeChangeCallback']){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1;var undoLevels=-1;var anySelection=false;var selectedText=inst.getSelectedText();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){if(eval("typeof(TinyMCE_"+plugins[i]+"_cleanup)")!="undefined")content=eval("TinyMCE_"+plugins[i]+"_cleanup(type, content);");}return content;};TinyMCE.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.selectedInstance=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedInstance)return tinyMCE._cleanupHTML(this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);return null;};TinyMCE.prototype.setContent=function(html_content){if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceSetContent',false,html_content);};TinyMCE.prototype.importThemeLanguagePack=function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js');};TinyMCE.prototype.importPluginLanguagePack=function(name,valid_languages){var lang="en";valid_languages=valid_languages.split(',');for(var i=0;i<valid_languages.length;i++){if(tinyMCE.settings['language']==valid_languages[i])lang=tinyMCE.settings['language'];}tinyMCE.loadScript(tinyMCE.baseURL+'/plugins/'+name+'/langs/'+lang+'.js');};TinyMCE.prototype.applyTemplate=function(html,args){html=tinyMCE.replaceVar(html,"themeurl",tinyMCE.themeURL);if(typeof(args)!="undefined")html=tinyMCE.replaceVars(html,args);html=tinyMCE.replaceVars(html,tinyMCE.settings);html=tinyMCE.replaceVars(html,tinyMCELang);return html;};TinyMCE.prototype.openWindow=function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args['mce_template_file']=template['file'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=template['width']))width=320;if(!(height=template['height']))height=200;if(tinyMCE.isMSIE)height+=30;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args)url=tinyMCE.replaceVar(url,name,escape(args[name]));if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup","top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus();}else{if(tinyMCE.isMSIE&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features);}else{if(tinyMCE.settings["dialog_type"]=="window"||tinyMCE.settings["dialog_type"]=="modal"){var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";var win=window.open(url,"mcePopup","top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}eval('try { win.resizeTo(width, height); } catch(e) { }');win.focus();}else{var div=document.createElement("div");var id="mceDialog"+(tinyMCE.dialogCounter++);height+=30;div.id=id;div.className="mceDialog";div.style.width=width+"px";div.style.height=height+"px";var html='<div class="mceDialogHeader"><div class="mceDialogTitle"></div><div class="mceDialogClose"><a href="javascript:tinyMCE.closeDialog();"></a></div></div>';html+='<div id="'+id+'IFrameWrapper" class="mceDialogIFrameWrapper"><iframe border="0" marginwidth="0" marginheight="0" frameborder="0" hspace="0" vspace="0" src="'+url+'" width="'+width+'" height="'+height+'"></iframe></div>';div.innerHTML=html;document.body.appendChild(div);tinyMCE._currentDialog=id;}}}};TinyMCE.prototype.closeDialog=function(){if(tinyMCE.settings["dialog_type"]=="div"){var div=document.getElementById(tinyMCE._currentDialog);if(div)div.parentNode.removeChild(div);}else window.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i];}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(element,deep,state){if(!element)return;var tableElement=null;switch(element.nodeName.toLowerCase()){case "table":var oldW=element.style.width;var oldH=element.style.height;element.className=tinyMCE.getVisualAidClass(element.className,state&&element.getAttribute("border")==0);element.style.width=oldW;element.style.height=oldH;for(var y=0;y<element.rows.length;y++){for(var x=0;x<element.rows[y].cells.length;x++){var className=tinyMCE.getVisualAidClass(element.rows[y].cells[x].className,state&&element.getAttribute("border")==0);element.rows[y].cells[x].className=className;}}break;}if(deep&&element.hasChildNodes()){for(var i=0;i<element.childNodes.length;i++)tinyMCE.handleVisualAid(element.childNodes[i],deep,state);}};TinyMCE.prototype.getAttrib=function(elm,name,default_value){var v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(typeof(default_value)=="undefined")default_value="";return(v&&v!="")?v:default_value;};TinyMCE.prototype.setAttrib=function(element,name,value,fix_value){if(typeof(value)=="number")value=""+value;if(fix_value){if(value==null)value="";var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(name=="class")element.className=value;if(value!=null&&value!=""&&value!=-1)element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype._setHTML=function(doc,html_content){if(tinyMCE.isMSIE){var re=new RegExp('<p><hr /></p>','g');html_content=html_content.replace(re,"<hr>");}try{doc.body.innerHTML=html_content;}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName.toLowerCase()=="p")node.outerHTML=node.innerHTML;}}var html=doc.body.innerHTML;if(html.indexOf('="mso')!=-1){for(var i=0;i<doc.body.all.length;i++){var el=doc.body.all[i];el.removeAttribute("className","",0);el.removeAttribute("style","",0);}html=doc.body.innerHTML;html=tinyMCE.regexpReplace(html,"<o:p><\/o:p>","<br />");html=tinyMCE.regexpReplace(html,"<o:p> <\/o:p>","");html=tinyMCE.regexpReplace(html,"<st1:.*?>","");html=tinyMCE.regexpReplace(html,"<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p><\/p>\r\n<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p> <\/p>","<br />");html=tinyMCE.regexpReplace(html,"<p>\s*(<p>\s*)?","<p>");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","</p>");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j<document.forms.length;j++){for(var k=0;k<document.forms[j].elements.length;k++){if(document.forms[j].elements[k].name==element_id){elm=document.forms[j].elements[k];break;}}}}return elm;};TinyMCE.prototype.getEditorId=function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId;};TinyMCE.prototype.getInstanceById=function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(instance.formTargetElementId==editor_id){inst=instance;break;}}}return inst;};TinyMCE.prototype.queryInstanceCommandValue=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false;};TinyMCE.prototype.queryInstanceCommandState=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null;};TinyMCE.prototype.setWindowArg=function(name,value){this.windowArgs[name]=value;};TinyMCE.prototype.getWindowArg=function(name,default_value){return(typeof(this.windowArgs[name])=="undefined")?default_value:this.windowArgs[name];};TinyMCE.prototype.getCSSClasses=function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];break;}doc=instance.getDoc();}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc();}if(doc){var styles=tinyMCE.isMSIE?doc.styleSheets:doc.styleSheets;if(styles&&styles.length>0){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(0).rules : doc.styleSheets[0].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){if(rules[c].indexOf(' ')!=-1||rules[c].indexOf(':')!=-1||rules[c].indexOf('mce_')==1)continue;if(rules[c]=="."+tinyMCE.settings['visual_table_class'])continue;if(rules[c].indexOf('.')!=-1){output[output.length]=rules[c].substring(rules[c].indexOf('.')+1);}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.openFileBrowser=function(field_name,url,type,win){var cb=tinyMCE.getParam("file_browser_callback");this.setWindowArg("window",win);if(eval('typeof('+cb+')')=="undefined")alert("Callback function: "+cb+" could not be found.");else eval(cb+"(field_name, url, type, win);");};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i<args.length;i++){str+='args['+i+']';if(i<args.length-1)str+=',';}str+=');';return eval(str);};TinyMCE.prototype.executeCallback=function(param,suffix,mode){switch(mode){case 0:var state=false;var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}return state;case 1:var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}return false;}};function TinyMCEControl(settings){this.undoLevels=new Array();this.undoIndex=0;this.isDirty=false;this.settings=settings;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);};TinyMCEControl.prototype.repaint=function(){if(tinyMCE.isMSIE)return;this.getBody().style.display='none';this.getBody().style.display='block';};TinyMCEControl.prototype.switchSettings=function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('mce_real_src');if(src&&src!="")elms[i].setAttribute("src",src);}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('mce_real_href');if(href&&href!="")elms[i].setAttribute("href",href);}};TinyMCEControl.prototype.convertAllRelativeURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('src');if(src&&src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src);elms[i].setAttribute("mce_real_src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('href');if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href);elms[i].setAttribute("mce_real_href",href);}}};TinyMCEControl.prototype.getSelectedHTML=function(){if(tinyMCE.isSafari){return this.getRng().toString();}var elm=document.createElement("body");if(tinyMCE.isGecko)elm.appendChild(this.getRng().cloneContents());else elm.innerHTML=this.getRng().htmlText;return tinyMCE._cleanupHTML(this.contentDocument,this.settings,elm,this.visualAid);};TinyMCEControl.prototype.getBookmark=function(){var rng=this.getRng();if(tinyMCE.isSafari)return rng;if(tinyMCE.isMSIE)return rng.getBookmark();if(tinyMCE.isGecko)return rng.cloneRange();return null;};TinyMCEControl.prototype.moveToBookmark=function(bookmark){if(tinyMCE.isSafari){var sel=this.getSel().realSelection;sel.setBaseAndExtent(bookmark.startContainer,bookmark.startOffset,bookmark.endContainer,bookmark.endOffset);return true;}if(tinyMCE.isMSIE)return this.getRng().moveToBookmark(bookmark);if(tinyMCE.isGecko){var rng=this.getDoc().createRange();var sel=this.getSel();rng.setStart(bookmark.startContainer,bookmark.startOffset);rng.setEnd(bookmark.endContainer,bookmark.endOffset);sel.removeAllRanges();sel.addRange(rng);return true;}return false;};TinyMCEControl.prototype.getSelectedText=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();if(doc.selection.type=="Text"){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText='';}else{var sel=this.getSel();if(sel&&sel.toString)selectedText=sel.toString();else selectedText='';}return selectedText;};TinyMCEControl.prototype.selectNode=function(node,collapse,select_text_node,to_start){if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(tinyMCE.isMSIE){var rng=this.getBody().createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select();}catch(e){}}else{var sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.realSelection.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.realSelection.collapseToStart();else sel.realSelection.collapseToEnd();}this.scrollToNode(node);return;}var rng=this.getDoc().createRange();if(select_text_node){var nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(node.absTop>scrollY&&node.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false;}return true;}var doc=this.getDoc();var sel=this.getSel();var win=this.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var rootElm=doc.documentElement;var self=this;var blockName="P";var rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);var rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);var direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;var startNode=direct?sel.anchorNode:sel.focusNode;var startOffset=direct?sel.anchorOffset:sel.focusOffset;var endNode=direct?sel.focusNode:sel.anchorNode;var endOffset=direct?sel.focusOffset:sel.anchorOffset;var startBlock=tinyMCE.getParentBlockElement(startNode);var endBlock=tinyMCE.getParentBlockElement(endNode);if(startBlock!=null){blockName=startBlock.nodeName.toUpperCase();if(blockName=="TD"||blockName=="TABLE")blockName="P";}if((startBlock!=null&&startBlock.nodeName.toLowerCase()=="li")||(endBlock!=null&&endBlock.nodeName.toLowerCase()=="li"))return false;if((startBlock!=null&&startBlock.nodeName.toLowerCase()=="table")||(endBlock!=null&&endBlock.nodeName.toLowerCase()=="table"))startBlock=endBlock=null;var paraBefore=(startBlock!=null&&startBlock.nodeName.toUpperCase()==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);var paraAfter=(endBlock!=null&&endBlock.nodeName.toUpperCase()==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);var startChop=startNode;var endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startBlock==null){rng.deleteContents();sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);var contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName.toLowerCase()=="body")){var nodes=contents.firstChild.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName.toLowerCase()!="body")paraAfter.appendChild(nodes[i]);}}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML=" ";if(isEmpty(paraAfter))paraAfter.innerHTML=" ";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore);}else{body.innerHTML="<"+blockName+"> </"+blockName+"><"+blockName+"> </"+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){var nodes=contents.firstChild.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName.toLowerCase()!="body")paraAfter.appendChild(nodes[i]);}}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML=" ";if(isEmpty(paraAfter))paraAfter.innerHTML=" ";var rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode);}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset);}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();rng.insertNode(paraAfter);rng.insertNode(paraBefore);paraAfter.normalize();paraBefore.normalize();this.selectNode(paraAfter,true,true);return true;};TinyMCEControl.prototype._handleBackSpace=function(evt_type){var doc=this.getDoc();var sel=this.getSel();if(sel==null)return false;var rng=sel.getRangeAt(0);var node=rng.startContainer;var elm=node.nodeType==3?node.parentNode:node;if(node==null)return;if(elm&&elm.nodeName==""){var para=doc.createElement("p");while(elm.firstChild)para.appendChild(elm.firstChild);elm.parentNode.insertBefore(para,elm);elm.parentNode.removeChild(elm);var rng=rng.cloneRange();rng.setStartBefore(node.nextSibling);rng.setEndAfter(node.nextSibling);rng.extractContents();this.selectNode(node.nextSibling,true,true);}var para=tinyMCE.getParentBlockElement(node);if(para!=null&¶.nodeName.toLowerCase()=='p'&&evt_type=="keypress"){var htm=para.innerHTML;var block=tinyMCE.getParentBlockElement(node);if(htm==""||htm==" "||block.nodeName.toLowerCase()=="li"){var prevElm=para.previousSibling;while(prevElm!=null&&prevElm.nodeType!=1)prevElm=prevElm.previousSibling;if(prevElm==null)return false;var nodes=tinyMCE.getNodeTree(prevElm,new Array(),3);var lastTextNode=nodes.length==0?null:nodes[nodes.length-1];if(lastTextNode!=null)this.selectNode(lastTextNode,true,false,false);para.parentNode.removeChild(para);return true;}}return false;};TinyMCEControl.prototype._insertSpace=function(){return true;};TinyMCEControl.prototype.autoResetDesignMode=function(){if(!tinyMCE.isMSIE&&tinyMCE.settings['auto_reset_designmode']){var sel=this.getSel();if(!sel||!sel.rangeCount||sel.rangeCount==0)eval('try { this.getDoc().designMode = "On"; } catch(e) {}');}};TinyMCEControl.prototype.isDirty=function(){return this.isDirty;};TinyMCEControl.prototype.execCommand=function(command,user_interface,value){var doc=this.getDoc();var win=this.getWin();if(this.lastSafariSelection){this.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){doc.execCommand("useCSS",false,true);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE._themeExecCommand(this.editorId,this.getBody(),command,user_interface,value))return;if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceImage"&&command!="mceLink"&&command!="mceToggleVisualAid"&&(command!="mceInsertTable"&&!user_interface))this.execCommand("mceAddUndoLevel");if(this.getFocusElement()&&this.getFocusElement().nodeName.toLowerCase()=="img"){var align=this.getFocusElement().getAttribute('align');switch(command){case "JustifyLeft":if(align=='left')this.getFocusElement().removeAttribute('align');else this.getFocusElement().setAttribute('align','left');tinyMCE.triggerNodeChange();return;case "JustifyCenter":if(align=='middle')this.getFocusElement().removeAttribute('align');else this.getFocusElement().setAttribute('align','middle');tinyMCE.triggerNodeChange();return;case "JustifyRight":if(align=='right')this.getFocusElement().removeAttribute('align');else this.getFocusElement().setAttribute('align','right');tinyMCE.triggerNodeChange();return;}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case "JustifyLeft":alignValue="left";break;case "JustifyCenter":alignValue="center";break;case "JustifyFull":alignValue="justify";break;case "JustifyRight":alignValue="right";break;}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return;}}}switch(command){case "mceStoreSelection":this.selectionBookmark=this.getBookmark();break;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);break;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"><li> </li><"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<strike>"+this.getSelectedHTML()+"</strike>");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case "FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "HiliteColor":if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand('hilitecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('BackColor',false,value);break;case "Cut":case "Copy":case "Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.getLang('lang_clipboard_msg')))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case "mceSetContent":if(!value)value="";value=tinyMCE._customCleanup("insert_to_editor",value);tinyMCE._setHTML(doc,value);doc.body.innerHTML=tinyMCE._cleanupHTML(doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanupWord":if(tinyMCE.isMSIE){var html=this.getBody().createTextRange().htmlText;if(html.indexOf('="mso')!=-1){tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);html=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);}this.getBody().innerHTML=html;}break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);this.repaint();tinyMCE.triggerNodeChange();break;case "mceAnchor":if(!user_interface){var aElm=tinyMCE.getParentElement(this.getFocusElement(),"a","name");if(aElm){if(value==null||value==""){if(tinyMCE.isMSIE){aElm.outerHTML=aElm.innerHTML;}else{var rng=aElm.ownerDocument.createRange();rng.setStartBefore(aElm);rng.setEndAfter(aElm);rng.deleteContents();rng.insertNode(rng.createContextualFragment(aElm.innerHTML));}}else aElm.setAttribute('name',value);}else{this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];var aElm=this.getDoc().createElement("a");aElm.setAttribute('name',value);if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)aElm.appendChild(elm.childNodes[i].cloneNode(true));}elm.parentNode.replaceChild(aElm,elm);}}tinyMCE.triggerNodeChange();}break;case "mceReplaceContent":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":var selectedText=false;if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=(rng.text&&rng.text.length>0);}else selectedText=(this.getSel().toString().length>0);if(tinyMCE.selectedNode)tinyMCE.selectedElement=tinyMCE.selectedNode;if(selectedText&&!tinyMCE.selectedNode){this.getDoc().execCommand("RemoveFormat",false,null);if(value==null)return this.execCommand("RemoveFormat",false,null);this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=this.getDoc().createElement("span");spanElm.className=value;if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true));}elm.parentNode.replaceChild(spanElm,elm);}}}else{var targetElm=this.getFocusElement();if(tinyMCE.selectedElement.nodeName.toLowerCase()=="img"||tinyMCE.selectedElement.nodeName.toLowerCase()=="table")targetElm=tinyMCE.selectedElement;var targetNode=tinyMCE.getParentElement(targetElm,"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address");if(tinyMCE.selectedElement.nodeType==1)targetNode=tinyMCE.selectedElement;if(!tinyMCE.isMSIE&&!targetNode)targetNode=tinyMCE.imgElement;if(targetNode){if(targetNode.nodeName.toLowerCase()=="span"&&(!value||value=="")){if(targetNode.hasChildNodes()){for(var i=0;i<targetNode.childNodes.length;i++)targetNode.parentNode.insertBefore(targetNode.childNodes[i].cloneNode(true),targetNode);}targetNode.parentNode.removeChild(targetNode);}else{if(value!=null&&value!="")targetNode.className=value;else{targetNode.removeAttribute("className");targetNode.removeAttribute("class");}}}}tinyMCE.triggerNodeChange();break;case "mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceInsertContent',false,key);var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)this.getBody().innerHTML=html.substring(0,pos)+value+html.substring(pos+key.length);break;case "mceInsertContent":if(!tinyMCE.isMSIE){var sel=this.getSel();var rng=this.getRng();var isHTML=value.indexOf('<')!=-1;if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value);}else value=rng.createContextualFragment(value);}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value);}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true;}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true;}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node);}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng);}else rng.collapse(false);}else{var rng=doc.selection.createRange();if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);}tinyMCE.triggerNodeChange();break;case "mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']){var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];var newHTML=this.getBody().innerHTML;if(newHTML!=this.undoLevels[this.undoLevels.length-1]){tinyMCE.executeCallback('onchange_callback','_onchange',0,this);this.isDirty=true;if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}this.undoLevels[this.undoIndex++]=newHTML;this.undoLevels.length=this.undoIndex;}tinyMCE.triggerNodeChange(false);}break;case "Undo":if(tinyMCE.settings['custom_undo_redo']){if(this.undoIndex==this.undoLevels.length){this.execCommand("mceAddUndoLevel");this.undoIndex--;}if(this.undoIndex>0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);tinyMCE.triggerNodeChange();break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);rng.pasteHTML(rng.text);}catch(e){}}else this.getDoc().execCommand(command,user_interface,value);if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();}};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent">'+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);html=tinyMCE.replaceVar(html,"default_document",tinyMCE.baseURL+"/blank.htm");this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName.toLowerCase()=="textarea")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>';else html+='<input type="hidden" type="text" id="'+form_element_name+'" name="'+form_element_name+'" />';html+='</span>';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html=""+'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'+'<html>'+'<head>'+'<base href="'+tinyMCE.settings['base_href']+'" />'+'<title>blank_page</title>'+'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'+'</head>'+'<body class="mceContentBody">'+'</body>'+'</html>';try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse)rng.collapse(true);var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var elm=(sel&&sel.anchorNode)?sel.anchorNode:null;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img")elm=tinyMCE.selectedElement;}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();function debug(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\ | ||
| 10 | - Debug output:\ | ||
| 11 | - <textarea id="tinymce_debug" style="width: 100%; height: 300px">\ | ||
| 12 | - </textarea>';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i<args.length;i++){msg+=args[i];if(i<args.length-1)msg+=', ';}elm.value+=msg+"\n";}; | ||
| 13 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +function TinyMCE(){this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf("MSIE 5")!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf("MSIE 5.0")!=-1);this.isGecko=navigator.userAgent.indexOf("Gecko")!=-1;this.isSafari=navigator.userAgent.indexOf("Safari")!=-1;this.isMac=navigator.userAgent.indexOf("Mac")!=-1;this.dialogCounter=0;this.idCounter=0;}TinyMCE.prototype.defParam=function(_1,_2){this.settings[_1]=tinyMCE.getParam(_1,_2);};TinyMCE.prototype.init=function(_3){var _4;this.settings=_3;if(typeof (document.execCommand)=="undefined"){return;}if(!tinyMCE.baseURL){var _5=document.getElementsByTagName("script");for(var i=0;i<_5.length;i++){if(_5[i].src&&(_5[i].src.indexOf("tiny_mce.js")!=-1||_5[i].src.indexOf("tiny_mce_src.js")!=-1||_5[i].src.indexOf("tiny_mce_gzip.php")!=-1)){var _7=_5[i].src;tinyMCE.srcMode=(_7.indexOf("_src")!=-1)?"_src":"";_7=_7.substring(0,_7.lastIndexOf("/"));tinyMCE.baseURL=_7;break;}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf("?")!=-1){this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf("?"));}this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf("/"));if(tinyMCE.baseURL.indexOf("://")==-1&&tinyMCE.baseURL.charAt(0)!="/"){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL;}this.defParam("mode","none");this.defParam("theme","advanced");this.defParam("plugins","",true);this.defParam("language","en");this.defParam("docs_language",this.settings["language"]);this.defParam("elements","");this.defParam("textarea_trigger","mce_editable");this.defParam("valid_elements","+a[name|href|target|title|class],strong/b[class],em/i[class],strike[class],u[class],+p[dir|class|align],ol,ul,li,br,img[class|src|border=0|alt|title|hspace|vspace|width|height|align],sub,sup,blockquote[dir|style],table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class|align],address[class|align],h1[dir|class|align],h2[dir|class|align],h3[dir|class|align],h4[dir|class|align],h5[dir|class|align],h6[dir|class|align],hr");this.defParam("extended_valid_elements","");this.defParam("invalid_elements","");this.defParam("encoding","");this.defParam("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE.prototype.convertURL"));this.defParam("save_callback","");this.defParam("debug",false);this.defParam("force_br_newlines",false);this.defParam("force_p_newlines",true);this.defParam("add_form_submit_trigger",true);this.defParam("relative_urls",true);this.defParam("remove_script_host",true);this.defParam("focus_alert",true);this.defParam("document_base_url",this.documentURL);this.defParam("visual",true);this.defParam("visual_table_class","mceVisualAid");this.defParam("setupcontent_callback","");this.defParam("fix_content_duplication",true);this.defParam("custom_undo_redo",true);this.defParam("custom_undo_redo_levels",-1);this.defParam("custom_undo_redo_keyboard_shortcuts",true);this.defParam("verify_css_classes",false);this.defParam("trim_span_elements",true);this.defParam("verify_html",true);this.defParam("apply_source_formatting",false);this.defParam("directionality","ltr");this.defParam("auto_cleanup_word",false);this.defParam("cleanup_on_startup",false);this.defParam("inline_styles",false);this.defParam("convert_newlines_to_brs",false);this.defParam("auto_reset_designmode",false);this.defParam("entities","160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute");this.defParam("entity_encoding","named");this.defParam("cleanup_callback","");this.defParam("add_unload_trigger",true);this.defParam("ask",false);this.defParam("nowrap",false);this.defParam("auto_resize",false);this.defParam("auto_focus",false);this.defParam("cleanup",true);this.defParam("remove_linebreaks",true);this.defParam("button_tile_map",false);this.defParam("submit_patch",true);this.defParam("browsers","msie,safari,gecko");this.defParam("dialog_type","window");if(this.isMSIE&&this.settings["browsers"].indexOf("msie")==-1){return;}if(this.isGecko&&this.settings["browsers"].indexOf("gecko")==-1){return;}if(this.isSafari&&this.settings["browsers"].indexOf("safari")==-1){return;}var _8=tinyMCE.settings["document_base_url"];if(_8.indexOf("?")!=-1){_8=_8.substring(0,_8.indexOf("?"));}this.settings["base_href"]=_8.substring(0,_8.lastIndexOf("/"))+"/";_4=this.settings["theme"];this.blockRegExp=new RegExp("^(h1|h2|h3|h4|h5|h6|p|div|address|pre|form|table|li|ol|ul|td)$","i");this.settings["theme_href"]=tinyMCE.baseURL+"/themes/"+_4;if(!tinyMCE.isMSIE){this.settings["force_br_newlines"]=false;}if(tinyMCE.getParam("content_css",false)){var _9=tinyMCE.getParam("content_css","");if(_9.indexOf("://")==-1&&_9.charAt(0)!="/"){this.settings["content_css"]=this.documentBasePath+"/"+_9;}else{this.settings["content_css"]=_9;}}else{this.settings["content_css"]=tinyMCE.baseURL+"/themes/"+_4+"/editor_content.css";}if(tinyMCE.getParam("popups_css",false)){var _a=tinyMCE.getParam("popups_css","");if(_a.indexOf("://")==-1&&_a.charAt(0)!="/"){this.settings["popups_css"]=this.documentBasePath+"/"+_a;}else{this.settings["popups_css"]=_a;}}else{this.settings["popups_css"]=tinyMCE.baseURL+"/themes/"+_4+"/editor_popup.css";}if(tinyMCE.getParam("editor_css",false)){var _b=tinyMCE.getParam("editor_css","");if(_b.indexOf("://")==-1&&_b.charAt(0)!="/"){this.settings["editor_css"]=this.documentBasePath+"/"+_b;}else{this.settings["editor_css"]=_b;}}else{this.settings["editor_css"]=tinyMCE.baseURL+"/themes/"+_4+"/editor_ui.css";}if(tinyMCE.settings["debug"]){var _c="Debug: \n";_c+="baseURL: "+this.baseURL+"\n";_c+="documentBasePath: "+this.documentBasePath+"\n";_c+="content_css: "+this.settings["content_css"]+"\n";_c+="popups_css: "+this.settings["popups_css"]+"\n";_c+="editor_css: "+this.settings["editor_css"]+"\n";alert(_c);}this._initCleanup();if(this.configs.length==0){if(this.isSafari){alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");}tinyMCE.addEvent(window,"load",TinyMCE.prototype.onLoad);if(tinyMCE.isMSIE){if(tinyMCE.settings["add_unload_trigger"]){tinyMCE.addEvent(window,"unload",TinyMCE.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE.prototype.unloadHandler);}}else{if(tinyMCE.settings["add_unload_trigger"]){tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}}}this.loadScript(tinyMCE.baseURL+"/themes/"+this.settings["theme"]+"/editor_template"+tinyMCE.srcMode+".js");this.loadScript(tinyMCE.baseURL+"/langs/"+this.settings["language"]+".js");this.loadCSS(this.settings["editor_css"]);var _d=tinyMCE.getParam("plugins","",true,",");if(this.settings["plugins"]!=""){for(var i=0;i<_d.length;i++){this.loadScript(tinyMCE.baseURL+"/plugins/"+_d[i]+"/editor_plugin"+tinyMCE.srcMode+".js");}}_3["index"]=this.configs.length;this.configs[this.configs.length]=_3;};TinyMCE.prototype.loadScript=function(_f){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==_f){return;}}document.write("<sc"+"ript language=\"javascript\" type=\"text/javascript\" src=\""+_f+"\"></script>");this.loadedFiles[this.loadedFiles.length]=_f;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url){return;}}document.write("<link href=\""+url+"\" rel=\"stylesheet\" type=\"text/css\" />");this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,_14){if(tinyMCE.isMSIE){var _15=doc.createStyleSheet(_14);}else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=_14;if(headArr=doc.getElementsByTagName("head")){headArr[0].appendChild(elm);}}};TinyMCE.prototype.confirmAdd=function(e,_18){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var _1a=elm.name?elm.name:elm.id;tinyMCE.settings=_18;if(!elm.getAttribute("mce_noask")&&confirm(tinyMCELang["lang_edit_confirm"])){tinyMCE.addMCEControl(elm,_1a);}elm.setAttribute("mce_noask","true");};TinyMCE.prototype.updateContent=function(_1b){var _1c=document.getElementById(_1b);for(var n in tinyMCE.instances){var _1e=tinyMCE.instances[n];_1e.switchSettings();if(_1e.formElement==_1c){var doc=_1e.getDoc();tinyMCE._setHTML(doc,_1e.formElement.value);if(!tinyMCE.isMSIE){doc.body.innerHTML=tinyMCE._cleanupHTML(doc,this.settings,doc.body,_1e.visualAid);}}}};TinyMCE.prototype.addMCEControl=function(_20,_21,_22){var id="mce_editor_"+tinyMCE.idCounter++;var _24=new TinyMCEControl(tinyMCE.settings);_24.editorId=id;this.instances[id]=_24;_24.onAdd(_20,_21,_22);};TinyMCE.prototype.triggerSave=function(_25,_26){for(var n in tinyMCE.instances){var _28=tinyMCE.instances[n];_28.switchSettings();tinyMCE.settings["preformatted"]=false;if(typeof (_25)=="undefined"){_25=false;}if(typeof (_26)=="undefined"){_26=false;}tinyMCE._setHTML(_28.getDoc(),_28.getBody().innerHTML);var htm=_25?_28.getBody().innerHTML:tinyMCE._cleanupHTML(_28.getDoc(),this.settings,_28.getBody(),this.visualAid,true);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html"){htm=tinyMCE.convertStringToXML(htm);}if(!_26&&tinyMCE.settings["save_callback"]!=""){var _2a=eval(tinyMCE.settings["save_callback"]+"(inst.formTargetElementId,htm,inst.getBody());");}if((typeof (_2a)!="undefined")&&_2a!=null){htm=_2a;}htm=tinyMCE.regexpReplace(htm,"(","(","gi");htm=tinyMCE.regexpReplace(htm,")",")","gi");htm=tinyMCE.regexpReplace(htm,";",";","gi");htm=tinyMCE.regexpReplace(htm,""",""","gi");htm=tinyMCE.regexpReplace(htm,"^","^","gi");if(_28.formElement){_28.formElement.value=htm;}}};TinyMCE.prototype._convertOnClick=function(_2b){if(tinyMCE.isMSIE5){return;}var _2c=_2b.getElementsByTagName("a");for(var i=0;i<_2c.length;i++){var _2e=_2c[i].getAttribute("onclick");if(_2e&&_2e!=""){_2c[i].removeAttribute("onclick");_2c[i].setAttribute("mce_onclick",tinyMCE.cleanupEventStr(""+_2e));_2c[i].onclick=null;}}};TinyMCE.prototype.resetForm=function(_2f){var _30=document.forms[_2f];for(var n in tinyMCE.instances){var _32=tinyMCE.instances[n];_32.switchSettings();for(var i=0;i<_30.elements.length;i++){if(_32.formTargetElementId==_30.elements[i].name){_32.getBody().innerHTML=_30.elements[i].value;return;}}}};TinyMCE.prototype.execInstanceCommand=function(_34,_35,_36,_37,_38){var _39=tinyMCE.getInstanceById(_34);if(_39){if(typeof (_38)=="undefined"){_38=true;}if(_38){_39.contentWindow.focus();}_39.autoResetDesignMode();this.selectedElement=_39.getFocusElement();this.selectedInstance=_39;tinyMCE.execCommand(_35,_36,_37);}};TinyMCE.prototype.execCommand=function(_3a,_3b,_3c){_3b=_3b?_3b:false;_3c=_3c?_3c:null;if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();}switch(_3a){case "mceHelp":window.open(tinyMCE.themeURL+"/docs/"+this.settings["docs_language"]+"/index.htm","mceHelp","menubar=yes,toolbar=yes,scrollbars=yes,left=20,top=20,width=550,height=600");return;case "mceFocus":var _3d=tinyMCE.getInstanceById(_3c);if(_3d){_3d.contentWindow.focus();}return;case "mceAddControl":case "mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(_3c),_3c);return;case "mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(_3c),_3c["element"],_3c["document"]);return;case "mceRemoveControl":case "mceRemoveEditor":tinyMCE.removeMCEControl(_3c);return;case "mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance){this.selectedInstance.execCommand(_3a,_3b,_3c);}else{if(tinyMCE.settings["focus_alert"]){alert(tinyMCELang["lang_focus_alert"]);}}};TinyMCE.prototype.eventPatch=function(_3f){if(typeof (tinyMCE)=="undefined"){return true;}for(var i=0;i<document.frames.length;i++){if(document.frames[i].event){var _41=document.frames[i].event;_41.target=_41.srcElement;_41.target.editor_id=document.frames[i].editor_id;TinyMCE.prototype.handleEvent(_41);return;}}};TinyMCE.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE.prototype.addEventHandlers=function(_42){if(tinyMCE.isMSIE){var doc=document.frames[_42].document;document.frames[_42].editor_id=_42;tinyMCE.addEvent(doc,"keypress",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE.prototype.eventPatch);}else{var _44=tinyMCE.instances[_42];var doc=_44.getDoc();_44.switchSettings();doc.editor_id=_42;tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);eval("try { doc.designMode = \"On\"; } catch(e) {}");}};TinyMCE.prototype._createIFrame=function(_46){var _47=document.createElement("iframe");var id=_46.getAttribute("id");_47.setAttribute("id",id);_47.setAttribute("className","mceEditorArea");_47.setAttribute("border","0");_47.setAttribute("frameBorder","0");_47.setAttribute("marginWidth","0");_47.setAttribute("marginHeight","0");_47.setAttribute("leftMargin","0");_47.setAttribute("topMargin","0");_47.setAttribute("width",tinyMCE.settings["area_width"]);_47.setAttribute("height",tinyMCE.settings["area_height"]);_47.setAttribute("allowtransparency","true");if(tinyMCE.settings["auto_resize"]){_47.setAttribute("scrolling","no");}if(tinyMCE.isMSIE){_47.setAttribute("src",this.settings["default_document"]);}_47.style.width=tinyMCE.settings["area_width"];_47.style.height=tinyMCE.settings["area_height"];if(tinyMCE.isMSIE){_46.outerHTML=_47.outerHTML;}else{_46.parentNode.replaceChild(_47,_46);}if(tinyMCE.isMSIE){return window.frames[id];}else{return _47;}};TinyMCE.prototype.setupContent=function(_49){var _4a=tinyMCE.instances[_49];var doc=_4a.getDoc();var _4c=doc.getElementsByTagName("head").item(0);var _4d=_4a.startContent;_4a.switchSettings();if(!tinyMCE.isMSIE&&doc.title!="blank_page"){doc.location.href=tinyMCE.baseURL+"/blank.htm";window.setTimeout("tinyMCE.setupContent('"+_49+"');",1000);return;}if(!_4c){window.setTimeout("tinyMCE.setupContent('"+_49+"');",10);return;}tinyMCE.importCSS(_4a.getDoc(),_4a.settings["content_css"]);tinyMCE.executeCallback("init_instance_callback","_initInstance",0,_4a);if(tinyMCE.settings["nowrap"]){doc.body.style.whiteSpace="nowrap";}doc.body.dir=this.settings["directionality"];doc.editorId=_49;if(!tinyMCE.isMSIE){doc.documentElement.editorId=_49;}base=doc.createElement("base");base.setAttribute("href",tinyMCE.settings["base_href"]);_4c.appendChild(base);if(tinyMCE.settings["convert_newlines_to_brs"]){_4d=tinyMCE.regexpReplace(_4d,"\r\n","<br />","gi");_4d=tinyMCE.regexpReplace(_4d,"\r","<br />","gi");_4d=tinyMCE.regexpReplace(_4d,"\n","<br />","gi");}_4d=tinyMCE._customCleanup("insert_to_editor",_4d);if(tinyMCE.isMSIE){window.setInterval("try{tinyMCE.getCSSClasses(document.frames[\""+_49+"\"].document, \""+_49+"\");}catch(e){}",500);if(tinyMCE.settings["force_br_newlines"]){document.frames[_49].document.styleSheets[0].addRule("p","margin: 0px;");}var _4e=document.frames[_49].document.body;tinyMCE.addEvent(_4e,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(_4e,"beforecut",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(_4e,"paste",TinyMCE.prototype.eventPatch);_4e.editorId=_49;}if(!tinyMCE.isMSIE){var _4f=_4a.getDoc().createElement("body");var doc=_4a.getDoc();_4f.innerHTML=_4d;if(tinyMCE.settings["force_p_newlines"]){_4d=_4d.replace(new RegExp("<>","g"),"");}if(tinyMCE.settings["cleanup_on_startup"]){_4a.getBody().innerHTML=tinyMCE._cleanupHTML(doc,this.settings,_4f);}else{_4d=tinyMCE.regexpReplace(_4d,"<strong","<b","gi");_4d=tinyMCE.regexpReplace(_4d,"<em","<i","gi");_4d=tinyMCE.regexpReplace(_4d,"</strong>","</b>","gi");_4d=tinyMCE.regexpReplace(_4d,"</em>","</i>","gi");_4a.getBody().innerHTML=_4d;}_4a.convertAllRelativeURLs();}else{if(tinyMCE.settings["cleanup_on_startup"]){tinyMCE._setHTML(_4a.getDoc(),_4d);eval("try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst.contentDocument, this.settings, inst.getBody());} catch(e) {}");}else{tinyMCE._setHTML(_4a.getDoc(),_4d);}}tinyMCE._convertOnClick(_4a.getBody());var _51=document.getElementById(_4a.editorId+"_parent");if(_51.lastChild.nodeName.toLowerCase()=="input"){_4a.formElement=_51.lastChild;}else{_4a.formElement=_51.nextSibling;}tinyMCE.handleVisualAid(_4a.getBody(),true,tinyMCE.settings["visual"]);tinyMCE.executeCallback("setupcontent_callback","_setupContent",0,_49,_4a.getBody(),_4a.getDoc());if(!tinyMCE.isMSIE){TinyMCE.prototype.addEventHandlers(_49);}_4a.startContent=_4a.getBody().innerHTML;tinyMCE.selectedInstance=_4a;tinyMCE.selectedElement=_4a.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup("insert_to_editor_dom",_4a.contentWindow.document.body);};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else{e.preventDefault();}};TinyMCE.prototype.removeTinyMCEFormElements=function(_53){for(var i=0;i<_53.elements.length;i++){var _55=_53.elements[i].name?_53.elements[i].name:_53.elements[i].id;if(_55.indexOf("mce_editor_")==0){_53.elements[i].disabled=true;}}};TinyMCE.prototype.handleEvent=function(e){if(typeof (tinyMCE)=="undefined"){return true;}switch(e.type){case "submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();return;case "reset":var _57=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==_57){window.setTimeout("tinyMCE.resetForm("+i+");",10);}}return;case "paste":if(tinyMCE.settings["auto_cleanup_word"]){var _59=e.target.editorId;if(!_59){_59=e.target.ownerDocument.editorId;}if(_59){window.setTimeout("tinyMCE.execInstanceCommand('"+_59+"', 'mceCleanupWord', false, null);",1);}}break;case "beforecut":case "beforepaste":if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");}break;case "keypress":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}}if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();}if(tinyMCE.isGecko&&tinyMCE.settings["force_p_newlines"]&&e.keyCode==13&&!e.shiftKey){if(tinyMCE.selectedInstance._insertPara(e)){e.preventDefault();return false;}}if(tinyMCE.isGecko&&tinyMCE.settings["force_p_newlines"]&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){e.preventDefault();return false;}}if(!tinyMCE.isMSIE&&e.ctrlKey&&tinyMCE.settings["custom_undo_redo"]){if(e.charCode==120||e.charCode==118){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");return;}if(tinyMCE.settings["custom_undo_redo_keyboard_shortcuts"]){if(e.charCode==122){tinyMCE.selectedInstance.execCommand("Undo");e.preventDefault();return false;}if(e.charCode==121){tinyMCE.selectedInstance.execCommand("Redo");e.preventDefault();return false;}}if(e.charCode==98){tinyMCE.selectedInstance.execCommand("Bold");e.preventDefault();return false;}if(e.charCode==105){tinyMCE.selectedInstance.execCommand("Italic");e.preventDefault();return false;}if(e.charCode==117){tinyMCE.selectedInstance.execCommand("Underline");e.preventDefault();return false;}}if(tinyMCE.settings["custom_undo_redo"]){var _5a=new Array(13,45,36,35,33,34,37,38,39,40);var _5b=false;for(var i=0;i<_5a.length;i++){if(_5a[i]==e.keyCode){tinyMCE.selectedInstance.typing=false;_5b=true;break;}}if(!tinyMCE.selectedInstance.typing&&!_5b){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;}}if(tinyMCE.isMSIE&&tinyMCE.settings["force_br_newlines"]&&e.keyCode==13){if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null){return false;}e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{return;}if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();}if(tinyMCE.isGecko&&tinyMCE.settings["force_p_newlines"]&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9){tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings["visual"]);}if(tinyMCE.isGecko&&tinyMCE.settings["document_base_url"]!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86){tinyMCE.selectedInstance.fixBrokenURLs();}if(tinyMCE.isMSIE&&tinyMCE.settings["custom_undo_redo"]){var _60=new Array(13,45,36,35,33,34,37,38,39,40);var _61=false;for(var i=0;i<_60.length;i++){if(_60[i]==e.keyCode){tinyMCE.selectedInstance.typing=false;_61=true;break;}}if(!tinyMCE.selectedInstance.typing&&!_61&&(e.keyCode<16||e.keyCode>18&&e.keyCode!=255)){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;tinyMCE.triggerNodeChange(false);}if(_61&&e.type=="keyup"){tinyMCE.triggerNodeChange(false);}var _63=new Array(8,46);for(var i=0;i<_63.length;i++){if(_63[i]==e.keyCode){if(!tinyMCE.selectedInstance.typing){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;}if(e.type=="keyup"){tinyMCE.triggerNodeChange(false);}return true;}}var _65=new Array(66,73,85,86,88);for(var i=0;i<_63.length;i++){if(_65[i]==e.keyCode&&e.ctrlKey){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return true;}}if(tinyMCE.settings["custom_undo_redo_keyboard_shortcuts"]){if(e.keyCode==90&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Undo");tinyMCE.triggerNodeChange(false);e.returnValue=false;e.cancelBubble=true;return false;}if(e.keyCode==89&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Redo");tinyMCE.triggerNodeChange(false);e.returnValue=false;e.cancelBubble=true;return false;}}}var _67=new Array(13,45,36,35,33,34,37,38,39,40);var _68=false;for(var i=0;i<_67.length;i++){if(_67[i]==e.keyCode){_68=true;break;}}if(_68&&e.type=="keyup"){tinyMCE.triggerNodeChange(false);}break;case "mousedown":case "mouseup":case "click":case "focus":if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();}var _6a=tinyMCE.getParentElement(e.target,"body");for(var _6b in tinyMCE.instances){var _6c=tinyMCE.instances[_6b];_6c.autoResetDesignMode();if(_6c.getBody()==_6a){tinyMCE.selectedInstance=_6c;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");tinyMCE.selectedInstance.typing=false;break;}}if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus"){tinyMCE.selectedNode=null;}tinyMCE.triggerNodeChange(false);if(!tinyMCE.selectedInstance&&e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}if(e.target.nodeName.toLowerCase()=="a"&&e.type=="click"&&e.altKey){var _6e=""+tinyMCE.cleanupEventStr(e.target.getAttribute("mce_onclick"));eval(_6e.replace("return false;",""));}if(tinyMCE.isGecko&&tinyMCE.settings["document_base_url"]!=""+document.location.href){window.setTimeout("tinyMCE.getInstanceById(\""+_6c.editorId+"\").fixBrokenURLs();",10);}return false;break;}};TinyMCE.prototype.switchClass=function(_6f,_70,_71){var _72=false;if(typeof (_71)!="undefined"&&_6f!=null){_6f.classLock=_71;_72=true;}if(_6f!=null&&(_72||!_6f.classLock)){_6f.oldClassName=_6f.className;_6f.className=_70;}};TinyMCE.prototype.restoreAndSwitchClass=function(_73,_74){if(_73!=null&&!_73.classLock){this.restoreClass(_73);this.switchClass(_73,_74);}};TinyMCE.prototype.switchClassSticky=function(_75,_76,_77){var _78,lockChanged=false;if(!this.stickyClassesLookup[_75]){this.stickyClassesLookup[_75]=document.getElementById(_75);}_78=this.stickyClassesLookup[_75];if(typeof (_77)!="undefined"&&_78!=null){_78.classLock=_77;lockChanged=true;}if(_78!=null&&(lockChanged||!_78.classLock)){_78.className=_76;_78.oldClassName=_76;}};TinyMCE.prototype.restoreClass=function(_79){if(_79!=null&&_79.oldClassName&&!_79.classLock){_79.className=_79.oldClassName;_79.oldClassName=null;}};TinyMCE.prototype.setClassLock=function(_7a,_7b){if(_7a!=null){_7a.classLock=_7b;}};TinyMCE.prototype.addEvent=function(obj,_7d,_7e){if(tinyMCE.isMSIE){obj.attachEvent("on"+_7d,_7e);}else{obj.addEventListener(_7d,_7e,false);}};TinyMCE.prototype.submitPatch=function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.oldSubmit();};TinyMCE.prototype.onLoad=function(){for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var _80=new Array();if(document.forms&&tinyMCE.settings["add_form_submit_trigger"]&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var _82=document.forms[i];tinyMCE.addEvent(_82,"submit",TinyMCE.prototype.handleEvent);tinyMCE.addEvent(_82,"reset",TinyMCE.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings["submit_patch"]){try{_82.oldSubmit=_82.submit;_82.submit=TinyMCE.prototype.submitPatch;}catch(e){}}}}var _83=tinyMCE.settings["mode"];switch(_83){case "exact":var _84=tinyMCE.getParam("elements","",true,",");for(var i=0;i<_84.length;i++){var _86=tinyMCE._getElementById(_84[i]);var _87=_86?_86.getAttribute(tinyMCE.settings["textarea_trigger"]):"";if(_87=="false"){continue;}if(tinyMCE.settings["ask"]&&_86){_80[_80.length]=_86;continue;}if(_86){tinyMCE.addMCEControl(_86,_84[i]);}else{if(tinyMCE.settings["debug"]){alert("Error: Could not find element by id or name: "+_84[i]);}}}break;case "specific_textareas":case "textareas":var _88=document.getElementsByTagName("textarea");for(var i=0;i<_88.length;i++){var _8a=_88.item(i).getAttribute(tinyMCE.settings["textarea_trigger"]);if((_83=="specific_textareas"&&_8a=="true")||(_83=="textareas"&&_8a!="false")){_80[_80.length]=_88.item(i);}}break;}for(var i=0;i<_80.length;i++){var _8c=_80[i];var _8d=_8c.name?_8c.name:_8c.id;if(tinyMCE.settings["ask"]){if(tinyMCE.isGecko){var _8e=tinyMCE.settings;tinyMCE.addEvent(_8c,"focus",function(e){window.setTimeout(function(){TinyMCE.prototype.confirmAdd(e,_8e);},10);});}else{var _90=tinyMCE.settings;tinyMCE.addEvent(_8c,"focus",function(){TinyMCE.prototype.confirmAdd(null,_90);});}}else{tinyMCE.addMCEControl(_8c,_8d);}}if(tinyMCE.settings["auto_focus"]){window.setTimeout(function(){var _91=tinyMCE.getInstanceById(tinyMCE.settings["auto_focus"]);_91.selectNode(_91.getBody(),true,true);_91.contentWindow.focus();},10);}tinyMCE.executeCallback("oninit","_oninit",0);}};TinyMCE.prototype.removeMCEControl=function(_92){var _93=tinyMCE.getInstanceById(_92);if(_93){_93.switchSettings();_92=_93.editorId;var _94=tinyMCE.getContent(_92);var _95=new Array();for(var _96 in tinyMCE.instances){var _97=tinyMCE.instances[_96];if(_96!=_92){_95[_96]=_97;}}tinyMCE.instances=_95;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var _98=document.getElementById(_92+"_parent");var _99=_93.oldTargetElement;var _9a=_99.nodeName.toLowerCase();if(_9a=="textarea"||_9a=="input"){_98.parentNode.removeChild(_98);_99.style.display="inline";_99.value=_94;}else{_99.innerHTML=_94;_98.parentNode.insertBefore(_99,_98);_98.parentNode.removeChild(_98);}}};TinyMCE.prototype._cleanupElementName=function(_9b,_9c){_9b=_9b.toLowerCase();if(_9b=="body"){return null;}if(tinyMCE.cleanup_verify_html){for(var i=0;i<tinyMCE.cleanup_invalidElements.length;i++){if(tinyMCE.cleanup_invalidElements[i]==_9b){return null;}}var _9e=false;var _9f=null;for(var i=0;i<tinyMCE.cleanup_validElements.length&&!_9f;i++){for(var x=0,n=tinyMCE.cleanup_validElements[i][0].length;x<n;x++){var _a2=tinyMCE.cleanup_validElements[i][0][x];if(_a2.charAt(0)=="+"){_a2=_a2.substring(1);}if(_a2.match(new RegExp("\\*|\\?|\\+","g"))!=null){_a2=_a2.replace(new RegExp("\\?","g"),"(\\S?)");_a2=_a2.replace(new RegExp("\\+","g"),"(\\S+)");_a2=_a2.replace(new RegExp("\\*","g"),"(\\S*)");_a2="^"+_a2+"$";if(_9b.match(new RegExp(_a2,"g"))){_9f=tinyMCE.cleanup_validElements[i];_9e=true;break;}}if(_9b==_a2){_9f=tinyMCE.cleanup_validElements[i];_9e=true;_9b=_9f[0][0];break;}}}if(!_9e){return null;}}if(!tinyMCE.isMSIE){if(_9b=="strong"&&!tinyMCE.cleanup_on_save){_9b="b";}else{if(_9b=="em"&&!tinyMCE.cleanup_on_save){_9b="i";}}}if(tinyMCE.isMSIE){if(_9b=="table"){var _a3=_9c.style.pixelWidth==0?_9c.getAttribute("width"):_9c.style.pixelWidth;_9c.setAttribute("width",_a3);_a3=_9c.style.pixelHeight==0?_9c.getAttribute("height"):_9c.style.pixelHeight;_9c.setAttribute("height",_a3);}}var _a4=new Object();_a4.element_name=_9b;_a4.valid_attribs=_9f;return _a4;};TinyMCE.prototype._fixInlineStyles=function(elm){var _a6=elm.nodeName;if(elm.nodeName=="FONT"){if((c=tinyMCE.getAttrib(elm,"color"))!=""){elm.style.color=c;}}if(_a6=="TABLE"||_a6=="TD"||_a6=="IMG"){var _a7;_a7=tinyMCE.isMSIE?elm.width:elm.getAttribute("width");if(_a7&&_a7!=""){if(typeof (_a7)!="string"||!_a7.indexOf("%")){_a7+="px";}elm.style.width=_a7;}_a7=tinyMCE.isMSIE?elm.height:elm.getAttribute("height");if(_a7&&_a7!=""){if(typeof (_a7)!="string"||!_a7.indexOf("%")){_a7+="px";}elm.style.height=_a7;}_a7=tinyMCE.isMSIE?elm.border:elm.getAttribute("border");if(_a7&&_a7!=""&&(_a7!="0"&&_a6!="TABLE")){elm.style.borderWidth=_a7+"px";}}_a7=elm.getAttribute("align");if(_a7&&_a7!=""){if(elm.nodeName.toLowerCase()=="img"){if(tinyMCE.isMSIE){elm.style.styleFloat=_a7;}else{elm.style.cssFloat=_a7;}}else{elm.style.textAlign=_a7;}}_a7=elm.getAttribute("vspace");if(_a7&&_a7!=""){elm.style.marginTop=_a7+"px";elm.style.marginBottom=_a7+"px";}_a7=elm.getAttribute("hspace");if(_a7&&_a7!=""){elm.style.marginLeft=_a7+"px";elm.style.marginRight=_a7+"px";}};TinyMCE.prototype._cleanupAttribute=function(_a8,_a9,_aa,_ab){var _ac=_aa.nodeName.toLowerCase();var _ad=_aa.nodeValue;var _ae=null;var _af=false;if(tinyMCE.cleanup_inline_styles&&(_a9=="table"||_a9=="td"||_a9=="img")){if(_ac=="width"||_ac=="height"||_ac=="border"||_ac=="align"||_ac=="valign"||_ac=="hspace"||_ac=="vspace"){return null;}}if(_ac.indexOf("moz_")!=-1){return null;}if(!tinyMCE.isMSIE&&(_ac=="mce_real_href"||_ac=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var _b0=new Object();_b0.name=_ac;_b0.value=_ad;return _b0;}else{return null;}}if(_ac=="mce_onclick"){_af=true;}if(tinyMCE.cleanup_verify_html&&!_af){for(var i=1;i<_a8.length;i++){var _b2=_a8[i][0];var re=null;if(_b2.match(new RegExp("\\*|\\?|\\+","g"))!=null){_b2=_b2.replace(new RegExp("\\?","g"),"(\\S?)");_b2=_b2.replace(new RegExp("\\+","g"),"(\\S+)");_b2=_b2.replace(new RegExp("\\*","g"),"(\\S*)");_b2="^"+_b2+"$";re=new RegExp(_b2,"g");}if((re&&_ac.match(re)!=null)||_ac==_b2){_af=true;_ae=_a8[i][3];break;}}if((_a9=="table"||_a9=="td")&&_ac=="style"){_af=true;}if(!_af){return false;}}else{_af=true;}switch(_ac){case "size":if(tinyMCE.isMSIE5&&_a9=="font"){_ad=_ab.size;}break;case "color":if(tinyMCE.isMSIE5&&_a9=="font"){_ad=_ab.color;}break;case "width":if(tinyMCE.isMSIE){_ad=_ab.width;}break;case "height":if(tinyMCE.isMSIE){_ad=_ab.height;}break;case "border":if(tinyMCE.isMSIE){_ad=_ab.border;}break;case "class":if(_a9=="table"||_a9=="td"){if(tinyMCE.cleanup_visual_table_class!=""){_ad=tinyMCE.getVisualAidClass(_ad,!tinyMCE.cleanup_on_save);}}if(!tinyMCE._verifyClass(_ab)||_ad==""){return null;}break;case "style":_ad=_ab.style.cssText.toLowerCase();if(tinyMCE.isMSIE){var _b4=_ab.style.border;var bt=_ab.style.borderTop;var bl=_ab.style.borderLeft;var br=_ab.style.borderRight;var bb=_ab.style.borderBottom;if(_b4!=""&&(bt==_b4&&bl==_b4&&br==_b4&&bb==_b4)){_ad=tinyMCE.regexpReplace(_ad,"border-top: "+_b4+"?; ?","");_ad=tinyMCE.regexpReplace(_ad,"border-left: "+_b4+"?; ?","");_ad=tinyMCE.regexpReplace(_ad,"border-right: "+_b4+"?; ?","");_ad=tinyMCE.regexpReplace(_ad,"border-bottom: "+_b4+"?;( ?)","border: "+_b4+";$1");}}break;case "onclick":case "mce_onclick":if(tinyMCE.isMSIE5){break;}if(tinyMCE.cleanup_on_save){if(_ab.getAttribute("mce_onclick")){_ac="onclick";_ad=""+_ab.getAttribute("mce_onclick");}}else{if(_ac=="onclick"&&!tinyMCE.cleanup_on_save){return null;}}break;case "href":case "src":if(!tinyMCE.isMSIE&&_ac=="href"&&_ab.getAttribute("mce_real_href")){_ad=_ab.getAttribute("mce_real_href");}if(!tinyMCE.isMSIE&&_ac=="src"&&_ab.getAttribute("mce_real_src")){_ad=_ab.getAttribute("mce_real_src");}if(tinyMCE.isGecko&&!tinyMCE.settings["relative_urls"]){_ad=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings["base_href"],_ad);}_ad=eval(tinyMCE.cleanup_urlconverter_callback+"(attribValue, element_node, tinyMCE.cleanup_on_save);");break;case "colspan":case "rowspan":if(_ad=="1"){return null;}break;case "_moz-userdefined":case "editorid":case "editor_id":case "mce_real_href":case "mce_real_src":return null;}if(_ae!=null){var _b9=false;for(var i=0;i<_ae.length;i++){if(_ad==_ae[i]){_b9=true;break;}}if(!_b9){return null;}}var _bb=new Object();_bb.name=_ac;_bb.value=_ad;return _bb;};TinyMCE.prototype._verifyClass=function(_bc){if(tinyMCE.isGecko){var _bd=_bc.getAttribute("class");if(!_bd){return false;}}if(tinyMCE.isMSIE){var _be=_bc.getAttribute("className");}if(tinyMCE.cleanup_verify_css_classes&&tinyMCE.cleanup_on_save){var _bf=tinyMCE.getCSSClasses();nonDefinedCSS=true;for(var c=0;c<_bf.length;c++){if(_bf[c]==_be){nonDefinedCSS=false;break;}}if(nonDefinedCSS&&_be.indexOf("mce_")!=0){_bc.removeAttribute("className");_bc.removeAttribute("class");return false;}}return true;};TinyMCE.prototype.cleanupNode=function(_c1){var _c2="";switch(_c1.nodeType){case 1:var _c3=tinyMCE._cleanupElementName(_c1.nodeName,_c1);var _c4=_c3?_c3.element_name:null;var _c5=_c3?_c3.valid_attribs:null;var _c6="";var _c7=false;if(_c4!=null&&_c4.charAt(0)=="+"){_c4=_c4.substring(1);_c7=true;}if(tinyMCE.isMSIE&&tinyMCE.settings["fix_content_duplication"]){var _c8=tinyMCE.cleanup_elementLookupTable;for(var i=0;i<_c8.length;i++){if(_c8[i]==_c1){return _c2;}}_c8[_c8.length]=_c1;}if(!_c4){if(_c1.hasChildNodes()){for(var i=0;i<_c1.childNodes.length;i++){_c2+=this.cleanupNode(_c1.childNodes[i]);}}return _c2;}if(_c1.style&&(_c1.style.cssText.indexOf("mso-")!=-1&&tinyMCE.settings["auto_cleanup_word"])||_c1.style.cssText==""){_c1.style.cssText="";_c1.removeAttribute("style");}if(tinyMCE.cleanup_inline_styles){tinyMCE._fixInlineStyles(_c1);}if(_c5){for(var a=1;a<_c5.length;a++){var _cc,attribDefaultValue,attribForceValue,attribValue;_cc=_c5[a][0];attribDefaultValue=_c5[a][1];attribForceValue=_c5[a][2];if(attribDefaultValue!=null||attribForceValue!=null){var _cd=_c1.getAttribute(_cc);if(_c1.getAttribute(_cc)==null||_c1.getAttribute(_cc)==""){_cd=attribDefaultValue;}_cd=attribForceValue?attribForceValue:_cd;if(_cd=="{$uid}"){_cd="uid_"+(tinyMCE.cleanup_idCount++);}if(_cc=="class"){_cd=tinyMCE.getVisualAidClass(_cd,tinyMCE.cleanup_on_save);}_c1.setAttribute(_cc,_cd);}}}if(_c4=="span"&&tinyMCE.cleanup_trim_span_elements){var re=new RegExp("^[ \t]+","g");var _cf=true;for(var a=0;a<_c1.childNodes.length;a++){var _d1=_c1.childNodes[a];if((_d1.nodeType==3&&!_d1.nodeValue.match(re))||_d1.nodeName.toLowerCase()!="span"){_cf=false;break;}}tinyMCE._verifyClass(_c1);var _d2=0;for(var i=0;i<_c1.attributes.length;i++){if(_c1.attributes[i].specified){_d2++;}}if(_cf||_d2==0){if(_c1.hasChildNodes()){for(var i=0;i<_c1.childNodes.length;i++){_c2+=this.cleanupNode(_c1.childNodes[i]);}}return _c2;}}if(_c4=="table"&&!_c1.hasChildNodes()){return "";}if(tinyMCE.isGecko&&_c4=="img"){var w=_c1.style.width;if(w!=null&&w!=""){_c1.setAttribute("width",w);}var h=_c1.style.height;if(h!=null&&h!=""){_c1.setAttribute("height",h);}}if(_c1.attributes.length>0){for(var i=0;i<_c1.attributes.length;i++){if(_c1.attributes[i].specified){var _d8=tinyMCE._cleanupAttribute(_c5,_c4,_c1.attributes[i],_c1);if(_d8){_c6+=" "+_d8.name+"="+"\""+_d8.value+"\"";}}}}if(tinyMCE.isMSIE&&_c4=="input"){if(_c1.type){if(!_c6.match(/type=/g)){_c6+=" type="+"\""+_c1.type+"\"";}}if(_c1.value){if(!_c6.match(/value=/g)){_c6+=" value="+"\""+_c1.value+"\"";}}}if((_c4=="p"||_c4=="td")&&(_c1.innerHTML==""||_c1.innerHTML==" ")){return "<"+_c4+_c6+">"+this.convertStringToXML(String.fromCharCode(160))+"</"+_c4+">";}if(tinyMCE.isMSIE&&_c4=="script"){return "<"+_c4+_c6+">"+_c1.text+"</"+_c4+">";}if(_c1.hasChildNodes()){if(_c4=="p"&&tinyMCE.cleanup_force_br_newlines){_c2+="<div"+_c6+">";}else{_c2+="<"+_c4+_c6+">";}for(var i=0;i<_c1.childNodes.length;i++){_c2+=this.cleanupNode(_c1.childNodes[i]);}if(_c4=="p"&&tinyMCE.cleanup_force_br_newlines){_c2+="</div><br />";}else{_c2+="</"+_c4+">";}}else{if(_c7){_c2+="<"+_c4+_c6+"></"+_c4+">";}else{_c2+="<"+_c4+_c6+" />";}}return _c2;case 3:if(_c1.parentNode.nodeName.toLowerCase()=="script"){return _c1.nodeValue;}return this.convertStringToXML(_c1.nodeValue);case 8:return "<!--"+_c1.nodeValue+"-->";default:return "[UNKNOWN NODETYPE "+_c1.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(_da){var _db="";for(var i=0;i<_da.length;i++){var chr=_da.charCodeAt(i);if(tinyMCE.settings["entity_encoding"]=="numeric"){if(chr>127){_db+="&#"+chr+";";}else{_db+=String.fromCharCode(chr);}continue;}if(tinyMCE.settings["entity_encoding"]=="raw"){_db+=String.fromCharCode(chr);continue;}if(typeof (tinyMCE.cleanup_entities["c"+chr])!="undefined"&&tinyMCE.cleanup_entities["c"+chr]!=""){_db+="&"+tinyMCE.cleanup_entities["c"+chr]+";";}else{_db+=""+String.fromCharCode(chr);}}return _db;};TinyMCE.prototype._getCleanupElementName=function(_de){var pos;if(_de.charAt(0)=="+"){_de=_de.substring(1);}if((pos=_de.indexOf("/"))!=-1){_de=_de.substring(0,pos);}if((pos=_de.indexOf("["))!=-1){_de=_de.substring(0,pos);}return _de;};TinyMCE.prototype._initCleanup=function(){var _e0=tinyMCE.settings["valid_elements"];_e0=_e0.split(",");var _e1=tinyMCE.settings["extended_valid_elements"];_e1=_e1.split(",");for(var i=0;i<_e1.length;i++){var _e3=this._getCleanupElementName(_e1[i]);var _e4=false;for(var x=0;x<_e0.length;x++){if(this._getCleanupElementName(_e0[x])==_e3){_e0[x]=_e1[i];_e4=true;break;}}if(!_e4){_e0[_e0.length]=_e1[i];}}for(var i=0;i<_e0.length;i++){var _e7=_e0[i];_e7=_e7.replace("[","|");_e7=_e7.replace("]","");var _e8=_e7.split("|");for(var x=0;x<_e8.length;x++){_e8[x]=_e8[x].toLowerCase();}_e8[0]=_e8[0].split("/");for(var x=1;x<_e8.length;x++){var _eb=_e8[x];var _ec=null;var _ed=null;var _ee=null;if((pos=_eb.indexOf("="))!=-1){_ec=_eb.substring(pos+1);_eb=_eb.substring(0,pos);}if((pos=_eb.indexOf(":"))!=-1){_ed=_eb.substring(pos+1);_eb=_eb.substring(0,pos);}if((pos=_eb.indexOf("<"))!=-1){_ee=_eb.substring(pos+1).split("?");_eb=_eb.substring(0,pos);}_e8[x]=new Array(_eb,_ec,_ed,_ee);}_e0[i]=_e8;}var _ef=tinyMCE.settings["invalid_elements"].split(",");for(var i=0;i<_ef.length;i++){_ef[i]=_ef[i].toLowerCase();}tinyMCE.settings["cleanup_validElements"]=_e0;tinyMCE.settings["cleanup_invalidElements"]=_ef;tinyMCE.settings["cleanup_entities"]=new Array();var _f1=tinyMCE.getParam("entities","",true,",");for(var i=0;i<_f1.length;i+=2){tinyMCE.settings["cleanup_entities"]["c"+_f1[i]]=_f1[i+1];}};TinyMCE.prototype._cleanupHTML=function(doc,_f4,_f5,_f6,_f7){if(!tinyMCE.settings["cleanup"]){return _f5.innerHTML;}tinyMCE._customCleanup(_f7?"get_from_editor_dom":"insert_to_editor_dom",doc.body);tinyMCE.cleanup_validElements=tinyMCE.settings["cleanup_validElements"];tinyMCE.cleanup_entities=tinyMCE.settings["cleanup_entities"];tinyMCE.cleanup_invalidElements=tinyMCE.settings["cleanup_invalidElements"];tinyMCE.cleanup_verify_html=tinyMCE.settings["verify_html"];tinyMCE.cleanup_force_br_newlines=tinyMCE.settings["force_br_newlines"];tinyMCE.cleanup_urlconverter_callback=tinyMCE.settings["urlconverter_callback"];tinyMCE.cleanup_verify_css_classes=tinyMCE.settings["verify_css_classes"];tinyMCE.cleanup_visual_table_class=tinyMCE.settings["visual_table_class"];tinyMCE.cleanup_apply_source_formatting=tinyMCE.settings["apply_source_formatting"];tinyMCE.cleanup_trim_span_elements=tinyMCE.settings["trim_span_elements"];tinyMCE.cleanup_inline_styles=tinyMCE.settings["inline_styles"];tinyMCE.cleanup_visual_aid=_f6;tinyMCE.cleanup_on_save=_f7;tinyMCE.cleanup_idCount=0;tinyMCE.cleanup_elementLookupTable=new Array();var _f8=new Date().getTime();tinyMCE._convertOnClick(_f5);if(tinyMCE.isMSIE){_f5.innerHTML=tinyMCE.regexpReplace(_f5.innerHTML,"<p>[ \n\r]*<hr id=null>[ \n\r]*</p>","<hr />","gi");_f5.innerHTML=tinyMCE.regexpReplace(_f5.innerHTML,"<!([^-(DOCTYPE)]* )|<!/[^-]*>","","gi");}var _f9=this.cleanupNode(_f5);if(tinyMCE.settings["debug"]){alert("Cleanup process executed in: "+(new Date().getTime()-_f8)+" ms.");}_f9=tinyMCE.regexpReplace(_f9,"<p><hr /></p>","<hr />");_f9=tinyMCE.regexpReplace(_f9,"<p> </p><hr /><p> </p>","<hr />");if(!tinyMCE.isMSIE){_f9=_f9.replace(new RegExp("<o:p _moz-userdefined=\"\" />","g"),"");}if(tinyMCE.settings["apply_source_formatting"]){_f9=_f9.replace(new RegExp("<(p|div)([^>]*)>","g"),"\n<$1$2>\n");_f9=_f9.replace(new RegExp("</(p|div)([^>]*)>","g"),"\n</$1$2>\n");_f9=_f9.replace(new RegExp("<br />","g"),"<br />\n");}if(tinyMCE.settings["force_br_newlines"]){var re=new RegExp("<p> </p>","g");_f9=_f9.replace(re,"<br />");}if(tinyMCE.settings["force_p_newlines"]){var re=new RegExp("<>","g");_f9=_f9.replace(re,"");}if(tinyMCE.settings["remove_linebreaks"]){_f9=_f9.replace(new RegExp("\r|\n","g")," ");}_f9=tinyMCE._customCleanup(_f7?"get_from_editor":"insert_to_editor",_f9);var chk=tinyMCE.regexpReplace(_f9,"[ \t\r\n]","").toLowerCase();if(chk=="<br/>"||chk=="<br>"||chk=="<p> </p>"||chk=="<p> </p>"||chk=="<p></p>"){_f9="";}if(tinyMCE.settings["preformatted"]){return "<pre>"+_f9+"</pre>";}return _f9;};TinyMCE.prototype.setAttrib=function(_fd,_fe,_ff,_100){if(!_100&&_ff!=null){var re=new RegExp("[^0-9%]","g");_ff=_ff.replace(re,"");}if(_ff!=null&&_ff!=""){_fd.setAttribute(_fe,_ff);}else{_fd.removeAttribute(_fe);}if(_ff!=null&&_ff!=""){_fd.setAttribute(_fe,_ff);}else{_fd.removeAttribute(_fe);}};TinyMCE.prototype.insertLink=function(href,_103,_104,_105,_106){this.execCommand("mceAddUndoLevel");if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var _108=tinyMCE.getParentElement(this.selectedElement,"a");var _109=false;if(!_108){_108=doc.createElement("a");_109=true;}href=eval(tinyMCE.settings["urlconverter_callback"]+"(href, linkElement);");tinyMCE.setAttrib(_108,"href",href);tinyMCE.setAttrib(_108,"target",_103);tinyMCE.setAttrib(_108,"title",_104);tinyMCE.setAttrib(_108,"mce_onclick",_105);tinyMCE.setAttrib(_108,"class",_106);if(_109){_108.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(_108,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,"<a href=\"#mce_temp_url#\">"+this.selectedInstance.getSelectedHTML()+"</a>");}else{this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");}tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var _10a=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i<_10a.length;i++){href=eval(tinyMCE.settings["urlconverter_callback"]+"(href, elementArray[i]);");tinyMCE.setAttrib(_10a[i],"href",href);tinyMCE.setAttrib(_10a[i],"mce_real_href",href);tinyMCE.setAttrib(_10a[i],"target",_103);tinyMCE.setAttrib(_10a[i],"title",_104);tinyMCE.setAttrib(_10a[i],"mce_onclick",_105);tinyMCE.setAttrib(_10a[i],"class",_106);}tinyMCE.linkElement=_10a[0];}if(this.linkElement){href=eval(tinyMCE.settings["urlconverter_callback"]+"(href, this.linkElement);");tinyMCE.setAttrib(this.linkElement,"href",href);tinyMCE.setAttrib(this.linkElement,"mce_real_href",href);tinyMCE.setAttrib(this.linkElement,"target",_103);tinyMCE.setAttrib(this.linkElement,"title",_104);tinyMCE.setAttrib(this.linkElement,"mce_onclick",_105);tinyMCE.setAttrib(this.linkElement,"class",_106);}};TinyMCE.prototype.insertImage=function(src,alt,_10e,_10f,_110,_111,_112,_113,_114,_115,_116){if(src==""){return;}this.execCommand("mceAddUndoLevel");if(!this.imgElement&&tinyMCE.isSafari){var html="";html+="<img src=\""+src+"\" alt=\""+alt+"\"";html+=" border=\""+_10e+"\" hspace=\""+_10f+"\"";html+=" vspace=\""+_110+"\" width=\""+_111+"\"";html+=" height=\""+_112+"\" align=\""+_113+"\" title=\""+_114+"\" onmouseover=\""+_115+"\" onmouseout=\""+_116+"\" />";tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,"<img src=\"#mce_temp_url#\" />");}else{this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");}tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var _118=false;src=eval(tinyMCE.settings["urlconverter_callback"]+"(src, tinyMCE.imgElement);");if(_115&&_115!=""){_115="this.src='"+eval(tinyMCE.settings["urlconverter_callback"]+"(onmouseover, tinyMCE.imgElement);")+"';";}if(_116&&_116!=""){_116="this.src='"+eval(tinyMCE.settings["urlconverter_callback"]+"(onmouseout, tinyMCE.imgElement);")+"';";}if(typeof (_114)=="undefined"){_114=alt;}if(_111!=this.imgElement.getAttribute("width")||_112!=this.imgElement.getAttribute("height")||_113!=this.imgElement.getAttribute("align")){_118=true;}tinyMCE.setAttrib(this.imgElement,"src",src);tinyMCE.setAttrib(this.imgElement,"mce_real_src",src);tinyMCE.setAttrib(this.imgElement,"alt",alt);tinyMCE.setAttrib(this.imgElement,"title",_114);tinyMCE.setAttrib(this.imgElement,"align",_113);tinyMCE.setAttrib(this.imgElement,"border",_10e,true);tinyMCE.setAttrib(this.imgElement,"hspace",_10f,true);tinyMCE.setAttrib(this.imgElement,"vspace",_110,true);tinyMCE.setAttrib(this.imgElement,"width",_111,true);tinyMCE.setAttrib(this.imgElement,"height",_112,true);tinyMCE.setAttrib(this.imgElement,"onmouseover",_115);tinyMCE.setAttrib(this.imgElement,"onmouseout",_116);if(_111&&_111!=""){this.imgElement.style.pixelWidth=_111;}if(_112&&_112!=""){this.imgElement.style.pixelHeight=_112;}if(_118){tinyMCE.selectedInstance.repaint();}}};TinyMCE.prototype.getElementByAttributeValue=function(node,_11a,_11b,_11c){var _11d=this.getElementsByAttributeValue(node,_11a,_11b,_11c);if(_11d.length==0){return null;}return _11d[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,_11f,_120,_121){var _122=new Array();if(node&&node.nodeName.toLowerCase()==_11f){if(node.getAttribute(_120)&&node.getAttribute(_120).indexOf(_121)!=-1){_122[_122.length]=node;}}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x<n;x++){var _124=this.getElementsByAttributeValue(node.childNodes[x],_11f,_120,_121);for(var i=0,m=_124.length;i<m;i++){_122[_122.length]=_124[i];}}}return _122;};TinyMCE.prototype.isBlockElement=function(node){return node!=null&&node.nodeType==1&&this.blockRegExp.test(node.nodeName);};TinyMCE.prototype.getParentBlockElement=function(node){while(node){if(this.blockRegExp.test(node.nodeName)){return node;}node=node.parentNode;}return null;};TinyMCE.prototype.getNodeTree=function(node,_129,type,_12b){if(typeof (type)=="undefined"||node.nodeType==type&&(typeof (_12b)=="undefined"||node.nodeName.toLowerCase()==_12b.toLowerCase())){_129[_129.length]=node;}if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++){tinyMCE.getNodeTree(node.childNodes[i],_129,type,_12b);}}return _129;};TinyMCE.prototype.getParentElement=function(node,_12e,_12f,_130){if(typeof (_12e)=="undefined"){if(node.nodeType==1){return node;}while((node=node.parentNode)!=null&&node.nodeType!=1){}return node;}var _131=_12e.split(",");if(node==null){return null;}do{for(var i=0;i<_131.length;i++){if(node.nodeName.toLowerCase()==_131[i].toLowerCase()||_12e=="*"){if(typeof (_12f)=="undefined"){return node;}else{if(node.getAttribute(_12f)){if(typeof (_130)=="undefined"){if(node.getAttribute(_12f)!=""){return node;}}else{if(node.getAttribute(_12f)==_130){return node;}}}}}}}while(node=node.parentNode);return null;};TinyMCE.prototype.convertURL=function(url,node,_135){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;var _139=(prot=="file:");url=tinyMCE.regexpReplace(url,"(http|https):///","/");if(url.indexOf("mailto:")!=-1||url.indexOf("javascript:")!=-1||tinyMCE.regexpReplace(url,"[ \t\r\n+]|%20","").charAt(0)=="#"){return url;}if(!tinyMCE.isMSIE&&!_135&&url.indexOf("://")==-1&&url.charAt(0)!="/"){return tinyMCE.settings["base_href"]+url;}if(!tinyMCE.settings["relative_urls"]){var _13a=tinyMCE.parseURL(url);var _13b=tinyMCE.parseURL(tinyMCE.settings["base_href"]);if(_13a["anchor"]&&_13a["path"]==_13b["path"]){return "#"+_13a["anchor"];}}if(_135&&tinyMCE.settings["relative_urls"]){var _13c=tinyMCE.parseURL(url);var _13d=tinyMCE.parseURL(tinyMCE.settings["document_base_url"]);if(_13c["host"]==_13d["host"]&&(!_13c["port"]||_13c["port"]==_13d["port"])){return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings["document_base_url"],url);}}if(!_139&&tinyMCE.settings["remove_script_host"]){var _13e="",portPart="";if(port!=""){portPart=":"+port;}_13e=prot+"//"+host+portPart+"/";if(url.indexOf(_13e)==0){url=url.substring(_13e.length-1);}if(!tinyMCE.settings["relative_urls"]&&url.indexOf("://")==-1&&url.charAt(0)!="/"){url="/"+url;}}return url;};TinyMCE.prototype.parseURL=function(_13f){var _140=new Array();if(_13f){var pos,lastPos;pos=_13f.indexOf("://");if(pos!=-1){_140["protocol"]=_13f.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<_13f.length;i++){var chr=_13f.charAt(i);if(chr==":"){break;}if(chr=="/"){break;}}pos=i;_140["host"]=_13f.substring(lastPos,pos);lastPos=pos;if(_13f.charAt(pos)==":"){pos=_13f.indexOf("/",lastPos);_140["port"]=_13f.substring(lastPos+1,pos);}lastPos=pos;pos=_13f.indexOf("?",lastPos);if(pos==-1){pos=_13f.indexOf("#",lastPos);}if(pos==-1){pos=_13f.length;}_140["path"]=_13f.substring(lastPos,pos);lastPos=pos;if(_13f.charAt(pos)=="?"){pos=_13f.indexOf("#");pos=(pos==-1)?_13f.length:pos;_140["query"]=_13f.substring(lastPos+1,pos);}lastPos=pos;if(_13f.charAt(pos)=="#"){pos=_13f.length;_140["anchor"]=_13f.substring(lastPos+1,pos);}}return _140;};TinyMCE.prototype.convertAbsoluteURLToRelativeURL=function(_144,_145){var _146;var _147;var _148=0;var _149="";_144=_144.substring(0,_144.lastIndexOf("/"));_146=_144.split("/");_147=_145.split("/");if(_146.length>=_147.length){for(var i=0;i<_146.length;i++){if(i>=_147.length||_146[i]!=_147[i]){_148=i+1;break;}}}if(_146.length<_147.length){for(var i=0;i<_147.length;i++){if(i>=_146.length||_146[i]!=_147[i]){_148=i+1;break;}}}if(_148==1){return _145;}for(var i=0;i<(_146.length-(_148-1));i++){_149+="../";}for(var i=_148-1;i<_147.length;i++){if(i!=(_148-1)){_149+="/"+_147[i];}else{_149+=_147[i];}}return _149;};TinyMCE.prototype.convertRelativeToAbsoluteURL=function(_14e,_14f){var _150=TinyMCE.prototype.parseURL(_14e);var _151=TinyMCE.prototype.parseURL(_14f);if(_14f==""||_14f.charAt(0)=="/"||_14f.indexOf("://")!=-1||_14f.indexOf("mailto:")!=-1||_14f.indexOf("javascript:")!=-1||tinyMCE.regexpReplace(_14f,"[ \t\r\n+]|%20","").charAt(0)=="#"){return _14f;}baseURLParts=_150["path"].split("/");relURLParts=_151["path"].split("/");var _152=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0){continue;}_152[_152.length]=baseURLParts[i];}baseURLParts=_152.reverse();var _154=new Array();var _155=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]=="."){continue;}if(relURLParts[i]==".."){_155++;continue;}if(_155>0){_155--;continue;}_154[_154.length]=relURLParts[i];}relURLParts=_154.reverse();var len=baseURLParts.length-_155;var _158=(len<=0?"":"/")+baseURLParts.slice(0,len).join("/")+"/"+relURLParts.join("/");var _159="",end="";if(_150["protocol"]){_159+=_150["protocol"]+"://";}if(_150["host"]){_159+=_150["host"];}if(_150["port"]){_159+=":"+_150["port"];}if(_151["query"]){end+="?"+_151["query"];}if(_151["anchor"]){end+="#"+_151["anchor"];}if(_14f.charAt(_14f.length-1)=="/"){end+="/";}return _159+_158+end;};TinyMCE.prototype.getParam=function(name,_15b,_15c,_15d){var _15e=(typeof (this.settings[name])=="undefined")?_15b:this.settings[name];if(_15e=="true"||_15e=="false"){return (_15e=="true");}if(_15c){_15e=tinyMCE.regexpReplace(_15e,"[ \t\r\n]","");}if(typeof (_15d)!="undefined"&&_15d!=null){_15e=_15e.split(_15d);var _15f=new Array();for(var i=0;i<_15e.length;i++){if(_15e[i]&&_15e[i]!=""){_15f[_15f.length]=_15e[i];}}_15e=_15f;}return _15e;};TinyMCE.prototype.getLang=function(name,_162,_163){var _164=(typeof (tinyMCELang[name])=="undefined")?_162:tinyMCELang[name];if(_163){var el=document.createElement("div");el.innerHTML=_164;_164=el.innerHTML;}return _164;};TinyMCE.prototype.replaceVar=function(_166,_167,_168){var re=new RegExp("{\\$"+_167+"}","g");return _166.replace(re,_168);};TinyMCE.prototype.replaceVars=function(_16a,_16b){for(var key in _16b){var _16d=_16b[key];_16a=tinyMCE.replaceVar(_16a,key,_16d);}return _16a;};TinyMCE.prototype.triggerNodeChange=function(_16e,_16f){if(tinyMCE.settings["handleNodeChangeCallback"]){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var _171=inst.editorId;var elm=(typeof (_16f)!="undefined"&&_16f)?tinyMCE.selectedElement:inst.getFocusElement();var _173=-1;var _174=-1;var _175=false;var _176=inst.getSelectedText();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement){_175=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(_176&&_176.length>0);}if(tinyMCE.settings["custom_undo_redo"]){_173=inst.undoIndex;_174=inst.undoLevels.length;}tinyMCE.executeCallback("handleNodeChangeCallback","_handleNodeChange",0,_171,elm,_173,_174,inst.visualAid,_175);}}if(this.selectedInstance&&(typeof (_16e)=="undefined"||_16e)){this.selectedInstance.contentWindow.focus();}};TinyMCE.prototype._customCleanup=function(type,_179){var _17a=tinyMCE.settings["cleanup_callback"];if(_17a!=""&&eval("typeof("+_17a+")")!="undefined"){_179=eval(_17a+"(type, content);");}var _17b=tinyMCE.getParam("plugins","",true,",");for(var i=0;i<_17b.length;i++){if(eval("typeof(TinyMCE_"+_17b[i]+"_cleanup)")!="undefined"){_179=eval("TinyMCE_"+_17b[i]+"_cleanup(type, content);");}}return _179;};TinyMCE.prototype.getContent=function(_17d){if(typeof (_17d)!="undefined"){tinyMCE.selectedInstance=tinyMCE.getInstanceById(_17d);}if(tinyMCE.selectedInstance){return tinyMCE._cleanupHTML(this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);}return null;};TinyMCE.prototype.setContent=function(_17e){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand("mceSetContent",false,_17e);}};TinyMCE.prototype.importThemeLanguagePack=function(name){if(typeof (name)=="undefined"){name=tinyMCE.settings["theme"];}tinyMCE.loadScript(tinyMCE.baseURL+"/themes/"+name+"/langs/"+tinyMCE.settings["language"]+".js");};TinyMCE.prototype.importPluginLanguagePack=function(name,_181){var lang="en";_181=_181.split(",");for(var i=0;i<_181.length;i++){if(tinyMCE.settings["language"]==_181[i]){lang=tinyMCE.settings["language"];}}tinyMCE.loadScript(tinyMCE.baseURL+"/plugins/"+name+"/langs/"+lang+".js");};TinyMCE.prototype.applyTemplate=function(html,args){html=tinyMCE.replaceVar(html,"themeurl",tinyMCE.themeURL);if(typeof (args)!="undefined"){html=tinyMCE.replaceVars(html,args);}html=tinyMCE.replaceVars(html,tinyMCE.settings);html=tinyMCE.replaceVars(html,tinyMCELang);return html;};TinyMCE.prototype.openWindow=function(_186,args){var html,width,height,x,y,resizable,scrollbars,url;args["mce_template_file"]=_186["file"];tinyMCE.windowArgs=args;html=_186["html"];if(!(width=_186["width"])){width=320;}if(!(height=_186["height"])){height=200;}if(tinyMCE.isMSIE){height+=30;}x=parseInt(screen.width/2)-(width/2);y=parseInt(screen.height/2)-(height/2);resizable=(args&&args["resizable"])?args["resizable"]:"no";scrollbars=(args&&args["scrollbars"])?args["scrollbars"]:"no";if(_186["file"].charAt(0)!="/"&&_186["file"].indexOf("://")==-1){url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+_186["file"];}else{url=_186["file"];}for(var name in args){url=tinyMCE.replaceVar(url,name,escape(args[name]));}if(html){html=tinyMCE.replaceVar(html,"css",this.settings["popups_css"]);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup","top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang["lang_popup_blocked"]);return;}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus();}else{if(tinyMCE.isMSIE&&resizable!="yes"&&tinyMCE.settings["dialog_type"]=="modal"){var _18b="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,_18b);}else{if(tinyMCE.settings["dialog_type"]=="window"||tinyMCE.settings["dialog_type"]=="modal"){var _18c=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac){_18c="no";}var win=window.open(url,"mcePopup","top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+_18c+",minimizable="+resizable+",modal="+_18c+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang["lang_popup_blocked"]);return;}eval("try { win.resizeTo(width, height); } catch(e) { }");win.focus();}else{var div=document.createElement("div");var id="mceDialog"+(tinyMCE.dialogCounter++);height+=30;div.id=id;div.className="mceDialog";div.style.width=width+"px";div.style.height=height+"px";var html="<div class=\"mceDialogHeader\"><div class=\"mceDialogTitle\"></div><div class=\"mceDialogClose\"><a href=\"javascript:tinyMCE.closeDialog();\"></a></div></div>";html+="<div id=\""+id+"IFrameWrapper\" class=\"mceDialogIFrameWrapper\"><iframe border=\"0\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" hspace=\"0\" vspace=\"0\" src=\""+url+"\" width=\""+width+"\" height=\""+height+"\"></iframe></div>";div.innerHTML=html;document.body.appendChild(div);tinyMCE._currentDialog=id;}}}};TinyMCE.prototype.closeDialog=function(){if(tinyMCE.settings["dialog_type"]=="div"){var div=document.getElementById(tinyMCE._currentDialog);if(div){div.parentNode.removeChild(div);}}else{window.close();}};TinyMCE.prototype.getVisualAidClass=function(_192,_193){var _194=tinyMCE.settings["visual_table_class"];if(typeof (_193)=="undefined"){_193=tinyMCE.settings["visual"];}var _195=new Array();var ar=_192.split(" ");for(var i=0;i<ar.length;i++){if(ar[i]==_194){ar[i]="";}if(ar[i]!=""){_195[_195.length]=ar[i];}}if(_193){_195[_195.length]=_194;}var _198="";for(var i=0;i<_195.length;i++){if(i>0){_198+=" ";}_198+=_195[i];}return _198;};TinyMCE.prototype.handleVisualAid=function(_19a,deep,_19c){if(!_19a){return;}var _19d=null;switch(_19a.nodeName.toLowerCase()){case "table":var oldW=_19a.style.width;var oldH=_19a.style.height;_19a.className=tinyMCE.getVisualAidClass(_19a.className,_19c&&_19a.getAttribute("border")==0);_19a.style.width=oldW;_19a.style.height=oldH;for(var y=0;y<_19a.rows.length;y++){for(var x=0;x<_19a.rows[y].cells.length;x++){var _1a2=tinyMCE.getVisualAidClass(_19a.rows[y].cells[x].className,_19c&&_19a.getAttribute("border")==0);_19a.rows[y].cells[x].className=_1a2;}}break;}if(deep&&_19a.hasChildNodes()){for(var i=0;i<_19a.childNodes.length;i++){tinyMCE.handleVisualAid(_19a.childNodes[i],deep,_19c);}}};TinyMCE.prototype.getAttrib=function(elm,name,_1a6){var v=elm.getAttribute(name);if(name=="class"&&!v){v=elm.className;}if(typeof (_1a6)=="undefined"){_1a6="";}return (v&&v!="")?v:_1a6;};TinyMCE.prototype.setAttrib=function(_1a8,name,_1aa,_1ab){if(typeof (_1aa)=="number"){_1aa=""+_1aa;}if(_1ab){if(_1aa==null){_1aa="";}var re=new RegExp("[^0-9%]","g");_1aa=_1aa.replace(re,"");}if(name=="class"){_1a8.className=_1aa;}if(_1aa!=null&&_1aa!=""&&_1aa!=-1){_1a8.setAttribute(name,_1aa);}else{_1a8.removeAttribute(name);}};TinyMCE.prototype._setHTML=function(doc,_1ae){if(tinyMCE.isMSIE){var re=new RegExp("<p><hr /></p>","g");_1ae=_1ae.replace(re,"<hr>");}try{doc.body.innerHTML=_1ae;}catch(e){if(this.isMSIE){doc.body.createTextRange().pasteHTML(_1ae);}}if(tinyMCE.isMSIE&&tinyMCE.settings["fix_content_duplication"]){var _1b0=doc.getElementsByTagName("P");for(var i=0;i<_1b0.length;i++){var node=_1b0[i];while((node=node.parentNode)!=null){if(node.nodeName.toLowerCase()=="p"){node.outerHTML=node.innerHTML;}}}var html=doc.body.innerHTML;if(html.indexOf("=\"mso")!=-1){for(var i=0;i<doc.body.all.length;i++){var el=doc.body.all[i];el.removeAttribute("className","",0);el.removeAttribute("style","",0);}html=doc.body.innerHTML;html=tinyMCE.regexpReplace(html,"<o:p></o:p>","<br />");html=tinyMCE.regexpReplace(html,"<o:p> </o:p>","");html=tinyMCE.regexpReplace(html,"<st1:.*?>","");html=tinyMCE.regexpReplace(html,"<p></p>","");html=tinyMCE.regexpReplace(html,"<p></p>\r\n<p></p>","");html=tinyMCE.regexpReplace(html,"<p> </p>","<br />");html=tinyMCE.regexpReplace(html,"<p>s*(<p>s*)?","<p>");html=tinyMCE.regexpReplace(html,"</p>s*(</p>s*)?","</p>");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str){return "";}if((pos=str.indexOf("this.src="))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf("'"));return src;}return "";};TinyMCE.prototype._getElementById=function(_1b9){var elm=document.getElementById(_1b9);if(!elm){for(var j=0;j<document.forms.length;j++){for(var k=0;k<document.forms[j].elements.length;k++){if(document.forms[j].elements[k].name==_1b9){elm=document.forms[j].elements[k];break;}}}}return elm;};TinyMCE.prototype.getEditorId=function(_1bd){var inst=this.getInstanceById(_1bd);if(!inst){return null;}return inst.editorId;};TinyMCE.prototype.getInstanceById=function(_1bf){var inst=this.instances[_1bf];if(!inst){for(var _1c1 in tinyMCE.instances){var _1c2=tinyMCE.instances[_1c1];if(_1c2.formTargetElementId==_1bf){inst=_1c2;break;}}}return inst;};TinyMCE.prototype.queryInstanceCommandValue=function(_1c3,_1c4){var inst=tinyMCE.getInstanceById(_1c3);if(inst){return inst.queryCommandValue(_1c4);}return false;};TinyMCE.prototype.queryInstanceCommandState=function(_1c6,_1c7){var inst=tinyMCE.getInstanceById(_1c6);if(inst){return inst.queryCommandState(_1c7);}return null;};TinyMCE.prototype.setWindowArg=function(name,_1ca){this.windowArgs[name]=_1ca;};TinyMCE.prototype.getWindowArg=function(name,_1cc){return (typeof (this.windowArgs[name])=="undefined")?_1cc:this.windowArgs[name];};TinyMCE.prototype.getCSSClasses=function(_1cd,doc){var _1cf=new Array();if(typeof (tinyMCE.cssClasses)!="undefined"){return tinyMCE.cssClasses;}if(typeof (_1cd)=="undefined"&&typeof (doc)=="undefined"){var _1d0;for(var _1d1 in tinyMCE.instances){_1d0=tinyMCE.instances[_1d1];break;}doc=_1d0.getDoc();}if(typeof (doc)=="undefined"){var _1d2=tinyMCE.getInstanceById(_1cd);doc=_1d2.getDoc();}if(doc){var _1d3=tinyMCE.isMSIE?doc.styleSheets:doc.styleSheets;if(_1d3&&_1d3.length>0){var _1d4=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(0).rules : doc.styleSheets[0].cssRules;} catch(e) {}");if(!_1d4){return new Array();}for(var i=0;i<_1d4.length;i++){var _1d6=_1d4[i].selectorText;if(_1d6){var _1d7=_1d6.split(",");for(var c=0;c<_1d7.length;c++){if(_1d7[c].indexOf(" ")!=-1||_1d7[c].indexOf(":")!=-1||_1d7[c].indexOf("mce_")==1){continue;}if(_1d7[c]=="."+tinyMCE.settings["visual_table_class"]){continue;}if(_1d7[c].indexOf(".")!=-1){_1cf[_1cf.length]=_1d7[c].substring(_1d7[c].indexOf(".")+1);}}}}}}if(_1cf.length>0){tinyMCE.cssClasses=_1cf;}return _1cf;};TinyMCE.prototype.regexpReplace=function(_1d9,_1da,_1db,opts){if(typeof (opts)=="undefined"){opts="g";}var re=new RegExp(_1da,opts);return _1d9.replace(re,_1db);};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace("function anonymous()\n{\n","");str=str.replace("\n}","");return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var _1e1=node;while(_1e1){pos.absLeft+=_1e1.offsetLeft;pos.absTop+=_1e1.offsetTop;_1e1=_1e1.offsetParent;}return pos;};TinyMCE.prototype.openFileBrowser=function(_1e2,url,type,win){var cb=tinyMCE.getParam("file_browser_callback");this.setWindowArg("window",win);if(eval("typeof("+cb+")")=="undefined"){alert("Callback function: "+cb+" could not be found.");}else{eval(cb+"(field_name, url, type, win);");}};TinyMCE.prototype.getControlHTML=function(_1e7){var _1e8=tinyMCE.getParam("plugins","",true,",");var _1e9;for(var i=_1e8.length;i>=0;i--){_1e9="TinyMCE_"+_1e8[i]+"_getControlHTML";if(eval("typeof("+_1e9+")")!="undefined"){var html=eval(_1e9+"('"+_1e7+"');");if(html!=""){return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+_1e8[i]);}}}return eval("TinyMCE_"+tinyMCE.settings["theme"]+"_getControlHTML"+"('"+_1e7+"');");};TinyMCE.prototype._themeExecCommand=function(_1ec,_1ed,_1ee,_1ef,_1f0){var _1f1=tinyMCE.getParam("plugins","",true,",");var _1f2;for(var i=_1f1.length;i>=0;i--){_1f2="TinyMCE_"+_1f1[i]+"_execCommand";if(eval("typeof("+_1f2+")")!="undefined"){if(eval(_1f2+"(editor_id, element, command, user_interface, value);")){return true;}}}_1f2="TinyMCE_"+tinyMCE.settings["theme"]+"_execCommand";if(eval("typeof("+_1f2+")")!="undefined"){return eval(_1f2+"(editor_id, element, command, user_interface, value);");}return false;};TinyMCE.prototype._getThemeFunction=function(_1f4,_1f5){if(_1f5){return "TinyMCE_"+tinyMCE.settings["theme"]+_1f4;}var _1f6=tinyMCE.getParam("plugins","",true,",");var _1f7;for(var i=_1f6.length;i>=0;i--){_1f7="TinyMCE_"+_1f6[i]+_1f4;if(eval("typeof("+_1f7+")")!="undefined"){return _1f7;}}return "TinyMCE_"+tinyMCE.settings["theme"]+_1f4;};TinyMCE.prototype.isFunc=function(_1f9){if(_1f9==null||_1f9==""){return false;}return eval("typeof("+_1f9+")")!="undefined";};TinyMCE.prototype.exec=function(_1fa,args){var str=_1fa+"(";for(var i=3;i<args.length;i++){str+="args["+i+"]";if(i<args.length-1){str+=",";}}str+=");";return eval(str);};TinyMCE.prototype.executeCallback=function(_1fe,_1ff,mode){switch(mode){case 0:var _201=false;var _202=tinyMCE.getParam("plugins","",true,",");for(var i=0;i<_202.length;i++){var func="TinyMCE_"+_202[i]+_1ff;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);_201=true;}}var func="TinyMCE_"+tinyMCE.settings["theme"]+_1ff;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);_201=true;}var func=tinyMCE.getParam(_1fe,"");if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);_201=true;}return _201;case 1:var _207=tinyMCE.getParam("plugins","",true,",");for(var i=0;i<_207.length;i++){var func="TinyMCE_"+_207[i]+_1ff;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments)){return true;}}}var func="TinyMCE_"+tinyMCE.settings["theme"]+_1ff;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments)){return true;}}var func=tinyMCE.getParam(_1fe,"");if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments)){return true;}}return false;}};function TinyMCEControl(_20c){this.undoLevels=new Array();this.undoIndex=0;this.isDirty=false;this.settings=_20c;this.settings["theme"]=tinyMCE.getParam("theme","default");this.settings["width"]=tinyMCE.getParam("width",-1);this.settings["height"]=tinyMCE.getParam("height",-1);}TinyMCEControl.prototype.repaint=function(){if(tinyMCE.isMSIE){return;}this.getBody().style.display="none";this.getBody().style.display="block";};TinyMCEControl.prototype.switchSettings=function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings["index"]){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings["index"];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute("mce_real_src");if(src&&src!=""){elms[i].setAttribute("src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute("mce_real_href");if(href&&href!=""){elms[i].setAttribute("href",href);}}};TinyMCEControl.prototype.convertAllRelativeURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute("src");if(src&&src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings["base_href"],src);elms[i].setAttribute("src",src);elms[i].setAttribute("mce_real_src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute("href");if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings["base_href"],href);elms[i].setAttribute("href",href);elms[i].setAttribute("mce_real_href",href);}}};TinyMCEControl.prototype.getSelectedHTML=function(){if(tinyMCE.isSafari){return this.getRng().toString();}var elm=document.createElement("body");if(tinyMCE.isGecko){elm.appendChild(this.getRng().cloneContents());}else{elm.innerHTML=this.getRng().htmlText;}return tinyMCE._cleanupHTML(this.contentDocument,this.settings,elm,this.visualAid);};TinyMCEControl.prototype.getBookmark=function(){var rng=this.getRng();if(tinyMCE.isSafari){return rng;}if(tinyMCE.isMSIE){return rng.getBookmark();}if(tinyMCE.isGecko){return rng.cloneRange();}return null;};TinyMCEControl.prototype.moveToBookmark=function(_21d){if(tinyMCE.isSafari){var sel=this.getSel().realSelection;sel.setBaseAndExtent(_21d.startContainer,_21d.startOffset,_21d.endContainer,_21d.endOffset);return true;}if(tinyMCE.isMSIE){return this.getRng().moveToBookmark(_21d);}if(tinyMCE.isGecko){var rng=this.getDoc().createRange();var sel=this.getSel();rng.setStart(_21d.startContainer,_21d.startOffset);rng.setEnd(_21d.endContainer,_21d.endOffset);sel.removeAllRanges();sel.addRange(rng);return true;}return false;};TinyMCEControl.prototype.getSelectedText=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();if(doc.selection.type=="Text"){var rng=doc.selection.createRange();selectedText=rng.text;}else{selectedText="";}}else{var sel=this.getSel();if(sel&&sel.toString){selectedText=sel.toString();}else{selectedText="";}}return selectedText;};TinyMCEControl.prototype.selectNode=function(node,_225,_226,_227){if(!node){return;}if(typeof (_225)=="undefined"){_225=true;}if(typeof (_226)=="undefined"){_226=false;}if(typeof (_227)=="undefined"){_227=true;}if(tinyMCE.isMSIE){var rng=this.getBody().createTextRange();try{rng.moveToElementText(node);if(_225){rng.collapse(_227);}rng.select();}catch(e){}}else{var sel=this.getSel();if(!sel){return;}if(tinyMCE.isSafari){sel.realSelection.setBaseAndExtent(node,0,node,node.innerText.length);if(_225){if(_227){sel.realSelection.collapseToStart();}else{sel.realSelection.collapseToEnd();}}this.scrollToNode(node);return;}var rng=this.getDoc().createRange();if(_226){var _22b=tinyMCE.getNodeTree(node,new Array(),3);if(_22b.length>0){rng.selectNodeContents(_22b[0]);}else{rng.selectNodeContents(node);}}else{rng.selectNode(node);}if(_225){if(!_227&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else{rng.collapse(_227);}}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1){tinyMCE.selectedElement=node;}};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var _22f=doc.body.scrollLeft+doc.documentElement.scrollLeft;var _230=doc.body.scrollTop+doc.documentElement.scrollTop;var _231=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings["auto_resize"]&&!(node.absTop>_230&&node.absTop<(_230-25+_231))){this.contentWindow.scrollTo(pos.absLeft,pos.absTop-_231+25);}};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE){return this.getDoc().selection;}var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var _233=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=="<"){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}_233.focusNode=sel.baseNode;_233.focusOffset=sel.baseOffset;_233.anchorNode=sel.extentNode;_233.anchorOffset=sel.extentOffset;_233.getRangeAt=getRangeAt;_233.text=""+sel;_233.realSelection=sel;_233.toString=function(){return this.text;};return _233;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null){return null;}if(tinyMCE.isMSIE){return sel.createRange();}if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp("[ \t\r\n]+","g"),"").toLowerCase()=="";}if(para.getElementsByTagName("img").length>0){return false;}if(para.getElementsByTagName("table").length>0){return false;}if(para.getElementsByTagName("hr").length>0){return false;}var _23f=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<_23f.length;i++){if(!isEmptyHTML(_23f[i].nodeValue)){return false;}}return true;}var doc=this.getDoc();var sel=this.getSel();var win=this.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var _246=doc.documentElement;var self=this;var _248="P";var _249=doc.createRange();_249.setStart(sel.anchorNode,sel.anchorOffset);_249.collapse(true);var _24a=doc.createRange();_24a.setStart(sel.focusNode,sel.focusOffset);_24a.collapse(true);var _24b=_249.compareBoundaryPoints(_249.START_TO_END,_24a)<0;var _24c=_24b?sel.anchorNode:sel.focusNode;var _24d=_24b?sel.anchorOffset:sel.focusOffset;var _24e=_24b?sel.focusNode:sel.anchorNode;var _24f=_24b?sel.focusOffset:sel.anchorOffset;var _250=tinyMCE.getParentBlockElement(_24c);var _251=tinyMCE.getParentBlockElement(_24e);if(_250!=null){_248=_250.nodeName.toUpperCase();if(_248=="TD"||_248=="TABLE"){_248="P";}}if((_250!=null&&_250.nodeName.toLowerCase()=="li")||(_251!=null&&_251.nodeName.toLowerCase()=="li")){return false;}if((_250!=null&&_250.nodeName.toLowerCase()=="table")||(_251!=null&&_251.nodeName.toLowerCase()=="table")){_250=_251=null;}var _252=(_250!=null&&_250.nodeName.toUpperCase()==_248)?_250.cloneNode(false):doc.createElement(_248);var _253=(_251!=null&&_251.nodeName.toUpperCase()==_248)?_251.cloneNode(false):doc.createElement(_248);var _254=_24c;var _255=_24e;node=_254;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node)){break;}_254=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=_255;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node)){break;}_255=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(_250==null){rng.deleteContents();sel.removeAllRanges();if(_254!=_246&&_255!=_246){_249=rng.cloneRange();if(_254==body){_249.setStart(_254,0);}else{_249.setStartBefore(_254);}_252.appendChild(_249.cloneContents());if(_255.parentNode.nodeName==_248){_255=_255.parentNode;}rng.setEndAfter(_255);var _256=rng.cloneContents();if(_256.firstChild&&(_256.firstChild.nodeName==_248||_256.firstChild.nodeName.toLowerCase()=="body")){var _257=_256.firstChild.childNodes;for(var i=0;i<_257.length;i++){if(_257[i].nodeName.toLowerCase()!="body"){_253.appendChild(_257[i]);}}}else{_253.appendChild(_256);}if(isEmpty(_252)){_252.innerHTML=" ";}if(isEmpty(_253)){_253.innerHTML=" ";}rng.deleteContents();_24a.deleteContents();_249.deleteContents();_253.normalize();_249.insertNode(_253);_252.normalize();_249.insertNode(_252);}else{body.innerHTML="<"+_248+"> </"+_248+"><"+_248+"> </"+_248+">";_253=body.childNodes[1];}this.selectNode(_253,true,true);return true;}if(_254.nodeName==_248){_249.setStart(_254,0);}else{_249.setStartBefore(_254);}_249.setEnd(_24c,_24d);_252.appendChild(_249.cloneContents());_24a.setEndAfter(_255);_24a.setStart(_24e,_24f);var _259=_24a.cloneContents();if(_259.firstChild&&_259.firstChild.nodeName==_248){var _25a=_259.firstChild.childNodes;for(var i=0;i<_25a.length;i++){if(_25a[i].nodeName.toLowerCase()!="body"){_253.appendChild(_25a[i]);}}}else{_253.appendChild(_259);}if(isEmpty(_252)){_252.innerHTML=" ";}if(isEmpty(_253)){_253.innerHTML=" ";}var rng=doc.createRange();if(!_254.previousSibling&&_254.parentNode.nodeName.toUpperCase()==_248){rng.setStartBefore(_254.parentNode);}else{if(_249.startContainer.nodeName.toUpperCase()==_248&&_249.startOffset==0){rng.setStartBefore(_249.startContainer);}else{rng.setStart(_249.startContainer,_249.startOffset);}}if(!_255.nextSibling&&_255.parentNode.nodeName.toUpperCase()==_248){rng.setEndAfter(_255.parentNode);}else{rng.setEnd(_24a.endContainer,_24a.endOffset);}rng.deleteContents();rng.insertNode(_253);rng.insertNode(_252);_253.normalize();_252.normalize();this.selectNode(_253,true,true);return true;};TinyMCEControl.prototype._handleBackSpace=function(_25d){var doc=this.getDoc();var sel=this.getSel();if(sel==null){return false;}var rng=sel.getRangeAt(0);var node=rng.startContainer;var elm=node.nodeType==3?node.parentNode:node;if(node==null){return;}if(elm&&elm.nodeName==""){var para=doc.createElement("p");while(elm.firstChild){para.appendChild(elm.firstChild);}elm.parentNode.insertBefore(para,elm);elm.parentNode.removeChild(elm);var rng=rng.cloneRange();rng.setStartBefore(node.nextSibling);rng.setEndAfter(node.nextSibling);rng.extractContents();this.selectNode(node.nextSibling,true,true);}var para=tinyMCE.getParentBlockElement(node);if(para!=null&¶.nodeName.toLowerCase()=="p"&&_25d=="keypress"){var htm=para.innerHTML;var _267=tinyMCE.getParentBlockElement(node);if(htm==""||htm==" "||_267.nodeName.toLowerCase()=="li"){var _268=para.previousSibling;while(_268!=null&&_268.nodeType!=1){_268=_268.previousSibling;}if(_268==null){return false;}var _269=tinyMCE.getNodeTree(_268,new Array(),3);var _26a=_269.length==0?null:_269[_269.length-1];if(_26a!=null){this.selectNode(_26a,true,false,false);}para.parentNode.removeChild(para);return true;}}return false;};TinyMCEControl.prototype._insertSpace=function(){return true;};TinyMCEControl.prototype.autoResetDesignMode=function(){if(!tinyMCE.isMSIE&&tinyMCE.settings["auto_reset_designmode"]){var sel=this.getSel();if(!sel||!sel.rangeCount||sel.rangeCount==0){eval("try { this.getDoc().designMode = \"On\"; } catch(e) {}");}}};TinyMCEControl.prototype.isDirty=function(){return this.isDirty;};TinyMCEControl.prototype.execCommand=function(_26c,_26d,_26e){var doc=this.getDoc();var win=this.getWin();if(this.lastSafariSelection){this.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){doc.execCommand("useCSS",false,true);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE._themeExecCommand(this.editorId,this.getBody(),_26c,_26d,_26e)){return;}if(_26c!="mceAddUndoLevel"&&_26c!="Undo"&&_26c!="Redo"&&_26c!="mceImage"&&_26c!="mceLink"&&_26c!="mceToggleVisualAid"&&(_26c!="mceInsertTable"&&!_26d)){this.execCommand("mceAddUndoLevel");}if(this.getFocusElement()&&this.getFocusElement().nodeName.toLowerCase()=="img"){var _271=this.getFocusElement().getAttribute("align");switch(_26c){case "JustifyLeft":if(_271=="left"){this.getFocusElement().removeAttribute("align");}else{this.getFocusElement().setAttribute("align","left");}tinyMCE.triggerNodeChange();return;case "JustifyCenter":if(_271=="middle"){this.getFocusElement().removeAttribute("align");}else{this.getFocusElement().setAttribute("align","middle");}tinyMCE.triggerNodeChange();return;case "JustifyRight":if(_271=="right"){this.getFocusElement().removeAttribute("align");}else{this.getFocusElement().setAttribute("align","right");}tinyMCE.triggerNodeChange();return;}}if(tinyMCE.settings["force_br_newlines"]){var _272="";if(doc.selection.type!="Control"){switch(_26c){case "JustifyLeft":_272="left";break;case "JustifyCenter":_272="center";break;case "JustifyFull":_272="justify";break;case "JustifyRight":_272="right";break;}if(_272!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null){divElm.setAttribute("align",_272);}else{if(rng.pasteHTML&&rng.htmlText.length>0){rng.pasteHTML("<div align=\""+_272+"\">"+rng.htmlText+"</div>");}}tinyMCE.triggerNodeChange();return;}}}switch(_26c){case "mceStoreSelection":this.selectionBookmark=this.getBookmark();break;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);break;case "InsertUnorderedList":case "InsertOrderedList":var tag=(_26c=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari){this.execCommand("mceInsertContent",false,"<"+tag+"><li> </li><"+tag+">");}else{this.getDoc().execCommand(_26c,_26d,_26e);}tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari){this.execCommand("mceInsertContent",false,"<strike>"+this.getSelectedHTML()+"</strike>");}else{this.getDoc().execCommand(_26c,_26d,_26e);}tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(_26e);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=_26e;break;case "FormatBlock":if(_26e==null||_26e==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm){this.execCommand("mceRemoveNode",false,elm);}}else{this.getDoc().execCommand("FormatBlock",false,_26e);}tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!_26e){_26e=tinyMCE.getParentElement(this.getFocusElement());}if(tinyMCE.isMSIE){_26e.outerHTML=_26e.innerHTML;}else{var rng=_26e.ownerDocument.createRange();rng.setStartBefore(_26e);rng.setEndAfter(_26e);rng.deleteContents();rng.insertNode(rng.createContextualFragment(_26e.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var _277=this.getFocusElement();for(var i=0;_277;i++){if(_277.nodeName.toLowerCase()=="body"){break;}if(_277.nodeName.toLowerCase()=="#text"){i--;_277=_277.parentNode;continue;}if(i==_26e){this.selectNode(_277,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=_277;return;}_277=_277.parentNode;}break;case "HiliteColor":if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand("hilitecolor",false,_26e);this.getDoc().execCommand("useCSS",false,true);}else{this.getDoc().execCommand("BackColor",false,_26e);}break;case "Cut":case "Copy":case "Paste":var _279=false;eval("try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}");if(tinyMCE.isGecko&&_279){if(confirm(tinyMCE.getLang("lang_clipboard_msg"))){window.open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","mceExternal");}return;}else{tinyMCE.triggerNodeChange();}break;case "mceSetContent":if(!_26e){_26e="";}_26e=tinyMCE._customCleanup("insert_to_editor",_26e);tinyMCE._setHTML(doc,_26e);doc.body.innerHTML=tinyMCE._cleanupHTML(doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid);return true;case "mceLink":var _27a="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();_27a=rng.text;}else{_27a=this.getSel().toString();}if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(_27a.length<=0)){return;}}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a"){tinyMCE.linkElement=tinyMCE.selectedElement;}if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,"href")==""){tinyMCE.linkElement=null;}if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,"href");target=tinyMCE.getAttrib(tinyMCE.linkElement,"target");title=tinyMCE.getAttrib(tinyMCE.linkElement,"title");onclick=tinyMCE.getAttrib(tinyMCE.linkElement,"mce_onclick");style_class=tinyMCE.getAttrib(tinyMCE.linkElement,"class");if(onclick==""){onclick=tinyMCE.getAttrib(tinyMCE.linkElement,"onclick");}onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,"mce_real_href");if(mceRealHref!=""){href=mceRealHref;}href=eval(tinyMCE.settings["urlconverter_callback"]+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings["insertlink_callback"]){var _27d=eval(this.settings["insertlink_callback"]+"(href, target, title, onclick, action, style_class);");if(_27d&&_27d["href"]){tinyMCE.insertLink(_27d["href"],_27d["target"],_27d["title"],_27d["onclick"],_27d["style_class"]);}}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",_271="";var _27f="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,"name").indexOf("mce_")==0){return;}src=tinyMCE.getAttrib(img,"src");alt=tinyMCE.getAttrib(img,"alt");if(alt==""){alt=tinyMCE.getAttrib(img,"title");}if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!=""){img.setAttribute("width",w);}var h=img.style.height;if(h!=null&&h!=""){img.setAttribute("height",h);}}border=tinyMCE.getAttrib(img,"border");hspace=tinyMCE.getAttrib(img,"hspace");vspace=tinyMCE.getAttrib(img,"vspace");width=tinyMCE.getAttrib(img,"width");height=tinyMCE.getAttrib(img,"height");_271=tinyMCE.getAttrib(img,"align");onmouseover=tinyMCE.getAttrib(img,"onmouseover");onmouseout=tinyMCE.getAttrib(img,"onmouseout");_27f=tinyMCE.getAttrib(img,"title");if(tinyMCE.isMSIE){width=img.attributes["width"].specified?width:"";height=img.attributes["height"].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,"mce_real_src");if(mceRealSrc!=""){src=mceRealSrc;}src=eval(tinyMCE.settings["urlconverter_callback"]+"(src, img, true);");if(onmouseover!=""){onmouseover=eval(tinyMCE.settings["urlconverter_callback"]+"(onmouseover, img, true);");}if(onmouseout!=""){onmouseout=eval(tinyMCE.settings["urlconverter_callback"]+"(onmouseout, img, true);");}action="update";}if(this.settings["insertimage_callback"]){var _283=eval(this.settings["insertimage_callback"]+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(_283&&_283["src"]){tinyMCE.insertImage(_283["src"],_283["alt"],_283["border"],_283["hspace"],_283["vspace"],_283["width"],_283["height"],_283["align"],_283["title"],_283["onmouseover"],_283["onmouseout"]);}}else{tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:_271,title:_27f,onmouseover:onmouseover,onmouseout:onmouseout,action:action});}break;case "mceCleanupWord":if(tinyMCE.isMSIE){var html=this.getBody().createTextRange().htmlText;if(html.indexOf("=\"mso")!=-1){tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);html=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);}this.getBody().innerHTML=html;}break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);this.repaint();tinyMCE.triggerNodeChange();break;case "mceAnchor":if(!_26d){var aElm=tinyMCE.getParentElement(this.getFocusElement(),"a","name");if(aElm){if(_26e==null||_26e==""){if(tinyMCE.isMSIE){aElm.outerHTML=aElm.innerHTML;}else{var rng=aElm.ownerDocument.createRange();rng.setStartBefore(aElm);rng.setEndAfter(aElm);rng.deleteContents();rng.insertNode(rng.createContextualFragment(aElm.innerHTML));}}else{aElm.setAttribute("name",_26e);}}else{this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var _287=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<_287.length;x++){elm=_287[x];var aElm=this.getDoc().createElement("a");aElm.setAttribute("name",_26e);if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++){aElm.appendChild(elm.childNodes[i].cloneNode(true));}}elm.parentNode.replaceChild(aElm,elm);}}tinyMCE.triggerNodeChange();}break;case "mceReplaceContent":var _28b="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();_28b=rng.text;}else{_28b=this.getSel().toString();}if(_28b.length>0){_26e=tinyMCE.replaceVar(_26e,"selection",_28b);tinyMCE.execCommand("mceInsertContent",false,_26e);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof (_26e)=="object"){var _28d=(typeof (_26e["targets"])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":_26e["targets"];var _28e=tinyMCE.getParentElement(this.getFocusElement(),_28d);if(_28e){_28e.setAttribute(_26e["name"],_26e["value"]);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":var _28f=false;if(tinyMCE.isMSIE){var rng=doc.selection.createRange();_28f=(rng.text&&rng.text.length>0);}else{_28f=(this.getSel().toString().length>0);}if(tinyMCE.selectedNode){tinyMCE.selectedElement=tinyMCE.selectedNode;}if(_28f&&!tinyMCE.selectedNode){this.getDoc().execCommand("RemoveFormat",false,null);if(_26e==null){return this.execCommand("RemoveFormat",false,null);}this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var _291=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<_291.length;x++){elm=_291[x];if(elm){var _293=this.getDoc().createElement("span");_293.className=_26e;if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++){_293.appendChild(elm.childNodes[i].cloneNode(true));}}elm.parentNode.replaceChild(_293,elm);}}}else{var _295=this.getFocusElement();if(tinyMCE.selectedElement.nodeName.toLowerCase()=="img"||tinyMCE.selectedElement.nodeName.toLowerCase()=="table"){_295=tinyMCE.selectedElement;}var _296=tinyMCE.getParentElement(_295,"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address");if(tinyMCE.selectedElement.nodeType==1){_296=tinyMCE.selectedElement;}if(!tinyMCE.isMSIE&&!_296){_296=tinyMCE.imgElement;}if(_296){if(_296.nodeName.toLowerCase()=="span"&&(!_26e||_26e=="")){if(_296.hasChildNodes()){for(var i=0;i<_296.childNodes.length;i++){_296.parentNode.insertBefore(_296.childNodes[i].cloneNode(true),_296);}}_296.parentNode.removeChild(_296);}else{if(_26e!=null&&_26e!=""){_296.className=_26e;}else{_296.removeAttribute("className");_296.removeAttribute("class");}}}}tinyMCE.triggerNodeChange();break;case "mceInsertRawHTML":var key="tiny_mce_marker";this.execCommand("mceInsertContent",false,key);var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1){this.getBody().innerHTML=html.substring(0,pos)+_26e+html.substring(pos+key.length);}break;case "mceInsertContent":if(!tinyMCE.isMSIE){var sel=this.getSel();var rng=this.getRng();var _29c=_26e.indexOf("<")!=-1;if(_29c){if(tinyMCE.isSafari){var _29d=this.getDoc().createRange();_29d.setStart(this.getBody(),0);_29d.setEnd(this.getBody(),0);_26e=_29d.createContextualFragment(_26e);}else{_26e=rng.createContextualFragment(_26e);}}else{var el=document.createElement("div");el.innerHTML=_26e;_26e=el.firstChild.nodeValue;_26e=doc.createTextNode(_26e);}if(tinyMCE.isSafari&&!_29c){this.execCommand("InsertText",false,_26e.nodeValue);tinyMCE.triggerNodeChange();return true;}else{if(tinyMCE.isSafari&&_29c){rng.deleteContents();rng.insertNode(_26e);tinyMCE.triggerNodeChange();return true;}}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(_26e,node);}else{rng.insertNode(_26e);}if(!_29c){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(_26e);rng.collapse(false);sel.addRange(rng);}else{rng.collapse(false);}}else{var rng=doc.selection.createRange();if(rng.item){rng.item(0).outerHTML=_26e;}else{rng.pasteHTML(_26e);}}tinyMCE.triggerNodeChange();break;case "mceAddUndoLevel":if(tinyMCE.settings["custom_undo_redo"]){var _2a2=tinyMCE.settings["custom_undo_redo_levels"];var _2a3=this.getBody().innerHTML;if(_2a3!=this.undoLevels[this.undoLevels.length-1]){tinyMCE.executeCallback("onchange_callback","_onchange",0,this);this.isDirty=true;if(_2a2!=-1&&this.undoLevels.length>_2a2){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}this.undoLevels[this.undoIndex++]=_2a3;this.undoLevels.length=this.undoIndex;}tinyMCE.triggerNodeChange(false);}break;case "Undo":if(tinyMCE.settings["custom_undo_redo"]){if(this.undoIndex==this.undoLevels.length){this.execCommand("mceAddUndoLevel");this.undoIndex--;}if(this.undoIndex>0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else{this.getDoc().execCommand(_26c,_26d,_26e);}break;case "Redo":if(tinyMCE.settings["custom_undo_redo"]){if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else{this.getDoc().execCommand(_26c,_26d,_26e);}break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);tinyMCE.triggerNodeChange();break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);rng.pasteHTML(rng.text);}catch(e){}}else{this.getDoc().execCommand(_26c,_26d,_26e);}if(text.length==0){this.execCommand("mceSetCSSClass",false,"");}tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(_26c,_26d,_26e);tinyMCE.triggerNodeChange();}};TinyMCEControl.prototype.queryCommandValue=function(_2a7){return this.getDoc().queryCommandValue(_2a7);};TinyMCEControl.prototype.queryCommandState=function(_2a8){return this.getDoc().queryCommandState(_2a8);};TinyMCEControl.prototype.onAdd=function(_2a9,_2aa,_2ab){var _2ac=_2ab?_2ab:document;this.targetDoc=_2ac;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings["theme"];this.settings["themeurl"]=tinyMCE.themeURL;if(!_2a9){alert("Error: Could not find the target element.");return false;}var _2ad=tinyMCE._getThemeFunction("_getInsertLinkTemplate");if(eval("typeof("+_2ad+")")!="undefined"){this.insertLinkTemplate=eval(_2ad+"(this.settings);");}var _2ae=tinyMCE._getThemeFunction("_getInsertImageTemplate");if(eval("typeof("+_2ae+")")!="undefined"){this.insertImageTemplate=eval(_2ae+"(this.settings);");}var _2af=tinyMCE._getThemeFunction("_getEditorTemplate");if(eval("typeof("+_2af+")")=="undefined"){alert("Error: Could not find the template function: "+_2af);return false;}var _2b0=eval(_2af+"(this.settings, this.editorId);");var _2b1=_2b0["delta_width"]?_2b0["delta_width"]:0;var _2b2=_2b0["delta_height"]?_2b0["delta_height"]:0;var html="<span id=\""+this.editorId+"_parent\">"+_2b0["html"];var _2b4=tinyMCE._getThemeFunction("_handleNodeChange",true);if(eval("typeof("+_2b4+")")!="undefined"){this.settings["handleNodeChangeCallback"]=_2b4;}html=tinyMCE.replaceVar(html,"editor_id",this.editorId);html=tinyMCE.replaceVar(html,"default_document",tinyMCE.baseURL+"/blank.htm");this.settings["default_document"]=tinyMCE.baseURL+"/blank.htm";this.settings["old_width"]=this.settings["width"];this.settings["old_height"]=this.settings["height"];if(this.settings["width"]==-1){this.settings["width"]=_2a9.offsetWidth;}if(this.settings["height"]==-1){this.settings["height"]=_2a9.offsetHeight;}if(this.settings["width"]==0){this.settings["width"]=_2a9.style.width;}if(this.settings["height"]==0){this.settings["height"]=_2a9.style.height;}if(this.settings["width"]==0){this.settings["width"]=320;}if(this.settings["height"]==0){this.settings["height"]=240;}this.settings["area_width"]=parseInt(this.settings["width"]);this.settings["area_height"]=parseInt(this.settings["height"]);this.settings["area_width"]+=_2b1;this.settings["area_height"]+=_2b2;if((""+this.settings["width"]).indexOf("%")!=-1){this.settings["area_width"]="100%";}if((""+this.settings["height"]).indexOf("%")!=-1){this.settings["area_height"]="100%";}if((""+_2a9.style.width).indexOf("%")!=-1){this.settings["width"]=_2a9.style.width;this.settings["area_width"]="100%";}if((""+_2a9.style.height).indexOf("%")!=-1){this.settings["height"]=_2a9.style.height;this.settings["area_height"]="100%";}html=tinyMCE.applyTemplate(html);this.settings["width"]=this.settings["old_width"];this.settings["height"]=this.settings["old_height"];this.visualAid=this.settings["visual"];this.formTargetElementId=_2aa;if(_2a9.nodeName.toLowerCase()=="textarea"){this.startContent=_2a9.value;}else{this.startContent=_2a9.innerHTML;}if(_2a9.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=_2a9.cloneNode(true);if(tinyMCE.settings["debug"]){html+="<textarea wrap=\"off\" id=\""+_2aa+"\" name=\""+_2aa+"\" cols=\"100\" rows=\"15\"></textarea>";}else{html+="<input type=\"hidden\" type=\"text\" id=\""+_2aa+"\" name=\""+_2aa+"\" />";}html+="</span>";if(!tinyMCE.isMSIE){var rng=_2a9.ownerDocument.createRange();rng.setStartBefore(_2a9);var _2b6=rng.createContextualFragment(html);_2a9.parentNode.replaceChild(_2b6,_2a9);}else{_2a9.outerHTML=html;}}else{html+="</span>";this.oldTargetElement=_2a9;if(!tinyMCE.settings["debug"]){this.oldTargetElement.style.display="none";}if(!tinyMCE.isMSIE){var rng=_2a9.ownerDocument.createRange();rng.setStartBefore(_2a9);var _2b8=rng.createContextualFragment(html);_2a9.parentNode.insertBefore(_2b8,_2a9);}else{_2a9.insertAdjacentHTML("beforeBegin",html);}}var _2b9=false;var tElm=_2ac.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);_2b9=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);}else{tElm=_2ac.frames[this.editorId];}this.targetElement=tElm;this.iframeElement=_2ac.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(_2b9){var html=""+"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"+"<html>"+"<head>"+"<base href=\""+tinyMCE.settings["base_href"]+"\" />"+"<title>blank_page</title>"+"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"+"</head>"+"<body class=\"mceContentBody\">"+"</body>"+"</html>";try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE){window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);}tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse){rng.collapse(true);}var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var elm=(sel&&sel.anchorNode)?sel.anchorNode:null;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){elm=tinyMCE.selectedElement;}}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();function debug(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var _2c4=document.createElement("div");_2c4.setAttribute("className","debugger");_2c4.className="debugger";_2c4.innerHTML="\t\t\tDebug output:\t\t\t<textarea id=\"tinymce_debug\" style=\"width: 100%; height: 300px\">\t\t\t</textarea>";document.body.appendChild(_2c4);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i<args.length;i++){msg+=args[i];if(i<args.length-1){msg+=", ";}}elm.value+=msg+"\n";} | ||
| 14 | \ No newline at end of file | 3 | \ No newline at end of file |
thirdpartyjs/yui/dom/dom.js
| 1 | -/* | ||
| 2 | -Copyright (c) 2006, Yahoo! Inc. All rights reserved. | ||
| 3 | -Code licensed under the BSD License: | ||
| 4 | -http://developer.yahoo.net/yui/license.txt | ||
| 5 | -version: 0.12.0 | ||
| 6 | -*/ | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * The dom module provides helper methods for manipulating Dom elements. | ||
| 10 | - * @module dom | ||
| 11 | - * | ||
| 12 | - */ | ||
| 13 | - | ||
| 14 | -(function() { | ||
| 15 | - var Y = YAHOO.util, // internal shorthand | ||
| 16 | - getStyle, // for load time browser branching | ||
| 17 | - setStyle, // ditto | ||
| 18 | - id_counter = 0, // for use with generateId | ||
| 19 | - propertyCache = {}; // for faster hyphen converts | ||
| 20 | - | ||
| 21 | - // brower detection | ||
| 22 | - var ua = navigator.userAgent.toLowerCase(), | ||
| 23 | - isOpera = (ua.indexOf('opera') > -1), | ||
| 24 | - isSafari = (ua.indexOf('safari') > -1), | ||
| 25 | - isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1), | ||
| 26 | - isIE = (!isOpera && ua.indexOf('msie') > -1); | ||
| 27 | - | ||
| 28 | - // regex cache | ||
| 29 | - var patterns = { | ||
| 30 | - HYPHEN: /(-[a-z])/i | ||
| 31 | - }; | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - var toCamel = function(property) { | ||
| 35 | - if ( !patterns.HYPHEN.test(property) ) { | ||
| 36 | - return property; // no hyphens | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - if (propertyCache[property]) { // already converted | ||
| 40 | - return propertyCache[property]; | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - while( patterns.HYPHEN.exec(property) ) { | ||
| 44 | - property = property.replace(RegExp.$1, | ||
| 45 | - RegExp.$1.substr(1).toUpperCase()); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - propertyCache[property] = property; | ||
| 49 | - return property; | ||
| 50 | - //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug | ||
| 51 | - }; | ||
| 52 | - | ||
| 53 | - // branching at load instead of runtime | ||
| 54 | - if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method | ||
| 55 | - getStyle = function(el, property) { | ||
| 56 | - var value = null; | ||
| 57 | - | ||
| 58 | - var computed = document.defaultView.getComputedStyle(el, ''); | ||
| 59 | - if (computed) { // test computed before touching for safari | ||
| 60 | - value = computed[toCamel(property)]; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - return el.style[property] || value; | ||
| 64 | - }; | ||
| 65 | - } else if (document.documentElement.currentStyle && isIE) { // IE method | ||
| 66 | - getStyle = function(el, property) { | ||
| 67 | - switch( toCamel(property) ) { | ||
| 68 | - case 'opacity' :// IE opacity uses filter | ||
| 69 | - var val = 100; | ||
| 70 | - try { // will error if no DXImageTransform | ||
| 71 | - val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity; | ||
| 72 | - | ||
| 73 | - } catch(e) { | ||
| 74 | - try { // make sure its in the document | ||
| 75 | - val = el.filters('alpha').opacity; | ||
| 76 | - } catch(e) { | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - return val / 100; | ||
| 80 | - break; | ||
| 81 | - default: | ||
| 82 | - // test currentStyle before touching | ||
| 83 | - var value = el.currentStyle ? el.currentStyle[property] : null; | ||
| 84 | - return ( el.style[property] || value ); | ||
| 85 | - } | ||
| 86 | - }; | ||
| 87 | - } else { // default to inline only | ||
| 88 | - getStyle = function(el, property) { return el.style[property]; }; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - if (isIE) { | ||
| 92 | - setStyle = function(el, property, val) { | ||
| 93 | - switch (property) { | ||
| 94 | - case 'opacity': | ||
| 95 | - if ( typeof el.style.filter == 'string' ) { // in case not appended | ||
| 96 | - el.style.filter = 'alpha(opacity=' + val * 100 + ')'; | ||
| 97 | - | ||
| 98 | - if (!el.currentStyle || !el.currentStyle.hasLayout) { | ||
| 99 | - el.style.zoom = 1; // when no layout or cant tell | ||
| 100 | - } | ||
| 101 | - } | ||
| 102 | - break; | ||
| 103 | - default: | ||
| 104 | - el.style[property] = val; | ||
| 105 | - } | ||
| 106 | - }; | ||
| 107 | - } else { | ||
| 108 | - setStyle = function(el, property, val) { | ||
| 109 | - el.style[property] = val; | ||
| 110 | - }; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - /** | ||
| 114 | - * Provides helper methods for DOM elements. | ||
| 115 | - * @namespace YAHOO.util | ||
| 116 | - * @class Dom | ||
| 117 | - */ | ||
| 118 | - YAHOO.util.Dom = { | ||
| 119 | - /** | ||
| 120 | - * Returns an HTMLElement reference. | ||
| 121 | - * @method get | ||
| 122 | - * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements. | ||
| 123 | - * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements. | ||
| 124 | - */ | ||
| 125 | - get: function(el) { | ||
| 126 | - if (!el) { return null; } // nothing to work with | ||
| 127 | - | ||
| 128 | - if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is | ||
| 129 | - return el; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - if (typeof el == 'string') { // ID | ||
| 133 | - return document.getElementById(el); | ||
| 134 | - } | ||
| 135 | - else { // array of ID's and/or elements | ||
| 136 | - var collection = []; | ||
| 137 | - for (var i = 0, len = el.length; i < len; ++i) { | ||
| 138 | - collection[collection.length] = Y.Dom.get(el[i]); | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - return collection; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - return null; // safety, should never happen | ||
| 145 | - }, | ||
| 146 | - | ||
| 147 | - /** | ||
| 148 | - * Normalizes currentStyle and ComputedStyle. | ||
| 149 | - * @method getStyle | ||
| 150 | - * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements. | ||
| 151 | - * @param {String} property The style property whose value is returned. | ||
| 152 | - * @return {String | Array} The current value of the style property for the element(s). | ||
| 153 | - */ | ||
| 154 | - getStyle: function(el, property) { | ||
| 155 | - property = toCamel(property); | ||
| 156 | - | ||
| 157 | - var f = function(element) { | ||
| 158 | - return getStyle(element, property); | ||
| 159 | - }; | ||
| 160 | - | ||
| 161 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 162 | - }, | ||
| 163 | - | ||
| 164 | - /** | ||
| 165 | - * Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers. | ||
| 166 | - * @method setStyle | ||
| 167 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements. | ||
| 168 | - * @param {String} property The style property to be set. | ||
| 169 | - * @param {String} val The value to apply to the given property. | ||
| 170 | - */ | ||
| 171 | - setStyle: function(el, property, val) { | ||
| 172 | - property = toCamel(property); | ||
| 173 | - | ||
| 174 | - var f = function(element) { | ||
| 175 | - setStyle(element, property, val); | ||
| 176 | - | ||
| 177 | - }; | ||
| 178 | - | ||
| 179 | - Y.Dom.batch(el, f, Y.Dom, true); | ||
| 180 | - }, | ||
| 181 | - | ||
| 182 | - /** | ||
| 183 | - * Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). | ||
| 184 | - * @method getXY | ||
| 185 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements | ||
| 186 | - * @return {Array} The XY position of the element(s) | ||
| 187 | - */ | ||
| 188 | - getXY: function(el) { | ||
| 189 | - var f = function(el) { | ||
| 190 | - | ||
| 191 | - // has to be part of document to have pageXY | ||
| 192 | - if (el.parentNode === null || el.offsetParent === null || | ||
| 193 | - this.getStyle(el, 'display') == 'none') { | ||
| 194 | - return false; | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - var parentNode = null; | ||
| 198 | - var pos = []; | ||
| 199 | - var box; | ||
| 200 | - | ||
| 201 | - if (el.getBoundingClientRect) { // IE | ||
| 202 | - box = el.getBoundingClientRect(); | ||
| 203 | - var doc = document; | ||
| 204 | - if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll | ||
| 205 | - doc = parent.document; | ||
| 206 | - | ||
| 207 | - if ( !this.isAncestor(doc.documentElement, el) ) { | ||
| 208 | - return false; | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | - } | ||
| 212 | - | ||
| 213 | - var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop); | ||
| 214 | - var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft); | ||
| 215 | - | ||
| 216 | - return [box.left + scrollLeft, box.top + scrollTop]; | ||
| 217 | - } | ||
| 218 | - else { // safari, opera, & gecko | ||
| 219 | - pos = [el.offsetLeft, el.offsetTop]; | ||
| 220 | - parentNode = el.offsetParent; | ||
| 221 | - if (parentNode != el) { | ||
| 222 | - while (parentNode) { | ||
| 223 | - pos[0] += parentNode.offsetLeft; | ||
| 224 | - pos[1] += parentNode.offsetTop; | ||
| 225 | - parentNode = parentNode.offsetParent; | ||
| 226 | - } | ||
| 227 | - } | ||
| 228 | - if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases | ||
| 229 | - pos[0] -= document.body.offsetLeft; | ||
| 230 | - pos[1] -= document.body.offsetTop; | ||
| 231 | - } | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - if (el.parentNode) { parentNode = el.parentNode; } | ||
| 235 | - else { parentNode = null; } | ||
| 236 | - | ||
| 237 | - while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML') | ||
| 238 | - { // account for any scrolled ancestors | ||
| 239 | - if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug | ||
| 240 | - pos[0] -= parentNode.scrollLeft; | ||
| 241 | - pos[1] -= parentNode.scrollTop; | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - if (parentNode.parentNode) { | ||
| 245 | - parentNode = parentNode.parentNode; | ||
| 246 | - } else { parentNode = null; } | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | - | ||
| 250 | - return pos; | ||
| 251 | - }; | ||
| 252 | - | ||
| 253 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 254 | - }, | ||
| 255 | - | ||
| 256 | - /** | ||
| 257 | - * Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). | ||
| 258 | - * @method getX | ||
| 259 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements | ||
| 260 | - * @return {String | Array} The X position of the element(s) | ||
| 261 | - */ | ||
| 262 | - getX: function(el) { | ||
| 263 | - var f = function(el) { | ||
| 264 | - return Y.Dom.getXY(el)[0]; | ||
| 265 | - }; | ||
| 266 | - | ||
| 267 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 268 | - }, | ||
| 269 | - | ||
| 270 | - /** | ||
| 271 | - * Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). | ||
| 272 | - * @method getY | ||
| 273 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements | ||
| 274 | - * @return {String | Array} The Y position of the element(s) | ||
| 275 | - */ | ||
| 276 | - getY: function(el) { | ||
| 277 | - var f = function(el) { | ||
| 278 | - return Y.Dom.getXY(el)[1]; | ||
| 279 | - }; | ||
| 280 | - | ||
| 281 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 282 | - }, | ||
| 283 | - | ||
| 284 | - /** | ||
| 285 | - * Set the position of an html element in page coordinates, regardless of how the element is positioned. | ||
| 286 | - * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). | ||
| 287 | - * @method setXY | ||
| 288 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements | ||
| 289 | - * @param {Array} pos Contains X & Y values for new position (coordinates are page-based) | ||
| 290 | - * @param {Boolean} noRetry By default we try and set the position a second time if the first fails | ||
| 291 | - */ | ||
| 292 | - setXY: function(el, pos, noRetry) { | ||
| 293 | - var f = function(el) { | ||
| 294 | - var style_pos = this.getStyle(el, 'position'); | ||
| 295 | - if (style_pos == 'static') { // default to relative | ||
| 296 | - this.setStyle(el, 'position', 'relative'); | ||
| 297 | - style_pos = 'relative'; | ||
| 298 | - } | ||
| 299 | - | ||
| 300 | - var pageXY = this.getXY(el); | ||
| 301 | - if (pageXY === false) { // has to be part of doc to have pageXY | ||
| 302 | - return false; | ||
| 303 | - } | ||
| 304 | - | ||
| 305 | - var delta = [ // assuming pixels; if not we will have to retry | ||
| 306 | - parseInt( this.getStyle(el, 'left'), 10 ), | ||
| 307 | - parseInt( this.getStyle(el, 'top'), 10 ) | ||
| 308 | - ]; | ||
| 309 | - | ||
| 310 | - if ( isNaN(delta[0]) ) {// in case of 'auto' | ||
| 311 | - delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft; | ||
| 312 | - } | ||
| 313 | - if ( isNaN(delta[1]) ) { // in case of 'auto' | ||
| 314 | - delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop; | ||
| 315 | - } | ||
| 316 | - | ||
| 317 | - if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; } | ||
| 318 | - if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; } | ||
| 319 | - | ||
| 320 | - var newXY = this.getXY(el); | ||
| 321 | - | ||
| 322 | - // if retry is true, try one more time if we miss | ||
| 323 | - if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) { | ||
| 324 | - this.setXY(el, pos, true); | ||
| 325 | - } | ||
| 326 | - | ||
| 327 | - }; | ||
| 328 | - | ||
| 329 | - Y.Dom.batch(el, f, Y.Dom, true); | ||
| 330 | - }, | ||
| 331 | - | ||
| 332 | - /** | ||
| 333 | - * Set the X position of an html element in page coordinates, regardless of how the element is positioned. | ||
| 334 | - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). | ||
| 335 | - * @method setX | ||
| 336 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements. | ||
| 337 | - * @param {Int} x The value to use as the X coordinate for the element(s). | ||
| 338 | - */ | ||
| 339 | - setX: function(el, x) { | ||
| 340 | - Y.Dom.setXY(el, [x, null]); | ||
| 341 | - }, | ||
| 342 | - | ||
| 343 | - /** | ||
| 344 | - * Set the Y position of an html element in page coordinates, regardless of how the element is positioned. | ||
| 345 | - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). | ||
| 346 | - * @method setY | ||
| 347 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements. | ||
| 348 | - * @param {Int} x To use as the Y coordinate for the element(s). | ||
| 349 | - */ | ||
| 350 | - setY: function(el, y) { | ||
| 351 | - Y.Dom.setXY(el, [null, y]); | ||
| 352 | - }, | ||
| 353 | - | ||
| 354 | - /** | ||
| 355 | - * Returns the region position of the given element. | ||
| 356 | - * The element must be part of the DOM tree to have a region (display:none or elements not appended return false). | ||
| 357 | - * @method getRegion | ||
| 358 | - * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements. | ||
| 359 | - * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data. | ||
| 360 | - */ | ||
| 361 | - getRegion: function(el) { | ||
| 362 | - var f = function(el) { | ||
| 363 | - var region = new Y.Region.getRegion(el); | ||
| 364 | - return region; | ||
| 365 | - }; | ||
| 366 | - | ||
| 367 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 368 | - }, | ||
| 369 | - | ||
| 370 | - /** | ||
| 371 | - * Returns the width of the client (viewport). | ||
| 372 | - * @method getClientWidth | ||
| 373 | - * @deprecated Now using getViewportWidth. This interface left intact for back compat. | ||
| 374 | - * @return {Int} The width of the viewable area of the page. | ||
| 375 | - */ | ||
| 376 | - getClientWidth: function() { | ||
| 377 | - return Y.Dom.getViewportWidth(); | ||
| 378 | - }, | ||
| 379 | - | ||
| 380 | - /** | ||
| 381 | - * Returns the height of the client (viewport). | ||
| 382 | - * @method getClientHeight | ||
| 383 | - * @deprecated Now using getViewportHeight. This interface left intact for back compat. | ||
| 384 | - * @return {Int} The height of the viewable area of the page. | ||
| 385 | - */ | ||
| 386 | - getClientHeight: function() { | ||
| 387 | - return Y.Dom.getViewportHeight(); | ||
| 388 | - }, | ||
| 389 | - | ||
| 390 | - /** | ||
| 391 | - * Returns a array of HTMLElements with the given class. | ||
| 392 | - * For optimized performance, include a tag and/or root node when possible. | ||
| 393 | - * @method getElementsByClassName | ||
| 394 | - * @param {String} className The class name to match against | ||
| 395 | - * @param {String} tag (optional) The tag name of the elements being collected | ||
| 396 | - * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point | ||
| 397 | - * @return {Array} An array of elements that have the given class name | ||
| 398 | - */ | ||
| 399 | - getElementsByClassName: function(className, tag, root) { | ||
| 400 | - var method = function(el) { return Y.Dom.hasClass(el, className); }; | ||
| 401 | - return Y.Dom.getElementsBy(method, tag, root); | ||
| 402 | - }, | ||
| 403 | - | ||
| 404 | - /** | ||
| 405 | - * Determines whether an HTMLElement has the given className. | ||
| 406 | - * @method hasClass | ||
| 407 | - * @param {String | HTMLElement | Array} el The element or collection to test | ||
| 408 | - * @param {String} className the class name to search for | ||
| 409 | - * @return {Boolean | Array} A boolean value or array of boolean values | ||
| 410 | - */ | ||
| 411 | - hasClass: function(el, className) { | ||
| 412 | - var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'); | ||
| 413 | - | ||
| 414 | - var f = function(el) { | ||
| 415 | - return re.test(el['className']); | ||
| 416 | - }; | ||
| 417 | - | ||
| 418 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 419 | - }, | ||
| 420 | - | ||
| 421 | - /** | ||
| 422 | - * Adds a class name to a given element or collection of elements. | ||
| 423 | - * @method addClass | ||
| 424 | - * @param {String | HTMLElement | Array} el The element or collection to add the class to | ||
| 425 | - * @param {String} className the class name to add to the class attribute | ||
| 426 | - */ | ||
| 427 | - addClass: function(el, className) { | ||
| 428 | - var f = function(el) { | ||
| 429 | - if (this.hasClass(el, className)) { return; } // already present | ||
| 430 | - | ||
| 431 | - | ||
| 432 | - el['className'] = [el['className'], className].join(' '); | ||
| 433 | - }; | ||
| 434 | - | ||
| 435 | - Y.Dom.batch(el, f, Y.Dom, true); | ||
| 436 | - }, | ||
| 437 | - | ||
| 438 | - /** | ||
| 439 | - * Removes a class name from a given element or collection of elements. | ||
| 440 | - * @method removeClass | ||
| 441 | - * @param {String | HTMLElement | Array} el The element or collection to remove the class from | ||
| 442 | - * @param {String} className the class name to remove from the class attribute | ||
| 443 | - */ | ||
| 444 | - removeClass: function(el, className) { | ||
| 445 | - var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g'); | ||
| 446 | - | ||
| 447 | - var f = function(el) { | ||
| 448 | - if (!this.hasClass(el, className)) { return; } // not present | ||
| 449 | - | ||
| 450 | - | ||
| 451 | - var c = el['className']; | ||
| 452 | - el['className'] = c.replace(re, ' '); | ||
| 453 | - if ( this.hasClass(el, className) ) { // in case of multiple adjacent | ||
| 454 | - this.removeClass(el, className); | ||
| 455 | - } | ||
| 456 | - | ||
| 457 | - }; | ||
| 458 | - | ||
| 459 | - Y.Dom.batch(el, f, Y.Dom, true); | ||
| 460 | - }, | ||
| 461 | - | ||
| 462 | - /** | ||
| 463 | - * Replace a class with another class for a given element or collection of elements. | ||
| 464 | - * If no oldClassName is present, the newClassName is simply added. | ||
| 465 | - * @method replaceClass | ||
| 466 | - * @param {String | HTMLElement | Array} el The element or collection to remove the class from | ||
| 467 | - * @param {String} oldClassName the class name to be replaced | ||
| 468 | - * @param {String} newClassName the class name that will be replacing the old class name | ||
| 469 | - */ | ||
| 470 | - replaceClass: function(el, oldClassName, newClassName) { | ||
| 471 | - if (oldClassName === newClassName) { // avoid infinite loop | ||
| 472 | - return false; | ||
| 473 | - } | ||
| 474 | - | ||
| 475 | - var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g'); | ||
| 476 | - | ||
| 477 | - var f = function(el) { | ||
| 478 | - | ||
| 479 | - if ( !this.hasClass(el, oldClassName) ) { | ||
| 480 | - this.addClass(el, newClassName); // just add it if nothing to replace | ||
| 481 | - return; // note return | ||
| 482 | - } | ||
| 483 | - | ||
| 484 | - el['className'] = el['className'].replace(re, ' ' + newClassName + ' '); | ||
| 485 | - | ||
| 486 | - if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent | ||
| 487 | - this.replaceClass(el, oldClassName, newClassName); | ||
| 488 | - } | ||
| 489 | - }; | ||
| 490 | - | ||
| 491 | - Y.Dom.batch(el, f, Y.Dom, true); | ||
| 492 | - }, | ||
| 493 | - | ||
| 494 | - /** | ||
| 495 | - * Generates a unique ID | ||
| 496 | - * @method generateId | ||
| 497 | - * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present). | ||
| 498 | - * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen"). | ||
| 499 | - * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element) | ||
| 500 | - */ | ||
| 501 | - generateId: function(el, prefix) { | ||
| 502 | - prefix = prefix || 'yui-gen'; | ||
| 503 | - el = el || {}; | ||
| 504 | - | ||
| 505 | - var f = function(el) { | ||
| 506 | - if (el) { | ||
| 507 | - el = Y.Dom.get(el); | ||
| 508 | - } else { | ||
| 509 | - el = {}; // just generating ID in this case | ||
| 510 | - } | ||
| 511 | - | ||
| 512 | - if (!el.id) { | ||
| 513 | - el.id = prefix + id_counter++; | ||
| 514 | - } // dont override existing | ||
| 515 | - | ||
| 516 | - | ||
| 517 | - return el.id; | ||
| 518 | - }; | ||
| 519 | - | ||
| 520 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 521 | - }, | ||
| 522 | - | ||
| 523 | - /** | ||
| 524 | - * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy. | ||
| 525 | - * @method isAncestor | ||
| 526 | - * @param {String | HTMLElement} haystack The possible ancestor | ||
| 527 | - * @param {String | HTMLElement} needle The possible descendent | ||
| 528 | - * @return {Boolean} Whether or not the haystack is an ancestor of needle | ||
| 529 | - */ | ||
| 530 | - isAncestor: function(haystack, needle) { | ||
| 531 | - haystack = Y.Dom.get(haystack); | ||
| 532 | - if (!haystack || !needle) { return false; } | ||
| 533 | - | ||
| 534 | - var f = function(needle) { | ||
| 535 | - if (haystack.contains && !isSafari) { // safari "contains" is broken | ||
| 536 | - return haystack.contains(needle); | ||
| 537 | - } | ||
| 538 | - else if ( haystack.compareDocumentPosition ) { | ||
| 539 | - return !!(haystack.compareDocumentPosition(needle) & 16); | ||
| 540 | - } | ||
| 541 | - else { // loop up and test each parent | ||
| 542 | - var parent = needle.parentNode; | ||
| 543 | - | ||
| 544 | - while (parent) { | ||
| 545 | - if (parent == haystack) { | ||
| 546 | - return true; | ||
| 547 | - } | ||
| 548 | - else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') { | ||
| 549 | - return false; | ||
| 550 | - } | ||
| 551 | - | ||
| 552 | - parent = parent.parentNode; | ||
| 553 | - } | ||
| 554 | - return false; | ||
| 555 | - } | ||
| 556 | - }; | ||
| 557 | - | ||
| 558 | - return Y.Dom.batch(needle, f, Y.Dom, true); | ||
| 559 | - }, | ||
| 560 | - | ||
| 561 | - /** | ||
| 562 | - * Determines whether an HTMLElement is present in the current document. | ||
| 563 | - * @method inDocument | ||
| 564 | - * @param {String | HTMLElement} el The element to search for | ||
| 565 | - * @return {Boolean} Whether or not the element is present in the current document | ||
| 566 | - */ | ||
| 567 | - inDocument: function(el) { | ||
| 568 | - var f = function(el) { | ||
| 569 | - return this.isAncestor(document.documentElement, el); | ||
| 570 | - }; | ||
| 571 | - | ||
| 572 | - return Y.Dom.batch(el, f, Y.Dom, true); | ||
| 573 | - }, | ||
| 574 | - | ||
| 575 | - /** | ||
| 576 | - * Returns a array of HTMLElements that pass the test applied by supplied boolean method. | ||
| 577 | - * For optimized performance, include a tag and/or root node when possible. | ||
| 578 | - * @method getElementsBy | ||
| 579 | - * @param {Function} method - A boolean method for testing elements which receives the element as its only argument. | ||
| 580 | - | ||
| 581 | - * @param {String} tag (optional) The tag name of the elements being collected | ||
| 582 | - * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point | ||
| 583 | - */ | ||
| 584 | - getElementsBy: function(method, tag, root) { | ||
| 585 | - tag = tag || '*'; | ||
| 586 | - root = Y.Dom.get(root) || document; | ||
| 587 | - | ||
| 588 | - var nodes = []; | ||
| 589 | - var elements = root.getElementsByTagName(tag); | ||
| 590 | - | ||
| 591 | - if ( !elements.length && (tag == '*' && root.all) ) { | ||
| 592 | - elements = root.all; // IE < 6 | ||
| 593 | - } | ||
| 594 | - | ||
| 595 | - for (var i = 0, len = elements.length; i < len; ++i) { | ||
| 596 | - if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; } | ||
| 597 | - } | ||
| 598 | - | ||
| 599 | - | ||
| 600 | - return nodes; | ||
| 601 | - }, | ||
| 602 | - | ||
| 603 | - /** | ||
| 604 | - * Returns an array of elements that have had the supplied method applied. | ||
| 605 | - * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ). | ||
| 606 | - * @method batch | ||
| 607 | - * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to | ||
| 608 | - * @param {Function} method The method to apply to the element(s) | ||
| 609 | - * @param {Any} o (optional) An optional arg that is passed to the supplied method | ||
| 610 | - * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o" | ||
| 611 | - * @return {HTMLElement | Array} The element(s) with the method applied | ||
| 612 | - */ | ||
| 613 | - batch: function(el, method, o, override) { | ||
| 614 | - var id = el; | ||
| 615 | - el = Y.Dom.get(el); | ||
| 616 | - | ||
| 617 | - var scope = (override) ? o : window; | ||
| 618 | - | ||
| 619 | - if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection) | ||
| 620 | - if (!el) { | ||
| 621 | - return false; | ||
| 622 | - } | ||
| 623 | - return method.call(scope, el, o); | ||
| 624 | - } | ||
| 625 | - | ||
| 626 | - var collection = []; | ||
| 627 | - | ||
| 628 | - for (var i = 0, len = el.length; i < len; ++i) { | ||
| 629 | - if (!el[i]) { | ||
| 630 | - id = el[i]; | ||
| 631 | - } | ||
| 632 | - collection[collection.length] = method.call(scope, el[i], o); | ||
| 633 | - } | ||
| 634 | - | ||
| 635 | - return collection; | ||
| 636 | - }, | ||
| 637 | - | ||
| 638 | - /** | ||
| 639 | - * Returns the height of the document. | ||
| 640 | - * @method getDocumentHeight | ||
| 641 | - * @return {Int} The height of the actual document (which includes the body and its margin). | ||
| 642 | - */ | ||
| 643 | - getDocumentHeight: function() { | ||
| 644 | - var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight; | ||
| 645 | - | ||
| 646 | - var h = Math.max(scrollHeight, Y.Dom.getViewportHeight()); | ||
| 647 | - return h; | ||
| 648 | - }, | ||
| 649 | - | ||
| 650 | - /** | ||
| 651 | - * Returns the width of the document. | ||
| 652 | - * @method getDocumentWidth | ||
| 653 | - * @return {Int} The width of the actual document (which includes the body and its margin). | ||
| 654 | - */ | ||
| 655 | - getDocumentWidth: function() { | ||
| 656 | - var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth; | ||
| 657 | - var w = Math.max(scrollWidth, Y.Dom.getViewportWidth()); | ||
| 658 | - return w; | ||
| 659 | - }, | ||
| 660 | - | ||
| 661 | - /** | ||
| 662 | - * Returns the current height of the viewport. | ||
| 663 | - * @method getViewportHeight | ||
| 664 | - * @return {Int} The height of the viewable area of the page (excludes scrollbars). | ||
| 665 | - */ | ||
| 666 | - getViewportHeight: function() { | ||
| 667 | - var height = self.innerHeight; // Safari, Opera | ||
| 668 | - var mode = document.compatMode; | ||
| 669 | - | ||
| 670 | - if ( (mode || isIE) && !isOpera ) { // IE, Gecko | ||
| 671 | - height = (mode == 'CSS1Compat') ? | ||
| 672 | - document.documentElement.clientHeight : // Standards | ||
| 673 | - document.body.clientHeight; // Quirks | ||
| 674 | - } | ||
| 675 | - | ||
| 676 | - return height; | ||
| 677 | - }, | ||
| 678 | - | ||
| 679 | - /** | ||
| 680 | - * Returns the current width of the viewport. | ||
| 681 | - * @method getViewportWidth | ||
| 682 | - * @return {Int} The width of the viewable area of the page (excludes scrollbars). | ||
| 683 | - */ | ||
| 684 | - | ||
| 685 | - getViewportWidth: function() { | ||
| 686 | - var width = self.innerWidth; // Safari | ||
| 687 | - var mode = document.compatMode; | ||
| 688 | - | ||
| 689 | - if (mode || isIE) { // IE, Gecko, Opera | ||
| 690 | - width = (mode == 'CSS1Compat') ? | ||
| 691 | - document.documentElement.clientWidth : // Standards | ||
| 692 | - document.body.clientWidth; // Quirks | ||
| 693 | - } | ||
| 694 | - return width; | ||
| 695 | - } | ||
| 696 | - }; | ||
| 697 | -})(); | ||
| 698 | -/** | ||
| 699 | - * A region is a representation of an object on a grid. It is defined | ||
| 700 | - * by the top, right, bottom, left extents, so is rectangular by default. If | ||
| 701 | - * other shapes are required, this class could be extended to support it. | ||
| 702 | - * @namespace YAHOO.util | ||
| 703 | - * @class Region | ||
| 704 | - * @param {Int} t the top extent | ||
| 705 | - * @param {Int} r the right extent | ||
| 706 | - * @param {Int} b the bottom extent | ||
| 707 | - * @param {Int} l the left extent | ||
| 708 | - * @constructor | ||
| 709 | - */ | ||
| 710 | -YAHOO.util.Region = function(t, r, b, l) { | ||
| 711 | - | ||
| 712 | - /** | ||
| 713 | - * The region's top extent | ||
| 714 | - * @property top | ||
| 715 | - * @type Int | ||
| 716 | - */ | ||
| 717 | - this.top = t; | ||
| 718 | - | ||
| 719 | - /** | ||
| 720 | - * The region's top extent as index, for symmetry with set/getXY | ||
| 721 | - * @property 1 | ||
| 722 | - * @type Int | ||
| 723 | - */ | ||
| 724 | - this[1] = t; | ||
| 725 | - | ||
| 726 | - /** | ||
| 727 | - * The region's right extent | ||
| 728 | - * @property right | ||
| 729 | - * @type int | ||
| 730 | - */ | ||
| 731 | - this.right = r; | ||
| 732 | - | ||
| 733 | - /** | ||
| 734 | - * The region's bottom extent | ||
| 735 | - * @property bottom | ||
| 736 | - * @type Int | ||
| 737 | - */ | ||
| 738 | - this.bottom = b; | ||
| 739 | - | ||
| 740 | - /** | ||
| 741 | - * The region's left extent | ||
| 742 | - * @property left | ||
| 743 | - * @type Int | ||
| 744 | - */ | ||
| 745 | - this.left = l; | ||
| 746 | - | ||
| 747 | - /** | ||
| 748 | - * The region's left extent as index, for symmetry with set/getXY | ||
| 749 | - * @property 0 | ||
| 750 | - * @type Int | ||
| 751 | - */ | ||
| 752 | - this[0] = l; | ||
| 753 | -}; | ||
| 754 | - | ||
| 755 | -/** | ||
| 756 | - * Returns true if this region contains the region passed in | ||
| 757 | - * @method contains | ||
| 758 | - * @param {Region} region The region to evaluate | ||
| 759 | - * @return {Boolean} True if the region is contained with this region, | ||
| 760 | - * else false | ||
| 761 | - */ | ||
| 762 | -YAHOO.util.Region.prototype.contains = function(region) { | ||
| 763 | - return ( region.left >= this.left && | ||
| 764 | - region.right <= this.right && | ||
| 765 | - region.top >= this.top && | ||
| 766 | - region.bottom <= this.bottom ); | ||
| 767 | - | ||
| 768 | -}; | ||
| 769 | - | ||
| 770 | -/** | ||
| 771 | - * Returns the area of the region | ||
| 772 | - * @method getArea | ||
| 773 | - * @return {Int} the region's area | ||
| 774 | - */ | ||
| 775 | -YAHOO.util.Region.prototype.getArea = function() { | ||
| 776 | - return ( (this.bottom - this.top) * (this.right - this.left) ); | ||
| 777 | -}; | ||
| 778 | - | ||
| 779 | -/** | ||
| 780 | - * Returns the region where the passed in region overlaps with this one | ||
| 781 | - * @method intersect | ||
| 782 | - * @param {Region} region The region that intersects | ||
| 783 | - * @return {Region} The overlap region, or null if there is no overlap | ||
| 784 | - */ | ||
| 785 | -YAHOO.util.Region.prototype.intersect = function(region) { | ||
| 786 | - var t = Math.max( this.top, region.top ); | ||
| 787 | - var r = Math.min( this.right, region.right ); | ||
| 788 | - var b = Math.min( this.bottom, region.bottom ); | ||
| 789 | - var l = Math.max( this.left, region.left ); | ||
| 790 | - | ||
| 791 | - if (b >= t && r >= l) { | ||
| 792 | - return new YAHOO.util.Region(t, r, b, l); | ||
| 793 | - } else { | ||
| 794 | - return null; | ||
| 795 | - } | ||
| 796 | -}; | ||
| 797 | - | ||
| 798 | -/** | ||
| 799 | - * Returns the region representing the smallest region that can contain both | ||
| 800 | - * the passed in region and this region. | ||
| 801 | - * @method union | ||
| 802 | - * @param {Region} region The region that to create the union with | ||
| 803 | - * @return {Region} The union region | ||
| 804 | - */ | ||
| 805 | -YAHOO.util.Region.prototype.union = function(region) { | ||
| 806 | - var t = Math.min( this.top, region.top ); | ||
| 807 | - var r = Math.max( this.right, region.right ); | ||
| 808 | - var b = Math.max( this.bottom, region.bottom ); | ||
| 809 | - var l = Math.min( this.left, region.left ); | ||
| 810 | - | ||
| 811 | - return new YAHOO.util.Region(t, r, b, l); | ||
| 812 | -}; | ||
| 813 | - | ||
| 814 | -/** | ||
| 815 | - * toString | ||
| 816 | - * @method toString | ||
| 817 | - * @return string the region properties | ||
| 818 | - */ | ||
| 819 | -YAHOO.util.Region.prototype.toString = function() { | ||
| 820 | - return ( "Region {" + | ||
| 821 | - "top: " + this.top + | ||
| 822 | - ", right: " + this.right + | ||
| 823 | - ", bottom: " + this.bottom + | ||
| 824 | - ", left: " + this.left + | ||
| 825 | - "}" ); | ||
| 826 | -}; | ||
| 827 | - | ||
| 828 | -/** | ||
| 829 | - * Returns a region that is occupied by the DOM element | ||
| 830 | - * @method getRegion | ||
| 831 | - * @param {HTMLElement} el The element | ||
| 832 | - * @return {Region} The region that the element occupies | ||
| 833 | - * @static | ||
| 834 | - */ | ||
| 835 | -YAHOO.util.Region.getRegion = function(el) { | ||
| 836 | - var p = YAHOO.util.Dom.getXY(el); | ||
| 837 | - | ||
| 838 | - var t = p[1]; | ||
| 839 | - var r = p[0] + el.offsetWidth; | ||
| 840 | - var b = p[1] + el.offsetHeight; | ||
| 841 | - var l = p[0]; | ||
| 842 | - | ||
| 843 | - return new YAHOO.util.Region(t, r, b, l); | ||
| 844 | -}; | ||
| 845 | - | ||
| 846 | -///////////////////////////////////////////////////////////////////////////// | ||
| 847 | - | ||
| 848 | -/** | ||
| 849 | - * A point is a region that is special in that it represents a single point on | ||
| 850 | - * the grid. | ||
| 851 | - * @namespace YAHOO.util | ||
| 852 | - * @class Point | ||
| 853 | - * @param {Int} x The X position of the point | ||
| 854 | - * @param {Int} y The Y position of the point | ||
| 855 | - * @constructor | ||
| 856 | - * @extends YAHOO.util.Region | ||
| 857 | - */ | ||
| 858 | -YAHOO.util.Point = function(x, y) { | ||
| 859 | - if (x instanceof Array) { // accept output from Dom.getXY | ||
| 860 | - y = x[1]; | ||
| 861 | - x = x[0]; | ||
| 862 | - } | ||
| 863 | - | ||
| 864 | - /** | ||
| 865 | - * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry) | ||
| 866 | - * @property x | ||
| 867 | - * @type Int | ||
| 868 | - */ | ||
| 869 | - | ||
| 870 | - this.x = this.right = this.left = this[0] = x; | ||
| 871 | - | ||
| 872 | - /** | ||
| 873 | - * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry) | ||
| 874 | - * @property y | ||
| 875 | - * @type Int | ||
| 876 | - */ | ||
| 877 | - this.y = this.top = this.bottom = this[1] = y; | ||
| 878 | -}; | ||
| 879 | - | ||
| 880 | -YAHOO.util.Point.prototype = new YAHOO.util.Region(); | ||
| 881 | - | 1 | +(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf("opera")>-1),isSafari=(ua.indexOf("safari")>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf("gecko")>-1),isIE=(!isOpera&&ua.indexOf("msie")>-1);var _3={HYPHEN:/(-[a-z])/i};var _4=function(_5){if(!_3.HYPHEN.test(_5)){return _5;}if(propertyCache[_5]){return propertyCache[_5];}while(_3.HYPHEN.exec(_5)){_5=_5.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[_5]=_5;return _5;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,_7){var _8=null;var _9=document.defaultView.getComputedStyle(el,"");if(_9){_8=_9[_4(_7)];}return el.style[_7]||_8;};}else{if(document.documentElement.currentStyle&&isIE){getStyle=function(el,_b){switch(_4(_b)){case "opacity":var _c=100;try{_c=el.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(e){try{_c=el.filters("alpha").opacity;}catch(e){}}return _c/100;break;default:var _d=el.currentStyle?el.currentStyle[_b]:null;return (el.style[_b]||_d);}};}else{getStyle=function(el,_f){return el.style[_f];};}}if(isIE){setStyle=function(el,_11,val){switch(_11){case "opacity":if(typeof el.style.filter=="string"){el.style.filter="alpha(opacity="+val*100+")";if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[_11]=val;}};}else{setStyle=function(el,_14,val){el.style[_14]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!="string"&&!(el instanceof Array)){return el;}if(typeof el=="string"){return document.getElementById(el);}else{var _17=[];for(var i=0,len=el.length;i<len;++i){_17[_17.length]=Y.Dom.get(el[i]);}return _17;}return null;},getStyle:function(el,_1a){_1a=_4(_1a);var f=function(_1c){return getStyle(_1c,_1a);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,_1e,val){_1e=_4(_1e);var f=function(_21){setStyle(_21,_1e,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if(el.parentNode===null||el.offsetParent===null||this.getStyle(el,"display")=="none"){return false;}var _25=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var _29=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var _2a=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return [box.left+_2a,box.top+_29];}else{pos=[el.offsetLeft,el.offsetTop];_25=el.offsetParent;if(_25!=el){while(_25){pos[0]+=_25.offsetLeft;pos[1]+=_25.offsetTop;_25=_25.offsetParent;}}if(isSafari&&this.getStyle(el,"position")=="absolute"){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){_25=el.parentNode;}else{_25=null;}while(_25&&_25.tagName.toUpperCase()!="BODY"&&_25.tagName.toUpperCase()!="HTML"){if(Y.Dom.getStyle(_25,"display")!="inline"){pos[0]-=_25.scrollLeft;pos[1]-=_25.scrollTop;}if(_25.parentNode){_25=_25.parentNode;}else{_25=null;}}return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,_33){var f=function(el){var _36=this.getStyle(el,"position");if(_36=="static"){this.setStyle(el,"position","relative");_36="relative";}var _37=this.getXY(el);if(_37===false){return false;}var _38=[parseInt(this.getStyle(el,"left"),10),parseInt(this.getStyle(el,"top"),10)];if(isNaN(_38[0])){_38[0]=(_36=="relative")?0:el.offsetLeft;}if(isNaN(_38[1])){_38[1]=(_36=="relative")?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-_37[0]+_38[0]+"px";}if(pos[1]!==null){el.style.top=pos[1]-_37[1]+_38[1]+"px";}var _39=this.getXY(el);if(!_33&&(_39[0]!=pos[0]||_39[1]!=pos[1])){this.setXY(el,pos,true);}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var _41=new Y.Region.getRegion(el);return _41;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(_42,tag,_44){var _45=function(el){return Y.Dom.hasClass(el,_42);};return Y.Dom.getElementsBy(_45,tag,_44);},hasClass:function(el,_48){var re=new RegExp("(?:^|\\s+)"+_48+"(?:\\s+|$)");var f=function(el){return re.test(el["className"]);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,_4d){var f=function(el){if(this.hasClass(el,_4d)){return;}el["className"]=[el["className"],_4d].join(" ");};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,_51){var re=new RegExp("(?:^|\\s+)"+_51+"(?:\\s+|$)","g");var f=function(el){if(!this.hasClass(el,_51)){return;}var c=el["className"];el["className"]=c.replace(re," ");if(this.hasClass(el,_51)){this.removeClass(el,_51);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,_57,_58){if(_57===_58){return false;}var re=new RegExp("(?:^|\\s+)"+_57+"(?:\\s+|$)","g");var f=function(el){if(!this.hasClass(el,_57)){this.addClass(el,_58);return;}el["className"]=el["className"].replace(re," "+_58+" ");if(this.hasClass(el,_57)){this.replaceClass(el,_57,_58);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,_5d){_5d=_5d||"yui-gen";el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}if(!el.id){el.id=_5d+id_counter++;}return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(_60,_61){_60=Y.Dom.get(_60);if(!_60||!_61){return false;}var f=function(_63){if(_60.contains&&!isSafari){return _60.contains(_63);}else{if(_60.compareDocumentPosition){return !!(_60.compareDocumentPosition(_63)&16);}else{var _64=_63.parentNode;while(_64){if(_64==_60){return true;}else{if(!_64.tagName||_64.tagName.toUpperCase()=="HTML"){return false;}}_64=_64.parentNode;}return false;}}};return Y.Dom.batch(_61,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(_68,tag,_6a){tag=tag||"*";_6a=Y.Dom.get(_6a)||document;var _6b=[];var _6c=_6a.getElementsByTagName(tag);if(!_6c.length&&(tag=="*"&&_6a.all)){_6c=_6a.all;}for(var i=0,len=_6c.length;i<len;++i){if(_68(_6c[i])){_6b[_6b.length]=_6c[i];}}return _6b;},batch:function(el,_6f,o,_71){var id=el;el=Y.Dom.get(el);var _73=(_71)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return _6f.call(_73,el,o);}var _74=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}_74[_74.length]=_6f.call(_73,el[i],o);}return _74;},getDocumentHeight:function(){var _76=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(_76,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var _78=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(_78,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var _7a=self.innerHeight;var _7b=document.compatMode;if((_7b||isIE)&&!isOpera){_7a=(_7b=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return _7a;},getViewportWidth:function(){var _7c=self.innerWidth;var _7d=document.compatMode;if(_7d||isIE){_7c=(_7d=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return _7c;}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(_82){return (_82.left>=this.left&&_82.right<=this.right&&_82.top>=this.top&&_82.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return ((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(_83){var t=Math.max(this.top,_83.top);var r=Math.min(this.right,_83.right);var b=Math.min(this.bottom,_83.bottom);var l=Math.max(this.left,_83.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(_88){var t=Math.min(this.top,_88.top);var r=Math.max(this.right,_88.right);var b=Math.max(this.bottom,_88.bottom);var l=Math.min(this.left,_88.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return ("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); |
| 882 | \ No newline at end of file | 2 | \ No newline at end of file |
thirdpartyjs/yui/dragdrop/dragdrop.js
| 1 | -/* | ||
| 2 | -Copyright (c) 2006, Yahoo! Inc. All rights reserved. | ||
| 3 | -Code licensed under the BSD License: | ||
| 4 | -http://developer.yahoo.net/yui/license.txt | ||
| 5 | -version: 0.12.0 | ||
| 6 | -*/ | ||
| 7 | - | ||
| 8 | -(function() { | ||
| 9 | - | ||
| 10 | -var Event=YAHOO.util.Event; | ||
| 11 | -var Dom=YAHOO.util.Dom; | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * Defines the interface and base operation of items that that can be | ||
| 15 | - * dragged or can be drop targets. It was designed to be extended, overriding | ||
| 16 | - * the event handlers for startDrag, onDrag, onDragOver, onDragOut. | ||
| 17 | - * Up to three html elements can be associated with a DragDrop instance: | ||
| 18 | - * <ul> | ||
| 19 | - * <li>linked element: the element that is passed into the constructor. | ||
| 20 | - * This is the element which defines the boundaries for interaction with | ||
| 21 | - * other DragDrop objects.</li> | ||
| 22 | - * <li>handle element(s): The drag operation only occurs if the element that | ||
| 23 | - * was clicked matches a handle element. By default this is the linked | ||
| 24 | - * element, but there are times that you will want only a portion of the | ||
| 25 | - * linked element to initiate the drag operation, and the setHandleElId() | ||
| 26 | - * method provides a way to define this.</li> | ||
| 27 | - * <li>drag element: this represents an the element that would be moved along | ||
| 28 | - * with the cursor during a drag operation. By default, this is the linked | ||
| 29 | - * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define | ||
| 30 | - * a separate element that would be moved, as in {@link YAHOO.util.DDProxy} | ||
| 31 | - * </li> | ||
| 32 | - * </ul> | ||
| 33 | - * This class should not be instantiated until the onload event to ensure that | ||
| 34 | - * the associated elements are available. | ||
| 35 | - * The following would define a DragDrop obj that would interact with any | ||
| 36 | - * other DragDrop obj in the "group1" group: | ||
| 37 | - * <pre> | ||
| 38 | - * dd = new YAHOO.util.DragDrop("div1", "group1"); | ||
| 39 | - * </pre> | ||
| 40 | - * Since none of the event handlers have been implemented, nothing would | ||
| 41 | - * actually happen if you were to run the code above. Normally you would | ||
| 42 | - * override this class or one of the default implementations, but you can | ||
| 43 | - * also override the methods you want on an instance of the class... | ||
| 44 | - * <pre> | ||
| 45 | - * dd.onDragDrop = function(e, id) { | ||
| 46 | - * alert("dd was dropped on " + id); | ||
| 47 | - * } | ||
| 48 | - * </pre> | ||
| 49 | - * @namespace YAHOO.util | ||
| 50 | - * @class DragDrop | ||
| 51 | - * @constructor | ||
| 52 | - * @param {String} id of the element that is linked to this instance | ||
| 53 | - * @param {String} sGroup the group of related DragDrop objects | ||
| 54 | - * @param {object} config an object containing configurable attributes | ||
| 55 | - * Valid properties for DragDrop: | ||
| 56 | - * padding, isTarget, maintainOffset, primaryButtonOnly | ||
| 57 | - */ | ||
| 58 | -YAHOO.util.DragDrop = function(id, sGroup, config) { | ||
| 59 | - if (id) { | ||
| 60 | - this.init(id, sGroup, config); | ||
| 61 | - } | ||
| 62 | -}; | ||
| 63 | - | ||
| 64 | -YAHOO.util.DragDrop.prototype = { | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * The id of the element associated with this object. This is what we | ||
| 68 | - * refer to as the "linked element" because the size and position of | ||
| 69 | - * this element is used to determine when the drag and drop objects have | ||
| 70 | - * interacted. | ||
| 71 | - * @property id | ||
| 72 | - * @type String | ||
| 73 | - */ | ||
| 74 | - id: null, | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | - * Configuration attributes passed into the constructor | ||
| 78 | - * @property config | ||
| 79 | - * @type object | ||
| 80 | - */ | ||
| 81 | - config: null, | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | - * The id of the element that will be dragged. By default this is same | ||
| 85 | - * as the linked element , but could be changed to another element. Ex: | ||
| 86 | - * YAHOO.util.DDProxy | ||
| 87 | - * @property dragElId | ||
| 88 | - * @type String | ||
| 89 | - * @private | ||
| 90 | - */ | ||
| 91 | - dragElId: null, | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * the id of the element that initiates the drag operation. By default | ||
| 95 | - * this is the linked element, but could be changed to be a child of this | ||
| 96 | - * element. This lets us do things like only starting the drag when the | ||
| 97 | - * header element within the linked html element is clicked. | ||
| 98 | - * @property handleElId | ||
| 99 | - * @type String | ||
| 100 | - * @private | ||
| 101 | - */ | ||
| 102 | - handleElId: null, | ||
| 103 | - | ||
| 104 | - /** | ||
| 105 | - * An associative array of HTML tags that will be ignored if clicked. | ||
| 106 | - * @property invalidHandleTypes | ||
| 107 | - * @type {string: string} | ||
| 108 | - */ | ||
| 109 | - invalidHandleTypes: null, | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * An associative array of ids for elements that will be ignored if clicked | ||
| 113 | - * @property invalidHandleIds | ||
| 114 | - * @type {string: string} | ||
| 115 | - */ | ||
| 116 | - invalidHandleIds: null, | ||
| 117 | - | ||
| 118 | - /** | ||
| 119 | - * An indexted array of css class names for elements that will be ignored | ||
| 120 | - * if clicked. | ||
| 121 | - * @property invalidHandleClasses | ||
| 122 | - * @type string[] | ||
| 123 | - */ | ||
| 124 | - invalidHandleClasses: null, | ||
| 125 | - | ||
| 126 | - /** | ||
| 127 | - * The linked element's absolute X position at the time the drag was | ||
| 128 | - * started | ||
| 129 | - * @property startPageX | ||
| 130 | - * @type int | ||
| 131 | - * @private | ||
| 132 | - */ | ||
| 133 | - startPageX: 0, | ||
| 134 | - | ||
| 135 | - /** | ||
| 136 | - * The linked element's absolute X position at the time the drag was | ||
| 137 | - * started | ||
| 138 | - * @property startPageY | ||
| 139 | - * @type int | ||
| 140 | - * @private | ||
| 141 | - */ | ||
| 142 | - startPageY: 0, | ||
| 143 | - | ||
| 144 | - /** | ||
| 145 | - * The group defines a logical collection of DragDrop objects that are | ||
| 146 | - * related. Instances only get events when interacting with other | ||
| 147 | - * DragDrop object in the same group. This lets us define multiple | ||
| 148 | - * groups using a single DragDrop subclass if we want. | ||
| 149 | - * @property groups | ||
| 150 | - * @type {string: string} | ||
| 151 | - */ | ||
| 152 | - groups: null, | ||
| 153 | - | ||
| 154 | - /** | ||
| 155 | - * Individual drag/drop instances can be locked. This will prevent | ||
| 156 | - * onmousedown start drag. | ||
| 157 | - * @property locked | ||
| 158 | - * @type boolean | ||
| 159 | - * @private | ||
| 160 | - */ | ||
| 161 | - locked: false, | ||
| 162 | - | ||
| 163 | - /** | ||
| 164 | - * Lock this instance | ||
| 165 | - * @method lock | ||
| 166 | - */ | ||
| 167 | - lock: function() { this.locked = true; }, | ||
| 168 | - | ||
| 169 | - /** | ||
| 170 | - * Unlock this instace | ||
| 171 | - * @method unlock | ||
| 172 | - */ | ||
| 173 | - unlock: function() { this.locked = false; }, | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * By default, all insances can be a drop target. This can be disabled by | ||
| 177 | - * setting isTarget to false. | ||
| 178 | - * @method isTarget | ||
| 179 | - * @type boolean | ||
| 180 | - */ | ||
| 181 | - isTarget: true, | ||
| 182 | - | ||
| 183 | - /** | ||
| 184 | - * The padding configured for this drag and drop object for calculating | ||
| 185 | - * the drop zone intersection with this object. | ||
| 186 | - * @method padding | ||
| 187 | - * @type int[] | ||
| 188 | - */ | ||
| 189 | - padding: null, | ||
| 190 | - | ||
| 191 | - /** | ||
| 192 | - * Cached reference to the linked element | ||
| 193 | - * @property _domRef | ||
| 194 | - * @private | ||
| 195 | - */ | ||
| 196 | - _domRef: null, | ||
| 197 | - | ||
| 198 | - /** | ||
| 199 | - * Internal typeof flag | ||
| 200 | - * @property __ygDragDrop | ||
| 201 | - * @private | ||
| 202 | - */ | ||
| 203 | - __ygDragDrop: true, | ||
| 204 | - | ||
| 205 | - /** | ||
| 206 | - * Set to true when horizontal contraints are applied | ||
| 207 | - * @property constrainX | ||
| 208 | - * @type boolean | ||
| 209 | - * @private | ||
| 210 | - */ | ||
| 211 | - constrainX: false, | ||
| 212 | - | ||
| 213 | - /** | ||
| 214 | - * Set to true when vertical contraints are applied | ||
| 215 | - * @property constrainY | ||
| 216 | - * @type boolean | ||
| 217 | - * @private | ||
| 218 | - */ | ||
| 219 | - constrainY: false, | ||
| 220 | - | ||
| 221 | - /** | ||
| 222 | - * The left constraint | ||
| 223 | - * @property minX | ||
| 224 | - * @type int | ||
| 225 | - * @private | ||
| 226 | - */ | ||
| 227 | - minX: 0, | ||
| 228 | - | ||
| 229 | - /** | ||
| 230 | - * The right constraint | ||
| 231 | - * @property maxX | ||
| 232 | - * @type int | ||
| 233 | - * @private | ||
| 234 | - */ | ||
| 235 | - maxX: 0, | ||
| 236 | - | ||
| 237 | - /** | ||
| 238 | - * The up constraint | ||
| 239 | - * @property minY | ||
| 240 | - * @type int | ||
| 241 | - * @type int | ||
| 242 | - * @private | ||
| 243 | - */ | ||
| 244 | - minY: 0, | ||
| 245 | - | ||
| 246 | - /** | ||
| 247 | - * The down constraint | ||
| 248 | - * @property maxY | ||
| 249 | - * @type int | ||
| 250 | - * @private | ||
| 251 | - */ | ||
| 252 | - maxY: 0, | ||
| 253 | - | ||
| 254 | - /** | ||
| 255 | - * Maintain offsets when we resetconstraints. Set to true when you want | ||
| 256 | - * the position of the element relative to its parent to stay the same | ||
| 257 | - * when the page changes | ||
| 258 | - * | ||
| 259 | - * @property maintainOffset | ||
| 260 | - * @type boolean | ||
| 261 | - */ | ||
| 262 | - maintainOffset: false, | ||
| 263 | - | ||
| 264 | - /** | ||
| 265 | - * Array of pixel locations the element will snap to if we specified a | ||
| 266 | - * horizontal graduation/interval. This array is generated automatically | ||
| 267 | - * when you define a tick interval. | ||
| 268 | - * @property xTicks | ||
| 269 | - * @type int[] | ||
| 270 | - */ | ||
| 271 | - xTicks: null, | ||
| 272 | - | ||
| 273 | - /** | ||
| 274 | - * Array of pixel locations the element will snap to if we specified a | ||
| 275 | - * vertical graduation/interval. This array is generated automatically | ||
| 276 | - * when you define a tick interval. | ||
| 277 | - * @property yTicks | ||
| 278 | - * @type int[] | ||
| 279 | - */ | ||
| 280 | - yTicks: null, | ||
| 281 | - | ||
| 282 | - /** | ||
| 283 | - * By default the drag and drop instance will only respond to the primary | ||
| 284 | - * button click (left button for a right-handed mouse). Set to true to | ||
| 285 | - * allow drag and drop to start with any mouse click that is propogated | ||
| 286 | - * by the browser | ||
| 287 | - * @property primaryButtonOnly | ||
| 288 | - * @type boolean | ||
| 289 | - */ | ||
| 290 | - primaryButtonOnly: true, | ||
| 291 | - | ||
| 292 | - /** | ||
| 293 | - * The availabe property is false until the linked dom element is accessible. | ||
| 294 | - * @property available | ||
| 295 | - * @type boolean | ||
| 296 | - */ | ||
| 297 | - available: false, | ||
| 298 | - | ||
| 299 | - /** | ||
| 300 | - * By default, drags can only be initiated if the mousedown occurs in the | ||
| 301 | - * region the linked element is. This is done in part to work around a | ||
| 302 | - * bug in some browsers that mis-report the mousedown if the previous | ||
| 303 | - * mouseup happened outside of the window. This property is set to true | ||
| 304 | - * if outer handles are defined. | ||
| 305 | - * | ||
| 306 | - * @property hasOuterHandles | ||
| 307 | - * @type boolean | ||
| 308 | - * @default false | ||
| 309 | - */ | ||
| 310 | - hasOuterHandles: false, | ||
| 311 | - | ||
| 312 | - /** | ||
| 313 | - * Code that executes immediately before the startDrag event | ||
| 314 | - * @method b4StartDrag | ||
| 315 | - * @private | ||
| 316 | - */ | ||
| 317 | - b4StartDrag: function(x, y) { }, | ||
| 318 | - | ||
| 319 | - /** | ||
| 320 | - * Abstract method called after a drag/drop object is clicked | ||
| 321 | - * and the drag or mousedown time thresholds have beeen met. | ||
| 322 | - * @method startDrag | ||
| 323 | - * @param {int} X click location | ||
| 324 | - * @param {int} Y click location | ||
| 325 | - */ | ||
| 326 | - startDrag: function(x, y) { /* override this */ }, | ||
| 327 | - | ||
| 328 | - /** | ||
| 329 | - * Code that executes immediately before the onDrag event | ||
| 330 | - * @method b4Drag | ||
| 331 | - * @private | ||
| 332 | - */ | ||
| 333 | - b4Drag: function(e) { }, | ||
| 334 | - | ||
| 335 | - /** | ||
| 336 | - * Abstract method called during the onMouseMove event while dragging an | ||
| 337 | - * object. | ||
| 338 | - * @method onDrag | ||
| 339 | - * @param {Event} e the mousemove event | ||
| 340 | - */ | ||
| 341 | - onDrag: function(e) { /* override this */ }, | ||
| 342 | - | ||
| 343 | - /** | ||
| 344 | - * Abstract method called when this element fist begins hovering over | ||
| 345 | - * another DragDrop obj | ||
| 346 | - * @method onDragEnter | ||
| 347 | - * @param {Event} e the mousemove event | ||
| 348 | - * @param {String|DragDrop[]} id In POINT mode, the element | ||
| 349 | - * id this is hovering over. In INTERSECT mode, an array of one or more | ||
| 350 | - * dragdrop items being hovered over. | ||
| 351 | - */ | ||
| 352 | - onDragEnter: function(e, id) { /* override this */ }, | ||
| 353 | - | ||
| 354 | - /** | ||
| 355 | - * Code that executes immediately before the onDragOver event | ||
| 356 | - * @method b4DragOver | ||
| 357 | - * @private | ||
| 358 | - */ | ||
| 359 | - b4DragOver: function(e) { }, | ||
| 360 | - | ||
| 361 | - /** | ||
| 362 | - * Abstract method called when this element is hovering over another | ||
| 363 | - * DragDrop obj | ||
| 364 | - * @method onDragOver | ||
| 365 | - * @param {Event} e the mousemove event | ||
| 366 | - * @param {String|DragDrop[]} id In POINT mode, the element | ||
| 367 | - * id this is hovering over. In INTERSECT mode, an array of dd items | ||
| 368 | - * being hovered over. | ||
| 369 | - */ | ||
| 370 | - onDragOver: function(e, id) { /* override this */ }, | ||
| 371 | - | ||
| 372 | - /** | ||
| 373 | - * Code that executes immediately before the onDragOut event | ||
| 374 | - * @method b4DragOut | ||
| 375 | - * @private | ||
| 376 | - */ | ||
| 377 | - b4DragOut: function(e) { }, | ||
| 378 | - | ||
| 379 | - /** | ||
| 380 | - * Abstract method called when we are no longer hovering over an element | ||
| 381 | - * @method onDragOut | ||
| 382 | - * @param {Event} e the mousemove event | ||
| 383 | - * @param {String|DragDrop[]} id In POINT mode, the element | ||
| 384 | - * id this was hovering over. In INTERSECT mode, an array of dd items | ||
| 385 | - * that the mouse is no longer over. | ||
| 386 | - */ | ||
| 387 | - onDragOut: function(e, id) { /* override this */ }, | ||
| 388 | - | ||
| 389 | - /** | ||
| 390 | - * Code that executes immediately before the onDragDrop event | ||
| 391 | - * @method b4DragDrop | ||
| 392 | - * @private | ||
| 393 | - */ | ||
| 394 | - b4DragDrop: function(e) { }, | ||
| 395 | - | ||
| 396 | - /** | ||
| 397 | - * Abstract method called when this item is dropped on another DragDrop | ||
| 398 | - * obj | ||
| 399 | - * @method onDragDrop | ||
| 400 | - * @param {Event} e the mouseup event | ||
| 401 | - * @param {String|DragDrop[]} id In POINT mode, the element | ||
| 402 | - * id this was dropped on. In INTERSECT mode, an array of dd items this | ||
| 403 | - * was dropped on. | ||
| 404 | - */ | ||
| 405 | - onDragDrop: function(e, id) { /* override this */ }, | ||
| 406 | - | ||
| 407 | - /** | ||
| 408 | - * Abstract method called when this item is dropped on an area with no | ||
| 409 | - * drop target | ||
| 410 | - * @method onInvalidDrop | ||
| 411 | - * @param {Event} e the mouseup event | ||
| 412 | - */ | ||
| 413 | - onInvalidDrop: function(e) { /* override this */ }, | ||
| 414 | - | ||
| 415 | - /** | ||
| 416 | - * Code that executes immediately before the endDrag event | ||
| 417 | - * @method b4EndDrag | ||
| 418 | - * @private | ||
| 419 | - */ | ||
| 420 | - b4EndDrag: function(e) { }, | ||
| 421 | - | ||
| 422 | - /** | ||
| 423 | - * Fired when we are done dragging the object | ||
| 424 | - * @method endDrag | ||
| 425 | - * @param {Event} e the mouseup event | ||
| 426 | - */ | ||
| 427 | - endDrag: function(e) { /* override this */ }, | ||
| 428 | - | ||
| 429 | - /** | ||
| 430 | - * Code executed immediately before the onMouseDown event | ||
| 431 | - * @method b4MouseDown | ||
| 432 | - * @param {Event} e the mousedown event | ||
| 433 | - * @private | ||
| 434 | - */ | ||
| 435 | - b4MouseDown: function(e) { }, | ||
| 436 | - | ||
| 437 | - /** | ||
| 438 | - * Event handler that fires when a drag/drop obj gets a mousedown | ||
| 439 | - * @method onMouseDown | ||
| 440 | - * @param {Event} e the mousedown event | ||
| 441 | - */ | ||
| 442 | - onMouseDown: function(e) { /* override this */ }, | ||
| 443 | - | ||
| 444 | - /** | ||
| 445 | - * Event handler that fires when a drag/drop obj gets a mouseup | ||
| 446 | - * @method onMouseUp | ||
| 447 | - * @param {Event} e the mouseup event | ||
| 448 | - */ | ||
| 449 | - onMouseUp: function(e) { /* override this */ }, | ||
| 450 | - | ||
| 451 | - /** | ||
| 452 | - * Override the onAvailable method to do what is needed after the initial | ||
| 453 | - * position was determined. | ||
| 454 | - * @method onAvailable | ||
| 455 | - */ | ||
| 456 | - onAvailable: function () { | ||
| 457 | - }, | ||
| 458 | - | ||
| 459 | - /** | ||
| 460 | - * Returns a reference to the linked element | ||
| 461 | - * @method getEl | ||
| 462 | - * @return {HTMLElement} the html element | ||
| 463 | - */ | ||
| 464 | - getEl: function() { | ||
| 465 | - if (!this._domRef) { | ||
| 466 | - this._domRef = Dom.get(this.id); | ||
| 467 | - } | ||
| 468 | - | ||
| 469 | - return this._domRef; | ||
| 470 | - }, | ||
| 471 | - | ||
| 472 | - /** | ||
| 473 | - * Returns a reference to the actual element to drag. By default this is | ||
| 474 | - * the same as the html element, but it can be assigned to another | ||
| 475 | - * element. An example of this can be found in YAHOO.util.DDProxy | ||
| 476 | - * @method getDragEl | ||
| 477 | - * @return {HTMLElement} the html element | ||
| 478 | - */ | ||
| 479 | - getDragEl: function() { | ||
| 480 | - return Dom.get(this.dragElId); | ||
| 481 | - }, | ||
| 482 | - | ||
| 483 | - /** | ||
| 484 | - * Sets up the DragDrop object. Must be called in the constructor of any | ||
| 485 | - * YAHOO.util.DragDrop subclass | ||
| 486 | - * @method init | ||
| 487 | - * @param id the id of the linked element | ||
| 488 | - * @param {String} sGroup the group of related items | ||
| 489 | - * @param {object} config configuration attributes | ||
| 490 | - */ | ||
| 491 | - init: function(id, sGroup, config) { | ||
| 492 | - this.initTarget(id, sGroup, config); | ||
| 493 | - Event.on(this.id, "mousedown", this.handleMouseDown, this, true); | ||
| 494 | - // Event.on(this.id, "selectstart", Event.preventDefault); | ||
| 495 | - }, | ||
| 496 | - | ||
| 497 | - /** | ||
| 498 | - * Initializes Targeting functionality only... the object does not | ||
| 499 | - * get a mousedown handler. | ||
| 500 | - * @method initTarget | ||
| 501 | - * @param id the id of the linked element | ||
| 502 | - * @param {String} sGroup the group of related items | ||
| 503 | - * @param {object} config configuration attributes | ||
| 504 | - */ | ||
| 505 | - initTarget: function(id, sGroup, config) { | ||
| 506 | - | ||
| 507 | - // configuration attributes | ||
| 508 | - this.config = config || {}; | ||
| 509 | - | ||
| 510 | - // create a local reference to the drag and drop manager | ||
| 511 | - this.DDM = YAHOO.util.DDM; | ||
| 512 | - // initialize the groups array | ||
| 513 | - this.groups = {}; | ||
| 514 | - | ||
| 515 | - // assume that we have an element reference instead of an id if the | ||
| 516 | - // parameter is not a string | ||
| 517 | - if (typeof id !== "string") { | ||
| 518 | - YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 519 | - id = Dom.generateId(id); | ||
| 520 | - } | ||
| 521 | - | ||
| 522 | - // set the id | ||
| 523 | - this.id = id; | ||
| 524 | - | ||
| 525 | - // add to an interaction group | ||
| 526 | - this.addToGroup((sGroup) ? sGroup : "default"); | ||
| 527 | - | ||
| 528 | - // We don't want to register this as the handle with the manager | ||
| 529 | - // so we just set the id rather than calling the setter. | ||
| 530 | - this.handleElId = id; | ||
| 531 | - | ||
| 532 | - Event.onAvailable(id, this.handleOnAvailable, this, true); | ||
| 533 | - | ||
| 534 | - | ||
| 535 | - // the linked element is the element that gets dragged by default | ||
| 536 | - this.setDragElId(id); | ||
| 537 | - | ||
| 538 | - // by default, clicked anchors will not start drag operations. | ||
| 539 | - // @TODO what else should be here? Probably form fields. | ||
| 540 | - this.invalidHandleTypes = { A: "A" }; | ||
| 541 | - this.invalidHandleIds = {}; | ||
| 542 | - this.invalidHandleClasses = []; | ||
| 543 | - | ||
| 544 | - this.applyConfig(); | ||
| 545 | - }, | ||
| 546 | - | ||
| 547 | - /** | ||
| 548 | - * Applies the configuration parameters that were passed into the constructor. | ||
| 549 | - * This is supposed to happen at each level through the inheritance chain. So | ||
| 550 | - * a DDProxy implentation will execute apply config on DDProxy, DD, and | ||
| 551 | - * DragDrop in order to get all of the parameters that are available in | ||
| 552 | - * each object. | ||
| 553 | - * @method applyConfig | ||
| 554 | - */ | ||
| 555 | - applyConfig: function() { | ||
| 556 | - | ||
| 557 | - // configurable properties: | ||
| 558 | - // padding, isTarget, maintainOffset, primaryButtonOnly | ||
| 559 | - this.padding = this.config.padding || [0, 0, 0, 0]; | ||
| 560 | - this.isTarget = (this.config.isTarget !== false); | ||
| 561 | - this.maintainOffset = (this.config.maintainOffset); | ||
| 562 | - this.primaryButtonOnly = (this.config.primaryButtonOnly !== false); | ||
| 563 | - | ||
| 564 | - }, | ||
| 565 | - | ||
| 566 | - /** | ||
| 567 | - * Executed when the linked element is available | ||
| 568 | - * @method handleOnAvailable | ||
| 569 | - * @private | ||
| 570 | - */ | ||
| 571 | - handleOnAvailable: function() { | ||
| 572 | - this.available = true; | ||
| 573 | - this.resetConstraints(); | ||
| 574 | - this.onAvailable(); | ||
| 575 | - }, | ||
| 576 | - | ||
| 577 | - /** | ||
| 578 | - * Configures the padding for the target zone in px. Effectively expands | ||
| 579 | - * (or reduces) the virtual object size for targeting calculations. | ||
| 580 | - * Supports css-style shorthand; if only one parameter is passed, all sides | ||
| 581 | - * will have that padding, and if only two are passed, the top and bottom | ||
| 582 | - * will have the first param, the left and right the second. | ||
| 583 | - * @method setPadding | ||
| 584 | - * @param {int} iTop Top pad | ||
| 585 | - * @param {int} iRight Right pad | ||
| 586 | - * @param {int} iBot Bot pad | ||
| 587 | - * @param {int} iLeft Left pad | ||
| 588 | - */ | ||
| 589 | - setPadding: function(iTop, iRight, iBot, iLeft) { | ||
| 590 | - // this.padding = [iLeft, iRight, iTop, iBot]; | ||
| 591 | - if (!iRight && 0 !== iRight) { | ||
| 592 | - this.padding = [iTop, iTop, iTop, iTop]; | ||
| 593 | - } else if (!iBot && 0 !== iBot) { | ||
| 594 | - this.padding = [iTop, iRight, iTop, iRight]; | ||
| 595 | - } else { | ||
| 596 | - this.padding = [iTop, iRight, iBot, iLeft]; | ||
| 597 | - } | ||
| 598 | - }, | ||
| 599 | - | ||
| 600 | - /** | ||
| 601 | - * Stores the initial placement of the linked element. | ||
| 602 | - * @method setInitialPosition | ||
| 603 | - * @param {int} diffX the X offset, default 0 | ||
| 604 | - * @param {int} diffY the Y offset, default 0 | ||
| 605 | - */ | ||
| 606 | - setInitPosition: function(diffX, diffY) { | ||
| 607 | - var el = this.getEl(); | ||
| 608 | - | ||
| 609 | - if (!this.DDM.verifyEl(el)) { | ||
| 610 | - return; | ||
| 611 | - } | ||
| 612 | - | ||
| 613 | - var dx = diffX || 0; | ||
| 614 | - var dy = diffY || 0; | ||
| 615 | - | ||
| 616 | - var p = Dom.getXY( el ); | ||
| 617 | - | ||
| 618 | - this.initPageX = p[0] - dx; | ||
| 619 | - this.initPageY = p[1] - dy; | ||
| 620 | - | ||
| 621 | - this.lastPageX = p[0]; | ||
| 622 | - this.lastPageY = p[1]; | ||
| 623 | - | ||
| 624 | - | ||
| 625 | - this.setStartPosition(p); | ||
| 626 | - }, | ||
| 627 | - | ||
| 628 | - /** | ||
| 629 | - * Sets the start position of the element. This is set when the obj | ||
| 630 | - * is initialized, the reset when a drag is started. | ||
| 631 | - * @method setStartPosition | ||
| 632 | - * @param pos current position (from previous lookup) | ||
| 633 | - * @private | ||
| 634 | - */ | ||
| 635 | - setStartPosition: function(pos) { | ||
| 636 | - var p = pos || Dom.getXY( this.getEl() ); | ||
| 637 | - this.deltaSetXY = null; | ||
| 638 | - | ||
| 639 | - this.startPageX = p[0]; | ||
| 640 | - this.startPageY = p[1]; | ||
| 641 | - }, | ||
| 642 | - | ||
| 643 | - /** | ||
| 644 | - * Add this instance to a group of related drag/drop objects. All | ||
| 645 | - * instances belong to at least one group, and can belong to as many | ||
| 646 | - * groups as needed. | ||
| 647 | - * @method addToGroup | ||
| 648 | - * @param sGroup {string} the name of the group | ||
| 649 | - */ | ||
| 650 | - addToGroup: function(sGroup) { | ||
| 651 | - this.groups[sGroup] = true; | ||
| 652 | - this.DDM.regDragDrop(this, sGroup); | ||
| 653 | - }, | ||
| 654 | - | ||
| 655 | - /** | ||
| 656 | - * Remove's this instance from the supplied interaction group | ||
| 657 | - * @method removeFromGroup | ||
| 658 | - * @param {string} sGroup The group to drop | ||
| 659 | - */ | ||
| 660 | - removeFromGroup: function(sGroup) { | ||
| 661 | - if (this.groups[sGroup]) { | ||
| 662 | - delete this.groups[sGroup]; | ||
| 663 | - } | ||
| 664 | - | ||
| 665 | - this.DDM.removeDDFromGroup(this, sGroup); | ||
| 666 | - }, | ||
| 667 | - | ||
| 668 | - /** | ||
| 669 | - * Allows you to specify that an element other than the linked element | ||
| 670 | - * will be moved with the cursor during a drag | ||
| 671 | - * @method setDragElId | ||
| 672 | - * @param id {string} the id of the element that will be used to initiate the drag | ||
| 673 | - */ | ||
| 674 | - setDragElId: function(id) { | ||
| 675 | - this.dragElId = id; | ||
| 676 | - }, | ||
| 677 | - | ||
| 678 | - /** | ||
| 679 | - * Allows you to specify a child of the linked element that should be | ||
| 680 | - * used to initiate the drag operation. An example of this would be if | ||
| 681 | - * you have a content div with text and links. Clicking anywhere in the | ||
| 682 | - * content area would normally start the drag operation. Use this method | ||
| 683 | - * to specify that an element inside of the content div is the element | ||
| 684 | - * that starts the drag operation. | ||
| 685 | - * @method setHandleElId | ||
| 686 | - * @param id {string} the id of the element that will be used to | ||
| 687 | - * initiate the drag. | ||
| 688 | - */ | ||
| 689 | - setHandleElId: function(id) { | ||
| 690 | - if (typeof id !== "string") { | ||
| 691 | - YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 692 | - id = Dom.generateId(id); | ||
| 693 | - } | ||
| 694 | - this.handleElId = id; | ||
| 695 | - this.DDM.regHandle(this.id, id); | ||
| 696 | - }, | ||
| 697 | - | ||
| 698 | - /** | ||
| 699 | - * Allows you to set an element outside of the linked element as a drag | ||
| 700 | - * handle | ||
| 701 | - * @method setOuterHandleElId | ||
| 702 | - * @param id the id of the element that will be used to initiate the drag | ||
| 703 | - */ | ||
| 704 | - setOuterHandleElId: function(id) { | ||
| 705 | - if (typeof id !== "string") { | ||
| 706 | - YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 707 | - id = Dom.generateId(id); | ||
| 708 | - } | ||
| 709 | - Event.on(id, "mousedown", | ||
| 710 | - this.handleMouseDown, this, true); | ||
| 711 | - this.setHandleElId(id); | ||
| 712 | - | ||
| 713 | - this.hasOuterHandles = true; | ||
| 714 | - }, | ||
| 715 | - | ||
| 716 | - /** | ||
| 717 | - * Remove all drag and drop hooks for this element | ||
| 718 | - * @method unreg | ||
| 719 | - */ | ||
| 720 | - unreg: function() { | ||
| 721 | - Event.removeListener(this.id, "mousedown", | ||
| 722 | - this.handleMouseDown); | ||
| 723 | - this._domRef = null; | ||
| 724 | - this.DDM._remove(this); | ||
| 725 | - }, | ||
| 726 | - | ||
| 727 | - /** | ||
| 728 | - * Returns true if this instance is locked, or the drag drop mgr is locked | ||
| 729 | - * (meaning that all drag/drop is disabled on the page.) | ||
| 730 | - * @method isLocked | ||
| 731 | - * @return {boolean} true if this obj or all drag/drop is locked, else | ||
| 732 | - * false | ||
| 733 | - */ | ||
| 734 | - isLocked: function() { | ||
| 735 | - return (this.DDM.isLocked() || this.locked); | ||
| 736 | - }, | ||
| 737 | - | ||
| 738 | - /** | ||
| 739 | - * Fired when this object is clicked | ||
| 740 | - * @method handleMouseDown | ||
| 741 | - * @param {Event} e | ||
| 742 | - * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj) | ||
| 743 | - * @private | ||
| 744 | - */ | ||
| 745 | - handleMouseDown: function(e, oDD) { | ||
| 746 | - | ||
| 747 | - var button = e.which || e.button; | ||
| 748 | - | ||
| 749 | - if (this.primaryButtonOnly && button > 1) { | ||
| 750 | - return; | ||
| 751 | - } | ||
| 752 | - | ||
| 753 | - if (this.isLocked()) { | ||
| 754 | - return; | ||
| 755 | - } | ||
| 756 | - | ||
| 757 | - this.DDM.refreshCache(this.groups); | ||
| 758 | - // var self = this; | ||
| 759 | - // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0); | ||
| 760 | - | ||
| 761 | - // Only process the event if we really clicked within the linked | ||
| 762 | - // element. The reason we make this check is that in the case that | ||
| 763 | - // another element was moved between the clicked element and the | ||
| 764 | - // cursor in the time between the mousedown and mouseup events. When | ||
| 765 | - // this happens, the element gets the next mousedown event | ||
| 766 | - // regardless of where on the screen it happened. | ||
| 767 | - var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e)); | ||
| 768 | - if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) { | ||
| 769 | - } else { | ||
| 770 | - if (this.clickValidator(e)) { | ||
| 771 | - // set the initial element position | ||
| 772 | - this.setStartPosition(); | ||
| 773 | - | ||
| 774 | - | ||
| 775 | - this.b4MouseDown(e); | ||
| 776 | - this.onMouseDown(e); | ||
| 777 | - this.DDM.handleMouseDown(e, this); | ||
| 778 | - | ||
| 779 | - this.DDM.stopEvent(e); | ||
| 780 | - } else { | ||
| 781 | - | ||
| 782 | - | ||
| 783 | - } | ||
| 784 | - } | ||
| 785 | - }, | ||
| 786 | - | ||
| 787 | - clickValidator: function(e) { | ||
| 788 | - var target = Event.getTarget(e); | ||
| 789 | - return ( this.isValidHandleChild(target) && | ||
| 790 | - (this.id == this.handleElId || | ||
| 791 | - this.DDM.handleWasClicked(target, this.id)) ); | ||
| 792 | - }, | ||
| 793 | - | ||
| 794 | - /** | ||
| 795 | - * Allows you to specify a tag name that should not start a drag operation | ||
| 796 | - * when clicked. This is designed to facilitate embedding links within a | ||
| 797 | - * drag handle that do something other than start the drag. | ||
| 798 | - * @method addInvalidHandleType | ||
| 799 | - * @param {string} tagName the type of element to exclude | ||
| 800 | - */ | ||
| 801 | - addInvalidHandleType: function(tagName) { | ||
| 802 | - var type = tagName.toUpperCase(); | ||
| 803 | - this.invalidHandleTypes[type] = type; | ||
| 804 | - }, | ||
| 805 | - | ||
| 806 | - /** | ||
| 807 | - * Lets you to specify an element id for a child of a drag handle | ||
| 808 | - * that should not initiate a drag | ||
| 809 | - * @method addInvalidHandleId | ||
| 810 | - * @param {string} id the element id of the element you wish to ignore | ||
| 811 | - */ | ||
| 812 | - addInvalidHandleId: function(id) { | ||
| 813 | - if (typeof id !== "string") { | ||
| 814 | - YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 815 | - id = Dom.generateId(id); | ||
| 816 | - } | ||
| 817 | - this.invalidHandleIds[id] = id; | ||
| 818 | - }, | ||
| 819 | - | ||
| 820 | - /** | ||
| 821 | - * Lets you specify a css class of elements that will not initiate a drag | ||
| 822 | - * @method addInvalidHandleClass | ||
| 823 | - * @param {string} cssClass the class of the elements you wish to ignore | ||
| 824 | - */ | ||
| 825 | - addInvalidHandleClass: function(cssClass) { | ||
| 826 | - this.invalidHandleClasses.push(cssClass); | ||
| 827 | - }, | ||
| 828 | - | ||
| 829 | - /** | ||
| 830 | - * Unsets an excluded tag name set by addInvalidHandleType | ||
| 831 | - * @method removeInvalidHandleType | ||
| 832 | - * @param {string} tagName the type of element to unexclude | ||
| 833 | - */ | ||
| 834 | - removeInvalidHandleType: function(tagName) { | ||
| 835 | - var type = tagName.toUpperCase(); | ||
| 836 | - // this.invalidHandleTypes[type] = null; | ||
| 837 | - delete this.invalidHandleTypes[type]; | ||
| 838 | - }, | ||
| 839 | - | ||
| 840 | - /** | ||
| 841 | - * Unsets an invalid handle id | ||
| 842 | - * @method removeInvalidHandleId | ||
| 843 | - * @param {string} id the id of the element to re-enable | ||
| 844 | - */ | ||
| 845 | - removeInvalidHandleId: function(id) { | ||
| 846 | - if (typeof id !== "string") { | ||
| 847 | - YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 848 | - id = Dom.generateId(id); | ||
| 849 | - } | ||
| 850 | - delete this.invalidHandleIds[id]; | ||
| 851 | - }, | ||
| 852 | - | ||
| 853 | - /** | ||
| 854 | - * Unsets an invalid css class | ||
| 855 | - * @method removeInvalidHandleClass | ||
| 856 | - * @param {string} cssClass the class of the element(s) you wish to | ||
| 857 | - * re-enable | ||
| 858 | - */ | ||
| 859 | - removeInvalidHandleClass: function(cssClass) { | ||
| 860 | - for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) { | ||
| 861 | - if (this.invalidHandleClasses[i] == cssClass) { | ||
| 862 | - delete this.invalidHandleClasses[i]; | ||
| 863 | - } | ||
| 864 | - } | ||
| 865 | - }, | ||
| 866 | - | ||
| 867 | - /** | ||
| 868 | - * Checks the tag exclusion list to see if this click should be ignored | ||
| 869 | - * @method isValidHandleChild | ||
| 870 | - * @param {HTMLElement} node the HTMLElement to evaluate | ||
| 871 | - * @return {boolean} true if this is a valid tag type, false if not | ||
| 872 | - */ | ||
| 873 | - isValidHandleChild: function(node) { | ||
| 874 | - | ||
| 875 | - var valid = true; | ||
| 876 | - // var n = (node.nodeName == "#text") ? node.parentNode : node; | ||
| 877 | - var nodeName; | ||
| 878 | - try { | ||
| 879 | - nodeName = node.nodeName.toUpperCase(); | ||
| 880 | - } catch(e) { | ||
| 881 | - nodeName = node.nodeName; | ||
| 882 | - } | ||
| 883 | - valid = valid && !this.invalidHandleTypes[nodeName]; | ||
| 884 | - valid = valid && !this.invalidHandleIds[node.id]; | ||
| 885 | - | ||
| 886 | - for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) { | ||
| 887 | - valid = !Dom.hasClass(node, this.invalidHandleClasses[i]); | ||
| 888 | - } | ||
| 889 | - | ||
| 890 | - if(node.className !== 'dashboard_block_handle'){ | ||
| 891 | - valid = false; | ||
| 892 | - } | ||
| 893 | - | ||
| 894 | - | ||
| 895 | - return valid; | ||
| 896 | - | ||
| 897 | - }, | ||
| 898 | - | ||
| 899 | - /** | ||
| 900 | - * Create the array of horizontal tick marks if an interval was specified | ||
| 901 | - * in setXConstraint(). | ||
| 902 | - * @method setXTicks | ||
| 903 | - * @private | ||
| 904 | - */ | ||
| 905 | - setXTicks: function(iStartX, iTickSize) { | ||
| 906 | - this.xTicks = []; | ||
| 907 | - this.xTickSize = iTickSize; | ||
| 908 | - | ||
| 909 | - var tickMap = {}; | ||
| 910 | - | ||
| 911 | - for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) { | ||
| 912 | - if (!tickMap[i]) { | ||
| 913 | - this.xTicks[this.xTicks.length] = i; | ||
| 914 | - tickMap[i] = true; | ||
| 915 | - } | ||
| 916 | - } | ||
| 917 | - | ||
| 918 | - for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) { | ||
| 919 | - if (!tickMap[i]) { | ||
| 920 | - this.xTicks[this.xTicks.length] = i; | ||
| 921 | - tickMap[i] = true; | ||
| 922 | - } | ||
| 923 | - } | ||
| 924 | - | ||
| 925 | - this.xTicks.sort(this.DDM.numericSort) ; | ||
| 926 | - }, | ||
| 927 | - | ||
| 928 | - /** | ||
| 929 | - * Create the array of vertical tick marks if an interval was specified in | ||
| 930 | - * setYConstraint(). | ||
| 931 | - * @method setYTicks | ||
| 932 | - * @private | ||
| 933 | - */ | ||
| 934 | - setYTicks: function(iStartY, iTickSize) { | ||
| 935 | - this.yTicks = []; | ||
| 936 | - this.yTickSize = iTickSize; | ||
| 937 | - | ||
| 938 | - var tickMap = {}; | ||
| 939 | - | ||
| 940 | - for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) { | ||
| 941 | - if (!tickMap[i]) { | ||
| 942 | - this.yTicks[this.yTicks.length] = i; | ||
| 943 | - tickMap[i] = true; | ||
| 944 | - } | ||
| 945 | - } | ||
| 946 | - | ||
| 947 | - for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) { | ||
| 948 | - if (!tickMap[i]) { | ||
| 949 | - this.yTicks[this.yTicks.length] = i; | ||
| 950 | - tickMap[i] = true; | ||
| 951 | - } | ||
| 952 | - } | ||
| 953 | - | ||
| 954 | - this.yTicks.sort(this.DDM.numericSort) ; | ||
| 955 | - }, | ||
| 956 | - | ||
| 957 | - /** | ||
| 958 | - * By default, the element can be dragged any place on the screen. Use | ||
| 959 | - * this method to limit the horizontal travel of the element. Pass in | ||
| 960 | - * 0,0 for the parameters if you want to lock the drag to the y axis. | ||
| 961 | - * @method setXConstraint | ||
| 962 | - * @param {int} iLeft the number of pixels the element can move to the left | ||
| 963 | - * @param {int} iRight the number of pixels the element can move to the | ||
| 964 | - * right | ||
| 965 | - * @param {int} iTickSize optional parameter for specifying that the | ||
| 966 | - * element | ||
| 967 | - * should move iTickSize pixels at a time. | ||
| 968 | - */ | ||
| 969 | - setXConstraint: function(iLeft, iRight, iTickSize) { | ||
| 970 | - this.leftConstraint = iLeft; | ||
| 971 | - this.rightConstraint = iRight; | ||
| 972 | - | ||
| 973 | - this.minX = this.initPageX - iLeft; | ||
| 974 | - this.maxX = this.initPageX + iRight; | ||
| 975 | - if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); } | ||
| 976 | - | ||
| 977 | - this.constrainX = true; | ||
| 978 | - }, | ||
| 979 | - | ||
| 980 | - /** | ||
| 981 | - * Clears any constraints applied to this instance. Also clears ticks | ||
| 982 | - * since they can't exist independent of a constraint at this time. | ||
| 983 | - * @method clearConstraints | ||
| 984 | - */ | ||
| 985 | - clearConstraints: function() { | ||
| 986 | - this.constrainX = false; | ||
| 987 | - this.constrainY = false; | ||
| 988 | - this.clearTicks(); | ||
| 989 | - }, | ||
| 990 | - | ||
| 991 | - /** | ||
| 992 | - * Clears any tick interval defined for this instance | ||
| 993 | - * @method clearTicks | ||
| 994 | - */ | ||
| 995 | - clearTicks: function() { | ||
| 996 | - this.xTicks = null; | ||
| 997 | - this.yTicks = null; | ||
| 998 | - this.xTickSize = 0; | ||
| 999 | - this.yTickSize = 0; | ||
| 1000 | - }, | ||
| 1001 | - | ||
| 1002 | - /** | ||
| 1003 | - * By default, the element can be dragged any place on the screen. Set | ||
| 1004 | - * this to limit the vertical travel of the element. Pass in 0,0 for the | ||
| 1005 | - * parameters if you want to lock the drag to the x axis. | ||
| 1006 | - * @method setYConstraint | ||
| 1007 | - * @param {int} iUp the number of pixels the element can move up | ||
| 1008 | - * @param {int} iDown the number of pixels the element can move down | ||
| 1009 | - * @param {int} iTickSize optional parameter for specifying that the | ||
| 1010 | - * element should move iTickSize pixels at a time. | ||
| 1011 | - */ | ||
| 1012 | - setYConstraint: function(iUp, iDown, iTickSize) { | ||
| 1013 | - this.topConstraint = iUp; | ||
| 1014 | - this.bottomConstraint = iDown; | ||
| 1015 | - | ||
| 1016 | - this.minY = this.initPageY - iUp; | ||
| 1017 | - this.maxY = this.initPageY + iDown; | ||
| 1018 | - if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); } | ||
| 1019 | - | ||
| 1020 | - this.constrainY = true; | ||
| 1021 | - | ||
| 1022 | - }, | ||
| 1023 | - | ||
| 1024 | - /** | ||
| 1025 | - * resetConstraints must be called if you manually reposition a dd element. | ||
| 1026 | - * @method resetConstraints | ||
| 1027 | - * @param {boolean} maintainOffset | ||
| 1028 | - */ | ||
| 1029 | - resetConstraints: function() { | ||
| 1030 | - | ||
| 1031 | - | ||
| 1032 | - // Maintain offsets if necessary | ||
| 1033 | - if (this.initPageX || this.initPageX === 0) { | ||
| 1034 | - // figure out how much this thing has moved | ||
| 1035 | - var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0; | ||
| 1036 | - var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0; | ||
| 1037 | - | ||
| 1038 | - this.setInitPosition(dx, dy); | ||
| 1039 | - | ||
| 1040 | - // This is the first time we have detected the element's position | ||
| 1041 | - } else { | ||
| 1042 | - this.setInitPosition(); | ||
| 1043 | - } | ||
| 1044 | - | ||
| 1045 | - if (this.constrainX) { | ||
| 1046 | - this.setXConstraint( this.leftConstraint, | ||
| 1047 | - this.rightConstraint, | ||
| 1048 | - this.xTickSize ); | ||
| 1049 | - } | ||
| 1050 | - | ||
| 1051 | - if (this.constrainY) { | ||
| 1052 | - this.setYConstraint( this.topConstraint, | ||
| 1053 | - this.bottomConstraint, | ||
| 1054 | - this.yTickSize ); | ||
| 1055 | - } | ||
| 1056 | - }, | ||
| 1057 | - | ||
| 1058 | - /** | ||
| 1059 | - * Normally the drag element is moved pixel by pixel, but we can specify | ||
| 1060 | - * that it move a number of pixels at a time. This method resolves the | ||
| 1061 | - * location when we have it set up like this. | ||
| 1062 | - * @method getTick | ||
| 1063 | - * @param {int} val where we want to place the object | ||
| 1064 | - * @param {int[]} tickArray sorted array of valid points | ||
| 1065 | - * @return {int} the closest tick | ||
| 1066 | - * @private | ||
| 1067 | - */ | ||
| 1068 | - getTick: function(val, tickArray) { | ||
| 1069 | - | ||
| 1070 | - if (!tickArray) { | ||
| 1071 | - // If tick interval is not defined, it is effectively 1 pixel, | ||
| 1072 | - // so we return the value passed to us. | ||
| 1073 | - return val; | ||
| 1074 | - } else if (tickArray[0] >= val) { | ||
| 1075 | - // The value is lower than the first tick, so we return the first | ||
| 1076 | - // tick. | ||
| 1077 | - return tickArray[0]; | ||
| 1078 | - } else { | ||
| 1079 | - for (var i=0, len=tickArray.length; i<len; ++i) { | ||
| 1080 | - var next = i + 1; | ||
| 1081 | - if (tickArray[next] && tickArray[next] >= val) { | ||
| 1082 | - var diff1 = val - tickArray[i]; | ||
| 1083 | - var diff2 = tickArray[next] - val; | ||
| 1084 | - return (diff2 > diff1) ? tickArray[i] : tickArray[next]; | ||
| 1085 | - } | ||
| 1086 | - } | ||
| 1087 | - | ||
| 1088 | - // The value is larger than the last tick, so we return the last | ||
| 1089 | - // tick. | ||
| 1090 | - return tickArray[tickArray.length - 1]; | ||
| 1091 | - } | ||
| 1092 | - }, | ||
| 1093 | - | ||
| 1094 | - /** | ||
| 1095 | - * toString method | ||
| 1096 | - * @method toString | ||
| 1097 | - * @return {string} string representation of the dd obj | ||
| 1098 | - */ | ||
| 1099 | - toString: function() { | ||
| 1100 | - return ("DragDrop " + this.id); | ||
| 1101 | - } | ||
| 1102 | - | ||
| 1103 | -}; | ||
| 1104 | - | ||
| 1105 | -})(); | ||
| 1106 | -/** | ||
| 1107 | - * The drag and drop utility provides a framework for building drag and drop | ||
| 1108 | - * applications. In addition to enabling drag and drop for specific elements, | ||
| 1109 | - * the drag and drop elements are tracked by the manager class, and the | ||
| 1110 | - * interactions between the various elements are tracked during the drag and | ||
| 1111 | - * the implementing code is notified about these important moments. | ||
| 1112 | - * @module dragdrop | ||
| 1113 | - * @title Drag and Drop | ||
| 1114 | - * @requires yahoo,dom,event | ||
| 1115 | - * @namespace YAHOO.util | ||
| 1116 | - */ | ||
| 1117 | - | ||
| 1118 | -// Only load the library once. Rewriting the manager class would orphan | ||
| 1119 | -// existing drag and drop instances. | ||
| 1120 | -if (!YAHOO.util.DragDropMgr) { | ||
| 1121 | - | ||
| 1122 | -/** | ||
| 1123 | - * DragDropMgr is a singleton that tracks the element interaction for | ||
| 1124 | - * all DragDrop items in the window. Generally, you will not call | ||
| 1125 | - * this class directly, but it does have helper methods that could | ||
| 1126 | - * be useful in your DragDrop implementations. | ||
| 1127 | - * @class DragDropMgr | ||
| 1128 | - * @static | ||
| 1129 | - */ | ||
| 1130 | -YAHOO.util.DragDropMgr = function() { | ||
| 1131 | - | ||
| 1132 | - var Event = YAHOO.util.Event; | ||
| 1133 | - | ||
| 1134 | - return { | ||
| 1135 | - | ||
| 1136 | - /** | ||
| 1137 | - * Two dimensional Array of registered DragDrop objects. The first | ||
| 1138 | - * dimension is the DragDrop item group, the second the DragDrop | ||
| 1139 | - * object. | ||
| 1140 | - * @property ids | ||
| 1141 | - * @type {string: string} | ||
| 1142 | - * @private | ||
| 1143 | - * @static | ||
| 1144 | - */ | ||
| 1145 | - ids: {}, | ||
| 1146 | - | ||
| 1147 | - /** | ||
| 1148 | - * Array of element ids defined as drag handles. Used to determine | ||
| 1149 | - * if the element that generated the mousedown event is actually the | ||
| 1150 | - * handle and not the html element itself. | ||
| 1151 | - * @property handleIds | ||
| 1152 | - * @type {string: string} | ||
| 1153 | - * @private | ||
| 1154 | - * @static | ||
| 1155 | - */ | ||
| 1156 | - handleIds: {}, | ||
| 1157 | - | ||
| 1158 | - /** | ||
| 1159 | - * the DragDrop object that is currently being dragged | ||
| 1160 | - * @property dragCurrent | ||
| 1161 | - * @type DragDrop | ||
| 1162 | - * @private | ||
| 1163 | - * @static | ||
| 1164 | - **/ | ||
| 1165 | - dragCurrent: null, | ||
| 1166 | - | ||
| 1167 | - /** | ||
| 1168 | - * the DragDrop object(s) that are being hovered over | ||
| 1169 | - * @property dragOvers | ||
| 1170 | - * @type Array | ||
| 1171 | - * @private | ||
| 1172 | - * @static | ||
| 1173 | - */ | ||
| 1174 | - dragOvers: {}, | ||
| 1175 | - | ||
| 1176 | - /** | ||
| 1177 | - * the X distance between the cursor and the object being dragged | ||
| 1178 | - * @property deltaX | ||
| 1179 | - * @type int | ||
| 1180 | - * @private | ||
| 1181 | - * @static | ||
| 1182 | - */ | ||
| 1183 | - deltaX: 0, | ||
| 1184 | - | ||
| 1185 | - /** | ||
| 1186 | - * the Y distance between the cursor and the object being dragged | ||
| 1187 | - * @property deltaY | ||
| 1188 | - * @type int | ||
| 1189 | - * @private | ||
| 1190 | - * @static | ||
| 1191 | - */ | ||
| 1192 | - deltaY: 0, | ||
| 1193 | - | ||
| 1194 | - /** | ||
| 1195 | - * Flag to determine if we should prevent the default behavior of the | ||
| 1196 | - * events we define. By default this is true, but this can be set to | ||
| 1197 | - * false if you need the default behavior (not recommended) | ||
| 1198 | - * @property preventDefault | ||
| 1199 | - * @type boolean | ||
| 1200 | - * @static | ||
| 1201 | - */ | ||
| 1202 | - preventDefault: true, | ||
| 1203 | - | ||
| 1204 | - /** | ||
| 1205 | - * Flag to determine if we should stop the propagation of the events | ||
| 1206 | - * we generate. This is true by default but you may want to set it to | ||
| 1207 | - * false if the html element contains other features that require the | ||
| 1208 | - * mouse click. | ||
| 1209 | - * @property stopPropagation | ||
| 1210 | - * @type boolean | ||
| 1211 | - * @static | ||
| 1212 | - */ | ||
| 1213 | - stopPropagation: true, | ||
| 1214 | - | ||
| 1215 | - /** | ||
| 1216 | - * Internal flag that is set to true when drag and drop has been | ||
| 1217 | - * intialized | ||
| 1218 | - * @property initialized | ||
| 1219 | - * @private | ||
| 1220 | - * @static | ||
| 1221 | - */ | ||
| 1222 | - initalized: false, | ||
| 1223 | - | ||
| 1224 | - /** | ||
| 1225 | - * All drag and drop can be disabled. | ||
| 1226 | - * @property locked | ||
| 1227 | - * @private | ||
| 1228 | - * @static | ||
| 1229 | - */ | ||
| 1230 | - locked: false, | ||
| 1231 | - | ||
| 1232 | - /** | ||
| 1233 | - * Called the first time an element is registered. | ||
| 1234 | - * @method init | ||
| 1235 | - * @private | ||
| 1236 | - * @static | ||
| 1237 | - */ | ||
| 1238 | - init: function() { | ||
| 1239 | - this.initialized = true; | ||
| 1240 | - }, | ||
| 1241 | - | ||
| 1242 | - /** | ||
| 1243 | - * In point mode, drag and drop interaction is defined by the | ||
| 1244 | - * location of the cursor during the drag/drop | ||
| 1245 | - * @property POINT | ||
| 1246 | - * @type int | ||
| 1247 | - * @static | ||
| 1248 | - */ | ||
| 1249 | - POINT: 0, | ||
| 1250 | - | ||
| 1251 | - /** | ||
| 1252 | - * In intersect mode, drag and drop interactio nis defined by the | ||
| 1253 | - * overlap of two or more drag and drop objects. | ||
| 1254 | - * @property INTERSECT | ||
| 1255 | - * @type int | ||
| 1256 | - * @static | ||
| 1257 | - */ | ||
| 1258 | - INTERSECT: 1, | ||
| 1259 | - | ||
| 1260 | - /** | ||
| 1261 | - * The current drag and drop mode. Default: POINT | ||
| 1262 | - * @property mode | ||
| 1263 | - * @type int | ||
| 1264 | - * @static | ||
| 1265 | - */ | ||
| 1266 | - mode: 0, | ||
| 1267 | - | ||
| 1268 | - /** | ||
| 1269 | - * Runs method on all drag and drop objects | ||
| 1270 | - * @method _execOnAll | ||
| 1271 | - * @private | ||
| 1272 | - * @static | ||
| 1273 | - */ | ||
| 1274 | - _execOnAll: function(sMethod, args) { | ||
| 1275 | - for (var i in this.ids) { | ||
| 1276 | - for (var j in this.ids[i]) { | ||
| 1277 | - var oDD = this.ids[i][j]; | ||
| 1278 | - if (! this.isTypeOfDD(oDD)) { | ||
| 1279 | - continue; | ||
| 1280 | - } | ||
| 1281 | - oDD[sMethod].apply(oDD, args); | ||
| 1282 | - } | ||
| 1283 | - } | ||
| 1284 | - }, | ||
| 1285 | - | ||
| 1286 | - /** | ||
| 1287 | - * Drag and drop initialization. Sets up the global event handlers | ||
| 1288 | - * @method _onLoad | ||
| 1289 | - * @private | ||
| 1290 | - * @static | ||
| 1291 | - */ | ||
| 1292 | - _onLoad: function() { | ||
| 1293 | - | ||
| 1294 | - this.init(); | ||
| 1295 | - | ||
| 1296 | - | ||
| 1297 | - Event.on(document, "mouseup", this.handleMouseUp, this, true); | ||
| 1298 | - Event.on(document, "mousemove", this.handleMouseMove, this, true); | ||
| 1299 | - Event.on(window, "unload", this._onUnload, this, true); | ||
| 1300 | - Event.on(window, "resize", this._onResize, this, true); | ||
| 1301 | - // Event.on(window, "mouseout", this._test); | ||
| 1302 | - | ||
| 1303 | - }, | ||
| 1304 | - | ||
| 1305 | - /** | ||
| 1306 | - * Reset constraints on all drag and drop objs | ||
| 1307 | - * @method _onResize | ||
| 1308 | - * @private | ||
| 1309 | - * @static | ||
| 1310 | - */ | ||
| 1311 | - _onResize: function(e) { | ||
| 1312 | - this._execOnAll("resetConstraints", []); | ||
| 1313 | - }, | ||
| 1314 | - | ||
| 1315 | - /** | ||
| 1316 | - * Lock all drag and drop functionality | ||
| 1317 | - * @method lock | ||
| 1318 | - * @static | ||
| 1319 | - */ | ||
| 1320 | - lock: function() { this.locked = true; }, | ||
| 1321 | - | ||
| 1322 | - /** | ||
| 1323 | - * Unlock all drag and drop functionality | ||
| 1324 | - * @method unlock | ||
| 1325 | - * @static | ||
| 1326 | - */ | ||
| 1327 | - unlock: function() { this.locked = false; }, | ||
| 1328 | - | ||
| 1329 | - /** | ||
| 1330 | - * Is drag and drop locked? | ||
| 1331 | - * @method isLocked | ||
| 1332 | - * @return {boolean} True if drag and drop is locked, false otherwise. | ||
| 1333 | - * @static | ||
| 1334 | - */ | ||
| 1335 | - isLocked: function() { return this.locked; }, | ||
| 1336 | - | ||
| 1337 | - /** | ||
| 1338 | - * Location cache that is set for all drag drop objects when a drag is | ||
| 1339 | - * initiated, cleared when the drag is finished. | ||
| 1340 | - * @property locationCache | ||
| 1341 | - * @private | ||
| 1342 | - * @static | ||
| 1343 | - */ | ||
| 1344 | - locationCache: {}, | ||
| 1345 | - | ||
| 1346 | - /** | ||
| 1347 | - * Set useCache to false if you want to force object the lookup of each | ||
| 1348 | - * drag and drop linked element constantly during a drag. | ||
| 1349 | - * @property useCache | ||
| 1350 | - * @type boolean | ||
| 1351 | - * @static | ||
| 1352 | - */ | ||
| 1353 | - useCache: true, | ||
| 1354 | - | ||
| 1355 | - /** | ||
| 1356 | - * The number of pixels that the mouse needs to move after the | ||
| 1357 | - * mousedown before the drag is initiated. Default=3; | ||
| 1358 | - * @property clickPixelThresh | ||
| 1359 | - * @type int | ||
| 1360 | - * @static | ||
| 1361 | - */ | ||
| 1362 | - clickPixelThresh: 3, | ||
| 1363 | - | ||
| 1364 | - /** | ||
| 1365 | - * The number of milliseconds after the mousedown event to initiate the | ||
| 1366 | - * drag if we don't get a mouseup event. Default=1000 | ||
| 1367 | - * @property clickTimeThresh | ||
| 1368 | - * @type int | ||
| 1369 | - * @static | ||
| 1370 | - */ | ||
| 1371 | - clickTimeThresh: 1000, | ||
| 1372 | - | ||
| 1373 | - /** | ||
| 1374 | - * Flag that indicates that either the drag pixel threshold or the | ||
| 1375 | - * mousdown time threshold has been met | ||
| 1376 | - * @property dragThreshMet | ||
| 1377 | - * @type boolean | ||
| 1378 | - * @private | ||
| 1379 | - * @static | ||
| 1380 | - */ | ||
| 1381 | - dragThreshMet: false, | ||
| 1382 | - | ||
| 1383 | - /** | ||
| 1384 | - * Timeout used for the click time threshold | ||
| 1385 | - * @property clickTimeout | ||
| 1386 | - * @type Object | ||
| 1387 | - * @private | ||
| 1388 | - * @static | ||
| 1389 | - */ | ||
| 1390 | - clickTimeout: null, | ||
| 1391 | - | ||
| 1392 | - /** | ||
| 1393 | - * The X position of the mousedown event stored for later use when a | ||
| 1394 | - * drag threshold is met. | ||
| 1395 | - * @property startX | ||
| 1396 | - * @type int | ||
| 1397 | - * @private | ||
| 1398 | - * @static | ||
| 1399 | - */ | ||
| 1400 | - startX: 0, | ||
| 1401 | - | ||
| 1402 | - /** | ||
| 1403 | - * The Y position of the mousedown event stored for later use when a | ||
| 1404 | - * drag threshold is met. | ||
| 1405 | - * @property startY | ||
| 1406 | - * @type int | ||
| 1407 | - * @private | ||
| 1408 | - * @static | ||
| 1409 | - */ | ||
| 1410 | - startY: 0, | ||
| 1411 | - | ||
| 1412 | - /** | ||
| 1413 | - * Each DragDrop instance must be registered with the DragDropMgr. | ||
| 1414 | - * This is executed in DragDrop.init() | ||
| 1415 | - * @method regDragDrop | ||
| 1416 | - * @param {DragDrop} oDD the DragDrop object to register | ||
| 1417 | - * @param {String} sGroup the name of the group this element belongs to | ||
| 1418 | - * @static | ||
| 1419 | - */ | ||
| 1420 | - regDragDrop: function(oDD, sGroup) { | ||
| 1421 | - if (!this.initialized) { this.init(); } | ||
| 1422 | - | ||
| 1423 | - if (!this.ids[sGroup]) { | ||
| 1424 | - this.ids[sGroup] = {}; | ||
| 1425 | - } | ||
| 1426 | - this.ids[sGroup][oDD.id] = oDD; | ||
| 1427 | - }, | ||
| 1428 | - | ||
| 1429 | - /** | ||
| 1430 | - * Removes the supplied dd instance from the supplied group. Executed | ||
| 1431 | - * by DragDrop.removeFromGroup, so don't call this function directly. | ||
| 1432 | - * @method removeDDFromGroup | ||
| 1433 | - * @private | ||
| 1434 | - * @static | ||
| 1435 | - */ | ||
| 1436 | - removeDDFromGroup: function(oDD, sGroup) { | ||
| 1437 | - if (!this.ids[sGroup]) { | ||
| 1438 | - this.ids[sGroup] = {}; | ||
| 1439 | - } | ||
| 1440 | - | ||
| 1441 | - var obj = this.ids[sGroup]; | ||
| 1442 | - if (obj && obj[oDD.id]) { | ||
| 1443 | - delete obj[oDD.id]; | ||
| 1444 | - } | ||
| 1445 | - }, | ||
| 1446 | - | ||
| 1447 | - /** | ||
| 1448 | - * Unregisters a drag and drop item. This is executed in | ||
| 1449 | - * DragDrop.unreg, use that method instead of calling this directly. | ||
| 1450 | - * @method _remove | ||
| 1451 | - * @private | ||
| 1452 | - * @static | ||
| 1453 | - */ | ||
| 1454 | - _remove: function(oDD) { | ||
| 1455 | - for (var g in oDD.groups) { | ||
| 1456 | - if (g && this.ids[g][oDD.id]) { | ||
| 1457 | - delete this.ids[g][oDD.id]; | ||
| 1458 | - } | ||
| 1459 | - } | ||
| 1460 | - delete this.handleIds[oDD.id]; | ||
| 1461 | - }, | ||
| 1462 | - | ||
| 1463 | - /** | ||
| 1464 | - * Each DragDrop handle element must be registered. This is done | ||
| 1465 | - * automatically when executing DragDrop.setHandleElId() | ||
| 1466 | - * @method regHandle | ||
| 1467 | - * @param {String} sDDId the DragDrop id this element is a handle for | ||
| 1468 | - * @param {String} sHandleId the id of the element that is the drag | ||
| 1469 | - * handle | ||
| 1470 | - * @static | ||
| 1471 | - */ | ||
| 1472 | - regHandle: function(sDDId, sHandleId) { | ||
| 1473 | - if (!this.handleIds[sDDId]) { | ||
| 1474 | - this.handleIds[sDDId] = {}; | ||
| 1475 | - } | ||
| 1476 | - this.handleIds[sDDId][sHandleId] = sHandleId; | ||
| 1477 | - }, | ||
| 1478 | - | ||
| 1479 | - /** | ||
| 1480 | - * Utility function to determine if a given element has been | ||
| 1481 | - * registered as a drag drop item. | ||
| 1482 | - * @method isDragDrop | ||
| 1483 | - * @param {String} id the element id to check | ||
| 1484 | - * @return {boolean} true if this element is a DragDrop item, | ||
| 1485 | - * false otherwise | ||
| 1486 | - * @static | ||
| 1487 | - */ | ||
| 1488 | - isDragDrop: function(id) { | ||
| 1489 | - return ( this.getDDById(id) ) ? true : false; | ||
| 1490 | - }, | ||
| 1491 | - | ||
| 1492 | - /** | ||
| 1493 | - * Returns the drag and drop instances that are in all groups the | ||
| 1494 | - * passed in instance belongs to. | ||
| 1495 | - * @method getRelated | ||
| 1496 | - * @param {DragDrop} p_oDD the obj to get related data for | ||
| 1497 | - * @param {boolean} bTargetsOnly if true, only return targetable objs | ||
| 1498 | - * @return {DragDrop[]} the related instances | ||
| 1499 | - * @static | ||
| 1500 | - */ | ||
| 1501 | - getRelated: function(p_oDD, bTargetsOnly) { | ||
| 1502 | - var oDDs = []; | ||
| 1503 | - for (var i in p_oDD.groups) { | ||
| 1504 | - for (j in this.ids[i]) { | ||
| 1505 | - var dd = this.ids[i][j]; | ||
| 1506 | - if (! this.isTypeOfDD(dd)) { | ||
| 1507 | - continue; | ||
| 1508 | - } | ||
| 1509 | - if (!bTargetsOnly || dd.isTarget) { | ||
| 1510 | - oDDs[oDDs.length] = dd; | ||
| 1511 | - } | ||
| 1512 | - } | ||
| 1513 | - } | ||
| 1514 | - | ||
| 1515 | - return oDDs; | ||
| 1516 | - }, | ||
| 1517 | - | ||
| 1518 | - /** | ||
| 1519 | - * Returns true if the specified dd target is a legal target for | ||
| 1520 | - * the specifice drag obj | ||
| 1521 | - * @method isLegalTarget | ||
| 1522 | - * @param {DragDrop} the drag obj | ||
| 1523 | - * @param {DragDrop} the target | ||
| 1524 | - * @return {boolean} true if the target is a legal target for the | ||
| 1525 | - * dd obj | ||
| 1526 | - * @static | ||
| 1527 | - */ | ||
| 1528 | - isLegalTarget: function (oDD, oTargetDD) { | ||
| 1529 | - var targets = this.getRelated(oDD, true); | ||
| 1530 | - for (var i=0, len=targets.length;i<len;++i) { | ||
| 1531 | - if (targets[i].id == oTargetDD.id) { | ||
| 1532 | - return true; | ||
| 1533 | - } | ||
| 1534 | - } | ||
| 1535 | - | ||
| 1536 | - return false; | ||
| 1537 | - }, | ||
| 1538 | - | ||
| 1539 | - /** | ||
| 1540 | - * My goal is to be able to transparently determine if an object is | ||
| 1541 | - * typeof DragDrop, and the exact subclass of DragDrop. typeof | ||
| 1542 | - * returns "object", oDD.constructor.toString() always returns | ||
| 1543 | - * "DragDrop" and not the name of the subclass. So for now it just | ||
| 1544 | - * evaluates a well-known variable in DragDrop. | ||
| 1545 | - * @method isTypeOfDD | ||
| 1546 | - * @param {Object} the object to evaluate | ||
| 1547 | - * @return {boolean} true if typeof oDD = DragDrop | ||
| 1548 | - * @static | ||
| 1549 | - */ | ||
| 1550 | - isTypeOfDD: function (oDD) { | ||
| 1551 | - return (oDD && oDD.__ygDragDrop); | ||
| 1552 | - }, | ||
| 1553 | - | ||
| 1554 | - /** | ||
| 1555 | - * Utility function to determine if a given element has been | ||
| 1556 | - * registered as a drag drop handle for the given Drag Drop object. | ||
| 1557 | - * @method isHandle | ||
| 1558 | - * @param {String} id the element id to check | ||
| 1559 | - * @return {boolean} true if this element is a DragDrop handle, false | ||
| 1560 | - * otherwise | ||
| 1561 | - * @static | ||
| 1562 | - */ | ||
| 1563 | - isHandle: function(sDDId, sHandleId) { | ||
| 1564 | - return ( this.handleIds[sDDId] && | ||
| 1565 | - this.handleIds[sDDId][sHandleId] ); | ||
| 1566 | - }, | ||
| 1567 | - | ||
| 1568 | - /** | ||
| 1569 | - * Returns the DragDrop instance for a given id | ||
| 1570 | - * @method getDDById | ||
| 1571 | - * @param {String} id the id of the DragDrop object | ||
| 1572 | - * @return {DragDrop} the drag drop object, null if it is not found | ||
| 1573 | - * @static | ||
| 1574 | - */ | ||
| 1575 | - getDDById: function(id) { | ||
| 1576 | - for (var i in this.ids) { | ||
| 1577 | - if (this.ids[i][id]) { | ||
| 1578 | - return this.ids[i][id]; | ||
| 1579 | - } | ||
| 1580 | - } | ||
| 1581 | - return null; | ||
| 1582 | - }, | ||
| 1583 | - | ||
| 1584 | - /** | ||
| 1585 | - * Fired after a registered DragDrop object gets the mousedown event. | ||
| 1586 | - * Sets up the events required to track the object being dragged | ||
| 1587 | - * @method handleMouseDown | ||
| 1588 | - * @param {Event} e the event | ||
| 1589 | - * @param oDD the DragDrop object being dragged | ||
| 1590 | - * @private | ||
| 1591 | - * @static | ||
| 1592 | - */ | ||
| 1593 | - handleMouseDown: function(e, oDD) { | ||
| 1594 | - | ||
| 1595 | - this.currentTarget = YAHOO.util.Event.getTarget(e); | ||
| 1596 | - | ||
| 1597 | - this.dragCurrent = oDD; | ||
| 1598 | - | ||
| 1599 | - var el = oDD.getEl(); | ||
| 1600 | - | ||
| 1601 | - // track start position | ||
| 1602 | - this.startX = YAHOO.util.Event.getPageX(e); | ||
| 1603 | - this.startY = YAHOO.util.Event.getPageY(e); | ||
| 1604 | - | ||
| 1605 | - this.deltaX = this.startX - el.offsetLeft; | ||
| 1606 | - this.deltaY = this.startY - el.offsetTop; | ||
| 1607 | - | ||
| 1608 | - this.dragThreshMet = false; | ||
| 1609 | - | ||
| 1610 | - this.clickTimeout = setTimeout( | ||
| 1611 | - function() { | ||
| 1612 | - var DDM = YAHOO.util.DDM; | ||
| 1613 | - DDM.startDrag(DDM.startX, DDM.startY); | ||
| 1614 | - }, | ||
| 1615 | - this.clickTimeThresh ); | ||
| 1616 | - }, | ||
| 1617 | - | ||
| 1618 | - /** | ||
| 1619 | - * Fired when either the drag pixel threshol or the mousedown hold | ||
| 1620 | - * time threshold has been met. | ||
| 1621 | - * @method startDrag | ||
| 1622 | - * @param x {int} the X position of the original mousedown | ||
| 1623 | - * @param y {int} the Y position of the original mousedown | ||
| 1624 | - * @static | ||
| 1625 | - */ | ||
| 1626 | - startDrag: function(x, y) { | ||
| 1627 | - clearTimeout(this.clickTimeout); | ||
| 1628 | - if (this.dragCurrent) { | ||
| 1629 | - this.dragCurrent.b4StartDrag(x, y); | ||
| 1630 | - this.dragCurrent.startDrag(x, y); | ||
| 1631 | - } | ||
| 1632 | - this.dragThreshMet = true; | ||
| 1633 | - }, | ||
| 1634 | - | ||
| 1635 | - /** | ||
| 1636 | - * Internal function to handle the mouseup event. Will be invoked | ||
| 1637 | - * from the context of the document. | ||
| 1638 | - * @method handleMouseUp | ||
| 1639 | - * @param {Event} e the event | ||
| 1640 | - * @private | ||
| 1641 | - * @static | ||
| 1642 | - */ | ||
| 1643 | - handleMouseUp: function(e) { | ||
| 1644 | - | ||
| 1645 | - if (! this.dragCurrent) { | ||
| 1646 | - return; | ||
| 1647 | - } | ||
| 1648 | - | ||
| 1649 | - clearTimeout(this.clickTimeout); | ||
| 1650 | - | ||
| 1651 | - if (this.dragThreshMet) { | ||
| 1652 | - this.fireEvents(e, true); | ||
| 1653 | - } else { | ||
| 1654 | - } | ||
| 1655 | - | ||
| 1656 | - this.stopDrag(e); | ||
| 1657 | - | ||
| 1658 | - this.stopEvent(e); | ||
| 1659 | - }, | ||
| 1660 | - | ||
| 1661 | - /** | ||
| 1662 | - * Utility to stop event propagation and event default, if these | ||
| 1663 | - * features are turned on. | ||
| 1664 | - * @method stopEvent | ||
| 1665 | - * @param {Event} e the event as returned by this.getEvent() | ||
| 1666 | - * @static | ||
| 1667 | - */ | ||
| 1668 | - stopEvent: function(e) { | ||
| 1669 | - if (this.stopPropagation) { | ||
| 1670 | - YAHOO.util.Event.stopPropagation(e); | ||
| 1671 | - } | ||
| 1672 | - | ||
| 1673 | - if (this.preventDefault) { | ||
| 1674 | - YAHOO.util.Event.preventDefault(e); | ||
| 1675 | - } | ||
| 1676 | - }, | ||
| 1677 | - | ||
| 1678 | - /** | ||
| 1679 | - * Internal function to clean up event handlers after the drag | ||
| 1680 | - * operation is complete | ||
| 1681 | - * @method stopDrag | ||
| 1682 | - * @param {Event} e the event | ||
| 1683 | - * @private | ||
| 1684 | - * @static | ||
| 1685 | - */ | ||
| 1686 | - stopDrag: function(e) { | ||
| 1687 | - | ||
| 1688 | - // Fire the drag end event for the item that was dragged | ||
| 1689 | - if (this.dragCurrent) { | ||
| 1690 | - if (this.dragThreshMet) { | ||
| 1691 | - this.dragCurrent.b4EndDrag(e); | ||
| 1692 | - this.dragCurrent.endDrag(e); | ||
| 1693 | - } | ||
| 1694 | - | ||
| 1695 | - this.dragCurrent.onMouseUp(e); | ||
| 1696 | - } | ||
| 1697 | - | ||
| 1698 | - this.dragCurrent = null; | ||
| 1699 | - this.dragOvers = {}; | ||
| 1700 | - }, | ||
| 1701 | - | ||
| 1702 | - /** | ||
| 1703 | - * Internal function to handle the mousemove event. Will be invoked | ||
| 1704 | - * from the context of the html element. | ||
| 1705 | - * | ||
| 1706 | - * @TODO figure out what we can do about mouse events lost when the | ||
| 1707 | - * user drags objects beyond the window boundary. Currently we can | ||
| 1708 | - * detect this in internet explorer by verifying that the mouse is | ||
| 1709 | - * down during the mousemove event. Firefox doesn't give us the | ||
| 1710 | - * button state on the mousemove event. | ||
| 1711 | - * @method handleMouseMove | ||
| 1712 | - * @param {Event} e the event | ||
| 1713 | - * @private | ||
| 1714 | - * @static | ||
| 1715 | - */ | ||
| 1716 | - handleMouseMove: function(e) { | ||
| 1717 | - if (! this.dragCurrent) { | ||
| 1718 | - return true; | ||
| 1719 | - } | ||
| 1720 | - | ||
| 1721 | - // var button = e.which || e.button; | ||
| 1722 | - | ||
| 1723 | - // check for IE mouseup outside of page boundary | ||
| 1724 | - if (YAHOO.util.Event.isIE && !e.button) { | ||
| 1725 | - this.stopEvent(e); | ||
| 1726 | - return this.handleMouseUp(e); | ||
| 1727 | - } | ||
| 1728 | - | ||
| 1729 | - if (!this.dragThreshMet) { | ||
| 1730 | - var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e)); | ||
| 1731 | - var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e)); | ||
| 1732 | - if (diffX > this.clickPixelThresh || | ||
| 1733 | - diffY > this.clickPixelThresh) { | ||
| 1734 | - this.startDrag(this.startX, this.startY); | ||
| 1735 | - } | ||
| 1736 | - } | ||
| 1737 | - | ||
| 1738 | - if (this.dragThreshMet) { | ||
| 1739 | - this.dragCurrent.b4Drag(e); | ||
| 1740 | - this.dragCurrent.onDrag(e); | ||
| 1741 | - this.fireEvents(e, false); | ||
| 1742 | - } | ||
| 1743 | - | ||
| 1744 | - this.stopEvent(e); | ||
| 1745 | - | ||
| 1746 | - return true; | ||
| 1747 | - }, | ||
| 1748 | - | ||
| 1749 | - /** | ||
| 1750 | - * Iterates over all of the DragDrop elements to find ones we are | ||
| 1751 | - * hovering over or dropping on | ||
| 1752 | - * @method fireEvents | ||
| 1753 | - * @param {Event} e the event | ||
| 1754 | - * @param {boolean} isDrop is this a drop op or a mouseover op? | ||
| 1755 | - * @private | ||
| 1756 | - * @static | ||
| 1757 | - */ | ||
| 1758 | - fireEvents: function(e, isDrop) { | ||
| 1759 | - var dc = this.dragCurrent; | ||
| 1760 | - | ||
| 1761 | - // If the user did the mouse up outside of the window, we could | ||
| 1762 | - // get here even though we have ended the drag. | ||
| 1763 | - if (!dc || dc.isLocked()) { | ||
| 1764 | - return; | ||
| 1765 | - } | ||
| 1766 | - | ||
| 1767 | - var x = YAHOO.util.Event.getPageX(e); | ||
| 1768 | - var y = YAHOO.util.Event.getPageY(e); | ||
| 1769 | - var pt = new YAHOO.util.Point(x,y); | ||
| 1770 | - | ||
| 1771 | - // cache the previous dragOver array | ||
| 1772 | - var oldOvers = []; | ||
| 1773 | - | ||
| 1774 | - var outEvts = []; | ||
| 1775 | - var overEvts = []; | ||
| 1776 | - var dropEvts = []; | ||
| 1777 | - var enterEvts = []; | ||
| 1778 | - | ||
| 1779 | - // Check to see if the object(s) we were hovering over is no longer | ||
| 1780 | - // being hovered over so we can fire the onDragOut event | ||
| 1781 | - for (var i in this.dragOvers) { | ||
| 1782 | - | ||
| 1783 | - var ddo = this.dragOvers[i]; | ||
| 1784 | - | ||
| 1785 | - if (! this.isTypeOfDD(ddo)) { | ||
| 1786 | - continue; | ||
| 1787 | - } | ||
| 1788 | - | ||
| 1789 | - if (! this.isOverTarget(pt, ddo, this.mode)) { | ||
| 1790 | - outEvts.push( ddo ); | ||
| 1791 | - } | ||
| 1792 | - | ||
| 1793 | - oldOvers[i] = true; | ||
| 1794 | - delete this.dragOvers[i]; | ||
| 1795 | - } | ||
| 1796 | - | ||
| 1797 | - for (var sGroup in dc.groups) { | ||
| 1798 | - | ||
| 1799 | - if ("string" != typeof sGroup) { | ||
| 1800 | - continue; | ||
| 1801 | - } | ||
| 1802 | - | ||
| 1803 | - for (i in this.ids[sGroup]) { | ||
| 1804 | - var oDD = this.ids[sGroup][i]; | ||
| 1805 | - if (! this.isTypeOfDD(oDD)) { | ||
| 1806 | - continue; | ||
| 1807 | - } | ||
| 1808 | - | ||
| 1809 | - if (oDD.isTarget && !oDD.isLocked() && oDD != dc) { | ||
| 1810 | - if (this.isOverTarget(pt, oDD, this.mode)) { | ||
| 1811 | - // look for drop interactions | ||
| 1812 | - if (isDrop) { | ||
| 1813 | - dropEvts.push( oDD ); | ||
| 1814 | - // look for drag enter and drag over interactions | ||
| 1815 | - } else { | ||
| 1816 | - | ||
| 1817 | - // initial drag over: dragEnter fires | ||
| 1818 | - if (!oldOvers[oDD.id]) { | ||
| 1819 | - enterEvts.push( oDD ); | ||
| 1820 | - // subsequent drag overs: dragOver fires | ||
| 1821 | - } else { | ||
| 1822 | - overEvts.push( oDD ); | ||
| 1823 | - } | ||
| 1824 | - | ||
| 1825 | - this.dragOvers[oDD.id] = oDD; | ||
| 1826 | - } | ||
| 1827 | - } | ||
| 1828 | - } | ||
| 1829 | - } | ||
| 1830 | - } | ||
| 1831 | - | ||
| 1832 | - if (this.mode) { | ||
| 1833 | - if (outEvts.length) { | ||
| 1834 | - dc.b4DragOut(e, outEvts); | ||
| 1835 | - dc.onDragOut(e, outEvts); | ||
| 1836 | - } | ||
| 1837 | - | ||
| 1838 | - if (enterEvts.length) { | ||
| 1839 | - dc.onDragEnter(e, enterEvts); | ||
| 1840 | - } | ||
| 1841 | - | ||
| 1842 | - if (overEvts.length) { | ||
| 1843 | - dc.b4DragOver(e, overEvts); | ||
| 1844 | - dc.onDragOver(e, overEvts); | ||
| 1845 | - } | ||
| 1846 | - | ||
| 1847 | - if (dropEvts.length) { | ||
| 1848 | - dc.b4DragDrop(e, dropEvts); | ||
| 1849 | - dc.onDragDrop(e, dropEvts); | ||
| 1850 | - } | ||
| 1851 | - | ||
| 1852 | - } else { | ||
| 1853 | - // fire dragout events | ||
| 1854 | - var len = 0; | ||
| 1855 | - for (i=0, len=outEvts.length; i<len; ++i) { | ||
| 1856 | - dc.b4DragOut(e, outEvts[i].id); | ||
| 1857 | - dc.onDragOut(e, outEvts[i].id); | ||
| 1858 | - } | ||
| 1859 | - | ||
| 1860 | - // fire enter events | ||
| 1861 | - for (i=0,len=enterEvts.length; i<len; ++i) { | ||
| 1862 | - // dc.b4DragEnter(e, oDD.id); | ||
| 1863 | - dc.onDragEnter(e, enterEvts[i].id); | ||
| 1864 | - } | ||
| 1865 | - | ||
| 1866 | - // fire over events | ||
| 1867 | - for (i=0,len=overEvts.length; i<len; ++i) { | ||
| 1868 | - dc.b4DragOver(e, overEvts[i].id); | ||
| 1869 | - dc.onDragOver(e, overEvts[i].id); | ||
| 1870 | - } | ||
| 1871 | - | ||
| 1872 | - // fire drop events | ||
| 1873 | - for (i=0, len=dropEvts.length; i<len; ++i) { | ||
| 1874 | - dc.b4DragDrop(e, dropEvts[i].id); | ||
| 1875 | - dc.onDragDrop(e, dropEvts[i].id); | ||
| 1876 | - } | ||
| 1877 | - | ||
| 1878 | - } | ||
| 1879 | - | ||
| 1880 | - // notify about a drop that did not find a target | ||
| 1881 | - if (isDrop && !dropEvts.length) { | ||
| 1882 | - dc.onInvalidDrop(e); | ||
| 1883 | - } | ||
| 1884 | - | ||
| 1885 | - }, | ||
| 1886 | - | ||
| 1887 | - /** | ||
| 1888 | - * Helper function for getting the best match from the list of drag | ||
| 1889 | - * and drop objects returned by the drag and drop events when we are | ||
| 1890 | - * in INTERSECT mode. It returns either the first object that the | ||
| 1891 | - * cursor is over, or the object that has the greatest overlap with | ||
| 1892 | - * the dragged element. | ||
| 1893 | - * @method getBestMatch | ||
| 1894 | - * @param {DragDrop[]} dds The array of drag and drop objects | ||
| 1895 | - * targeted | ||
| 1896 | - * @return {DragDrop} The best single match | ||
| 1897 | - * @static | ||
| 1898 | - */ | ||
| 1899 | - getBestMatch: function(dds) { | ||
| 1900 | - var winner = null; | ||
| 1901 | - // Return null if the input is not what we expect | ||
| 1902 | - //if (!dds || !dds.length || dds.length == 0) { | ||
| 1903 | - // winner = null; | ||
| 1904 | - // If there is only one item, it wins | ||
| 1905 | - //} else if (dds.length == 1) { | ||
| 1906 | - | ||
| 1907 | - var len = dds.length; | ||
| 1908 | - | ||
| 1909 | - if (len == 1) { | ||
| 1910 | - winner = dds[0]; | ||
| 1911 | - } else { | ||
| 1912 | - // Loop through the targeted items | ||
| 1913 | - for (var i=0; i<len; ++i) { | ||
| 1914 | - var dd = dds[i]; | ||
| 1915 | - // If the cursor is over the object, it wins. If the | ||
| 1916 | - // cursor is over multiple matches, the first one we come | ||
| 1917 | - // to wins. | ||
| 1918 | - if (dd.cursorIsOver) { | ||
| 1919 | - winner = dd; | ||
| 1920 | - break; | ||
| 1921 | - // Otherwise the object with the most overlap wins | ||
| 1922 | - } else { | ||
| 1923 | - if (!winner || | ||
| 1924 | - winner.overlap.getArea() < dd.overlap.getArea()) { | ||
| 1925 | - winner = dd; | ||
| 1926 | - } | ||
| 1927 | - } | ||
| 1928 | - } | ||
| 1929 | - } | ||
| 1930 | - | ||
| 1931 | - return winner; | ||
| 1932 | - }, | ||
| 1933 | - | ||
| 1934 | - /** | ||
| 1935 | - * Refreshes the cache of the top-left and bottom-right points of the | ||
| 1936 | - * drag and drop objects in the specified group(s). This is in the | ||
| 1937 | - * format that is stored in the drag and drop instance, so typical | ||
| 1938 | - * usage is: | ||
| 1939 | - * <code> | ||
| 1940 | - * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups); | ||
| 1941 | - * </code> | ||
| 1942 | - * Alternatively: | ||
| 1943 | - * <code> | ||
| 1944 | - * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true}); | ||
| 1945 | - * </code> | ||
| 1946 | - * @TODO this really should be an indexed array. Alternatively this | ||
| 1947 | - * method could accept both. | ||
| 1948 | - * @method refreshCache | ||
| 1949 | - * @param {Object} groups an associative array of groups to refresh | ||
| 1950 | - * @static | ||
| 1951 | - */ | ||
| 1952 | - refreshCache: function(groups) { | ||
| 1953 | - for (var sGroup in groups) { | ||
| 1954 | - if ("string" != typeof sGroup) { | ||
| 1955 | - continue; | ||
| 1956 | - } | ||
| 1957 | - for (var i in this.ids[sGroup]) { | ||
| 1958 | - var oDD = this.ids[sGroup][i]; | ||
| 1959 | - | ||
| 1960 | - if (this.isTypeOfDD(oDD)) { | ||
| 1961 | - // if (this.isTypeOfDD(oDD) && oDD.isTarget) { | ||
| 1962 | - var loc = this.getLocation(oDD); | ||
| 1963 | - if (loc) { | ||
| 1964 | - this.locationCache[oDD.id] = loc; | ||
| 1965 | - } else { | ||
| 1966 | - delete this.locationCache[oDD.id]; | ||
| 1967 | - // this will unregister the drag and drop object if | ||
| 1968 | - // the element is not in a usable state | ||
| 1969 | - // oDD.unreg(); | ||
| 1970 | - } | ||
| 1971 | - } | ||
| 1972 | - } | ||
| 1973 | - } | ||
| 1974 | - }, | ||
| 1975 | - | ||
| 1976 | - /** | ||
| 1977 | - * This checks to make sure an element exists and is in the DOM. The | ||
| 1978 | - * main purpose is to handle cases where innerHTML is used to remove | ||
| 1979 | - * drag and drop objects from the DOM. IE provides an 'unspecified | ||
| 1980 | - * error' when trying to access the offsetParent of such an element | ||
| 1981 | - * @method verifyEl | ||
| 1982 | - * @param {HTMLElement} el the element to check | ||
| 1983 | - * @return {boolean} true if the element looks usable | ||
| 1984 | - * @static | ||
| 1985 | - */ | ||
| 1986 | - verifyEl: function(el) { | ||
| 1987 | - try { | ||
| 1988 | - if (el) { | ||
| 1989 | - var parent = el.offsetParent; | ||
| 1990 | - if (parent) { | ||
| 1991 | - return true; | ||
| 1992 | - } | ||
| 1993 | - } | ||
| 1994 | - } catch(e) { | ||
| 1995 | - } | ||
| 1996 | - | ||
| 1997 | - return false; | ||
| 1998 | - }, | ||
| 1999 | - | ||
| 2000 | - /** | ||
| 2001 | - * Returns a Region object containing the drag and drop element's position | ||
| 2002 | - * and size, including the padding configured for it | ||
| 2003 | - * @method getLocation | ||
| 2004 | - * @param {DragDrop} oDD the drag and drop object to get the | ||
| 2005 | - * location for | ||
| 2006 | - * @return {YAHOO.util.Region} a Region object representing the total area | ||
| 2007 | - * the element occupies, including any padding | ||
| 2008 | - * the instance is configured for. | ||
| 2009 | - * @static | ||
| 2010 | - */ | ||
| 2011 | - getLocation: function(oDD) { | ||
| 2012 | - if (! this.isTypeOfDD(oDD)) { | ||
| 2013 | - return null; | ||
| 2014 | - } | ||
| 2015 | - | ||
| 2016 | - var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l; | ||
| 2017 | - | ||
| 2018 | - try { | ||
| 2019 | - pos= YAHOO.util.Dom.getXY(el); | ||
| 2020 | - } catch (e) { } | ||
| 2021 | - | ||
| 2022 | - if (!pos) { | ||
| 2023 | - return null; | ||
| 2024 | - } | ||
| 2025 | - | ||
| 2026 | - x1 = pos[0]; | ||
| 2027 | - x2 = x1 + el.offsetWidth; | ||
| 2028 | - y1 = pos[1]; | ||
| 2029 | - y2 = y1 + el.offsetHeight; | ||
| 2030 | - | ||
| 2031 | - t = y1 - oDD.padding[0]; | ||
| 2032 | - r = x2 + oDD.padding[1]; | ||
| 2033 | - b = y2 + oDD.padding[2]; | ||
| 2034 | - l = x1 - oDD.padding[3]; | ||
| 2035 | - | ||
| 2036 | - return new YAHOO.util.Region( t, r, b, l ); | ||
| 2037 | - }, | ||
| 2038 | - | ||
| 2039 | - /** | ||
| 2040 | - * Checks the cursor location to see if it over the target | ||
| 2041 | - * @method isOverTarget | ||
| 2042 | - * @param {YAHOO.util.Point} pt The point to evaluate | ||
| 2043 | - * @param {DragDrop} oTarget the DragDrop object we are inspecting | ||
| 2044 | - * @return {boolean} true if the mouse is over the target | ||
| 2045 | - * @private | ||
| 2046 | - * @static | ||
| 2047 | - */ | ||
| 2048 | - isOverTarget: function(pt, oTarget, intersect) { | ||
| 2049 | - // use cache if available | ||
| 2050 | - var loc = this.locationCache[oTarget.id]; | ||
| 2051 | - if (!loc || !this.useCache) { | ||
| 2052 | - loc = this.getLocation(oTarget); | ||
| 2053 | - this.locationCache[oTarget.id] = loc; | ||
| 2054 | - | ||
| 2055 | - } | ||
| 2056 | - | ||
| 2057 | - if (!loc) { | ||
| 2058 | - return false; | ||
| 2059 | - } | ||
| 2060 | - | ||
| 2061 | - oTarget.cursorIsOver = loc.contains( pt ); | ||
| 2062 | - | ||
| 2063 | - // DragDrop is using this as a sanity check for the initial mousedown | ||
| 2064 | - // in this case we are done. In POINT mode, if the drag obj has no | ||
| 2065 | - // contraints, we are also done. Otherwise we need to evaluate the | ||
| 2066 | - // location of the target as related to the actual location of the | ||
| 2067 | - // dragged element. | ||
| 2068 | - var dc = this.dragCurrent; | ||
| 2069 | - if (!dc || !dc.getTargetCoord || | ||
| 2070 | - (!intersect && !dc.constrainX && !dc.constrainY)) { | ||
| 2071 | - return oTarget.cursorIsOver; | ||
| 2072 | - } | ||
| 2073 | - | ||
| 2074 | - oTarget.overlap = null; | ||
| 2075 | - | ||
| 2076 | - // Get the current location of the drag element, this is the | ||
| 2077 | - // location of the mouse event less the delta that represents | ||
| 2078 | - // where the original mousedown happened on the element. We | ||
| 2079 | - // need to consider constraints and ticks as well. | ||
| 2080 | - var pos = dc.getTargetCoord(pt.x, pt.y); | ||
| 2081 | - | ||
| 2082 | - var el = dc.getDragEl(); | ||
| 2083 | - var curRegion = new YAHOO.util.Region( pos.y, | ||
| 2084 | - pos.x + el.offsetWidth, | ||
| 2085 | - pos.y + el.offsetHeight, | ||
| 2086 | - pos.x ); | ||
| 2087 | - | ||
| 2088 | - var overlap = curRegion.intersect(loc); | ||
| 2089 | - | ||
| 2090 | - if (overlap) { | ||
| 2091 | - oTarget.overlap = overlap; | ||
| 2092 | - return (intersect) ? true : oTarget.cursorIsOver; | ||
| 2093 | - } else { | ||
| 2094 | - return false; | ||
| 2095 | - } | ||
| 2096 | - }, | ||
| 2097 | - | ||
| 2098 | - /** | ||
| 2099 | - * unload event handler | ||
| 2100 | - * @method _onUnload | ||
| 2101 | - * @private | ||
| 2102 | - * @static | ||
| 2103 | - */ | ||
| 2104 | - _onUnload: function(e, me) { | ||
| 2105 | - this.unregAll(); | ||
| 2106 | - }, | ||
| 2107 | - | ||
| 2108 | - /** | ||
| 2109 | - * Cleans up the drag and drop events and objects. | ||
| 2110 | - * @method unregAll | ||
| 2111 | - * @private | ||
| 2112 | - * @static | ||
| 2113 | - */ | ||
| 2114 | - unregAll: function() { | ||
| 2115 | - | ||
| 2116 | - if (this.dragCurrent) { | ||
| 2117 | - this.stopDrag(); | ||
| 2118 | - this.dragCurrent = null; | ||
| 2119 | - } | ||
| 2120 | - | ||
| 2121 | - this._execOnAll("unreg", []); | ||
| 2122 | - | ||
| 2123 | - for (i in this.elementCache) { | ||
| 2124 | - delete this.elementCache[i]; | ||
| 2125 | - } | ||
| 2126 | - | ||
| 2127 | - this.elementCache = {}; | ||
| 2128 | - this.ids = {}; | ||
| 2129 | - }, | ||
| 2130 | - | ||
| 2131 | - /** | ||
| 2132 | - * A cache of DOM elements | ||
| 2133 | - * @property elementCache | ||
| 2134 | - * @private | ||
| 2135 | - * @static | ||
| 2136 | - */ | ||
| 2137 | - elementCache: {}, | ||
| 2138 | - | ||
| 2139 | - /** | ||
| 2140 | - * Get the wrapper for the DOM element specified | ||
| 2141 | - * @method getElWrapper | ||
| 2142 | - * @param {String} id the id of the element to get | ||
| 2143 | - * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element | ||
| 2144 | - * @private | ||
| 2145 | - * @deprecated This wrapper isn't that useful | ||
| 2146 | - * @static | ||
| 2147 | - */ | ||
| 2148 | - getElWrapper: function(id) { | ||
| 2149 | - var oWrapper = this.elementCache[id]; | ||
| 2150 | - if (!oWrapper || !oWrapper.el) { | ||
| 2151 | - oWrapper = this.elementCache[id] = | ||
| 2152 | - new this.ElementWrapper(YAHOO.util.Dom.get(id)); | ||
| 2153 | - } | ||
| 2154 | - return oWrapper; | ||
| 2155 | - }, | ||
| 2156 | - | ||
| 2157 | - /** | ||
| 2158 | - * Returns the actual DOM element | ||
| 2159 | - * @method getElement | ||
| 2160 | - * @param {String} id the id of the elment to get | ||
| 2161 | - * @return {Object} The element | ||
| 2162 | - * @deprecated use YAHOO.util.Dom.get instead | ||
| 2163 | - * @static | ||
| 2164 | - */ | ||
| 2165 | - getElement: function(id) { | ||
| 2166 | - return YAHOO.util.Dom.get(id); | ||
| 2167 | - }, | ||
| 2168 | - | ||
| 2169 | - /** | ||
| 2170 | - * Returns the style property for the DOM element (i.e., | ||
| 2171 | - * document.getElById(id).style) | ||
| 2172 | - * @method getCss | ||
| 2173 | - * @param {String} id the id of the elment to get | ||
| 2174 | - * @return {Object} The style property of the element | ||
| 2175 | - * @deprecated use YAHOO.util.Dom instead | ||
| 2176 | - * @static | ||
| 2177 | - */ | ||
| 2178 | - getCss: function(id) { | ||
| 2179 | - var el = YAHOO.util.Dom.get(id); | ||
| 2180 | - return (el) ? el.style : null; | ||
| 2181 | - }, | ||
| 2182 | - | ||
| 2183 | - /** | ||
| 2184 | - * Inner class for cached elements | ||
| 2185 | - * @class DragDropMgr.ElementWrapper | ||
| 2186 | - * @for DragDropMgr | ||
| 2187 | - * @private | ||
| 2188 | - * @deprecated | ||
| 2189 | - */ | ||
| 2190 | - ElementWrapper: function(el) { | ||
| 2191 | - /** | ||
| 2192 | - * The element | ||
| 2193 | - * @property el | ||
| 2194 | - */ | ||
| 2195 | - this.el = el || null; | ||
| 2196 | - /** | ||
| 2197 | - * The element id | ||
| 2198 | - * @property id | ||
| 2199 | - */ | ||
| 2200 | - this.id = this.el && el.id; | ||
| 2201 | - /** | ||
| 2202 | - * A reference to the style property | ||
| 2203 | - * @property css | ||
| 2204 | - */ | ||
| 2205 | - this.css = this.el && el.style; | ||
| 2206 | - }, | ||
| 2207 | - | ||
| 2208 | - /** | ||
| 2209 | - * Returns the X position of an html element | ||
| 2210 | - * @method getPosX | ||
| 2211 | - * @param el the element for which to get the position | ||
| 2212 | - * @return {int} the X coordinate | ||
| 2213 | - * @for DragDropMgr | ||
| 2214 | - * @deprecated use YAHOO.util.Dom.getX instead | ||
| 2215 | - * @static | ||
| 2216 | - */ | ||
| 2217 | - getPosX: function(el) { | ||
| 2218 | - return YAHOO.util.Dom.getX(el); | ||
| 2219 | - }, | ||
| 2220 | - | ||
| 2221 | - /** | ||
| 2222 | - * Returns the Y position of an html element | ||
| 2223 | - * @method getPosY | ||
| 2224 | - * @param el the element for which to get the position | ||
| 2225 | - * @return {int} the Y coordinate | ||
| 2226 | - * @deprecated use YAHOO.util.Dom.getY instead | ||
| 2227 | - * @static | ||
| 2228 | - */ | ||
| 2229 | - getPosY: function(el) { | ||
| 2230 | - return YAHOO.util.Dom.getY(el); | ||
| 2231 | - }, | ||
| 2232 | - | ||
| 2233 | - /** | ||
| 2234 | - * Swap two nodes. In IE, we use the native method, for others we | ||
| 2235 | - * emulate the IE behavior | ||
| 2236 | - * @method swapNode | ||
| 2237 | - * @param n1 the first node to swap | ||
| 2238 | - * @param n2 the other node to swap | ||
| 2239 | - * @static | ||
| 2240 | - */ | ||
| 2241 | - swapNode: function(n1, n2) { | ||
| 2242 | - if (n1.swapNode) { | ||
| 2243 | - n1.swapNode(n2); | ||
| 2244 | - } else { | ||
| 2245 | - var p = n2.parentNode; | ||
| 2246 | - var s = n2.nextSibling; | ||
| 2247 | - | ||
| 2248 | - if (s == n1) { | ||
| 2249 | - p.insertBefore(n1, n2); | ||
| 2250 | - } else if (n2 == n1.nextSibling) { | ||
| 2251 | - p.insertBefore(n2, n1); | ||
| 2252 | - } else { | ||
| 2253 | - n1.parentNode.replaceChild(n2, n1); | ||
| 2254 | - p.insertBefore(n1, s); | ||
| 2255 | - } | ||
| 2256 | - } | ||
| 2257 | - }, | ||
| 2258 | - | ||
| 2259 | - /** | ||
| 2260 | - * Returns the current scroll position | ||
| 2261 | - * @method getScroll | ||
| 2262 | - * @private | ||
| 2263 | - * @static | ||
| 2264 | - */ | ||
| 2265 | - getScroll: function () { | ||
| 2266 | - var t, l, dde=document.documentElement, db=document.body; | ||
| 2267 | - if (dde && (dde.scrollTop || dde.scrollLeft)) { | ||
| 2268 | - t = dde.scrollTop; | ||
| 2269 | - l = dde.scrollLeft; | ||
| 2270 | - } else if (db) { | ||
| 2271 | - t = db.scrollTop; | ||
| 2272 | - l = db.scrollLeft; | ||
| 2273 | - } else { | ||
| 2274 | - YAHOO.log("could not get scroll property"); | ||
| 2275 | - } | ||
| 2276 | - return { top: t, left: l }; | ||
| 2277 | - }, | ||
| 2278 | - | ||
| 2279 | - /** | ||
| 2280 | - * Returns the specified element style property | ||
| 2281 | - * @method getStyle | ||
| 2282 | - * @param {HTMLElement} el the element | ||
| 2283 | - * @param {string} styleProp the style property | ||
| 2284 | - * @return {string} The value of the style property | ||
| 2285 | - * @deprecated use YAHOO.util.Dom.getStyle | ||
| 2286 | - * @static | ||
| 2287 | - */ | ||
| 2288 | - getStyle: function(el, styleProp) { | ||
| 2289 | - return YAHOO.util.Dom.getStyle(el, styleProp); | ||
| 2290 | - }, | ||
| 2291 | - | ||
| 2292 | - /** | ||
| 2293 | - * Gets the scrollTop | ||
| 2294 | - * @method getScrollTop | ||
| 2295 | - * @return {int} the document's scrollTop | ||
| 2296 | - * @static | ||
| 2297 | - */ | ||
| 2298 | - getScrollTop: function () { return this.getScroll().top; }, | ||
| 2299 | - | ||
| 2300 | - /** | ||
| 2301 | - * Gets the scrollLeft | ||
| 2302 | - * @method getScrollLeft | ||
| 2303 | - * @return {int} the document's scrollTop | ||
| 2304 | - * @static | ||
| 2305 | - */ | ||
| 2306 | - getScrollLeft: function () { return this.getScroll().left; }, | ||
| 2307 | - | ||
| 2308 | - /** | ||
| 2309 | - * Sets the x/y position of an element to the location of the | ||
| 2310 | - * target element. | ||
| 2311 | - * @method moveToEl | ||
| 2312 | - * @param {HTMLElement} moveEl The element to move | ||
| 2313 | - * @param {HTMLElement} targetEl The position reference element | ||
| 2314 | - * @static | ||
| 2315 | - */ | ||
| 2316 | - moveToEl: function (moveEl, targetEl) { | ||
| 2317 | - var aCoord = YAHOO.util.Dom.getXY(targetEl); | ||
| 2318 | - YAHOO.util.Dom.setXY(moveEl, aCoord); | ||
| 2319 | - }, | ||
| 2320 | - | ||
| 2321 | - /** | ||
| 2322 | - * Gets the client height | ||
| 2323 | - * @method getClientHeight | ||
| 2324 | - * @return {int} client height in px | ||
| 2325 | - * @deprecated use YAHOO.util.Dom.getViewportHeight instead | ||
| 2326 | - * @static | ||
| 2327 | - */ | ||
| 2328 | - getClientHeight: function() { | ||
| 2329 | - return YAHOO.util.Dom.getViewportHeight(); | ||
| 2330 | - }, | ||
| 2331 | - | ||
| 2332 | - /** | ||
| 2333 | - * Gets the client width | ||
| 2334 | - * @method getClientWidth | ||
| 2335 | - * @return {int} client width in px | ||
| 2336 | - * @deprecated use YAHOO.util.Dom.getViewportWidth instead | ||
| 2337 | - * @static | ||
| 2338 | - */ | ||
| 2339 | - getClientWidth: function() { | ||
| 2340 | - return YAHOO.util.Dom.getViewportWidth(); | ||
| 2341 | - }, | ||
| 2342 | - | ||
| 2343 | - /** | ||
| 2344 | - * Numeric array sort function | ||
| 2345 | - * @method numericSort | ||
| 2346 | - * @static | ||
| 2347 | - */ | ||
| 2348 | - numericSort: function(a, b) { return (a - b); }, | ||
| 2349 | - | ||
| 2350 | - /** | ||
| 2351 | - * Internal counter | ||
| 2352 | - * @property _timeoutCount | ||
| 2353 | - * @private | ||
| 2354 | - * @static | ||
| 2355 | - */ | ||
| 2356 | - _timeoutCount: 0, | ||
| 2357 | - | ||
| 2358 | - /** | ||
| 2359 | - * Trying to make the load order less important. Without this we get | ||
| 2360 | - * an error if this file is loaded before the Event Utility. | ||
| 2361 | - * @method _addListeners | ||
| 2362 | - * @private | ||
| 2363 | - * @static | ||
| 2364 | - */ | ||
| 2365 | - _addListeners: function() { | ||
| 2366 | - var DDM = YAHOO.util.DDM; | ||
| 2367 | - if ( YAHOO.util.Event && document ) { | ||
| 2368 | - DDM._onLoad(); | ||
| 2369 | - } else { | ||
| 2370 | - if (DDM._timeoutCount > 2000) { | ||
| 2371 | - } else { | ||
| 2372 | - setTimeout(DDM._addListeners, 10); | ||
| 2373 | - if (document && document.body) { | ||
| 2374 | - DDM._timeoutCount += 1; | ||
| 2375 | - } | ||
| 2376 | - } | ||
| 2377 | - } | ||
| 2378 | - }, | ||
| 2379 | - | ||
| 2380 | - /** | ||
| 2381 | - * Recursively searches the immediate parent and all child nodes for | ||
| 2382 | - * the handle element in order to determine wheter or not it was | ||
| 2383 | - * clicked. | ||
| 2384 | - * @method handleWasClicked | ||
| 2385 | - * @param node the html element to inspect | ||
| 2386 | - * @static | ||
| 2387 | - */ | ||
| 2388 | - handleWasClicked: function(node, id) { | ||
| 2389 | - if (this.isHandle(id, node.id)) { | ||
| 2390 | - return true; | ||
| 2391 | - } else { | ||
| 2392 | - // check to see if this is a text node child of the one we want | ||
| 2393 | - var p = node.parentNode; | ||
| 2394 | - | ||
| 2395 | - while (p) { | ||
| 2396 | - if (this.isHandle(id, p.id)) { | ||
| 2397 | - return true; | ||
| 2398 | - } else { | ||
| 2399 | - p = p.parentNode; | ||
| 2400 | - } | ||
| 2401 | - } | ||
| 2402 | - } | ||
| 2403 | - | ||
| 2404 | - return false; | ||
| 2405 | - } | ||
| 2406 | - | ||
| 2407 | - }; | ||
| 2408 | - | 1 | +(function(){ |
| 2 | +var _1=YAHOO.util.Event; | ||
| 3 | +var _2=YAHOO.util.Dom; | ||
| 4 | +YAHOO.util.DragDrop=function(id,_4,_5){ | ||
| 5 | +if(id){ | ||
| 6 | +this.init(id,_4,_5); | ||
| 7 | +} | ||
| 8 | +}; | ||
| 9 | +YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){ | ||
| 10 | +this.locked=true; | ||
| 11 | +},unlock:function(){ | ||
| 12 | +this.locked=false; | ||
| 13 | +},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){ | ||
| 14 | +},startDrag:function(x,y){ | ||
| 15 | +},b4Drag:function(e){ | ||
| 16 | +},onDrag:function(e){ | ||
| 17 | +},onDragEnter:function(e,id){ | ||
| 18 | +},b4DragOver:function(e){ | ||
| 19 | +},onDragOver:function(e,id){ | ||
| 20 | +},b4DragOut:function(e){ | ||
| 21 | +},onDragOut:function(e,id){ | ||
| 22 | +},b4DragDrop:function(e){ | ||
| 23 | +},onDragDrop:function(e,id){ | ||
| 24 | +},onInvalidDrop:function(e){ | ||
| 25 | +},b4EndDrag:function(e){ | ||
| 26 | +},endDrag:function(e){ | ||
| 27 | +},b4MouseDown:function(e){ | ||
| 28 | +},onMouseDown:function(e){ | ||
| 29 | +},onMouseUp:function(e){ | ||
| 30 | +},onAvailable:function(){ | ||
| 31 | +},getEl:function(){ | ||
| 32 | +if(!this._domRef){ | ||
| 33 | +this._domRef=_2.get(this.id); | ||
| 34 | +} | ||
| 35 | +return this._domRef; | ||
| 36 | +},getDragEl:function(){ | ||
| 37 | +return _2.get(this.dragElId); | ||
| 38 | +},init:function(id,_1e,_1f){ | ||
| 39 | +this.initTarget(id,_1e,_1f); | ||
| 40 | +_1.on(this.id,"mousedown",this.handleMouseDown,this,true); | ||
| 41 | +},initTarget:function(id,_21,_22){ | ||
| 42 | +this.config=_22||{}; | ||
| 43 | +this.DDM=YAHOO.util.DDM; | ||
| 44 | +this.groups={}; | ||
| 45 | +if(typeof id!=="string"){ | ||
| 46 | +YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 47 | +id=_2.generateId(id); | ||
| 48 | +} | ||
| 49 | +this.id=id; | ||
| 50 | +this.addToGroup((_21)?_21:"default"); | ||
| 51 | +this.handleElId=id; | ||
| 52 | +_1.onAvailable(id,this.handleOnAvailable,this,true); | ||
| 53 | +this.setDragElId(id); | ||
| 54 | +this.invalidHandleTypes={A:"A"}; | ||
| 55 | +this.invalidHandleIds={}; | ||
| 56 | +this.invalidHandleClasses=[]; | ||
| 57 | +this.applyConfig(); | ||
| 58 | +},applyConfig:function(){ | ||
| 59 | +this.padding=this.config.padding||[0,0,0,0]; | ||
| 60 | +this.isTarget=(this.config.isTarget!==false); | ||
| 61 | +this.maintainOffset=(this.config.maintainOffset); | ||
| 62 | +this.primaryButtonOnly=(this.config.primaryButtonOnly!==false); | ||
| 63 | +},handleOnAvailable:function(){ | ||
| 64 | +this.available=true; | ||
| 65 | +this.resetConstraints(); | ||
| 66 | +this.onAvailable(); | ||
| 67 | +},setPadding:function(_23,_24,_25,_26){ | ||
| 68 | +if(!_24&&0!==_24){ | ||
| 69 | +this.padding=[_23,_23,_23,_23]; | ||
| 70 | +}else{ | ||
| 71 | +if(!_25&&0!==_25){ | ||
| 72 | +this.padding=[_23,_24,_23,_24]; | ||
| 73 | +}else{ | ||
| 74 | +this.padding=[_23,_24,_25,_26]; | ||
| 75 | +} | ||
| 76 | +} | ||
| 77 | +},setInitPosition:function(_27,_28){ | ||
| 78 | +var el=this.getEl(); | ||
| 79 | +if(!this.DDM.verifyEl(el)){ | ||
| 80 | +return; | ||
| 81 | +} | ||
| 82 | +var dx=_27||0; | ||
| 83 | +var dy=_28||0; | ||
| 84 | +var p=_2.getXY(el); | ||
| 85 | +this.initPageX=p[0]-dx; | ||
| 86 | +this.initPageY=p[1]-dy; | ||
| 87 | +this.lastPageX=p[0]; | ||
| 88 | +this.lastPageY=p[1]; | ||
| 89 | +this.setStartPosition(p); | ||
| 90 | +},setStartPosition:function(pos){ | ||
| 91 | +var p=pos||_2.getXY(this.getEl()); | ||
| 92 | +this.deltaSetXY=null; | ||
| 93 | +this.startPageX=p[0]; | ||
| 94 | +this.startPageY=p[1]; | ||
| 95 | +},addToGroup:function(_2f){ | ||
| 96 | +this.groups[_2f]=true; | ||
| 97 | +this.DDM.regDragDrop(this,_2f); | ||
| 98 | +},removeFromGroup:function(_30){ | ||
| 99 | +if(this.groups[_30]){ | ||
| 100 | +delete this.groups[_30]; | ||
| 101 | +} | ||
| 102 | +this.DDM.removeDDFromGroup(this,_30); | ||
| 103 | +},setDragElId:function(id){ | ||
| 104 | +this.dragElId=id; | ||
| 105 | +},setHandleElId:function(id){ | ||
| 106 | +if(typeof id!=="string"){ | ||
| 107 | +YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 108 | +id=_2.generateId(id); | ||
| 109 | +} | ||
| 110 | +this.handleElId=id; | ||
| 111 | +this.DDM.regHandle(this.id,id); | ||
| 112 | +},setOuterHandleElId:function(id){ | ||
| 113 | +if(typeof id!=="string"){ | ||
| 114 | +YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 115 | +id=_2.generateId(id); | ||
| 116 | +} | ||
| 117 | +_1.on(id,"mousedown",this.handleMouseDown,this,true); | ||
| 118 | +this.setHandleElId(id); | ||
| 119 | +this.hasOuterHandles=true; | ||
| 120 | +},unreg:function(){ | ||
| 121 | +_1.removeListener(this.id,"mousedown",this.handleMouseDown); | ||
| 122 | +this._domRef=null; | ||
| 123 | +this.DDM._remove(this); | ||
| 124 | +},isLocked:function(){ | ||
| 125 | +return (this.DDM.isLocked()||this.locked); | ||
| 126 | +},handleMouseDown:function(e,oDD){ | ||
| 127 | +var _36=e.which||e.button; | ||
| 128 | +if(this.primaryButtonOnly&&_36>1){ | ||
| 129 | +return; | ||
| 130 | +} | ||
| 131 | +if(this.isLocked()){ | ||
| 132 | +return; | ||
| 133 | +} | ||
| 134 | +this.DDM.refreshCache(this.groups); | ||
| 135 | +var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e)); | ||
| 136 | +if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){ | ||
| 137 | +}else{ | ||
| 138 | +if(this.clickValidator(e)){ | ||
| 139 | +this.setStartPosition(); | ||
| 140 | +this.b4MouseDown(e); | ||
| 141 | +this.onMouseDown(e); | ||
| 142 | +this.DDM.handleMouseDown(e,this); | ||
| 143 | +this.DDM.stopEvent(e); | ||
| 144 | +}else{ | ||
| 145 | +} | ||
| 146 | +} | ||
| 147 | +},clickValidator:function(e){ | ||
| 148 | +var _39=_1.getTarget(e); | ||
| 149 | +return (this.isValidHandleChild(_39)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_39,this.id))); | ||
| 150 | +},addInvalidHandleType:function(_3a){ | ||
| 151 | +var _3b=_3a.toUpperCase(); | ||
| 152 | +this.invalidHandleTypes[_3b]=_3b; | ||
| 153 | +},addInvalidHandleId:function(id){ | ||
| 154 | +if(typeof id!=="string"){ | ||
| 155 | +YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 156 | +id=_2.generateId(id); | ||
| 157 | +} | ||
| 158 | +this.invalidHandleIds[id]=id; | ||
| 159 | +},addInvalidHandleClass:function(_3d){ | ||
| 160 | +this.invalidHandleClasses.push(_3d); | ||
| 161 | +},removeInvalidHandleType:function(_3e){ | ||
| 162 | +var _3f=_3e.toUpperCase(); | ||
| 163 | +delete this.invalidHandleTypes[_3f]; | ||
| 164 | +},removeInvalidHandleId:function(id){ | ||
| 165 | +if(typeof id!=="string"){ | ||
| 166 | +YAHOO.log("id is not a string, assuming it is an HTMLElement"); | ||
| 167 | +id=_2.generateId(id); | ||
| 168 | +} | ||
| 169 | +delete this.invalidHandleIds[id]; | ||
| 170 | +},removeInvalidHandleClass:function(_41){ | ||
| 171 | +for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){ | ||
| 172 | +if(this.invalidHandleClasses[i]==_41){ | ||
| 173 | +delete this.invalidHandleClasses[i]; | ||
| 174 | +} | ||
| 175 | +} | ||
| 176 | +},isValidHandleChild:function(_43){ | ||
| 177 | +var _44=true; | ||
| 178 | +var _45; | ||
| 179 | +try{ | ||
| 180 | +_45=_43.nodeName.toUpperCase(); | ||
| 181 | +} | ||
| 182 | +catch(e){ | ||
| 183 | +_45=_43.nodeName; | ||
| 184 | +} | ||
| 185 | +_44=_44&&!this.invalidHandleTypes[_45]; | ||
| 186 | +_44=_44&&!this.invalidHandleIds[_43.id]; | ||
| 187 | +for(var i=0,len=this.invalidHandleClasses.length;_44&&i<len;++i){ | ||
| 188 | +_44=!_2.hasClass(_43,this.invalidHandleClasses[i]); | ||
| 189 | +} | ||
| 190 | +if(_43.className!=="dashboard_block_handle"){ | ||
| 191 | +_44=false; | ||
| 192 | +} | ||
| 193 | +return _44; | ||
| 194 | +},setXTicks:function(_47,_48){ | ||
| 195 | +this.xTicks=[]; | ||
| 196 | +this.xTickSize=_48; | ||
| 197 | +var _49={}; | ||
| 198 | +for(var i=this.initPageX;i>=this.minX;i=i-_48){ | ||
| 199 | +if(!_49[i]){ | ||
| 200 | +this.xTicks[this.xTicks.length]=i; | ||
| 201 | +_49[i]=true; | ||
| 202 | +} | ||
| 203 | +} | ||
| 204 | +for(i=this.initPageX;i<=this.maxX;i=i+_48){ | ||
| 205 | +if(!_49[i]){ | ||
| 206 | +this.xTicks[this.xTicks.length]=i; | ||
| 207 | +_49[i]=true; | ||
| 208 | +} | ||
| 209 | +} | ||
| 210 | +this.xTicks.sort(this.DDM.numericSort); | ||
| 211 | +},setYTicks:function(_4b,_4c){ | ||
| 212 | +this.yTicks=[]; | ||
| 213 | +this.yTickSize=_4c; | ||
| 214 | +var _4d={}; | ||
| 215 | +for(var i=this.initPageY;i>=this.minY;i=i-_4c){ | ||
| 216 | +if(!_4d[i]){ | ||
| 217 | +this.yTicks[this.yTicks.length]=i; | ||
| 218 | +_4d[i]=true; | ||
| 219 | +} | ||
| 220 | +} | ||
| 221 | +for(i=this.initPageY;i<=this.maxY;i=i+_4c){ | ||
| 222 | +if(!_4d[i]){ | ||
| 223 | +this.yTicks[this.yTicks.length]=i; | ||
| 224 | +_4d[i]=true; | ||
| 225 | +} | ||
| 226 | +} | ||
| 227 | +this.yTicks.sort(this.DDM.numericSort); | ||
| 228 | +},setXConstraint:function(_4f,_50,_51){ | ||
| 229 | +this.leftConstraint=_4f; | ||
| 230 | +this.rightConstraint=_50; | ||
| 231 | +this.minX=this.initPageX-_4f; | ||
| 232 | +this.maxX=this.initPageX+_50; | ||
| 233 | +if(_51){ | ||
| 234 | +this.setXTicks(this.initPageX,_51); | ||
| 235 | +} | ||
| 236 | +this.constrainX=true; | ||
| 237 | +},clearConstraints:function(){ | ||
| 238 | +this.constrainX=false; | ||
| 239 | +this.constrainY=false; | ||
| 240 | +this.clearTicks(); | ||
| 241 | +},clearTicks:function(){ | ||
| 242 | +this.xTicks=null; | ||
| 243 | +this.yTicks=null; | ||
| 244 | +this.xTickSize=0; | ||
| 245 | +this.yTickSize=0; | ||
| 246 | +},setYConstraint:function(iUp,_53,_54){ | ||
| 247 | +this.topConstraint=iUp; | ||
| 248 | +this.bottomConstraint=_53; | ||
| 249 | +this.minY=this.initPageY-iUp; | ||
| 250 | +this.maxY=this.initPageY+_53; | ||
| 251 | +if(_54){ | ||
| 252 | +this.setYTicks(this.initPageY,_54); | ||
| 253 | +} | ||
| 254 | +this.constrainY=true; | ||
| 255 | +},resetConstraints:function(){ | ||
| 256 | +if(this.initPageX||this.initPageX===0){ | ||
| 257 | +var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0; | ||
| 258 | +var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0; | ||
| 259 | +this.setInitPosition(dx,dy); | ||
| 260 | +}else{ | ||
| 261 | +this.setInitPosition(); | ||
| 262 | +} | ||
| 263 | +if(this.constrainX){ | ||
| 264 | +this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize); | ||
| 265 | +} | ||
| 266 | +if(this.constrainY){ | ||
| 267 | +this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize); | ||
| 268 | +} | ||
| 269 | +},getTick:function(val,_58){ | ||
| 270 | +if(!_58){ | ||
| 271 | +return val; | ||
| 272 | +}else{ | ||
| 273 | +if(_58[0]>=val){ | ||
| 274 | +return _58[0]; | ||
| 275 | +}else{ | ||
| 276 | +for(var i=0,len=_58.length;i<len;++i){ | ||
| 277 | +var _5a=i+1; | ||
| 278 | +if(_58[_5a]&&_58[_5a]>=val){ | ||
| 279 | +var _5b=val-_58[i]; | ||
| 280 | +var _5c=_58[_5a]-val; | ||
| 281 | +return (_5c>_5b)?_58[i]:_58[_5a]; | ||
| 282 | +} | ||
| 283 | +} | ||
| 284 | +return _58[_58.length-1]; | ||
| 285 | +} | ||
| 286 | +} | ||
| 287 | +},toString:function(){ | ||
| 288 | +return ("DragDrop "+this.id); | ||
| 289 | +}}; | ||
| 290 | +})(); | ||
| 291 | +if(!YAHOO.util.DragDropMgr){ | ||
| 292 | +YAHOO.util.DragDropMgr=function(){ | ||
| 293 | +var _5d=YAHOO.util.Event; | ||
| 294 | +return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){ | ||
| 295 | +this.initialized=true; | ||
| 296 | +},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_5e,_5f){ | ||
| 297 | +for(var i in this.ids){ | ||
| 298 | +for(var j in this.ids[i]){ | ||
| 299 | +var oDD=this.ids[i][j]; | ||
| 300 | +if(!this.isTypeOfDD(oDD)){ | ||
| 301 | +continue; | ||
| 302 | +} | ||
| 303 | +oDD[_5e].apply(oDD,_5f); | ||
| 304 | +} | ||
| 305 | +} | ||
| 306 | +},_onLoad:function(){ | ||
| 307 | +this.init(); | ||
| 308 | +_5d.on(document,"mouseup",this.handleMouseUp,this,true); | ||
| 309 | +_5d.on(document,"mousemove",this.handleMouseMove,this,true); | ||
| 310 | +_5d.on(window,"unload",this._onUnload,this,true); | ||
| 311 | +_5d.on(window,"resize",this._onResize,this,true); | ||
| 312 | +},_onResize:function(e){ | ||
| 313 | +this._execOnAll("resetConstraints",[]); | ||
| 314 | +},lock:function(){ | ||
| 315 | +this.locked=true; | ||
| 316 | +},unlock:function(){ | ||
| 317 | +this.locked=false; | ||
| 318 | +},isLocked:function(){ | ||
| 319 | +return this.locked; | ||
| 320 | +},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_65){ | ||
| 321 | +if(!this.initialized){ | ||
| 322 | +this.init(); | ||
| 323 | +} | ||
| 324 | +if(!this.ids[_65]){ | ||
| 325 | +this.ids[_65]={}; | ||
| 326 | +} | ||
| 327 | +this.ids[_65][oDD.id]=oDD; | ||
| 328 | +},removeDDFromGroup:function(oDD,_67){ | ||
| 329 | +if(!this.ids[_67]){ | ||
| 330 | +this.ids[_67]={}; | ||
| 331 | +} | ||
| 332 | +var obj=this.ids[_67]; | ||
| 333 | +if(obj&&obj[oDD.id]){ | ||
| 334 | +delete obj[oDD.id]; | ||
| 335 | +} | ||
| 336 | +},_remove:function(oDD){ | ||
| 337 | +for(var g in oDD.groups){ | ||
| 338 | +if(g&&this.ids[g][oDD.id]){ | ||
| 339 | +delete this.ids[g][oDD.id]; | ||
| 340 | +} | ||
| 341 | +} | ||
| 342 | +delete this.handleIds[oDD.id]; | ||
| 343 | +},regHandle:function(_6b,_6c){ | ||
| 344 | +if(!this.handleIds[_6b]){ | ||
| 345 | +this.handleIds[_6b]={}; | ||
| 346 | +} | ||
| 347 | +this.handleIds[_6b][_6c]=_6c; | ||
| 348 | +},isDragDrop:function(id){ | ||
| 349 | +return (this.getDDById(id))?true:false; | ||
| 350 | +},getRelated:function(_6e,_6f){ | ||
| 351 | +var _70=[]; | ||
| 352 | +for(var i in _6e.groups){ | ||
| 353 | +for(j in this.ids[i]){ | ||
| 354 | +var dd=this.ids[i][j]; | ||
| 355 | +if(!this.isTypeOfDD(dd)){ | ||
| 356 | +continue; | ||
| 357 | +} | ||
| 358 | +if(!_6f||dd.isTarget){ | ||
| 359 | +_70[_70.length]=dd; | ||
| 360 | +} | ||
| 361 | +} | ||
| 362 | +} | ||
| 363 | +return _70; | ||
| 364 | +},isLegalTarget:function(oDD,_74){ | ||
| 365 | +var _75=this.getRelated(oDD,true); | ||
| 366 | +for(var i=0,len=_75.length;i<len;++i){ | ||
| 367 | +if(_75[i].id==_74.id){ | ||
| 368 | +return true; | ||
| 369 | +} | ||
| 370 | +} | ||
| 371 | +return false; | ||
| 372 | +},isTypeOfDD:function(oDD){ | ||
| 373 | +return (oDD&&oDD.__ygDragDrop); | ||
| 374 | +},isHandle:function(_78,_79){ | ||
| 375 | +return (this.handleIds[_78]&&this.handleIds[_78][_79]); | ||
| 376 | +},getDDById:function(id){ | ||
| 377 | +for(var i in this.ids){ | ||
| 378 | +if(this.ids[i][id]){ | ||
| 379 | +return this.ids[i][id]; | ||
| 380 | +} | ||
| 381 | +} | ||
| 382 | +return null; | ||
| 383 | +},handleMouseDown:function(e,oDD){ | ||
| 384 | +this.currentTarget=YAHOO.util.Event.getTarget(e); | ||
| 385 | +this.dragCurrent=oDD; | ||
| 386 | +var el=oDD.getEl(); | ||
| 387 | +this.startX=YAHOO.util.Event.getPageX(e); | ||
| 388 | +this.startY=YAHOO.util.Event.getPageY(e); | ||
| 389 | +this.deltaX=this.startX-el.offsetLeft; | ||
| 390 | +this.deltaY=this.startY-el.offsetTop; | ||
| 391 | +this.dragThreshMet=false; | ||
| 392 | +this.clickTimeout=setTimeout(function(){ | ||
| 393 | +var DDM=YAHOO.util.DDM; | ||
| 394 | +DDM.startDrag(DDM.startX,DDM.startY); | ||
| 395 | +},this.clickTimeThresh); | ||
| 396 | +},startDrag:function(x,y){ | ||
| 397 | +clearTimeout(this.clickTimeout); | ||
| 398 | +if(this.dragCurrent){ | ||
| 399 | +this.dragCurrent.b4StartDrag(x,y); | ||
| 400 | +this.dragCurrent.startDrag(x,y); | ||
| 401 | +} | ||
| 402 | +this.dragThreshMet=true; | ||
| 403 | +},handleMouseUp:function(e){ | ||
| 404 | +if(!this.dragCurrent){ | ||
| 405 | +return; | ||
| 406 | +} | ||
| 407 | +clearTimeout(this.clickTimeout); | ||
| 408 | +if(this.dragThreshMet){ | ||
| 409 | +this.fireEvents(e,true); | ||
| 410 | +}else{ | ||
| 411 | +} | ||
| 412 | +this.stopDrag(e); | ||
| 413 | +this.stopEvent(e); | ||
| 414 | +},stopEvent:function(e){ | ||
| 415 | +if(this.stopPropagation){ | ||
| 416 | +YAHOO.util.Event.stopPropagation(e); | ||
| 417 | +} | ||
| 418 | +if(this.preventDefault){ | ||
| 419 | +YAHOO.util.Event.preventDefault(e); | ||
| 420 | +} | ||
| 421 | +},stopDrag:function(e){ | ||
| 422 | +if(this.dragCurrent){ | ||
| 423 | +if(this.dragThreshMet){ | ||
| 424 | +this.dragCurrent.b4EndDrag(e); | ||
| 425 | +this.dragCurrent.endDrag(e); | ||
| 426 | +} | ||
| 427 | +this.dragCurrent.onMouseUp(e); | ||
| 428 | +} | ||
| 429 | +this.dragCurrent=null; | ||
| 430 | +this.dragOvers={}; | ||
| 431 | +},handleMouseMove:function(e){ | ||
| 432 | +if(!this.dragCurrent){ | ||
| 433 | +return true; | ||
| 434 | +} | ||
| 435 | +if(YAHOO.util.Event.isIE&&!e.button){ | ||
| 436 | +this.stopEvent(e); | ||
| 437 | +return this.handleMouseUp(e); | ||
| 438 | +} | ||
| 439 | +if(!this.dragThreshMet){ | ||
| 440 | +var _86=Math.abs(this.startX-YAHOO.util.Event.getPageX(e)); | ||
| 441 | +var _87=Math.abs(this.startY-YAHOO.util.Event.getPageY(e)); | ||
| 442 | +if(_86>this.clickPixelThresh||_87>this.clickPixelThresh){ | ||
| 443 | +this.startDrag(this.startX,this.startY); | ||
| 444 | +} | ||
| 445 | +} | ||
| 446 | +if(this.dragThreshMet){ | ||
| 447 | +this.dragCurrent.b4Drag(e); | ||
| 448 | +this.dragCurrent.onDrag(e); | ||
| 449 | +this.fireEvents(e,false); | ||
| 450 | +} | ||
| 451 | +this.stopEvent(e); | ||
| 452 | +return true; | ||
| 453 | +},fireEvents:function(e,_89){ | ||
| 454 | +var dc=this.dragCurrent; | ||
| 455 | +if(!dc||dc.isLocked()){ | ||
| 456 | +return; | ||
| 457 | +} | ||
| 458 | +var x=YAHOO.util.Event.getPageX(e); | ||
| 459 | +var y=YAHOO.util.Event.getPageY(e); | ||
| 460 | +var pt=new YAHOO.util.Point(x,y); | ||
| 461 | +var _8e=[]; | ||
| 462 | +var _8f=[]; | ||
| 463 | +var _90=[]; | ||
| 464 | +var _91=[]; | ||
| 465 | +var _92=[]; | ||
| 466 | +for(var i in this.dragOvers){ | ||
| 467 | +var ddo=this.dragOvers[i]; | ||
| 468 | +if(!this.isTypeOfDD(ddo)){ | ||
| 469 | +continue; | ||
| 470 | +} | ||
| 471 | +if(!this.isOverTarget(pt,ddo,this.mode)){ | ||
| 472 | +_8f.push(ddo); | ||
| 473 | +} | ||
| 474 | +_8e[i]=true; | ||
| 475 | +delete this.dragOvers[i]; | ||
| 476 | +} | ||
| 477 | +for(var _95 in dc.groups){ | ||
| 478 | +if("string"!=typeof _95){ | ||
| 479 | +continue; | ||
| 480 | +} | ||
| 481 | +for(i in this.ids[_95]){ | ||
| 482 | +var oDD=this.ids[_95][i]; | ||
| 483 | +if(!this.isTypeOfDD(oDD)){ | ||
| 484 | +continue; | ||
| 485 | +} | ||
| 486 | +if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){ | ||
| 487 | +if(this.isOverTarget(pt,oDD,this.mode)){ | ||
| 488 | +if(_89){ | ||
| 489 | +_91.push(oDD); | ||
| 490 | +}else{ | ||
| 491 | +if(!_8e[oDD.id]){ | ||
| 492 | +_92.push(oDD); | ||
| 493 | +}else{ | ||
| 494 | +_90.push(oDD); | ||
| 495 | +} | ||
| 496 | +this.dragOvers[oDD.id]=oDD; | ||
| 497 | +} | ||
| 498 | +} | ||
| 499 | +} | ||
| 500 | +} | ||
| 501 | +} | ||
| 502 | +if(this.mode){ | ||
| 503 | +if(_8f.length){ | ||
| 504 | +dc.b4DragOut(e,_8f); | ||
| 505 | +dc.onDragOut(e,_8f); | ||
| 506 | +} | ||
| 507 | +if(_92.length){ | ||
| 508 | +dc.onDragEnter(e,_92); | ||
| 509 | +} | ||
| 510 | +if(_90.length){ | ||
| 511 | +dc.b4DragOver(e,_90); | ||
| 512 | +dc.onDragOver(e,_90); | ||
| 513 | +} | ||
| 514 | +if(_91.length){ | ||
| 515 | +dc.b4DragDrop(e,_91); | ||
| 516 | +dc.onDragDrop(e,_91); | ||
| 517 | +} | ||
| 518 | +}else{ | ||
| 519 | +var len=0; | ||
| 520 | +for(i=0,len=_8f.length;i<len;++i){ | ||
| 521 | +dc.b4DragOut(e,_8f[i].id); | ||
| 522 | +dc.onDragOut(e,_8f[i].id); | ||
| 523 | +} | ||
| 524 | +for(i=0,len=_92.length;i<len;++i){ | ||
| 525 | +dc.onDragEnter(e,_92[i].id); | ||
| 526 | +} | ||
| 527 | +for(i=0,len=_90.length;i<len;++i){ | ||
| 528 | +dc.b4DragOver(e,_90[i].id); | ||
| 529 | +dc.onDragOver(e,_90[i].id); | ||
| 530 | +} | ||
| 531 | +for(i=0,len=_91.length;i<len;++i){ | ||
| 532 | +dc.b4DragDrop(e,_91[i].id); | ||
| 533 | +dc.onDragDrop(e,_91[i].id); | ||
| 534 | +} | ||
| 535 | +} | ||
| 536 | +if(_89&&!_91.length){ | ||
| 537 | +dc.onInvalidDrop(e); | ||
| 538 | +} | ||
| 539 | +},getBestMatch:function(dds){ | ||
| 540 | +var _99=null; | ||
| 541 | +var len=dds.length; | ||
| 542 | +if(len==1){ | ||
| 543 | +_99=dds[0]; | ||
| 544 | +}else{ | ||
| 545 | +for(var i=0;i<len;++i){ | ||
| 546 | +var dd=dds[i]; | ||
| 547 | +if(dd.cursorIsOver){ | ||
| 548 | +_99=dd; | ||
| 549 | +break; | ||
| 550 | +}else{ | ||
| 551 | +if(!_99||_99.overlap.getArea()<dd.overlap.getArea()){ | ||
| 552 | +_99=dd; | ||
| 553 | +} | ||
| 554 | +} | ||
| 555 | +} | ||
| 556 | +} | ||
| 557 | +return _99; | ||
| 558 | +},refreshCache:function(_9d){ | ||
| 559 | +for(var _9e in _9d){ | ||
| 560 | +if("string"!=typeof _9e){ | ||
| 561 | +continue; | ||
| 562 | +} | ||
| 563 | +for(var i in this.ids[_9e]){ | ||
| 564 | +var oDD=this.ids[_9e][i]; | ||
| 565 | +if(this.isTypeOfDD(oDD)){ | ||
| 566 | +var loc=this.getLocation(oDD); | ||
| 567 | +if(loc){ | ||
| 568 | +this.locationCache[oDD.id]=loc; | ||
| 569 | +}else{ | ||
| 570 | +delete this.locationCache[oDD.id]; | ||
| 571 | +} | ||
| 572 | +} | ||
| 573 | +} | ||
| 574 | +} | ||
| 575 | +},verifyEl:function(el){ | ||
| 576 | +try{ | ||
| 577 | +if(el){ | ||
| 578 | +var _a3=el.offsetParent; | ||
| 579 | +if(_a3){ | ||
| 580 | +return true; | ||
| 581 | +} | ||
| 582 | +} | ||
| 583 | +} | ||
| 584 | +catch(e){ | ||
| 585 | +} | ||
| 586 | +return false; | ||
| 587 | +},getLocation:function(oDD){ | ||
| 588 | +if(!this.isTypeOfDD(oDD)){ | ||
| 589 | +return null; | ||
| 590 | +} | ||
| 591 | +var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l; | ||
| 592 | +try{ | ||
| 593 | +pos=YAHOO.util.Dom.getXY(el); | ||
| 594 | +} | ||
| 595 | +catch(e){ | ||
| 596 | +} | ||
| 597 | +if(!pos){ | ||
| 598 | +return null; | ||
| 599 | +} | ||
| 600 | +x1=pos[0]; | ||
| 601 | +x2=x1+el.offsetWidth; | ||
| 602 | +y1=pos[1]; | ||
| 603 | +y2=y1+el.offsetHeight; | ||
| 604 | +t=y1-oDD.padding[0]; | ||
| 605 | +r=x2+oDD.padding[1]; | ||
| 606 | +b=y2+oDD.padding[2]; | ||
| 607 | +l=x1-oDD.padding[3]; | ||
| 608 | +return new YAHOO.util.Region(t,r,b,l); | ||
| 609 | +},isOverTarget:function(pt,_a7,_a8){ | ||
| 610 | +var loc=this.locationCache[_a7.id]; | ||
| 611 | +if(!loc||!this.useCache){ | ||
| 612 | +loc=this.getLocation(_a7); | ||
| 613 | +this.locationCache[_a7.id]=loc; | ||
| 614 | +} | ||
| 615 | +if(!loc){ | ||
| 616 | +return false; | ||
| 617 | +} | ||
| 618 | +_a7.cursorIsOver=loc.contains(pt); | ||
| 619 | +var dc=this.dragCurrent; | ||
| 620 | +if(!dc||!dc.getTargetCoord||(!_a8&&!dc.constrainX&&!dc.constrainY)){ | ||
| 621 | +return _a7.cursorIsOver; | ||
| 622 | +} | ||
| 623 | +_a7.overlap=null; | ||
| 624 | +var pos=dc.getTargetCoord(pt.x,pt.y); | ||
| 625 | +var el=dc.getDragEl(); | ||
| 626 | +var _ad=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x); | ||
| 627 | +var _ae=_ad.intersect(loc); | ||
| 628 | +if(_ae){ | ||
| 629 | +_a7.overlap=_ae; | ||
| 630 | +return (_a8)?true:_a7.cursorIsOver; | ||
| 631 | +}else{ | ||
| 632 | +return false; | ||
| 633 | +} | ||
| 634 | +},_onUnload:function(e,me){ | ||
| 635 | +this.unregAll(); | ||
| 636 | +},unregAll:function(){ | ||
| 637 | +if(this.dragCurrent){ | ||
| 638 | +this.stopDrag(); | ||
| 639 | +this.dragCurrent=null; | ||
| 640 | +} | ||
| 641 | +this._execOnAll("unreg",[]); | ||
| 642 | +for(i in this.elementCache){ | ||
| 643 | +delete this.elementCache[i]; | ||
| 644 | +} | ||
| 645 | +this.elementCache={}; | ||
| 646 | +this.ids={}; | ||
| 647 | +},elementCache:{},getElWrapper:function(id){ | ||
| 648 | +var _b2=this.elementCache[id]; | ||
| 649 | +if(!_b2||!_b2.el){ | ||
| 650 | +_b2=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id)); | ||
| 651 | +} | ||
| 652 | +return _b2; | ||
| 653 | +},getElement:function(id){ | ||
| 654 | +return YAHOO.util.Dom.get(id); | ||
| 655 | +},getCss:function(id){ | ||
| 656 | +var el=YAHOO.util.Dom.get(id); | ||
| 657 | +return (el)?el.style:null; | ||
| 658 | +},ElementWrapper:function(el){ | ||
| 659 | +this.el=el||null; | ||
| 660 | +this.id=this.el&&el.id; | ||
| 661 | +this.css=this.el&&el.style; | ||
| 662 | +},getPosX:function(el){ | ||
| 663 | +return YAHOO.util.Dom.getX(el); | ||
| 664 | +},getPosY:function(el){ | ||
| 665 | +return YAHOO.util.Dom.getY(el); | ||
| 666 | +},swapNode:function(n1,n2){ | ||
| 667 | +if(n1.swapNode){ | ||
| 668 | +n1.swapNode(n2); | ||
| 669 | +}else{ | ||
| 670 | +var p=n2.parentNode; | ||
| 671 | +var s=n2.nextSibling; | ||
| 672 | +if(s==n1){ | ||
| 673 | +p.insertBefore(n1,n2); | ||
| 674 | +}else{ | ||
| 675 | +if(n2==n1.nextSibling){ | ||
| 676 | +p.insertBefore(n2,n1); | ||
| 677 | +}else{ | ||
| 678 | +n1.parentNode.replaceChild(n2,n1); | ||
| 679 | +p.insertBefore(n1,s); | ||
| 680 | +} | ||
| 681 | +} | ||
| 682 | +} | ||
| 683 | +},getScroll:function(){ | ||
| 684 | +var t,l,dde=document.documentElement,db=document.body; | ||
| 685 | +if(dde&&(dde.scrollTop||dde.scrollLeft)){ | ||
| 686 | +t=dde.scrollTop; | ||
| 687 | +l=dde.scrollLeft; | ||
| 688 | +}else{ | ||
| 689 | +if(db){ | ||
| 690 | +t=db.scrollTop; | ||
| 691 | +l=db.scrollLeft; | ||
| 692 | +}else{ | ||
| 693 | +YAHOO.log("could not get scroll property"); | ||
| 694 | +} | ||
| 695 | +} | ||
| 696 | +return {top:t,left:l}; | ||
| 697 | +},getStyle:function(el,_bf){ | ||
| 698 | +return YAHOO.util.Dom.getStyle(el,_bf); | ||
| 699 | +},getScrollTop:function(){ | ||
| 700 | +return this.getScroll().top; | ||
| 701 | +},getScrollLeft:function(){ | ||
| 702 | +return this.getScroll().left; | ||
| 703 | +},moveToEl:function(_c0,_c1){ | ||
| 704 | +var _c2=YAHOO.util.Dom.getXY(_c1); | ||
| 705 | +YAHOO.util.Dom.setXY(_c0,_c2); | ||
| 706 | +},getClientHeight:function(){ | ||
| 707 | +return YAHOO.util.Dom.getViewportHeight(); | ||
| 708 | +},getClientWidth:function(){ | ||
| 709 | +return YAHOO.util.Dom.getViewportWidth(); | ||
| 710 | +},numericSort:function(a,b){ | ||
| 711 | +return (a-b); | ||
| 712 | +},_timeoutCount:0,_addListeners:function(){ | ||
| 713 | +var DDM=YAHOO.util.DDM; | ||
| 714 | +if(YAHOO.util.Event&&document){ | ||
| 715 | +DDM._onLoad(); | ||
| 716 | +}else{ | ||
| 717 | +if(DDM._timeoutCount>2000){ | ||
| 718 | +}else{ | ||
| 719 | +setTimeout(DDM._addListeners,10); | ||
| 720 | +if(document&&document.body){ | ||
| 721 | +DDM._timeoutCount+=1; | ||
| 722 | +} | ||
| 723 | +} | ||
| 724 | +} | ||
| 725 | +},handleWasClicked:function(_c6,id){ | ||
| 726 | +if(this.isHandle(id,_c6.id)){ | ||
| 727 | +return true; | ||
| 728 | +}else{ | ||
| 729 | +var p=_c6.parentNode; | ||
| 730 | +while(p){ | ||
| 731 | +if(this.isHandle(id,p.id)){ | ||
| 732 | +return true; | ||
| 733 | +}else{ | ||
| 734 | +p=p.parentNode; | ||
| 735 | +} | ||
| 736 | +} | ||
| 737 | +} | ||
| 738 | +return false; | ||
| 739 | +}}; | ||
| 2409 | }(); | 740 | }(); |
| 2410 | - | ||
| 2411 | -// shorter alias, save a few bytes | ||
| 2412 | -YAHOO.util.DDM = YAHOO.util.DragDropMgr; | 741 | +YAHOO.util.DDM=YAHOO.util.DragDropMgr; |
| 2413 | YAHOO.util.DDM._addListeners(); | 742 | YAHOO.util.DDM._addListeners(); |
| 2414 | - | ||
| 2415 | } | 743 | } |
| 2416 | - | ||
| 2417 | -/** | ||
| 2418 | - * A DragDrop implementation where the linked element follows the | ||
| 2419 | - * mouse cursor during a drag. | ||
| 2420 | - * @class DD | ||
| 2421 | - * @extends YAHOO.util.DragDrop | ||
| 2422 | - * @constructor | ||
| 2423 | - * @param {String} id the id of the linked element | ||
| 2424 | - * @param {String} sGroup the group of related DragDrop items | ||
| 2425 | - * @param {object} config an object containing configurable attributes | ||
| 2426 | - * Valid properties for DD: | ||
| 2427 | - * scroll | ||
| 2428 | - */ | ||
| 2429 | -YAHOO.util.DD = function(id, sGroup, config) { | ||
| 2430 | - if (id) { | ||
| 2431 | - this.init(id, sGroup, config); | ||
| 2432 | - } | 744 | +YAHOO.util.DD=function(id,_ca,_cb){ |
| 745 | +if(id){ | ||
| 746 | +this.init(id,_ca,_cb); | ||
| 747 | +} | ||
| 2433 | }; | 748 | }; |
| 2434 | - | ||
| 2435 | -YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, { | ||
| 2436 | - | ||
| 2437 | - /** | ||
| 2438 | - * When set to true, the utility automatically tries to scroll the browser | ||
| 2439 | - * window wehn a drag and drop element is dragged near the viewport boundary. | ||
| 2440 | - * Defaults to true. | ||
| 2441 | - * @property scroll | ||
| 2442 | - * @type boolean | ||
| 2443 | - */ | ||
| 2444 | - scroll: true, | ||
| 2445 | - | ||
| 2446 | - /** | ||
| 2447 | - * Sets the pointer offset to the distance between the linked element's top | ||
| 2448 | - * left corner and the location the element was clicked | ||
| 2449 | - * @method autoOffset | ||
| 2450 | - * @param {int} iPageX the X coordinate of the click | ||
| 2451 | - * @param {int} iPageY the Y coordinate of the click | ||
| 2452 | - */ | ||
| 2453 | - autoOffset: function(iPageX, iPageY) { | ||
| 2454 | - var x = iPageX - this.startPageX; | ||
| 2455 | - var y = iPageY - this.startPageY; | ||
| 2456 | - this.setDelta(x, y); | ||
| 2457 | - }, | ||
| 2458 | - | ||
| 2459 | - /** | ||
| 2460 | - * Sets the pointer offset. You can call this directly to force the | ||
| 2461 | - * offset to be in a particular location (e.g., pass in 0,0 to set it | ||
| 2462 | - * to the center of the object, as done in YAHOO.widget.Slider) | ||
| 2463 | - * @method setDelta | ||
| 2464 | - * @param {int} iDeltaX the distance from the left | ||
| 2465 | - * @param {int} iDeltaY the distance from the top | ||
| 2466 | - */ | ||
| 2467 | - setDelta: function(iDeltaX, iDeltaY) { | ||
| 2468 | - this.deltaX = iDeltaX; | ||
| 2469 | - this.deltaY = iDeltaY; | ||
| 2470 | - }, | ||
| 2471 | - | ||
| 2472 | - /** | ||
| 2473 | - * Sets the drag element to the location of the mousedown or click event, | ||
| 2474 | - * maintaining the cursor location relative to the location on the element | ||
| 2475 | - * that was clicked. Override this if you want to place the element in a | ||
| 2476 | - * location other than where the cursor is. | ||
| 2477 | - * @method setDragElPos | ||
| 2478 | - * @param {int} iPageX the X coordinate of the mousedown or drag event | ||
| 2479 | - * @param {int} iPageY the Y coordinate of the mousedown or drag event | ||
| 2480 | - */ | ||
| 2481 | - setDragElPos: function(iPageX, iPageY) { | ||
| 2482 | - // the first time we do this, we are going to check to make sure | ||
| 2483 | - // the element has css positioning | ||
| 2484 | - | ||
| 2485 | - var el = this.getDragEl(); | ||
| 2486 | - this.alignElWithMouse(el, iPageX, iPageY); | ||
| 2487 | - }, | ||
| 2488 | - | ||
| 2489 | - /** | ||
| 2490 | - * Sets the element to the location of the mousedown or click event, | ||
| 2491 | - * maintaining the cursor location relative to the location on the element | ||
| 2492 | - * that was clicked. Override this if you want to place the element in a | ||
| 2493 | - * location other than where the cursor is. | ||
| 2494 | - * @method alignElWithMouse | ||
| 2495 | - * @param {HTMLElement} el the element to move | ||
| 2496 | - * @param {int} iPageX the X coordinate of the mousedown or drag event | ||
| 2497 | - * @param {int} iPageY the Y coordinate of the mousedown or drag event | ||
| 2498 | - */ | ||
| 2499 | - alignElWithMouse: function(el, iPageX, iPageY) { | ||
| 2500 | - var oCoord = this.getTargetCoord(iPageX, iPageY); | ||
| 2501 | - | ||
| 2502 | - if (!this.deltaSetXY) { | ||
| 2503 | - var aCoord = [oCoord.x, oCoord.y]; | ||
| 2504 | - YAHOO.util.Dom.setXY(el, aCoord); | ||
| 2505 | - var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); | ||
| 2506 | - var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); | ||
| 2507 | - | ||
| 2508 | - this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ]; | ||
| 2509 | - } else { | ||
| 2510 | - YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px"); | ||
| 2511 | - YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px"); | ||
| 2512 | - } | ||
| 2513 | - | ||
| 2514 | - this.cachePosition(oCoord.x, oCoord.y); | ||
| 2515 | - this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth); | ||
| 2516 | - }, | ||
| 2517 | - | ||
| 2518 | - /** | ||
| 2519 | - * Saves the most recent position so that we can reset the constraints and | ||
| 2520 | - * tick marks on-demand. We need to know this so that we can calculate the | ||
| 2521 | - * number of pixels the element is offset from its original position. | ||
| 2522 | - * @method cachePosition | ||
| 2523 | - * @param iPageX the current x position (optional, this just makes it so we | ||
| 2524 | - * don't have to look it up again) | ||
| 2525 | - * @param iPageY the current y position (optional, this just makes it so we | ||
| 2526 | - * don't have to look it up again) | ||
| 2527 | - */ | ||
| 2528 | - cachePosition: function(iPageX, iPageY) { | ||
| 2529 | - if (iPageX) { | ||
| 2530 | - this.lastPageX = iPageX; | ||
| 2531 | - this.lastPageY = iPageY; | ||
| 2532 | - } else { | ||
| 2533 | - var aCoord = YAHOO.util.Dom.getXY(this.getEl()); | ||
| 2534 | - this.lastPageX = aCoord[0]; | ||
| 2535 | - this.lastPageY = aCoord[1]; | ||
| 2536 | - } | ||
| 2537 | - }, | ||
| 2538 | - | ||
| 2539 | - /** | ||
| 2540 | - * Auto-scroll the window if the dragged object has been moved beyond the | ||
| 2541 | - * visible window boundary. | ||
| 2542 | - * @method autoScroll | ||
| 2543 | - * @param {int} x the drag element's x position | ||
| 2544 | - * @param {int} y the drag element's y position | ||
| 2545 | - * @param {int} h the height of the drag element | ||
| 2546 | - * @param {int} w the width of the drag element | ||
| 2547 | - * @private | ||
| 2548 | - */ | ||
| 2549 | - autoScroll: function(x, y, h, w) { | ||
| 2550 | - | ||
| 2551 | - if (this.scroll) { | ||
| 2552 | - // The client height | ||
| 2553 | - var clientH = this.DDM.getClientHeight(); | ||
| 2554 | - | ||
| 2555 | - // The client width | ||
| 2556 | - var clientW = this.DDM.getClientWidth(); | ||
| 2557 | - | ||
| 2558 | - // The amt scrolled down | ||
| 2559 | - var st = this.DDM.getScrollTop(); | ||
| 2560 | - | ||
| 2561 | - // The amt scrolled right | ||
| 2562 | - var sl = this.DDM.getScrollLeft(); | ||
| 2563 | - | ||
| 2564 | - // Location of the bottom of the element | ||
| 2565 | - var bot = h + y; | ||
| 2566 | - | ||
| 2567 | - // Location of the right of the element | ||
| 2568 | - var right = w + x; | ||
| 2569 | - | ||
| 2570 | - // The distance from the cursor to the bottom of the visible area, | ||
| 2571 | - // adjusted so that we don't scroll if the cursor is beyond the | ||
| 2572 | - // element drag constraints | ||
| 2573 | - var toBot = (clientH + st - y - this.deltaY); | ||
| 2574 | - | ||
| 2575 | - // The distance from the cursor to the right of the visible area | ||
| 2576 | - var toRight = (clientW + sl - x - this.deltaX); | ||
| 2577 | - | ||
| 2578 | - | ||
| 2579 | - // How close to the edge the cursor must be before we scroll | ||
| 2580 | - // var thresh = (document.all) ? 100 : 40; | ||
| 2581 | - var thresh = 40; | ||
| 2582 | - | ||
| 2583 | - // How many pixels to scroll per autoscroll op. This helps to reduce | ||
| 2584 | - // clunky scrolling. IE is more sensitive about this ... it needs this | ||
| 2585 | - // value to be higher. | ||
| 2586 | - var scrAmt = (document.all) ? 80 : 30; | ||
| 2587 | - | ||
| 2588 | - // Scroll down if we are near the bottom of the visible page and the | ||
| 2589 | - // obj extends below the crease | ||
| 2590 | - if ( bot > clientH && toBot < thresh ) { | ||
| 2591 | - window.scrollTo(sl, st + scrAmt); | ||
| 2592 | - } | ||
| 2593 | - | ||
| 2594 | - // Scroll up if the window is scrolled down and the top of the object | ||
| 2595 | - // goes above the top border | ||
| 2596 | - if ( y < st && st > 0 && y - st < thresh ) { | ||
| 2597 | - window.scrollTo(sl, st - scrAmt); | ||
| 2598 | - } | ||
| 2599 | - | ||
| 2600 | - // Scroll right if the obj is beyond the right border and the cursor is | ||
| 2601 | - // near the border. | ||
| 2602 | - if ( right > clientW && toRight < thresh ) { | ||
| 2603 | - window.scrollTo(sl + scrAmt, st); | ||
| 2604 | - } | ||
| 2605 | - | ||
| 2606 | - // Scroll left if the window has been scrolled to the right and the obj | ||
| 2607 | - // extends past the left border | ||
| 2608 | - if ( x < sl && sl > 0 && x - sl < thresh ) { | ||
| 2609 | - window.scrollTo(sl - scrAmt, st); | ||
| 2610 | - } | ||
| 2611 | - } | ||
| 2612 | - }, | ||
| 2613 | - | ||
| 2614 | - /** | ||
| 2615 | - * Finds the location the element should be placed if we want to move | ||
| 2616 | - * it to where the mouse location less the click offset would place us. | ||
| 2617 | - * @method getTargetCoord | ||
| 2618 | - * @param {int} iPageX the X coordinate of the click | ||
| 2619 | - * @param {int} iPageY the Y coordinate of the click | ||
| 2620 | - * @return an object that contains the coordinates (Object.x and Object.y) | ||
| 2621 | - * @private | ||
| 2622 | - */ | ||
| 2623 | - getTargetCoord: function(iPageX, iPageY) { | ||
| 2624 | - | ||
| 2625 | - | ||
| 2626 | - var x = iPageX - this.deltaX; | ||
| 2627 | - var y = iPageY - this.deltaY; | ||
| 2628 | - | ||
| 2629 | - if (this.constrainX) { | ||
| 2630 | - if (x < this.minX) { x = this.minX; } | ||
| 2631 | - if (x > this.maxX) { x = this.maxX; } | ||
| 2632 | - } | ||
| 2633 | - | ||
| 2634 | - if (this.constrainY) { | ||
| 2635 | - if (y < this.minY) { y = this.minY; } | ||
| 2636 | - if (y > this.maxY) { y = this.maxY; } | ||
| 2637 | - } | ||
| 2638 | - | ||
| 2639 | - x = this.getTick(x, this.xTicks); | ||
| 2640 | - y = this.getTick(y, this.yTicks); | ||
| 2641 | - | ||
| 2642 | - | ||
| 2643 | - return {x:x, y:y}; | ||
| 2644 | - }, | ||
| 2645 | - | ||
| 2646 | - /* | ||
| 2647 | - * Sets up config options specific to this class. Overrides | ||
| 2648 | - * YAHOO.util.DragDrop, but all versions of this method through the | ||
| 2649 | - * inheritance chain are called | ||
| 2650 | - */ | ||
| 2651 | - applyConfig: function() { | ||
| 2652 | - YAHOO.util.DD.superclass.applyConfig.call(this); | ||
| 2653 | - this.scroll = (this.config.scroll !== false); | ||
| 2654 | - }, | ||
| 2655 | - | ||
| 2656 | - /* | ||
| 2657 | - * Event that fires prior to the onMouseDown event. Overrides | ||
| 2658 | - * YAHOO.util.DragDrop. | ||
| 2659 | - */ | ||
| 2660 | - b4MouseDown: function(e) { | ||
| 2661 | - // this.resetConstraints(); | ||
| 2662 | - this.autoOffset(YAHOO.util.Event.getPageX(e), | ||
| 2663 | - YAHOO.util.Event.getPageY(e)); | ||
| 2664 | - }, | ||
| 2665 | - | ||
| 2666 | - /* | ||
| 2667 | - * Event that fires prior to the onDrag event. Overrides | ||
| 2668 | - * YAHOO.util.DragDrop. | ||
| 2669 | - */ | ||
| 2670 | - b4Drag: function(e) { | ||
| 2671 | - this.setDragElPos(YAHOO.util.Event.getPageX(e), | ||
| 2672 | - YAHOO.util.Event.getPageY(e)); | ||
| 2673 | - }, | ||
| 2674 | - | ||
| 2675 | - toString: function() { | ||
| 2676 | - return ("DD " + this.id); | ||
| 2677 | - } | ||
| 2678 | - | ||
| 2679 | - ////////////////////////////////////////////////////////////////////////// | ||
| 2680 | - // Debugging ygDragDrop events that can be overridden | ||
| 2681 | - ////////////////////////////////////////////////////////////////////////// | ||
| 2682 | - /* | ||
| 2683 | - startDrag: function(x, y) { | ||
| 2684 | - }, | ||
| 2685 | - | ||
| 2686 | - onDrag: function(e) { | ||
| 2687 | - }, | ||
| 2688 | - | ||
| 2689 | - onDragEnter: function(e, id) { | ||
| 2690 | - }, | ||
| 2691 | - | ||
| 2692 | - onDragOver: function(e, id) { | ||
| 2693 | - }, | ||
| 2694 | - | ||
| 2695 | - onDragOut: function(e, id) { | ||
| 2696 | - }, | ||
| 2697 | - | ||
| 2698 | - onDragDrop: function(e, id) { | ||
| 2699 | - }, | ||
| 2700 | - | ||
| 2701 | - endDrag: function(e) { | ||
| 2702 | - } | ||
| 2703 | - | ||
| 2704 | - */ | ||
| 2705 | - | ||
| 2706 | -}); | ||
| 2707 | -/** | ||
| 2708 | - * A DragDrop implementation that inserts an empty, bordered div into | ||
| 2709 | - * the document that follows the cursor during drag operations. At the time of | ||
| 2710 | - * the click, the frame div is resized to the dimensions of the linked html | ||
| 2711 | - * element, and moved to the exact location of the linked element. | ||
| 2712 | - * | ||
| 2713 | - * References to the "frame" element refer to the single proxy element that | ||
| 2714 | - * was created to be dragged in place of all DDProxy elements on the | ||
| 2715 | - * page. | ||
| 2716 | - * | ||
| 2717 | - * @class DDProxy | ||
| 2718 | - * @extends YAHOO.util.DD | ||
| 2719 | - * @constructor | ||
| 2720 | - * @param {String} id the id of the linked html element | ||
| 2721 | - * @param {String} sGroup the group of related DragDrop objects | ||
| 2722 | - * @param {object} config an object containing configurable attributes | ||
| 2723 | - * Valid properties for DDProxy in addition to those in DragDrop: | ||
| 2724 | - * resizeFrame, centerFrame, dragElId | ||
| 2725 | - */ | ||
| 2726 | -YAHOO.util.DDProxy = function(id, sGroup, config) { | ||
| 2727 | - if (id) { | ||
| 2728 | - this.init(id, sGroup, config); | ||
| 2729 | - this.initFrame(); | ||
| 2730 | - } | 749 | +YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_cc,_cd){ |
| 750 | +var x=_cc-this.startPageX; | ||
| 751 | +var y=_cd-this.startPageY; | ||
| 752 | +this.setDelta(x,y); | ||
| 753 | +},setDelta:function(_d0,_d1){ | ||
| 754 | +this.deltaX=_d0; | ||
| 755 | +this.deltaY=_d1; | ||
| 756 | +},setDragElPos:function(_d2,_d3){ | ||
| 757 | +var el=this.getDragEl(); | ||
| 758 | +this.alignElWithMouse(el,_d2,_d3); | ||
| 759 | +},alignElWithMouse:function(el,_d6,_d7){ | ||
| 760 | +var _d8=this.getTargetCoord(_d6,_d7); | ||
| 761 | +if(!this.deltaSetXY){ | ||
| 762 | +var _d9=[_d8.x,_d8.y]; | ||
| 763 | +YAHOO.util.Dom.setXY(el,_d9); | ||
| 764 | +var _da=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10); | ||
| 765 | +var _db=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10); | ||
| 766 | +this.deltaSetXY=[_da-_d8.x,_db-_d8.y]; | ||
| 767 | +}else{ | ||
| 768 | +YAHOO.util.Dom.setStyle(el,"left",(_d8.x+this.deltaSetXY[0])+"px"); | ||
| 769 | +YAHOO.util.Dom.setStyle(el,"top",(_d8.y+this.deltaSetXY[1])+"px"); | ||
| 770 | +} | ||
| 771 | +this.cachePosition(_d8.x,_d8.y); | ||
| 772 | +this.autoScroll(_d8.x,_d8.y,el.offsetHeight,el.offsetWidth); | ||
| 773 | +},cachePosition:function(_dc,_dd){ | ||
| 774 | +if(_dc){ | ||
| 775 | +this.lastPageX=_dc; | ||
| 776 | +this.lastPageY=_dd; | ||
| 777 | +}else{ | ||
| 778 | +var _de=YAHOO.util.Dom.getXY(this.getEl()); | ||
| 779 | +this.lastPageX=_de[0]; | ||
| 780 | +this.lastPageY=_de[1]; | ||
| 781 | +} | ||
| 782 | +},autoScroll:function(x,y,h,w){ | ||
| 783 | +if(this.scroll){ | ||
| 784 | +var _e3=this.DDM.getClientHeight(); | ||
| 785 | +var _e4=this.DDM.getClientWidth(); | ||
| 786 | +var st=this.DDM.getScrollTop(); | ||
| 787 | +var sl=this.DDM.getScrollLeft(); | ||
| 788 | +var bot=h+y; | ||
| 789 | +var _e8=w+x; | ||
| 790 | +var _e9=(_e3+st-y-this.deltaY); | ||
| 791 | +var _ea=(_e4+sl-x-this.deltaX); | ||
| 792 | +var _eb=40; | ||
| 793 | +var _ec=(document.all)?80:30; | ||
| 794 | +if(bot>_e3&&_e9<_eb){ | ||
| 795 | +window.scrollTo(sl,st+_ec); | ||
| 796 | +} | ||
| 797 | +if(y<st&&st>0&&y-st<_eb){ | ||
| 798 | +window.scrollTo(sl,st-_ec); | ||
| 799 | +} | ||
| 800 | +if(_e8>_e4&&_ea<_eb){ | ||
| 801 | +window.scrollTo(sl+_ec,st); | ||
| 802 | +} | ||
| 803 | +if(x<sl&&sl>0&&x-sl<_eb){ | ||
| 804 | +window.scrollTo(sl-_ec,st); | ||
| 805 | +} | ||
| 806 | +} | ||
| 807 | +},getTargetCoord:function(_ed,_ee){ | ||
| 808 | +var x=_ed-this.deltaX; | ||
| 809 | +var y=_ee-this.deltaY; | ||
| 810 | +if(this.constrainX){ | ||
| 811 | +if(x<this.minX){ | ||
| 812 | +x=this.minX; | ||
| 813 | +} | ||
| 814 | +if(x>this.maxX){ | ||
| 815 | +x=this.maxX; | ||
| 816 | +} | ||
| 817 | +} | ||
| 818 | +if(this.constrainY){ | ||
| 819 | +if(y<this.minY){ | ||
| 820 | +y=this.minY; | ||
| 821 | +} | ||
| 822 | +if(y>this.maxY){ | ||
| 823 | +y=this.maxY; | ||
| 824 | +} | ||
| 825 | +} | ||
| 826 | +x=this.getTick(x,this.xTicks); | ||
| 827 | +y=this.getTick(y,this.yTicks); | ||
| 828 | +return {x:x,y:y}; | ||
| 829 | +},applyConfig:function(){ | ||
| 830 | +YAHOO.util.DD.superclass.applyConfig.call(this); | ||
| 831 | +this.scroll=(this.config.scroll!==false); | ||
| 832 | +},b4MouseDown:function(e){ | ||
| 833 | +this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e)); | ||
| 834 | +},b4Drag:function(e){ | ||
| 835 | +this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e)); | ||
| 836 | +},toString:function(){ | ||
| 837 | +return ("DD "+this.id); | ||
| 838 | +}}); | ||
| 839 | +YAHOO.util.DDProxy=function(id,_f4,_f5){ | ||
| 840 | +if(id){ | ||
| 841 | +this.init(id,_f4,_f5); | ||
| 842 | +this.initFrame(); | ||
| 843 | +} | ||
| 2731 | }; | 844 | }; |
| 2732 | - | ||
| 2733 | -/** | ||
| 2734 | - * The default drag frame div id | ||
| 2735 | - * @property YAHOO.util.DDProxy.dragElId | ||
| 2736 | - * @type String | ||
| 2737 | - * @static | ||
| 2738 | - */ | ||
| 2739 | -YAHOO.util.DDProxy.dragElId = "ygddfdiv"; | ||
| 2740 | - | ||
| 2741 | -YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, { | ||
| 2742 | - | ||
| 2743 | - /** | ||
| 2744 | - * By default we resize the drag frame to be the same size as the element | ||
| 2745 | - * we want to drag (this is to get the frame effect). We can turn it off | ||
| 2746 | - * if we want a different behavior. | ||
| 2747 | - * @property resizeFrame | ||
| 2748 | - * @type boolean | ||
| 2749 | - */ | ||
| 2750 | - resizeFrame: true, | ||
| 2751 | - | ||
| 2752 | - /** | ||
| 2753 | - * By default the frame is positioned exactly where the drag element is, so | ||
| 2754 | - * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if | ||
| 2755 | - * you do not have constraints on the obj is to have the drag frame centered | ||
| 2756 | - * around the cursor. Set centerFrame to true for this effect. | ||
| 2757 | - * @property centerFrame | ||
| 2758 | - * @type boolean | ||
| 2759 | - */ | ||
| 2760 | - centerFrame: false, | ||
| 2761 | - | ||
| 2762 | - /** | ||
| 2763 | - * Creates the proxy element if it does not yet exist | ||
| 2764 | - * @method createFrame | ||
| 2765 | - */ | ||
| 2766 | - createFrame: function() { | ||
| 2767 | - var self = this; | ||
| 2768 | - var body = document.body; | ||
| 2769 | - | ||
| 2770 | - if (!body || !body.firstChild) { | ||
| 2771 | - setTimeout( function() { self.createFrame(); }, 50 ); | ||
| 2772 | - return; | ||
| 2773 | - } | ||
| 2774 | - | ||
| 2775 | - var div = this.getDragEl(); | ||
| 2776 | - | ||
| 2777 | - if (!div) { | ||
| 2778 | - div = document.createElement("div"); | ||
| 2779 | - div.id = this.dragElId; | ||
| 2780 | - var s = div.style; | ||
| 2781 | - | ||
| 2782 | - s.position = "absolute"; | ||
| 2783 | - s.visibility = "hidden"; | ||
| 2784 | - s.cursor = "move"; | ||
| 2785 | - s.border = "2px solid #aaa"; | ||
| 2786 | - s.zIndex = 999; | ||
| 2787 | - | ||
| 2788 | - // appendChild can blow up IE if invoked prior to the window load event | ||
| 2789 | - // while rendering a table. It is possible there are other scenarios | ||
| 2790 | - // that would cause this to happen as well. | ||
| 2791 | - body.insertBefore(div, body.firstChild); | ||
| 2792 | - } | ||
| 2793 | - }, | ||
| 2794 | - | ||
| 2795 | - /** | ||
| 2796 | - * Initialization for the drag frame element. Must be called in the | ||
| 2797 | - * constructor of all subclasses | ||
| 2798 | - * @method initFrame | ||
| 2799 | - */ | ||
| 2800 | - initFrame: function() { | ||
| 2801 | - this.createFrame(); | ||
| 2802 | - }, | ||
| 2803 | - | ||
| 2804 | - applyConfig: function() { | ||
| 2805 | - YAHOO.util.DDProxy.superclass.applyConfig.call(this); | ||
| 2806 | - | ||
| 2807 | - this.resizeFrame = (this.config.resizeFrame !== false); | ||
| 2808 | - this.centerFrame = (this.config.centerFrame); | ||
| 2809 | - this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId); | ||
| 2810 | - }, | ||
| 2811 | - | ||
| 2812 | - /** | ||
| 2813 | - * Resizes the drag frame to the dimensions of the clicked object, positions | ||
| 2814 | - * it over the object, and finally displays it | ||
| 2815 | - * @method showFrame | ||
| 2816 | - * @param {int} iPageX X click position | ||
| 2817 | - * @param {int} iPageY Y click position | ||
| 2818 | - * @private | ||
| 2819 | - */ | ||
| 2820 | - showFrame: function(iPageX, iPageY) { | ||
| 2821 | - var el = this.getEl(); | ||
| 2822 | - var dragEl = this.getDragEl(); | ||
| 2823 | - var s = dragEl.style; | ||
| 2824 | - | ||
| 2825 | - this._resizeProxy(); | ||
| 2826 | - | ||
| 2827 | - if (this.centerFrame) { | ||
| 2828 | - this.setDelta( Math.round(parseInt(s.width, 10)/2), | ||
| 2829 | - Math.round(parseInt(s.height, 10)/2) ); | ||
| 2830 | - } | ||
| 2831 | - | ||
| 2832 | - this.setDragElPos(iPageX, iPageY); | ||
| 2833 | - | ||
| 2834 | - YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); | ||
| 2835 | - }, | ||
| 2836 | - | ||
| 2837 | - /** | ||
| 2838 | - * The proxy is automatically resized to the dimensions of the linked | ||
| 2839 | - * element when a drag is initiated, unless resizeFrame is set to false | ||
| 2840 | - * @method _resizeProxy | ||
| 2841 | - * @private | ||
| 2842 | - */ | ||
| 2843 | - _resizeProxy: function() { | ||
| 2844 | - if (this.resizeFrame) { | ||
| 2845 | - var DOM = YAHOO.util.Dom; | ||
| 2846 | - var el = this.getEl(); | ||
| 2847 | - var dragEl = this.getDragEl(); | ||
| 2848 | - | ||
| 2849 | - var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10); | ||
| 2850 | - var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10); | ||
| 2851 | - var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10); | ||
| 2852 | - var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10); | ||
| 2853 | - | ||
| 2854 | - if (isNaN(bt)) { bt = 0; } | ||
| 2855 | - if (isNaN(br)) { br = 0; } | ||
| 2856 | - if (isNaN(bb)) { bb = 0; } | ||
| 2857 | - if (isNaN(bl)) { bl = 0; } | ||
| 2858 | - | ||
| 2859 | - | ||
| 2860 | - var newWidth = Math.max(0, el.offsetWidth - br - bl); | ||
| 2861 | - var newHeight = Math.max(0, el.offsetHeight - bt - bb); | ||
| 2862 | - | ||
| 2863 | - | ||
| 2864 | - DOM.setStyle( dragEl, "width", newWidth + "px" ); | ||
| 2865 | - DOM.setStyle( dragEl, "height", newHeight + "px" ); | ||
| 2866 | - } | ||
| 2867 | - }, | ||
| 2868 | - | ||
| 2869 | - // overrides YAHOO.util.DragDrop | ||
| 2870 | - b4MouseDown: function(e) { | ||
| 2871 | - var x = YAHOO.util.Event.getPageX(e); | ||
| 2872 | - var y = YAHOO.util.Event.getPageY(e); | ||
| 2873 | - this.autoOffset(x, y); | ||
| 2874 | - this.setDragElPos(x, y); | ||
| 2875 | - }, | ||
| 2876 | - | ||
| 2877 | - // overrides YAHOO.util.DragDrop | ||
| 2878 | - b4StartDrag: function(x, y) { | ||
| 2879 | - // show the drag frame | ||
| 2880 | - this.showFrame(x, y); | ||
| 2881 | - }, | ||
| 2882 | - | ||
| 2883 | - // overrides YAHOO.util.DragDrop | ||
| 2884 | - b4EndDrag: function(e) { | ||
| 2885 | - YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); | ||
| 2886 | - }, | ||
| 2887 | - | ||
| 2888 | - // overrides YAHOO.util.DragDrop | ||
| 2889 | - // By default we try to move the element to the last location of the frame. | ||
| 2890 | - // This is so that the default behavior mirrors that of YAHOO.util.DD. | ||
| 2891 | - endDrag: function(e) { | ||
| 2892 | - var DOM = YAHOO.util.Dom; | ||
| 2893 | - var lel = this.getEl(); | ||
| 2894 | - var del = this.getDragEl(); | ||
| 2895 | - | ||
| 2896 | - // Show the drag frame briefly so we can get its position | ||
| 2897 | - // del.style.visibility = ""; | ||
| 2898 | - DOM.setStyle(del, "visibility", ""); | ||
| 2899 | - | ||
| 2900 | - // Hide the linked element before the move to get around a Safari | ||
| 2901 | - // rendering bug. | ||
| 2902 | - //lel.style.visibility = "hidden"; | ||
| 2903 | - DOM.setStyle(lel, "visibility", "hidden"); | ||
| 2904 | - YAHOO.util.DDM.moveToEl(lel, del); | ||
| 2905 | - //del.style.visibility = "hidden"; | ||
| 2906 | - DOM.setStyle(del, "visibility", "hidden"); | ||
| 2907 | - //lel.style.visibility = ""; | ||
| 2908 | - DOM.setStyle(lel, "visibility", ""); | ||
| 2909 | - }, | ||
| 2910 | - | ||
| 2911 | - toString: function() { | ||
| 2912 | - return ("DDProxy " + this.id); | ||
| 2913 | - } | ||
| 2914 | - | ||
| 2915 | -}); | ||
| 2916 | -/** | ||
| 2917 | - * A DragDrop implementation that does not move, but can be a drop | ||
| 2918 | - * target. You would get the same result by simply omitting implementation | ||
| 2919 | - * for the event callbacks, but this way we reduce the processing cost of the | ||
| 2920 | - * event listener and the callbacks. | ||
| 2921 | - * @class DDTarget | ||
| 2922 | - * @extends YAHOO.util.DragDrop | ||
| 2923 | - * @constructor | ||
| 2924 | - * @param {String} id the id of the element that is a drop target | ||
| 2925 | - * @param {String} sGroup the group of related DragDrop objects | ||
| 2926 | - * @param {object} config an object containing configurable attributes | ||
| 2927 | - * Valid properties for DDTarget in addition to those in | ||
| 2928 | - * DragDrop: | ||
| 2929 | - * none | ||
| 2930 | - */ | ||
| 2931 | -YAHOO.util.DDTarget = function(id, sGroup, config) { | ||
| 2932 | - if (id) { | ||
| 2933 | - this.initTarget(id, sGroup, config); | ||
| 2934 | - } | 845 | +YAHOO.util.DDProxy.dragElId="ygddfdiv"; |
| 846 | +YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){ | ||
| 847 | +var _f6=this; | ||
| 848 | +var _f7=document.body; | ||
| 849 | +if(!_f7||!_f7.firstChild){ | ||
| 850 | +setTimeout(function(){ | ||
| 851 | +_f6.createFrame(); | ||
| 852 | +},50); | ||
| 853 | +return; | ||
| 854 | +} | ||
| 855 | +var div=this.getDragEl(); | ||
| 856 | +if(!div){ | ||
| 857 | +div=document.createElement("div"); | ||
| 858 | +div.id=this.dragElId; | ||
| 859 | +var s=div.style; | ||
| 860 | +s.position="absolute"; | ||
| 861 | +s.visibility="hidden"; | ||
| 862 | +s.cursor="move"; | ||
| 863 | +s.border="2px solid #aaa"; | ||
| 864 | +s.zIndex=999; | ||
| 865 | +_f7.insertBefore(div,_f7.firstChild); | ||
| 866 | +} | ||
| 867 | +},initFrame:function(){ | ||
| 868 | +this.createFrame(); | ||
| 869 | +},applyConfig:function(){ | ||
| 870 | +YAHOO.util.DDProxy.superclass.applyConfig.call(this); | ||
| 871 | +this.resizeFrame=(this.config.resizeFrame!==false); | ||
| 872 | +this.centerFrame=(this.config.centerFrame); | ||
| 873 | +this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId); | ||
| 874 | +},showFrame:function(_fa,_fb){ | ||
| 875 | +var el=this.getEl(); | ||
| 876 | +var _fd=this.getDragEl(); | ||
| 877 | +var s=_fd.style; | ||
| 878 | +this._resizeProxy(); | ||
| 879 | +if(this.centerFrame){ | ||
| 880 | +this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2)); | ||
| 881 | +} | ||
| 882 | +this.setDragElPos(_fa,_fb); | ||
| 883 | +YAHOO.util.Dom.setStyle(_fd,"visibility","visible"); | ||
| 884 | +},_resizeProxy:function(){ | ||
| 885 | +if(this.resizeFrame){ | ||
| 886 | +var DOM=YAHOO.util.Dom; | ||
| 887 | +var el=this.getEl(); | ||
| 888 | +var _101=this.getDragEl(); | ||
| 889 | +var bt=parseInt(DOM.getStyle(_101,"borderTopWidth"),10); | ||
| 890 | +var br=parseInt(DOM.getStyle(_101,"borderRightWidth"),10); | ||
| 891 | +var bb=parseInt(DOM.getStyle(_101,"borderBottomWidth"),10); | ||
| 892 | +var bl=parseInt(DOM.getStyle(_101,"borderLeftWidth"),10); | ||
| 893 | +if(isNaN(bt)){ | ||
| 894 | +bt=0; | ||
| 895 | +} | ||
| 896 | +if(isNaN(br)){ | ||
| 897 | +br=0; | ||
| 898 | +} | ||
| 899 | +if(isNaN(bb)){ | ||
| 900 | +bb=0; | ||
| 901 | +} | ||
| 902 | +if(isNaN(bl)){ | ||
| 903 | +bl=0; | ||
| 904 | +} | ||
| 905 | +var _106=Math.max(0,el.offsetWidth-br-bl); | ||
| 906 | +var _107=Math.max(0,el.offsetHeight-bt-bb); | ||
| 907 | +DOM.setStyle(_101,"width",_106+"px"); | ||
| 908 | +DOM.setStyle(_101,"height",_107+"px"); | ||
| 909 | +} | ||
| 910 | +},b4MouseDown:function(e){ | ||
| 911 | +var x=YAHOO.util.Event.getPageX(e); | ||
| 912 | +var y=YAHOO.util.Event.getPageY(e); | ||
| 913 | +this.autoOffset(x,y); | ||
| 914 | +this.setDragElPos(x,y); | ||
| 915 | +},b4StartDrag:function(x,y){ | ||
| 916 | +this.showFrame(x,y); | ||
| 917 | +},b4EndDrag:function(e){ | ||
| 918 | +YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden"); | ||
| 919 | +},endDrag:function(e){ | ||
| 920 | +var DOM=YAHOO.util.Dom; | ||
| 921 | +var lel=this.getEl(); | ||
| 922 | +var del=this.getDragEl(); | ||
| 923 | +DOM.setStyle(del,"visibility",""); | ||
| 924 | +DOM.setStyle(lel,"visibility","hidden"); | ||
| 925 | +YAHOO.util.DDM.moveToEl(lel,del); | ||
| 926 | +DOM.setStyle(del,"visibility","hidden"); | ||
| 927 | +DOM.setStyle(lel,"visibility",""); | ||
| 928 | +},toString:function(){ | ||
| 929 | +return ("DDProxy "+this.id); | ||
| 930 | +}}); | ||
| 931 | +YAHOO.util.DDTarget=function(id,_113,_114){ | ||
| 932 | +if(id){ | ||
| 933 | +this.initTarget(id,_113,_114); | ||
| 934 | +} | ||
| 2935 | }; | 935 | }; |
| 936 | +YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){ | ||
| 937 | +return ("DDTarget "+this.id); | ||
| 938 | +}}); | ||
| 2936 | 939 | ||
| 2937 | -// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop(); | ||
| 2938 | -YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, { | ||
| 2939 | - toString: function() { | ||
| 2940 | - return ("DDTarget " + this.id); | ||
| 2941 | - } | ||
| 2942 | -}); |
thirdpartyjs/yui/event/event.js
| 1 | -/* | ||
| 2 | -Copyright (c) 2006, Yahoo! Inc. All rights reserved. | ||
| 3 | -Code licensed under the BSD License: | ||
| 4 | -http://developer.yahoo.net/yui/license.txt | ||
| 5 | -version: 0.12.0 | ||
| 6 | -*/ | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * The CustomEvent class lets you define events for your application | ||
| 10 | - * that can be subscribed to by one or more independent component. | ||
| 11 | - * | ||
| 12 | - * @param {String} type The type of event, which is passed to the callback | ||
| 13 | - * when the event fires | ||
| 14 | - * @param {Object} oScope The context the event will fire from. "this" will | ||
| 15 | - * refer to this object in the callback. Default value: | ||
| 16 | - * the window object. The listener can override this. | ||
| 17 | - * @param {boolean} silent pass true to prevent the event from writing to | ||
| 18 | - * the log system | ||
| 19 | - * @namespace YAHOO.util | ||
| 20 | - * @class CustomEvent | ||
| 21 | - * @constructor | ||
| 22 | - */ | ||
| 23 | -YAHOO.util.CustomEvent = function(type, oScope, silent, signature) { | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * The type of event, returned to subscribers when the event fires | ||
| 27 | - * @property type | ||
| 28 | - * @type string | ||
| 29 | - */ | ||
| 30 | - this.type = type; | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * The scope the the event will fire from by default. Defaults to the window | ||
| 34 | - * obj | ||
| 35 | - * @property scope | ||
| 36 | - * @type object | ||
| 37 | - */ | ||
| 38 | - this.scope = oScope || window; | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * By default all custom events are logged in the debug build, set silent | ||
| 42 | - * to true to disable logging for this event. | ||
| 43 | - * @property silent | ||
| 44 | - * @type boolean | ||
| 45 | - */ | ||
| 46 | - this.silent = silent; | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * Custom events support two styles of arguments provided to the event | ||
| 50 | - * subscribers. | ||
| 51 | - * <ul> | ||
| 52 | - * <li>YAHOO.util.CustomEvent.LIST: | ||
| 53 | - * <ul> | ||
| 54 | - * <li>param1: event name</li> | ||
| 55 | - * <li>param2: array of arguments sent to fire</li> | ||
| 56 | - * <li>param3: <optional> a custom object supplied by the subscriber</li> | ||
| 57 | - * </ul> | ||
| 58 | - * </li> | ||
| 59 | - * <li>YAHOO.util.CustomEvent.FLAT | ||
| 60 | - * <ul> | ||
| 61 | - * <li>param1: the first argument passed to fire. If you need to | ||
| 62 | - * pass multiple parameters, use and array or object literal</li> | ||
| 63 | - * <li>param2: <optional> a custom object supplied by the subscriber</li> | ||
| 64 | - * </ul> | ||
| 65 | - * </li> | ||
| 66 | - * </ul> | ||
| 67 | - * @property signature | ||
| 68 | - * @type int | ||
| 69 | - */ | ||
| 70 | - this.signature = signature || YAHOO.util.CustomEvent.LIST; | ||
| 71 | - | ||
| 72 | - /** | ||
| 73 | - * The subscribers to this event | ||
| 74 | - * @property subscribers | ||
| 75 | - * @type Subscriber[] | ||
| 76 | - */ | ||
| 77 | - this.subscribers = []; | ||
| 78 | - | ||
| 79 | - if (!this.silent) { | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - var onsubscribeType = "_YUICEOnSubscribe"; | ||
| 83 | - | ||
| 84 | - // Only add subscribe events for events that are not generated by | ||
| 85 | - // CustomEvent | ||
| 86 | - if (type !== onsubscribeType) { | ||
| 87 | - | ||
| 88 | - /** | ||
| 89 | - * Custom events provide a custom event that fires whenever there is | ||
| 90 | - * a new subscriber to the event. This provides an opportunity to | ||
| 91 | - * handle the case where there is a non-repeating event that has | ||
| 92 | - * already fired has a new subscriber. | ||
| 93 | - * | ||
| 94 | - * @event subscribeEvent | ||
| 95 | - * @type YAHOO.util.CustomEvent | ||
| 96 | - * @param {Function} fn The function to execute | ||
| 97 | - * @param {Object} obj An object to be passed along when the event | ||
| 98 | - * fires | ||
| 99 | - * @param {boolean|Object} override If true, the obj passed in becomes | ||
| 100 | - * the execution scope of the listener. | ||
| 101 | - * if an object, that object becomes the | ||
| 102 | - * the execution scope. | ||
| 103 | - */ | ||
| 104 | - this.subscribeEvent = | ||
| 105 | - new YAHOO.util.CustomEvent(onsubscribeType, this, true); | ||
| 106 | - | ||
| 107 | - } | ||
| 108 | -}; | ||
| 109 | - | ||
| 110 | -/** | ||
| 111 | - * Subscriber listener sigature constant. The LIST type returns three | ||
| 112 | - * parameters: the event type, the array of args passed to fire, and | ||
| 113 | - * the optional custom object | ||
| 114 | - * @property YAHOO.util.CustomEvent.LIST | ||
| 115 | - * @static | ||
| 116 | - * @type int | ||
| 117 | - */ | ||
| 118 | -YAHOO.util.CustomEvent.LIST = 0; | ||
| 119 | - | ||
| 120 | -/** | ||
| 121 | - * Subscriber listener sigature constant. The FLAT type returns two | ||
| 122 | - * parameters: the first argument passed to fire and the optional | ||
| 123 | - * custom object | ||
| 124 | - * @property YAHOO.util.CustomEvent.FLAT | ||
| 125 | - * @static | ||
| 126 | - * @type int | ||
| 127 | - */ | ||
| 128 | -YAHOO.util.CustomEvent.FLAT = 1; | ||
| 129 | - | ||
| 130 | -YAHOO.util.CustomEvent.prototype = { | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | - * Subscribes the caller to this event | ||
| 134 | - * @method subscribe | ||
| 135 | - * @param {Function} fn The function to execute | ||
| 136 | - * @param {Object} obj An object to be passed along when the event | ||
| 137 | - * fires | ||
| 138 | - * @param {boolean|Object} override If true, the obj passed in becomes | ||
| 139 | - * the execution scope of the listener. | ||
| 140 | - * if an object, that object becomes the | ||
| 141 | - * the execution scope. | ||
| 142 | - */ | ||
| 143 | - subscribe: function(fn, obj, override) { | ||
| 144 | - if (this.subscribeEvent) { | ||
| 145 | - this.subscribeEvent.fire(fn, obj, override); | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) ); | ||
| 149 | - }, | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * Unsubscribes the caller from this event | ||
| 153 | - * @method unsubscribe | ||
| 154 | - * @param {Function} fn The function to execute | ||
| 155 | - * @param {Object} obj The custom object passed to subscribe (optional) | ||
| 156 | - * @return {boolean} True if the subscriber was found and detached. | ||
| 157 | - */ | ||
| 158 | - unsubscribe: function(fn, obj) { | ||
| 159 | - var found = false; | ||
| 160 | - for (var i=0, len=this.subscribers.length; i<len; ++i) { | ||
| 161 | - var s = this.subscribers[i]; | ||
| 162 | - if (s && s.contains(fn, obj)) { | ||
| 163 | - this._delete(i); | ||
| 164 | - found = true; | ||
| 165 | - } | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - return found; | ||
| 169 | - }, | ||
| 170 | - | ||
| 171 | - /** | ||
| 172 | - * Notifies the subscribers. The callback functions will be executed | ||
| 173 | - * from the scope specified when the event was created, and with the | ||
| 174 | - * following parameters: | ||
| 175 | - * <ul> | ||
| 176 | - * <li>The type of event</li> | ||
| 177 | - * <li>All of the arguments fire() was executed with as an array</li> | ||
| 178 | - * <li>The custom object (if any) that was passed into the subscribe() | ||
| 179 | - * method</li> | ||
| 180 | - * </ul> | ||
| 181 | - * @method fire | ||
| 182 | - * @param {Object*} arguments an arbitrary set of parameters to pass to | ||
| 183 | - * the handler. | ||
| 184 | - */ | ||
| 185 | - fire: function() { | ||
| 186 | - var len=this.subscribers.length; | ||
| 187 | - if (!len && this.silent) { | ||
| 188 | - return true; | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - var args=[], ret=true, i; | ||
| 192 | - | ||
| 193 | - for (i=0; i<arguments.length; ++i) { | ||
| 194 | - args.push(arguments[i]); | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - var argslength = args.length; | ||
| 198 | - | ||
| 199 | - if (!this.silent) { | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - for (i=0; i<len; ++i) { | ||
| 203 | - var s = this.subscribers[i]; | ||
| 204 | - if (s) { | ||
| 205 | - if (!this.silent) { | ||
| 206 | - } | ||
| 207 | - | ||
| 208 | - var scope = s.getScope(this.scope); | ||
| 209 | - | ||
| 210 | - if (this.signature == YAHOO.util.CustomEvent.FLAT) { | ||
| 211 | - var param = null; | ||
| 212 | - if (args.length > 0) { | ||
| 213 | - param = args[0]; | ||
| 214 | - } | ||
| 215 | - ret = s.fn.call(scope, param, s.obj); | ||
| 216 | - } else { | ||
| 217 | - ret = s.fn.call(scope, this.type, args, s.obj); | ||
| 218 | - } | ||
| 219 | - if (false === ret) { | ||
| 220 | - if (!this.silent) { | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - //break; | ||
| 224 | - return false; | ||
| 225 | - } | ||
| 226 | - } | ||
| 227 | - } | ||
| 228 | - | ||
| 229 | - return true; | ||
| 230 | - }, | ||
| 231 | - | ||
| 232 | - /** | ||
| 233 | - * Removes all listeners | ||
| 234 | - * @method unsubscribeAll | ||
| 235 | - */ | ||
| 236 | - unsubscribeAll: function() { | ||
| 237 | - for (var i=0, len=this.subscribers.length; i<len; ++i) { | ||
| 238 | - this._delete(len - 1 - i); | ||
| 239 | - } | ||
| 240 | - }, | ||
| 241 | - | ||
| 242 | - /** | ||
| 243 | - * @method _delete | ||
| 244 | - * @private | ||
| 245 | - */ | ||
| 246 | - _delete: function(index) { | ||
| 247 | - var s = this.subscribers[index]; | ||
| 248 | - if (s) { | ||
| 249 | - delete s.fn; | ||
| 250 | - delete s.obj; | ||
| 251 | - } | ||
| 252 | - | ||
| 253 | - // delete this.subscribers[index]; | ||
| 254 | - this.subscribers.splice(index, 1); | ||
| 255 | - }, | ||
| 256 | - | ||
| 257 | - /** | ||
| 258 | - * @method toString | ||
| 259 | - */ | ||
| 260 | - toString: function() { | ||
| 261 | - return "CustomEvent: " + "'" + this.type + "', " + | ||
| 262 | - "scope: " + this.scope; | ||
| 263 | - | ||
| 264 | - } | ||
| 265 | -}; | ||
| 266 | - | ||
| 267 | -///////////////////////////////////////////////////////////////////// | ||
| 268 | - | ||
| 269 | -/** | ||
| 270 | - * Stores the subscriber information to be used when the event fires. | ||
| 271 | - * @param {Function} fn The function to execute | ||
| 272 | - * @param {Object} obj An object to be passed along when the event fires | ||
| 273 | - * @param {boolean} override If true, the obj passed in becomes the execution | ||
| 274 | - * scope of the listener | ||
| 275 | - * @class Subscriber | ||
| 276 | - * @constructor | ||
| 277 | - */ | ||
| 278 | -YAHOO.util.Subscriber = function(fn, obj, override) { | ||
| 279 | - | ||
| 280 | - /** | ||
| 281 | - * The callback that will be execute when the event fires | ||
| 282 | - * @property fn | ||
| 283 | - * @type function | ||
| 284 | - */ | ||
| 285 | - this.fn = fn; | ||
| 286 | - | ||
| 287 | - /** | ||
| 288 | - * An optional custom object that will passed to the callback when | ||
| 289 | - * the event fires | ||
| 290 | - * @property obj | ||
| 291 | - * @type object | ||
| 292 | - */ | ||
| 293 | - this.obj = obj || null; | ||
| 294 | - | ||
| 295 | - /** | ||
| 296 | - * The default execution scope for the event listener is defined when the | ||
| 297 | - * event is created (usually the object which contains the event). | ||
| 298 | - * By setting override to true, the execution scope becomes the custom | ||
| 299 | - * object passed in by the subscriber. If override is an object, that | ||
| 300 | - * object becomes the scope. | ||
| 301 | - * @property override | ||
| 302 | - * @type boolean|object | ||
| 303 | - */ | ||
| 304 | - this.override = override; | ||
| 305 | - | ||
| 306 | -}; | ||
| 307 | - | ||
| 308 | -/** | ||
| 309 | - * Returns the execution scope for this listener. If override was set to true | ||
| 310 | - * the custom obj will be the scope. If override is an object, that is the | ||
| 311 | - * scope, otherwise the default scope will be used. | ||
| 312 | - * @method getScope | ||
| 313 | - * @param {Object} defaultScope the scope to use if this listener does not | ||
| 314 | - * override it. | ||
| 315 | - */ | ||
| 316 | -YAHOO.util.Subscriber.prototype.getScope = function(defaultScope) { | ||
| 317 | - if (this.override) { | ||
| 318 | - if (this.override === true) { | ||
| 319 | - return this.obj; | ||
| 320 | - } else { | ||
| 321 | - return this.override; | ||
| 322 | - } | ||
| 323 | - } | ||
| 324 | - return defaultScope; | ||
| 325 | -}; | ||
| 326 | - | ||
| 327 | -/** | ||
| 328 | - * Returns true if the fn and obj match this objects properties. | ||
| 329 | - * Used by the unsubscribe method to match the right subscriber. | ||
| 330 | - * | ||
| 331 | - * @method contains | ||
| 332 | - * @param {Function} fn the function to execute | ||
| 333 | - * @param {Object} obj an object to be passed along when the event fires | ||
| 334 | - * @return {boolean} true if the supplied arguments match this | ||
| 335 | - * subscriber's signature. | ||
| 336 | - */ | ||
| 337 | -YAHOO.util.Subscriber.prototype.contains = function(fn, obj) { | ||
| 338 | - if (obj) { | ||
| 339 | - return (this.fn == fn && this.obj == obj); | ||
| 340 | - } else { | ||
| 341 | - return (this.fn == fn); | ||
| 342 | - } | ||
| 343 | -}; | ||
| 344 | - | ||
| 345 | -/** | ||
| 346 | - * @method toString | ||
| 347 | - */ | ||
| 348 | -YAHOO.util.Subscriber.prototype.toString = function() { | ||
| 349 | - return "Subscriber { obj: " + (this.obj || "") + | ||
| 350 | - ", override: " + (this.override || "no") + " }"; | ||
| 351 | -}; | ||
| 352 | - | ||
| 353 | -/** | ||
| 354 | - * The Event Utility provides utilities for managing DOM Events and tools | ||
| 355 | - * for building event systems | ||
| 356 | - * | ||
| 357 | - * @module event | ||
| 358 | - * @title Event Utility | ||
| 359 | - * @namespace YAHOO.util | ||
| 360 | - * @requires yahoo | ||
| 361 | - */ | ||
| 362 | - | ||
| 363 | -// The first instance of Event will win if it is loaded more than once. | ||
| 364 | -if (!YAHOO.util.Event) { | ||
| 365 | - | ||
| 366 | -/** | ||
| 367 | - * The event utility provides functions to add and remove event listeners, | ||
| 368 | - * event cleansing. It also tries to automatically remove listeners it | ||
| 369 | - * registers during the unload event. | ||
| 370 | - * | ||
| 371 | - * @class Event | ||
| 372 | - * @static | ||
| 373 | - */ | ||
| 374 | - YAHOO.util.Event = function() { | ||
| 375 | - | ||
| 376 | - /** | ||
| 377 | - * True after the onload event has fired | ||
| 378 | - * @property loadComplete | ||
| 379 | - * @type boolean | ||
| 380 | - * @static | ||
| 381 | - * @private | ||
| 382 | - */ | ||
| 383 | - var loadComplete = false; | ||
| 384 | - | ||
| 385 | - /** | ||
| 386 | - * Cache of wrapped listeners | ||
| 387 | - * @property listeners | ||
| 388 | - * @type array | ||
| 389 | - * @static | ||
| 390 | - * @private | ||
| 391 | - */ | ||
| 392 | - var listeners = []; | ||
| 393 | - | ||
| 394 | - /** | ||
| 395 | - * User-defined unload function that will be fired before all events | ||
| 396 | - * are detached | ||
| 397 | - * @property unloadListeners | ||
| 398 | - * @type array | ||
| 399 | - * @static | ||
| 400 | - * @private | ||
| 401 | - */ | ||
| 402 | - var unloadListeners = []; | ||
| 403 | - | ||
| 404 | - /** | ||
| 405 | - * Cache of DOM0 event handlers to work around issues with DOM2 events | ||
| 406 | - * in Safari | ||
| 407 | - * @property legacyEvents | ||
| 408 | - * @static | ||
| 409 | - * @private | ||
| 410 | - */ | ||
| 411 | - var legacyEvents = []; | ||
| 412 | - | ||
| 413 | - /** | ||
| 414 | - * Listener stack for DOM0 events | ||
| 415 | - * @property legacyHandlers | ||
| 416 | - * @static | ||
| 417 | - * @private | ||
| 418 | - */ | ||
| 419 | - var legacyHandlers = []; | ||
| 420 | - | ||
| 421 | - /** | ||
| 422 | - * The number of times to poll after window.onload. This number is | ||
| 423 | - * increased if additional late-bound handlers are requested after | ||
| 424 | - * the page load. | ||
| 425 | - * @property retryCount | ||
| 426 | - * @static | ||
| 427 | - * @private | ||
| 428 | - */ | ||
| 429 | - var retryCount = 0; | ||
| 430 | - | ||
| 431 | - /** | ||
| 432 | - * onAvailable listeners | ||
| 433 | - * @property onAvailStack | ||
| 434 | - * @static | ||
| 435 | - * @private | ||
| 436 | - */ | ||
| 437 | - var onAvailStack = []; | ||
| 438 | - | ||
| 439 | - /** | ||
| 440 | - * Lookup table for legacy events | ||
| 441 | - * @property legacyMap | ||
| 442 | - * @static | ||
| 443 | - * @private | ||
| 444 | - */ | ||
| 445 | - var legacyMap = []; | ||
| 446 | - | ||
| 447 | - /** | ||
| 448 | - * Counter for auto id generation | ||
| 449 | - * @property counter | ||
| 450 | - * @static | ||
| 451 | - * @private | ||
| 452 | - */ | ||
| 453 | - var counter = 0; | ||
| 454 | - | ||
| 455 | - return { // PREPROCESS | ||
| 456 | - | ||
| 457 | - /** | ||
| 458 | - * The number of times we should look for elements that are not | ||
| 459 | - * in the DOM at the time the event is requested after the document | ||
| 460 | - * has been loaded. The default is 200@amp;50 ms, so it will poll | ||
| 461 | - * for 10 seconds or until all outstanding handlers are bound | ||
| 462 | - * (whichever comes first). | ||
| 463 | - * @property POLL_RETRYS | ||
| 464 | - * @type int | ||
| 465 | - * @static | ||
| 466 | - * @final | ||
| 467 | - */ | ||
| 468 | - POLL_RETRYS: 200, | ||
| 469 | - | ||
| 470 | - /** | ||
| 471 | - * The poll interval in milliseconds | ||
| 472 | - * @property POLL_INTERVAL | ||
| 473 | - * @type int | ||
| 474 | - * @static | ||
| 475 | - * @final | ||
| 476 | - */ | ||
| 477 | - POLL_INTERVAL: 20, | ||
| 478 | - | ||
| 479 | - /** | ||
| 480 | - * Element to bind, int constant | ||
| 481 | - * @property EL | ||
| 482 | - * @type int | ||
| 483 | - * @static | ||
| 484 | - * @final | ||
| 485 | - */ | ||
| 486 | - EL: 0, | ||
| 487 | - | ||
| 488 | - /** | ||
| 489 | - * Type of event, int constant | ||
| 490 | - * @property TYPE | ||
| 491 | - * @type int | ||
| 492 | - * @static | ||
| 493 | - * @final | ||
| 494 | - */ | ||
| 495 | - TYPE: 1, | ||
| 496 | - | ||
| 497 | - /** | ||
| 498 | - * Function to execute, int constant | ||
| 499 | - * @property FN | ||
| 500 | - * @type int | ||
| 501 | - * @static | ||
| 502 | - * @final | ||
| 503 | - */ | ||
| 504 | - FN: 2, | ||
| 505 | - | ||
| 506 | - /** | ||
| 507 | - * Function wrapped for scope correction and cleanup, int constant | ||
| 508 | - * @property WFN | ||
| 509 | - * @type int | ||
| 510 | - * @static | ||
| 511 | - * @final | ||
| 512 | - */ | ||
| 513 | - WFN: 3, | ||
| 514 | - | ||
| 515 | - /** | ||
| 516 | - * Object passed in by the user that will be returned as a | ||
| 517 | - * parameter to the callback, int constant | ||
| 518 | - * @property OBJ | ||
| 519 | - * @type int | ||
| 520 | - * @static | ||
| 521 | - * @final | ||
| 522 | - */ | ||
| 523 | - OBJ: 3, | ||
| 524 | - | ||
| 525 | - /** | ||
| 526 | - * Adjusted scope, either the element we are registering the event | ||
| 527 | - * on or the custom object passed in by the listener, int constant | ||
| 528 | - * @property ADJ_SCOPE | ||
| 529 | - * @type int | ||
| 530 | - * @static | ||
| 531 | - * @final | ||
| 532 | - */ | ||
| 533 | - ADJ_SCOPE: 4, | ||
| 534 | - | ||
| 535 | - /** | ||
| 536 | - * Safari detection is necessary to work around the preventDefault | ||
| 537 | - * bug that makes it so you can't cancel a href click from the | ||
| 538 | - * handler. There is not a capabilities check we can use here. | ||
| 539 | - * @property isSafari | ||
| 540 | - * @private | ||
| 541 | - * @static | ||
| 542 | - */ | ||
| 543 | - isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent), | ||
| 544 | - | ||
| 545 | - /** | ||
| 546 | - * IE detection needed to properly calculate pageX and pageY. | ||
| 547 | - * capabilities checking didn't seem to work because another | ||
| 548 | - * browser that does not provide the properties have the values | ||
| 549 | - * calculated in a different manner than IE. | ||
| 550 | - * @property isIE | ||
| 551 | - * @private | ||
| 552 | - * @static | ||
| 553 | - */ | ||
| 554 | - isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && | ||
| 555 | - navigator.userAgent.match(/msie/gi)), | ||
| 556 | - | ||
| 557 | - /** | ||
| 558 | - * poll handle | ||
| 559 | - * @property _interval | ||
| 560 | - * @private | ||
| 561 | - */ | ||
| 562 | - _interval: null, | ||
| 563 | - | ||
| 564 | - /** | ||
| 565 | - * @method startInterval | ||
| 566 | - * @static | ||
| 567 | - * @private | ||
| 568 | - */ | ||
| 569 | - startInterval: function() { | ||
| 570 | - if (!this._interval) { | ||
| 571 | - var self = this; | ||
| 572 | - var callback = function() { self._tryPreloadAttach(); }; | ||
| 573 | - this._interval = setInterval(callback, this.POLL_INTERVAL); | ||
| 574 | - // this.timeout = setTimeout(callback, i); | ||
| 575 | - } | ||
| 576 | - }, | ||
| 577 | - | ||
| 578 | - /** | ||
| 579 | - * Executes the supplied callback when the item with the supplied | ||
| 580 | - * id is found. This is meant to be used to execute behavior as | ||
| 581 | - * soon as possible as the page loads. If you use this after the | ||
| 582 | - * initial page load it will poll for a fixed time for the element. | ||
| 583 | - * The number of times it will poll and the frequency are | ||
| 584 | - * configurable. By default it will poll for 10 seconds. | ||
| 585 | - * | ||
| 586 | - * @method onAvailable | ||
| 587 | - * | ||
| 588 | - * @param {string} p_id the id of the element to look for. | ||
| 589 | - * @param {function} p_fn what to execute when the element is found. | ||
| 590 | - * @param {object} p_obj an optional object to be passed back as | ||
| 591 | - * a parameter to p_fn. | ||
| 592 | - * @param {boolean} p_override If set to true, p_fn will execute | ||
| 593 | - * in the scope of p_obj | ||
| 594 | - * | ||
| 595 | - * @static | ||
| 596 | - */ | ||
| 597 | - onAvailable: function(p_id, p_fn, p_obj, p_override) { | ||
| 598 | - onAvailStack.push( { id: p_id, | ||
| 599 | - fn: p_fn, | ||
| 600 | - obj: p_obj, | ||
| 601 | - override: p_override, | ||
| 602 | - checkReady: false } ); | ||
| 603 | - | ||
| 604 | - retryCount = this.POLL_RETRYS; | ||
| 605 | - this.startInterval(); | ||
| 606 | - }, | ||
| 607 | - | ||
| 608 | - /** | ||
| 609 | - * Works the same way as onAvailable, but additionally checks the | ||
| 610 | - * state of sibling elements to determine if the content of the | ||
| 611 | - * available element is safe to modify. | ||
| 612 | - * | ||
| 613 | - * @method onContentReady | ||
| 614 | - * | ||
| 615 | - * @param {string} p_id the id of the element to look for. | ||
| 616 | - * @param {function} p_fn what to execute when the element is ready. | ||
| 617 | - * @param {object} p_obj an optional object to be passed back as | ||
| 618 | - * a parameter to p_fn. | ||
| 619 | - * @param {boolean} p_override If set to true, p_fn will execute | ||
| 620 | - * in the scope of p_obj | ||
| 621 | - * | ||
| 622 | - * @static | ||
| 623 | - */ | ||
| 624 | - onContentReady: function(p_id, p_fn, p_obj, p_override) { | ||
| 625 | - onAvailStack.push( { id: p_id, | ||
| 626 | - fn: p_fn, | ||
| 627 | - obj: p_obj, | ||
| 628 | - override: p_override, | ||
| 629 | - checkReady: true } ); | ||
| 630 | - | ||
| 631 | - retryCount = this.POLL_RETRYS; | ||
| 632 | - this.startInterval(); | ||
| 633 | - }, | ||
| 634 | - | ||
| 635 | - /** | ||
| 636 | - * Appends an event handler | ||
| 637 | - * | ||
| 638 | - * @method addListener | ||
| 639 | - * | ||
| 640 | - * @param {Object} el The html element to assign the | ||
| 641 | - * event to | ||
| 642 | - * @param {String} sType The type of event to append | ||
| 643 | - * @param {Function} fn The method the event invokes | ||
| 644 | - * @param {Object} obj An arbitrary object that will be | ||
| 645 | - * passed as a parameter to the handler | ||
| 646 | - * @param {boolean} override If true, the obj passed in becomes | ||
| 647 | - * the execution scope of the listener | ||
| 648 | - * @return {boolean} True if the action was successful or defered, | ||
| 649 | - * false if one or more of the elements | ||
| 650 | - * could not have the event bound to it. | ||
| 651 | - * @static | ||
| 652 | - */ | ||
| 653 | - addListener: function(el, sType, fn, obj, override) { | ||
| 654 | - | ||
| 655 | - if (!fn || !fn.call) { | ||
| 656 | - return false; | ||
| 657 | - } | ||
| 658 | - | ||
| 659 | - // The el argument can be an array of elements or element ids. | ||
| 660 | - if ( this._isValidCollection(el)) { | ||
| 661 | - var ok = true; | ||
| 662 | - for (var i=0,len=el.length; i<len; ++i) { | ||
| 663 | - ok = this.on(el[i], | ||
| 664 | - sType, | ||
| 665 | - fn, | ||
| 666 | - obj, | ||
| 667 | - override) && ok; | ||
| 668 | - } | ||
| 669 | - return ok; | ||
| 670 | - | ||
| 671 | - } else if (typeof el == "string") { | ||
| 672 | - var oEl = this.getEl(el); | ||
| 673 | - // If the el argument is a string, we assume it is | ||
| 674 | - // actually the id of the element. If the page is loaded | ||
| 675 | - // we convert el to the actual element, otherwise we | ||
| 676 | - // defer attaching the event until onload event fires | ||
| 677 | - | ||
| 678 | - // check to see if we need to delay hooking up the event | ||
| 679 | - // until after the page loads. | ||
| 680 | - if (oEl) { | ||
| 681 | - el = oEl; | ||
| 682 | - } else { | ||
| 683 | - // defer adding the event until the element is available | ||
| 684 | - this.onAvailable(el, function() { | ||
| 685 | - YAHOO.util.Event.on(el, sType, fn, obj, override); | ||
| 686 | - }); | ||
| 687 | - | ||
| 688 | - return true; | ||
| 689 | - } | ||
| 690 | - } | ||
| 691 | - | ||
| 692 | - // Element should be an html element or an array if we get | ||
| 693 | - // here. | ||
| 694 | - if (!el) { | ||
| 695 | - return false; | ||
| 696 | - } | ||
| 697 | - | ||
| 698 | - // we need to make sure we fire registered unload events | ||
| 699 | - // prior to automatically unhooking them. So we hang on to | ||
| 700 | - // these instead of attaching them to the window and fire the | ||
| 701 | - // handles explicitly during our one unload event. | ||
| 702 | - if ("unload" == sType && obj !== this) { | ||
| 703 | - unloadListeners[unloadListeners.length] = | ||
| 704 | - [el, sType, fn, obj, override]; | ||
| 705 | - return true; | ||
| 706 | - } | ||
| 707 | - | ||
| 708 | - // if the user chooses to override the scope, we use the custom | ||
| 709 | - // object passed in, otherwise the executing scope will be the | ||
| 710 | - // HTML element that the event is registered on | ||
| 711 | - var scope = el; | ||
| 712 | - if (override) { | ||
| 713 | - if (override === true) { | ||
| 714 | - scope = obj; | ||
| 715 | - } else { | ||
| 716 | - scope = override; | ||
| 717 | - } | ||
| 718 | - } | ||
| 719 | - | ||
| 720 | - // wrap the function so we can return the obj object when | ||
| 721 | - // the event fires; | ||
| 722 | - var wrappedFn = function(e) { | ||
| 723 | - return fn.call(scope, YAHOO.util.Event.getEvent(e), | ||
| 724 | - obj); | ||
| 725 | - }; | ||
| 726 | - | ||
| 727 | - var li = [el, sType, fn, wrappedFn, scope]; | ||
| 728 | - var index = listeners.length; | ||
| 729 | - // cache the listener so we can try to automatically unload | ||
| 730 | - listeners[index] = li; | ||
| 731 | - | ||
| 732 | - if (this.useLegacyEvent(el, sType)) { | ||
| 733 | - var legacyIndex = this.getLegacyIndex(el, sType); | ||
| 734 | - | ||
| 735 | - // Add a new dom0 wrapper if one is not detected for this | ||
| 736 | - // element | ||
| 737 | - if ( legacyIndex == -1 || | ||
| 738 | - el != legacyEvents[legacyIndex][0] ) { | ||
| 739 | - | ||
| 740 | - legacyIndex = legacyEvents.length; | ||
| 741 | - legacyMap[el.id + sType] = legacyIndex; | ||
| 742 | - | ||
| 743 | - // cache the signature for the DOM0 event, and | ||
| 744 | - // include the existing handler for the event, if any | ||
| 745 | - legacyEvents[legacyIndex] = | ||
| 746 | - [el, sType, el["on" + sType]]; | ||
| 747 | - legacyHandlers[legacyIndex] = []; | ||
| 748 | - | ||
| 749 | - el["on" + sType] = | ||
| 750 | - function(e) { | ||
| 751 | - YAHOO.util.Event.fireLegacyEvent( | ||
| 752 | - YAHOO.util.Event.getEvent(e), legacyIndex); | ||
| 753 | - }; | ||
| 754 | - } | ||
| 755 | - | ||
| 756 | - // add a reference to the wrapped listener to our custom | ||
| 757 | - // stack of events | ||
| 758 | - //legacyHandlers[legacyIndex].push(index); | ||
| 759 | - legacyHandlers[legacyIndex].push(li); | ||
| 760 | - | ||
| 761 | - } else { | ||
| 762 | - this._simpleAdd(el, sType, wrappedFn, false); | ||
| 763 | - } | ||
| 764 | - | ||
| 765 | - return true; | ||
| 766 | - | ||
| 767 | - }, | ||
| 768 | - | ||
| 769 | - /** | ||
| 770 | - * When using legacy events, the handler is routed to this object | ||
| 771 | - * so we can fire our custom listener stack. | ||
| 772 | - * @method fireLegacyEvent | ||
| 773 | - * @static | ||
| 774 | - * @private | ||
| 775 | - */ | ||
| 776 | - fireLegacyEvent: function(e, legacyIndex) { | ||
| 777 | - var ok = true; | ||
| 778 | - | ||
| 779 | - var le = legacyHandlers[legacyIndex]; | ||
| 780 | - for (var i=0,len=le.length; i<len; ++i) { | ||
| 781 | - var li = le[i]; | ||
| 782 | - if ( li && li[this.WFN] ) { | ||
| 783 | - var scope = li[this.ADJ_SCOPE]; | ||
| 784 | - var ret = li[this.WFN].call(scope, e); | ||
| 785 | - ok = (ok && ret); | ||
| 786 | - } | ||
| 787 | - } | ||
| 788 | - | ||
| 789 | - return ok; | ||
| 790 | - }, | ||
| 791 | - | ||
| 792 | - /** | ||
| 793 | - * Returns the legacy event index that matches the supplied | ||
| 794 | - * signature | ||
| 795 | - * @method getLegacyIndex | ||
| 796 | - * @static | ||
| 797 | - * @private | ||
| 798 | - */ | ||
| 799 | - getLegacyIndex: function(el, sType) { | ||
| 800 | - var key = this.generateId(el) + sType; | ||
| 801 | - if (typeof legacyMap[key] == "undefined") { | ||
| 802 | - return -1; | ||
| 803 | - } else { | ||
| 804 | - return legacyMap[key]; | ||
| 805 | - } | ||
| 806 | - }, | ||
| 807 | - | ||
| 808 | - /** | ||
| 809 | - * Logic that determines when we should automatically use legacy | ||
| 810 | - * events instead of DOM2 events. | ||
| 811 | - * @method useLegacyEvent | ||
| 812 | - * @static | ||
| 813 | - * @private | ||
| 814 | - */ | ||
| 815 | - useLegacyEvent: function(el, sType) { | ||
| 816 | - if (!el.addEventListener && !el.attachEvent) { | ||
| 817 | - return true; | ||
| 818 | - } else if (this.isSafari) { | ||
| 819 | - if ("click" == sType || "dblclick" == sType) { | ||
| 820 | - return true; | ||
| 821 | - } | ||
| 822 | - } | ||
| 823 | - return false; | ||
| 824 | - }, | ||
| 825 | - | ||
| 826 | - /** | ||
| 827 | - * Removes an event handler | ||
| 828 | - * | ||
| 829 | - * @method removeListener | ||
| 830 | - * | ||
| 831 | - * @param {Object} el the html element or the id of the element to | ||
| 832 | - * assign the event to. | ||
| 833 | - * @param {String} sType the type of event to remove. | ||
| 834 | - * @param {Function} fn the method the event invokes. If fn is | ||
| 835 | - * undefined, then all event handlers for the type of event are | ||
| 836 | - * removed. | ||
| 837 | - * @return {boolean} true if the unbind was successful, false | ||
| 838 | - * otherwise. | ||
| 839 | - * @static | ||
| 840 | - */ | ||
| 841 | - removeListener: function(el, sType, fn) { | ||
| 842 | - var i, len; | ||
| 843 | - | ||
| 844 | - // The el argument can be a string | ||
| 845 | - if (typeof el == "string") { | ||
| 846 | - el = this.getEl(el); | ||
| 847 | - // The el argument can be an array of elements or element ids. | ||
| 848 | - } else if ( this._isValidCollection(el)) { | ||
| 849 | - var ok = true; | ||
| 850 | - for (i=0,len=el.length; i<len; ++i) { | ||
| 851 | - ok = ( this.removeListener(el[i], sType, fn) && ok ); | ||
| 852 | - } | ||
| 853 | - return ok; | ||
| 854 | - } | ||
| 855 | - | ||
| 856 | - if (!fn || !fn.call) { | ||
| 857 | - //return false; | ||
| 858 | - return this.purgeElement(el, false, sType); | ||
| 859 | - } | ||
| 860 | - | ||
| 861 | - if ("unload" == sType) { | ||
| 862 | - | ||
| 863 | - for (i=0, len=unloadListeners.length; i<len; i++) { | ||
| 864 | - var li = unloadListeners[i]; | ||
| 865 | - if (li && | ||
| 866 | - li[0] == el && | ||
| 867 | - li[1] == sType && | ||
| 868 | - li[2] == fn) { | ||
| 869 | - unloadListeners.splice(i, 1); | ||
| 870 | - return true; | ||
| 871 | - } | ||
| 872 | - } | ||
| 873 | - | ||
| 874 | - return false; | ||
| 875 | - } | ||
| 876 | - | ||
| 877 | - var cacheItem = null; | ||
| 878 | - | ||
| 879 | - // The index is a hidden parameter; needed to remove it from | ||
| 880 | - // the method signature because it was tempting users to | ||
| 881 | - // try and take advantage of it, which is not possible. | ||
| 882 | - var index = arguments[3]; | ||
| 883 | - | ||
| 884 | - if ("undefined" == typeof index) { | ||
| 885 | - index = this._getCacheIndex(el, sType, fn); | ||
| 886 | - } | ||
| 887 | - | ||
| 888 | - if (index >= 0) { | ||
| 889 | - cacheItem = listeners[index]; | ||
| 890 | - } | ||
| 891 | - | ||
| 892 | - if (!el || !cacheItem) { | ||
| 893 | - return false; | ||
| 894 | - } | ||
| 895 | - | ||
| 896 | - if (this.useLegacyEvent(el, sType)) { | ||
| 897 | - var legacyIndex = this.getLegacyIndex(el, sType); | ||
| 898 | - var llist = legacyHandlers[legacyIndex]; | ||
| 899 | - if (llist) { | ||
| 900 | - for (i=0, len=llist.length; i<len; ++i) { | ||
| 901 | - li = llist[i]; | ||
| 902 | - if (li && | ||
| 903 | - li[this.EL] == el && | ||
| 904 | - li[this.TYPE] == sType && | ||
| 905 | - li[this.FN] == fn) { | ||
| 906 | - llist.splice(i, 1); | ||
| 907 | - break; | ||
| 908 | - } | ||
| 909 | - } | ||
| 910 | - } | ||
| 911 | - | ||
| 912 | - } else { | ||
| 913 | - this._simpleRemove(el, sType, cacheItem[this.WFN], false); | ||
| 914 | - } | ||
| 915 | - | ||
| 916 | - // removed the wrapped handler | ||
| 917 | - delete listeners[index][this.WFN]; | ||
| 918 | - delete listeners[index][this.FN]; | ||
| 919 | - listeners.splice(index, 1); | ||
| 920 | - | ||
| 921 | - return true; | ||
| 922 | - | ||
| 923 | - }, | ||
| 924 | - | ||
| 925 | - /** | ||
| 926 | - * Returns the event's target element | ||
| 927 | - * @method getTarget | ||
| 928 | - * @param {Event} ev the event | ||
| 929 | - * @param {boolean} resolveTextNode when set to true the target's | ||
| 930 | - * parent will be returned if the target is a | ||
| 931 | - * text node. @deprecated, the text node is | ||
| 932 | - * now resolved automatically | ||
| 933 | - * @return {HTMLElement} the event's target | ||
| 934 | - * @static | ||
| 935 | - */ | ||
| 936 | - getTarget: function(ev, resolveTextNode) { | ||
| 937 | - var t = ev.target || ev.srcElement; | ||
| 938 | - return this.resolveTextNode(t); | ||
| 939 | - }, | ||
| 940 | - | ||
| 941 | - /** | ||
| 942 | - * In some cases, some browsers will return a text node inside | ||
| 943 | - * the actual element that was targeted. This normalizes the | ||
| 944 | - * return value for getTarget and getRelatedTarget. | ||
| 945 | - * @method resolveTextNode | ||
| 946 | - * @param {HTMLElement} node node to resolve | ||
| 947 | - * @return {HTMLElement} the normized node | ||
| 948 | - * @static | ||
| 949 | - */ | ||
| 950 | - resolveTextNode: function(node) { | ||
| 951 | - // if (node && node.nodeName && | ||
| 952 | - // "#TEXT" == node.nodeName.toUpperCase()) { | ||
| 953 | - if (node && 3 == node.nodeType) { | ||
| 954 | - return node.parentNode; | ||
| 955 | - } else { | ||
| 956 | - return node; | ||
| 957 | - } | ||
| 958 | - }, | ||
| 959 | - | ||
| 960 | - /** | ||
| 961 | - * Returns the event's pageX | ||
| 962 | - * @method getPageX | ||
| 963 | - * @param {Event} ev the event | ||
| 964 | - * @return {int} the event's pageX | ||
| 965 | - * @static | ||
| 966 | - */ | ||
| 967 | - getPageX: function(ev) { | ||
| 968 | - var x = ev.pageX; | ||
| 969 | - if (!x && 0 !== x) { | ||
| 970 | - x = ev.clientX || 0; | ||
| 971 | - | ||
| 972 | - if ( this.isIE ) { | ||
| 973 | - x += this._getScrollLeft(); | ||
| 974 | - } | ||
| 975 | - } | ||
| 976 | - | ||
| 977 | - return x; | ||
| 978 | - }, | ||
| 979 | - | ||
| 980 | - /** | ||
| 981 | - * Returns the event's pageY | ||
| 982 | - * @method getPageY | ||
| 983 | - * @param {Event} ev the event | ||
| 984 | - * @return {int} the event's pageY | ||
| 985 | - * @static | ||
| 986 | - */ | ||
| 987 | - getPageY: function(ev) { | ||
| 988 | - var y = ev.pageY; | ||
| 989 | - if (!y && 0 !== y) { | ||
| 990 | - y = ev.clientY || 0; | ||
| 991 | - | ||
| 992 | - if ( this.isIE ) { | ||
| 993 | - y += this._getScrollTop(); | ||
| 994 | - } | ||
| 995 | - } | ||
| 996 | - | ||
| 997 | - return y; | ||
| 998 | - }, | ||
| 999 | - | ||
| 1000 | - /** | ||
| 1001 | - * Returns the pageX and pageY properties as an indexed array. | ||
| 1002 | - * @method getXY | ||
| 1003 | - * @type int[] | ||
| 1004 | - * @static | ||
| 1005 | - */ | ||
| 1006 | - getXY: function(ev) { | ||
| 1007 | - return [this.getPageX(ev), this.getPageY(ev)]; | ||
| 1008 | - }, | ||
| 1009 | - | ||
| 1010 | - /** | ||
| 1011 | - * Returns the event's related target | ||
| 1012 | - * @method getRelatedTarget | ||
| 1013 | - * @param {Event} ev the event | ||
| 1014 | - * @return {HTMLElement} the event's relatedTarget | ||
| 1015 | - * @static | ||
| 1016 | - */ | ||
| 1017 | - getRelatedTarget: function(ev) { | ||
| 1018 | - var t = ev.relatedTarget; | ||
| 1019 | - if (!t) { | ||
| 1020 | - if (ev.type == "mouseout") { | ||
| 1021 | - t = ev.toElement; | ||
| 1022 | - } else if (ev.type == "mouseover") { | ||
| 1023 | - t = ev.fromElement; | ||
| 1024 | - } | ||
| 1025 | - } | ||
| 1026 | - | ||
| 1027 | - return this.resolveTextNode(t); | ||
| 1028 | - }, | ||
| 1029 | - | ||
| 1030 | - /** | ||
| 1031 | - * Returns the time of the event. If the time is not included, the | ||
| 1032 | - * event is modified using the current time. | ||
| 1033 | - * @method getTime | ||
| 1034 | - * @param {Event} ev the event | ||
| 1035 | - * @return {Date} the time of the event | ||
| 1036 | - * @static | ||
| 1037 | - */ | ||
| 1038 | - getTime: function(ev) { | ||
| 1039 | - if (!ev.time) { | ||
| 1040 | - var t = new Date().getTime(); | ||
| 1041 | - try { | ||
| 1042 | - ev.time = t; | ||
| 1043 | - } catch(e) { | ||
| 1044 | - return t; | ||
| 1045 | - } | ||
| 1046 | - } | ||
| 1047 | - | ||
| 1048 | - return ev.time; | ||
| 1049 | - }, | ||
| 1050 | - | ||
| 1051 | - /** | ||
| 1052 | - * Convenience method for stopPropagation + preventDefault | ||
| 1053 | - * @method stopEvent | ||
| 1054 | - * @param {Event} ev the event | ||
| 1055 | - * @static | ||
| 1056 | - */ | ||
| 1057 | - stopEvent: function(ev) { | ||
| 1058 | - this.stopPropagation(ev); | ||
| 1059 | - this.preventDefault(ev); | ||
| 1060 | - }, | ||
| 1061 | - | ||
| 1062 | - /** | ||
| 1063 | - * Stops event propagation | ||
| 1064 | - * @method stopPropagation | ||
| 1065 | - * @param {Event} ev the event | ||
| 1066 | - * @static | ||
| 1067 | - */ | ||
| 1068 | - stopPropagation: function(ev) { | ||
| 1069 | - if (ev.stopPropagation) { | ||
| 1070 | - ev.stopPropagation(); | ||
| 1071 | - } else { | ||
| 1072 | - ev.cancelBubble = true; | ||
| 1073 | - } | ||
| 1074 | - }, | ||
| 1075 | - | ||
| 1076 | - /** | ||
| 1077 | - * Prevents the default behavior of the event | ||
| 1078 | - * @method preventDefault | ||
| 1079 | - * @param {Event} ev the event | ||
| 1080 | - * @static | ||
| 1081 | - */ | ||
| 1082 | - preventDefault: function(ev) { | ||
| 1083 | - if (ev.preventDefault) { | ||
| 1084 | - ev.preventDefault(); | ||
| 1085 | - } else { | ||
| 1086 | - ev.returnValue = false; | ||
| 1087 | - } | ||
| 1088 | - }, | ||
| 1089 | - | ||
| 1090 | - /** | ||
| 1091 | - * Finds the event in the window object, the caller's arguments, or | ||
| 1092 | - * in the arguments of another method in the callstack. This is | ||
| 1093 | - * executed automatically for events registered through the event | ||
| 1094 | - * manager, so the implementer should not normally need to execute | ||
| 1095 | - * this function at all. | ||
| 1096 | - * @method getEvent | ||
| 1097 | - * @param {Event} e the event parameter from the handler | ||
| 1098 | - * @return {Event} the event | ||
| 1099 | - * @static | ||
| 1100 | - */ | ||
| 1101 | - getEvent: function(e) { | ||
| 1102 | - var ev = e || window.event; | ||
| 1103 | - | ||
| 1104 | - if (!ev) { | ||
| 1105 | - var c = this.getEvent.caller; | ||
| 1106 | - while (c) { | ||
| 1107 | - ev = c.arguments[0]; | ||
| 1108 | - if (ev && Event == ev.constructor) { | ||
| 1109 | - break; | ||
| 1110 | - } | ||
| 1111 | - c = c.caller; | ||
| 1112 | - } | ||
| 1113 | - } | ||
| 1114 | - | ||
| 1115 | - return ev; | ||
| 1116 | - }, | ||
| 1117 | - | ||
| 1118 | - /** | ||
| 1119 | - * Returns the charcode for an event | ||
| 1120 | - * @method getCharCode | ||
| 1121 | - * @param {Event} ev the event | ||
| 1122 | - * @return {int} the event's charCode | ||
| 1123 | - * @static | ||
| 1124 | - */ | ||
| 1125 | - getCharCode: function(ev) { | ||
| 1126 | - return ev.charCode || ev.keyCode || 0; | ||
| 1127 | - }, | ||
| 1128 | - | ||
| 1129 | - /** | ||
| 1130 | - * Locating the saved event handler data by function ref | ||
| 1131 | - * | ||
| 1132 | - * @method _getCacheIndex | ||
| 1133 | - * @static | ||
| 1134 | - * @private | ||
| 1135 | - */ | ||
| 1136 | - _getCacheIndex: function(el, sType, fn) { | ||
| 1137 | - for (var i=0,len=listeners.length; i<len; ++i) { | ||
| 1138 | - var li = listeners[i]; | ||
| 1139 | - if ( li && | ||
| 1140 | - li[this.FN] == fn && | ||
| 1141 | - li[this.EL] == el && | ||
| 1142 | - li[this.TYPE] == sType ) { | ||
| 1143 | - return i; | ||
| 1144 | - } | ||
| 1145 | - } | ||
| 1146 | - | ||
| 1147 | - return -1; | ||
| 1148 | - }, | ||
| 1149 | - | ||
| 1150 | - /** | ||
| 1151 | - * Generates an unique ID for the element if it does not already | ||
| 1152 | - * have one. | ||
| 1153 | - * @method generateId | ||
| 1154 | - * @param el the element to create the id for | ||
| 1155 | - * @return {string} the resulting id of the element | ||
| 1156 | - * @static | ||
| 1157 | - */ | ||
| 1158 | - generateId: function(el) { | ||
| 1159 | - var id = el.id; | ||
| 1160 | - | ||
| 1161 | - if (!id) { | ||
| 1162 | - id = "yuievtautoid-" + counter; | ||
| 1163 | - ++counter; | ||
| 1164 | - el.id = id; | ||
| 1165 | - } | ||
| 1166 | - | ||
| 1167 | - return id; | ||
| 1168 | - }, | ||
| 1169 | - | ||
| 1170 | - /** | ||
| 1171 | - * We want to be able to use getElementsByTagName as a collection | ||
| 1172 | - * to attach a group of events to. Unfortunately, different | ||
| 1173 | - * browsers return different types of collections. This function | ||
| 1174 | - * tests to determine if the object is array-like. It will also | ||
| 1175 | - * fail if the object is an array, but is empty. | ||
| 1176 | - * @method _isValidCollection | ||
| 1177 | - * @param o the object to test | ||
| 1178 | - * @return {boolean} true if the object is array-like and populated | ||
| 1179 | - * @static | ||
| 1180 | - * @private | ||
| 1181 | - */ | ||
| 1182 | - _isValidCollection: function(o) { | ||
| 1183 | - // this.logger.debug(o.constructor.toString()) | ||
| 1184 | - // this.logger.debug(typeof o) | ||
| 1185 | - | ||
| 1186 | - return ( o && // o is something | ||
| 1187 | - o.length && // o is indexed | ||
| 1188 | - typeof o != "string" && // o is not a string | ||
| 1189 | - !o.tagName && // o is not an HTML element | ||
| 1190 | - !o.alert && // o is not a window | ||
| 1191 | - typeof o[0] != "undefined" ); | ||
| 1192 | - | ||
| 1193 | - }, | ||
| 1194 | - | ||
| 1195 | - /** | ||
| 1196 | - * @private | ||
| 1197 | - * @property elCache | ||
| 1198 | - * DOM element cache | ||
| 1199 | - * @static | ||
| 1200 | - */ | ||
| 1201 | - elCache: {}, | ||
| 1202 | - | ||
| 1203 | - /** | ||
| 1204 | - * We cache elements bound by id because when the unload event | ||
| 1205 | - * fires, we can no longer use document.getElementById | ||
| 1206 | - * @method getEl | ||
| 1207 | - * @static | ||
| 1208 | - * @private | ||
| 1209 | - */ | ||
| 1210 | - getEl: function(id) { | ||
| 1211 | - return document.getElementById(id); | ||
| 1212 | - }, | ||
| 1213 | - | ||
| 1214 | - /** | ||
| 1215 | - * Clears the element cache | ||
| 1216 | - * @deprecated Elements are not cached any longer | ||
| 1217 | - * @method clearCache | ||
| 1218 | - * @static | ||
| 1219 | - * @private | ||
| 1220 | - */ | ||
| 1221 | - clearCache: function() { }, | ||
| 1222 | - | ||
| 1223 | - /** | ||
| 1224 | - * hook up any deferred listeners | ||
| 1225 | - * @method _load | ||
| 1226 | - * @static | ||
| 1227 | - * @private | ||
| 1228 | - */ | ||
| 1229 | - _load: function(e) { | ||
| 1230 | - loadComplete = true; | ||
| 1231 | - var EU = YAHOO.util.Event; | ||
| 1232 | - // Remove the listener to assist with the IE memory issue, but not | ||
| 1233 | - // for other browsers because FF 1.0x does not like it. | ||
| 1234 | - if (this.isIE) { | ||
| 1235 | - EU._simpleRemove(window, "load", EU._load); | ||
| 1236 | - } | ||
| 1237 | - }, | ||
| 1238 | - | ||
| 1239 | - /** | ||
| 1240 | - * Polling function that runs before the onload event fires, | ||
| 1241 | - * attempting to attach to DOM Nodes as soon as they are | ||
| 1242 | - * available | ||
| 1243 | - * @method _tryPreloadAttach | ||
| 1244 | - * @static | ||
| 1245 | - * @private | ||
| 1246 | - */ | ||
| 1247 | - _tryPreloadAttach: function() { | ||
| 1248 | - | ||
| 1249 | - if (this.locked) { | ||
| 1250 | - return false; | ||
| 1251 | - } | ||
| 1252 | - | ||
| 1253 | - this.locked = true; | ||
| 1254 | - | ||
| 1255 | - // keep trying until after the page is loaded. We need to | ||
| 1256 | - // check the page load state prior to trying to bind the | ||
| 1257 | - // elements so that we can be certain all elements have been | ||
| 1258 | - // tested appropriately | ||
| 1259 | - var tryAgain = !loadComplete; | ||
| 1260 | - if (!tryAgain) { | ||
| 1261 | - tryAgain = (retryCount > 0); | ||
| 1262 | - } | ||
| 1263 | - | ||
| 1264 | - // onAvailable | ||
| 1265 | - var notAvail = []; | ||
| 1266 | - for (var i=0,len=onAvailStack.length; i<len ; ++i) { | ||
| 1267 | - var item = onAvailStack[i]; | ||
| 1268 | - if (item) { | ||
| 1269 | - var el = this.getEl(item.id); | ||
| 1270 | - | ||
| 1271 | - if (el) { | ||
| 1272 | - // The element is available, but not necessarily ready | ||
| 1273 | - | ||
| 1274 | - if ( !item.checkReady || | ||
| 1275 | - loadComplete || | ||
| 1276 | - el.nextSibling || | ||
| 1277 | - (document && document.body) ) { | ||
| 1278 | - | ||
| 1279 | - var scope = el; | ||
| 1280 | - if (item.override) { | ||
| 1281 | - if (item.override === true) { | ||
| 1282 | - scope = item.obj; | ||
| 1283 | - } else { | ||
| 1284 | - scope = item.override; | ||
| 1285 | - } | ||
| 1286 | - } | ||
| 1287 | - item.fn.call(scope, item.obj); | ||
| 1288 | - delete onAvailStack[i]; | ||
| 1289 | - } | ||
| 1290 | - } else { | ||
| 1291 | - notAvail.push(item); | ||
| 1292 | - } | ||
| 1293 | - } | ||
| 1294 | - } | ||
| 1295 | - | ||
| 1296 | - retryCount = (notAvail.length === 0) ? 0 : retryCount - 1; | ||
| 1297 | - | ||
| 1298 | - if (tryAgain) { | ||
| 1299 | - this.startInterval(); | ||
| 1300 | - } else { | ||
| 1301 | - clearInterval(this._interval); | ||
| 1302 | - this._interval = null; | ||
| 1303 | - } | ||
| 1304 | - | ||
| 1305 | - this.locked = false; | ||
| 1306 | - | ||
| 1307 | - return true; | ||
| 1308 | - | ||
| 1309 | - }, | ||
| 1310 | - | ||
| 1311 | - /** | ||
| 1312 | - * Removes all listeners attached to the given element via addListener. | ||
| 1313 | - * Optionally, the node's children can also be purged. | ||
| 1314 | - * Optionally, you can specify a specific type of event to remove. | ||
| 1315 | - * @method purgeElement | ||
| 1316 | - * @param {HTMLElement} el the element to purge | ||
| 1317 | - * @param {boolean} recurse recursively purge this element's children | ||
| 1318 | - * as well. Use with caution. | ||
| 1319 | - * @param {string} sType optional type of listener to purge. If | ||
| 1320 | - * left out, all listeners will be removed | ||
| 1321 | - * @static | ||
| 1322 | - */ | ||
| 1323 | - purgeElement: function(el, recurse, sType) { | ||
| 1324 | - var elListeners = this.getListeners(el, sType); | ||
| 1325 | - if (elListeners) { | ||
| 1326 | - for (var i=0,len=elListeners.length; i<len ; ++i) { | ||
| 1327 | - var l = elListeners[i]; | ||
| 1328 | - // can't use the index on the changing collection | ||
| 1329 | - //this.removeListener(el, l.type, l.fn, l.index); | ||
| 1330 | - this.removeListener(el, l.type, l.fn); | ||
| 1331 | - } | ||
| 1332 | - } | ||
| 1333 | - | ||
| 1334 | - if (recurse && el && el.childNodes) { | ||
| 1335 | - for (i=0,len=el.childNodes.length; i<len ; ++i) { | ||
| 1336 | - this.purgeElement(el.childNodes[i], recurse, sType); | ||
| 1337 | - } | ||
| 1338 | - } | ||
| 1339 | - }, | ||
| 1340 | - | ||
| 1341 | - /** | ||
| 1342 | - * Returns all listeners attached to the given element via addListener. | ||
| 1343 | - * Optionally, you can specify a specific type of event to return. | ||
| 1344 | - * @method getListeners | ||
| 1345 | - * @param el {HTMLElement} the element to inspect | ||
| 1346 | - * @param sType {string} optional type of listener to return. If | ||
| 1347 | - * left out, all listeners will be returned | ||
| 1348 | - * @return {Object} the listener. Contains the following fields: | ||
| 1349 | - * type: (string) the type of event | ||
| 1350 | - * fn: (function) the callback supplied to addListener | ||
| 1351 | - * obj: (object) the custom object supplied to addListener | ||
| 1352 | - * adjust: (boolean) whether or not to adjust the default scope | ||
| 1353 | - * index: (int) its position in the Event util listener cache | ||
| 1354 | - * @static | ||
| 1355 | - */ | ||
| 1356 | - getListeners: function(el, sType) { | ||
| 1357 | - var elListeners = []; | ||
| 1358 | - if (listeners && listeners.length > 0) { | ||
| 1359 | - for (var i=0,len=listeners.length; i<len ; ++i) { | ||
| 1360 | - var l = listeners[i]; | ||
| 1361 | - if ( l && l[this.EL] === el && | ||
| 1362 | - (!sType || sType === l[this.TYPE]) ) { | ||
| 1363 | - elListeners.push({ | ||
| 1364 | - type: l[this.TYPE], | ||
| 1365 | - fn: l[this.FN], | ||
| 1366 | - obj: l[this.OBJ], | ||
| 1367 | - adjust: l[this.ADJ_SCOPE], | ||
| 1368 | - index: i | ||
| 1369 | - }); | ||
| 1370 | - } | ||
| 1371 | - } | ||
| 1372 | - } | ||
| 1373 | - | ||
| 1374 | - return (elListeners.length) ? elListeners : null; | ||
| 1375 | - }, | ||
| 1376 | - | ||
| 1377 | - /** | ||
| 1378 | - * Removes all listeners registered by pe.event. Called | ||
| 1379 | - * automatically during the unload event. | ||
| 1380 | - * @method _unload | ||
| 1381 | - * @static | ||
| 1382 | - * @private | ||
| 1383 | - */ | ||
| 1384 | - _unload: function(e) { | ||
| 1385 | - | ||
| 1386 | - var EU = YAHOO.util.Event, i, j, l, len, index; | ||
| 1387 | - | ||
| 1388 | - for (i=0,len=unloadListeners.length; i<len; ++i) { | ||
| 1389 | - l = unloadListeners[i]; | ||
| 1390 | - if (l) { | ||
| 1391 | - var scope = window; | ||
| 1392 | - if (l[EU.ADJ_SCOPE]) { | ||
| 1393 | - if (l[EU.ADJ_SCOPE] === true) { | ||
| 1394 | - scope = l[EU.OBJ]; | ||
| 1395 | - } else { | ||
| 1396 | - scope = l[EU.ADJ_SCOPE]; | ||
| 1397 | - } | ||
| 1398 | - } | ||
| 1399 | - l[EU.FN].call(scope, EU.getEvent(e), l[EU.OBJ] ); | ||
| 1400 | - delete unloadListeners[i]; | ||
| 1401 | - l=null; | ||
| 1402 | - scope=null; | ||
| 1403 | - } | ||
| 1404 | - } | ||
| 1405 | - | ||
| 1406 | - if (listeners && listeners.length > 0) { | ||
| 1407 | - j = listeners.length; | ||
| 1408 | - while (j) { | ||
| 1409 | - index = j-1; | ||
| 1410 | - l = listeners[index]; | ||
| 1411 | - if (l) { | ||
| 1412 | - EU.removeListener(l[EU.EL], l[EU.TYPE], | ||
| 1413 | - l[EU.FN], index); | ||
| 1414 | - } | ||
| 1415 | - j = j - 1; | ||
| 1416 | - } | ||
| 1417 | - l=null; | ||
| 1418 | - | ||
| 1419 | - EU.clearCache(); | ||
| 1420 | - } | ||
| 1421 | - | ||
| 1422 | - for (i=0,len=legacyEvents.length; i<len; ++i) { | ||
| 1423 | - // dereference the element | ||
| 1424 | - delete legacyEvents[i][0]; | ||
| 1425 | - // delete the array item | ||
| 1426 | - delete legacyEvents[i]; | ||
| 1427 | - } | ||
| 1428 | - | ||
| 1429 | - EU._simpleRemove(window, "unload", EU._unload); | ||
| 1430 | - | ||
| 1431 | - }, | ||
| 1432 | - | ||
| 1433 | - /** | ||
| 1434 | - * Returns scrollLeft | ||
| 1435 | - * @method _getScrollLeft | ||
| 1436 | - * @static | ||
| 1437 | - * @private | ||
| 1438 | - */ | ||
| 1439 | - _getScrollLeft: function() { | ||
| 1440 | - return this._getScroll()[1]; | ||
| 1441 | - }, | ||
| 1442 | - | ||
| 1443 | - /** | ||
| 1444 | - * Returns scrollTop | ||
| 1445 | - * @method _getScrollTop | ||
| 1446 | - * @static | ||
| 1447 | - * @private | ||
| 1448 | - */ | ||
| 1449 | - _getScrollTop: function() { | ||
| 1450 | - return this._getScroll()[0]; | ||
| 1451 | - }, | ||
| 1452 | - | ||
| 1453 | - /** | ||
| 1454 | - * Returns the scrollTop and scrollLeft. Used to calculate the | ||
| 1455 | - * pageX and pageY in Internet Explorer | ||
| 1456 | - * @method _getScroll | ||
| 1457 | - * @static | ||
| 1458 | - * @private | ||
| 1459 | - */ | ||
| 1460 | - _getScroll: function() { | ||
| 1461 | - var dd = document.documentElement, db = document.body; | ||
| 1462 | - if (dd && (dd.scrollTop || dd.scrollLeft)) { | ||
| 1463 | - return [dd.scrollTop, dd.scrollLeft]; | ||
| 1464 | - } else if (db) { | ||
| 1465 | - return [db.scrollTop, db.scrollLeft]; | ||
| 1466 | - } else { | ||
| 1467 | - return [0, 0]; | ||
| 1468 | - } | ||
| 1469 | - }, | ||
| 1470 | - | ||
| 1471 | - /** | ||
| 1472 | - * Adds a DOM event directly without the caching, cleanup, scope adj, etc | ||
| 1473 | - * | ||
| 1474 | - * @method _simpleAdd | ||
| 1475 | - * @param {HTMLElement} el the element to bind the handler to | ||
| 1476 | - * @param {string} sType the type of event handler | ||
| 1477 | - * @param {function} fn the callback to invoke | ||
| 1478 | - * @param {boolen} capture capture or bubble phase | ||
| 1479 | - * @static | ||
| 1480 | - * @private | ||
| 1481 | - */ | ||
| 1482 | - _simpleAdd: function () { | ||
| 1483 | - if (window.addEventListener) { | ||
| 1484 | - return function(el, sType, fn, capture) { | ||
| 1485 | - el.addEventListener(sType, fn, (capture)); | ||
| 1486 | - }; | ||
| 1487 | - } else if (window.attachEvent) { | ||
| 1488 | - return function(el, sType, fn, capture) { | ||
| 1489 | - el.attachEvent("on" + sType, fn); | ||
| 1490 | - }; | ||
| 1491 | - } else { | ||
| 1492 | - return function(){}; | ||
| 1493 | - } | ||
| 1494 | - }(), | ||
| 1495 | - | ||
| 1496 | - /** | ||
| 1497 | - * Basic remove listener | ||
| 1498 | - * | ||
| 1499 | - * @method _simpleRemove | ||
| 1500 | - * @param {HTMLElement} el the element to bind the handler to | ||
| 1501 | - * @param {string} sType the type of event handler | ||
| 1502 | - * @param {function} fn the callback to invoke | ||
| 1503 | - * @param {boolen} capture capture or bubble phase | ||
| 1504 | - * @static | ||
| 1505 | - * @private | ||
| 1506 | - */ | ||
| 1507 | - _simpleRemove: function() { | ||
| 1508 | - if (window.removeEventListener) { | ||
| 1509 | - return function (el, sType, fn, capture) { | ||
| 1510 | - el.removeEventListener(sType, fn, (capture)); | ||
| 1511 | - }; | ||
| 1512 | - } else if (window.detachEvent) { | ||
| 1513 | - return function (el, sType, fn) { | ||
| 1514 | - el.detachEvent("on" + sType, fn); | ||
| 1515 | - }; | ||
| 1516 | - } else { | ||
| 1517 | - return function(){}; | ||
| 1518 | - } | ||
| 1519 | - }() | ||
| 1520 | - }; | ||
| 1521 | - | ||
| 1522 | - }(); | ||
| 1523 | - | ||
| 1524 | - (function() { | ||
| 1525 | - var EU = YAHOO.util.Event; | ||
| 1526 | - | ||
| 1527 | - /** | ||
| 1528 | - * YAHOO.util.Event.on is an alias for addListener | ||
| 1529 | - * @method on | ||
| 1530 | - * @see addListener | ||
| 1531 | - * @static | ||
| 1532 | - */ | ||
| 1533 | - EU.on = EU.addListener; | ||
| 1534 | - | ||
| 1535 | - // YAHOO.mix(EU, YAHOO.util.EventProvider.prototype); | ||
| 1536 | - // EU.createEvent("DOMContentReady"); | ||
| 1537 | - // EU.subscribe("DOMContentReady", EU._load); | ||
| 1538 | - | ||
| 1539 | - if (document && document.body) { | ||
| 1540 | - EU._load(); | ||
| 1541 | - } else { | ||
| 1542 | - // EU._simpleAdd(document, "DOMContentLoaded", EU._load); | ||
| 1543 | - EU._simpleAdd(window, "load", EU._load); | ||
| 1544 | - } | ||
| 1545 | - EU._simpleAdd(window, "unload", EU._unload); | ||
| 1546 | - EU._tryPreloadAttach(); | ||
| 1547 | - })(); | ||
| 1548 | -} | ||
| 1549 | - | ||
| 1550 | -/** | ||
| 1551 | - * EventProvider is designed to be used with YAHOO.augment to wrap | ||
| 1552 | - * CustomEvents in an interface that allows events to be subscribed to | ||
| 1553 | - * and fired by name. This makes it possible for implementing code to | ||
| 1554 | - * subscribe to an event that either has not been created yet, or will | ||
| 1555 | - * not be created at all. | ||
| 1556 | - * | ||
| 1557 | - * @Class EventProvider | ||
| 1558 | - */ | ||
| 1559 | -YAHOO.util.EventProvider = function() { }; | ||
| 1560 | - | ||
| 1561 | -YAHOO.util.EventProvider.prototype = { | ||
| 1562 | - | ||
| 1563 | - /** | ||
| 1564 | - * Private storage of custom events | ||
| 1565 | - * @property __yui_events | ||
| 1566 | - * @type Object[] | ||
| 1567 | - * @private | ||
| 1568 | - */ | ||
| 1569 | - __yui_events: null, | ||
| 1570 | - | ||
| 1571 | - /** | ||
| 1572 | - * Private storage of custom event subscribers | ||
| 1573 | - * @property __yui_subscribers | ||
| 1574 | - * @type Object[] | ||
| 1575 | - * @private | ||
| 1576 | - */ | ||
| 1577 | - __yui_subscribers: null, | ||
| 1578 | - | ||
| 1579 | - /** | ||
| 1580 | - * Subscribe to a CustomEvent by event type | ||
| 1581 | - * | ||
| 1582 | - * @method subscribe | ||
| 1583 | - * @param p_type {string} the type, or name of the event | ||
| 1584 | - * @param p_fn {function} the function to exectute when the event fires | ||
| 1585 | - * @param p_obj | ||
| 1586 | - * @param p_obj {Object} An object to be passed along when the event | ||
| 1587 | - * fires | ||
| 1588 | - * @param p_override {boolean} If true, the obj passed in becomes the | ||
| 1589 | - * execution scope of the listener | ||
| 1590 | - */ | ||
| 1591 | - subscribe: function(p_type, p_fn, p_obj, p_override) { | ||
| 1592 | - | ||
| 1593 | - this.__yui_events = this.__yui_events || {}; | ||
| 1594 | - var ce = this.__yui_events[p_type]; | ||
| 1595 | - | ||
| 1596 | - if (ce) { | ||
| 1597 | - ce.subscribe(p_fn, p_obj, p_override); | ||
| 1598 | - } else { | ||
| 1599 | - this.__yui_subscribers = this.__yui_subscribers || {}; | ||
| 1600 | - var subs = this.__yui_subscribers; | ||
| 1601 | - if (!subs[p_type]) { | ||
| 1602 | - subs[p_type] = []; | ||
| 1603 | - } | ||
| 1604 | - subs[p_type].push( | ||
| 1605 | - { fn: p_fn, obj: p_obj, override: p_override } ); | ||
| 1606 | - } | ||
| 1607 | - }, | ||
| 1608 | - | ||
| 1609 | - /** | ||
| 1610 | - * Unsubscribes the from the specified event | ||
| 1611 | - * @method unsubscribe | ||
| 1612 | - * @param p_type {string} The type, or name of the event | ||
| 1613 | - * @param p_fn {Function} The function to execute | ||
| 1614 | - * @param p_obj {Object} The custom object passed to subscribe (optional) | ||
| 1615 | - * @return {boolean} true if the subscriber was found and detached. | ||
| 1616 | - */ | ||
| 1617 | - unsubscribe: function(p_type, p_fn, p_obj) { | ||
| 1618 | - this.__yui_events = this.__yui_events || {}; | ||
| 1619 | - var ce = this.__yui_events[p_type]; | ||
| 1620 | - if (ce) { | ||
| 1621 | - return ce.unsubscribe(p_fn, p_obj); | ||
| 1622 | - } else { | ||
| 1623 | - return false; | ||
| 1624 | - } | ||
| 1625 | - }, | ||
| 1626 | - | ||
| 1627 | - /** | ||
| 1628 | - * Creates a new custom event of the specified type. If a custom event | ||
| 1629 | - * by that name already exists, it will not be re-created. In either | ||
| 1630 | - * case the custom event is returned. | ||
| 1631 | - * | ||
| 1632 | - * @method createEvent | ||
| 1633 | - * | ||
| 1634 | - * @param p_type {string} the type, or name of the event | ||
| 1635 | - * @param p_config {object} optional config params. Valid properties are: | ||
| 1636 | - * | ||
| 1637 | - * <ul> | ||
| 1638 | - * <li> | ||
| 1639 | - * scope: defines the default execution scope. If not defined | ||
| 1640 | - * the default scope will be this instance. | ||
| 1641 | - * </li> | ||
| 1642 | - * <li> | ||
| 1643 | - * silent: if true, the custom event will not generate log messages. | ||
| 1644 | - * This is false by default. | ||
| 1645 | - * </li> | ||
| 1646 | - * <li> | ||
| 1647 | - * onSubscribeCallback: specifies a callback to execute when the | ||
| 1648 | - * event has a new subscriber. This will fire immediately for | ||
| 1649 | - * each queued subscriber if any exist prior to the creation of | ||
| 1650 | - * the event. | ||
| 1651 | - * </li> | ||
| 1652 | - * </ul> | ||
| 1653 | - * | ||
| 1654 | - * @return {CustomEvent} the custom event | ||
| 1655 | - * | ||
| 1656 | - */ | ||
| 1657 | - createEvent: function(p_type, p_config) { | ||
| 1658 | - | ||
| 1659 | - this.__yui_events = this.__yui_events || {}; | ||
| 1660 | - var opts = p_config || {}; | ||
| 1661 | - var events = this.__yui_events; | ||
| 1662 | - | ||
| 1663 | - if (events[p_type]) { | ||
| 1664 | - } else { | ||
| 1665 | - | ||
| 1666 | - var scope = opts.scope || this; | ||
| 1667 | - var silent = opts.silent || null; | ||
| 1668 | - | ||
| 1669 | - var ce = new YAHOO.util.CustomEvent(p_type, scope, silent, | ||
| 1670 | - YAHOO.util.CustomEvent.FLAT); | ||
| 1671 | - events[p_type] = ce; | ||
| 1672 | - | ||
| 1673 | - if (opts.onSubscribeCallback) { | ||
| 1674 | - ce.subscribeEvent.subscribe(opts.onSubscribeCallback); | ||
| 1675 | - } | ||
| 1676 | - | ||
| 1677 | - this.__yui_subscribers = this.__yui_subscribers || {}; | ||
| 1678 | - var qs = this.__yui_subscribers[p_type]; | ||
| 1679 | - | ||
| 1680 | - if (qs) { | ||
| 1681 | - for (var i=0; i<qs.length; ++i) { | ||
| 1682 | - ce.subscribe(qs[i].fn, qs[i].obj, qs[i].override); | ||
| 1683 | - } | ||
| 1684 | - } | ||
| 1685 | - } | ||
| 1686 | - | ||
| 1687 | - return events[p_type]; | ||
| 1688 | - }, | ||
| 1689 | - | ||
| 1690 | - /** | ||
| 1691 | - * Fire a custom event by name. The callback functions will be executed | ||
| 1692 | - * from the scope specified when the event was created, and with the | ||
| 1693 | - * following parameters: | ||
| 1694 | - * <ul> | ||
| 1695 | - * <li>The first argument fire() was executed with</li> | ||
| 1696 | - * <li>The custom object (if any) that was passed into the subscribe() | ||
| 1697 | - * method</li> | ||
| 1698 | - * </ul> | ||
| 1699 | - * @method fireEvent | ||
| 1700 | - * @param p_type {string} the type, or name of the event | ||
| 1701 | - * @param arguments {Object*} an arbitrary set of parameters to pass to | ||
| 1702 | - * the handler. | ||
| 1703 | - * @return {boolean} the return value from CustomEvent.fire, or null if | ||
| 1704 | - * the custom event does not exist. | ||
| 1705 | - */ | ||
| 1706 | - fireEvent: function(p_type, arg1, arg2, etc) { | ||
| 1707 | - | ||
| 1708 | - this.__yui_events = this.__yui_events || {}; | ||
| 1709 | - var ce = this.__yui_events[p_type]; | ||
| 1710 | - | ||
| 1711 | - if (ce) { | ||
| 1712 | - var args = []; | ||
| 1713 | - for (var i=1; i<arguments.length; ++i) { | ||
| 1714 | - args.push(arguments[i]); | ||
| 1715 | - } | ||
| 1716 | - return ce.fire.apply(ce, args); | ||
| 1717 | - } else { | ||
| 1718 | - return null; | ||
| 1719 | - } | ||
| 1720 | - }, | ||
| 1721 | - | ||
| 1722 | - /** | ||
| 1723 | - * Returns true if the custom event of the provided type has been created | ||
| 1724 | - * with createEvent. | ||
| 1725 | - * @method hasEvent | ||
| 1726 | - * @param type {string} the type, or name of the event | ||
| 1727 | - */ | ||
| 1728 | - hasEvent: function(type) { | ||
| 1729 | - if (this.__yui_events) { | ||
| 1730 | - if (this.__yui_events[type]) { | ||
| 1731 | - return true; | ||
| 1732 | - } | ||
| 1733 | - } | ||
| 1734 | - return false; | ||
| 1735 | - } | ||
| 1736 | - | ||
| 1737 | -}; | ||
| 1738 | - | 1 | +YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_a){var _b=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_a)){this._delete(i);_b=true;}}return _b;},fire:function(){var _e=this.subscribers.length;if(!_e&&this.silent){return true;}var _f=[],ret=true,i;for(i=0;i<arguments.length;++i){_f.push(arguments[i]);}var _10=_f.length;if(!this.silent){}for(i=0;i<_e;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _12=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var _13=null;if(_f.length>0){_13=_f[0];}ret=s.fn.call(_12,_13,s.obj);}else{ret=s.fn.call(_12,this.type,_f,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_15){var s=this.subscribers[_15];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_15,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_19){this.fn=fn;this.obj=obj||null;this.override=_19;};YAHOO.util.Subscriber.prototype.getScope=function(_1a){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return _1a;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return (this.fn==fn&&this.obj==obj);}else{return (this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _1d=false;var _1e=[];var _1f=[];var _20=[];var _21=[];var _22=0;var _23=[];var _24=[];var _25=0;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var _26=this;var _27=function(){_26._tryPreloadAttach();};this._interval=setInterval(_27,this.POLL_INTERVAL);}},onAvailable:function(_28,_29,_2a,_2b){_23.push({id:_28,fn:_29,obj:_2a,override:_2b,checkReady:false});_22=this.POLL_RETRYS;this.startInterval();},onContentReady:function(_2c,_2d,_2e,_2f){_23.push({id:_2c,fn:_2d,obj:_2e,override:_2f,checkReady:true});_22=this.POLL_RETRYS;this.startInterval();},addListener:function(el,_31,fn,obj,_34){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],_31,fn,obj,_34)&&ok;}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,_31,fn,obj,_34);});return true;}}}if(!el){return false;}if("unload"==_31&&obj!==this){_1f[_1f.length]=[el,_31,fn,obj,_34];return true;}var _38=el;if(_34){if(_34===true){_38=obj;}else{_38=_34;}}var _39=function(e){return fn.call(_38,YAHOO.util.Event.getEvent(e),obj);};var li=[el,_31,fn,_39,_38];var _3c=_1e.length;_1e[_3c]=li;if(this.useLegacyEvent(el,_31)){var _3d=this.getLegacyIndex(el,_31);if(_3d==-1||el!=_20[_3d][0]){_3d=_20.length;_24[el.id+_31]=_3d;_20[_3d]=[el,_31,el["on"+_31]];_21[_3d]=[];el["on"+_31]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_3d);};}_21[_3d].push(li);}else{this._simpleAdd(el,_31,_39,false);}return true;},fireLegacyEvent:function(e,_40){var ok=true;var le=_21[_40];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _45=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_45,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_48){var key=this.generateId(el)+_48;if(typeof _24[key]=="undefined"){return -1;}else{return _24[key];}},useLegacyEvent:function(el,_4b){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_4b||"dblclick"==_4b){return true;}}}return false;},removeListener:function(el,_4d,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_4d,fn)&&ok);}return ok;}}if(!fn||!fn.call){return this.purgeElement(el,false,_4d);}if("unload"==_4d){for(i=0,len=_1f.length;i<len;i++){var li=_1f[i];if(li&&li[0]==el&&li[1]==_4d&&li[2]==fn){_1f.splice(i,1);return true;}}return false;}var _52=null;var _53=arguments[3];if("undefined"==typeof _53){_53=this._getCacheIndex(el,_4d,fn);}if(_53>=0){_52=_1e[_53];}if(!el||!_52){return false;}if(this.useLegacyEvent(el,_4d)){var _54=this.getLegacyIndex(el,_4d);var _55=_21[_54];if(_55){for(i=0,len=_55.length;i<len;++i){li=_55[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_4d&&li[this.FN]==fn){_55.splice(i,1);break;}}}}else{this._simpleRemove(el,_4d,_52[this.WFN],false);}delete _1e[_53][this.WFN];delete _1e[_53][this.FN];_1e.splice(_53,1);return true;},getTarget:function(ev,_57){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_59){if(_59&&3==_59.nodeType){return _59.parentNode;}else{return _59;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,_6b,fn){for(var i=0,len=_1e.length;i<len;++i){var li=_1e[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_6b){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_25;++_25;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_1d=true;var EU=YAHOO.util.Event;if(this.isIE){EU._simpleRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _75=!_1d;if(!_75){_75=(_22>0);}var _76=[];for(var i=0,len=_23.length;i<len;++i){var _78=_23[i];if(_78){var el=this.getEl(_78.id);if(el){if(!_78.checkReady||_1d||el.nextSibling||(document&&document.body)){var _7a=el;if(_78.override){if(_78.override===true){_7a=_78.obj;}else{_7a=_78.override;}}_78.fn.call(_7a,_78.obj);delete _23[i];}}else{_76.push(_78);}}}_22=(_76.length===0)?0:_22-1;if(_75){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,_7c,_7d){var _7e=this.getListeners(el,_7d);if(_7e){for(var i=0,len=_7e.length;i<len;++i){var l=_7e[i];this.removeListener(el,l.type,l.fn);}}if(_7c&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_7c,_7d);}}},getListeners:function(el,_82){var _83=[];if(_1e&&_1e.length>0){for(var i=0,len=_1e.length;i<len;++i){var l=_1e[i];if(l&&l[this.EL]===el&&(!_82||_82===l[this.TYPE])){_83.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_83.length)?_83:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=_1f.length;i<len;++i){l=_1f[i];if(l){var _88=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){_88=l[EU.OBJ];}else{_88=l[EU.ADJ_SCOPE];}}l[EU.FN].call(_88,EU.getEvent(e),l[EU.OBJ]);delete _1f[i];l=null;_88=null;}}if(_1e&&_1e.length>0){j=_1e.length;while(j){index=j-1;l=_1e[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_20.length;i<len;++i){delete _20[i][0];delete _20[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(){if(window.addEventListener){return function(el,_8b,fn,_8d){el.addEventListener(_8b,fn,(_8d));};}else{if(window.attachEvent){return function(el,_8f,fn,_91){el.attachEvent("on"+_8f,fn);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,_93,fn,_95){el.removeEventListener(_93,fn,(_95));};}else{if(window.detachEvent){return function(el,_97,fn){el.detachEvent("on"+_97,fn);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(document&&document.body){EU._load();}else{EU._simpleAdd(window,"load",EU._load);}EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(_9a,_9b,_9c,_9d){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_9a];if(ce){ce.subscribe(_9b,_9c,_9d);}else{this.__yui_subscribers=this.__yui_subscribers||{};var _9f=this.__yui_subscribers;if(!_9f[_9a]){_9f[_9a]=[];}_9f[_9a].push({fn:_9b,obj:_9c,override:_9d});}},unsubscribe:function(_a0,_a1,_a2){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_a0];if(ce){return ce.unsubscribe(_a1,_a2);}else{return false;}},createEvent:function(_a4,_a5){this.__yui_events=this.__yui_events||{};var _a6=_a5||{};var _a7=this.__yui_events;if(_a7[_a4]){}else{var _a8=_a6.scope||this;var _a9=_a6.silent||null;var ce=new YAHOO.util.CustomEvent(_a4,_a8,_a9,YAHOO.util.CustomEvent.FLAT);_a7[_a4]=ce;if(_a6.onSubscribeCallback){ce.subscribeEvent.subscribe(_a6.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[_a4];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}return _a7[_a4];},fireEvent:function(_ad,_ae,_af,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_ad];if(ce){var _b2=[];for(var i=1;i<arguments.length;++i){_b2.push(arguments[i]);}return ce.fire.apply(ce,_b2);}else{return null;}},hasEvent:function(_b4){if(this.__yui_events){if(this.__yui_events[_b4]){return true;}}return false;}}; |
| 1739 | \ No newline at end of file | 2 | \ No newline at end of file |
thirdpartyjs/yui/tools/tools.js
| 1 | -/** | ||
| 2 | -* @fileoverview | ||
| 3 | -* <p>General Tools.</p> | ||
| 4 | -* <p>Now contains a modified version of Douglas Crockford's json.js that doesn't | ||
| 5 | -* mess with the DOM's prototype methods | ||
| 6 | -* http://www.json.org/js.html</p> | ||
| 7 | -* @author Dav Glass <dav.glass@yahoo.com> | ||
| 8 | -* @version 1.0 | ||
| 9 | -* @requires YAHOO | ||
| 10 | -* @requires YAHOO.util.Dom | ||
| 11 | -* @requires YAHOO.util.Event | ||
| 12 | -* | ||
| 13 | -* @constructor | ||
| 14 | -* @class General Tools. | ||
| 15 | -*/ | ||
| 16 | -YAHOO.Tools = function() { | ||
| 17 | - keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | ||
| 18 | - /** | ||
| 19 | - * Moved all regexes to the top level object to cache them. | ||
| 20 | - * @type Object | ||
| 21 | - */ | ||
| 22 | - regExs = { | ||
| 23 | - quotes: /\x22/g, | ||
| 24 | - startspace: /^\s+/g, | ||
| 25 | - endspace: /\s+$/g, | ||
| 26 | - striptags: /<\/?[^>]+>/gi, | ||
| 27 | - hasbr: /<br/i, | ||
| 28 | - hasp: /<p>/i, | ||
| 29 | - rbr: /<br>/gi, | ||
| 30 | - rbr2: /<br\/>/gi, | ||
| 31 | - rendp: /<\/p>/gi, | ||
| 32 | - rp: /<p>/gi, | ||
| 33 | - base64: /[^A-Za-z0-9\+\/\=]/g, | ||
| 34 | - syntaxCheck: /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/ | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - jsonCodes = { | ||
| 38 | - '\b': '\\b', | ||
| 39 | - '\t': '\\t', | ||
| 40 | - '\n': '\\n', | ||
| 41 | - '\f': '\\f', | ||
| 42 | - '\r': '\\r', | ||
| 43 | - '"' : '\\"', | ||
| 44 | - '\\': '\\\\' | ||
| 45 | - } | ||
| 46 | - return { | ||
| 47 | - version: '1.0' | ||
| 48 | - } | ||
| 49 | -}(); | ||
| 50 | -/** | ||
| 51 | -* This normalizes getting the height of an element in IE | ||
| 52 | -* @param {String/HTMLElement} elm The element to get the height of | ||
| 53 | -* @returns The Height in pixels | ||
| 54 | -* @type String | ||
| 55 | -*/ | ||
| 56 | -YAHOO.Tools.getHeight = function(elm) { | ||
| 57 | - var elm = $(elm); | ||
| 58 | - var h = $D.getStyle(elm, 'height'); | ||
| 59 | - if (h == 'auto') { | ||
| 60 | - elm.style.zoom = 1; | ||
| 61 | - h = elm.clientHeight + 'px'; | ||
| 62 | - } | ||
| 63 | - return h; | ||
| 64 | -} | ||
| 65 | -/** | ||
| 66 | -* Get the XY coords required to place the element at the center of the screen | ||
| 67 | -* @param {String/HTMLElement} elm The element to place at the center of the screen | ||
| 68 | -* @returns The XY coords required to place the element at the center of the screen | ||
| 69 | -* @type Array | ||
| 70 | -*/ | ||
| 71 | -YAHOO.Tools.getCenter = function(elm) { | ||
| 72 | - var elm = $(elm); | ||
| 73 | - var cX = Math.round(($D.getViewportWidth() - parseInt($D.getStyle(elm, 'width'))) / 2); | ||
| 74 | - var cY = Math.round(($D.getViewportHeight() - parseInt(this.getHeight(elm))) / 2); | ||
| 75 | - return [cX, cY]; | ||
| 76 | -} | ||
| 77 | - | ||
| 78 | -/** | ||
| 79 | -* Converts a text string into a DOM object | ||
| 80 | -* @param {String} txt String to convert | ||
| 81 | -* @returns A string to a textNode | ||
| 82 | -*/ | ||
| 83 | -YAHOO.Tools.makeTextObject = function(txt) { | ||
| 84 | - return document.createTextNode(txt); | ||
| 85 | -} | ||
| 86 | -/** | ||
| 87 | -* Takes an Array of DOM objects and appends them as a child to the main Element | ||
| 88 | -* @param {Array} arr Array of elements to append to elm. | ||
| 89 | -* @param {HTMLElement/String} elm A reference or ID to the main Element that the children will be appended to | ||
| 90 | -*/ | ||
| 91 | -YAHOO.Tools.makeChildren = function(arr, elm) { | ||
| 92 | - var elm = $(elm); | ||
| 93 | - for (var i in arr) { | ||
| 94 | - _val = arr[i]; | ||
| 95 | - if (typeof _val == 'string') { | ||
| 96 | - _val = this.makeTxtObject(_val); | ||
| 97 | - } | ||
| 98 | - elm.appendChild(_val); | ||
| 99 | - } | ||
| 100 | -} | ||
| 101 | -/** | ||
| 102 | -* Converts a standard CSS string to a Javascriptable Camel Case variable name | ||
| 103 | -* @param {String} str The CSS string to convert to camel case Javascript String | ||
| 104 | -* Example:<br> | ||
| 105 | -* background-color<br> | ||
| 106 | -* backgroundColor<br><br> | ||
| 107 | -* list-style-type<br> | ||
| 108 | -* listStyleType | ||
| 109 | -*/ | ||
| 110 | -YAHOO.Tools.styleToCamel = function(str) { | ||
| 111 | - var _tmp = str.split('-'); | ||
| 112 | - var _new_style = _tmp[0]; | ||
| 113 | - for (var i = 1; i < _tmp.length; i++) { | ||
| 114 | - _new_style += _tmp[i].substring(0, 1).toUpperCase() + _tmp[i].substring(1, _tmp[i].length); | ||
| 115 | - } | ||
| 116 | - return _new_style; | ||
| 117 | -} | ||
| 118 | -/** | ||
| 119 | -* Removes " from a given string | ||
| 120 | -* @param {String} str The string to remove quotes from | ||
| 121 | -*/ | ||
| 122 | -YAHOO.Tools.removeQuotes = function(str) { | ||
| 123 | - var checkText = new String(str); | ||
| 124 | - return String(checkText.replace(regExs.quotes, '')); | ||
| 125 | -} | ||
| 126 | -/** | ||
| 127 | -* Trims starting and trailing white space from a string. | ||
| 128 | -* @param {String} str The string to trim | ||
| 129 | -*/ | ||
| 130 | -YAHOO.Tools.trim = function(str) { | ||
| 131 | - return str.replace(regExs.startspace, '').replace(regExs.endspace, ''); | ||
| 132 | -} | ||
| 133 | -/** | ||
| 134 | -* Removes all HTML tags from a string. | ||
| 135 | -* @param {String} str The string to remove HTML from | ||
| 136 | -*/ | ||
| 137 | -YAHOO.Tools.stripTags = function(str) { | ||
| 138 | - return str.replace(regExs.striptags, ''); | ||
| 139 | -} | ||
| 140 | -/** | ||
| 141 | -* Returns True/False if it finds BR' or P's | ||
| 142 | -* @param {String} str The string to search | ||
| 143 | -*/ | ||
| 144 | -YAHOO.Tools.hasBRs = function(str) { | ||
| 145 | - return str.match(regExs.hasbr) || str.match(regExs.hasp); | ||
| 146 | -} | ||
| 147 | -/** | ||
| 148 | -* Converts BR's and P's to Plain Text Line Feeds | ||
| 149 | -* @param {String} str The string to search | ||
| 150 | -*/ | ||
| 151 | -YAHOO.Tools.convertBRs2NLs = function(str) { | ||
| 152 | - return str.replace(regExs.rbr, "\n").replace(regExs.rbr2, "\n").replace(regExs.rendp, "\n").replace(regExs.rp, ""); | ||
| 153 | -} | ||
| 154 | -/** | ||
| 155 | -* Repeats a string n number of times | ||
| 156 | -* @param {String} str The string to repeat | ||
| 157 | -* @param {Integer} repeat Number of times to repeat it | ||
| 158 | -* @returns Repeated string | ||
| 159 | -* @type String | ||
| 160 | -*/ | ||
| 161 | -YAHOO.Tools.stringRepeat = function(str, repeat) { | ||
| 162 | - return new Array(repeat + 1).join(str); | ||
| 163 | -} | ||
| 164 | -/** | ||
| 165 | -* Reverses a string | ||
| 166 | -* @param {String} str The string to reverse | ||
| 167 | -* @returns Reversed string | ||
| 168 | -* @type String | ||
| 169 | -*/ | ||
| 170 | -YAHOO.Tools.stringReverse = function(str) { | ||
| 171 | - var new_str = ''; | ||
| 172 | - for (i = 0; i < str.length; i++) { | ||
| 173 | - new_str = new_str + str.charAt((str.length -1) -i); | ||
| 174 | - } | ||
| 175 | - return new_str; | ||
| 176 | -} | ||
| 177 | -/** | ||
| 178 | -* printf function written in Javascript<br> | ||
| 179 | -* <pre>var test = "You are viewing messages {0} - {1} out of {2}"; | ||
| 180 | -* YAHOO.Tools.printf(test, '5', '25', '500');</pre><br> | ||
| 181 | -* This will return a string like:<br> | ||
| 182 | -* "You are view messages 5 - 25 out of 500"<br> | ||
| 183 | -* Patched provided by: Peter Foti <foti-1@comcast.net><br> | ||
| 184 | -* @param {String} string | ||
| 185 | -* @returns Parsed String | ||
| 186 | -* @type String | ||
| 187 | -*/ | ||
| 188 | -YAHOO.Tools.printf = function() { | ||
| 189 | - var num = arguments.length; | ||
| 190 | - var oStr = arguments[0]; | ||
| 191 | - | ||
| 192 | - for (var i = 1; i < num; i++) { | ||
| 193 | - var pattern = "\\{" + (i-1) + "\\}"; | ||
| 194 | - var re = new RegExp(pattern, "g"); | ||
| 195 | - oStr = oStr.replace(re, arguments[i]); | ||
| 196 | - } | ||
| 197 | - return oStr; | ||
| 198 | -} | ||
| 199 | -/** | ||
| 200 | -* Trims starting and trailing white space from a string. | ||
| 201 | -* @param {HTMLElement/Array/String} el Single element, array of elements or id string to apply the style string to | ||
| 202 | -* @param {String} str The CSS string to apply to the elements | ||
| 203 | -* Example: | ||
| 204 | -* color: black; text-decoration: none; background-color: yellow; | ||
| 205 | -*/ | ||
| 206 | -YAHOO.Tools.setStyleString = function(el, str) { | ||
| 207 | - var _tmp = str.split(';'); | ||
| 208 | - for (x in _tmp) { | ||
| 209 | - if (x) { | ||
| 210 | - __tmp = YAHOO.Tools.trim(_tmp[x]); | ||
| 211 | - __tmp = _tmp[x].split(':'); | ||
| 212 | - if (__tmp[0] && __tmp[1]) { | ||
| 213 | - var _attr = YAHOO.Tools.trim(__tmp[0]); | ||
| 214 | - var _val = YAHOO.Tools.trim(__tmp[1]); | ||
| 215 | - if (_attr && _val) { | ||
| 216 | - if (_attr.indexOf('-') != -1) { | ||
| 217 | - _attr = YAHOO.Tools.styleToCamel(_attr); | ||
| 218 | - } | ||
| 219 | - $D.setStyle(el, _attr, _val); | ||
| 220 | - } | ||
| 221 | - } | ||
| 222 | - } | ||
| 223 | - } | ||
| 224 | -} | ||
| 225 | -/** | ||
| 226 | -* Gets the currently selected text | ||
| 227 | -* @param {Object} _document Optional. Reference to the document object | ||
| 228 | -* @param {Object} _window Optional. Reference to the window object | ||
| 229 | -* Both parameters are optional, but if you give one you need to give both.<br> | ||
| 230 | -* The reason for the parameters is if you are dealing with an iFrame or FrameSet, | ||
| 231 | -* you need to specify the document and the window of the frame you want to get the selection for | ||
| 232 | -*/ | ||
| 233 | -YAHOO.Tools.getSelection = function(_document, _window) { | ||
| 234 | - if (!_document) { _document = document; } | ||
| 235 | - if (!_window) { _window = window; } | ||
| 236 | - if (_document.selection) { | ||
| 237 | - return _document.selection; | ||
| 238 | - } | ||
| 239 | - return _window.getSelection(); | ||
| 240 | -} | ||
| 241 | -/** | ||
| 242 | -* Remove the element from the document. | ||
| 243 | -* @param {HTMLElement/Array/String} el Single element, array of elements or id string to remove from the document | ||
| 244 | -* This function needs to be extended to remove all of the child elements & their listeners. | ||
| 245 | -*/ | ||
| 246 | -YAHOO.Tools.removeElement = function(el) { | ||
| 247 | - if (!(el instanceof Array)) { | ||
| 248 | - el = new Array($(el)); | ||
| 249 | - } | ||
| 250 | - for (var i = 0; i < el.length; i++) { | ||
| 251 | - if (el[i].parentNode) { | ||
| 252 | - el[i].parentNode.removeChild(el); | ||
| 253 | - } | ||
| 254 | - } | ||
| 255 | -} | ||
| 256 | -/** | ||
| 257 | -* Set a cookie. | ||
| 258 | -* @param {String} name The name of the cookie to be set | ||
| 259 | -* @param {String} value The value of the cookie | ||
| 260 | -* @param {String} expires A valid Javascript Date object | ||
| 261 | -* @param {String} path The path of the cookie (Deaults to /) | ||
| 262 | -* @param {String} domain The domain to attach the cookie to | ||
| 263 | -* @param {Booleen} secure Booleen True or False | ||
| 264 | -*/ | ||
| 265 | -YAHOO.Tools.setCookie = function(name, value, expires, path, domain, secure) { | ||
| 266 | - var argv = arguments; | ||
| 267 | - var argc = arguments.length; | ||
| 268 | - var expires = (argc > 2) ? argv[2] : null; | ||
| 269 | - var path = (argc > 3) ? argv[3] : '/'; | ||
| 270 | - var domain = (argc > 4) ? argv[4] : null; | ||
| 271 | - var secure = (argc > 5) ? argv[5] : false; | ||
| 272 | - document.cookie = name + "=" + escape (value) + | ||
| 273 | - ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + | ||
| 274 | - ((path == null) ? "" : ("; path=" + path)) + | ||
| 275 | - ((domain == null) ? "" : ("; domain=" + domain)) + | ||
| 276 | - ((secure == true) ? "; secure" : ""); | ||
| 277 | -} | ||
| 278 | - | ||
| 279 | -/** | ||
| 280 | -* Get the value of a cookie. | ||
| 281 | -* @param {String} name The name of the cookie to get | ||
| 282 | -*/ | ||
| 283 | -YAHOO.Tools.getCookie = function(name) { | ||
| 284 | - var dc = document.cookie; | ||
| 285 | - var prefix = name + '='; | ||
| 286 | - var begin = dc.indexOf('; ' + prefix); | ||
| 287 | - if (begin == -1) { | ||
| 288 | - begin = dc.indexOf(prefix); | ||
| 289 | - if (begin != 0) return null; | ||
| 290 | - } else { | ||
| 291 | - begin += 2; | ||
| 292 | - } | ||
| 293 | - var end = document.cookie.indexOf(';', begin); | ||
| 294 | - if (end == -1) { | ||
| 295 | - end = dc.length; | ||
| 296 | - } | ||
| 297 | - return unescape(dc.substring(begin + prefix.length, end)); | ||
| 298 | -} | ||
| 299 | -/** | ||
| 300 | -* Delete a cookie | ||
| 301 | -* @param {String} name The name of the cookie to delete. | ||
| 302 | -*/ | ||
| 303 | -YAHOO.Tools.deleteCookie = function(name, path, domain) { | ||
| 304 | - if (getCookie(name)) { | ||
| 305 | - document.cookie = name + '=' + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT'; | ||
| 306 | - } | ||
| 307 | -} | ||
| 308 | -/** | ||
| 309 | -* Object based Browser Engine Detection<br> | ||
| 310 | -* The returned object will look like:<br> | ||
| 311 | -* <pre> | ||
| 312 | -* obj { | ||
| 313 | -* ua: 'Full UserAgent String' | ||
| 314 | -* opera: boolean | ||
| 315 | -* safari: boolean | ||
| 316 | -* gecko: boolean | ||
| 317 | -* msie: boolean | ||
| 318 | -* version: string | ||
| 319 | -* } | ||
| 320 | -* </pre> | ||
| 321 | -* @return Browser Information Object | ||
| 322 | -* @type Object | ||
| 323 | -*/ | ||
| 324 | -YAHOO.Tools.getBrowserEngine = function() { | ||
| 325 | - var opera = ((window.opera && window.opera.version) ? true : false); | ||
| 326 | - var safari = ((navigator.vendor && navigator.vendor.indexOf('Apple') != -1) ? true : false); | ||
| 327 | - var gecko = ((document.getElementById && !document.all && !opera && !safari) ? true : false); | ||
| 328 | - var msie = ((window.ActiveXObject) ? true : false); | ||
| 329 | - var version = false; | ||
| 330 | - if (msie) { | ||
| 331 | - /** | ||
| 332 | - * This checks for the maxHeight style property. | ||
| 333 | - * I.E. 7 has this | ||
| 334 | - */ | ||
| 335 | - if (typeof document.body.style.maxHeight != "undefined") { | ||
| 336 | - version = '7'; | ||
| 337 | - } else { | ||
| 338 | - /** | ||
| 339 | - * Fall back to 6 (might need to find a 5.5 object too...). | ||
| 340 | - */ | ||
| 341 | - version = '6'; | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | - if (opera) { | ||
| 345 | - /** | ||
| 346 | - * The window.opera object has a method called version(); | ||
| 347 | - * Here we only grab the first 2 parts of the dotted string to get 9.01, 9.02, etc.. | ||
| 348 | - */ | ||
| 349 | - var tmp_version = window.opera.version().split('.'); | ||
| 350 | - version = tmp_version[0] + '.' + tmp_version[1]; | ||
| 351 | - } | ||
| 352 | - if (gecko) { | ||
| 353 | - /** | ||
| 354 | - * FireFox 2 has a function called registerContentHandler(); | ||
| 355 | - */ | ||
| 356 | - if (navigator.registerContentHandler) { | ||
| 357 | - version = '2'; | ||
| 358 | - } else { | ||
| 359 | - version = '1.5'; | ||
| 360 | - } | ||
| 361 | - /** | ||
| 362 | - * This should catch all pre Firefox 1.5 browsers | ||
| 363 | - */ | ||
| 364 | - if ((navigator.vendorSub) && !version) { | ||
| 365 | - version = navigator.vendorSub; | ||
| 366 | - } | ||
| 367 | - } | ||
| 368 | - if (safari) { | ||
| 369 | - try { | ||
| 370 | - /** | ||
| 371 | - * Safari 1.3+ supports the console method | ||
| 372 | - */ | ||
| 373 | - if (console) { | ||
| 374 | - /** | ||
| 375 | - * Safari 2+ supports the onmousewheel event | ||
| 376 | - */ | ||
| 377 | - if ((window.onmousewheel !== 'undefined') && (window.onmousewheel === null)) { | ||
| 378 | - version = '2'; | ||
| 379 | - } else { | ||
| 380 | - version = '1.3'; | ||
| 381 | - } | ||
| 382 | - } | ||
| 383 | - } catch (e) { | ||
| 384 | - /** | ||
| 385 | - * Safari 1.2 does not support the console method | ||
| 386 | - */ | ||
| 387 | - version = '1.2'; | ||
| 388 | - } | ||
| 389 | - } | ||
| 390 | - /** | ||
| 391 | - * Return the Browser Object | ||
| 392 | - * @type Object | ||
| 393 | - */ | ||
| 394 | - var browsers = { | ||
| 395 | - ua: navigator.userAgent, | ||
| 396 | - opera: opera, | ||
| 397 | - safari: safari, | ||
| 398 | - gecko: gecko, | ||
| 399 | - msie: msie, | ||
| 400 | - version: version | ||
| 401 | - } | ||
| 402 | - return browsers; | ||
| 403 | -} | ||
| 404 | -/** | ||
| 405 | -* User Agent Based Browser Detection<br> | ||
| 406 | -* This function uses the userAgent string to get the browsers information.<br> | ||
| 407 | -* The returned object will look like:<br> | ||
| 408 | -* <pre> | ||
| 409 | -* obj { | ||
| 410 | -* ua: 'Full UserAgent String' | ||
| 411 | -* opera: boolean | ||
| 412 | -* safari: boolean | ||
| 413 | -* firefox: boolean | ||
| 414 | -* mozilla: boolean | ||
| 415 | -* msie: boolean | ||
| 416 | -* mac: boolean | ||
| 417 | -* win: boolean | ||
| 418 | -* unix: boolean | ||
| 419 | -* version: string | ||
| 420 | -* flash: version string | ||
| 421 | -* } | ||
| 422 | -* </pre><br> | ||
| 423 | -* @return Browser Information Object | ||
| 424 | -* @type Object | ||
| 425 | -*/ | ||
| 426 | -YAHOO.Tools.getBrowserAgent = function() { | ||
| 427 | - var ua = navigator.userAgent.toLowerCase(); | ||
| 428 | - var opera = ((ua.indexOf('opera') != -1) ? true : false); | ||
| 429 | - var safari = ((ua.indexOf('safari') != -1) ? true : false); | ||
| 430 | - var firefox = ((ua.indexOf('firefox') != -1) ? true : false); | ||
| 431 | - var msie = ((ua.indexOf('msie') != -1) ? true : false); | ||
| 432 | - var mac = ((ua.indexOf('mac') != -1) ? true : false); | ||
| 433 | - var unix = ((ua.indexOf('x11') != -1) ? true : false); | ||
| 434 | - var win = ((mac || unix) ? false : true); | ||
| 435 | - var version = false; | ||
| 436 | - var mozilla = false; | ||
| 437 | - //var flash = this.checkFlash(); | ||
| 438 | - if (!firefox && !safari && (ua.indexOf('gecko') != -1)) { | ||
| 439 | - mozilla = true; | ||
| 440 | - var _tmp = ua.split('/'); | ||
| 441 | - version = _tmp[_tmp.length - 1].split(' ')[0]; | ||
| 442 | - } | ||
| 443 | - if (firefox) { | ||
| 444 | - var _tmp = ua.split('/'); | ||
| 445 | - version = _tmp[_tmp.length - 1].split(' ')[0]; | ||
| 446 | - } | ||
| 447 | - if (msie) { | ||
| 448 | - version = ua.substring((ua.indexOf('msie ') + 5)).split(';')[0]; | ||
| 449 | - } | ||
| 450 | - if (safari) { | ||
| 451 | - /** | ||
| 452 | - * Safari doesn't report a string, have to use getBrowserEngine to get it | ||
| 453 | - */ | ||
| 454 | - version = this.getBrowserEngine().version; | ||
| 455 | - } | ||
| 456 | - if (opera) { | ||
| 457 | - version = ua.substring((ua.indexOf('opera/') + 6)).split(' ')[0]; | ||
| 458 | - } | ||
| 459 | - | ||
| 460 | - /** | ||
| 461 | - * Return the Browser Object | ||
| 462 | - * @type Object | ||
| 463 | - */ | ||
| 464 | - var browsers = { | ||
| 465 | - ua: navigator.userAgent, | ||
| 466 | - opera: opera, | ||
| 467 | - safari: safari, | ||
| 468 | - firefox: firefox, | ||
| 469 | - mozilla: mozilla, | ||
| 470 | - msie: msie, | ||
| 471 | - mac: mac, | ||
| 472 | - win: win, | ||
| 473 | - unix: unix, | ||
| 474 | - version: version//, | ||
| 475 | - //flash: flash | ||
| 476 | - } | ||
| 477 | - return browsers; | ||
| 478 | -} | ||
| 479 | -/** | ||
| 480 | -* Check if Flash is enabled and return the version number | ||
| 481 | -* @return Version number or false on error | ||
| 482 | -* @type String | ||
| 483 | -*/ | ||
| 484 | -YAHOO.Tools.checkFlash = function() { | ||
| 485 | - var br = this.getBrowserEngine(); | ||
| 486 | - if (br.msie) { | ||
| 487 | - try { | ||
| 488 | - // version will be set for 7.X or greater players | ||
| 489 | - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); | ||
| 490 | - var versionStr = axo.GetVariable("$version"); | ||
| 491 | - var tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] | ||
| 492 | - var tempString = tempArray[1]; // "2,0,0,11" | ||
| 493 | - var versionArray = tempString.split(","); // ['2', '0', '0', '11'] | ||
| 494 | - var flash = versionArray[0]; | ||
| 495 | - } catch (e) { | ||
| 496 | - } | ||
| 497 | - } else { | ||
| 498 | - var flashObj = null; | ||
| 499 | - var tokens, len, curr_tok; | ||
| 500 | - if (navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash']) { | ||
| 501 | - flashObj = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin; | ||
| 502 | - } | ||
| 503 | - if (flashObj == null) { | ||
| 504 | - flash = false; | ||
| 505 | - } else { | ||
| 506 | - tokens = navigator.plugins['Shockwave Flash'].description.split(' '); | ||
| 507 | - len = tokens.length; | ||
| 508 | - while(len--) { | ||
| 509 | - curr_tok = tokens[len]; | ||
| 510 | - if(!isNaN(parseInt(curr_tok))) { | ||
| 511 | - hasVersion = curr_tok; | ||
| 512 | - flash = hasVersion; | ||
| 513 | - break; | ||
| 514 | - } | ||
| 515 | - } | ||
| 516 | - } | ||
| 517 | - } | ||
| 518 | - return flash; | ||
| 519 | -} | ||
| 520 | -/** | ||
| 521 | -* Set Mass Attributes on an Element | ||
| 522 | -* @param {Object} attrObj Object containing the attributes to set. | ||
| 523 | -* @param {HTMLElement/String} elm The element you want to apply the attribute to | ||
| 524 | -* Supports adding listeners and setting style from a CSS style string.<br> | ||
| 525 | -*/ | ||
| 526 | -YAHOO.Tools.setAttr = function(attrsObj, elm) { | ||
| 527 | - if (typeof elm == 'string') { | ||
| 528 | - elm = $(elm); | ||
| 529 | - } | ||
| 530 | - for (var i in attrsObj) { | ||
| 531 | - switch (i.toLowerCase()) { | ||
| 532 | - case 'listener': | ||
| 533 | - if (attrsObj[i] instanceof Array) { | ||
| 534 | - var ev = attrsObj[i][0]; | ||
| 535 | - var func = attrsObj[i][1]; | ||
| 536 | - var base = attrsObj[i][2]; | ||
| 537 | - var scope = attrsObj[i][3]; | ||
| 538 | - $E.addListener(elm, ev, func, base, scope); | ||
| 539 | - } | ||
| 540 | - break; | ||
| 541 | - case 'classname': | ||
| 542 | - case 'class': | ||
| 543 | - elm.className = attrsObj[i]; | ||
| 544 | - break; | ||
| 545 | - case 'style': | ||
| 546 | - YAHOO.Tools.setStyleString(elm, attrsObj[i]); | ||
| 547 | - break; | ||
| 548 | - default: | ||
| 549 | - elm.setAttribute(i, attrsObj[i]); | ||
| 550 | - break; | ||
| 551 | - } | ||
| 552 | - } | ||
| 553 | -} | ||
| 554 | -/** | ||
| 555 | -* Usage:<br> | ||
| 556 | -* <pre><code> | ||
| 557 | -* div = YAHOO.util.Dom.create('div', 'Single DIV. This is some test text.', { | ||
| 558 | -* className:'test1', | ||
| 559 | -* style:'font-size: 20px' | ||
| 560 | -* } | ||
| 561 | -* ); | ||
| 562 | -* test1.appendChild(div); | ||
| 563 | -* <br><br>- or -<br><br> | ||
| 564 | -* div = YAHOO.util.Dom.create('div', {className:'test2',style:'font-size:11px'}, | ||
| 565 | -* [YAHOO.util.Dom.create('p', { | ||
| 566 | -* style:'border: 1px solid red; color: blue', | ||
| 567 | -* listener: ['click', test] | ||
| 568 | -* }, | ||
| 569 | -* 'This is a P inside of a DIV both styled.') | ||
| 570 | -* ] | ||
| 571 | -*); | ||
| 572 | -* test2.appendChild(div); | ||
| 573 | -* | ||
| 574 | -* </code></pre> | ||
| 575 | -* @param {String} tagName Tag name to create | ||
| 576 | -* @param {Object} attrs Element attributes in object notation | ||
| 577 | -* @param {Array} children Array of children to append to the created element | ||
| 578 | -* @param {String} txt Text string to insert into the created element | ||
| 579 | -* @returns A reference to the newly created element | ||
| 580 | -* @type HTMLReference | ||
| 581 | -*/ | ||
| 582 | -YAHOO.Tools.create = function(tagName) { | ||
| 583 | - tagName = tagName.toLowerCase(); | ||
| 584 | - elm = document.createElement(tagName); | ||
| 585 | - var txt = false; | ||
| 586 | - var attrsObj = false; | ||
| 587 | - | ||
| 588 | - if (!elm) { return false; } | ||
| 589 | - | ||
| 590 | - for (var i = 1; i < arguments.length; i++) { | ||
| 591 | - txt = arguments[i]; | ||
| 592 | - if (typeof txt == 'string') { | ||
| 593 | - _txt = YAHOO.Tools.makeTextObject(txt); | ||
| 594 | - elm.appendChild(_txt); | ||
| 595 | - } else if (txt instanceof Array) { | ||
| 596 | - YAHOO.Tools.makeChildren(txt, elm); | ||
| 597 | - } else if (typeof txt == 'object') { | ||
| 598 | - //_makeStyleObject(txt, elm); | ||
| 599 | - YAHOO.Tools.setAttr(txt, elm); | ||
| 600 | - } | ||
| 601 | - } | ||
| 602 | - return elm; | ||
| 603 | -} | ||
| 604 | -/** | ||
| 605 | -* Inserts an HTML Element after another in the DOM Tree. | ||
| 606 | -* @param {HTMLElement} elm The element to insert | ||
| 607 | -* @param {HTMLElement} curNode The element to insert it before | ||
| 608 | -*/ | ||
| 609 | -YAHOO.Tools.insertAfter = function(elm, curNode) { | ||
| 610 | - if (curNode.nextSibling) { | ||
| 611 | - curNode.parentNode.insertBefore(elm, curNode.nextSibling); | ||
| 612 | - } else { | ||
| 613 | - curNode.parentNode.appendChild(elm); | ||
| 614 | - } | ||
| 615 | -} | ||
| 616 | -/** | ||
| 617 | -* Validates that the value passed is in the Array passed. | ||
| 618 | -* @param {Array} arr The Array to search (haystack) | ||
| 619 | -* @param {String} val The value to search for (needle) | ||
| 620 | -* @returns True if the value is found | ||
| 621 | -* @type Boolean | ||
| 622 | -*/ | ||
| 623 | -YAHOO.Tools.inArray = function(arr, val) { | ||
| 624 | - if (arr instanceof Array) { | ||
| 625 | - for (var i = (arr.length -1); i >= 0; i--) { | ||
| 626 | - if (arr[i] === val) { | ||
| 627 | - return true; | ||
| 628 | - } | ||
| 629 | - } | ||
| 630 | - } | ||
| 631 | - return false; | ||
| 632 | -} | ||
| 633 | - | ||
| 634 | - | ||
| 635 | -/** | ||
| 636 | -* Validates that the value passed in is a boolean. | ||
| 637 | -* @param {Object} str The value to validate | ||
| 638 | -* @return true, if the value is valid | ||
| 639 | -* @type Boolean | ||
| 640 | -*/ | ||
| 641 | -YAHOO.Tools.checkBoolean = function(str) { | ||
| 642 | - return ((typeof str == 'boolean') ? true : false); | ||
| 643 | -} | ||
| 644 | - | ||
| 645 | -/** | ||
| 646 | -* Validates that the value passed in is a number. | ||
| 647 | -* @param {Object} str The value to validate | ||
| 648 | -* @return true, if the value is valid | ||
| 649 | -* @type Boolean | ||
| 650 | -*/ | ||
| 651 | -YAHOO.Tools.checkNumber = function(str) { | ||
| 652 | - return ((isNaN(str)) ? false : true); | ||
| 653 | -} | ||
| 654 | - | ||
| 655 | -/** | ||
| 656 | -* Divide your desired pixel width by 13 to find em width. Multiply that value by 0.9759 for IE via *width. | ||
| 657 | -* @param {Integer} size The pixel size to convert to em. | ||
| 658 | -* @return Object of sizes (2) {msie: size, other: size } | ||
| 659 | -* @type Object | ||
| 660 | -*/ | ||
| 661 | -YAHOO.Tools.PixelToEm = function(size) { | ||
| 662 | - var data = {}; | ||
| 663 | - var sSize = (size / 13); | ||
| 664 | - data.other = (Math.round(sSize * 100) / 100); | ||
| 665 | - data.msie = (Math.round((sSize * 0.9759) * 100) / 100); | ||
| 666 | - return data; | ||
| 667 | -} | ||
| 668 | - | ||
| 669 | -/** | ||
| 670 | -* Return a string of CSS statements for this pixel size in ems | ||
| 671 | -* @param {Integer} size The pixel size to convert to em. | ||
| 672 | -* @param {String} prop The property to apply the style to. | ||
| 673 | -* @return String of CSS style statements (width:46.15em;*width:45.04em;min-width:600px;) | ||
| 674 | -* @type String | ||
| 675 | -*/ | ||
| 676 | -YAHOO.Tools.PixelToEmStyle = function(size, prop) { | ||
| 677 | - var data = ''; | ||
| 678 | - var prop = ((prop) ? prop.toLowerCase() : 'width'); | ||
| 679 | - var sSize = (size / 13); | ||
| 680 | - data += prop + ':' + (Math.round(sSize * 100) / 100) + 'em;'; | ||
| 681 | - data += '*' + prop + ':' + (Math.round((sSize * 0.9759) * 100) / 100) + 'em;'; | ||
| 682 | - if ((prop == 'width') || (prop == 'height')) { | ||
| 683 | - data += 'min-' + prop + ':' + size + 'px;'; | ||
| 684 | - } | ||
| 685 | - return data; | ||
| 686 | -} | ||
| 687 | - | ||
| 688 | -/** | ||
| 689 | -* Base64 Encodes a string | ||
| 690 | -* @param {String} str The string to base64 encode. | ||
| 691 | -* @return Base64 Encoded String | ||
| 692 | -* @type String | ||
| 693 | -*/ | ||
| 694 | -YAHOO.Tools.base64Encode = function(str) { | ||
| 695 | - var data = ""; | ||
| 696 | - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; | ||
| 697 | - var i = 0; | ||
| 698 | - | ||
| 699 | - do { | ||
| 700 | - chr1 = str.charCodeAt(i++); | ||
| 701 | - chr2 = str.charCodeAt(i++); | ||
| 702 | - chr3 = str.charCodeAt(i++); | ||
| 703 | - | ||
| 704 | - enc1 = chr1 >> 2; | ||
| 705 | - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); | ||
| 706 | - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); | ||
| 707 | - enc4 = chr3 & 63; | ||
| 708 | - | ||
| 709 | - if (isNaN(chr2)) { | ||
| 710 | - enc3 = enc4 = 64; | ||
| 711 | - } else if (isNaN(chr3)) { | ||
| 712 | - enc4 = 64; | ||
| 713 | - } | ||
| 714 | - | ||
| 715 | - data = data + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); | ||
| 716 | - } while (i < str.length); | ||
| 717 | - | ||
| 718 | - return data; | ||
| 719 | -} | ||
| 720 | -/** | ||
| 721 | -* Base64 Dncodes a string | ||
| 722 | -* @param {String} str The base64 encoded string to decode. | ||
| 723 | -* @return The decoded String | ||
| 724 | -* @type String | ||
| 725 | -*/ | ||
| 726 | -YAHOO.Tools.base64Decode = function(str) { | ||
| 727 | - var data = ""; | ||
| 728 | - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; | ||
| 729 | - var i = 0; | ||
| 730 | - | ||
| 731 | - // remove all characters that are not A-Z, a-z, 0-9, +, /, or = | ||
| 732 | - str = str.replace(regExs.base64, ""); | ||
| 733 | - | ||
| 734 | - do { | ||
| 735 | - enc1 = keyStr.indexOf(str.charAt(i++)); | ||
| 736 | - enc2 = keyStr.indexOf(str.charAt(i++)); | ||
| 737 | - enc3 = keyStr.indexOf(str.charAt(i++)); | ||
| 738 | - enc4 = keyStr.indexOf(str.charAt(i++)); | ||
| 739 | - | ||
| 740 | - chr1 = (enc1 << 2) | (enc2 >> 4); | ||
| 741 | - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); | ||
| 742 | - chr3 = ((enc3 & 3) << 6) | enc4; | ||
| 743 | - | ||
| 744 | - data = data + String.fromCharCode(chr1); | ||
| 745 | - | ||
| 746 | - if (enc3 != 64) { | ||
| 747 | - data = data + String.fromCharCode(chr2); | ||
| 748 | - } | ||
| 749 | - if (enc4 != 64) { | ||
| 750 | - data = data + String.fromCharCode(chr3); | ||
| 751 | - } | ||
| 752 | - } while (i < str.length); | ||
| 753 | - | ||
| 754 | - return data; | ||
| 755 | -} | ||
| 756 | - | ||
| 757 | -/** | ||
| 758 | -* Parses a Query String, if one is not provided, it will look in location.href<br> | ||
| 759 | -* NOTE: This function will also handle test[] vars and convert them to an array inside of the return object.<br> | ||
| 760 | -* This now supports #hash vars, it will return it in the object as Obj.hash | ||
| 761 | -* @param {String} str The string to parse as a query string | ||
| 762 | -* @return An object of the parts of the parsed query string | ||
| 763 | -* @type Object | ||
| 764 | -*/ | ||
| 765 | -YAHOO.Tools.getQueryString = function(str) { | ||
| 766 | - var qstr = {}; | ||
| 767 | - if (!str) { | ||
| 768 | - var str = location.href.split('?'); | ||
| 769 | - if (str.length != 2) { | ||
| 770 | - str = ['', location.href]; | ||
| 771 | - } | ||
| 772 | - } else { | ||
| 773 | - var str = ['', str]; | ||
| 774 | - } | ||
| 775 | - if (str[1].match('#')) { | ||
| 776 | - var _tmp = str[1].split('#'); | ||
| 777 | - qstr.hash = _tmp[1]; | ||
| 778 | - str[1] = _tmp[0]; | ||
| 779 | - } | ||
| 780 | - if (str[1]) { | ||
| 781 | - str = str[1].split('&'); | ||
| 782 | - if (str.length) { | ||
| 783 | - for (var i = 0; i < str.length; i++) { | ||
| 784 | - var part = str[i].split('='); | ||
| 785 | - if (part[0].indexOf('[') != -1) { | ||
| 786 | - if (part[0].indexOf('[]') != -1) { | ||
| 787 | - //Array | ||
| 788 | - var arr = part[0].substring(0, part[0].length - 2); | ||
| 789 | - if (!qstr[arr]) { | ||
| 790 | - qstr[arr] = []; | ||
| 791 | - } | ||
| 792 | - qstr[arr][qstr[arr].length] = part[1]; | ||
| 793 | - } else { | ||
| 794 | - //Object | ||
| 795 | - var arr = part[0].substring(0, part[0].indexOf('[')); | ||
| 796 | - var data = part[0].substring((part[0].indexOf('[') + 1), part[0].indexOf(']')); | ||
| 797 | - if (!qstr[arr]) { | ||
| 798 | - qstr[arr] = {}; | ||
| 799 | - } | ||
| 800 | - //Object | ||
| 801 | - qstr[arr][data] = part[1]; | ||
| 802 | - } | ||
| 803 | - } else { | ||
| 804 | - qstr[part[0]] = part[1]; | ||
| 805 | - } | ||
| 806 | - } | ||
| 807 | - } | ||
| 808 | - } | ||
| 809 | - return qstr; | ||
| 810 | -} | ||
| 811 | -/** | ||
| 812 | -* Parses a Query String Var<br> | ||
| 813 | -* NOTE: This function will also handle test[] vars and convert them to an array inside of the return object. | ||
| 814 | -* @param {String} str The var to get from the query string | ||
| 815 | -* @return The value of the var in the querystring. | ||
| 816 | -* @type String/Array | ||
| 817 | -*/ | ||
| 818 | -YAHOO.Tools.getQueryStringVar = function(str) { | ||
| 819 | - var qs = this.getQueryString(); | ||
| 820 | - if (qs[str]) { | ||
| 821 | - return qs[str]; | ||
| 822 | - } else { | ||
| 823 | - return false; | ||
| 824 | - } | ||
| 825 | -} | ||
| 826 | - | ||
| 827 | - | ||
| 828 | -/** | ||
| 829 | -* Function to pad a date with a beginning 0 so 1 becomes 01, 2 becomes 02, etc.. | ||
| 830 | -* @param {String} n The string to pad | ||
| 831 | -* @returns Zero padded string | ||
| 832 | -* @type String | ||
| 833 | -*/ | ||
| 834 | -YAHOO.Tools.padDate = function(n) { | ||
| 835 | - return n < 10 ? '0' + n : n; | ||
| 836 | -} | ||
| 837 | - | ||
| 838 | -/** | ||
| 839 | -* Converts a string to a JSON string | ||
| 840 | -* @param {String} str Converts a string to a JSON string | ||
| 841 | -* @returns JSON Encoded string | ||
| 842 | -* @type String | ||
| 843 | -*/ | ||
| 844 | -YAHOO.Tools.encodeStr = function(str) { | ||
| 845 | - if (/["\\\x00-\x1f]/.test(str)) { | ||
| 846 | - return '"' + str.replace(/([\x00-\x1f\\"])/g, function(a, b) { | ||
| 847 | - var c = jsonCodes[b]; | ||
| 848 | - if(c) { | ||
| 849 | - return c; | ||
| 850 | - } | ||
| 851 | - c = b.charCodeAt(); | ||
| 852 | - return '\\u00' + | ||
| 853 | - Math.floor(c / 16).toString(16) + | ||
| 854 | - (c % 16).toString(16); | ||
| 855 | - }) + '"'; | ||
| 856 | - } | ||
| 857 | - return '"' + str + '"'; | ||
| 858 | -} | ||
| 859 | -/** | ||
| 860 | -* Converts an Array to a JSON string | ||
| 861 | -* @param {Array} arr Converts an Array to a JSON string | ||
| 862 | -* @returns JSON encoded string | ||
| 863 | -* @type String | ||
| 864 | -*/ | ||
| 865 | -YAHOO.Tools.encodeArr = function(arr) { | ||
| 866 | - var a = ['['], b, i, l = arr.length, v; | ||
| 867 | - for (i = 0; i < l; i += 1) { | ||
| 868 | - v = arr[i]; | ||
| 869 | - switch (typeof v) { | ||
| 870 | - case 'undefined': | ||
| 871 | - case 'function': | ||
| 872 | - case 'unknown': | ||
| 873 | - break; | ||
| 874 | - default: | ||
| 875 | - if (b) { | ||
| 876 | - a.push(','); | ||
| 877 | - } | ||
| 878 | - a.push(v === null ? "null" : YAHOO.Tools.JSONEncode(v)); | ||
| 879 | - b = true; | ||
| 880 | - } | ||
| 881 | - } | ||
| 882 | - a.push(']'); | ||
| 883 | - return a.join(''); | ||
| 884 | -} | ||
| 885 | -/** | ||
| 886 | -* Converts a Date object to a JSON string | ||
| 887 | -* @param {Object} d Converts a Date object to a JSON string | ||
| 888 | -* @returns JSON encoded Date string | ||
| 889 | -* @type String | ||
| 890 | -*/ | ||
| 891 | -YAHOO.Tools.encodeDate = function(d) { | ||
| 892 | - return '"' + d.getFullYear() + '-' + YAHOO.Tools.padDate(d.getMonth() + 1) + '-' + YAHOO.Tools.padDate(d.getDate()) + 'T' + YAHOO.Tools.padDate(d.getHours()) + ':' + YAHOO.Tools.padDate(d.getMinutes()) + ':' + YAHOO.Tools.padDate(d.getSeconds()) + '"'; | ||
| 893 | -} | ||
| 894 | - | ||
| 895 | -/** | ||
| 896 | -* Fixes the JSON date format | ||
| 897 | -* @param {String} dateStr JSON encoded date string (YYYY-MM-DDTHH:MM:SS) | ||
| 898 | -* @returns Date Object | ||
| 899 | -* @type Object | ||
| 900 | -*/ | ||
| 901 | -YAHOO.Tools.fixJSONDate = function(dateStr) { | ||
| 902 | - var tmp = dateStr.split('T'); | ||
| 903 | - var fixedDate = dateStr; | ||
| 904 | - if (tmp.length == 2) { | ||
| 905 | - var tmpDate = tmp[0].split('-'); | ||
| 906 | - if (tmpDate.length == 3) { | ||
| 907 | - fixedDate = new Date(tmpDate[0], (tmpDate[1] - 1), tmpDate[2]); | ||
| 908 | - var tmpTime = tmp[1].split(':'); | ||
| 909 | - if (tmpTime.length == 3) { | ||
| 910 | - fixedDate.setHours(tmpTime[0], tmpTime[1], tmpTime[2]); | ||
| 911 | - } | ||
| 912 | - } | ||
| 913 | - } | ||
| 914 | - return fixedDate; | ||
| 915 | -} | ||
| 916 | - | ||
| 917 | -/** | ||
| 918 | -* Encode a Javascript Object/Array into a JSON string | ||
| 919 | -* @param {String/Object/Array} o Converts the object to a JSON string | ||
| 920 | -* @returns JSON String | ||
| 921 | -* @type String | ||
| 922 | -*/ | ||
| 923 | -YAHOO.Tools.JSONEncode = function(o) { | ||
| 924 | - if ((typeof o == 'undefined') || (o === null)) { | ||
| 925 | - return 'null'; | ||
| 926 | - } else if (o instanceof Array) { | ||
| 927 | - return YAHOO.Tools.encodeArr(o); | ||
| 928 | - } else if (o instanceof Date) { | ||
| 929 | - return YAHOO.Tools.encodeDate(o); | ||
| 930 | - } else if (typeof o == 'string') { | ||
| 931 | - return YAHOO.Tools.encodeStr(o); | ||
| 932 | - } else if (typeof o == 'number') { | ||
| 933 | - return isFinite(o) ? String(o) : "null"; | ||
| 934 | - } else if (typeof o == 'boolean') { | ||
| 935 | - return String(o); | ||
| 936 | - } else { | ||
| 937 | - var a = ['{'], b, i, v; | ||
| 938 | - for (var i in o) { | ||
| 939 | - //if (o.hasOwnProperty(i)) { | ||
| 940 | - v = o[i]; | ||
| 941 | - switch (typeof v) { | ||
| 942 | - case 'undefined': | ||
| 943 | - case 'function': | ||
| 944 | - case 'unknown': | ||
| 945 | - break; | ||
| 946 | - default: | ||
| 947 | - if (b) { | ||
| 948 | - a.push(','); | ||
| 949 | - } | ||
| 950 | - a.push(YAHOO.Tools.JSONEncode(i), ':', ((v === null) ? "null" : YAHOO.Tools.JSONEncode(v))); | ||
| 951 | - b = true; | ||
| 952 | - } | ||
| 953 | - //} | ||
| 954 | - } | ||
| 955 | - a.push('}'); | ||
| 956 | - return a.join(''); | ||
| 957 | - } | ||
| 958 | -} | ||
| 959 | -/** | ||
| 960 | -* Converts/evals a JSON string into a native Javascript object | ||
| 961 | -* @param {String} json Converts the JSON string back into the native object | ||
| 962 | -* @param {Booleen} autoDate Try to autofix date objects | ||
| 963 | -* @returns eval'd object | ||
| 964 | -* @type Object/Array/String | ||
| 965 | -*/ | ||
| 966 | -YAHOO.Tools.JSONParse = function(json, autoDate) { | ||
| 967 | - var autoDate = ((autoDate) ? true : false); | ||
| 968 | - try { | ||
| 969 | - if (regExs.syntaxCheck.test(json)) { | ||
| 970 | - var j = eval('(' + json + ')'); | ||
| 971 | - if (autoDate) { | ||
| 972 | - function walk(k, v) { | ||
| 973 | - if (v && typeof v === 'object') { | ||
| 974 | - for (var i in v) { | ||
| 975 | - if (v.hasOwnProperty(i)) { | ||
| 976 | - v[i] = walk(i, v[i]); | ||
| 977 | - } | ||
| 978 | - } | ||
| 979 | - } | ||
| 980 | - if (k.toLowerCase().indexOf('date') >= 0) { | ||
| 981 | - return YAHOO.Tools.fixJSONDate(v); | ||
| 982 | - } else { | ||
| 983 | - return v; | ||
| 984 | - } | ||
| 985 | - } | ||
| 986 | - return walk('', j); | ||
| 987 | - } else { | ||
| 988 | - return j; | ||
| 989 | - } | ||
| 990 | - } | ||
| 991 | - } catch(e) { | ||
| 992 | - console.log(e); | ||
| 993 | - } | ||
| 994 | - throw new SyntaxError("parseJSON"); | ||
| 995 | -} | ||
| 996 | - | ||
| 997 | - | ||
| 998 | -/* | ||
| 999 | -* Try to catch the developers that use the wrong case 8-) | ||
| 1000 | -*/ | ||
| 1001 | -YAHOO.tools = YAHOO.Tools; | ||
| 1002 | -YAHOO.TOOLS = YAHOO.Tools; | ||
| 1003 | -YAHOO.util.Dom.create = YAHOO.Tools.create; | ||
| 1004 | -/* | ||
| 1005 | -* Smaller Code | ||
| 1006 | -*/ | ||
| 1007 | - | ||
| 1008 | -$A = YAHOO.util.Anim; | ||
| 1009 | -$E = YAHOO.util.Event; | ||
| 1010 | -$D = YAHOO.util.Dom; | ||
| 1011 | -$T = YAHOO.Tools; | ||
| 1012 | -$ = YAHOO.util.Dom.get; | ||
| 1013 | -$$ = YAHOO.util.Dom.getElementsByClassName; | 1 | +YAHOO.Tools=function(){keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";regExs={quotes:/\x22/g,startspace:/^\s+/g,endspace:/\s+$/g,striptags:/<\/?[^>]+>/gi,hasbr:/<br/i,hasp:/<p>/i,rbr:/<br>/gi,rbr2:/<br\/>/gi,rendp:/<\/p>/gi,rp:/<p>/gi,base64:/[^A-Za-z0-9\+\/\=]/g,syntaxCheck:/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/};jsonCodes={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"};return {version:"1.0"};}();YAHOO.Tools.getHeight=function(_1){var _2=$(_2);var h=$D.getStyle(_2,"height");if(h=="auto"){_2.style.zoom=1;h=_2.clientHeight+"px";}return h;};YAHOO.Tools.getCenter=function(_4){var _5=$(_5);var cX=Math.round(($D.getViewportWidth()-parseInt($D.getStyle(_5,"width")))/2);var cY=Math.round(($D.getViewportHeight()-parseInt(this.getHeight(_5)))/2);return [cX,cY];};YAHOO.Tools.makeTextObject=function(_8){return document.createTextNode(_8);};YAHOO.Tools.makeChildren=function(_9,_a){var _b=$(_b);for(var i in _9){_val=_9[i];if(typeof _val=="string"){_val=this.makeTxtObject(_val);}_b.appendChild(_val);}};YAHOO.Tools.styleToCamel=function(_d){var _e=_d.split("-");var _f=_e[0];for(var i=1;i<_e.length;i++){_f+=_e[i].substring(0,1).toUpperCase()+_e[i].substring(1,_e[i].length);}return _f;};YAHOO.Tools.removeQuotes=function(str){var _12=new String(str);return String(_12.replace(regExs.quotes,""));};YAHOO.Tools.trim=function(str){return str.replace(regExs.startspace,"").replace(regExs.endspace,"");};YAHOO.Tools.stripTags=function(str){return str.replace(regExs.striptags,"");};YAHOO.Tools.hasBRs=function(str){return str.match(regExs.hasbr)||str.match(regExs.hasp);};YAHOO.Tools.convertBRs2NLs=function(str){return str.replace(regExs.rbr,"\n").replace(regExs.rbr2,"\n").replace(regExs.rendp,"\n").replace(regExs.rp,"");};YAHOO.Tools.stringRepeat=function(str,_18){return new Array(_18+1).join(str);};YAHOO.Tools.stringReverse=function(str){var _1a="";for(i=0;i<str.length;i++){_1a=_1a+str.charAt((str.length-1)-i);}return _1a;};YAHOO.Tools.printf=function(){var num=arguments.length;var _1c=arguments[0];for(var i=1;i<num;i++){var _1e="\\{"+(i-1)+"\\}";var re=new RegExp(_1e,"g");_1c=_1c.replace(re,arguments[i]);}return _1c;};YAHOO.Tools.setStyleString=function(el,str){var _22=str.split(";");for(x in _22){if(x){__tmp=YAHOO.Tools.trim(_22[x]);__tmp=_22[x].split(":");if(__tmp[0]&&__tmp[1]){var _23=YAHOO.Tools.trim(__tmp[0]);var _24=YAHOO.Tools.trim(__tmp[1]);if(_23&&_24){if(_23.indexOf("-")!=-1){_23=YAHOO.Tools.styleToCamel(_23);}$D.setStyle(el,_23,_24);}}}}};YAHOO.Tools.getSelection=function(_25,_26){if(!_25){_25=document;}if(!_26){_26=window;}if(_25.selection){return _25.selection;}return _26.getSelection();};YAHOO.Tools.removeElement=function(el){if(!(el instanceof Array)){el=new Array($(el));}for(var i=0;i<el.length;i++){if(el[i].parentNode){el[i].parentNode.removeChild(el);}}};YAHOO.Tools.setCookie=function(_29,_2a,_2b,_2c,_2d,_2e){var _2f=arguments;var _30=arguments.length;var _31=(_30>2)?_2f[2]:null;var _32=(_30>3)?_2f[3]:"/";var _33=(_30>4)?_2f[4]:null;var _34=(_30>5)?_2f[5]:false;document.cookie=_29+"="+escape(_2a)+((_31==null)?"":("; expires="+_31.toGMTString()))+((_32==null)?"":("; path="+_32))+((_33==null)?"":("; domain="+_33))+((_34==true)?"; secure":"");};YAHOO.Tools.getCookie=function(_35){var dc=document.cookie;var _37=_35+"=";var _38=dc.indexOf("; "+_37);if(_38==-1){_38=dc.indexOf(_37);if(_38!=0){return null;}}else{_38+=2;}var end=document.cookie.indexOf(";",_38);if(end==-1){end=dc.length;}return unescape(dc.substring(_38+_37.length,end));};YAHOO.Tools.deleteCookie=function(_3a,_3b,_3c){if(getCookie(_3a)){document.cookie=_3a+"="+((_3b)?"; path="+_3b:"")+((_3c)?"; domain="+_3c:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}};YAHOO.Tools.getBrowserEngine=function(){var _3d=((window.opera&&window.opera.version)?true:false);var _3e=((navigator.vendor&&navigator.vendor.indexOf("Apple")!=-1)?true:false);var _3f=((document.getElementById&&!document.all&&!_3d&&!_3e)?true:false);var _40=((window.ActiveXObject)?true:false);var _41=false;if(_40){if(typeof document.body.style.maxHeight!="undefined"){_41="7";}else{_41="6";}}if(_3d){var _42=window.opera.version().split(".");_41=_42[0]+"."+_42[1];}if(_3f){if(navigator.registerContentHandler){_41="2";}else{_41="1.5";}if((navigator.vendorSub)&&!_41){_41=navigator.vendorSub;}}if(_3e){try{if(console){if((window.onmousewheel!=="undefined")&&(window.onmousewheel===null)){_41="2";}else{_41="1.3";}}}catch(e){_41="1.2";}}var _43={ua:navigator.userAgent,opera:_3d,safari:_3e,gecko:_3f,msie:_40,version:_41};return _43;};YAHOO.Tools.getBrowserAgent=function(){var ua=navigator.userAgent.toLowerCase();var _45=((ua.indexOf("opera")!=-1)?true:false);var _46=((ua.indexOf("safari")!=-1)?true:false);var _47=((ua.indexOf("firefox")!=-1)?true:false);var _48=((ua.indexOf("msie")!=-1)?true:false);var mac=((ua.indexOf("mac")!=-1)?true:false);var _4a=((ua.indexOf("x11")!=-1)?true:false);var win=((mac||_4a)?false:true);var _4c=false;var _4d=false;if(!_47&&!_46&&(ua.indexOf("gecko")!=-1)){_4d=true;var _4e=ua.split("/");_4c=_4e[_4e.length-1].split(" ")[0];}if(_47){var _4f=ua.split("/");_4c=_4f[_4f.length-1].split(" ")[0];}if(_48){_4c=ua.substring((ua.indexOf("msie ")+5)).split(";")[0];}if(_46){_4c=this.getBrowserEngine().version;}if(_45){_4c=ua.substring((ua.indexOf("opera/")+6)).split(" ")[0];}var _50={ua:navigator.userAgent,opera:_45,safari:_46,firefox:_47,mozilla:_4d,msie:_48,mac:mac,win:win,unix:_4a,version:_4c};return _50;};YAHOO.Tools.checkFlash=function(){var br=this.getBrowserEngine();if(br.msie){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");var _53=axo.GetVariable("$version");var _54=_53.split(" ");var _55=_54[1];var _56=_55.split(",");var _57=_56[0];}catch(e){}}else{var _58=null;var _59,len,curr_tok;if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]){_58=navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;}if(_58==null){_57=false;}else{_59=navigator.plugins["Shockwave Flash"].description.split(" ");len=_59.length;while(len--){curr_tok=_59[len];if(!isNaN(parseInt(curr_tok))){hasVersion=curr_tok;_57=hasVersion;break;}}}}return _57;};YAHOO.Tools.setAttr=function(_5a,elm){if(typeof elm=="string"){elm=$(elm);}for(var i in _5a){switch(i.toLowerCase()){case "listener":if(_5a[i] instanceof Array){var ev=_5a[i][0];var _5e=_5a[i][1];var _5f=_5a[i][2];var _60=_5a[i][3];$E.addListener(elm,ev,_5e,_5f,_60);}break;case "classname":case "class":elm.className=_5a[i];break;case "style":YAHOO.Tools.setStyleString(elm,_5a[i]);break;default:elm.setAttribute(i,_5a[i]);break;}}};YAHOO.Tools.create=function(_61){_61=_61.toLowerCase();elm=document.createElement(_61);var txt=false;var _63=false;if(!elm){return false;}for(var i=1;i<arguments.length;i++){txt=arguments[i];if(typeof txt=="string"){_txt=YAHOO.Tools.makeTextObject(txt);elm.appendChild(_txt);}else{if(txt instanceof Array){YAHOO.Tools.makeChildren(txt,elm);}else{if(typeof txt=="object"){YAHOO.Tools.setAttr(txt,elm);}}}}return elm;};YAHOO.Tools.insertAfter=function(elm,_66){if(_66.nextSibling){_66.parentNode.insertBefore(elm,_66.nextSibling);}else{_66.parentNode.appendChild(elm);}};YAHOO.Tools.inArray=function(arr,val){if(arr instanceof Array){for(var i=(arr.length-1);i>=0;i--){if(arr[i]===val){return true;}}}return false;};YAHOO.Tools.checkBoolean=function(str){return ((typeof str=="boolean")?true:false);};YAHOO.Tools.checkNumber=function(str){return ((isNaN(str))?false:true);};YAHOO.Tools.PixelToEm=function(_6c){var _6d={};var _6e=(_6c/13);_6d.other=(Math.round(_6e*100)/100);_6d.msie=(Math.round((_6e*0.9759)*100)/100);return _6d;};YAHOO.Tools.PixelToEmStyle=function(_6f,_70){var _71="";var _72=((_72)?_72.toLowerCase():"width");var _73=(_6f/13);_71+=_72+":"+(Math.round(_73*100)/100)+"em;";_71+="*"+_72+":"+(Math.round((_73*0.9759)*100)/100)+"em;";if((_72=="width")||(_72=="height")){_71+="min-"+_72+":"+_6f+"px;";}return _71;};YAHOO.Tools.base64Encode=function(str){var _75="";var _76,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;do{_76=str.charCodeAt(i++);chr2=str.charCodeAt(i++);chr3=str.charCodeAt(i++);enc1=_76>>2;enc2=((_76&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else{if(isNaN(chr3)){enc4=64;}}_75=_75+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<str.length);return _75;};YAHOO.Tools.base64Decode=function(str){var _79="";var _7a,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;str=str.replace(regExs.base64,"");do{enc1=keyStr.indexOf(str.charAt(i++));enc2=keyStr.indexOf(str.charAt(i++));enc3=keyStr.indexOf(str.charAt(i++));enc4=keyStr.indexOf(str.charAt(i++));_7a=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;_79=_79+String.fromCharCode(_7a);if(enc3!=64){_79=_79+String.fromCharCode(chr2);}if(enc4!=64){_79=_79+String.fromCharCode(chr3);}}while(i<str.length);return _79;};YAHOO.Tools.getQueryString=function(str){var _7d={};if(!str){var str=location.href.split("?");if(str.length!=2){str=["",location.href];}}else{var str=["",str];}if(str[1].match("#")){var _80=str[1].split("#");_7d.hash=_80[1];str[1]=_80[0];}if(str[1]){str=str[1].split("&");if(str.length){for(var i=0;i<str.length;i++){var _82=str[i].split("=");if(_82[0].indexOf("[")!=-1){if(_82[0].indexOf("[]")!=-1){var arr=_82[0].substring(0,_82[0].length-2);if(!_7d[arr]){_7d[arr]=[];}_7d[arr][_7d[arr].length]=_82[1];}else{var arr=_82[0].substring(0,_82[0].indexOf("["));var _85=_82[0].substring((_82[0].indexOf("[")+1),_82[0].indexOf("]"));if(!_7d[arr]){_7d[arr]={};}_7d[arr][_85]=_82[1];}}else{_7d[_82[0]]=_82[1];}}}}return _7d;};YAHOO.Tools.getQueryStringVar=function(str){var qs=this.getQueryString();if(qs[str]){return qs[str];}else{return false;}};YAHOO.Tools.padDate=function(n){return n<10?"0"+n:n;};YAHOO.Tools.encodeStr=function(str){if(/["\\\x00-\x1f]/.test(str)){return "\""+str.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=jsonCodes[b];if(c){return c;}c=b.charCodeAt();return "\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);})+"\"";}return "\""+str+"\"";};YAHOO.Tools.encodeArr=function(arr){var a=["["],b,i,l=arr.length,v;for(i=0;i<l;i+=1){v=arr[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(",");}a.push(v===null?"null":YAHOO.Tools.JSONEncode(v));b=true;}}a.push("]");return a.join("");};YAHOO.Tools.encodeDate=function(d){return "\""+d.getFullYear()+"-"+YAHOO.Tools.padDate(d.getMonth()+1)+"-"+YAHOO.Tools.padDate(d.getDate())+"T"+YAHOO.Tools.padDate(d.getHours())+":"+YAHOO.Tools.padDate(d.getMinutes())+":"+YAHOO.Tools.padDate(d.getSeconds())+"\"";};YAHOO.Tools.fixJSONDate=function(_90){var tmp=_90.split("T");var _92=_90;if(tmp.length==2){var _93=tmp[0].split("-");if(_93.length==3){_92=new Date(_93[0],(_93[1]-1),_93[2]);var _94=tmp[1].split(":");if(_94.length==3){_92.setHours(_94[0],_94[1],_94[2]);}}}return _92;};YAHOO.Tools.JSONEncode=function(o){if((typeof o=="undefined")||(o===null)){return "null";}else{if(o instanceof Array){return YAHOO.Tools.encodeArr(o);}else{if(o instanceof Date){return YAHOO.Tools.encodeDate(o);}else{if(typeof o=="string"){return YAHOO.Tools.encodeStr(o);}else{if(typeof o=="number"){return isFinite(o)?String(o):"null";}else{if(typeof o=="boolean"){return String(o);}else{var a=["{"],b,i,v;for(var i in o){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(",");}a.push(YAHOO.Tools.JSONEncode(i),":",((v===null)?"null":YAHOO.Tools.JSONEncode(v)));b=true;}}a.push("}");return a.join("");}}}}}}};YAHOO.Tools.JSONParse=function(_98,_99){var _9a=((_9a)?true:false);try{if(regExs.syntaxCheck.test(_98)){var j=eval("("+_98+")");if(_9a){function walk(k,v){if(v&&typeof v==="object"){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i]);}}}if(k.toLowerCase().indexOf("date")>=0){return YAHOO.Tools.fixJSONDate(v);}else{return v;}}return walk("",j);}else{return j;}}}catch(e){console.log(e);}throw new SyntaxError("parseJSON");};YAHOO.tools=YAHOO.Tools;YAHOO.TOOLS=YAHOO.Tools;YAHOO.util.Dom.create=YAHOO.Tools.create;$A=YAHOO.util.Anim;$E=YAHOO.util.Event;$D=YAHOO.util.Dom;$T=YAHOO.Tools;$=YAHOO.util.Dom.get;$$=YAHOO.util.Dom.getElementsByClassName; |
| 1014 | \ No newline at end of file | 2 | \ No newline at end of file |
thirdpartyjs/yui/utilities/utilities.js
| 1 | -/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txtversion: 0.12.0 */ | ||
| 2 | -if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};YAHOO.log=function(_2,_3,_4){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_2,_3,_4);}else{return false;}};YAHOO.extend=function(_6,_7,_8){var F=function(){};F.prototype=_7.prototype;_6.prototype=new F();_6.prototype.constructor=_6;_6.superclass=_7.prototype;if(_7.prototype.constructor==Object.prototype.constructor){_7.prototype.constructor=_7;}if(_8){for(var i in _8){_6.prototype[i]=_8[i];}}};YAHOO.augment=function(r,s){var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;++i){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}};YAHOO.namespace("util","widget","example");(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=Y.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if(el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){if(Y.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;}var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=Y.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=Y.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}return width;}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_9)){this._delete(i);_10=true;}}return _10;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}var _14=[],ret=true,i;for(i=0;i<arguments.length;++i){_14.push(arguments[i]);}var _15=_14.length;if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _16=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var _17=null;if(_14.length>0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_18){var s=this.subscribers[_18];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_18,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_20){this.fn=fn;this.obj=obj||null;this.override=_20;};YAHOO.util.Subscriber.prototype.getScope=function(_21){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return _21;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return (this.fn==fn&&this.obj==obj);}else{return (this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _22=false;var _23=[];var _24=[];var _25=[];var _26=[];var _27=0;var _28=[];var _29=[];var _30=0;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var _31=this;var _32=function(){_31._tryPreloadAttach();};this._interval=setInterval(_32,this.POLL_INTERVAL);}},onAvailable:function(_33,_34,_35,_36){_28.push({id:_33,fn:_34,obj:_35,override:_36,checkReady:false});_27=this.POLL_RETRYS;this.startInterval();},onContentReady:function(_37,_38,_39,_40){_28.push({id:_37,fn:_38,obj:_39,override:_40,checkReady:true});_27=this.POLL_RETRYS;this.startInterval();},addListener:function(el,_42,fn,obj,_43){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],_42,fn,obj,_43)&&ok;}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,_42,fn,obj,_43);});return true;}}}if(!el){return false;}if("unload"==_42&&obj!==this){_24[_24.length]=[el,_42,fn,obj,_43];return true;}var _46=el;if(_43){if(_43===true){_46=obj;}else{_46=_43;}}var _47=function(e){return fn.call(_46,YAHOO.util.Event.getEvent(e),obj);};var li=[el,_42,fn,_47,_46];var _50=_23.length;_23[_50]=li;if(this.useLegacyEvent(el,_42)){var _51=this.getLegacyIndex(el,_42);if(_51==-1||el!=_25[_51][0]){_51=_25.length;_29[el.id+_42]=_51;_25[_51]=[el,_42,el["on"+_42]];_26[_51]=[];el["on"+_42]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_51);};}_26[_51].push(li);}else{this._simpleAdd(el,_42,_47,false);}return true;},fireLegacyEvent:function(e,_52){var ok=true;var le=_26[_52];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _54=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_54,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_56){var key=this.generateId(el)+_56;if(typeof _29[key]=="undefined"){return -1;}else{return _29[key];}},useLegacyEvent:function(el,_58){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_58||"dblclick"==_58){return true;}}}return false;},removeListener:function(el,_59,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_59,fn)&&ok);}return ok;}}if(!fn||!fn.call){return this.purgeElement(el,false,_59);}if("unload"==_59){for(i=0,len=_24.length;i<len;i++){var li=_24[i];if(li&&li[0]==el&&li[1]==_59&&li[2]==fn){_24.splice(i,1);return true;}}return false;}var _60=null;var _61=arguments[3];if("undefined"==typeof _61){_61=this._getCacheIndex(el,_59,fn);}if(_61>=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i<len;++i){li=_63[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_59&&li[this.FN]==fn){_63.splice(i,1);}}}}else{this._simpleRemove(el,_59,_60[this.WFN],false);}delete _23[_61][this.WFN];delete _23[_61][this.FN];_23.splice(_61,1);return true;},getTarget:function(ev,_65){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_67){if(_67&&3==_67.nodeType){return _67.parentNode;}else{return _67;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,_71,fn){for(var i=0,len=_23.length;i<len;++i){var li=_23[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_71){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_30;++_30;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_22=true;var EU=YAHOO.util.Event;if(this.isIE){EU._simpleRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _75=!_22;if(!_75){_75=(_27>0);}var _76=[];for(var i=0,len=_28.length;i<len;++i){var _77=_28[i];if(_77){var el=this.getEl(_77.id);if(el){if(!_77.checkReady||_22||el.nextSibling||(document&&document.body)){var _78=el;if(_77.override){if(_77.override===true){_78=_77.obj;}else{_78=_77.override;}}_77.fn.call(_78,_77.obj);delete _28[i];}}else{_76.push(_77);}}}_27=(_76.length===0)?0:_27-1;if(_75){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,_79,_80){var _81=this.getListeners(el,_80);if(_81){for(var i=0,len=_81.length;i<len;++i){var l=_81[i];this.removeListener(el,l.type,l.fn);}}if(_79&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_79,_80);}}},getListeners:function(el,_83){var _84=[];if(_23&&_23.length>0){for(var i=0,len=_23.length;i<len;++i){var l=_23[i];if(l&&l[this.EL]===el&&(!_83||_83===l[this.TYPE])){_84.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_84.length)?_84:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=_24.length;i<len;++i){l=_24[i];if(l){var _85=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){_85=l[EU.OBJ];}else{_85=l[EU.ADJ_SCOPE];}}l[EU.FN].call(_85,EU.getEvent(e),l[EU.OBJ]);delete _24[i];l=null;_85=null;}}if(_23&&_23.length>0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i<len;++i){delete _25[i][0];delete _25[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(){if(window.addEventListener){return function(el,_87,fn,_88){el.addEventListener(_87,fn,(_88));};}else{if(window.attachEvent){return function(el,_89,fn,_90){el.attachEvent("on"+_89,fn);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,_91,fn,_92){el.removeEventListener(_91,fn,(_92));};}else{if(window.detachEvent){return function(el,_93,fn){el.detachEvent("on"+_93,fn);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(document&&document.body){EU._load();}else{EU._simpleAdd(window,"load",EU._load);}EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(_94,_95,_96,_97){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_94];if(ce){ce.subscribe(_95,_96,_97);}else{this.__yui_subscribers=this.__yui_subscribers||{};var _99=this.__yui_subscribers;if(!_99[_94]){_99[_94]=[];}_99[_94].push({fn:_95,obj:_96,override:_97});}},unsubscribe:function(_100,p_fn,_102){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_100];if(ce){return ce.unsubscribe(p_fn,_102);}else{return false;}},createEvent:function(_103,_104){this.__yui_events=this.__yui_events||{};var opts=_104||{};var _106=this.__yui_events;if(_106[_103]){}else{var _107=opts.scope||this;var _108=opts.silent||null;var ce=new YAHOO.util.CustomEvent(_103,_107,_108,YAHOO.util.CustomEvent.FLAT);_106[_103]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[_103];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}return _106[_103];},fireEvent:function(_110,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_110];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}return false;}};YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i];}}else{end=start+attributes[attr]['by'];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index!=-1){queue.splice(index,1);}tweenCount-=1;if(tweenCount<=0){this.stop();}};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){this.unRegister(tween,i);}}queue=[];thread=null;tweenCount=0;}else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null){tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}tween._onTween.fire();}else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},bounceBoth:function(t,b,c,d){if(t<d/2)return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}control=tmp;}if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}else{Y.Dom.setXY(el,Y.Dom.getXY(el));}start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();(function(){var _1=YAHOO.util.Event;var _2=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=_2.get(this.id);}return this._domRef;},getDragEl:function(){return _2.get(this.dragElId);},init:function(id,_9,_10){this.initTarget(id,_9,_10);_1.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_11,_12){this.config=_12||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.id=id;this.addToGroup((_11)?_11:"default");this.handleElId=id;_1.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_13,_14,_15,_16){if(!_14&&0!==_14){this.padding=[_13,_13,_13,_13];}else{if(!_15&&0!==_15){this.padding=[_13,_14,_13,_14];}else{this.padding=[_13,_14,_15,_16];}}},setInitPosition:function(_17,_18){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_17||0;var dy=_18||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_24){this.groups[_24]=true;this.DDM.regDragDrop(this,_24);},removeFromGroup:function(_25){if(this.groups[_25]){delete this.groups[_25];}this.DDM.removeDDFromGroup(this,_25);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}_1.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var _27=e.which||e.button;if(this.primaryButtonOnly&&_27>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _29=_1.getTarget(e);return (this.isValidHandleChild(_29)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_29,this.id)));},addInvalidHandleType:function(_30){var _31=_30.toUpperCase();this.invalidHandleTypes[_31]=_31;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_32){this.invalidHandleClasses.push(_32);},removeInvalidHandleType:function(_33){var _34=_33.toUpperCase();delete this.invalidHandleTypes[_34];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_35){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==_35){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(_37){var _38=true;var _39;try{_39=_37.nodeName.toUpperCase();}catch(e){_39=_37.nodeName;}_38=_38&&!this.invalidHandleTypes[_39];_38=_38&&!this.invalidHandleIds[_37.id];for(var i=0,len=this.invalidHandleClasses.length;_38&&i<len;++i){_38=!_2.hasClass(_37,this.invalidHandleClasses[i]);}return _38;},setXTicks:function(_40,_41){this.xTicks=[];this.xTickSize=_41;var _42={};for(var i=this.initPageX;i>=this.minX;i=i-_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_43,_44){this.yTicks=[];this.yTickSize=_44;var _45={};for(var i=this.initPageY;i>=this.minY;i=i-_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_46,_47,_48){this.leftConstraint=_46;this.rightConstraint=_47;this.minX=this.initPageX-_46;this.maxX=this.initPageX+_47;if(_48){this.setXTicks(this.initPageX,_48);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_50,_51){this.topConstraint=iUp;this.bottomConstraint=_50;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_50;if(_51){this.setYTicks(this.initPageY,_51);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_53){if(!_53){return val;}else{if(_53[0]>=val){return _53[0];}else{for(var i=0,len=_53.length;i<len;++i){var _54=i+1;if(_53[_54]&&_53[_54]>=val){var _55=val-_53[i];var _56=_53[_54]-val;return (_56>_55)?_53[i]:_53[_54];}}return _53[_53.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var _57=YAHOO.util.Event;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_58,_59){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_58].apply(oDD,_59);}}},_onLoad:function(){this.init();_57.on(document,"mouseup",this.handleMouseUp,this,true);_57.on(document,"mousemove",this.handleMouseMove,this,true);_57.on(window,"unload",this._onUnload,this,true);_57.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_61){if(!this.initialized){this.init();}if(!this.ids[_61]){this.ids[_61]={};}this.ids[_61][oDD.id]=oDD;},removeDDFromGroup:function(oDD,_62){if(!this.ids[_62]){this.ids[_62]={};}var obj=this.ids[_62];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];},regHandle:function(_65,_66){if(!this.handleIds[_65]){this.handleIds[_65]={};}this.handleIds[_65][_66]=_66;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(_67,_68){var _69=[];for(var i in _67.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_68||dd.isTarget){_69[_69.length]=dd;}}}return _69;},isLegalTarget:function(oDD,_71){var _72=this.getRelated(oDD,true);for(var i=0,len=_72.length;i<len;++i){if(_72[i].id==_71.id){return true;}}return false;},isTypeOfDD:function(oDD){return (oDD&&oDD.__ygDragDrop);},isHandle:function(_73,_74){return (this.handleIds[_73]&&this.handleIds[_73][_74]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}return null;},handleMouseDown:function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}this.dragThreshMet=true;},handleMouseUp:function(e){if(!this.dragCurrent){return;}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}this.dragCurrent.onMouseUp(e);}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}if(!this.dragThreshMet){var _76=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var _77=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(_76>this.clickPixelThresh||_77>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;},fireEvents:function(e,_78){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _80=[];var _81=[];var _82=[];var _83=[];var _84=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_81.push(ddo);}_80[i]=true;delete this.dragOvers[i];}for(var _86 in dc.groups){if("string"!=typeof _86){continue;}for(i in this.ids[_86]){var oDD=this.ids[_86][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_78){_83.push(oDD);}else{if(!_80[oDD.id]){_84.push(oDD);}else{_82.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_81.length){dc.b4DragOut(e,_81);dc.onDragOut(e,_81);}if(_84.length){dc.onDragEnter(e,_84);}if(_82.length){dc.b4DragOver(e,_82);dc.onDragOver(e,_82);}if(_83.length){dc.b4DragDrop(e,_83);dc.onDragDrop(e,_83);}}else{var len=0;for(i=0,len=_81.length;i<len;++i){dc.b4DragOut(e,_81[i].id);dc.onDragOut(e,_81[i].id);}for(i=0,len=_84.length;i<len;++i){dc.onDragEnter(e,_84[i].id);}for(i=0,len=_82.length;i<len;++i){dc.b4DragOver(e,_82[i].id);dc.onDragOver(e,_82[i].id);}for(i=0,len=_83.length;i<len;++i){dc.b4DragDrop(e,_83[i].id);dc.onDragDrop(e,_83[i].id);}}if(_78&&!_83.length){dc.onInvalidDrop(e);}},getBestMatch:function(dds){var _89=null;var len=dds.length;if(len==1){_89=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(dd.cursorIsOver){_89=dd;break;}else{if(!_89||_89.overlap.getArea()<dd.overlap.getArea()){_89=dd;}}}}return _89;},refreshCache:function(_90){for(var _91 in _90){if("string"!=typeof _91){continue;}for(var i in this.ids[_91]){var oDD=this.ids[_91][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){try{if(el){var _93=el.offsetParent;if(_93){return true;}}}catch(e){}return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=YAHOO.util.Dom.getXY(el);}catch(e){}if(!pos){return null;}x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new YAHOO.util.Region(t,r,b,l);},isOverTarget:function(pt,_94,_95){var loc=this.locationCache[_94.id];if(!loc||!this.useCache){loc=this.getLocation(_94);this.locationCache[_94.id]=loc;}if(!loc){return false;}_94.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!_95&&!dc.constrainX&&!dc.constrainY)){return _94.cursorIsOver;}_94.overlap=null;var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var _96=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var _97=_96.intersect(loc);if(_97){_94.overlap=_97;return (_95)?true:_94.cursorIsOver;}else{return false;}},_onUnload:function(e,me){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var _99=this.elementCache[id];if(!_99||!_99.el){_99=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id));}return _99;},getElement:function(id){return YAHOO.util.Dom.get(id);},getCss:function(id){var el=YAHOO.util.Dom.get(id);return (el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return YAHOO.util.Dom.getX(el);},getPosY:function(el){return YAHOO.util.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else{if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else{if(db){t=db.scrollTop;l=db.scrollLeft;}else{YAHOO.log("could not get scroll property");}}return {top:t,left:l};},getStyle:function(el,_104){return YAHOO.util.Dom.getStyle(el,_104);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(_105,_106){var _107=YAHOO.util.Dom.getXY(_106);YAHOO.util.Dom.setXY(_105,_107);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(a,b){return (a-b);},_timeoutCount:0,_addListeners:function(){var DDM=YAHOO.util.DDM;if(YAHOO.util.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_111,_112){if(id){this.init(id,_111,_112);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_113,_114){var x=_113-this.startPageX;var y=_114-this.startPageY;this.setDelta(x,y);},setDelta:function(_115,_116){this.deltaX=_115;this.deltaY=_116;},setDragElPos:function(_117,_118){var el=this.getDragEl();this.alignElWithMouse(el,_117,_118);},alignElWithMouse:function(el,_119,_120){var _121=this.getTargetCoord(_119,_120);if(!this.deltaSetXY){var _122=[_121.x,_121.y];YAHOO.util.Dom.setXY(el,_122);var _123=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _124=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_123-_121.x,_124-_121.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_121.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_121.y+this.deltaSetXY[1])+"px");}this.cachePosition(_121.x,_121.y);this.autoScroll(_121.x,_121.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(_125,_126){if(_125){this.lastPageX=_125;this.lastPageY=_126;}else{var _127=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_127[0];this.lastPageY=_127[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var _130=this.DDM.getClientHeight();var _131=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _135=w+x;var _136=(_130+st-y-this.deltaY);var _137=(_131+sl-x-this.deltaX);var _138=40;var _139=(document.all)?80:30;if(bot>_130&&_136<_138){window.scrollTo(sl,st+_139);}if(y<st&&st>0&&y-st<_138){window.scrollTo(sl,st-_139);}if(_135>_131&&_137<_138){window.scrollTo(sl+_139,st);}if(x<sl&&sl>0&&x-sl<_138){window.scrollTo(sl-_139,st);}}},getTargetCoord:function(_140,_141){var x=_140-this.deltaX;var y=_141-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;}if(y>this.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return ("DD "+this.id);}});YAHOO.util.DDProxy=function(id,_142,_143){if(id){this.init(id,_142,_143);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(_147,_148){var el=this.getEl();var _149=this.getDragEl();var s=_149.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_147,_148);YAHOO.util.Dom.setStyle(_149,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var _151=this.getDragEl();var bt=parseInt(DOM.getStyle(_151,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_151,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_151,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_151,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _156=Math.max(0,el.offsetWidth-br-bl);var _157=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(_151,"width",_156+"px");DOM.setStyle(_151,"height",_157+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return ("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,_160,_161){if(id){this.initTarget(id,_160,_161);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return ("DDTarget "+this.id);}}); | ||
| 3 | -YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id) | ||
| 4 | -{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b) | ||
| 5 | -{this._use_default_post_header=b;},setPollingInterval:function(i) | ||
| 6 | -{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId) | ||
| 7 | -{var obj,http;try | ||
| 8 | -{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};} | ||
| 9 | -catch(e) | ||
| 10 | -{for(var i=0;i<this._msxml_progid.length;++i){try | ||
| 11 | -{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;} | ||
| 12 | -catch(e){}}} | ||
| 13 | -finally | ||
| 14 | -{return obj;}},getConnectionObject:function() | ||
| 15 | -{var o;var tId=this._transaction_id;try | ||
| 16 | -{o=this.createXhrObject(tId);if(o){this._transaction_id++;}} | ||
| 17 | -catch(e){} | ||
| 18 | -finally | ||
| 19 | -{return o;}},asyncRequest:function(method,uri,callback,postData) | ||
| 20 | -{var o=this.getConnectionObject();if(!o){return null;} | ||
| 21 | -else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;} | ||
| 22 | -if(method=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;} | ||
| 23 | -else{uri+="?"+this._sFormData;}} | ||
| 24 | -else if(method=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}} | ||
| 25 | -o.conn.open(method,uri,true);if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}} | ||
| 26 | -if(this._has_http_headers){this.setHeader(o);} | ||
| 27 | -this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback) | ||
| 28 | -{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);} | ||
| 29 | -this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];} | ||
| 30 | -oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort) | ||
| 31 | -{if(!callback){this.releaseObject(o);return;} | ||
| 32 | -var httpStatus,responseObject;try | ||
| 33 | -{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;} | ||
| 34 | -else{httpStatus=13030;}} | ||
| 35 | -catch(e){httpStatus=13030;} | ||
| 36 | -if(httpStatus>=200&&httpStatus<300){try | ||
| 37 | -{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);} | ||
| 38 | -else{callback.success.apply(callback.scope,[responseObject]);}}} | ||
| 39 | -catch(e){}} | ||
| 40 | -else{try | ||
| 41 | -{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);} | ||
| 42 | -else{callback.failure.apply(callback.scope,[responseObject]);}} | ||
| 43 | -break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);} | ||
| 44 | -else{callback.failure.apply(callback.scope,[responseObject]);}}}} | ||
| 45 | -catch(e){}} | ||
| 46 | -this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg) | ||
| 47 | -{var obj={};var headerObj={};try | ||
| 48 | -{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}} | ||
| 49 | -catch(e){} | ||
| 50 | -obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;} | ||
| 51 | -return obj;},createExceptionObject:function(tId,callbackArg,isAbort) | ||
| 52 | -{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;} | ||
| 53 | -else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;} | ||
| 54 | -if(callbackArg){obj.argument=callbackArg;} | ||
| 55 | -return obj;},initHeader:function(label,value) | ||
| 56 | -{if(this._http_header[label]===undefined){this._http_header[label]=value;} | ||
| 57 | -else{this._http_header[label]=value+","+this._http_header[label];} | ||
| 58 | -this._has_http_headers=true;},setHeader:function(o) | ||
| 59 | -{for(var prop in this._http_header){if(this._http_header.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this._http_header[prop]);}} | ||
| 60 | -delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId,isUpload,secureUri) | ||
| 61 | -{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);} | ||
| 62 | -else if(typeof formId=='object'){oForm=formId;} | ||
| 63 | -else{return;} | ||
| 64 | -if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;} | ||
| 65 | -var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName) | ||
| 66 | -{switch(oElement.type) | ||
| 67 | -{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';} | ||
| 68 | -else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}} | ||
| 69 | -break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';} | ||
| 70 | -break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;} | ||
| 71 | -break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}} | ||
| 72 | -this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';} | ||
| 73 | -else if(typeof secureURI=='string'){io.src=secureUri;}} | ||
| 74 | -else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;} | ||
| 75 | -io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData) | ||
| 76 | -{var formElements=new Array();var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}} | ||
| 77 | -return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var io=document.getElementById(frameId);this._formNode.action=uri;this._formNode.method='POST';this._formNode.target=frameId;if(this._formNode.encoding){this._formNode.encoding='multipart/form-data';} | ||
| 78 | -else{this._formNode.enctype='multipart/form-data';} | ||
| 79 | -if(postData){var oElements=this.appendPostData(postData);} | ||
| 80 | -this._formNode.submit();if(oElements&&oElements.length>0){try | ||
| 81 | -{for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}} | ||
| 82 | -catch(e){}} | ||
| 83 | -this.resetFormState();var uploadCallback=function() | ||
| 84 | -{var obj={};obj.tId=id;obj.argument=callback.argument;try | ||
| 85 | -{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;} | ||
| 86 | -catch(e){} | ||
| 87 | -if(callback.upload){if(!callback.scope){callback.upload(obj);} | ||
| 88 | -else{callback.upload.apply(callback.scope,[obj]);}} | ||
| 89 | -if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);} | ||
| 90 | -else if(window.detachEvent){io.detachEvent('onload',uploadCallback);} | ||
| 91 | -else{io.removeEventListener('load',uploadCallback,false);} | ||
| 92 | -setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);} | ||
| 93 | -else if(window.attachEvent){io.attachEvent('onload',uploadCallback);} | ||
| 94 | -else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout) | ||
| 95 | -{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];} | ||
| 96 | -this.handleTransactionResponse(o,callback,true);return true;} | ||
| 97 | -else{return false;}},isCallInProgress:function(o) | ||
| 98 | -{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;} | ||
| 99 | -else{return false;}},releaseObject:function(o) | ||
| 100 | -{o.conn=null;o=null;}}; | ||
| 101 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};YAHOO.log=function(_2,_3,_4){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_2,_3,_4);}else{return false;}};YAHOO.extend=function(_6,_7,_8){var F=function(){};F.prototype=_7.prototype;_6.prototype=new F();_6.prototype.constructor=_6;_6.superclass=_7.prototype;if(_7.prototype.constructor==Object.prototype.constructor){_7.prototype.constructor=_7;}if(_8){for(var i in _8){_6.prototype[i]=_8[i];}}};YAHOO.augment=function(r,s){var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;++i){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}};YAHOO.namespace("util","widget","example");(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf("opera")>-1),isSafari=(ua.indexOf("safari")>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf("gecko")>-1),isIE=(!isOpera&&ua.indexOf("msie")>-1);var _10={HYPHEN:/(-[a-z])/i};var _11=function(_12){if(!_10.HYPHEN.test(_12)){return _12;}if(propertyCache[_12]){return propertyCache[_12];}while(_10.HYPHEN.exec(_12)){_12=_12.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[_12]=_12;return _12;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,_14){var _15=null;var _16=document.defaultView.getComputedStyle(el,"");if(_16){_15=_16[_11(_14)];}return el.style[_14]||_15;};}else{if(document.documentElement.currentStyle&&isIE){getStyle=function(el,_18){switch(_11(_18)){case "opacity":var val=100;try{val=el.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(e){try{val=el.filters("alpha").opacity;}catch(e){}}return val/100;break;default:var _1a=el.currentStyle?el.currentStyle[_18]:null;return (el.style[_18]||_1a);}};}else{getStyle=function(el,_1c){return el.style[_1c];};}}if(isIE){setStyle=function(el,_1e,val){switch(_1e){case "opacity":if(typeof el.style.filter=="string"){el.style.filter="alpha(opacity="+val*100+")";if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[_1e]=val;}};}else{setStyle=function(el,_21,val){el.style[_21]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!="string"&&!(el instanceof Array)){return el;}if(typeof el=="string"){return document.getElementById(el);}else{var _24=[];for(var i=0,len=el.length;i<len;++i){_24[_24.length]=Y.Dom.get(el[i]);}return _24;}return null;},getStyle:function(el,_27){_27=_11(_27);var f=function(_29){return getStyle(_29,_27);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,_2b,val){_2b=_11(_2b);var f=function(_2e){setStyle(_2e,_2b,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if(el.parentNode===null||el.offsetParent===null||this.getStyle(el,"display")=="none"){return false;}var _32=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var _36=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var _37=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return [box.left+_37,box.top+_36];}else{pos=[el.offsetLeft,el.offsetTop];_32=el.offsetParent;if(_32!=el){while(_32){pos[0]+=_32.offsetLeft;pos[1]+=_32.offsetTop;_32=_32.offsetParent;}}if(isSafari&&this.getStyle(el,"position")=="absolute"){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){_32=el.parentNode;}else{_32=null;}while(_32&&_32.tagName.toUpperCase()!="BODY"&&_32.tagName.toUpperCase()!="HTML"){if(Y.Dom.getStyle(_32,"display")!="inline"){pos[0]-=_32.scrollLeft;pos[1]-=_32.scrollTop;}if(_32.parentNode){_32=_32.parentNode;}else{_32=null;}}return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,_40){var f=function(el){var _43=this.getStyle(el,"position");if(_43=="static"){this.setStyle(el,"position","relative");_43="relative";}var _44=this.getXY(el);if(_44===false){return false;}var _45=[parseInt(this.getStyle(el,"left"),10),parseInt(this.getStyle(el,"top"),10)];if(isNaN(_45[0])){_45[0]=(_43=="relative")?0:el.offsetLeft;}if(isNaN(_45[1])){_45[1]=(_43=="relative")?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-_44[0]+_45[0]+"px";}if(pos[1]!==null){el.style.top=pos[1]-_44[1]+_45[1]+"px";}var _46=this.getXY(el);if(!_40&&(_46[0]!=pos[0]||_46[1]!=pos[1])){this.setXY(el,pos,true);}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var _4e=new Y.Region.getRegion(el);return _4e;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(_4f,tag,_51){var _52=function(el){return Y.Dom.hasClass(el,_4f);};return Y.Dom.getElementsBy(_52,tag,_51);},hasClass:function(el,_55){var re=new RegExp("(?:^|\\s+)"+_55+"(?:\\s+|$)");var f=function(el){return re.test(el["className"]);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,_5a){var f=function(el){if(this.hasClass(el,_5a)){return;}el["className"]=[el["className"],_5a].join(" ");};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,_5e){var re=new RegExp("(?:^|\\s+)"+_5e+"(?:\\s+|$)","g");var f=function(el){if(!this.hasClass(el,_5e)){return;}var c=el["className"];el["className"]=c.replace(re," ");if(this.hasClass(el,_5e)){this.removeClass(el,_5e);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,_64,_65){if(_64===_65){return false;}var re=new RegExp("(?:^|\\s+)"+_64+"(?:\\s+|$)","g");var f=function(el){if(!this.hasClass(el,_64)){this.addClass(el,_65);return;}el["className"]=el["className"].replace(re," "+_65+" ");if(this.hasClass(el,_64)){this.replaceClass(el,_64,_65);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,_6a){_6a=_6a||"yui-gen";el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}if(!el.id){el.id=_6a+id_counter++;}return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(_6d,_6e){_6d=Y.Dom.get(_6d);if(!_6d||!_6e){return false;}var f=function(_70){if(_6d.contains&&!isSafari){return _6d.contains(_70);}else{if(_6d.compareDocumentPosition){return !!(_6d.compareDocumentPosition(_70)&16);}else{var _71=_70.parentNode;while(_71){if(_71==_6d){return true;}else{if(!_71.tagName||_71.tagName.toUpperCase()=="HTML"){return false;}}_71=_71.parentNode;}return false;}}};return Y.Dom.batch(_6e,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(_75,tag,_77){tag=tag||"*";_77=Y.Dom.get(_77)||document;var _78=[];var _79=_77.getElementsByTagName(tag);if(!_79.length&&(tag=="*"&&_77.all)){_79=_77.all;}for(var i=0,len=_79.length;i<len;++i){if(_75(_79[i])){_78[_78.length]=_79[i];}}return _78;},batch:function(el,_7c,o,_7e){var id=el;el=Y.Dom.get(el);var _80=(_7e)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return _7c.call(_80,el,o);}var _81=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}_81[_81.length]=_7c.call(_80,el[i],o);}return _81;},getDocumentHeight:function(){var _83=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(_83,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var _85=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(_85,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var _87=self.innerHeight;var _88=document.compatMode;if((_88||isIE)&&!isOpera){_87=(_88=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return _87;},getViewportWidth:function(){var _89=self.innerWidth;var _8a=document.compatMode;if(_8a||isIE){_89=(_8a=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return _89;}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(_8f){return (_8f.left>=this.left&&_8f.right<=this.right&&_8f.top>=this.top&&_8f.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return ((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(_90){var t=Math.max(this.top,_90.top);var r=Math.min(this.right,_90.right);var b=Math.min(this.bottom,_90.bottom);var l=Math.max(this.left,_90.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(_95){var t=Math.min(this.top,_95.top);var r=Math.max(this.right,_95.right);var b=Math.max(this.bottom,_95.bottom);var l=Math.min(this.left,_95.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return ("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_9)){this._delete(i);_10=true;}}return _10;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}var _14=[],ret=true,i;for(i=0;i<arguments.length;++i){_14.push(arguments[i]);}var _15=_14.length;if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _16=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var _17=null;if(_14.length>0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_18){var s=this.subscribers[_18];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_18,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_20){this.fn=fn;this.obj=obj||null;this.override=_20;};YAHOO.util.Subscriber.prototype.getScope=function(_21){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return _21;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return (this.fn==fn&&this.obj==obj);}else{return (this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _22=false;var _23=[];var _24=[];var _25=[];var _26=[];var _27=0;var _28=[];var _29=[];var _30=0;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var _31=this;var _32=function(){_31._tryPreloadAttach();};this._interval=setInterval(_32,this.POLL_INTERVAL);}},onAvailable:function(_33,_34,_35,_36){_28.push({id:_33,fn:_34,obj:_35,override:_36,checkReady:false});_27=this.POLL_RETRYS;this.startInterval();},onContentReady:function(_37,_38,_39,_40){_28.push({id:_37,fn:_38,obj:_39,override:_40,checkReady:true});_27=this.POLL_RETRYS;this.startInterval();},addListener:function(el,_42,fn,obj,_43){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],_42,fn,obj,_43)&&ok;}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,_42,fn,obj,_43);});return true;}}}if(!el){return false;}if("unload"==_42&&obj!==this){_24[_24.length]=[el,_42,fn,obj,_43];return true;}var _46=el;if(_43){if(_43===true){_46=obj;}else{_46=_43;}}var _47=function(e){return fn.call(_46,YAHOO.util.Event.getEvent(e),obj);};var li=[el,_42,fn,_47,_46];var _50=_23.length;_23[_50]=li;if(this.useLegacyEvent(el,_42)){var _51=this.getLegacyIndex(el,_42);if(_51==-1||el!=_25[_51][0]){_51=_25.length;_29[el.id+_42]=_51;_25[_51]=[el,_42,el["on"+_42]];_26[_51]=[];el["on"+_42]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_51);};}_26[_51].push(li);}else{this._simpleAdd(el,_42,_47,false);}return true;},fireLegacyEvent:function(e,_52){var ok=true;var le=_26[_52];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _54=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_54,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_56){var key=this.generateId(el)+_56;if(typeof _29[key]=="undefined"){return -1;}else{return _29[key];}},useLegacyEvent:function(el,_58){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_58||"dblclick"==_58){return true;}}}return false;},removeListener:function(el,_59,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_59,fn)&&ok);}return ok;}}if(!fn||!fn.call){return this.purgeElement(el,false,_59);}if("unload"==_59){for(i=0,len=_24.length;i<len;i++){var li=_24[i];if(li&&li[0]==el&&li[1]==_59&&li[2]==fn){_24.splice(i,1);return true;}}return false;}var _60=null;var _61=arguments[3];if("undefined"==typeof _61){_61=this._getCacheIndex(el,_59,fn);}if(_61>=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i<len;++i){li=_63[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_59&&li[this.FN]==fn){_63.splice(i,1);}}}}else{this._simpleRemove(el,_59,_60[this.WFN],false);}delete _23[_61][this.WFN];delete _23[_61][this.FN];_23.splice(_61,1);return true;},getTarget:function(ev,_65){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_67){if(_67&&3==_67.nodeType){return _67.parentNode;}else{return _67;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,_71,fn){for(var i=0,len=_23.length;i<len;++i){var li=_23[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_71){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_30;++_30;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_22=true;var EU=YAHOO.util.Event;if(this.isIE){EU._simpleRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _75=!_22;if(!_75){_75=(_27>0);}var _76=[];for(var i=0,len=_28.length;i<len;++i){var _77=_28[i];if(_77){var el=this.getEl(_77.id);if(el){if(!_77.checkReady||_22||el.nextSibling||(document&&document.body)){var _78=el;if(_77.override){if(_77.override===true){_78=_77.obj;}else{_78=_77.override;}}_77.fn.call(_78,_77.obj);delete _28[i];}}else{_76.push(_77);}}}_27=(_76.length===0)?0:_27-1;if(_75){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,_79,_80){var _81=this.getListeners(el,_80);if(_81){for(var i=0,len=_81.length;i<len;++i){var l=_81[i];this.removeListener(el,l.type,l.fn);}}if(_79&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_79,_80);}}},getListeners:function(el,_83){var _84=[];if(_23&&_23.length>0){for(var i=0,len=_23.length;i<len;++i){var l=_23[i];if(l&&l[this.EL]===el&&(!_83||_83===l[this.TYPE])){_84.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_84.length)?_84:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=_24.length;i<len;++i){l=_24[i];if(l){var _85=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){_85=l[EU.OBJ];}else{_85=l[EU.ADJ_SCOPE];}}l[EU.FN].call(_85,EU.getEvent(e),l[EU.OBJ]);delete _24[i];l=null;_85=null;}}if(_23&&_23.length>0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i<len;++i){delete _25[i][0];delete _25[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(){if(window.addEventListener){return function(el,_87,fn,_88){el.addEventListener(_87,fn,(_88));};}else{if(window.attachEvent){return function(el,_89,fn,_90){el.attachEvent("on"+_89,fn);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,_91,fn,_92){el.removeEventListener(_91,fn,(_92));};}else{if(window.detachEvent){return function(el,_93,fn){el.detachEvent("on"+_93,fn);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(document&&document.body){EU._load();}else{EU._simpleAdd(window,"load",EU._load);}EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(_94,_95,_96,_97){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_94];if(ce){ce.subscribe(_95,_96,_97);}else{this.__yui_subscribers=this.__yui_subscribers||{};var _99=this.__yui_subscribers;if(!_99[_94]){_99[_94]=[];}_99[_94].push({fn:_95,obj:_96,override:_97});}},unsubscribe:function(_100,p_fn,_102){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_100];if(ce){return ce.unsubscribe(p_fn,_102);}else{return false;}},createEvent:function(_103,_104){this.__yui_events=this.__yui_events||{};var opts=_104||{};var _106=this.__yui_events;if(_106[_103]){}else{var _107=opts.scope||this;var _108=opts.silent||null;var ce=new YAHOO.util.CustomEvent(_103,_107,_108,YAHOO.util.CustomEvent.FLAT);_106[_103]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[_103];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}return _106[_103];},fireEvent:function(_110,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_110];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}return false;}};YAHOO.util.Anim=function(el,_157,_158,_159){if(el){this.init(el,_157,_158,_159);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return ("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,_15d,end){return this.method(this.currentFrame,_15d,end-_15d,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=="auto"&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,"position")=="absolute"&&pos)){val=el["offset"+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return "px";}return "";},setRuntimeAttribute:function(attr){var _16a;var end;var _16c=this.attributes;this.runtimeAttributes[attr]={};var _16d=function(prop){return (typeof prop!=="undefined");};if(!_16d(_16c[attr]["to"])&&!_16d(_16c[attr]["by"])){return false;}_16a=(_16d(_16c[attr]["from"]))?_16c[attr]["from"]:this.getAttribute(attr);if(_16d(_16c[attr]["to"])){end=_16c[attr]["to"];}else{if(_16d(_16c[attr]["by"])){if(_16a.constructor==Array){end=[];for(var i=0,len=_16a.length;i<len;++i){end[i]=_16a[i]+_16c[attr]["by"][i];}}else{end=_16a+_16c[attr]["by"];}}}this.runtimeAttributes[attr].start=_16a;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(_16d(_16c[attr].unit))?_16c[attr]["unit"]:this.getDefaultUnit(attr);},init:function(el,_171,_172,_173){var _174=false;var _175=null;var _176=0;el=YAHOO.util.Dom.get(el);this.attributes=_171||{};this.duration=_172||1;this.method=_173||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return _174;};this.getStartTime=function(){return _175;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);};this.stop=function(_177){if(_177){this.currentFrame=this.totalFrames;this._onTween.fire();}YAHOO.util.AnimMgr.stop(this);};var _178=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}_174=true;_176=0;_175=new Date();};var _17a=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return ("duration: "+data.duration+", currentFrame: "+data.currentFrame);};this.onTween.fire(data);var _17c=this.runtimeAttributes;for(var attr in _17c){this.setAttribute(attr,this.doMethod(attr,_17c[attr].start,_17c[attr].end),_17c[attr].unit);}_176+=1;};var _17e=function(){var _17f=(new Date()-_175)/1000;var data={duration:_17f,frames:_176,fps:_176/_17f};data.toString=function(){return ("duration: "+data.duration+", frames: "+data.frames+", fps: "+data.fps);};_174=false;_176=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent("_start",this,true);this.onStart=new YAHOO.util.CustomEvent("start",this);this.onTween=new YAHOO.util.CustomEvent("tween",this);this._onTween=new YAHOO.util.CustomEvent("_tween",this,true);this.onComplete=new YAHOO.util.CustomEvent("complete",this);this._onComplete=new YAHOO.util.CustomEvent("_complete",this,true);this._onStart.subscribe(_178);this._onTween.subscribe(_17a);this._onComplete.subscribe(_17e);}};YAHOO.util.AnimMgr=new function(){var _181=null;var _182=[];var _183=0;this.fps=200;this.delay=1;this.registerElement=function(_184){_182[_182.length]=_184;_183+=1;_184._onStart.fire();this.start();};this.unRegister=function(_185,_186){_185._onComplete.fire();_186=_186||getIndex(_185);if(_186!=-1){_182.splice(_186,1);}_183-=1;if(_183<=0){this.stop();}};this.start=function(){if(_181===null){_181=setInterval(this.run,this.delay);}};this.stop=function(_187){if(!_187){clearInterval(_181);for(var i=0,len=_182.length;i<len;++i){if(_182[i].isAnimated()){this.unRegister(_187,i);}}_182=[];_181=null;_183=0;}else{this.unRegister(_187);}};this.run=function(){for(var i=0,len=_182.length;i<len;++i){var _18a=_182[i];if(!_18a||!_18a.isAnimated()){continue;}if(_18a.currentFrame<_18a.totalFrames||_18a.totalFrames===null){_18a.currentFrame+=1;if(_18a.useSeconds){correctFrame(_18a);}_18a._onTween.fire();}else{YAHOO.util.AnimMgr.stop(_18a,i);}}};var _18b=function(anim){for(var i=0,len=_182.length;i<len;++i){if(_182[i]==anim){return i;}}return -1;};var _18e=function(_18f){var _190=_18f.totalFrames;var _191=_18f.currentFrame;var _192=(_18f.currentFrame*_18f.duration*1000/_18f.totalFrames);var _193=(new Date()-_18f.getStartTime());var _194=0;if(_193<_18f.duration*1000){_194=Math.round((_193/_192-1)*_18f.currentFrame);}else{_194=_190-(_191+1);}if(_194>0&&isFinite(_194)){if(_18f.currentFrame+_194>=_190){_194=_190-(_191+1);}_18f.currentFrame+=_194;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(_195,t){var n=_195.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[_195[i][0],_195[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}return [tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,_19c,_19d,_19e){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,_19c,_19d,_19e);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var _1a0=Y.ColorAnim.superclass;var _1a1=Y.ColorAnim.prototype;_1a1.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("ColorAnim "+id);};_1a1.patterns.color=/color$/i;_1a1.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;_1a1.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;_1a1.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;_1a1.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;_1a1.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return [parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return [parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return [parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};_1a1.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var _1a9=el.parentNode;val=Y.Dom.getStyle(_1a9,attr);while(_1a9&&this.patterns.transparent.test(val)){_1a9=_1a9.parentNode;val=Y.Dom.getStyle(_1a9,attr);if(_1a9.tagName.toUpperCase()=="HTML"){val="#fff";}}}}else{val=_1a0.getAttribute.call(this,attr);}return val;};_1a1.doMethod=function(attr,_1ab,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=_1ab.length;i<len;++i){val[i]=_1a0.doMethod.call(this,attr,_1ab[i],end[i]);}val="rgb("+Math.floor(val[0])+","+Math.floor(val[1])+","+Math.floor(val[2])+")";}else{val=_1a0.doMethod.call(this,attr,_1ab,end);}return val;};_1a1.setRuntimeAttribute=function(attr){_1a0.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var _1b0=this.attributes;var _1b1=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof _1b0[attr]["to"]==="undefined"&&typeof _1b0[attr]["by"]!=="undefined"){end=this.parseColor(_1b0[attr].by);for(var i=0,len=_1b1.length;i<len;++i){end[i]=_1b1[i]+end[i];}}this.runtimeAttributes[attr].start=_1b1;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return -c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}return -c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}return -c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d)==1){return b+c;}if(!p){p=d*0.3;}if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d)==1){return b+c;}if(!p){p=d*0.3;}if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d/2)==2){return b+c;}if(!p){p=d*(0.3*1.5);}if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}if(t<1){return -0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158;}return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158;}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158;}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else{if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b;}else{if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b;}}}},bounceBoth:function(t,b,c,d){if(t<d/2){return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*0.5+b;}return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*0.5+c*0.5+b;}};(function(){YAHOO.util.Motion=function(el,_204,_205,_206){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,_204,_205,_206);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var _208=Y.Motion.superclass;var _209=Y.Motion.prototype;_209.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("Motion "+id);};_209.patterns.points=/^points$/i;_209.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||"px";_208.setAttribute.call(this,"left",val[0],unit);_208.setAttribute.call(this,"top",val[1],unit);}else{_208.setAttribute.call(this,attr,val,unit);}};_209.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[_208.getAttribute.call(this,"left"),_208.getAttribute.call(this,"top")];}else{val=_208.getAttribute.call(this,attr);}return val;};_209.doMethod=function(attr,_212,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=_208.doMethod.call(this,attr,_212,end);}return val;};_209.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var _218=this.attributes;var _219;var _21a=_218["points"]["control"]||[];var end;var i,len;if(_21a.length>0&&!(_21a[0] instanceof Array)){_21a=[_21a];}else{var tmp=[];for(i=0,len=_21a.length;i<len;++i){tmp[i]=_21a[i];}_21a=tmp;}if(Y.Dom.getStyle(el,"position")=="static"){Y.Dom.setStyle(el,"position","relative");}if(isset(_218["points"]["from"])){Y.Dom.setXY(el,_218["points"]["from"]);}else{Y.Dom.setXY(el,Y.Dom.getXY(el));}_219=this.getAttribute("points");if(isset(_218["points"]["to"])){end=translateValues.call(this,_218["points"]["to"],_219);var _21e=Y.Dom.getXY(this.getEl());for(i=0,len=_21a.length;i<len;++i){_21a[i]=translateValues.call(this,_21a[i],_219);}}else{if(isset(_218["points"]["by"])){end=[_219[0]+_218["points"]["by"][0],_219[1]+_218["points"]["by"][1]];for(i=0,len=_21a.length;i<len;++i){_21a[i]=[_219[0]+_21a[i][0],_219[1]+_21a[i][1]];}}}this.runtimeAttributes[attr]=[_219];if(_21a.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(_21a);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{_208.setRuntimeAttribute.call(this,attr);}};var _21f=function(val,_221){var _222=Y.Dom.getXY(this.getEl());val=[val[0]-_222[0]+_221[0],val[1]-_222[1]+_221[1]];return val;};var _223=function(prop){return (typeof prop!=="undefined");};})();(function(){YAHOO.util.Scroll=function(el,_226,_227,_228){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,_226,_227,_228);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var _22a=Y.Scroll.superclass;var _22b=Y.Scroll.prototype;_22b.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("Scroll "+id);};_22b.doMethod=function(attr,_22f,end){var val=null;if(attr=="scroll"){val=[this.method(this.currentFrame,_22f[0],end[0]-_22f[0],this.totalFrames),this.method(this.currentFrame,_22f[1],end[1]-_22f[1],this.totalFrames)];}else{val=_22a.doMethod.call(this,attr,_22f,end);}return val;};_22b.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=="scroll"){val=[el.scrollLeft,el.scrollTop];}else{val=_22a.getAttribute.call(this,attr);}return val;};_22b.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=="scroll"){el.scrollLeft=val[0];el.scrollTop=val[1];}else{_22a.setAttribute.call(this,attr,val,unit);}};})();(function(){var _1=YAHOO.util.Event;var _2=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=_2.get(this.id);}return this._domRef;},getDragEl:function(){return _2.get(this.dragElId);},init:function(id,_9,_10){this.initTarget(id,_9,_10);_1.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_11,_12){this.config=_12||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.id=id;this.addToGroup((_11)?_11:"default");this.handleElId=id;_1.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_13,_14,_15,_16){if(!_14&&0!==_14){this.padding=[_13,_13,_13,_13];}else{if(!_15&&0!==_15){this.padding=[_13,_14,_13,_14];}else{this.padding=[_13,_14,_15,_16];}}},setInitPosition:function(_17,_18){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_17||0;var dy=_18||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_24){this.groups[_24]=true;this.DDM.regDragDrop(this,_24);},removeFromGroup:function(_25){if(this.groups[_25]){delete this.groups[_25];}this.DDM.removeDDFromGroup(this,_25);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}_1.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var _27=e.which||e.button;if(this.primaryButtonOnly&&_27>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _29=_1.getTarget(e);return (this.isValidHandleChild(_29)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_29,this.id)));},addInvalidHandleType:function(_30){var _31=_30.toUpperCase();this.invalidHandleTypes[_31]=_31;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_32){this.invalidHandleClasses.push(_32);},removeInvalidHandleType:function(_33){var _34=_33.toUpperCase();delete this.invalidHandleTypes[_34];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_35){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==_35){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(_37){var _38=true;var _39;try{_39=_37.nodeName.toUpperCase();}catch(e){_39=_37.nodeName;}_38=_38&&!this.invalidHandleTypes[_39];_38=_38&&!this.invalidHandleIds[_37.id];for(var i=0,len=this.invalidHandleClasses.length;_38&&i<len;++i){_38=!_2.hasClass(_37,this.invalidHandleClasses[i]);}return _38;},setXTicks:function(_40,_41){this.xTicks=[];this.xTickSize=_41;var _42={};for(var i=this.initPageX;i>=this.minX;i=i-_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_43,_44){this.yTicks=[];this.yTickSize=_44;var _45={};for(var i=this.initPageY;i>=this.minY;i=i-_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_46,_47,_48){this.leftConstraint=_46;this.rightConstraint=_47;this.minX=this.initPageX-_46;this.maxX=this.initPageX+_47;if(_48){this.setXTicks(this.initPageX,_48);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_50,_51){this.topConstraint=iUp;this.bottomConstraint=_50;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_50;if(_51){this.setYTicks(this.initPageY,_51);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_53){if(!_53){return val;}else{if(_53[0]>=val){return _53[0];}else{for(var i=0,len=_53.length;i<len;++i){var _54=i+1;if(_53[_54]&&_53[_54]>=val){var _55=val-_53[i];var _56=_53[_54]-val;return (_56>_55)?_53[i]:_53[_54];}}return _53[_53.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var _57=YAHOO.util.Event;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_58,_59){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_58].apply(oDD,_59);}}},_onLoad:function(){this.init();_57.on(document,"mouseup",this.handleMouseUp,this,true);_57.on(document,"mousemove",this.handleMouseMove,this,true);_57.on(window,"unload",this._onUnload,this,true);_57.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_61){if(!this.initialized){this.init();}if(!this.ids[_61]){this.ids[_61]={};}this.ids[_61][oDD.id]=oDD;},removeDDFromGroup:function(oDD,_62){if(!this.ids[_62]){this.ids[_62]={};}var obj=this.ids[_62];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];},regHandle:function(_65,_66){if(!this.handleIds[_65]){this.handleIds[_65]={};}this.handleIds[_65][_66]=_66;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(_67,_68){var _69=[];for(var i in _67.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_68||dd.isTarget){_69[_69.length]=dd;}}}return _69;},isLegalTarget:function(oDD,_71){var _72=this.getRelated(oDD,true);for(var i=0,len=_72.length;i<len;++i){if(_72[i].id==_71.id){return true;}}return false;},isTypeOfDD:function(oDD){return (oDD&&oDD.__ygDragDrop);},isHandle:function(_73,_74){return (this.handleIds[_73]&&this.handleIds[_73][_74]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}return null;},handleMouseDown:function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}this.dragThreshMet=true;},handleMouseUp:function(e){if(!this.dragCurrent){return;}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}this.dragCurrent.onMouseUp(e);}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}if(!this.dragThreshMet){var _76=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var _77=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(_76>this.clickPixelThresh||_77>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;},fireEvents:function(e,_78){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _80=[];var _81=[];var _82=[];var _83=[];var _84=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_81.push(ddo);}_80[i]=true;delete this.dragOvers[i];}for(var _86 in dc.groups){if("string"!=typeof _86){continue;}for(i in this.ids[_86]){var oDD=this.ids[_86][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_78){_83.push(oDD);}else{if(!_80[oDD.id]){_84.push(oDD);}else{_82.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_81.length){dc.b4DragOut(e,_81);dc.onDragOut(e,_81);}if(_84.length){dc.onDragEnter(e,_84);}if(_82.length){dc.b4DragOver(e,_82);dc.onDragOver(e,_82);}if(_83.length){dc.b4DragDrop(e,_83);dc.onDragDrop(e,_83);}}else{var len=0;for(i=0,len=_81.length;i<len;++i){dc.b4DragOut(e,_81[i].id);dc.onDragOut(e,_81[i].id);}for(i=0,len=_84.length;i<len;++i){dc.onDragEnter(e,_84[i].id);}for(i=0,len=_82.length;i<len;++i){dc.b4DragOver(e,_82[i].id);dc.onDragOver(e,_82[i].id);}for(i=0,len=_83.length;i<len;++i){dc.b4DragDrop(e,_83[i].id);dc.onDragDrop(e,_83[i].id);}}if(_78&&!_83.length){dc.onInvalidDrop(e);}},getBestMatch:function(dds){var _89=null;var len=dds.length;if(len==1){_89=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(dd.cursorIsOver){_89=dd;break;}else{if(!_89||_89.overlap.getArea()<dd.overlap.getArea()){_89=dd;}}}}return _89;},refreshCache:function(_90){for(var _91 in _90){if("string"!=typeof _91){continue;}for(var i in this.ids[_91]){var oDD=this.ids[_91][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){try{if(el){var _93=el.offsetParent;if(_93){return true;}}}catch(e){}return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=YAHOO.util.Dom.getXY(el);}catch(e){}if(!pos){return null;}x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new YAHOO.util.Region(t,r,b,l);},isOverTarget:function(pt,_94,_95){var loc=this.locationCache[_94.id];if(!loc||!this.useCache){loc=this.getLocation(_94);this.locationCache[_94.id]=loc;}if(!loc){return false;}_94.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!_95&&!dc.constrainX&&!dc.constrainY)){return _94.cursorIsOver;}_94.overlap=null;var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var _96=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var _97=_96.intersect(loc);if(_97){_94.overlap=_97;return (_95)?true:_94.cursorIsOver;}else{return false;}},_onUnload:function(e,me){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var _99=this.elementCache[id];if(!_99||!_99.el){_99=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id));}return _99;},getElement:function(id){return YAHOO.util.Dom.get(id);},getCss:function(id){var el=YAHOO.util.Dom.get(id);return (el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return YAHOO.util.Dom.getX(el);},getPosY:function(el){return YAHOO.util.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else{if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else{if(db){t=db.scrollTop;l=db.scrollLeft;}else{YAHOO.log("could not get scroll property");}}return {top:t,left:l};},getStyle:function(el,_104){return YAHOO.util.Dom.getStyle(el,_104);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(_105,_106){var _107=YAHOO.util.Dom.getXY(_106);YAHOO.util.Dom.setXY(_105,_107);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(a,b){return (a-b);},_timeoutCount:0,_addListeners:function(){var DDM=YAHOO.util.DDM;if(YAHOO.util.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_111,_112){if(id){this.init(id,_111,_112);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_113,_114){var x=_113-this.startPageX;var y=_114-this.startPageY;this.setDelta(x,y);},setDelta:function(_115,_116){this.deltaX=_115;this.deltaY=_116;},setDragElPos:function(_117,_118){var el=this.getDragEl();this.alignElWithMouse(el,_117,_118);},alignElWithMouse:function(el,_119,_120){var _121=this.getTargetCoord(_119,_120);if(!this.deltaSetXY){var _122=[_121.x,_121.y];YAHOO.util.Dom.setXY(el,_122);var _123=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _124=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_123-_121.x,_124-_121.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_121.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_121.y+this.deltaSetXY[1])+"px");}this.cachePosition(_121.x,_121.y);this.autoScroll(_121.x,_121.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(_125,_126){if(_125){this.lastPageX=_125;this.lastPageY=_126;}else{var _127=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_127[0];this.lastPageY=_127[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var _130=this.DDM.getClientHeight();var _131=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _135=w+x;var _136=(_130+st-y-this.deltaY);var _137=(_131+sl-x-this.deltaX);var _138=40;var _139=(document.all)?80:30;if(bot>_130&&_136<_138){window.scrollTo(sl,st+_139);}if(y<st&&st>0&&y-st<_138){window.scrollTo(sl,st-_139);}if(_135>_131&&_137<_138){window.scrollTo(sl+_139,st);}if(x<sl&&sl>0&&x-sl<_138){window.scrollTo(sl-_139,st);}}},getTargetCoord:function(_140,_141){var x=_140-this.deltaX;var y=_141-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;}if(y>this.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return ("DD "+this.id);}});YAHOO.util.DDProxy=function(id,_142,_143){if(id){this.init(id,_142,_143);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(_147,_148){var el=this.getEl();var _149=this.getDragEl();var s=_149.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_147,_148);YAHOO.util.Dom.setStyle(_149,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var _151=this.getDragEl();var bt=parseInt(DOM.getStyle(_151,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_151,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_151,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_151,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _156=Math.max(0,el.offsetWidth-br-bl);var _157=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(_151,"width",_156+"px");DOM.setStyle(_151,"height",_157+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return ("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,_160,_161){if(id){this.initTarget(id,_160,_161);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return ("DDTarget "+this.id);}});YAHOO.util.Connect={_msxml_progid:["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded",_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id){this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b){this._use_default_post_header=b;},setPollingInterval:function(i){if(typeof i=="number"&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(_350){var obj,http;try{http=new XMLHttpRequest();obj={conn:http,tId:_350};}catch(e){for(var i=0;i<this._msxml_progid.length;++i){try{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:_350};break;}catch(e){}}}finally{return obj;}},getConnectionObject:function(){var o;var tId=this._transaction_id;try{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}catch(e){}finally{return o;}},asyncRequest:function(_355,uri,_357,_358){var o=this.getConnectionObject();if(!o){return null;}else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,_357,uri,_358);this.releaseObject(o);return;}if(_355=="GET"){if(this._sFormData.length!=0){uri+=((uri.indexOf("?")==-1)?"?":"&")+this._sFormData;}else{uri+="?"+this._sFormData;}}else{if(_355=="POST"){_358=_358?this._sFormData+"&"+_358:this._sFormData;}}}o.conn.open(_355,uri,true);if(this._isFormSubmit||(_358&&this._use_default_post_header)){this.initHeader("Content-Type",this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}if(this._has_http_headers){this.setHeader(o);}this.handleReadyState(o,_357);o.conn.send(_358||null);return o;}},handleReadyState:function(o,_35b){var _35c=this;if(_35b&&_35b.timeout){this._timeOut[o.tId]=window.setTimeout(function(){_35c.abort(o,_35b,true);},_35b.timeout);}this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(_35c._poll[o.tId]);delete _35c._poll[o.tId];if(_35b&&_35b.timeout){delete _35c._timeOut[o.tId];}_35c.handleTransactionResponse(o,_35b);}},this._polling_interval);},handleTransactionResponse:function(o,_35e,_35f){if(!_35e){this.releaseObject(o);return;}var _360,responseObject;try{if(o.conn.status!==undefined&&o.conn.status!=0){_360=o.conn.status;}else{_360=13030;}}catch(e){_360=13030;}if(_360>=200&&_360<300){try{responseObject=this.createResponseObject(o,_35e.argument);if(_35e.success){if(!_35e.scope){_35e.success(responseObject);}else{_35e.success.apply(_35e.scope,[responseObject]);}}}catch(e){}}else{try{switch(_360){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,_35e.argument,(_35f?_35f:false));if(_35e.failure){if(!_35e.scope){_35e.failure(responseObject);}else{_35e.failure.apply(_35e.scope,[responseObject]);}}break;default:responseObject=this.createResponseObject(o,_35e.argument);if(_35e.failure){if(!_35e.scope){_35e.failure(responseObject);}else{_35e.failure.apply(_35e.scope,[responseObject]);}}}}catch(e){}}this.releaseObject(o);responseObject=null;},createResponseObject:function(o,_362){var obj={};var _364={};try{var _365=o.conn.getAllResponseHeaders();var _366=_365.split("\n");for(var i=0;i<_366.length;i++){var _368=_366[i].indexOf(":");if(_368!=-1){_364[_366[i].substring(0,_368)]=_366[i].substring(_368+2);}}}catch(e){}obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=_364;obj.getAllResponseHeaders=_365;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof _362!==undefined){obj.argument=_362;}return obj;},createExceptionObject:function(tId,_36a,_36b){var _36c=0;var _36d="communication failure";var _36e=-1;var _36f="transaction aborted";var obj={};obj.tId=tId;if(_36b){obj.status=_36e;obj.statusText=_36f;}else{obj.status=_36c;obj.statusText=_36d;}if(_36a){obj.argument=_36a;}return obj;},initHeader:function(_371,_372){if(this._http_header[_371]===undefined){this._http_header[_371]=_372;}else{this._http_header[_371]=_372+","+this._http_header[_371];}this._has_http_headers=true;},setHeader:function(o){for(var prop in this._http_header){if(this._http_header.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this._http_header[prop]);}}delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(_375,_376,_377){this.resetFormState();var _378;if(typeof _375=="string"){_378=(document.getElementById(_375)||document.forms[_375]);}else{if(typeof _375=="object"){_378=_375;}else{return;}}if(_376){this.createFrame(_377?_377:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=_378;return;}var _379,oName,oValue,oDisabled;var _37a=false;for(var i=0;i<_378.elements.length;i++){_379=_378.elements[i];oDisabled=_378.elements[i].disabled;oName=_378.elements[i].name;oValue=_378.elements[i].value;if(!oDisabled&&oName){switch(_379.type){case "select-one":case "select-multiple":for(var j=0;j<_379.options.length;j++){if(_379.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+"="+encodeURIComponent(_379.options[j].attributes["value"].specified?_379.options[j].value:_379.options[j].text)+"&";}else{this._sFormData+=encodeURIComponent(oName)+"="+encodeURIComponent(_379.options[j].hasAttribute("value")?_379.options[j].value:_379.options[j].text)+"&";}}}break;case "radio":case "checkbox":if(_379.checked){this._sFormData+=encodeURIComponent(oName)+"="+encodeURIComponent(oValue)+"&";}break;case "file":case undefined:case "reset":case "button":break;case "submit":if(_37a==false){this._sFormData+=encodeURIComponent(oName)+"="+encodeURIComponent(oValue)+"&";_37a=true;}break;default:this._sFormData+=encodeURIComponent(oName)+"="+encodeURIComponent(oValue)+"&";break;}}}this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(_37d){var _37e="yuiIO"+this._transaction_id;if(window.ActiveXObject){var io=document.createElement("<iframe id=\""+_37e+"\" name=\""+_37e+"\" />");if(typeof _37d=="boolean"){io.src="javascript:false";}else{if(typeof secureURI=="string"){io.src=_37d;}}}else{var io=document.createElement("iframe");io.id=_37e;io.name=_37e;}io.style.position="absolute";io.style.top="-1000px";io.style.left="-1000px";document.body.appendChild(io);},appendPostData:function(_381){var _382=new Array();var _383=_381.split("&");for(var i=0;i<_383.length;i++){var _385=_383[i].indexOf("=");if(_385!=-1){_382[i]=document.createElement("input");_382[i].type="hidden";_382[i].name=_383[i].substring(0,_385);_382[i].value=_383[i].substring(_385+1);this._formNode.appendChild(_382[i]);}}return _382;},uploadFile:function(id,_387,uri,_389){var _38a="yuiIO"+id;var io=document.getElementById(_38a);this._formNode.action=uri;this._formNode.method="POST";this._formNode.target=_38a;if(this._formNode.encoding){this._formNode.encoding="multipart/form-data";}else{this._formNode.enctype="multipart/form-data";}if(_389){var _38c=this.appendPostData(_389);}this._formNode.submit();if(_38c&&_38c.length>0){try{for(var i=0;i<_38c.length;i++){this._formNode.removeChild(_38c[i]);}}catch(e){}}this.resetFormState();var _38e=function(){var obj={};obj.tId=id;obj.argument=_387.argument;try{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}catch(e){}if(_387.upload){if(!_387.scope){_387.upload(obj);}else{_387.upload.apply(_387.scope,[obj]);}}if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",_38e);}else{if(window.detachEvent){io.detachEvent("onload",_38e);}else{io.removeEventListener("load",_38e,false);}}setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",_38e);}else{if(window.attachEvent){io.attachEvent("onload",_38e);}else{io.addEventListener("load",_38e,false);}}},abort:function(o,_391,_392){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(_392){delete this._timeOut[o.tId];}this.handleTransactionResponse(o,_391,true);return true;}else{return false;}},isCallInProgress:function(o){if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}else{return false;}},releaseObject:function(o){o.conn=null;o=null;}}; | ||
| 102 | \ No newline at end of file | 3 | \ No newline at end of file |
thirdpartyjs/yui/yahoo/yahoo.js
| 1 | -/* | ||
| 2 | -Copyright (c) 2006, Yahoo! Inc. All rights reserved. | ||
| 3 | -Code licensed under the BSD License: | ||
| 4 | -http://developer.yahoo.net/yui/license.txt | ||
| 5 | -version: 0.12.0 | ||
| 6 | -*/ | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * The YAHOO object is the single global object used by YUI Library. It | ||
| 10 | - * contains utility function for setting up namespaces, inheritance, and | ||
| 11 | - * logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces | ||
| 12 | - * created automatically for and used by the library. | ||
| 13 | - * @module yahoo | ||
| 14 | - * @title YAHOO Global | ||
| 15 | - */ | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * The YAHOO global namespace object | ||
| 19 | - * @class YAHOO | ||
| 20 | - * @static | ||
| 21 | - */ | ||
| 22 | -if (typeof YAHOO == "undefined") { | ||
| 23 | - var YAHOO = {}; | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | -/** | ||
| 27 | - * Returns the namespace specified and creates it if it doesn't exist | ||
| 28 | - * <pre> | ||
| 29 | - * YAHOO.namespace("property.package"); | ||
| 30 | - * YAHOO.namespace("YAHOO.property.package"); | ||
| 31 | - * </pre> | ||
| 32 | - * Either of the above would create YAHOO.property, then | ||
| 33 | - * YAHOO.property.package | ||
| 34 | - * | ||
| 35 | - * Be careful when naming packages. Reserved words may work in some browsers | ||
| 36 | - * and not others. For instance, the following will fail in Safari: | ||
| 37 | - * <pre> | ||
| 38 | - * YAHOO.namespace("really.long.nested.namespace"); | ||
| 39 | - * </pre> | ||
| 40 | - * This fails because "long" is a future reserved word in ECMAScript | ||
| 41 | - * | ||
| 42 | - * @method namespace | ||
| 43 | - * @static | ||
| 44 | - * @param {String*} arguments 1-n namespaces to create | ||
| 45 | - * @return {Object} A reference to the last namespace object created | ||
| 46 | - */ | ||
| 47 | -YAHOO.namespace = function() { | ||
| 48 | - var a=arguments, o=null, i, j, d; | ||
| 49 | - for (i=0; i<a.length; ++i) { | ||
| 50 | - d=a[i].split("."); | ||
| 51 | - o=YAHOO; | ||
| 52 | - | ||
| 53 | - // YAHOO is implied, so it is ignored if it is included | ||
| 54 | - for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; ++j) { | ||
| 55 | - o[d[j]]=o[d[j]] || {}; | ||
| 56 | - o=o[d[j]]; | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - return o; | ||
| 61 | -}; | ||
| 62 | - | ||
| 63 | -/** | ||
| 64 | - * Uses YAHOO.widget.Logger to output a log message, if the widget is available. | ||
| 65 | - * | ||
| 66 | - * @method log | ||
| 67 | - * @static | ||
| 68 | - * @param {String} msg The message to log. | ||
| 69 | - * @param {String} cat The log category for the message. Default | ||
| 70 | - * categories are "info", "warn", "error", time". | ||
| 71 | - * Custom categories can be used as well. (opt) | ||
| 72 | - * @param {String} src The source of the the message (opt) | ||
| 73 | - * @return {Boolean} True if the log operation was successful. | ||
| 74 | - */ | ||
| 75 | -YAHOO.log = function(msg, cat, src) { | ||
| 76 | - var l=YAHOO.widget.Logger; | ||
| 77 | - if(l && l.log) { | ||
| 78 | - return l.log(msg, cat, src); | ||
| 79 | - } else { | ||
| 80 | - return false; | ||
| 81 | - } | ||
| 82 | -}; | ||
| 83 | - | ||
| 84 | -/** | ||
| 85 | - * Utility to set up the prototype, constructor and superclass properties to | ||
| 86 | - * support an inheritance strategy that can chain constructors and methods. | ||
| 87 | - * | ||
| 88 | - * @method extend | ||
| 89 | - * @static | ||
| 90 | - * @param {Function} subc the object to modify | ||
| 91 | - * @param {Function} superc the object to inherit | ||
| 92 | - * @param {String[]} overrides additional properties/methods to add to the | ||
| 93 | - * subclass prototype. These will override the | ||
| 94 | - * matching items obtained from the superclass | ||
| 95 | - * if present. | ||
| 96 | - */ | ||
| 97 | -YAHOO.extend = function(subc, superc, overrides) { | ||
| 98 | - var F = function() {}; | ||
| 99 | - F.prototype=superc.prototype; | ||
| 100 | - subc.prototype=new F(); | ||
| 101 | - subc.prototype.constructor=subc; | ||
| 102 | - subc.superclass=superc.prototype; | ||
| 103 | - if (superc.prototype.constructor == Object.prototype.constructor) { | ||
| 104 | - superc.prototype.constructor=superc; | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - if (overrides) { | ||
| 108 | - for (var i in overrides) { | ||
| 109 | - subc.prototype[i]=overrides[i]; | ||
| 110 | - } | ||
| 111 | - } | ||
| 112 | -}; | ||
| 113 | - | ||
| 114 | -/** | ||
| 115 | - * Applies all prototype properties in the supplier to the receiver if the | ||
| 116 | - * receiver does not have these properties yet. Optionally, one or more | ||
| 117 | - * methods/properties can be specified (as additional parameters). This | ||
| 118 | - * option will overwrite the property if receiver has it already. | ||
| 119 | - * | ||
| 120 | - * @method augment | ||
| 121 | - * @static | ||
| 122 | - * @param {Function} r the object to receive the augmentation | ||
| 123 | - * @param {Function} s the object that supplies the properties to augment | ||
| 124 | - * @param {String*} arguments zero or more properties methods to augment the | ||
| 125 | - * receiver with. If none specified, everything | ||
| 126 | - * in the supplier will be used unless it would | ||
| 127 | - * overwrite an existing property in the receiver | ||
| 128 | - */ | ||
| 129 | -YAHOO.augment = function(r, s) { | ||
| 130 | - var rp=r.prototype, sp=s.prototype, a=arguments, i, p; | ||
| 131 | - if (a[2]) { | ||
| 132 | - for (i=2; i<a.length; ++i) { | ||
| 133 | - rp[a[i]] = sp[a[i]]; | ||
| 134 | - } | ||
| 135 | - } else { | ||
| 136 | - for (p in sp) { | ||
| 137 | - if (!rp[p]) { | ||
| 138 | - rp[p] = sp[p]; | ||
| 139 | - } | ||
| 140 | - } | ||
| 141 | - } | ||
| 142 | -}; | ||
| 143 | - | ||
| 144 | -YAHOO.namespace("util", "widget", "example"); | ||
| 145 | - | 1 | +if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};YAHOO.log=function(_2,_3,_4){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_2,_3,_4);}else{return false;}};YAHOO.extend=function(_6,_7,_8){var F=function(){};F.prototype=_7.prototype;_6.prototype=new F();_6.prototype.constructor=_6;_6.superclass=_7.prototype;if(_7.prototype.constructor==Object.prototype.constructor){_7.prototype.constructor=_7;}if(_8){for(var i in _8){_6.prototype[i]=_8[i];}}};YAHOO.augment=function(r,s){var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;++i){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}};YAHOO.namespace("util","widget","example"); |
| 146 | \ No newline at end of file | 2 | \ No newline at end of file |