diff --git a/lib/dashboard/Notification.inc.php b/lib/dashboard/Notification.inc.php index 0b8a176..3bade91 100644 --- a/lib/dashboard/Notification.inc.php +++ b/lib/dashboard/Notification.inc.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -58,7 +58,7 @@ class KTNotification extends KTEntity { /** primary key value */ var $iId = -1; var $iUserId; - + // sType and sLabel provide the title of the dashboard alert. var $sLabel; // a simple label - e.g. the document's title, or so forth. var $sType; // namespaced item type. (e.g. ktcore/subscriptions, word/officeupload) @@ -73,34 +73,34 @@ class KTNotification extends KTEntity { var $iData2; // sData1 and sData2 are 255-length character fields var $sData1; - var $sData2; + var $sData2; // sText1 is a 65535-length text field - var $sText1; - + var $sText1; + var $_bUsePearError = true; - + function getId() { return $this->iId; } - - function getLabel() { return $this->sLabel; } + + function getLabel() { return $this->sLabel; } function setLabel($sLabel) { $this->sLabel = $sLabel; } - function getType() { return $this->sType; } + function getType() { return $this->sType; } function setType($sType) { $this->sType = $sType; } - - function getIntData1() { return $this->iData1; } + + function getIntData1() { return $this->iData1; } function setIntData1($iData1) { $this->iData1 = $iData1; } - function getIntData2() { return $this->iData2; } + function getIntData2() { return $this->iData2; } function setIntData2($iData2) { $this->iData2 = $iData2; } - function getStrData1() { return $this->sData1; } + function getStrData1() { return $this->sData1; } function setStrData1($sData1) { $this->sData1 = $sData1; } - function getStrData2() { return $this->sData2; } - function setStrData2($sData2) { $this->sData2 = $sData2; } - function getTextData1() { return $this->sText1; } - function setTextData1($mValue) { $this->sText1 = $mValue; } + function getStrData2() { return $this->sData2; } + function setStrData2($sData2) { $this->sData2 = $sData2; } + function getTextData1() { return $this->sText1; } + function setTextData1($mValue) { $this->sText1 = $mValue; } var $_aFieldToSelect = array( "iId" => "id", "iUserId" => "user_id", - "sLabel" => "label", + "sLabel" => "label", "sType" => "type", "dCreationDate" => "creation_date", "iData1" => "data_int_1", @@ -109,7 +109,7 @@ class KTNotification extends KTEntity { "sData2" => "data_str_2", "sText1" => "data_text_1", ); - + function _table () { return KTUtil::getTableName('notifications'); } @@ -118,11 +118,11 @@ class KTNotification extends KTEntity { $notificationRegistry =& KTNotificationRegistry::getSingleton(); $handler = $notificationRegistry->getHandler($this->sType); - if (is_null($handler)) { return null; } - + if (is_null($handler)) { return null; } + return $handler->handleNotification($this); } - + function &getHandler() { $notificationRegistry =& KTNotificationRegistry::getSingleton(); $handler =& $notificationRegistry->getHandler($this->sType); @@ -131,10 +131,10 @@ class KTNotification extends KTEntity { // Static function function &get($iId) { return KTEntityUtil::get('KTNotification', $iId); } - function &getList($sWhereClause = null, $aOptions = null ) { + function &getList($sWhereClause = null, $aOptions = null ) { if(!is_array($aOptions)) $aOptions = array($aOptions); $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'creation_date DESC'); - return KTEntityUtil::getList2('KTNotification', $sWhereClause, $aOptions); + return KTEntityUtil::getList2('KTNotification', $sWhereClause, $aOptions); } function &createFromArray($aOptions) { return KTEntityUtil::createFromArray('KTNotification', $aOptions); } @@ -151,14 +151,15 @@ class KTNotificationHandler extends KTStandardDispatcher { function handleNotification($oKTNotification) { $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate("kt3/notifications/generic"); - $aTemplateData = array("context" => $oKTNotification,); + + $aTemplateData = array("context" => $oKTNotification, "oKTConfig" => $oKTConfig); return $oTemplate->render($aTemplateData); } function do_main() { $this->resolveNotification($this->notification); } - + // called to resolve the notification (typically from /notify.php?id=xxxxx function resolveNotification($oKTNotification) { $_SESSION['KTErrorMessage'][] = _kt("This notification handler does not support publication."); @@ -172,10 +173,10 @@ class KTSubscriptionNotification extends KTNotificationHandler { /* Subscription Notifications * * Subscriptions are a large part of the notification volume. - * That said, notifications cater to a larger group, so there is some + * That said, notifications cater to a larger group, so there is some * degree of mismatch between the two. * - * Mapping the needs of subscriptions onto the provisions of notifications + * Mapping the needs of subscriptions onto the provisions of notifications * works as: * * $oKTN->label: object name [e.g. Document Name] @@ -183,9 +184,9 @@ class KTSubscriptionNotification extends KTNotificationHandler { * $oKTN->strData2: _location_ name. (e.g. folder of the subscription.) * $oKTN->intData1: object id (e.g. document_id, folder_id) * $oKTN->intData2: actor id (e.g. user_id) - * + * */ - + var $notificationType = 'ktcore/subscriptions'; var $_eventObjectMap = array( @@ -202,7 +203,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { "ArchivedDocument" => 'document', // can go through and request un-archival (?) "RestoredArchivedDocument" => 'document', "DiscussDocument" => 'document', - ); + ); function KTSubscriptionNotification() { $this->_eventTypeNames = array( @@ -218,7 +219,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { "MovedDocument" => _kt('Document moved'), "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?) "RestoredArchivedDocument" => _kt('Document restored'), - "DiscussDocument" => _kt('Document Discussions updated'), + "DiscussDocument" => _kt('Document Discussions updated'), ); //parent::KTNotificationHandler(); } @@ -233,9 +234,9 @@ class KTSubscriptionNotification extends KTNotificationHandler { 'has_actor' => false, 'notify_id' => $oKTNotification->getId(), ); - + $info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name']; - + if ($info['actor_id'] !== null) { $oTempUser = User::get($info['actor_id']); if (PEAR::isError($oTempUser) || ($oTempUser == false)) { @@ -246,31 +247,31 @@ class KTSubscriptionNotification extends KTNotificationHandler { $info['has_actor'] = true; } } - + if ($info['object_id'] !== null) { $info['object'] = $this->_getEventObject($info['event_type'], $info['object_id']); } - + return $info; } - + // resolve the object type based on the alert type. function _getEventObject($sAlertType, $id) { $t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); - + if ($t == 'document') { $o = Document::get($id); - if (PEAR::isError($o) || ($o == false)) { return null; + if (PEAR::isError($o) || ($o == false)) { return null; } else { return $o; } } else if ($t == 'folder') { $o = Folder::get($id); - if (PEAR::isError($o) || ($o == false)) { return null; + if (PEAR::isError($o) || ($o == false)) { return null; } else { return $o; } } else { return null; } } - + function _getEventObjectType($sAlertType) { return KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); } @@ -286,21 +287,21 @@ class KTSubscriptionNotification extends KTNotificationHandler { /* "iId" => "id", "iUserId" => "user_id", - "sLabel" => "label", + "sLabel" => "label", "sType" => "type", "dCreationDate" => "creation_date", "iData1" => "data_int_1", "iData2" => "data_int_2", "sData1" => "data_str_1", "sData2" => "data_str_2", - + 'object_name' => $oKTNotification->getLabel(), 'event_type' => $oKTNotification->getStrData1(), 'location_name' => $oKTNotification->getStrData2(), 'object_id' => $oKTNotification->getIntData1(), 'actor_id' => $oKTNotification->getIntData2(), - 'has_actor' => false, - + 'has_actor' => false, + */ $creationInfo['sLabel'] = $aOptions['target_name']; $creationInfo['sData1'] = $aOptions['event_type']; @@ -312,20 +313,23 @@ class KTSubscriptionNotification extends KTNotificationHandler { $creationInfo['dCreationDate'] = getCurrentDateTime(); // erk. global $default; - + //$default->log->debug('subscription notification: from ' . print_r($aOptions, true)); $default->log->debug('subscription notification: using ' . print_r($creationInfo, true)); - + $oNotification =& KTNotification::createFromArray($creationInfo); - - + + $default->log->debug('subscription notification: created ' . print_r($oNotification, true)); - + return $oNotification; // $res. } - - - + + /** + * View the notification, and clear if requested + * + * @param unknown_type $oKTNotification + */ function resolveNotification($oKTNotification) { $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); if ($notify_action == 'clear') { @@ -333,38 +337,38 @@ class KTSubscriptionNotification extends KTNotificationHandler { $oKTNotification->delete(); exit(redirect(generateControllerLink('dashboard'))); } - + // otherwise, we want to redirect the to object represented by the item. // - viewDocument and viewFolder are the appropriate items. - // - object_id + // - object_id $info = $this->_getSubscriptionData($oKTNotification); - + $object_type = $this->_getEventObjectType($info['event_type']); - + if ($object_type == '') { - $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; + $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; exit(redirect(generateControllerLink('dashboard'))); - } - + } + if ($object_type == 'document') { if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. $params = 'fDocumentId=' . $info['object_id']; $url = generateControllerLink('viewDocument', $params); - $oKTNotification->delete(); // clear the alert. + //$oKTNotification->delete(); // clear the alert. exit(redirect($url)); - } + } } else if ($object_type == 'folder') { if ($info['object_id'] !== null) { // fails and generates an error with no doc-id. $params = 'fFolderId=' . $info['object_id']; $url = generateControllerLink('browse', $params); - $oKTNotification->delete(); // clear the alert. + //$oKTNotification->delete(); // clear the alert. exit(redirect($url)); - } + } } - $_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); + $_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); exit(redirect(generateControllerLink('dashboard'))); } - + } class KTWorkflowNotification extends KTNotificationHandler { @@ -374,41 +378,41 @@ class KTWorkflowNotification extends KTNotificationHandler { foreach ($aNotifications as $oNotification) { $oNotification->delete(); } - + } - function & newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) { - $aInfo = array(); + function & newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) { + $aInfo = array(); $aInfo['sData1'] = $oState->getName(); $aInfo['sData2'] = $sComments; $aInfo['iData1'] = $oDocument->getId(); $aInfo['iData2'] = $oActor->getId(); $aInfo['sType'] = 'ktcore/workflow'; - $aInfo['dCreationDate'] = getCurrentDateTime(); + $aInfo['dCreationDate'] = getCurrentDateTime(); $aInfo['iUserId'] = $oUser->getId(); $aInfo['sLabel'] = $oDocument->getName(); - + $oNotification = KTNotification::createFromArray($aInfo); - + $handler = new KTWorkflowNotification(); - + if ($oUser->getEmailNotification() && (strlen($oUser->getEmail()) > 0)) { $emailContent = $handler->handleNotification($oNotification); $emailSubject = sprintf(_kt('Workflow Notification: %s'), $oDocument->getName()); $oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent); $oEmail->send(); } - + return $oNotification; } - function handleNotification($oKTNotification) { + function handleNotification($oKTNotification) { $oTemplating =& KTTemplating::getSingleton(); $oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/workflow_notification'); - + $oDoc = Document::get($oKTNotification->getIntData1()); $isBroken = (PEAR::isError($oDoc) || ($oDoc->getStatusID() != LIVE)); - + $oTemplate->setData(array( 'context' => $this, 'document_id' => $oKTNotification->getIntData1(), @@ -421,7 +425,7 @@ class KTWorkflowNotification extends KTNotificationHandler { )); return $oTemplate->render(); } - + function resolveNotification($oKTNotification) { $notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null); if ($notify_action == 'clear') { @@ -429,10 +433,10 @@ class KTWorkflowNotification extends KTNotificationHandler { $oKTNotification->delete(); exit(redirect(generateControllerLink('dashboard'))); } - + $params = 'fDocumentId=' . $oKTNotification->getIntData1(); $url = generateControllerLink('viewDocument', $params); - $oKTNotification->delete(); // clear the alert. + //$oKTNotification->delete(); // clear the alert. exit(redirect($url)); } } diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index ceed319..1f538f2 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -10,32 +10,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ */ @@ -191,17 +191,17 @@ class KTDocumentUtil { return true; } - + function archive($oDocument, $sReason) { - + $this->startTransaction(); $oDocument->setStatusID(ARCHIVED); $res = $oDocument->update(); - + if (PEAR::isError($res) || ($res === false)) { return PEAR::raiseError(_kt('There was a database error while trying to archive this file')); } - + $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt('Document archived: %s'), $sReason), 'ktcore.transactions.update'); $oDocumentTransaction->create(); @@ -222,12 +222,12 @@ class KTDocumentUtil { return $ret; } } - + // fire subscription alerts for the archived document $oSubscriptionEvent = new SubscriptionEvent(); $oFolder = Folder::get($oDocument->getFolderID()); $oSubscriptionEvent->ArchivedDocument($oDocument, $oFolder); - + return true; } @@ -904,6 +904,10 @@ class KTDocumentUtil { $res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId()); if (PEAR::isError($res)) { return $res; } + $oNewDocument->setIsCheckedOut(false); + $oNewDocument->setCheckedOutUserID(-1); + + // finally, copy the actual file. $oStorage =& KTStorageManagerUtil::getSingleton(); $res = $oStorage->copy($oDocument, $oNewDocument); @@ -967,7 +971,7 @@ class KTDocumentUtil { return $ret; } } - + // fire subscription alerts for the copied document $oSubscriptionEvent = new SubscriptionEvent(); $oFolder = Folder::get($oDocument->getFolderID()); @@ -1077,7 +1081,7 @@ class KTDocumentUtil { return $ret; } } - + // fire subscription alerts for the moved document $oSubscriptionEvent = new SubscriptionEvent(); $oSubscriptionEvent->MoveDocument($oDocument, $oFolder, $oOriginalFolder); diff --git a/lib/documentmanagement/observers.inc.php b/lib/documentmanagement/observers.inc.php index c9f9f59..20b3764 100644 --- a/lib/documentmanagement/observers.inc.php +++ b/lib/documentmanagement/observers.inc.php @@ -70,9 +70,6 @@ class JavascriptObserver { } function start() { - $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js'); - $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js'); - $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js'); $this->context->oPage->requireJSResource('resources/js/add_document.js'); $this->context->oRedirector =& $this; $this->context->handleOutput('
 
'); diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php index 8874ea7..dc665c1 100644 --- a/lib/templating/kt3template.inc.php +++ b/lib/templating/kt3template.inc.php @@ -130,7 +130,7 @@ class KTPage { $aJS[] = 'thirdpartyjs/MochiKit/MochiKitPacked.js'; $aJS[] = 'resources/js/kt-utility.js'; $aJS[] = 'presentation/i18nJavascript.php'; - $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners.inc.js'; + $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners_lite.inc.js'; $aJS[] = 'resources/js/loader.js'; $aJS[] = 'thirdpartyjs/yui/tools/tools.js'; $aJS[] = 'thirdpartyjs/yui/connection/connection.js'; diff --git a/plugins/ktcore/KTBulkActions.php b/plugins/ktcore/KTBulkActions.php index 710c046..dfc21dc 100644 --- a/plugins/ktcore/KTBulkActions.php +++ b/plugins/ktcore/KTBulkActions.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -484,9 +484,9 @@ class KTBulkArchiveAction extends KTBulkAction { function perform_action($oEntity) { if(is_a($oEntity, 'Document')) { - + $res = KTDocumentUtil::archive($oEntity, $this->sReason); - + if(PEAR::isError($res)){ return $res; } @@ -530,9 +530,13 @@ class KTBulkArchiveAction extends KTBulkAction { if(!empty($aDocuments)){ foreach($aDocuments as $sDocumentId){ $oDocument = Document::get($sDocumentId); - - $res = KTDocumentUtil::archive($oEntity, $this->sReason); - + + if(PEAR::isError($oDocument)){ + return $oDocument; + } + + $res = KTDocumentUtil::archive($oDocument, $this->sReason); + if(PEAR::isError($res)){ return $res; } @@ -548,7 +552,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { var $_sPermission = 'ktcore.permissions.read'; var $_bMutator = true; var $bNotifications = true; - + function getDisplayName() { return _kt('Export'); } @@ -580,7 +584,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { $this->startTransaction(); $oKTConfig =& KTConfig::getSingleton(); $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); - + $this->bNotifications = ($oKTConfig->get('export/enablenotifications', 'on') == 'on') ? true : false; $result = parent::do_performaction(); @@ -600,7 +604,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { )); $this->commitTransaction(); - + $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode)); $str = sprintf('

' . _kt('Go here to download the zip file if you are not automatically redirected there') . "

\n", $url); $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); @@ -611,9 +615,9 @@ class KTBrowseBulkExportAction extends KTBulkAction { document.location.href = "%s"; } callLater(1, kt_bulkexport_redirect); - + ', $url); - + return $str; } @@ -627,14 +631,14 @@ class KTBrowseBulkExportAction extends KTBulkAction { $oDocumentTransaction = new DocumentTransaction($oDocument, "Document part of bulk export", 'ktstandard.transactions.bulk_export', array()); $oDocumentTransaction->create(); } - + // fire subscription alerts for the downloaded document - if global config is set if($this->bNotifications){ $oSubscriptionEvent = new SubscriptionEvent(); $oFolder = Folder::get($oDocument->getFolderID()); $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); } - + $this->oZip->addDocumentToZip($oDocument); }else if(is_a($oEntity, 'Folder')) { @@ -695,12 +699,12 @@ class KTBrowseBulkExportAction extends KTBulkAction { function do_downloadZipFile() { $sCode = $this->oValidator->validateString($_REQUEST['exportcode']); - + $folderName = $this->oFolder->getName(); $this->oZip = new ZipFolder($folderName); - + $res = $this->oZip->downloadZipFile($sCode); - + if(PEAR::isError($res)){ $this->addErrorMessage($res->getMessage()); redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); @@ -798,7 +802,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { $oKTConfig =& KTConfig::getSingleton(); $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); - + $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); $sReturn = sprintf('

' . _kt('Return to the original folder') . "

\n", $folderurl); @@ -809,7 +813,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { $folderName = $this->oFolder->getName(); $this->oZip = new ZipFolder($folderName); $res = $this->oZip->checkConvertEncoding(); - + if(PEAR::isError($res)){ $this->addErrorMessage($res->getMessage()); return $sReturn; @@ -836,7 +840,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { $this->commitTransaction(); if($this->bDownload){ - + $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode)); $str = sprintf('

' . _kt('Go here to download the zip file if you are not automatically redirected there') . "

\n", $url); $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); @@ -847,9 +851,9 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { document.location.href = "%s"; } callLater(1, kt_bulkexport_redirect); - + ', $url); - + return $str; } return $result; @@ -938,15 +942,15 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { } return true; } - + function do_downloadZipFile() { $sCode = $this->oValidator->validateString($_REQUEST['exportcode']); - + $folderName = $this->oFolder->getName(); $this->oZip = new ZipFolder($folderName); - + $res = $this->oZip->downloadZipFile($sCode); - + if(PEAR::isError($res)){ $this->addErrorMessage($res->getMessage()); redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId())); diff --git a/plugins/ktcore/admin/documentFieldsv2.php b/plugins/ktcore/admin/documentFieldsv2.php index 8aac953..99041e3 100644 --- a/plugins/ktcore/admin/documentFieldsv2.php +++ b/plugins/ktcore/admin/documentFieldsv2.php @@ -6,32 +6,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -49,7 +49,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { function predispatch() { $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Field Management')); $this->persistParams(array('fFieldsetId')); - + $this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId')); if (PEAR::isError($this->oFieldset)) { $this->oFieldset = null; @@ -63,7 +63,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { function do_main () { $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/list'); - + $oTemplate->setData(array( 'context' => $this, 'fieldsets' => KTFieldset::getList('disabled != true'), @@ -80,10 +80,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'cancel_action' => 'main', 'fail_action' => 'newfieldset', 'action' => 'create', - 'context' => $this, + 'context' => $this, )); - - + + // construct the widget set. // we use a slight variation here, because "type" is only present in certain circumstances. $widgets = array( @@ -98,16 +98,16 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'name' => 'description', 'required' => true, 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), - )), + )), ); if ($this->bHaveConditional) { - + // FIXME get this from some external source. $type_vocab = array( 'normal' => _kt("Normal"), - 'conditional' => _kt("Conditional"), + 'conditional' => _kt("Conditional"), ); - + $widgets[] = array('ktcore.widgets.selection', array( 'label' => _kt("Fieldset Type"), 'use_simple' => false, @@ -119,20 +119,20 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'vocab' => $type_vocab, )); } - + $widgets[] = array('ktcore.widgets.boolean',array( 'label' => _kt("Generic"), 'name' => 'generic', '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."), )); - + $oForm->setWidgets($widgets); - + // similarly, we construct validators here. $validators = array( array('ktcore.validators.string', array( 'test' => 'name', - 'output' => 'name', + 'output' => 'name', )), array('ktcore.validators.string', array( 'test' => 'description', @@ -143,65 +143,65 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'output' => 'generic', )), ); - + if ($this->bHaveConditional) { $validators[] = array('ktcore.validators.string', array( 'test' => 'fieldset_type', 'output' => 'fieldset_type', )); } - + $oForm->setValidators($validators); - + return $oForm; } function do_newfieldset() { $this->oPage->setBreadcrumbDetails(_kt("Create New Fieldset")); $oForm = $this->form_create(); - + return $oForm->render(); } - + function do_create() { $oForm = $this->form_create(); $res = $oForm->validate(); - + $data = $res['results']; $errors = $res['errors']; $extra_errors = array(); - + if (!empty($data['name'])) { $oFieldset = KTFieldset::getByName($data['name']); if (!PEAR::isError($oFieldset)) { // means we're looking at an existing name $extra_errors['name'] = _kt("There is already a fieldset with that name."); - } + } } - + $is_conditional = false; // FIXME this is inelegant. get it from somewhere else. if ($this->bHaveConditional && ($data['fieldset_type'] == 'conditional')) { $is_conditional = true; } - - + + if (!empty($errors) || !empty($extra_errors)) { return $oForm->handleError(null, $extra_errors); } - + // we also need a namespace. $temp_name = $data['name']; $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); $oOldFieldset = KTFieldset::getByNamespace($namespace); - + while (!PEAR::isError($oOldFieldset)) { $temp_name .= '_'; $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name); - $oOldFieldset = KTFieldset::getByNamespace($namespace); + $oOldFieldset = KTFieldset::getByNamespace($namespace); } - - // we now know its a non-conflicting one. + + // we now know its a non-conflicting one. // FIXME handle conditional fieldsets, which should be ... a different object. $oFieldset = KTFieldset::createFromArray(array( "name" => $data['name'], @@ -212,29 +212,29 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { "isGeneric" => $data['generic'], "isComplete" => false, "isComplex" => false, - "isSystem" => false, + "isSystem" => false, )); if (PEAR::isError($oFieldset)) { return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage())); } - + $this->successRedirectTo('edit',_kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId())); - } + } function getTypesForFieldset($oFieldset) { if ($oFieldset->getIsGeneric()) { return _kt('All types use this generic fieldset.'); } - + $types = $oFieldset->getAssociatedTypes(); if (PEAR::isError($types)) { return _kt('Error retrieving list of types.'); } - if (empty($types)) { + if (empty($types)) { return _kt('None'); } $aNames = array(); - foreach ($types as $oType) { + foreach ($types as $oType) { if (!PEAR::isError($oType)) { $aNames[] = $oType->getName(); } @@ -247,30 +247,30 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { // here we engage in some major evil. // we check for the subevent var // and subdispatch if appropriate. - // + // // saves a little code-duplication (actually, a lot of code-duplication) - + // FIXME this is essentially a stub for the fieldset-delegation code. if ($this->oFieldset->getIsConditional()) { require_once('fieldsets/conditional.inc.php'); - $oSubDispatcher = new ConditionalFieldsetManagementDispatcher; + $oSubDispatcher = new ConditionalFieldsetManagementDispatcher; } else { require_once('fieldsets/basic.inc.php'); $oSubDispatcher = new BasicFieldsetManagementDispatcher; } - + $subevent_var = 'fieldset_action'; $subevent = KTUtil::arrayGet($_REQUEST, $subevent_var); if (!empty($subevent)) { // do nothing, since this will handle everything $this_url = KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit")); - $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url); + $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url); exit(0); } else { // what we want is the "additional info" section $additional = $oSubDispatcher->describe_fieldset($this->oFieldset); } - + $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/edit'); $oTemplate->setData(array( 'context' => $this, @@ -279,9 +279,19 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { )); return $oTemplate->render(); } - + function do_delete() { $this->startTransaction(); + + // check if fieldset is associated with a document type - remove association + $types = $this->oFieldset->getAssociatedTypes(); + $sFieldSetId = $this->oFieldset->getId(); + if(!PEAR::isError($types) AND !empty($types)){ + foreach($types as $oType){ + $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $sFieldSetId); + } + } + $res = $this->oFieldset->delete('true'); $this->oValidator->notErrorFalse($res, array( 'redirect_to' => array('main', ''), @@ -289,7 +299,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { )); $this->successRedirectToMain(_kt('Fieldset deleted')); } - + function form_edit() { $oForm = new KTForm; $oForm->setOptions(array( @@ -299,10 +309,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'cancel_action' => 'edit', 'fail_action' => 'editfieldset', 'action' => 'savefieldset', - 'context' => $this, + 'context' => $this, )); - - + + // construct the widget set. // we use a slight variation here, because "type" is only present in certain circumstances. $widgets = array( @@ -318,24 +328,24 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'name' => 'description', 'required' => true, 'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."), - 'value' => sanitizeForHTML($this->oFieldset->getDescription()), - )), + 'value' => sanitizeForHTML($this->oFieldset->getDescription()), + )), ); - + $widgets[] = array('ktcore.widgets.boolean',array( 'label' => _kt("Generic"), 'name' => 'generic', '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."), - 'value' => $this->oFieldset->getIsGeneric(), + 'value' => $this->oFieldset->getIsGeneric(), )); - + $oForm->setWidgets($widgets); - + // similarly, we construct validators here. $validators = array( array('ktcore.validators.string', array( 'test' => 'name', - 'output' => 'name', + 'output' => 'name', )), array('ktcore.validators.string', array( 'test' => 'description', @@ -346,22 +356,22 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { 'output' => 'generic', )), ); - + $oForm->setValidators($validators); - + return $oForm; } - - function do_editfieldset() { + + function do_editfieldset() { $oForm = $this->form_edit(); $this->oPage->setBreadcrumbDetails(_kt('edit fieldset')); return $oForm->renderPage(_kt("Edit Fieldset")); } - - function do_savefieldset() { + + function do_savefieldset() { $oForm = $this->form_edit(); $res = $oForm->validate(); - + $data = $res['results']; $errors = $res['errors']; $extra_errors = array(); @@ -371,18 +381,18 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { $extra_errors['name'][] = _kt("A fieldset with that name already exists."); } } - + if (!empty($errors) || !empty($extra_errors)) { return $oForm->handleError(null, $extra_errors); } - + $this->startTransaction(); - + $this->oFieldset->setName($data['name']); - $this->oFieldset->setDescription($data['description']); + $this->oFieldset->setDescription($data['description']); $bGeneric = $data['generic']; if ($bGeneric != $this->oFieldset->getIsGeneric() && $bGeneric == true) { - // delink it from all doctypes. + // delink it from all doctypes. $aTypes = $this->oFieldset->getAssociatedTypes(); foreach ($aTypes as $oType) { $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $this->oFieldset->getId()); @@ -392,17 +402,17 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { } } } - - $this->oFieldset->setIsGeneric($data['generic']); - + + $this->oFieldset->setIsGeneric($data['generic']); + $res = $this->oFieldset->update(); if (PEAR::isError($res)) { $this->errorRedirectTo('edit', _kt('Could not save fieldset changes')); exit(0); } - + return $this->successRedirectTo('edit', _kt("Fieldset details updated.")); - } + } } ?> diff --git a/plugins/ktcore/admin/fieldsets/basic.inc.php b/plugins/ktcore/admin/fieldsets/basic.inc.php index 1678506..1011a3a 100644 --- a/plugins/ktcore/admin/fieldsets/basic.inc.php +++ b/plugins/ktcore/admin/fieldsets/basic.inc.php @@ -608,8 +608,6 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { $renderedTree = $this->_evilTreeRenderer($fieldTree); $this->oPage->setTitle(_kt('Edit Lookup Tree')); - - //$this->oPage->requireJSResource('thirdparty/js/MochiKit/Base.js'); if ($current_node == 0) { $category_name = 'Root'; } else { diff --git a/plugins/ktstandard/KTBulkExportPlugin.php b/plugins/ktstandard/KTBulkExportPlugin.php index f658f04..861793c 100644 --- a/plugins/ktstandard/KTBulkExportPlugin.php +++ b/plugins/ktstandard/KTBulkExportPlugin.php @@ -106,8 +106,6 @@ class KTBulkExportAction extends KTFolderAction { exit(0); } - $this->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js'); - $this->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js'); $this->oPage->template = "kt3/minimal_page"; $this->handleOutput(""); diff --git a/sql/mysql/install/rebuild.bat b/sql/mysql/install/rebuild.bat index bf56b25..baf0b1a 100644 --- a/sql/mysql/install/rebuild.bat +++ b/sql/mysql/install/rebuild.bat @@ -14,7 +14,7 @@ mysqladmin -u root -p -f drop %INPUT% ECHO ---- Creating database %INPUT% ---- mysqladmin -u root -p create %INPUT% ECHO ---- Creating structure for database %INPUT% ---- -mysql -u root %INPUT%oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/taillog.js')} diff --git a/templates/kt3/notifications/subscriptions.AddDocument.smarty b/templates/kt3/notifications/subscriptions.AddDocument.smarty index 0931815..f54ad2a 100644 --- a/templates/kt3/notifications/subscriptions.AddDocument.smarty +++ b/templates/kt3/notifications/subscriptions.AddDocument.smarty @@ -1,13 +1,26 @@
{$info.title|sanitize}
+ {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}.
- {if !$is_broken} - {i18n}View Document{/i18n} - {else} - {i18n}Document is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Document{/i18n} + {else} + {i18n}Document is no longer available{/i18n} + {/if} + +  |  + +
+
diff --git a/templates/kt3/notifications/subscriptions.AddFolder.smarty b/templates/kt3/notifications/subscriptions.AddFolder.smarty index fd23def..a1897a9 100644 --- a/templates/kt3/notifications/subscriptions.AddFolder.smarty +++ b/templates/kt3/notifications/subscriptions.AddFolder.smarty @@ -3,11 +3,22 @@ {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}.
+
{if !$is_broken} - {i18n}View New Folder{/i18n} - {else} - {i18n}Folder is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} + {i18n}View New Folder{/i18n} + {else} + {i18n}Folder is no longer available{/i18n} + {/if} +  |  + +
+ +
diff --git a/templates/kt3/notifications/subscriptions.ArchivedDocument.smarty b/templates/kt3/notifications/subscriptions.ArchivedDocument.smarty index 32210fa..0cd268f 100644 --- a/templates/kt3/notifications/subscriptions.ArchivedDocument.smarty +++ b/templates/kt3/notifications/subscriptions.ArchivedDocument.smarty @@ -3,6 +3,9 @@ {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}. diff --git a/templates/kt3/notifications/subscriptions.CheckInDocument.smarty b/templates/kt3/notifications/subscriptions.CheckInDocument.smarty index 4fe7a1d..5bbf175 100644 --- a/templates/kt3/notifications/subscriptions.CheckInDocument.smarty +++ b/templates/kt3/notifications/subscriptions.CheckInDocument.smarty @@ -3,11 +3,18 @@ {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}.
- {if !$is_broken} - {i18n}View Document{/i18n} - {else} - {i18n}Document is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Document{/i18n} + {else} + {i18n}Document is no longer available{/i18n} + {/if} +  |  +
+ {i18n}Clear Alert{/i18n} + {i18n}Clear Alert{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty b/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty index 4a48000..af607f3 100644 --- a/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty +++ b/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty @@ -3,11 +3,18 @@ {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}.
- {if !$is_broken} - {i18n}View Document{/i18n} - {else} - {i18n}Document is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Document{/i18n} + {else} + {i18n}Document is no longer available{/i18n} + {/if} +  |  +
+ {i18n}Clear Alert{/i18n} + {i18n}Clear Alert{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.DiscussDocument.smarty b/templates/kt3/notifications/subscriptions.DiscussDocument.smarty index a691323..eabfd95 100644 --- a/templates/kt3/notifications/subscriptions.DiscussDocument.smarty +++ b/templates/kt3/notifications/subscriptions.DiscussDocument.smarty @@ -7,11 +7,20 @@ The discussion around document "{$info.object_name|sanitize}" has been updated. {/if}
- {if !$is_broken} - {i18n}View Document{/i18n} - {else} - {i18n}Document is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Document{/i18n} + {else} + {i18n}Document is no longer available{/i18n} + {/if} +  |  +
+ + {i18n}Clear Alert{/i18n} + + {i18n}Clear Alert{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.ModifyDocument.smarty b/templates/kt3/notifications/subscriptions.ModifyDocument.smarty index c61fb83..ed8625b 100644 --- a/templates/kt3/notifications/subscriptions.ModifyDocument.smarty +++ b/templates/kt3/notifications/subscriptions.ModifyDocument.smarty @@ -3,11 +3,20 @@ {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}.
- {if !$is_broken} - {i18n}View Document{/i18n} - {else} - {i18n}Document is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Document{/i18n} + {else} + {i18n}Document is no longer available{/i18n} + {/if} +  |  +
+ + {i18n}Clear Alert{/i18n} + + {i18n}Clear Alert{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.MoveDocument.smarty b/templates/kt3/notifications/subscriptions.MoveDocument.smarty index 194c549..504c68b 100644 --- a/templates/kt3/notifications/subscriptions.MoveDocument.smarty +++ b/templates/kt3/notifications/subscriptions.MoveDocument.smarty @@ -3,12 +3,21 @@ {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}.
- {if !$is_broken} - {i18n}View New Location{/i18n} - {else} - {i18n}Location is no longer available{/i18n} - {/if} +
+ {if !$is_broken} + {i18n}View New Location{/i18n} + {else} + {i18n}Location is no longer available{/i18n} + {/if} - | {i18n}Clear Alert{/i18n} +  |  +
+ + {i18n}Clear Alert{/i18n} + + {i18n}Clear Alert{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty b/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty index e0db4f0..c347c53 100644 --- a/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty +++ b/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty @@ -3,11 +3,20 @@ {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}.
- {if !$is_broken} - {i18n}View Folder{/i18n} - {else} - {i18n}Folder is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Folder{/i18n} + {else} + {i18n}Folder is no longer available{/i18n} + {/if} +  |  +
+ + {i18n}Clear Alert{/i18n} + + {i18n}Clear Alert{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty b/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty index 105eaf0..da6816a 100644 --- a/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty +++ b/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty @@ -3,12 +3,21 @@ {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}.
- {if !$is_broken} - {i18n}View Folder{/i18n} - {else} - {i18n}Location is no longer available{/i18n} - {/if} +
+ {if !$is_broken} + {i18n}View Folder{/i18n} + {else} + {i18n}Location is no longer available{/i18n} + {/if} - | {i18n}Clear Alert{/i18n} +  |  + diff --git a/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty b/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty index 2ecebd8..7f9b479 100644 --- a/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty +++ b/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty @@ -3,6 +3,12 @@ {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}. diff --git a/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty b/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty index 1a8c49a..f8eaf16 100644 --- a/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty +++ b/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty @@ -3,6 +3,12 @@ {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}. diff --git a/templates/kt3/notifications/subscriptions.RestoreDocument.smarty b/templates/kt3/notifications/subscriptions.RestoreDocument.smarty index 02aa440..4f36447 100644 --- a/templates/kt3/notifications/subscriptions.RestoreDocument.smarty +++ b/templates/kt3/notifications/subscriptions.RestoreDocument.smarty @@ -3,6 +3,12 @@ {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been restored by an administrator.{/i18n} diff --git a/templates/kt3/notifications/subscriptions.generic.smarty b/templates/kt3/notifications/subscriptions.generic.smarty index fdc7074..0bfb0ab 100644 --- a/templates/kt3/notifications/subscriptions.generic.smarty +++ b/templates/kt3/notifications/subscriptions.generic.smarty @@ -1,6 +1,12 @@
{$info.title|sanitize}
diff --git a/templates/ktcore/action/checkout_final.smarty b/templates/ktcore/action/checkout_final.smarty index 43f5268..30e2c6d 100644 --- a/templates/ktcore/action/checkout_final.smarty +++ b/templates/ktcore/action/checkout_final.smarty @@ -1,8 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} - {capture assign=sLocation}action=checkout_final&fDocumentId={$context->oDocument->getId()}&reason={$reason|escape:'url'}{/capture} {capture assign=sJavascript} diff --git a/templates/ktcore/assist/assist_notification.smarty b/templates/ktcore/assist/assist_notification.smarty index 4f3057c..c734fb6 100644 --- a/templates/ktcore/assist/assist_notification.smarty +++ b/templates/ktcore/assist/assist_notification.smarty @@ -4,11 +4,20 @@ user, #user#, has requested help on the document #name#, and you are the owner or an admin of this document.{/i18n}
- {if !$is_broken} - {i18n}View Help Request{/i18n} - {else} - {i18n}Document is no longer available{/i18n} - {/if} - | {i18n}Clear Alert{/i18n} +
+ {if !$is_broken} + {i18n}View Help Request{/i18n} + {else} + {i18n}Document is no longer available{/i18n} + {/if} +  |  +
+ + {i18n}Clear Alert{/i18n} + + {i18n}Clear Alert{/i18n}
diff --git a/templates/ktcore/assist/assist_notification_details.smarty b/templates/ktcore/assist/assist_notification_details.smarty index c3bb4cf..f2c14eb 100644 --- a/templates/ktcore/assist/assist_notification_details.smarty +++ b/templates/ktcore/assist/assist_notification_details.smarty @@ -12,7 +12,16 @@ diff --git a/templates/ktcore/boolean_search_change.smarty b/templates/ktcore/boolean_search_change.smarty index 2b8b08f..4a0f6b4 100644 --- a/templates/ktcore/boolean_search_change.smarty +++ b/templates/ktcore/boolean_search_change.smarty @@ -1,8 +1,3 @@ -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} {$context->oPage->requireJSResource("resources/js/taillog.js")} {$context->oPage->requireJSResource("resources/js/constructed_search.js")} {$context->oPage->requireJSResource("resources/js/constructed_search_postprocess.js")} diff --git a/templates/ktcore/boolean_search_edit.smarty b/templates/ktcore/boolean_search_edit.smarty index f7003b2..1404bbb 100644 --- a/templates/ktcore/boolean_search_edit.smarty +++ b/templates/ktcore/boolean_search_edit.smarty @@ -1,8 +1,3 @@ -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} {$context->oPage->requireJSResource("resources/js/taillog.js")} {$context->oPage->requireJSResource("resources/js/constructed_search.js")} {$context->oPage->requireJSResource("resources/js/constructed_search_postprocess.js")} diff --git a/templates/ktcore/document/add.smarty b/templates/ktcore/document/add.smarty index 520fc08..96d2090 100644 --- a/templates/ktcore/document/add.smarty +++ b/templates/ktcore/document/add.smarty @@ -1,9 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/taillog.js')} @@ -50,6 +44,11 @@ function startupMetadata() { document_type_changed(); } +function progressIndicator(){ + var indicator = document.getElementById(); + indicator.style.display = "block"; +} + addLoadEvent(startupMetadata); {/literal} {/capture} diff --git a/templates/ktcore/document/admin/deletedlist.smarty b/templates/ktcore/document/admin/deletedlist.smarty index 8ac6ba7..e80a6ac 100644 --- a/templates/ktcore/document/admin/deletedlist.smarty +++ b/templates/ktcore/document/admin/deletedlist.smarty @@ -1,7 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/toggleselect.js')} {$context->oPage->requireJSResource('resources/js/expungeList.js')} diff --git a/templates/ktcore/document/edit.smarty b/templates/ktcore/document/edit.smarty index ac124e6..7f989e4 100644 --- a/templates/ktcore/document/edit.smarty +++ b/templates/ktcore/document/edit.smarty @@ -1,9 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/taillog.js')} diff --git a/templates/ktcore/folder/bulkImport.smarty b/templates/ktcore/folder/bulkImport.smarty index 6f1f350..50a5f55 100644 --- a/templates/ktcore/folder/bulkImport.smarty +++ b/templates/ktcore/folder/bulkImport.smarty @@ -1,9 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/taillog.js')} {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} diff --git a/templates/ktcore/folder/bulkUpload.smarty b/templates/ktcore/folder/bulkUpload.smarty index 1ed3ce6..77721b4 100644 --- a/templates/ktcore/folder/bulkUpload.smarty +++ b/templates/ktcore/folder/bulkUpload.smarty @@ -1,9 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/taillog.js')} {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} diff --git a/templates/ktcore/folder/roles_managegroups.smarty b/templates/ktcore/folder/roles_managegroups.smarty index bfd4537..631c5c6 100644 --- a/templates/ktcore/folder/roles_managegroups.smarty +++ b/templates/ktcore/folder/roles_managegroups.smarty @@ -1,9 +1,6 @@

{i18n arg_rolename=$rolename}Allocate Groups to Role: #rolename#{/i18n}

{$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')}

{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}

diff --git a/templates/ktcore/folder/roles_manageusers.smarty b/templates/ktcore/folder/roles_manageusers.smarty index b356687..6d7bb0a 100644 --- a/templates/ktcore/folder/roles_manageusers.smarty +++ b/templates/ktcore/folder/roles_manageusers.smarty @@ -1,9 +1,6 @@

{i18n}Allocate User to Role{/i18n}

{$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')}

{i18n}Add or remove users for this role. {/i18n}

diff --git a/templates/ktcore/forms/widgets/collection.smarty b/templates/ktcore/forms/widgets/collection.smarty index 2d3c5f0..a9fdae1 100644 --- a/templates/ktcore/forms/widgets/collection.smarty +++ b/templates/ktcore/forms/widgets/collection.smarty @@ -7,12 +7,6 @@ - - - - - - diff --git a/templates/ktcore/login.smarty b/templates/ktcore/login.smarty index 6b90288..650c0e1 100644 --- a/templates/ktcore/login.smarty +++ b/templates/ktcore/login.smarty @@ -11,7 +11,7 @@ - + @@ -45,6 +45,7 @@
@@ -54,24 +55,72 @@
{/if}

- {i18n arg_appname="$appname"}#appname# Version{/i18n} {$versionName}
- {i18n}Document Management Software{/i18n}
- {i18n}© 2007 The Jam Warehouse Software (Pty) Ltd.{/i18n}

- {if ($smallVersion == 'OSS')} - {i18n}This program is free software and published under the GNU General Public License version 3{/i18n}
- {else} - {i18n}All rights reserved.{/i18n}
- {/if} + {i18n}Access to this service is subject to the KnowledgeTreeLive Terms and Conditions of use.{/i18n}
+ {i18n}© 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved{/i18n}

- -
+
+
+ + + + + + + + + + + + + + + + +
Close
Please note that this feature is only used to reset the ADMIN password. System users should contact admin to reset their password.
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Please note that this feature is only used to reset the ADMIN password. System users should contact admin to reset their password.
+
+
+
+
+
+
+ {if $reset_password == true} + + {else} + + {/if} - - - - diff --git a/templates/ktcore/metadata/admin/edit_lookuptree.smarty b/templates/ktcore/metadata/admin/edit_lookuptree.smarty index 7552341..9aa36a0 100644 --- a/templates/ktcore/metadata/admin/edit_lookuptree.smarty +++ b/templates/ktcore/metadata/admin/edit_lookuptree.smarty @@ -1,7 +1,4 @@ {$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")}

get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Edit Lookup Tree{/i18n}:
{$field->getName()}

diff --git a/templates/ktcore/metadata/conditional/conditional_overview.smarty b/templates/ktcore/metadata/conditional/conditional_overview.smarty index 9c5c34e..904315d 100644 --- a/templates/ktcore/metadata/conditional/conditional_overview.smarty +++ b/templates/ktcore/metadata/conditional/conditional_overview.smarty @@ -1,8 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} {$context->oPage->requireJSResource('resources/js/taillog.js')} {$context->oPage->requireJSResource('resources/js/conditional_usage.js')} diff --git a/templates/ktcore/metadata/conditional/editcomplex.smarty b/templates/ktcore/metadata/conditional/editcomplex.smarty index 0d131fc..751dc3d 100644 --- a/templates/ktcore/metadata/conditional/editcomplex.smarty +++ b/templates/ktcore/metadata/conditional/editcomplex.smarty @@ -35,13 +35,6 @@ {/capture} {$context->oPage->requireCSSStandalone($sCSS)} - -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} - {$context->oPage->requireJSResource("resources/js/taillog.js")} {$context->oPage->requireJSResource("resources/js/conditional_complex_edit.js")} diff --git a/templates/ktcore/metadata/conditional/editsimple.smarty b/templates/ktcore/metadata/conditional/editsimple.smarty index 48dc91a..d67e7c0 100644 --- a/templates/ktcore/metadata/conditional/editsimple.smarty +++ b/templates/ktcore/metadata/conditional/editsimple.smarty @@ -46,11 +46,6 @@ td { vertical-align: top; } {$context->oPage->requireCSSStandalone($sCSS)} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DateTime.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} {$context->oPage->requireJSResource("resources/js/taillog.js")} {$context->oPage->requireJSResource("resources/js/conditional_simple_edit.js")} diff --git a/templates/ktcore/principals/groups_sourceusers.smarty b/templates/ktcore/principals/groups_sourceusers.smarty index bdc7fbf..a7cafae 100644 --- a/templates/ktcore/principals/groups_sourceusers.smarty +++ b/templates/ktcore/principals/groups_sourceusers.smarty @@ -1,9 +1,5 @@

{i18n arg_name=$group->getName()}Manage Users in #name#{/i18n}

-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} -

{i18n}Users may be associated with Groups which are then used to grant these users security privileges.{/i18n}

diff --git a/templates/ktcore/widget_fieldset_conditional.smarty b/templates/ktcore/widget_fieldset_conditional.smarty index fedeb41..d960b52 100644 --- a/templates/ktcore/widget_fieldset_conditional.smarty +++ b/templates/ktcore/widget_fieldset_conditional.smarty @@ -1,8 +1,3 @@ -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Base.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")} -{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Async.js")} - {capture assign=sJS} var innerUrl = {$rootUrl}; {literal} diff --git a/templates/ktstandard/authentication/ldapsearchuser.smarty b/templates/ktstandard/authentication/ldapsearchuser.smarty index 8b48c5a..3a28d2d 100644 --- a/templates/ktstandard/authentication/ldapsearchuser.smarty +++ b/templates/ktstandard/authentication/ldapsearchuser.smarty @@ -1,7 +1,3 @@ -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} - {$context->oPage->requireJSResource('resources/js/toggleselect.js')}
diff --git a/thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js b/thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js index 9dd1075..e520f1f 100644 --- a/thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js +++ b/thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js @@ -1,12 +1 @@ -/** - * $RCSfile$ - * $Revision$ - * $Date$ - * - * @author Moxiecode - * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved. - */ - 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');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i');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","gi");content=tinyMCE.regexpReplace(content,"\r","
","gi");content=tinyMCE.regexpReplace(content,"\n","
","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,"","","gi");content=tinyMCE.regexpReplace(content,"","","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");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;i18&&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;i0){for(var i=0;i"+this.convertStringToXML(String.fromCharCode(160))+"";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+"";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="";else output+="<"+elementName+elementAttribs+">";for(var i=0;i
";else output+="";}else{if(openTag)output+="<"+elementName+elementAttribs+">";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 "";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i127)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[ \n\r]*
[ \n\r]*

','
','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])alert("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'


','
');html=tinyMCE.regexpReplace(html,'

 


 

','
');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('','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\n");html=html.replace(new RegExp('
','g'),"
\n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('

 

','g');html=html.replace(re,"
");}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=="
"||chk=="
"||chk=="

 

"||chk=="

 

"||chk=="

")html="";if(tinyMCE.settings["preformatted"])return "
"+html+"
";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,''+this.selectedInstance.getSelectedHTML()+'');}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';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'');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=strTok2.length){for(var i=0;i=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length=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=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;i0);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';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;i0)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

','g');html_content=html_content.replace(re,"
");}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<\/o:p>","
");html=tinyMCE.regexpReplace(html," <\/o:p>","");html=tinyMCE.regexpReplace(html,"","");html=tinyMCE.regexpReplace(html,"

<\/p>","");html=tinyMCE.regexpReplace(html,"

<\/p>\r\n

<\/p>","");html=tinyMCE.regexpReplace(html,"

 <\/p>","
");html=tinyMCE.regexpReplace(html,"

\s*(

\s*)?","

");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","

");}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;j0){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;i0)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;i1&&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;i0)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 <"+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;i0)rng.pasteHTML('
'+rng.htmlText+"
");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+">
  •  
  • <"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,""+this.getSelectedHTML()+"");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;x0){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;xcustomUndoLevels){for(var i=0;i0){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=''+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+='';else html+='';html+='';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+='';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=""+''+''+''+''+'blank_page'+''+''+''+''+'';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='\ - Debug output:\ - ';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i");this.loadedFiles[this.loadedFiles.length]=_f;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i");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","gi");_4d=tinyMCE.regexpReplace(_4d,"\r","
    ","gi");_4d=tinyMCE.regexpReplace(_4d,"\n","
    ","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,"","","gi");_4d=tinyMCE.regexpReplace(_4d,"","","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");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;c0){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))+"";}if(tinyMCE.isMSIE&&_c4=="script"){return "<"+_c4+_c6+">"+_c1.text+"";}if(_c1.hasChildNodes()){if(_c4=="p"&&tinyMCE.cleanup_force_br_newlines){_c2+="";}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+="
    ";}else{_c2+="";}}else{if(_c7){_c2+="<"+_c4+_c6+">";}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 "";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,"

    [ \n\r]*


    [ \n\r]*

    ","
    ","gi");_f5.innerHTML=tinyMCE.regexpReplace(_f5.innerHTML,"","","gi");}var _f9=this.cleanupNode(_f5);if(tinyMCE.settings["debug"]){alert("Cleanup process executed in: "+(new Date().getTime()-_f8)+" ms.");}_f9=tinyMCE.regexpReplace(_f9,"


    ","
    ");_f9=tinyMCE.regexpReplace(_f9,"

     


     

    ","
    ");if(!tinyMCE.isMSIE){_f9=_f9.replace(new RegExp("","g"),"");}if(tinyMCE.settings["apply_source_formatting"]){_f9=_f9.replace(new RegExp("<(p|div)([^>]*)>","g"),"\n<$1$2>\n");_f9=_f9.replace(new RegExp("]*)>","g"),"\n\n");_f9=_f9.replace(new RegExp("
    ","g"),"
    \n");}if(tinyMCE.settings["force_br_newlines"]){var re=new RegExp("

     

    ","g");_f9=_f9.replace(re,"
    ");}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=="
    "||chk=="
    "||chk=="

     

    "||chk=="

     

    "||chk=="

    "){_f9="";}if(tinyMCE.settings["preformatted"]){return "
    "+_f9+"
    ";}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,""+this.selectedInstance.getSelectedHTML()+"");}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+="\""+alt+"\"";html+="";tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,"");}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=_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="
    ";html+="
    ";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;i0){_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("


    ","g");_1ae=_1ae.replace(re,"
    ");}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
    ","
    ");html=tinyMCE.regexpReplace(html," ","");html=tinyMCE.regexpReplace(html,"","");html=tinyMCE.regexpReplace(html,"

    ","");html=tinyMCE.regexpReplace(html,"

    \r\n

    ","");html=tinyMCE.regexpReplace(html,"

     

    ","
    ");html=tinyMCE.regexpReplace(html,"

    s*(

    s*)?","

    ");html=tinyMCE.regexpReplace(html,"

    s*(

    s*)?","

    ");}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;j0){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;i1&&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;i0){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+"> ";_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("
    "+rng.htmlText+"
    ");}}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+">
  •  
  • <"+tag+">");}else{this.getDoc().execCommand(_26c,_26d,_26e);}tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari){this.execCommand("mceInsertContent",false,""+this.getSelectedHTML()+"");}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;i0){_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_2a2){for(var i=0;i0){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=""+_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+="";}else{html+="";}html+="";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+="";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=""+""+""+""+""+"blank_page"+""+""+""+""+"";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";document.body.appendChild(_2c4);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i -1), - isSafari = (ua.indexOf('safari') > -1), - isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1), - isIE = (!isOpera && ua.indexOf('msie') > -1); - - // regex cache - var patterns = { - HYPHEN: /(-[a-z])/i - }; - - - var toCamel = function(property) { - if ( !patterns.HYPHEN.test(property) ) { - return property; // no hyphens - } - - if (propertyCache[property]) { // already converted - return propertyCache[property]; - } - - while( patterns.HYPHEN.exec(property) ) { - property = property.replace(RegExp.$1, - RegExp.$1.substr(1).toUpperCase()); - } - - propertyCache[property] = property; - return property; - //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug - }; - - // branching at load instead of runtime - if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method - getStyle = function(el, property) { - var value = null; - - var computed = document.defaultView.getComputedStyle(el, ''); - if (computed) { // test computed before touching for safari - value = computed[toCamel(property)]; - } - - return el.style[property] || value; - }; - } else if (document.documentElement.currentStyle && isIE) { // IE method - getStyle = function(el, property) { - switch( toCamel(property) ) { - case 'opacity' :// IE opacity uses filter - var val = 100; - try { // will error if no DXImageTransform - val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity; - - } catch(e) { - try { // make sure its in the document - val = el.filters('alpha').opacity; - } catch(e) { - } - } - return val / 100; - break; - default: - // test currentStyle before touching - var value = el.currentStyle ? el.currentStyle[property] : null; - return ( el.style[property] || value ); - } - }; - } else { // default to inline only - 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' ) { // in case not appended - el.style.filter = 'alpha(opacity=' + val * 100 + ')'; - - if (!el.currentStyle || !el.currentStyle.hasLayout) { - el.style.zoom = 1; // when no layout or cant tell - } - } - break; - default: - el.style[property] = val; - } - }; - } else { - setStyle = function(el, property, val) { - el.style[property] = val; - }; - } - - /** - * Provides helper methods for DOM elements. - * @namespace YAHOO.util - * @class Dom - */ - YAHOO.util.Dom = { - /** - * Returns an HTMLElement reference. - * @method get - * @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. - * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements. - */ - get: function(el) { - if (!el) { return null; } // nothing to work with - - if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is - return el; - } - - if (typeof el == 'string') { // ID - return document.getElementById(el); - } - else { // array of ID's and/or elements - var collection = []; - for (var i = 0, len = el.length; i < len; ++i) { - collection[collection.length] = Y.Dom.get(el[i]); - } - - return collection; - } - - return null; // safety, should never happen - }, - - /** - * Normalizes currentStyle and ComputedStyle. - * @method getStyle - * @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. - * @param {String} property The style property whose value is returned. - * @return {String | Array} The current value of the style property for the element(s). - */ - getStyle: function(el, property) { - property = toCamel(property); - - var f = function(element) { - return getStyle(element, property); - }; - - return Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers. - * @method setStyle - * @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. - * @param {String} property The style property to be set. - * @param {String} val The value to apply to the given property. - */ - setStyle: function(el, property, val) { - property = toCamel(property); - - var f = function(element) { - setStyle(element, property, val); - - }; - - Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * 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). - * @method getXY - * @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 - * @return {Array} The XY position of the element(s) - */ - getXY: function(el) { - var f = function(el) { - - // has to be part of document to have pageXY - if (el.parentNode === null || el.offsetParent === null || - this.getStyle(el, 'display') == 'none') { - return false; - } - - var parentNode = null; - var pos = []; - var box; - - if (el.getBoundingClientRect) { // IE - box = el.getBoundingClientRect(); - var doc = document; - if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll - 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 { // safari, opera, & gecko - 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' ) { // safari doubles in some cases - 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') - { // account for any scrolled ancestors - if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug - 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); - }, - - /** - * 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). - * @method getX - * @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 - * @return {String | Array} The X position of the element(s) - */ - getX: function(el) { - var f = function(el) { - return Y.Dom.getXY(el)[0]; - }; - - return Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * 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). - * @method getY - * @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 - * @return {String | Array} The Y position of the element(s) - */ - getY: function(el) { - var f = function(el) { - return Y.Dom.getXY(el)[1]; - }; - - return Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Set the position of an html element in page coordinates, regardless of how the element is positioned. - * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - * @method setXY - * @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 - * @param {Array} pos Contains X & Y values for new position (coordinates are page-based) - * @param {Boolean} noRetry By default we try and set the position a second time if the first fails - */ - setXY: function(el, pos, noRetry) { - var f = function(el) { - var style_pos = this.getStyle(el, 'position'); - if (style_pos == 'static') { // default to relative - this.setStyle(el, 'position', 'relative'); - style_pos = 'relative'; - } - - var pageXY = this.getXY(el); - if (pageXY === false) { // has to be part of doc to have pageXY - return false; - } - - var delta = [ // assuming pixels; if not we will have to retry - parseInt( this.getStyle(el, 'left'), 10 ), - parseInt( this.getStyle(el, 'top'), 10 ) - ]; - - if ( isNaN(delta[0]) ) {// in case of 'auto' - delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft; - } - if ( isNaN(delta[1]) ) { // in case of 'auto' - 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 retry is true, try one more time if we miss - if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) { - this.setXY(el, pos, true); - } - - }; - - Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Set the X position of an html element in page coordinates, regardless of how the element is positioned. - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - * @method setX - * @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. - * @param {Int} x The value to use as the X coordinate for the element(s). - */ - setX: function(el, x) { - Y.Dom.setXY(el, [x, null]); - }, - - /** - * Set the Y position of an html element in page coordinates, regardless of how the element is positioned. - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - * @method setY - * @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. - * @param {Int} x To use as the Y coordinate for the element(s). - */ - setY: function(el, y) { - Y.Dom.setXY(el, [null, y]); - }, - - /** - * Returns the region position of the given element. - * The element must be part of the DOM tree to have a region (display:none or elements not appended return false). - * @method getRegion - * @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. - * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data. - */ - 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); - }, - - /** - * Returns the width of the client (viewport). - * @method getClientWidth - * @deprecated Now using getViewportWidth. This interface left intact for back compat. - * @return {Int} The width of the viewable area of the page. - */ - getClientWidth: function() { - return Y.Dom.getViewportWidth(); - }, - - /** - * Returns the height of the client (viewport). - * @method getClientHeight - * @deprecated Now using getViewportHeight. This interface left intact for back compat. - * @return {Int} The height of the viewable area of the page. - */ - getClientHeight: function() { - return Y.Dom.getViewportHeight(); - }, - - /** - * Returns a array of HTMLElements with the given class. - * For optimized performance, include a tag and/or root node when possible. - * @method getElementsByClassName - * @param {String} className The class name to match against - * @param {String} tag (optional) The tag name of the elements being collected - * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point - * @return {Array} An array of elements that have the given class name - */ - getElementsByClassName: function(className, tag, root) { - var method = function(el) { return Y.Dom.hasClass(el, className); }; - return Y.Dom.getElementsBy(method, tag, root); - }, - - /** - * Determines whether an HTMLElement has the given className. - * @method hasClass - * @param {String | HTMLElement | Array} el The element or collection to test - * @param {String} className the class name to search for - * @return {Boolean | Array} A boolean value or array of boolean values - */ - 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); - }, - - /** - * Adds a class name to a given element or collection of elements. - * @method addClass - * @param {String | HTMLElement | Array} el The element or collection to add the class to - * @param {String} className the class name to add to the class attribute - */ - addClass: function(el, className) { - var f = function(el) { - if (this.hasClass(el, className)) { return; } // already present - - - el['className'] = [el['className'], className].join(' '); - }; - - Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Removes a class name from a given element or collection of elements. - * @method removeClass - * @param {String | HTMLElement | Array} el The element or collection to remove the class from - * @param {String} className the class name to remove from the class attribute - */ - removeClass: function(el, className) { - var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g'); - - var f = function(el) { - if (!this.hasClass(el, className)) { return; } // not present - - - var c = el['className']; - el['className'] = c.replace(re, ' '); - if ( this.hasClass(el, className) ) { // in case of multiple adjacent - this.removeClass(el, className); - } - - }; - - Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Replace a class with another class for a given element or collection of elements. - * If no oldClassName is present, the newClassName is simply added. - * @method replaceClass - * @param {String | HTMLElement | Array} el The element or collection to remove the class from - * @param {String} oldClassName the class name to be replaced - * @param {String} newClassName the class name that will be replacing the old class name - */ - replaceClass: function(el, oldClassName, newClassName) { - if (oldClassName === newClassName) { // avoid infinite loop - return false; - } - - var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g'); - - var f = function(el) { - - if ( !this.hasClass(el, oldClassName) ) { - this.addClass(el, newClassName); // just add it if nothing to replace - return; // note return - } - - el['className'] = el['className'].replace(re, ' ' + newClassName + ' '); - - if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent - this.replaceClass(el, oldClassName, newClassName); - } - }; - - Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Generates a unique ID - * @method generateId - * @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). - * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen"). - * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element) - */ - generateId: function(el, prefix) { - prefix = prefix || 'yui-gen'; - el = el || {}; - - var f = function(el) { - if (el) { - el = Y.Dom.get(el); - } else { - el = {}; // just generating ID in this case - } - - if (!el.id) { - el.id = prefix + id_counter++; - } // dont override existing - - - return el.id; - }; - - return Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy. - * @method isAncestor - * @param {String | HTMLElement} haystack The possible ancestor - * @param {String | HTMLElement} needle The possible descendent - * @return {Boolean} Whether or not the haystack is an ancestor of needle - */ - isAncestor: function(haystack, needle) { - haystack = Y.Dom.get(haystack); - if (!haystack || !needle) { return false; } - - var f = function(needle) { - if (haystack.contains && !isSafari) { // safari "contains" is broken - return haystack.contains(needle); - } - else if ( haystack.compareDocumentPosition ) { - return !!(haystack.compareDocumentPosition(needle) & 16); - } - else { // loop up and test each parent - 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); - }, - - /** - * Determines whether an HTMLElement is present in the current document. - * @method inDocument - * @param {String | HTMLElement} el The element to search for - * @return {Boolean} Whether or not the element is present in the current document - */ - inDocument: function(el) { - var f = function(el) { - return this.isAncestor(document.documentElement, el); - }; - - return Y.Dom.batch(el, f, Y.Dom, true); - }, - - /** - * Returns a array of HTMLElements that pass the test applied by supplied boolean method. - * For optimized performance, include a tag and/or root node when possible. - * @method getElementsBy - * @param {Function} method - A boolean method for testing elements which receives the element as its only argument. - - * @param {String} tag (optional) The tag name of the elements being collected - * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point - */ - 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; // IE < 6 - } - - for (var i = 0, len = elements.length; i < len; ++i) { - if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; } - } - - - return nodes; - }, - - /** - * Returns an array of elements that have had the supplied method applied. - * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ). - * @method batch - * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to - * @param {Function} method The method to apply to the element(s) - * @param {Any} o (optional) An optional arg that is passed to the supplied method - * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o" - * @return {HTMLElement | Array} The element(s) with the method applied - */ - 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) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection) - 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; - }, - - /** - * Returns the height of the document. - * @method getDocumentHeight - * @return {Int} The height of the actual document (which includes the body and its margin). - */ - getDocumentHeight: function() { - var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight; - - var h = Math.max(scrollHeight, Y.Dom.getViewportHeight()); - return h; - }, - - /** - * Returns the width of the document. - * @method getDocumentWidth - * @return {Int} The width of the actual document (which includes the body and its margin). - */ - getDocumentWidth: function() { - var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth; - var w = Math.max(scrollWidth, Y.Dom.getViewportWidth()); - return w; - }, - - /** - * Returns the current height of the viewport. - * @method getViewportHeight - * @return {Int} The height of the viewable area of the page (excludes scrollbars). - */ - getViewportHeight: function() { - var height = self.innerHeight; // Safari, Opera - var mode = document.compatMode; - - if ( (mode || isIE) && !isOpera ) { // IE, Gecko - height = (mode == 'CSS1Compat') ? - document.documentElement.clientHeight : // Standards - document.body.clientHeight; // Quirks - } - - return height; - }, - - /** - * Returns the current width of the viewport. - * @method getViewportWidth - * @return {Int} The width of the viewable area of the page (excludes scrollbars). - */ - - getViewportWidth: function() { - var width = self.innerWidth; // Safari - var mode = document.compatMode; - - if (mode || isIE) { // IE, Gecko, Opera - width = (mode == 'CSS1Compat') ? - document.documentElement.clientWidth : // Standards - document.body.clientWidth; // Quirks - } - return width; - } - }; -})(); -/** - * A region is a representation of an object on a grid. It is defined - * by the top, right, bottom, left extents, so is rectangular by default. If - * other shapes are required, this class could be extended to support it. - * @namespace YAHOO.util - * @class Region - * @param {Int} t the top extent - * @param {Int} r the right extent - * @param {Int} b the bottom extent - * @param {Int} l the left extent - * @constructor - */ -YAHOO.util.Region = function(t, r, b, l) { - - /** - * The region's top extent - * @property top - * @type Int - */ - this.top = t; - - /** - * The region's top extent as index, for symmetry with set/getXY - * @property 1 - * @type Int - */ - this[1] = t; - - /** - * The region's right extent - * @property right - * @type int - */ - this.right = r; - - /** - * The region's bottom extent - * @property bottom - * @type Int - */ - this.bottom = b; - - /** - * The region's left extent - * @property left - * @type Int - */ - this.left = l; - - /** - * The region's left extent as index, for symmetry with set/getXY - * @property 0 - * @type Int - */ - this[0] = l; -}; - -/** - * Returns true if this region contains the region passed in - * @method contains - * @param {Region} region The region to evaluate - * @return {Boolean} True if the region is contained with this region, - * else false - */ -YAHOO.util.Region.prototype.contains = function(region) { - return ( region.left >= this.left && - region.right <= this.right && - region.top >= this.top && - region.bottom <= this.bottom ); - -}; - -/** - * Returns the area of the region - * @method getArea - * @return {Int} the region's area - */ -YAHOO.util.Region.prototype.getArea = function() { - return ( (this.bottom - this.top) * (this.right - this.left) ); -}; - -/** - * Returns the region where the passed in region overlaps with this one - * @method intersect - * @param {Region} region The region that intersects - * @return {Region} The overlap region, or null if there is no overlap - */ -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; - } -}; - -/** - * Returns the region representing the smallest region that can contain both - * the passed in region and this region. - * @method union - * @param {Region} region The region that to create the union with - * @return {Region} The union region - */ -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); -}; - -/** - * toString - * @method toString - * @return string the region properties - */ -YAHOO.util.Region.prototype.toString = function() { - return ( "Region {" + - "top: " + this.top + - ", right: " + this.right + - ", bottom: " + this.bottom + - ", left: " + this.left + - "}" ); -}; - -/** - * Returns a region that is occupied by the DOM element - * @method getRegion - * @param {HTMLElement} el The element - * @return {Region} The region that the element occupies - * @static - */ -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); -}; - -///////////////////////////////////////////////////////////////////////////// - -/** - * A point is a region that is special in that it represents a single point on - * the grid. - * @namespace YAHOO.util - * @class Point - * @param {Int} x The X position of the point - * @param {Int} y The Y position of the point - * @constructor - * @extends YAHOO.util.Region - */ -YAHOO.util.Point = function(x, y) { - if (x instanceof Array) { // accept output from Dom.getXY - y = x[1]; - x = x[0]; - } - - /** - * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry) - * @property x - * @type Int - */ - - this.x = this.right = this.left = this[0] = x; - - /** - * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry) - * @property y - * @type Int - */ - this.y = this.top = this.bottom = this[1] = y; -}; - -YAHOO.util.Point.prototype = new YAHOO.util.Region(); - +(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=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(); \ No newline at end of file diff --git a/thirdpartyjs/yui/dragdrop/dragdrop.js b/thirdpartyjs/yui/dragdrop/dragdrop.js index 3ff1049..766fa74 100644 --- a/thirdpartyjs/yui/dragdrop/dragdrop.js +++ b/thirdpartyjs/yui/dragdrop/dragdrop.js @@ -1,2942 +1,939 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.12.0 -*/ - -(function() { - -var Event=YAHOO.util.Event; -var Dom=YAHOO.util.Dom; - -/** - * Defines the interface and base operation of items that that can be - * dragged or can be drop targets. It was designed to be extended, overriding - * the event handlers for startDrag, onDrag, onDragOver, onDragOut. - * Up to three html elements can be associated with a DragDrop instance: - *
      - *
    • linked element: the element that is passed into the constructor. - * This is the element which defines the boundaries for interaction with - * other DragDrop objects.
    • - *
    • handle element(s): The drag operation only occurs if the element that - * was clicked matches a handle element. By default this is the linked - * element, but there are times that you will want only a portion of the - * linked element to initiate the drag operation, and the setHandleElId() - * method provides a way to define this.
    • - *
    • drag element: this represents an the element that would be moved along - * with the cursor during a drag operation. By default, this is the linked - * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define - * a separate element that would be moved, as in {@link YAHOO.util.DDProxy} - *
    • - *
    - * This class should not be instantiated until the onload event to ensure that - * the associated elements are available. - * The following would define a DragDrop obj that would interact with any - * other DragDrop obj in the "group1" group: - *
    - *  dd = new YAHOO.util.DragDrop("div1", "group1");
    - * 
    - * Since none of the event handlers have been implemented, nothing would - * actually happen if you were to run the code above. Normally you would - * override this class or one of the default implementations, but you can - * also override the methods you want on an instance of the class... - *
    - *  dd.onDragDrop = function(e, id) {
    - *    alert("dd was dropped on " + id);
    - *  }
    - * 
    - * @namespace YAHOO.util - * @class DragDrop - * @constructor - * @param {String} id of the element that is linked to this instance - * @param {String} sGroup the group of related DragDrop objects - * @param {object} config an object containing configurable attributes - * Valid properties for DragDrop: - * padding, isTarget, maintainOffset, primaryButtonOnly - */ -YAHOO.util.DragDrop = function(id, sGroup, config) { - if (id) { - this.init(id, sGroup, config); - } -}; - -YAHOO.util.DragDrop.prototype = { - - /** - * The id of the element associated with this object. This is what we - * refer to as the "linked element" because the size and position of - * this element is used to determine when the drag and drop objects have - * interacted. - * @property id - * @type String - */ - id: null, - - /** - * Configuration attributes passed into the constructor - * @property config - * @type object - */ - config: null, - - /** - * The id of the element that will be dragged. By default this is same - * as the linked element , but could be changed to another element. Ex: - * YAHOO.util.DDProxy - * @property dragElId - * @type String - * @private - */ - dragElId: null, - - /** - * the id of the element that initiates the drag operation. By default - * this is the linked element, but could be changed to be a child of this - * element. This lets us do things like only starting the drag when the - * header element within the linked html element is clicked. - * @property handleElId - * @type String - * @private - */ - handleElId: null, - - /** - * An associative array of HTML tags that will be ignored if clicked. - * @property invalidHandleTypes - * @type {string: string} - */ - invalidHandleTypes: null, - - /** - * An associative array of ids for elements that will be ignored if clicked - * @property invalidHandleIds - * @type {string: string} - */ - invalidHandleIds: null, - - /** - * An indexted array of css class names for elements that will be ignored - * if clicked. - * @property invalidHandleClasses - * @type string[] - */ - invalidHandleClasses: null, - - /** - * The linked element's absolute X position at the time the drag was - * started - * @property startPageX - * @type int - * @private - */ - startPageX: 0, - - /** - * The linked element's absolute X position at the time the drag was - * started - * @property startPageY - * @type int - * @private - */ - startPageY: 0, - - /** - * The group defines a logical collection of DragDrop objects that are - * related. Instances only get events when interacting with other - * DragDrop object in the same group. This lets us define multiple - * groups using a single DragDrop subclass if we want. - * @property groups - * @type {string: string} - */ - groups: null, - - /** - * Individual drag/drop instances can be locked. This will prevent - * onmousedown start drag. - * @property locked - * @type boolean - * @private - */ - locked: false, - - /** - * Lock this instance - * @method lock - */ - lock: function() { this.locked = true; }, - - /** - * Unlock this instace - * @method unlock - */ - unlock: function() { this.locked = false; }, - - /** - * By default, all insances can be a drop target. This can be disabled by - * setting isTarget to false. - * @method isTarget - * @type boolean - */ - isTarget: true, - - /** - * The padding configured for this drag and drop object for calculating - * the drop zone intersection with this object. - * @method padding - * @type int[] - */ - padding: null, - - /** - * Cached reference to the linked element - * @property _domRef - * @private - */ - _domRef: null, - - /** - * Internal typeof flag - * @property __ygDragDrop - * @private - */ - __ygDragDrop: true, - - /** - * Set to true when horizontal contraints are applied - * @property constrainX - * @type boolean - * @private - */ - constrainX: false, - - /** - * Set to true when vertical contraints are applied - * @property constrainY - * @type boolean - * @private - */ - constrainY: false, - - /** - * The left constraint - * @property minX - * @type int - * @private - */ - minX: 0, - - /** - * The right constraint - * @property maxX - * @type int - * @private - */ - maxX: 0, - - /** - * The up constraint - * @property minY - * @type int - * @type int - * @private - */ - minY: 0, - - /** - * The down constraint - * @property maxY - * @type int - * @private - */ - maxY: 0, - - /** - * Maintain offsets when we resetconstraints. Set to true when you want - * the position of the element relative to its parent to stay the same - * when the page changes - * - * @property maintainOffset - * @type boolean - */ - maintainOffset: false, - - /** - * Array of pixel locations the element will snap to if we specified a - * horizontal graduation/interval. This array is generated automatically - * when you define a tick interval. - * @property xTicks - * @type int[] - */ - xTicks: null, - - /** - * Array of pixel locations the element will snap to if we specified a - * vertical graduation/interval. This array is generated automatically - * when you define a tick interval. - * @property yTicks - * @type int[] - */ - yTicks: null, - - /** - * By default the drag and drop instance will only respond to the primary - * button click (left button for a right-handed mouse). Set to true to - * allow drag and drop to start with any mouse click that is propogated - * by the browser - * @property primaryButtonOnly - * @type boolean - */ - primaryButtonOnly: true, - - /** - * The availabe property is false until the linked dom element is accessible. - * @property available - * @type boolean - */ - available: false, - - /** - * By default, drags can only be initiated if the mousedown occurs in the - * region the linked element is. This is done in part to work around a - * bug in some browsers that mis-report the mousedown if the previous - * mouseup happened outside of the window. This property is set to true - * if outer handles are defined. - * - * @property hasOuterHandles - * @type boolean - * @default false - */ - hasOuterHandles: false, - - /** - * Code that executes immediately before the startDrag event - * @method b4StartDrag - * @private - */ - b4StartDrag: function(x, y) { }, - - /** - * Abstract method called after a drag/drop object is clicked - * and the drag or mousedown time thresholds have beeen met. - * @method startDrag - * @param {int} X click location - * @param {int} Y click location - */ - startDrag: function(x, y) { /* override this */ }, - - /** - * Code that executes immediately before the onDrag event - * @method b4Drag - * @private - */ - b4Drag: function(e) { }, - - /** - * Abstract method called during the onMouseMove event while dragging an - * object. - * @method onDrag - * @param {Event} e the mousemove event - */ - onDrag: function(e) { /* override this */ }, - - /** - * Abstract method called when this element fist begins hovering over - * another DragDrop obj - * @method onDragEnter - * @param {Event} e the mousemove event - * @param {String|DragDrop[]} id In POINT mode, the element - * id this is hovering over. In INTERSECT mode, an array of one or more - * dragdrop items being hovered over. - */ - onDragEnter: function(e, id) { /* override this */ }, - - /** - * Code that executes immediately before the onDragOver event - * @method b4DragOver - * @private - */ - b4DragOver: function(e) { }, - - /** - * Abstract method called when this element is hovering over another - * DragDrop obj - * @method onDragOver - * @param {Event} e the mousemove event - * @param {String|DragDrop[]} id In POINT mode, the element - * id this is hovering over. In INTERSECT mode, an array of dd items - * being hovered over. - */ - onDragOver: function(e, id) { /* override this */ }, - - /** - * Code that executes immediately before the onDragOut event - * @method b4DragOut - * @private - */ - b4DragOut: function(e) { }, - - /** - * Abstract method called when we are no longer hovering over an element - * @method onDragOut - * @param {Event} e the mousemove event - * @param {String|DragDrop[]} id In POINT mode, the element - * id this was hovering over. In INTERSECT mode, an array of dd items - * that the mouse is no longer over. - */ - onDragOut: function(e, id) { /* override this */ }, - - /** - * Code that executes immediately before the onDragDrop event - * @method b4DragDrop - * @private - */ - b4DragDrop: function(e) { }, - - /** - * Abstract method called when this item is dropped on another DragDrop - * obj - * @method onDragDrop - * @param {Event} e the mouseup event - * @param {String|DragDrop[]} id In POINT mode, the element - * id this was dropped on. In INTERSECT mode, an array of dd items this - * was dropped on. - */ - onDragDrop: function(e, id) { /* override this */ }, - - /** - * Abstract method called when this item is dropped on an area with no - * drop target - * @method onInvalidDrop - * @param {Event} e the mouseup event - */ - onInvalidDrop: function(e) { /* override this */ }, - - /** - * Code that executes immediately before the endDrag event - * @method b4EndDrag - * @private - */ - b4EndDrag: function(e) { }, - - /** - * Fired when we are done dragging the object - * @method endDrag - * @param {Event} e the mouseup event - */ - endDrag: function(e) { /* override this */ }, - - /** - * Code executed immediately before the onMouseDown event - * @method b4MouseDown - * @param {Event} e the mousedown event - * @private - */ - b4MouseDown: function(e) { }, - - /** - * Event handler that fires when a drag/drop obj gets a mousedown - * @method onMouseDown - * @param {Event} e the mousedown event - */ - onMouseDown: function(e) { /* override this */ }, - - /** - * Event handler that fires when a drag/drop obj gets a mouseup - * @method onMouseUp - * @param {Event} e the mouseup event - */ - onMouseUp: function(e) { /* override this */ }, - - /** - * Override the onAvailable method to do what is needed after the initial - * position was determined. - * @method onAvailable - */ - onAvailable: function () { - }, - - /** - * Returns a reference to the linked element - * @method getEl - * @return {HTMLElement} the html element - */ - getEl: function() { - if (!this._domRef) { - this._domRef = Dom.get(this.id); - } - - return this._domRef; - }, - - /** - * Returns a reference to the actual element to drag. By default this is - * the same as the html element, but it can be assigned to another - * element. An example of this can be found in YAHOO.util.DDProxy - * @method getDragEl - * @return {HTMLElement} the html element - */ - getDragEl: function() { - return Dom.get(this.dragElId); - }, - - /** - * Sets up the DragDrop object. Must be called in the constructor of any - * YAHOO.util.DragDrop subclass - * @method init - * @param id the id of the linked element - * @param {String} sGroup the group of related items - * @param {object} config configuration attributes - */ - init: function(id, sGroup, config) { - this.initTarget(id, sGroup, config); - Event.on(this.id, "mousedown", this.handleMouseDown, this, true); - // Event.on(this.id, "selectstart", Event.preventDefault); - }, - - /** - * Initializes Targeting functionality only... the object does not - * get a mousedown handler. - * @method initTarget - * @param id the id of the linked element - * @param {String} sGroup the group of related items - * @param {object} config configuration attributes - */ - initTarget: function(id, sGroup, config) { - - // configuration attributes - this.config = config || {}; - - // create a local reference to the drag and drop manager - this.DDM = YAHOO.util.DDM; - // initialize the groups array - this.groups = {}; - - // assume that we have an element reference instead of an id if the - // parameter is not a string - if (typeof id !== "string") { - YAHOO.log("id is not a string, assuming it is an HTMLElement"); - id = Dom.generateId(id); - } - - // set the id - this.id = id; - - // add to an interaction group - this.addToGroup((sGroup) ? sGroup : "default"); - - // We don't want to register this as the handle with the manager - // so we just set the id rather than calling the setter. - this.handleElId = id; - - Event.onAvailable(id, this.handleOnAvailable, this, true); - - - // the linked element is the element that gets dragged by default - this.setDragElId(id); - - // by default, clicked anchors will not start drag operations. - // @TODO what else should be here? Probably form fields. - this.invalidHandleTypes = { A: "A" }; - this.invalidHandleIds = {}; - this.invalidHandleClasses = []; - - this.applyConfig(); - }, - - /** - * Applies the configuration parameters that were passed into the constructor. - * This is supposed to happen at each level through the inheritance chain. So - * a DDProxy implentation will execute apply config on DDProxy, DD, and - * DragDrop in order to get all of the parameters that are available in - * each object. - * @method applyConfig - */ - applyConfig: function() { - - // configurable properties: - // padding, isTarget, maintainOffset, primaryButtonOnly - 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); - - }, - - /** - * Executed when the linked element is available - * @method handleOnAvailable - * @private - */ - handleOnAvailable: function() { - this.available = true; - this.resetConstraints(); - this.onAvailable(); - }, - - /** - * Configures the padding for the target zone in px. Effectively expands - * (or reduces) the virtual object size for targeting calculations. - * Supports css-style shorthand; if only one parameter is passed, all sides - * will have that padding, and if only two are passed, the top and bottom - * will have the first param, the left and right the second. - * @method setPadding - * @param {int} iTop Top pad - * @param {int} iRight Right pad - * @param {int} iBot Bot pad - * @param {int} iLeft Left pad - */ - setPadding: function(iTop, iRight, iBot, iLeft) { - // this.padding = [iLeft, iRight, iTop, iBot]; - if (!iRight && 0 !== iRight) { - this.padding = [iTop, iTop, iTop, iTop]; - } else if (!iBot && 0 !== iBot) { - this.padding = [iTop, iRight, iTop, iRight]; - } else { - this.padding = [iTop, iRight, iBot, iLeft]; - } - }, - - /** - * Stores the initial placement of the linked element. - * @method setInitialPosition - * @param {int} diffX the X offset, default 0 - * @param {int} diffY the Y offset, default 0 - */ - setInitPosition: function(diffX, diffY) { - var el = this.getEl(); - - if (!this.DDM.verifyEl(el)) { - return; - } - - var dx = diffX || 0; - var dy = diffY || 0; - - var p = Dom.getXY( el ); - - this.initPageX = p[0] - dx; - this.initPageY = p[1] - dy; - - this.lastPageX = p[0]; - this.lastPageY = p[1]; - - - this.setStartPosition(p); - }, - - /** - * Sets the start position of the element. This is set when the obj - * is initialized, the reset when a drag is started. - * @method setStartPosition - * @param pos current position (from previous lookup) - * @private - */ - setStartPosition: function(pos) { - var p = pos || Dom.getXY( this.getEl() ); - this.deltaSetXY = null; - - this.startPageX = p[0]; - this.startPageY = p[1]; - }, - - /** - * Add this instance to a group of related drag/drop objects. All - * instances belong to at least one group, and can belong to as many - * groups as needed. - * @method addToGroup - * @param sGroup {string} the name of the group - */ - addToGroup: function(sGroup) { - this.groups[sGroup] = true; - this.DDM.regDragDrop(this, sGroup); - }, - - /** - * Remove's this instance from the supplied interaction group - * @method removeFromGroup - * @param {string} sGroup The group to drop - */ - removeFromGroup: function(sGroup) { - if (this.groups[sGroup]) { - delete this.groups[sGroup]; - } - - this.DDM.removeDDFromGroup(this, sGroup); - }, - - /** - * Allows you to specify that an element other than the linked element - * will be moved with the cursor during a drag - * @method setDragElId - * @param id {string} the id of the element that will be used to initiate the drag - */ - setDragElId: function(id) { - this.dragElId = id; - }, - - /** - * Allows you to specify a child of the linked element that should be - * used to initiate the drag operation. An example of this would be if - * you have a content div with text and links. Clicking anywhere in the - * content area would normally start the drag operation. Use this method - * to specify that an element inside of the content div is the element - * that starts the drag operation. - * @method setHandleElId - * @param id {string} the id of the element that will be used to - * initiate the drag. - */ - setHandleElId: function(id) { - if (typeof id !== "string") { - YAHOO.log("id is not a string, assuming it is an HTMLElement"); - id = Dom.generateId(id); - } - this.handleElId = id; - this.DDM.regHandle(this.id, id); - }, - - /** - * Allows you to set an element outside of the linked element as a drag - * handle - * @method setOuterHandleElId - * @param id the id of the element that will be used to initiate the drag - */ - setOuterHandleElId: function(id) { - if (typeof id !== "string") { - YAHOO.log("id is not a string, assuming it is an HTMLElement"); - id = Dom.generateId(id); - } - Event.on(id, "mousedown", - this.handleMouseDown, this, true); - this.setHandleElId(id); - - this.hasOuterHandles = true; - }, - - /** - * Remove all drag and drop hooks for this element - * @method unreg - */ - unreg: function() { - Event.removeListener(this.id, "mousedown", - this.handleMouseDown); - this._domRef = null; - this.DDM._remove(this); - }, - - /** - * Returns true if this instance is locked, or the drag drop mgr is locked - * (meaning that all drag/drop is disabled on the page.) - * @method isLocked - * @return {boolean} true if this obj or all drag/drop is locked, else - * false - */ - isLocked: function() { - return (this.DDM.isLocked() || this.locked); - }, - - /** - * Fired when this object is clicked - * @method handleMouseDown - * @param {Event} e - * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj) - * @private - */ - handleMouseDown: function(e, oDD) { - - var button = e.which || e.button; - - if (this.primaryButtonOnly && button > 1) { - return; - } - - if (this.isLocked()) { - return; - } - - this.DDM.refreshCache(this.groups); - // var self = this; - // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0); - - // Only process the event if we really clicked within the linked - // element. The reason we make this check is that in the case that - // another element was moved between the clicked element and the - // cursor in the time between the mousedown and mouseup events. When - // this happens, the element gets the next mousedown event - // regardless of where on the screen it happened. - var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e)); - if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) { - } else { - if (this.clickValidator(e)) { - // set the initial element position - this.setStartPosition(); - - - this.b4MouseDown(e); - this.onMouseDown(e); - this.DDM.handleMouseDown(e, this); - - this.DDM.stopEvent(e); - } else { - - - } - } - }, - - clickValidator: function(e) { - var target = Event.getTarget(e); - return ( this.isValidHandleChild(target) && - (this.id == this.handleElId || - this.DDM.handleWasClicked(target, this.id)) ); - }, - - /** - * Allows you to specify a tag name that should not start a drag operation - * when clicked. This is designed to facilitate embedding links within a - * drag handle that do something other than start the drag. - * @method addInvalidHandleType - * @param {string} tagName the type of element to exclude - */ - addInvalidHandleType: function(tagName) { - var type = tagName.toUpperCase(); - this.invalidHandleTypes[type] = type; - }, - - /** - * Lets you to specify an element id for a child of a drag handle - * that should not initiate a drag - * @method addInvalidHandleId - * @param {string} id the element id of the element you wish to ignore - */ - addInvalidHandleId: function(id) { - if (typeof id !== "string") { - YAHOO.log("id is not a string, assuming it is an HTMLElement"); - id = Dom.generateId(id); - } - this.invalidHandleIds[id] = id; - }, - - /** - * Lets you specify a css class of elements that will not initiate a drag - * @method addInvalidHandleClass - * @param {string} cssClass the class of the elements you wish to ignore - */ - addInvalidHandleClass: function(cssClass) { - this.invalidHandleClasses.push(cssClass); - }, - - /** - * Unsets an excluded tag name set by addInvalidHandleType - * @method removeInvalidHandleType - * @param {string} tagName the type of element to unexclude - */ - removeInvalidHandleType: function(tagName) { - var type = tagName.toUpperCase(); - // this.invalidHandleTypes[type] = null; - delete this.invalidHandleTypes[type]; - }, - - /** - * Unsets an invalid handle id - * @method removeInvalidHandleId - * @param {string} id the id of the element to re-enable - */ - removeInvalidHandleId: function(id) { - if (typeof id !== "string") { - YAHOO.log("id is not a string, assuming it is an HTMLElement"); - id = Dom.generateId(id); - } - delete this.invalidHandleIds[id]; - }, - - /** - * Unsets an invalid css class - * @method removeInvalidHandleClass - * @param {string} cssClass the class of the element(s) you wish to - * re-enable - */ - removeInvalidHandleClass: function(cssClass) { - for (var i=0, len=this.invalidHandleClasses.length; i= this.minX; i = i - iTickSize) { - if (!tickMap[i]) { - this.xTicks[this.xTicks.length] = i; - tickMap[i] = true; - } - } - - for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) { - if (!tickMap[i]) { - this.xTicks[this.xTicks.length] = i; - tickMap[i] = true; - } - } - - this.xTicks.sort(this.DDM.numericSort) ; - }, - - /** - * Create the array of vertical tick marks if an interval was specified in - * setYConstraint(). - * @method setYTicks - * @private - */ - setYTicks: function(iStartY, iTickSize) { - this.yTicks = []; - this.yTickSize = iTickSize; - - var tickMap = {}; - - for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) { - if (!tickMap[i]) { - this.yTicks[this.yTicks.length] = i; - tickMap[i] = true; - } - } - - for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) { - if (!tickMap[i]) { - this.yTicks[this.yTicks.length] = i; - tickMap[i] = true; - } - } - - this.yTicks.sort(this.DDM.numericSort) ; - }, - - /** - * By default, the element can be dragged any place on the screen. Use - * this method to limit the horizontal travel of the element. Pass in - * 0,0 for the parameters if you want to lock the drag to the y axis. - * @method setXConstraint - * @param {int} iLeft the number of pixels the element can move to the left - * @param {int} iRight the number of pixels the element can move to the - * right - * @param {int} iTickSize optional parameter for specifying that the - * element - * should move iTickSize pixels at a time. - */ - setXConstraint: function(iLeft, iRight, iTickSize) { - this.leftConstraint = iLeft; - this.rightConstraint = iRight; - - this.minX = this.initPageX - iLeft; - this.maxX = this.initPageX + iRight; - if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); } - - this.constrainX = true; - }, - - /** - * Clears any constraints applied to this instance. Also clears ticks - * since they can't exist independent of a constraint at this time. - * @method clearConstraints - */ - clearConstraints: function() { - this.constrainX = false; - this.constrainY = false; - this.clearTicks(); - }, - - /** - * Clears any tick interval defined for this instance - * @method clearTicks - */ - clearTicks: function() { - this.xTicks = null; - this.yTicks = null; - this.xTickSize = 0; - this.yTickSize = 0; - }, - - /** - * By default, the element can be dragged any place on the screen. Set - * this to limit the vertical travel of the element. Pass in 0,0 for the - * parameters if you want to lock the drag to the x axis. - * @method setYConstraint - * @param {int} iUp the number of pixels the element can move up - * @param {int} iDown the number of pixels the element can move down - * @param {int} iTickSize optional parameter for specifying that the - * element should move iTickSize pixels at a time. - */ - setYConstraint: function(iUp, iDown, iTickSize) { - this.topConstraint = iUp; - this.bottomConstraint = iDown; - - this.minY = this.initPageY - iUp; - this.maxY = this.initPageY + iDown; - if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); } - - this.constrainY = true; - - }, - - /** - * resetConstraints must be called if you manually reposition a dd element. - * @method resetConstraints - * @param {boolean} maintainOffset - */ - resetConstraints: function() { - - - // Maintain offsets if necessary - if (this.initPageX || this.initPageX === 0) { - // figure out how much this thing has moved - var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0; - var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0; - - this.setInitPosition(dx, dy); - - // This is the first time we have detected the element's position - } 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 ); - } - }, - - /** - * Normally the drag element is moved pixel by pixel, but we can specify - * that it move a number of pixels at a time. This method resolves the - * location when we have it set up like this. - * @method getTick - * @param {int} val where we want to place the object - * @param {int[]} tickArray sorted array of valid points - * @return {int} the closest tick - * @private - */ - getTick: function(val, tickArray) { - - if (!tickArray) { - // If tick interval is not defined, it is effectively 1 pixel, - // so we return the value passed to us. - return val; - } else if (tickArray[0] >= val) { - // The value is lower than the first tick, so we return the first - // tick. - return tickArray[0]; - } else { - for (var i=0, len=tickArray.length; i= val) { - var diff1 = val - tickArray[i]; - var diff2 = tickArray[next] - val; - return (diff2 > diff1) ? tickArray[i] : tickArray[next]; - } - } - - // The value is larger than the last tick, so we return the last - // tick. - return tickArray[tickArray.length - 1]; - } - }, - - /** - * toString method - * @method toString - * @return {string} string representation of the dd obj - */ - toString: function() { - return ("DragDrop " + this.id); - } - -}; - -})(); -/** - * The drag and drop utility provides a framework for building drag and drop - * applications. In addition to enabling drag and drop for specific elements, - * the drag and drop elements are tracked by the manager class, and the - * interactions between the various elements are tracked during the drag and - * the implementing code is notified about these important moments. - * @module dragdrop - * @title Drag and Drop - * @requires yahoo,dom,event - * @namespace YAHOO.util - */ - -// Only load the library once. Rewriting the manager class would orphan -// existing drag and drop instances. -if (!YAHOO.util.DragDropMgr) { - -/** - * DragDropMgr is a singleton that tracks the element interaction for - * all DragDrop items in the window. Generally, you will not call - * this class directly, but it does have helper methods that could - * be useful in your DragDrop implementations. - * @class DragDropMgr - * @static - */ -YAHOO.util.DragDropMgr = function() { - - var Event = YAHOO.util.Event; - - return { - - /** - * Two dimensional Array of registered DragDrop objects. The first - * dimension is the DragDrop item group, the second the DragDrop - * object. - * @property ids - * @type {string: string} - * @private - * @static - */ - ids: {}, - - /** - * Array of element ids defined as drag handles. Used to determine - * if the element that generated the mousedown event is actually the - * handle and not the html element itself. - * @property handleIds - * @type {string: string} - * @private - * @static - */ - handleIds: {}, - - /** - * the DragDrop object that is currently being dragged - * @property dragCurrent - * @type DragDrop - * @private - * @static - **/ - dragCurrent: null, - - /** - * the DragDrop object(s) that are being hovered over - * @property dragOvers - * @type Array - * @private - * @static - */ - dragOvers: {}, - - /** - * the X distance between the cursor and the object being dragged - * @property deltaX - * @type int - * @private - * @static - */ - deltaX: 0, - - /** - * the Y distance between the cursor and the object being dragged - * @property deltaY - * @type int - * @private - * @static - */ - deltaY: 0, - - /** - * Flag to determine if we should prevent the default behavior of the - * events we define. By default this is true, but this can be set to - * false if you need the default behavior (not recommended) - * @property preventDefault - * @type boolean - * @static - */ - preventDefault: true, - - /** - * Flag to determine if we should stop the propagation of the events - * we generate. This is true by default but you may want to set it to - * false if the html element contains other features that require the - * mouse click. - * @property stopPropagation - * @type boolean - * @static - */ - stopPropagation: true, - - /** - * Internal flag that is set to true when drag and drop has been - * intialized - * @property initialized - * @private - * @static - */ - initalized: false, - - /** - * All drag and drop can be disabled. - * @property locked - * @private - * @static - */ - locked: false, - - /** - * Called the first time an element is registered. - * @method init - * @private - * @static - */ - init: function() { - this.initialized = true; - }, - - /** - * In point mode, drag and drop interaction is defined by the - * location of the cursor during the drag/drop - * @property POINT - * @type int - * @static - */ - POINT: 0, - - /** - * In intersect mode, drag and drop interactio nis defined by the - * overlap of two or more drag and drop objects. - * @property INTERSECT - * @type int - * @static - */ - INTERSECT: 1, - - /** - * The current drag and drop mode. Default: POINT - * @property mode - * @type int - * @static - */ - mode: 0, - - /** - * Runs method on all drag and drop objects - * @method _execOnAll - * @private - * @static - */ - _execOnAll: function(sMethod, args) { - 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[sMethod].apply(oDD, args); - } - } - }, - - /** - * Drag and drop initialization. Sets up the global event handlers - * @method _onLoad - * @private - * @static - */ - _onLoad: function() { - - this.init(); - - - Event.on(document, "mouseup", this.handleMouseUp, this, true); - Event.on(document, "mousemove", this.handleMouseMove, this, true); - Event.on(window, "unload", this._onUnload, this, true); - Event.on(window, "resize", this._onResize, this, true); - // Event.on(window, "mouseout", this._test); - - }, - - /** - * Reset constraints on all drag and drop objs - * @method _onResize - * @private - * @static - */ - _onResize: function(e) { - this._execOnAll("resetConstraints", []); - }, - - /** - * Lock all drag and drop functionality - * @method lock - * @static - */ - lock: function() { this.locked = true; }, - - /** - * Unlock all drag and drop functionality - * @method unlock - * @static - */ - unlock: function() { this.locked = false; }, - - /** - * Is drag and drop locked? - * @method isLocked - * @return {boolean} True if drag and drop is locked, false otherwise. - * @static - */ - isLocked: function() { return this.locked; }, - - /** - * Location cache that is set for all drag drop objects when a drag is - * initiated, cleared when the drag is finished. - * @property locationCache - * @private - * @static - */ - locationCache: {}, - - /** - * Set useCache to false if you want to force object the lookup of each - * drag and drop linked element constantly during a drag. - * @property useCache - * @type boolean - * @static - */ - useCache: true, - - /** - * The number of pixels that the mouse needs to move after the - * mousedown before the drag is initiated. Default=3; - * @property clickPixelThresh - * @type int - * @static - */ - clickPixelThresh: 3, - - /** - * The number of milliseconds after the mousedown event to initiate the - * drag if we don't get a mouseup event. Default=1000 - * @property clickTimeThresh - * @type int - * @static - */ - clickTimeThresh: 1000, - - /** - * Flag that indicates that either the drag pixel threshold or the - * mousdown time threshold has been met - * @property dragThreshMet - * @type boolean - * @private - * @static - */ - dragThreshMet: false, - - /** - * Timeout used for the click time threshold - * @property clickTimeout - * @type Object - * @private - * @static - */ - clickTimeout: null, - - /** - * The X position of the mousedown event stored for later use when a - * drag threshold is met. - * @property startX - * @type int - * @private - * @static - */ - startX: 0, - - /** - * The Y position of the mousedown event stored for later use when a - * drag threshold is met. - * @property startY - * @type int - * @private - * @static - */ - startY: 0, - - /** - * Each DragDrop instance must be registered with the DragDropMgr. - * This is executed in DragDrop.init() - * @method regDragDrop - * @param {DragDrop} oDD the DragDrop object to register - * @param {String} sGroup the name of the group this element belongs to - * @static - */ - regDragDrop: function(oDD, sGroup) { - if (!this.initialized) { this.init(); } - - if (!this.ids[sGroup]) { - this.ids[sGroup] = {}; - } - this.ids[sGroup][oDD.id] = oDD; - }, - - /** - * Removes the supplied dd instance from the supplied group. Executed - * by DragDrop.removeFromGroup, so don't call this function directly. - * @method removeDDFromGroup - * @private - * @static - */ - removeDDFromGroup: function(oDD, sGroup) { - if (!this.ids[sGroup]) { - this.ids[sGroup] = {}; - } - - var obj = this.ids[sGroup]; - if (obj && obj[oDD.id]) { - delete obj[oDD.id]; - } - }, - - /** - * Unregisters a drag and drop item. This is executed in - * DragDrop.unreg, use that method instead of calling this directly. - * @method _remove - * @private - * @static - */ - _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]; - }, - - /** - * Each DragDrop handle element must be registered. This is done - * automatically when executing DragDrop.setHandleElId() - * @method regHandle - * @param {String} sDDId the DragDrop id this element is a handle for - * @param {String} sHandleId the id of the element that is the drag - * handle - * @static - */ - regHandle: function(sDDId, sHandleId) { - if (!this.handleIds[sDDId]) { - this.handleIds[sDDId] = {}; - } - this.handleIds[sDDId][sHandleId] = sHandleId; - }, - - /** - * Utility function to determine if a given element has been - * registered as a drag drop item. - * @method isDragDrop - * @param {String} id the element id to check - * @return {boolean} true if this element is a DragDrop item, - * false otherwise - * @static - */ - isDragDrop: function(id) { - return ( this.getDDById(id) ) ? true : false; - }, - - /** - * Returns the drag and drop instances that are in all groups the - * passed in instance belongs to. - * @method getRelated - * @param {DragDrop} p_oDD the obj to get related data for - * @param {boolean} bTargetsOnly if true, only return targetable objs - * @return {DragDrop[]} the related instances - * @static - */ - getRelated: function(p_oDD, bTargetsOnly) { - var oDDs = []; - for (var i in p_oDD.groups) { - for (j in this.ids[i]) { - var dd = this.ids[i][j]; - if (! this.isTypeOfDD(dd)) { - continue; - } - if (!bTargetsOnly || dd.isTarget) { - oDDs[oDDs.length] = dd; - } - } - } - - return oDDs; - }, - - /** - * Returns true if the specified dd target is a legal target for - * the specifice drag obj - * @method isLegalTarget - * @param {DragDrop} the drag obj - * @param {DragDrop} the target - * @return {boolean} true if the target is a legal target for the - * dd obj - * @static - */ - isLegalTarget: function (oDD, oTargetDD) { - var targets = this.getRelated(oDD, true); - for (var i=0, len=targets.length;i this.clickPixelThresh || - diffY > 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; - }, - - /** - * Iterates over all of the DragDrop elements to find ones we are - * hovering over or dropping on - * @method fireEvents - * @param {Event} e the event - * @param {boolean} isDrop is this a drop op or a mouseover op? - * @private - * @static - */ - fireEvents: function(e, isDrop) { - var dc = this.dragCurrent; - - // If the user did the mouse up outside of the window, we could - // get here even though we have ended the drag. - 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); - - // cache the previous dragOver array - var oldOvers = []; - - var outEvts = []; - var overEvts = []; - var dropEvts = []; - var enterEvts = []; - - // Check to see if the object(s) we were hovering over is no longer - // being hovered over so we can fire the onDragOut event - for (var i in this.dragOvers) { - - var ddo = this.dragOvers[i]; - - if (! this.isTypeOfDD(ddo)) { - continue; - } - - if (! this.isOverTarget(pt, ddo, this.mode)) { - outEvts.push( ddo ); - } - - oldOvers[i] = true; - delete this.dragOvers[i]; - } - - for (var sGroup in dc.groups) { - - if ("string" != typeof sGroup) { - continue; - } - - for (i in this.ids[sGroup]) { - var oDD = this.ids[sGroup][i]; - if (! this.isTypeOfDD(oDD)) { - continue; - } - - if (oDD.isTarget && !oDD.isLocked() && oDD != dc) { - if (this.isOverTarget(pt, oDD, this.mode)) { - // look for drop interactions - if (isDrop) { - dropEvts.push( oDD ); - // look for drag enter and drag over interactions - } else { - - // initial drag over: dragEnter fires - if (!oldOvers[oDD.id]) { - enterEvts.push( oDD ); - // subsequent drag overs: dragOver fires - } else { - overEvts.push( oDD ); - } - - this.dragOvers[oDD.id] = oDD; - } - } - } - } - } - - if (this.mode) { - if (outEvts.length) { - dc.b4DragOut(e, outEvts); - dc.onDragOut(e, outEvts); - } - - if (enterEvts.length) { - dc.onDragEnter(e, enterEvts); - } - - if (overEvts.length) { - dc.b4DragOver(e, overEvts); - dc.onDragOver(e, overEvts); - } - - if (dropEvts.length) { - dc.b4DragDrop(e, dropEvts); - dc.onDragDrop(e, dropEvts); - } - - } else { - // fire dragout events - var len = 0; - for (i=0, len=outEvts.length; i - * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups); - * - * Alternatively: - * - * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true}); - * - * @TODO this really should be an indexed array. Alternatively this - * method could accept both. - * @method refreshCache - * @param {Object} groups an associative array of groups to refresh - * @static - */ - refreshCache: function(groups) { - for (var sGroup in groups) { - if ("string" != typeof sGroup) { - continue; - } - for (var i in this.ids[sGroup]) { - var oDD = this.ids[sGroup][i]; - - if (this.isTypeOfDD(oDD)) { - // if (this.isTypeOfDD(oDD) && oDD.isTarget) { - var loc = this.getLocation(oDD); - if (loc) { - this.locationCache[oDD.id] = loc; - } else { - delete this.locationCache[oDD.id]; - // this will unregister the drag and drop object if - // the element is not in a usable state - // oDD.unreg(); - } - } - } - } - }, - - /** - * This checks to make sure an element exists and is in the DOM. The - * main purpose is to handle cases where innerHTML is used to remove - * drag and drop objects from the DOM. IE provides an 'unspecified - * error' when trying to access the offsetParent of such an element - * @method verifyEl - * @param {HTMLElement} el the element to check - * @return {boolean} true if the element looks usable - * @static - */ - verifyEl: function(el) { - try { - if (el) { - var parent = el.offsetParent; - if (parent) { - return true; - } - } - } catch(e) { - } - - return false; - }, - - /** - * Returns a Region object containing the drag and drop element's position - * and size, including the padding configured for it - * @method getLocation - * @param {DragDrop} oDD the drag and drop object to get the - * location for - * @return {YAHOO.util.Region} a Region object representing the total area - * the element occupies, including any padding - * the instance is configured for. - * @static - */ - 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 ); - }, - - /** - * Checks the cursor location to see if it over the target - * @method isOverTarget - * @param {YAHOO.util.Point} pt The point to evaluate - * @param {DragDrop} oTarget the DragDrop object we are inspecting - * @return {boolean} true if the mouse is over the target - * @private - * @static - */ - isOverTarget: function(pt, oTarget, intersect) { - // use cache if available - var loc = this.locationCache[oTarget.id]; - if (!loc || !this.useCache) { - loc = this.getLocation(oTarget); - this.locationCache[oTarget.id] = loc; - - } - - if (!loc) { - return false; - } - - oTarget.cursorIsOver = loc.contains( pt ); - - // DragDrop is using this as a sanity check for the initial mousedown - // in this case we are done. In POINT mode, if the drag obj has no - // contraints, we are also done. Otherwise we need to evaluate the - // location of the target as related to the actual location of the - // dragged element. - var dc = this.dragCurrent; - if (!dc || !dc.getTargetCoord || - (!intersect && !dc.constrainX && !dc.constrainY)) { - return oTarget.cursorIsOver; - } - - oTarget.overlap = null; - - // Get the current location of the drag element, this is the - // location of the mouse event less the delta that represents - // where the original mousedown happened on the element. We - // need to consider constraints and ticks as well. - var pos = dc.getTargetCoord(pt.x, pt.y); - - var el = dc.getDragEl(); - var curRegion = new YAHOO.util.Region( pos.y, - pos.x + el.offsetWidth, - pos.y + el.offsetHeight, - pos.x ); - - var overlap = curRegion.intersect(loc); - - if (overlap) { - oTarget.overlap = overlap; - return (intersect) ? true : oTarget.cursorIsOver; - } else { - return false; - } - }, - - /** - * unload event handler - * @method _onUnload - * @private - * @static - */ - _onUnload: function(e, me) { - this.unregAll(); - }, - - /** - * Cleans up the drag and drop events and objects. - * @method unregAll - * @private - * @static - */ - 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 = {}; - }, - - /** - * A cache of DOM elements - * @property elementCache - * @private - * @static - */ - elementCache: {}, - - /** - * Get the wrapper for the DOM element specified - * @method getElWrapper - * @param {String} id the id of the element to get - * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element - * @private - * @deprecated This wrapper isn't that useful - * @static - */ - getElWrapper: function(id) { - var oWrapper = this.elementCache[id]; - if (!oWrapper || !oWrapper.el) { - oWrapper = this.elementCache[id] = - new this.ElementWrapper(YAHOO.util.Dom.get(id)); - } - return oWrapper; - }, - - /** - * Returns the actual DOM element - * @method getElement - * @param {String} id the id of the elment to get - * @return {Object} The element - * @deprecated use YAHOO.util.Dom.get instead - * @static - */ - getElement: function(id) { - return YAHOO.util.Dom.get(id); - }, - - /** - * Returns the style property for the DOM element (i.e., - * document.getElById(id).style) - * @method getCss - * @param {String} id the id of the elment to get - * @return {Object} The style property of the element - * @deprecated use YAHOO.util.Dom instead - * @static - */ - getCss: function(id) { - var el = YAHOO.util.Dom.get(id); - return (el) ? el.style : null; - }, - - /** - * Inner class for cached elements - * @class DragDropMgr.ElementWrapper - * @for DragDropMgr - * @private - * @deprecated - */ - ElementWrapper: function(el) { - /** - * The element - * @property el - */ - this.el = el || null; - /** - * The element id - * @property id - */ - this.id = this.el && el.id; - /** - * A reference to the style property - * @property css - */ - this.css = this.el && el.style; - }, - - /** - * Returns the X position of an html element - * @method getPosX - * @param el the element for which to get the position - * @return {int} the X coordinate - * @for DragDropMgr - * @deprecated use YAHOO.util.Dom.getX instead - * @static - */ - getPosX: function(el) { - return YAHOO.util.Dom.getX(el); - }, - - /** - * Returns the Y position of an html element - * @method getPosY - * @param el the element for which to get the position - * @return {int} the Y coordinate - * @deprecated use YAHOO.util.Dom.getY instead - * @static - */ - getPosY: function(el) { - return YAHOO.util.Dom.getY(el); - }, - - /** - * Swap two nodes. In IE, we use the native method, for others we - * emulate the IE behavior - * @method swapNode - * @param n1 the first node to swap - * @param n2 the other node to swap - * @static - */ - 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); - } - } - }, - - /** - * Returns the current scroll position - * @method getScroll - * @private - * @static - */ - 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 }; - }, - - /** - * Returns the specified element style property - * @method getStyle - * @param {HTMLElement} el the element - * @param {string} styleProp the style property - * @return {string} The value of the style property - * @deprecated use YAHOO.util.Dom.getStyle - * @static - */ - getStyle: function(el, styleProp) { - return YAHOO.util.Dom.getStyle(el, styleProp); - }, - - /** - * Gets the scrollTop - * @method getScrollTop - * @return {int} the document's scrollTop - * @static - */ - getScrollTop: function () { return this.getScroll().top; }, - - /** - * Gets the scrollLeft - * @method getScrollLeft - * @return {int} the document's scrollTop - * @static - */ - getScrollLeft: function () { return this.getScroll().left; }, - - /** - * Sets the x/y position of an element to the location of the - * target element. - * @method moveToEl - * @param {HTMLElement} moveEl The element to move - * @param {HTMLElement} targetEl The position reference element - * @static - */ - moveToEl: function (moveEl, targetEl) { - var aCoord = YAHOO.util.Dom.getXY(targetEl); - YAHOO.util.Dom.setXY(moveEl, aCoord); - }, - - /** - * Gets the client height - * @method getClientHeight - * @return {int} client height in px - * @deprecated use YAHOO.util.Dom.getViewportHeight instead - * @static - */ - getClientHeight: function() { - return YAHOO.util.Dom.getViewportHeight(); - }, - - /** - * Gets the client width - * @method getClientWidth - * @return {int} client width in px - * @deprecated use YAHOO.util.Dom.getViewportWidth instead - * @static - */ - getClientWidth: function() { - return YAHOO.util.Dom.getViewportWidth(); - }, - - /** - * Numeric array sort function - * @method numericSort - * @static - */ - numericSort: function(a, b) { return (a - b); }, - - /** - * Internal counter - * @property _timeoutCount - * @private - * @static - */ - _timeoutCount: 0, - - /** - * Trying to make the load order less important. Without this we get - * an error if this file is loaded before the Event Utility. - * @method _addListeners - * @private - * @static - */ - _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; - } - } - } - }, - - /** - * Recursively searches the immediate parent and all child nodes for - * the handle element in order to determine wheter or not it was - * clicked. - * @method handleWasClicked - * @param node the html element to inspect - * @static - */ - handleWasClicked: function(node, id) { - if (this.isHandle(id, node.id)) { - return true; - } else { - // check to see if this is a text node child of the one we want - var p = node.parentNode; - - while (p) { - if (this.isHandle(id, p.id)) { - return true; - } else { - p = p.parentNode; - } - } - } - - return false; - } - - }; - +(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,_1e,_1f){ +this.initTarget(id,_1e,_1f); +_1.on(this.id,"mousedown",this.handleMouseDown,this,true); +},initTarget:function(id,_21,_22){ +this.config=_22||{}; +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((_21)?_21:"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(_23,_24,_25,_26){ +if(!_24&&0!==_24){ +this.padding=[_23,_23,_23,_23]; +}else{ +if(!_25&&0!==_25){ +this.padding=[_23,_24,_23,_24]; +}else{ +this.padding=[_23,_24,_25,_26]; +} +} +},setInitPosition:function(_27,_28){ +var el=this.getEl(); +if(!this.DDM.verifyEl(el)){ +return; +} +var dx=_27||0; +var dy=_28||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(_2f){ +this.groups[_2f]=true; +this.DDM.regDragDrop(this,_2f); +},removeFromGroup:function(_30){ +if(this.groups[_30]){ +delete this.groups[_30]; +} +this.DDM.removeDDFromGroup(this,_30); +},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 _36=e.which||e.button; +if(this.primaryButtonOnly&&_36>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 _39=_1.getTarget(e); +return (this.isValidHandleChild(_39)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_39,this.id))); +},addInvalidHandleType:function(_3a){ +var _3b=_3a.toUpperCase(); +this.invalidHandleTypes[_3b]=_3b; +},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(_3d){ +this.invalidHandleClasses.push(_3d); +},removeInvalidHandleType:function(_3e){ +var _3f=_3e.toUpperCase(); +delete this.invalidHandleTypes[_3f]; +},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(_41){ +for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-_48){ +if(!_49[i]){ +this.xTicks[this.xTicks.length]=i; +_49[i]=true; +} +} +for(i=this.initPageX;i<=this.maxX;i=i+_48){ +if(!_49[i]){ +this.xTicks[this.xTicks.length]=i; +_49[i]=true; +} +} +this.xTicks.sort(this.DDM.numericSort); +},setYTicks:function(_4b,_4c){ +this.yTicks=[]; +this.yTickSize=_4c; +var _4d={}; +for(var i=this.initPageY;i>=this.minY;i=i-_4c){ +if(!_4d[i]){ +this.yTicks[this.yTicks.length]=i; +_4d[i]=true; +} +} +for(i=this.initPageY;i<=this.maxY;i=i+_4c){ +if(!_4d[i]){ +this.yTicks[this.yTicks.length]=i; +_4d[i]=true; +} +} +this.yTicks.sort(this.DDM.numericSort); +},setXConstraint:function(_4f,_50,_51){ +this.leftConstraint=_4f; +this.rightConstraint=_50; +this.minX=this.initPageX-_4f; +this.maxX=this.initPageX+_50; +if(_51){ +this.setXTicks(this.initPageX,_51); +} +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,_53,_54){ +this.topConstraint=iUp; +this.bottomConstraint=_53; +this.minY=this.initPageY-iUp; +this.maxY=this.initPageY+_53; +if(_54){ +this.setYTicks(this.initPageY,_54); +} +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,_58){ +if(!_58){ +return val; +}else{ +if(_58[0]>=val){ +return _58[0]; +}else{ +for(var i=0,len=_58.length;i=val){ +var _5b=val-_58[i]; +var _5c=_58[_5a]-val; +return (_5c>_5b)?_58[i]:_58[_5a]; +} +} +return _58[_58.length-1]; +} +} +},toString:function(){ +return ("DragDrop "+this.id); +}}; +})(); +if(!YAHOO.util.DragDropMgr){ +YAHOO.util.DragDropMgr=function(){ +var _5d=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(_5e,_5f){ +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[_5e].apply(oDD,_5f); +} +} +},_onLoad:function(){ +this.init(); +_5d.on(document,"mouseup",this.handleMouseUp,this,true); +_5d.on(document,"mousemove",this.handleMouseMove,this,true); +_5d.on(window,"unload",this._onUnload,this,true); +_5d.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,_65){ +if(!this.initialized){ +this.init(); +} +if(!this.ids[_65]){ +this.ids[_65]={}; +} +this.ids[_65][oDD.id]=oDD; +},removeDDFromGroup:function(oDD,_67){ +if(!this.ids[_67]){ +this.ids[_67]={}; +} +var obj=this.ids[_67]; +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(_6b,_6c){ +if(!this.handleIds[_6b]){ +this.handleIds[_6b]={}; +} +this.handleIds[_6b][_6c]=_6c; +},isDragDrop:function(id){ +return (this.getDDById(id))?true:false; +},getRelated:function(_6e,_6f){ +var _70=[]; +for(var i in _6e.groups){ +for(j in this.ids[i]){ +var dd=this.ids[i][j]; +if(!this.isTypeOfDD(dd)){ +continue; +} +if(!_6f||dd.isTarget){ +_70[_70.length]=dd; +} +} +} +return _70; +},isLegalTarget:function(oDD,_74){ +var _75=this.getRelated(oDD,true); +for(var i=0,len=_75.length;ithis.clickPixelThresh||_87>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,_89){ +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 _8e=[]; +var _8f=[]; +var _90=[]; +var _91=[]; +var _92=[]; +for(var i in this.dragOvers){ +var ddo=this.dragOvers[i]; +if(!this.isTypeOfDD(ddo)){ +continue; +} +if(!this.isOverTarget(pt,ddo,this.mode)){ +_8f.push(ddo); +} +_8e[i]=true; +delete this.dragOvers[i]; +} +for(var _95 in dc.groups){ +if("string"!=typeof _95){ +continue; +} +for(i in this.ids[_95]){ +var oDD=this.ids[_95][i]; +if(!this.isTypeOfDD(oDD)){ +continue; +} +if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){ +if(this.isOverTarget(pt,oDD,this.mode)){ +if(_89){ +_91.push(oDD); +}else{ +if(!_8e[oDD.id]){ +_92.push(oDD); +}else{ +_90.push(oDD); +} +this.dragOvers[oDD.id]=oDD; +} +} +} +} +} +if(this.mode){ +if(_8f.length){ +dc.b4DragOut(e,_8f); +dc.onDragOut(e,_8f); +} +if(_92.length){ +dc.onDragEnter(e,_92); +} +if(_90.length){ +dc.b4DragOver(e,_90); +dc.onDragOver(e,_90); +} +if(_91.length){ +dc.b4DragDrop(e,_91); +dc.onDragDrop(e,_91); +} +}else{ +var len=0; +for(i=0,len=_8f.length;i2000){ +}else{ +setTimeout(DDM._addListeners,10); +if(document&&document.body){ +DDM._timeoutCount+=1; +} +} +} +},handleWasClicked:function(_c6,id){ +if(this.isHandle(id,_c6.id)){ +return true; +}else{ +var p=_c6.parentNode; +while(p){ +if(this.isHandle(id,p.id)){ +return true; +}else{ +p=p.parentNode; +} +} +} +return false; +}}; }(); - -// shorter alias, save a few bytes -YAHOO.util.DDM = YAHOO.util.DragDropMgr; +YAHOO.util.DDM=YAHOO.util.DragDropMgr; YAHOO.util.DDM._addListeners(); - } - -/** - * A DragDrop implementation where the linked element follows the - * mouse cursor during a drag. - * @class DD - * @extends YAHOO.util.DragDrop - * @constructor - * @param {String} id the id of the linked element - * @param {String} sGroup the group of related DragDrop items - * @param {object} config an object containing configurable attributes - * Valid properties for DD: - * scroll - */ -YAHOO.util.DD = function(id, sGroup, config) { - if (id) { - this.init(id, sGroup, config); - } +YAHOO.util.DD=function(id,_ca,_cb){ +if(id){ +this.init(id,_ca,_cb); +} }; - -YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, { - - /** - * When set to true, the utility automatically tries to scroll the browser - * window wehn a drag and drop element is dragged near the viewport boundary. - * Defaults to true. - * @property scroll - * @type boolean - */ - scroll: true, - - /** - * Sets the pointer offset to the distance between the linked element's top - * left corner and the location the element was clicked - * @method autoOffset - * @param {int} iPageX the X coordinate of the click - * @param {int} iPageY the Y coordinate of the click - */ - autoOffset: function(iPageX, iPageY) { - var x = iPageX - this.startPageX; - var y = iPageY - this.startPageY; - this.setDelta(x, y); - }, - - /** - * Sets the pointer offset. You can call this directly to force the - * offset to be in a particular location (e.g., pass in 0,0 to set it - * to the center of the object, as done in YAHOO.widget.Slider) - * @method setDelta - * @param {int} iDeltaX the distance from the left - * @param {int} iDeltaY the distance from the top - */ - setDelta: function(iDeltaX, iDeltaY) { - this.deltaX = iDeltaX; - this.deltaY = iDeltaY; - }, - - /** - * Sets the drag element to the location of the mousedown or click event, - * maintaining the cursor location relative to the location on the element - * that was clicked. Override this if you want to place the element in a - * location other than where the cursor is. - * @method setDragElPos - * @param {int} iPageX the X coordinate of the mousedown or drag event - * @param {int} iPageY the Y coordinate of the mousedown or drag event - */ - setDragElPos: function(iPageX, iPageY) { - // the first time we do this, we are going to check to make sure - // the element has css positioning - - var el = this.getDragEl(); - this.alignElWithMouse(el, iPageX, iPageY); - }, - - /** - * Sets the element to the location of the mousedown or click event, - * maintaining the cursor location relative to the location on the element - * that was clicked. Override this if you want to place the element in a - * location other than where the cursor is. - * @method alignElWithMouse - * @param {HTMLElement} el the element to move - * @param {int} iPageX the X coordinate of the mousedown or drag event - * @param {int} iPageY the Y coordinate of the mousedown or drag event - */ - alignElWithMouse: function(el, iPageX, iPageY) { - var oCoord = this.getTargetCoord(iPageX, iPageY); - - if (!this.deltaSetXY) { - var aCoord = [oCoord.x, oCoord.y]; - YAHOO.util.Dom.setXY(el, aCoord); - var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); - var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); - - this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ]; - } else { - YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px"); - YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px"); - } - - this.cachePosition(oCoord.x, oCoord.y); - this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth); - }, - - /** - * Saves the most recent position so that we can reset the constraints and - * tick marks on-demand. We need to know this so that we can calculate the - * number of pixels the element is offset from its original position. - * @method cachePosition - * @param iPageX the current x position (optional, this just makes it so we - * don't have to look it up again) - * @param iPageY the current y position (optional, this just makes it so we - * don't have to look it up again) - */ - cachePosition: function(iPageX, iPageY) { - if (iPageX) { - this.lastPageX = iPageX; - this.lastPageY = iPageY; - } else { - var aCoord = YAHOO.util.Dom.getXY(this.getEl()); - this.lastPageX = aCoord[0]; - this.lastPageY = aCoord[1]; - } - }, - - /** - * Auto-scroll the window if the dragged object has been moved beyond the - * visible window boundary. - * @method autoScroll - * @param {int} x the drag element's x position - * @param {int} y the drag element's y position - * @param {int} h the height of the drag element - * @param {int} w the width of the drag element - * @private - */ - autoScroll: function(x, y, h, w) { - - if (this.scroll) { - // The client height - var clientH = this.DDM.getClientHeight(); - - // The client width - var clientW = this.DDM.getClientWidth(); - - // The amt scrolled down - var st = this.DDM.getScrollTop(); - - // The amt scrolled right - var sl = this.DDM.getScrollLeft(); - - // Location of the bottom of the element - var bot = h + y; - - // Location of the right of the element - var right = w + x; - - // The distance from the cursor to the bottom of the visible area, - // adjusted so that we don't scroll if the cursor is beyond the - // element drag constraints - var toBot = (clientH + st - y - this.deltaY); - - // The distance from the cursor to the right of the visible area - var toRight = (clientW + sl - x - this.deltaX); - - - // How close to the edge the cursor must be before we scroll - // var thresh = (document.all) ? 100 : 40; - var thresh = 40; - - // How many pixels to scroll per autoscroll op. This helps to reduce - // clunky scrolling. IE is more sensitive about this ... it needs this - // value to be higher. - var scrAmt = (document.all) ? 80 : 30; - - // Scroll down if we are near the bottom of the visible page and the - // obj extends below the crease - if ( bot > clientH && toBot < thresh ) { - window.scrollTo(sl, st + scrAmt); - } - - // Scroll up if the window is scrolled down and the top of the object - // goes above the top border - if ( y < st && st > 0 && y - st < thresh ) { - window.scrollTo(sl, st - scrAmt); - } - - // Scroll right if the obj is beyond the right border and the cursor is - // near the border. - if ( right > clientW && toRight < thresh ) { - window.scrollTo(sl + scrAmt, st); - } - - // Scroll left if the window has been scrolled to the right and the obj - // extends past the left border - if ( x < sl && sl > 0 && x - sl < thresh ) { - window.scrollTo(sl - scrAmt, st); - } - } - }, - - /** - * Finds the location the element should be placed if we want to move - * it to where the mouse location less the click offset would place us. - * @method getTargetCoord - * @param {int} iPageX the X coordinate of the click - * @param {int} iPageY the Y coordinate of the click - * @return an object that contains the coordinates (Object.x and Object.y) - * @private - */ - getTargetCoord: function(iPageX, iPageY) { - - - var x = iPageX - this.deltaX; - var y = iPageY - 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}; - }, - - /* - * Sets up config options specific to this class. Overrides - * YAHOO.util.DragDrop, but all versions of this method through the - * inheritance chain are called - */ - applyConfig: function() { - YAHOO.util.DD.superclass.applyConfig.call(this); - this.scroll = (this.config.scroll !== false); - }, - - /* - * Event that fires prior to the onMouseDown event. Overrides - * YAHOO.util.DragDrop. - */ - b4MouseDown: function(e) { - // this.resetConstraints(); - this.autoOffset(YAHOO.util.Event.getPageX(e), - YAHOO.util.Event.getPageY(e)); - }, - - /* - * Event that fires prior to the onDrag event. Overrides - * YAHOO.util.DragDrop. - */ - b4Drag: function(e) { - this.setDragElPos(YAHOO.util.Event.getPageX(e), - YAHOO.util.Event.getPageY(e)); - }, - - toString: function() { - return ("DD " + this.id); - } - - ////////////////////////////////////////////////////////////////////////// - // Debugging ygDragDrop events that can be overridden - ////////////////////////////////////////////////////////////////////////// - /* - startDrag: function(x, y) { - }, - - onDrag: function(e) { - }, - - onDragEnter: function(e, id) { - }, - - onDragOver: function(e, id) { - }, - - onDragOut: function(e, id) { - }, - - onDragDrop: function(e, id) { - }, - - endDrag: function(e) { - } - - */ - -}); -/** - * A DragDrop implementation that inserts an empty, bordered div into - * the document that follows the cursor during drag operations. At the time of - * the click, the frame div is resized to the dimensions of the linked html - * element, and moved to the exact location of the linked element. - * - * References to the "frame" element refer to the single proxy element that - * was created to be dragged in place of all DDProxy elements on the - * page. - * - * @class DDProxy - * @extends YAHOO.util.DD - * @constructor - * @param {String} id the id of the linked html element - * @param {String} sGroup the group of related DragDrop objects - * @param {object} config an object containing configurable attributes - * Valid properties for DDProxy in addition to those in DragDrop: - * resizeFrame, centerFrame, dragElId - */ -YAHOO.util.DDProxy = function(id, sGroup, config) { - if (id) { - this.init(id, sGroup, config); - this.initFrame(); - } +YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_cc,_cd){ +var x=_cc-this.startPageX; +var y=_cd-this.startPageY; +this.setDelta(x,y); +},setDelta:function(_d0,_d1){ +this.deltaX=_d0; +this.deltaY=_d1; +},setDragElPos:function(_d2,_d3){ +var el=this.getDragEl(); +this.alignElWithMouse(el,_d2,_d3); +},alignElWithMouse:function(el,_d6,_d7){ +var _d8=this.getTargetCoord(_d6,_d7); +if(!this.deltaSetXY){ +var _d9=[_d8.x,_d8.y]; +YAHOO.util.Dom.setXY(el,_d9); +var _da=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10); +var _db=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10); +this.deltaSetXY=[_da-_d8.x,_db-_d8.y]; +}else{ +YAHOO.util.Dom.setStyle(el,"left",(_d8.x+this.deltaSetXY[0])+"px"); +YAHOO.util.Dom.setStyle(el,"top",(_d8.y+this.deltaSetXY[1])+"px"); +} +this.cachePosition(_d8.x,_d8.y); +this.autoScroll(_d8.x,_d8.y,el.offsetHeight,el.offsetWidth); +},cachePosition:function(_dc,_dd){ +if(_dc){ +this.lastPageX=_dc; +this.lastPageY=_dd; +}else{ +var _de=YAHOO.util.Dom.getXY(this.getEl()); +this.lastPageX=_de[0]; +this.lastPageY=_de[1]; +} +},autoScroll:function(x,y,h,w){ +if(this.scroll){ +var _e3=this.DDM.getClientHeight(); +var _e4=this.DDM.getClientWidth(); +var st=this.DDM.getScrollTop(); +var sl=this.DDM.getScrollLeft(); +var bot=h+y; +var _e8=w+x; +var _e9=(_e3+st-y-this.deltaY); +var _ea=(_e4+sl-x-this.deltaX); +var _eb=40; +var _ec=(document.all)?80:30; +if(bot>_e3&&_e9<_eb){ +window.scrollTo(sl,st+_ec); +} +if(y0&&y-st<_eb){ +window.scrollTo(sl,st-_ec); +} +if(_e8>_e4&&_ea<_eb){ +window.scrollTo(sl+_ec,st); +} +if(x0&&x-sl<_eb){ +window.scrollTo(sl-_ec,st); +} +} +},getTargetCoord:function(_ed,_ee){ +var x=_ed-this.deltaX; +var y=_ee-this.deltaY; +if(this.constrainX){ +if(xthis.maxX){ +x=this.maxX; +} +} +if(this.constrainY){ +if(ythis.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,_f4,_f5){ +if(id){ +this.init(id,_f4,_f5); +this.initFrame(); +} }; - -/** - * The default drag frame div id - * @property YAHOO.util.DDProxy.dragElId - * @type String - * @static - */ -YAHOO.util.DDProxy.dragElId = "ygddfdiv"; - -YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, { - - /** - * By default we resize the drag frame to be the same size as the element - * we want to drag (this is to get the frame effect). We can turn it off - * if we want a different behavior. - * @property resizeFrame - * @type boolean - */ - resizeFrame: true, - - /** - * By default the frame is positioned exactly where the drag element is, so - * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if - * you do not have constraints on the obj is to have the drag frame centered - * around the cursor. Set centerFrame to true for this effect. - * @property centerFrame - * @type boolean - */ - centerFrame: false, - - /** - * Creates the proxy element if it does not yet exist - * @method createFrame - */ - 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; - - // appendChild can blow up IE if invoked prior to the window load event - // while rendering a table. It is possible there are other scenarios - // that would cause this to happen as well. - body.insertBefore(div, body.firstChild); - } - }, - - /** - * Initialization for the drag frame element. Must be called in the - * constructor of all subclasses - * @method initFrame - */ - 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); - }, - - /** - * Resizes the drag frame to the dimensions of the clicked object, positions - * it over the object, and finally displays it - * @method showFrame - * @param {int} iPageX X click position - * @param {int} iPageY Y click position - * @private - */ - showFrame: function(iPageX, iPageY) { - var el = this.getEl(); - var dragEl = this.getDragEl(); - var s = dragEl.style; - - this._resizeProxy(); - - if (this.centerFrame) { - this.setDelta( Math.round(parseInt(s.width, 10)/2), - Math.round(parseInt(s.height, 10)/2) ); - } - - this.setDragElPos(iPageX, iPageY); - - YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); - }, - - /** - * The proxy is automatically resized to the dimensions of the linked - * element when a drag is initiated, unless resizeFrame is set to false - * @method _resizeProxy - * @private - */ - _resizeProxy: function() { - if (this.resizeFrame) { - var DOM = YAHOO.util.Dom; - var el = this.getEl(); - var dragEl = this.getDragEl(); - - var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10); - var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10); - var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10); - var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10); - - if (isNaN(bt)) { bt = 0; } - if (isNaN(br)) { br = 0; } - if (isNaN(bb)) { bb = 0; } - if (isNaN(bl)) { bl = 0; } - - - var newWidth = Math.max(0, el.offsetWidth - br - bl); - var newHeight = Math.max(0, el.offsetHeight - bt - bb); - - - DOM.setStyle( dragEl, "width", newWidth + "px" ); - DOM.setStyle( dragEl, "height", newHeight + "px" ); - } - }, - - // overrides YAHOO.util.DragDrop - 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); - }, - - // overrides YAHOO.util.DragDrop - b4StartDrag: function(x, y) { - // show the drag frame - this.showFrame(x, y); - }, - - // overrides YAHOO.util.DragDrop - b4EndDrag: function(e) { - YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); - }, - - // overrides YAHOO.util.DragDrop - // By default we try to move the element to the last location of the frame. - // This is so that the default behavior mirrors that of YAHOO.util.DD. - endDrag: function(e) { - var DOM = YAHOO.util.Dom; - var lel = this.getEl(); - var del = this.getDragEl(); - - // Show the drag frame briefly so we can get its position - // del.style.visibility = ""; - DOM.setStyle(del, "visibility", ""); - - // Hide the linked element before the move to get around a Safari - // rendering bug. - //lel.style.visibility = "hidden"; - DOM.setStyle(lel, "visibility", "hidden"); - YAHOO.util.DDM.moveToEl(lel, del); - //del.style.visibility = "hidden"; - DOM.setStyle(del, "visibility", "hidden"); - //lel.style.visibility = ""; - DOM.setStyle(lel, "visibility", ""); - }, - - toString: function() { - return ("DDProxy " + this.id); - } - -}); -/** - * A DragDrop implementation that does not move, but can be a drop - * target. You would get the same result by simply omitting implementation - * for the event callbacks, but this way we reduce the processing cost of the - * event listener and the callbacks. - * @class DDTarget - * @extends YAHOO.util.DragDrop - * @constructor - * @param {String} id the id of the element that is a drop target - * @param {String} sGroup the group of related DragDrop objects - * @param {object} config an object containing configurable attributes - * Valid properties for DDTarget in addition to those in - * DragDrop: - * none - */ -YAHOO.util.DDTarget = function(id, sGroup, config) { - if (id) { - this.initTarget(id, sGroup, config); - } +YAHOO.util.DDProxy.dragElId="ygddfdiv"; +YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){ +var _f6=this; +var _f7=document.body; +if(!_f7||!_f7.firstChild){ +setTimeout(function(){ +_f6.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; +_f7.insertBefore(div,_f7.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(_fa,_fb){ +var el=this.getEl(); +var _fd=this.getDragEl(); +var s=_fd.style; +this._resizeProxy(); +if(this.centerFrame){ +this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2)); +} +this.setDragElPos(_fa,_fb); +YAHOO.util.Dom.setStyle(_fd,"visibility","visible"); +},_resizeProxy:function(){ +if(this.resizeFrame){ +var DOM=YAHOO.util.Dom; +var el=this.getEl(); +var _101=this.getDragEl(); +var bt=parseInt(DOM.getStyle(_101,"borderTopWidth"),10); +var br=parseInt(DOM.getStyle(_101,"borderRightWidth"),10); +var bb=parseInt(DOM.getStyle(_101,"borderBottomWidth"),10); +var bl=parseInt(DOM.getStyle(_101,"borderLeftWidth"),10); +if(isNaN(bt)){ +bt=0; +} +if(isNaN(br)){ +br=0; +} +if(isNaN(bb)){ +bb=0; +} +if(isNaN(bl)){ +bl=0; +} +var _106=Math.max(0,el.offsetWidth-br-bl); +var _107=Math.max(0,el.offsetHeight-bt-bb); +DOM.setStyle(_101,"width",_106+"px"); +DOM.setStyle(_101,"height",_107+"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,_113,_114){ +if(id){ +this.initTarget(id,_113,_114); +} }; +YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){ +return ("DDTarget "+this.id); +}}); -// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop(); -YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, { - toString: function() { - return ("DDTarget " + this.id); - } -}); diff --git a/thirdpartyjs/yui/event/event.js b/thirdpartyjs/yui/event/event.js index 0f135dd..fad7673 100644 --- a/thirdpartyjs/yui/event/event.js +++ b/thirdpartyjs/yui/event/event.js @@ -1,1738 +1 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.12.0 -*/ - -/** - * The CustomEvent class lets you define events for your application - * that can be subscribed to by one or more independent component. - * - * @param {String} type The type of event, which is passed to the callback - * when the event fires - * @param {Object} oScope The context the event will fire from. "this" will - * refer to this object in the callback. Default value: - * the window object. The listener can override this. - * @param {boolean} silent pass true to prevent the event from writing to - * the log system - * @namespace YAHOO.util - * @class CustomEvent - * @constructor - */ -YAHOO.util.CustomEvent = function(type, oScope, silent, signature) { - - /** - * The type of event, returned to subscribers when the event fires - * @property type - * @type string - */ - this.type = type; - - /** - * The scope the the event will fire from by default. Defaults to the window - * obj - * @property scope - * @type object - */ - this.scope = oScope || window; - - /** - * By default all custom events are logged in the debug build, set silent - * to true to disable logging for this event. - * @property silent - * @type boolean - */ - this.silent = silent; - - /** - * Custom events support two styles of arguments provided to the event - * subscribers. - *
      - *
    • YAHOO.util.CustomEvent.LIST: - *
        - *
      • param1: event name
      • - *
      • param2: array of arguments sent to fire
      • - *
      • param3: a custom object supplied by the subscriber
      • - *
      - *
    • - *
    • YAHOO.util.CustomEvent.FLAT - *
        - *
      • param1: the first argument passed to fire. If you need to - * pass multiple parameters, use and array or object literal
      • - *
      • param2: a custom object supplied by the subscriber
      • - *
      - *
    • - *
    - * @property signature - * @type int - */ - this.signature = signature || YAHOO.util.CustomEvent.LIST; - - /** - * The subscribers to this event - * @property subscribers - * @type Subscriber[] - */ - this.subscribers = []; - - if (!this.silent) { - } - - var onsubscribeType = "_YUICEOnSubscribe"; - - // Only add subscribe events for events that are not generated by - // CustomEvent - if (type !== onsubscribeType) { - - /** - * Custom events provide a custom event that fires whenever there is - * a new subscriber to the event. This provides an opportunity to - * handle the case where there is a non-repeating event that has - * already fired has a new subscriber. - * - * @event subscribeEvent - * @type YAHOO.util.CustomEvent - * @param {Function} fn The function to execute - * @param {Object} obj An object to be passed along when the event - * fires - * @param {boolean|Object} override If true, the obj passed in becomes - * the execution scope of the listener. - * if an object, that object becomes the - * the execution scope. - */ - this.subscribeEvent = - new YAHOO.util.CustomEvent(onsubscribeType, this, true); - - } -}; - -/** - * Subscriber listener sigature constant. The LIST type returns three - * parameters: the event type, the array of args passed to fire, and - * the optional custom object - * @property YAHOO.util.CustomEvent.LIST - * @static - * @type int - */ -YAHOO.util.CustomEvent.LIST = 0; - -/** - * Subscriber listener sigature constant. The FLAT type returns two - * parameters: the first argument passed to fire and the optional - * custom object - * @property YAHOO.util.CustomEvent.FLAT - * @static - * @type int - */ -YAHOO.util.CustomEvent.FLAT = 1; - -YAHOO.util.CustomEvent.prototype = { - - /** - * Subscribes the caller to this event - * @method subscribe - * @param {Function} fn The function to execute - * @param {Object} obj An object to be passed along when the event - * fires - * @param {boolean|Object} override If true, the obj passed in becomes - * the execution scope of the listener. - * if an object, that object becomes the - * the execution scope. - */ - subscribe: function(fn, obj, override) { - if (this.subscribeEvent) { - this.subscribeEvent.fire(fn, obj, override); - } - - this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) ); - }, - - /** - * Unsubscribes the caller from this event - * @method unsubscribe - * @param {Function} fn The function to execute - * @param {Object} obj The custom object passed to subscribe (optional) - * @return {boolean} True if the subscriber was found and detached. - */ - unsubscribe: function(fn, obj) { - var found = false; - for (var i=0, len=this.subscribers.length; i - *
  • The type of event
  • - *
  • All of the arguments fire() was executed with as an array
  • - *
  • The custom object (if any) that was passed into the subscribe() - * method
  • - * - * @method fire - * @param {Object*} arguments an arbitrary set of parameters to pass to - * the handler. - */ - fire: function() { - var len=this.subscribers.length; - if (!len && this.silent) { - return true; - } - - var args=[], ret=true, i; - - for (i=0; i 0) { - param = args[0]; - } - ret = s.fn.call(scope, param, s.obj); - } else { - ret = s.fn.call(scope, this.type, args, s.obj); - } - if (false === ret) { - if (!this.silent) { - } - - //break; - return false; - } - } - } - - return true; - }, - - /** - * Removes all listeners - * @method unsubscribeAll - */ - unsubscribeAll: function() { - for (var i=0, len=this.subscribers.length; i