Initial commit for trunk 3.x.
authorMarco Zanon <info@marcozanon.com>
Sun, 26 Aug 2012 10:29:09 +0000 (10:29 +0000)
committerMarco Zanon <info@marcozanon.com>
Sun, 26 Aug 2012 10:29:09 +0000 (10:29 +0000)
368 files changed:
3.x/LICENSE [new file with mode: 0644]
3.x/build.xml [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/MException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/MHttpServlet.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/MInformation.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/MObject.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/MRuntimeException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/configuration/MConfiguration.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/configuration/MConfigurationException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/configuration/MFileParsingConfigurationException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/configuration/MValueNotFoundConfigurationException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/conversion/MConversionException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/conversion/MDateConverter.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/conversion/MFormatConversionException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/conversion/MNumberConverter.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MInvalidValueJsonException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonArray.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonBoolean.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonNull.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonNumber.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonObject.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonString.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/json/MJsonValue.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/logging/MLogFilter.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/logging/MLogPlainTextFile.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/logging/MLogTarget.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/logging/MLoggingException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MSqlConnection.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MSqlException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MSqlTable.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MStatementSqlException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/sql/MTransactionSqlException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/text/MText.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/text/MTranslationException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/text/MTranslationValueNotFoundTextException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/text/MTranslator.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/text/MXhtmlUnsafeStringTextException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MApplicationServletWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MBrowserPageRequestPreprocessingWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MDisplayWidgetNotFoundWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MDownloaderNotFoundWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidRemoteIpAddressWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidRequestWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidResourceWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidSecurityIdWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MMessagingWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoBrowserPageWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoCellContentWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoLogFilterWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoProcessableMessageWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoViewContentWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoViewWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNoWidgetIdWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MNullPropertyWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MResponseWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MSecurityWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MSetupWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MUnexpectedMessageWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MUniqueWidgetIdNotAvailableWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MValidationWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MViewNotUnloadableWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MViewThreadStoppingWebRuntimeException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebApplicationContext.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebBorder.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebBreadcrumbs.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebBrowserPage.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebCellWidget.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebCheckBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebColor.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebComboBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebDateBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebDirectWidget.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebDisplayWidget.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebDownloader.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebExtendedTextBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebFont.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebGridLayout.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebGridLayoutCell.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebImage.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebImageButton.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebLabel.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebMeasure.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebMessage.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebNumberBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebPasswordBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebRuntimeException.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebSimpleTextBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebTable.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebTableCell.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebTextBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebUploader.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebVerticalMenu.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebVerticalMenuItem.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebView.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebWidget.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebWysiwygBox.java [new file with mode: 0644]
3.x/src/java/com/marcozanon/macaco/web/ui/MWebXhtmlLabel.java [new file with mode: 0644]
3.x/src/resources/css/default.css [new file with mode: 0644]
3.x/src/resources/dtd/xhtml1-transitional-macaco-edit.dtd [new file with mode: 0644]
3.x/src/resources/gif/waitingIcon.gif [new file with mode: 0644]
3.x/src/resources/javascript/$.js [new file with mode: 0644]
3.x/src/resources/javascript/MWebCustomJsonHelper.js [new file with mode: 0644]
3.x/src/resources/javascript/MWebMessageInterface.js [new file with mode: 0644]
3.x/src/resources/javascript/MWebNotificationArea.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/langs/en.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/license.txt [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advhr/css/advhr.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advhr/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advhr/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advhr/js/rule.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advhr/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advhr/rule.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/css/advimage.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/image.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/img/sample.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/js/image.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advimage/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlink/css/advlink.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlink/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlink/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlink/js/advlink.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlink/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlink/link.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlist/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/advlist/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autolink/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autolink/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autoresize/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autoresize/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autosave/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autosave/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/autosave/langs/en.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/bbcode/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/bbcode/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/contextmenu/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/contextmenu/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/directionality/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/directionality/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/emotions.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cool.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cry.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-embarassed.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-foot-in-mouth.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-frown.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-innocent.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-kiss.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-laughing.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-money-mouth.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-sealed.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-smile.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-surprised.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-tongue-out.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-undecided.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-wink.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-yell.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/js/emotions.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/emotions/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/dialog.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/img/example.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/js/dialog.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/langs/en.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example_dependency/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/example_dependency/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullpage/css/fullpage.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullpage/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullpage/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullpage/fullpage.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullpage/js/fullpage.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullpage/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/fullscreen.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/iespell/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/iespell/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/alert.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/button.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/corners.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/window.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/template.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/insertdatetime/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/insertdatetime/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/layer/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/layer/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/legacyoutput/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/legacyoutput/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/lists/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/lists/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/css/media.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/js/embed.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/js/media.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/media.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/media/moxieplayer.swf [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/nonbreaking/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/nonbreaking/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/noneditable/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/noneditable/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/pagebreak/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/pagebreak/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/js/pastetext.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/js/pasteword.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/pastetext.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/paste/pasteword.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/preview/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/preview/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/preview/example.html [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/preview/jscripts/embed.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/preview/preview.html [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/print/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/print/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/save/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/save/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/css/searchreplace.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/js/searchreplace.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/searchreplace.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/css/content.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/img/wline.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/css/props.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/js/props.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/props.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/style/readme.txt [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/tabfocus/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/tabfocus/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/cell.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/css/cell.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/css/row.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/css/table.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/js/cell.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/js/merge_cells.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/js/row.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/js/table.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/merge_cells.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/row.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/table/table.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/blank.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/css/template.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/js/template.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/template/template.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/css/visualblocks.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/visualchars/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/visualchars/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/wordcount/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/wordcount/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/abbr.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/acronym.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/attributes.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/cite.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/css/attributes.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/css/popup.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/del.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/editor_plugin.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/editor_plugin_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/ins.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/abbr.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/acronym.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/attributes.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/cite.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/del.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/element_common.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/ins.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/about.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/anchor.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/charmap.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/color_picker.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/editor_template.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/editor_template_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/image.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/colorpicker.jpg [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/flash.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/icons.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/iframe.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/pagebreak.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/quicktime.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/realmedia.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/shockwave.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/trans.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/video.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/img/windowsmedia.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/about.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/anchor.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/charmap.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/color_picker.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/image.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/link.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/js/source_editor.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/langs/en.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/langs/en_dlg.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/link.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/shortcuts.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/content.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/dialog.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/buttons.png [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/items.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_arrow.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_check.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/progress.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/tabs.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/ui.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/content.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/dialog.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/ui.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/content.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/dialog.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg.png [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_black.png [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_silver.png [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui_black.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui_silver.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/advanced/source_editor.htm [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/editor_template.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/editor_template_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/img/icons.gif [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/langs/en.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/skins/default/content.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/skins/default/ui.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/content.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/img/button_bg.png [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/ui.css [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/tiny_mce.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/tiny_mce_popup.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/tiny_mce_src.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/utils/editable_selects.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/utils/form_utils.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/utils/mctabs.js [new file with mode: 0644]
3.x/src/resources/javascript/TinyMCE/utils/validate.js [new file with mode: 0644]

diff --git a/3.x/LICENSE b/3.x/LICENSE
new file mode 100644 (file)
index 0000000..2f6f993
--- /dev/null
@@ -0,0 +1,28 @@
+Macaco
+Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+
+Released under MIT license:
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+
+Small portions inspired by other projects or web pages.
+See source code for additional information.
+
+Includes TinyMCE Wysiwyg editor (c) Moxiecode Systems AB.
+See http://tinymce.moxiecode.com for license and additional information.
diff --git a/3.x/build.xml b/3.x/build.xml
new file mode 100644 (file)
index 0000000..9c859a8
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="macaco" default="clean">
+
+    <target name="clean" description="Cleans up everything">
+        <delete dir="target/" />
+    </target>
+
+    <target name="archive" depends="clean" description="Packs source files into a .tar.gz archive">
+        <tar compression="gzip" destfile="target/${ant.project.name}.tar.gz" basedir="." excludes="target/" />
+    </target>
+
+    <target name="checkServlet3Mode">
+        <condition property="isServlet3Mode">
+            <istrue value="${servlet3Mode}" />
+        </condition>
+    </target>
+
+    <target name="compileWithServlet3Mode" depends="clean, checkServlet3Mode" if="isServlet3Mode" description="Compiles source Java code to bytecode (Servlet &gt;= 3 mode)">
+        <mkdir dir="target/classes/" />
+        <javac srcdir="src/java/" destdir="target/classes/">
+            <compilerarg value="-Xlint" />
+        </javac>
+    </target>
+
+    <target name="compileWithoutServlet3Mode" depends="clean, checkServlet3Mode" unless="isServlet3Mode" description="Compiles source Java code to bytecode (Servlet &lt; 3 mode)">
+        <mkdir dir="target/classes/" />
+        <javac srcdir="src/java/" excludes="**/MWebUploader.java" destdir="target/classes/">
+            <compilerarg value="-Xlint" />
+        </javac>
+    </target>
+
+    <target name="compile" depends="compileWithServlet3Mode, compileWithoutServlet3Mode" description="Compiles source Java code to bytecode">
+    </target>
+
+    <target name="jar" depends="compile" description="Creates a Jar file">
+        <jar destfile="target/${ant.project.name}.jar">
+            <fileset dir="target/classes/" includes="**/*.class" />
+            <fileset dir="src/resources/" includes="**/*.*" />
+        </jar>
+    </target>
+
+</project>
diff --git a/3.x/src/java/com/marcozanon/macaco/MException.java b/3.x/src/java/com/marcozanon/macaco/MException.java
new file mode 100644 (file)
index 0000000..0c78658
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco;
+
+public abstract class MException extends Exception {
+
+    /* */
+
+    public MException() {
+        super();
+    }
+
+    public MException(String message) {
+        super(message);
+    }
+
+    public MException(Throwable error) {
+        super(error);
+    }
+
+    public MException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/MHttpServlet.java b/3.x/src/java/com/marcozanon/macaco/MHttpServlet.java
new file mode 100644 (file)
index 0000000..64cb7c9
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco;
+
+import javax.servlet.http.HttpServlet;
+
+public abstract class MHttpServlet extends HttpServlet {
+
+    /* */
+
+    protected MHttpServlet clone() {
+        throw new UnsupportedOperationException("Please provide manually by yourself.");
+    }
+
+    public String toString() {
+        throw new UnsupportedOperationException("Please use appropriate methods (if any).");
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/MInformation.java b/3.x/src/java/com/marcozanon/macaco/MInformation.java
new file mode 100644 (file)
index 0000000..d9d6dc2
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco;
+
+import com.marcozanon.macaco.text.MText;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class MInformation extends MObject {
+
+    public static final String MACACO_VERSION = "3.x";
+
+    public static final String TEXT_ENCODING = "UTF-8";
+
+    public static enum HttpContentType {
+        CSS(String.format("text/css; charset=%s", MInformation.TEXT_ENCODING)),
+        GIF(String.format("image/gif; charset=%s", MInformation.TEXT_ENCODING)),
+        HTML(String.format("text/html; charset=%s", MInformation.TEXT_ENCODING)),
+        JAVASCRIPT(String.format("application/x-javascript; charset=%s", MInformation.TEXT_ENCODING)),
+        JPEG(String.format("image/jpeg; charset=%s", MInformation.TEXT_ENCODING)),
+        PLAIN(String.format("text/plain; charset=%s", MInformation.TEXT_ENCODING)),
+        PNG(String.format("image/png; charset=%s", MInformation.TEXT_ENCODING)),
+        XHTML(String.format("application/xhtml+xml; charset=%s", MInformation.TEXT_ENCODING));
+        private String name = null;
+        private HttpContentType(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    /* Macaco information */
+
+    public static String getMacacoVersion() {
+        return MInformation.MACACO_VERSION;
+    }
+
+    public static String getMacacoFullName() {
+        return "Macaco " + MInformation.getMacacoVersion();
+    }
+
+    public static String getMacacoCopyrightInformation() {
+        StringBuilder s = new StringBuilder("");
+        s.append(MInformation.getMacacoFullName() + System.getProperty("line.separator"));
+        s.append("Copyright (c) 2009-2012 by Marco Zanon." + System.getProperty("line.separator"));
+        s.append("Released under the MIT license. See LICENSE for additional information." + System.getProperty("line.separator"));
+        s.append("Small portions inspired by other projects or web pages. See source code for additional information.");
+        s.append("Includes TinyMCE Wysiwyg editor (c) Moxiecode Systems AB. See http://tinymce.moxiecode.com for license and additional information.");
+        return s.toString();
+    }
+
+    /* Resources */
+
+    public static byte[] getCoreResource(String resource) throws IOException {
+        if (MText.isBlank(resource)) {
+            throw new IllegalArgumentException("Invalid 'resource': null or empty.");
+        }
+        // modified from http://articles.techrepublic.com.com/5100-10878_11-1046714.html
+        InputStream inputStream = new BufferedInputStream(MInformation.class.getClassLoader().getResourceAsStream(resource));
+        byte[] resourceContent = new byte[0];
+        try {
+            int bufferSize = 128*1024; // 128 kB
+            byte[] buffer = new byte[bufferSize];
+            byte[] tmp = null;
+            int b = 0;
+            while (-1 != (b = inputStream.read(buffer, 0, bufferSize))) {
+                // extend array
+                tmp = new byte[resourceContent.length + b];
+                // copy data
+                System.arraycopy(resourceContent, 0, tmp, 0, resourceContent.length);
+                System.arraycopy(buffer, 0, tmp, resourceContent.length, b);
+                resourceContent = tmp;
+                tmp = null;
+            }
+        }
+        finally {
+            if (null != inputStream) {
+                try {
+                    inputStream.close();
+                }
+                catch (Exception exception) { // should not happen
+                }
+            }
+        }
+        //
+        return resourceContent;
+    }
+
+    /* Exceptions */
+
+    public static String getExceptionAsString(Exception exception) {
+        if (null == exception) {
+            throw new IllegalArgumentException("Invalid 'exception': null.");
+        }
+        //
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        exception.printStackTrace(pw);
+        pw.flush();
+        sw.flush();
+        //
+        return sw.toString();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/MObject.java b/3.x/src/java/com/marcozanon/macaco/MObject.java
new file mode 100644 (file)
index 0000000..530c5b6
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco;
+
+public abstract class MObject {
+
+    /* */
+
+    protected MObject clone() {
+        throw new UnsupportedOperationException("Please provide manually by yourself.");
+    }
+
+    public String toString() {
+        throw new UnsupportedOperationException("Please use appropriate methods (if any).");
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/MRuntimeException.java b/3.x/src/java/com/marcozanon/macaco/MRuntimeException.java
new file mode 100644 (file)
index 0000000..1841175
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco;
+
+public abstract class MRuntimeException extends RuntimeException {
+
+    /* */
+
+    public MRuntimeException() {
+        super();
+    }
+
+    public MRuntimeException(String message) {
+        super(message);
+    }
+
+    public MRuntimeException(Throwable error) {
+        super(error);
+    }
+
+    public MRuntimeException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/configuration/MConfiguration.java b/3.x/src/java/com/marcozanon/macaco/configuration/MConfiguration.java
new file mode 100644 (file)
index 0000000..f012ea7
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.configuration;
+
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedHashMap;
+
+public class MConfiguration extends MObject {
+
+    protected LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
+
+    /* */
+
+    public MConfiguration(String file) throws MFileParsingConfigurationException {
+        super();
+        //
+        this.parseFile(file);
+    }
+
+    /* Parameters */
+
+    protected LinkedHashMap<String, String> getParametersReference() {
+        return this.parameters;
+    }
+
+    /* Strings management */
+
+    public void parseFile(String file) throws MFileParsingConfigurationException {
+        if (MText.isBlank(file)) {
+            throw new IllegalArgumentException("Invalid 'file': null or empty.");
+        }
+        //
+        LineNumberReader buffer = null;
+        try {
+            buffer = new LineNumberReader(new InputStreamReader(new FileInputStream(file), MInformation.TEXT_ENCODING));
+        }
+        catch (FileNotFoundException exception) {
+            throw new MFileParsingConfigurationException("Could not open file.", exception);
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+        String line = null;
+        synchronized (this.getParametersReference()) {
+            while (true) {
+                try {
+                    line = buffer.readLine();
+                }
+                catch (IOException exception) {
+                    throw new MFileParsingConfigurationException("Could not read file.", exception);
+                }
+                if (null == line) {
+                    break;
+                }
+                line = line.trim();
+                if ((line.startsWith("#")) || (line.startsWith(";")) || (MText.isEmpty(line))) {
+                    continue;
+                }
+                else {
+                    int a = line.indexOf("=");
+                    if (-1 == a) {
+                        throw new MFileParsingConfigurationException(String.format("Invalid line: %s: string malformed.", buffer.getLineNumber()));
+                    }
+                    String key = line.substring(0, a).trim();
+                    String value = line.substring(a + 1).trim();
+                    if (this.getParametersReference().containsKey(key)) {
+                        throw new MFileParsingConfigurationException(String.format("Invalid line: %s: duplicated key: %s.", buffer.getLineNumber(), key));
+                    }
+                    this.getParametersReference().put(key, value);
+                }
+            }
+        }
+        try {
+            buffer.close();
+        }
+        catch (IOException exception) {
+            throw new MFileParsingConfigurationException("Could not close file.", exception);
+        }
+    }
+
+    public void clear() {
+        synchronized (this.getParametersReference()) {
+            this.getParametersReference().clear();
+        }
+    }
+
+    public String getValue(String key) throws MValueNotFoundConfigurationException {
+        if (MText.isBlank(key)) {
+            throw new IllegalArgumentException("Invalid 'key': null or empty.");
+        }
+        //
+        if (!this.getParametersReference().containsKey(key)) {
+            throw new MValueNotFoundConfigurationException(String.format("Invalid 'key': %s: not available.", key));
+        }
+        return this.getParametersReference().get(key);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/configuration/MConfigurationException.java b/3.x/src/java/com/marcozanon/macaco/configuration/MConfigurationException.java
new file mode 100644 (file)
index 0000000..2335d50
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.configuration;
+
+import com.marcozanon.macaco.MException;
+
+public abstract class MConfigurationException extends MException {
+
+    /* */
+
+    public MConfigurationException() {
+        super();
+    }
+
+    public MConfigurationException(String message) {
+        super(message);
+    }
+
+    public MConfigurationException(Throwable error) {
+        super(error);
+    }
+
+    public MConfigurationException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/configuration/MFileParsingConfigurationException.java b/3.x/src/java/com/marcozanon/macaco/configuration/MFileParsingConfigurationException.java
new file mode 100644 (file)
index 0000000..b464314
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.configuration;
+
+@SuppressWarnings("serial")
+public class MFileParsingConfigurationException extends MConfigurationException {
+
+    /* */
+
+    public MFileParsingConfigurationException() {
+        super();
+    }
+
+    public MFileParsingConfigurationException(String message) {
+        super(message);
+    }
+
+    public MFileParsingConfigurationException(Throwable error) {
+        super(error);
+    }
+
+    public MFileParsingConfigurationException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/configuration/MValueNotFoundConfigurationException.java b/3.x/src/java/com/marcozanon/macaco/configuration/MValueNotFoundConfigurationException.java
new file mode 100644 (file)
index 0000000..05a13cd
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.configuration;
+
+@SuppressWarnings("serial")
+public class MValueNotFoundConfigurationException extends MConfigurationException {
+
+    /* */
+
+    public MValueNotFoundConfigurationException() {
+        super();
+    }
+
+    public MValueNotFoundConfigurationException(String message) {
+        super(message);
+    }
+
+    public MValueNotFoundConfigurationException(Throwable error) {
+        super(error);
+    }
+
+    public MValueNotFoundConfigurationException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/conversion/MConversionException.java b/3.x/src/java/com/marcozanon/macaco/conversion/MConversionException.java
new file mode 100644 (file)
index 0000000..e11f312
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.conversion;
+
+import com.marcozanon.macaco.MException;
+
+public abstract class MConversionException extends MException {
+
+    /* */
+
+    public MConversionException() {
+        super();
+    }
+
+    public MConversionException(String message) {
+        super(message);
+    }
+
+    public MConversionException(Throwable error) {
+        super(error);
+    }
+
+    public MConversionException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/conversion/MDateConverter.java b/3.x/src/java/com/marcozanon/macaco/conversion/MDateConverter.java
new file mode 100644 (file)
index 0000000..ceb748c
--- /dev/null
@@ -0,0 +1,246 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.conversion;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Locale;
+import java.util.TimeZone;
+
+public class MDateConverter extends MObject {
+
+    protected LinkedHashSet<String> dateFormats = new LinkedHashSet<String>();
+    protected Locale locale = null;
+    protected TimeZone timeZone = null;
+
+    /* */
+
+    public MDateConverter(String defaultDateFormat, Locale locale) {
+        this(defaultDateFormat, locale, TimeZone.getDefault());
+    }
+
+    public MDateConverter(String defaultDateFormat, Locale locale, TimeZone timeZone) {
+        super();
+        //
+        this.addDateFormat(defaultDateFormat);
+        this.setLocale(locale);
+        this.setTimeZone(timeZone);
+    }
+
+    public MDateConverter(LinkedHashSet<String> dateFormats, Locale locale, TimeZone timeZone) {
+        super();
+        //
+        this.setDateFormats(dateFormats);
+        this.setLocale(locale);
+        this.setTimeZone(timeZone);
+    }
+
+    public MDateConverter clone() {
+        return new MDateConverter(this.getDateFormats(), this.getLocale(), this.getTimeZone());
+    }
+
+    /* Date formats */
+
+    public void setDateFormats(LinkedHashSet<String> dateFormats) {
+        if (null == dateFormats) {
+            throw new IllegalArgumentException("Invalid 'dateFormats': null.");
+        }
+        else {
+            Iterator i = dateFormats.iterator();
+            while (i.hasNext()) {
+                MDateConverter.checkDateFormat((String)i.next());
+            }
+        }
+        //
+        synchronized (this.dateFormats) {
+            this.dateFormats = dateFormats;
+        }
+    }
+
+    public void addDateFormat(String dateFormat) {
+        MDateConverter.checkDateFormat(dateFormat);
+        //
+        synchronized (this.dateFormats) {
+            this.dateFormats.add(dateFormat);
+        }
+    }
+
+    protected LinkedHashSet<String> getDateFormatsReference() {
+        return this.dateFormats;
+    }
+
+    public LinkedHashSet<String> getDateFormats() {
+        LinkedHashSet<String> tmpDateFormats = new LinkedHashSet<String>();
+        Iterator i = this.getDateFormatsReference().iterator();
+        while (i.hasNext()) {
+            tmpDateFormats.add((String)i.next());
+        }
+        return tmpDateFormats;
+    }
+
+    public String getDefaultDateFormat() {
+        return this.getDateFormatsReference().iterator().next();
+    }
+
+    /* Locale */
+
+    protected void setLocale(Locale locale) {
+        if (null == locale) {
+            throw new IllegalArgumentException("Invalid 'locale': null.");
+        }
+        //
+        this.locale = locale;
+    }
+
+    public Locale getLocale() {
+        return this.locale;
+    }
+
+    /* Time zone */
+
+    protected void setTimeZone(TimeZone timeZone) {
+        if (null == timeZone) {
+            throw new IllegalArgumentException("Invalid 'timeZone': null.");
+        }
+        //
+        this.timeZone = timeZone;
+    }
+
+    protected TimeZone getTimeZoneReference() {
+        return this.timeZone;
+    }
+
+    public TimeZone getTimeZone() {
+        return (TimeZone)this.getTimeZoneReference().clone();
+    }
+
+    /* Conversion */
+
+    protected static void checkDateFormat(String dateFormat) {
+        if (MText.isBlank(dateFormat)) {
+            throw new IllegalArgumentException("Invalid 'dateFormat': null or empty.");
+        }
+        //
+        try {
+            SimpleDateFormat testDateFormat = new SimpleDateFormat(dateFormat);
+        }
+        catch (IllegalArgumentException exception) {
+            throw new IllegalArgumentException(String.format("Invalid 'dateFormat': %s.", dateFormat)); // no need to propagate exception
+        }
+    }
+
+    protected static Date getDateFromStringByParameters(String x, String inputDateFormat, Locale inputLocale, TimeZone inputTimeZone) throws MFormatConversionException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        MDateConverter.checkDateFormat(inputDateFormat);
+        if (null == inputLocale) {
+            throw new IllegalArgumentException("Invalid 'inputLocale': null.");
+        }
+        if (null == inputTimeZone) {
+            throw new IllegalArgumentException("Invalid 'inputTimeZone': null.");
+        }
+        //
+        Calendar c1 = Calendar.getInstance(inputTimeZone, inputLocale);
+        c1.clear();
+        c1.setLenient(false);
+        SimpleDateFormat sdf = new SimpleDateFormat(inputDateFormat, inputLocale);
+        sdf.setCalendar(c1);
+        Date d1 = null;
+        try {
+            d1 = sdf.parse(x);
+        }
+        catch (ParseException exception) {
+            throw new MFormatConversionException(String.format("Invalid 'x' or parsing: %s (input format: %s).", x, inputDateFormat)); // no need to propagate exception
+        }
+        Calendar c2 = Calendar.getInstance(inputTimeZone, inputLocale);
+        c2.clear();
+        c2.set(Calendar.YEAR, c1.get(Calendar.YEAR));
+        c2.set(Calendar.MONTH, c1.get(Calendar.MONTH));
+        c2.set(Calendar.DAY_OF_MONTH, c1.get(Calendar.DAY_OF_MONTH));
+        Date d2 = c2.getTime();
+        if (!x.equals(sdf.format(d2))) {
+            throw new MFormatConversionException(String.format("Invalid 'x' or parsing: %s (input format: %s).", x, inputDateFormat));
+        }
+        return d2;
+    }
+
+    protected static String getStringFromDateByParameters(Date date, String outputDateFormat, Locale outputLocale, TimeZone outputTimeZone) {
+        if (null == date) {
+            throw new IllegalArgumentException("Invalid 'date': null.");
+        }
+        MDateConverter.checkDateFormat(outputDateFormat);
+        if (null == outputLocale) {
+            throw new IllegalArgumentException("Invalid 'outputLocale': null.");
+        }
+        if (null == outputTimeZone) {
+            throw new IllegalArgumentException("Invalid 'outputTimeZone': null.");
+        }
+        //
+        SimpleDateFormat sdf = new SimpleDateFormat(outputDateFormat, outputLocale);
+        sdf.setCalendar(Calendar.getInstance(outputTimeZone, outputLocale));
+        return sdf.format(date);
+    }
+
+    public Date getDateFromString(String x) throws MFormatConversionException {
+        Date y = null;
+        for (String dateFormat: this.getDateFormatsReference()) {
+            try {
+                y = this.getDateFromStringByParameters(x, dateFormat, this.getLocale(), this.getTimeZoneReference());
+                return y;
+            }
+            catch (MFormatConversionException exception) {
+            }
+        }
+        if (null == y) {
+            throw new MFormatConversionException(String.format("Invalid 'x': %s.", x));
+        }
+        return y; // necessary to avoid Java compilation errors
+    }
+
+    public String getStringFromDate(Date x) {
+        return this.getStringFromDateByParameters(x, this.getDefaultDateFormat(), this.getLocale(), this.getTimeZoneReference());
+    }
+
+    /* Helper methods */
+
+    public static Date getFlatDate(Date x) {
+        if (null == x) {
+            return x;
+        }
+        //
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(x);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+
+    public static Date getCeilDate(Date x) {
+        if (null == x) {
+            return x;
+        }
+        //
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(x);
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+        calendar.set(Calendar.MILLISECOND, 999);
+        return calendar.getTime();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/conversion/MFormatConversionException.java b/3.x/src/java/com/marcozanon/macaco/conversion/MFormatConversionException.java
new file mode 100644 (file)
index 0000000..c4590ce
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.conversion;
+
+@SuppressWarnings("serial")
+public class MFormatConversionException extends MConversionException {
+
+    /* */
+
+    public MFormatConversionException() {
+        super();
+    }
+
+    public MFormatConversionException(String message) {
+        super(message);
+    }
+
+    public MFormatConversionException(Throwable error) {
+        super(error);
+    }
+
+    public MFormatConversionException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/conversion/MNumberConverter.java b/3.x/src/java/com/marcozanon/macaco/conversion/MNumberConverter.java
new file mode 100644 (file)
index 0000000..7200cc6
--- /dev/null
@@ -0,0 +1,170 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.conversion;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.ParsePosition;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Locale;
+
+public class MNumberConverter extends MObject {
+
+    protected LinkedHashSet<String> numberFormats = new LinkedHashSet<String>();
+    protected Locale locale = null;
+
+    /* */
+
+    public MNumberConverter(String defaultNumberFormat, Locale locale) {
+        super();
+        //
+        this.addNumberFormat(defaultNumberFormat);
+        this.setLocale(locale);
+    }
+
+    public MNumberConverter(LinkedHashSet<String> numberFormats, Locale locale) {
+        super();
+        //
+        this.setNumberFormats(numberFormats);
+        this.setLocale(locale);
+    }
+
+    public MNumberConverter clone() {
+        return new MNumberConverter(this.getNumberFormats(), this.getLocale());
+    }
+
+    /* Number formats */
+
+    public void setNumberFormats(LinkedHashSet<String> numberFormats) {
+        if (null == numberFormats) {
+            throw new IllegalArgumentException("Invalid 'numberFormats': null.");
+        }
+        else {
+            Iterator i = numberFormats.iterator();
+            while (i.hasNext()) {
+                MNumberConverter.checkNumberFormat((String)i.next());
+            }
+        }
+        //
+        synchronized (this.numberFormats) {
+            this.numberFormats = numberFormats;
+        }
+    }
+
+    public void addNumberFormat(String numberFormat) {
+        MNumberConverter.checkNumberFormat(numberFormat);
+        //
+        synchronized (this.numberFormats) {
+            this.numberFormats.add(numberFormat);
+        }
+    }
+
+    protected LinkedHashSet<String> getNumberFormatsReference() {
+        return this.numberFormats;
+    }
+
+    public LinkedHashSet<String> getNumberFormats() {
+        LinkedHashSet<String> tmpNumberFormats = new LinkedHashSet<String>();
+        Iterator i = this.getNumberFormatsReference().iterator();
+        while (i.hasNext()) {
+            tmpNumberFormats.add((String)i.next());
+        }
+        return tmpNumberFormats;
+    }
+
+    public String getDefaultNumberFormat() {
+        return this.getNumberFormatsReference().iterator().next();
+    }
+
+    /* Locale */
+
+    protected void setLocale(Locale locale) {
+        if (null == locale) {
+            throw new IllegalArgumentException("Invalid 'locale': null.");
+        }
+        //
+        this.locale = locale;
+    }
+
+    public Locale getLocale() {
+        return this.locale;
+    }
+
+    /* Conversion */
+
+    protected static void checkNumberFormat(String numberFormat) {
+        if (MText.isBlank(numberFormat)) {
+            throw new IllegalArgumentException("Invalid 'numberFormat': null or empty.");
+        }
+        //
+        try {
+            DecimalFormat testNumberFormat = new DecimalFormat(numberFormat);
+        }
+        catch (IllegalArgumentException exception) {
+            throw new IllegalArgumentException(String.format("Invalid 'numberFormat': %s.", numberFormat)); // no need to propagate exception
+        }
+    }
+
+    protected static BigDecimal getNumberFromStringByParameters(String x, String inputNumberFormat, Locale inputLocale) throws MFormatConversionException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        MNumberConverter.checkNumberFormat(inputNumberFormat);
+        if (null == inputLocale) {
+            throw new IllegalArgumentException("Invalid 'inputLocale': null.");
+        }
+        //
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(inputLocale);
+        DecimalFormat df = new DecimalFormat(inputNumberFormat, dfs);
+        df.setParseBigDecimal(true);
+        ParsePosition validPosition = new ParsePosition(0);
+        BigDecimal bd = (BigDecimal)df.parse(x, validPosition);
+        if (validPosition.getIndex() < x.length()) {
+            throw new MFormatConversionException(String.format("Invalid 'x' or parsing: %s (input format: %s).", x, inputNumberFormat));
+        }
+        return bd;
+    }
+
+    protected static String getStringFromNumberByParameters(BigDecimal number, String outputNumberFormat, Locale outputLocale) {
+        if (null == number) {
+            throw new IllegalArgumentException("Invalid 'number': null.");
+        }
+        MNumberConverter.checkNumberFormat(outputNumberFormat);
+        if (null == outputLocale) {
+            throw new IllegalArgumentException("Invalid 'outputLocale': null.");
+        }
+        //
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(outputLocale);
+        DecimalFormat df = new DecimalFormat(outputNumberFormat, dfs);
+        return df.format(number);
+    }
+
+    public BigDecimal getNumberFromString(String x) throws MFormatConversionException {
+        BigDecimal y = null;
+        for (String numberFormat: this.getNumberFormatsReference()) {
+            try {
+                y = this.getNumberFromStringByParameters(x, numberFormat, this.getLocale());
+                return y;
+            }
+            catch (MFormatConversionException exception) {
+            }
+        }
+        if (null == y) {
+            throw new MFormatConversionException(String.format("Invalid 'x': %s.", x));
+        }
+        return y; // necessary to avoid Java compilation errors
+    }
+
+    public String getStringFromNumber(BigDecimal x) {
+        return this.getStringFromNumberByParameters(x, this.getDefaultNumberFormat(), this.getLocale());
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MInvalidValueJsonException.java b/3.x/src/java/com/marcozanon/macaco/json/MInvalidValueJsonException.java
new file mode 100644 (file)
index 0000000..d04af90
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+@SuppressWarnings("serial")
+public class MInvalidValueJsonException extends MJsonException {
+
+    /* */
+
+    public MInvalidValueJsonException() {
+        super();
+    }
+
+    public MInvalidValueJsonException(String message) {
+        super(message);
+    }
+
+    public MInvalidValueJsonException(Throwable error) {
+        super(error);
+    }
+
+    public MInvalidValueJsonException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonArray.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonArray.java
new file mode 100644 (file)
index 0000000..8c1cc88
--- /dev/null
@@ -0,0 +1,208 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedList;
+
+public class MJsonArray extends MJsonValue {
+
+    protected static enum ParsingMode {
+        START,
+        POST_VALUE,
+        POST_VALUE_SEPARATOR,
+        ERROR
+    };
+
+    protected LinkedList<MJsonValue> values = new LinkedList<MJsonValue>();
+
+    /* */
+
+    public MJsonArray() throws MInvalidValueJsonException {
+        this("[]");
+    }
+
+    public MJsonArray(String x) throws MInvalidValueJsonException {
+        super();
+        //
+        this.parseString(x);
+    }
+
+    public MJsonArray clone() {
+        MJsonArray tmpMJsonArray = null;
+        try {
+            tmpMJsonArray = new MJsonArray(this.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        return tmpMJsonArray;
+    }
+
+    /* Values handlers */
+
+    public void addValue(MJsonValue x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        this.getValuesReference().add(x);
+    }
+
+    public void setValue(int index, MJsonValue x) {
+        if ((0 > index) || ((this.getValueCount() - 1) < index)) {
+            throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
+        }
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        this.getValuesReference().set(index, x);
+    }
+
+    protected LinkedList<MJsonValue> getValuesReference() {
+        return this.values;
+    }
+
+    public MJsonValue getValue(int index) {
+        if ((0 > index) || ((this.getValueCount() - 1) < index)) {
+            throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
+        }
+        //
+        return this.getValuesReference().get(index).clone();
+    }
+
+    public int getValueCount() {
+        return this.getValuesReference().size();
+    }
+
+    public void removeValue(int index) {
+        if ((0 > index) || ((this.getValueCount() - 1) < index)) {
+            throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
+        }
+        //
+        this.getValuesReference().remove(index);
+    }
+
+    public void clearValues() {
+        this.getValuesReference().clear();
+    }
+
+    /* Parsers */
+
+    protected static int getTokenLength(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        if ((2 > x.length()) || ('[' != x.charAt(0))) {
+            return 0;
+        }
+        int position = x.indexOf("]", 1);
+        while (-1 < position) {
+            try {
+                MJsonArray testValue = new MJsonArray();
+                testValue.parseString(x.substring(0, position + 1));
+                return position + 1;
+            }
+            catch (MInvalidValueJsonException exception) {
+                position = x.indexOf("]", position + 1);
+            }
+        }
+        return 0;
+    }
+
+    public void parseString(String x) throws MInvalidValueJsonException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        //
+        if ((2 > x.length()) || ('[' != x.charAt(0)) || (']' != x.charAt(x.length() - 1))) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: must begin and end with square brackets.", x));
+        }
+        String y = x.substring(1, x.length() - 1);
+        int parsingPosition = 0;
+        MJsonArray.ParsingMode parsingMode = MJsonArray.ParsingMode.START;
+        while ((y.length() > parsingPosition) && (MJsonArray.ParsingMode.ERROR != parsingMode)) {
+            int c = y.codePointAt(parsingPosition);
+            switch (parsingMode) {
+                case START:
+                case POST_VALUE_SEPARATOR: // a value is expected
+                    if (MJsonValue.isWhitespace(c)) {
+                        parsingPosition++;
+                    }
+                    else if ((MJsonValue.isValueSeparator(c)) || (MJsonValue.isNameSeparator(c)) || (MJsonValue.isClosingStructuralCharacter(c))) {
+                        parsingMode = MJsonArray.ParsingMode.ERROR;
+                    }
+                    else {
+                        int offset = 0;
+                        if (0 < (offset = MJsonNull.getTokenLength(y.substring(parsingPosition)))) {
+                            this.addValue(new MJsonNull(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonBoolean.getTokenLength(y.substring(parsingPosition)))) {
+                            this.addValue(new MJsonBoolean(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonNumber.getTokenLength(y.substring(parsingPosition)))) {
+                            this.addValue(new MJsonNumber(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonString.getTokenLength(y.substring(parsingPosition)))) {
+                            this.addValue(new MJsonString(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonArray.getTokenLength(y.substring(parsingPosition)))) {
+                            this.addValue(new MJsonArray(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonObject.getTokenLength(y.substring(parsingPosition)))) {
+                            this.addValue(new MJsonObject(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        if (0 < offset) {
+                            parsingPosition += offset;
+                            parsingMode = MJsonArray.ParsingMode.POST_VALUE;
+                        }
+                        else {
+                            parsingMode = MJsonArray.ParsingMode.ERROR;
+                        }
+                    }
+                    break;
+                case POST_VALUE:
+                    if (MJsonValue.isWhitespace(c)) {
+                        parsingPosition++;
+                    }
+                    else if (MJsonValue.isValueSeparator(c)) {
+                        parsingPosition++;
+                        parsingMode = MJsonArray.ParsingMode.POST_VALUE_SEPARATOR;
+                    }
+                    else {
+                        parsingMode = MJsonArray.ParsingMode.ERROR;
+                    }
+                    break;
+                case ERROR: // malformed string
+                    break;
+            }
+        }
+        if (MJsonArray.ParsingMode.POST_VALUE_SEPARATOR == parsingMode) {
+            parsingMode = MJsonArray.ParsingMode.ERROR;
+        }
+        if (MJsonArray.ParsingMode.ERROR == parsingMode) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json array.", x));
+        }
+    }
+
+    /* Formatter */
+
+    public String getJsonValue() {
+        StringBuilder s = new StringBuilder("");
+        s.append("[");
+        for (int i = 0; this.getValueCount() > i; i++) {
+            if (0 < i) {
+                s.append(", ");
+            }
+            s.append(this.getValuesReference().get(i).getJsonValue());
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonBoolean.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonBoolean.java
new file mode 100644 (file)
index 0000000..ca288fb
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MJsonBoolean extends MJsonValue {
+
+    protected Boolean value = null;
+
+    /* */
+
+    public MJsonBoolean() throws MInvalidValueJsonException {
+        this("false");
+    }
+
+    public MJsonBoolean(String x) throws MInvalidValueJsonException {
+        super();
+        //
+        this.parseString(x);
+    }
+
+    public MJsonBoolean clone() {
+        MJsonBoolean tmpMJsonBoolean = null;
+        try {
+            tmpMJsonBoolean = new MJsonBoolean(this.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        return tmpMJsonBoolean;
+    }
+
+    /* Value handlers */
+
+    public void setValue(Boolean x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        this.value = x;
+    }
+
+    public Boolean getValue() {
+        return this.value;
+    }
+
+    /* Parsers */
+
+    protected static int getTokenLength(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        if (x.startsWith("true")) {
+            return "true".length();
+        }
+        else if (x.startsWith("false")) {
+            return "false".length();
+        }
+        return 0;
+    }
+
+    public void parseString(String x) throws MInvalidValueJsonException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        //
+        if ((!"true".equals(x)) && (!"false".equals(x))) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json boolean.", x));
+        }
+        this.setValue(Boolean.valueOf(x));
+    }
+
+    /* Formatter */
+
+    public String getJsonValue() {
+        return this.getValue().toString();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonException.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonException.java
new file mode 100644 (file)
index 0000000..4cff4ba
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.MException;
+
+public abstract class MJsonException extends MException {
+
+    /* */
+
+    public MJsonException() {
+        super();
+    }
+
+    public MJsonException(String message) {
+        super(message);
+    }
+
+    public MJsonException(Throwable error) {
+        super(error);
+    }
+
+    public MJsonException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonNull.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonNull.java
new file mode 100644 (file)
index 0000000..af6d549
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MJsonNull extends MJsonValue {
+
+    /* */
+
+    public MJsonNull() throws MInvalidValueJsonException {
+        this("null");
+    }
+
+    public MJsonNull(String x) throws MInvalidValueJsonException {
+        super();
+        //
+        this.parseString(x);
+    }
+
+    public MJsonNull clone() {
+        MJsonNull tmpMJsonNull = null;
+        try {
+            tmpMJsonNull = new MJsonNull(this.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        return tmpMJsonNull;
+    }
+
+    /* Parsers */
+
+    protected static int getTokenLength(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        if (x.startsWith("null")) {
+            return "null".length();
+        }
+        return 0;
+    }
+
+    public void parseString(String x) throws MInvalidValueJsonException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        //
+        if (!"null".equals(x)) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json null.", x));
+        }
+    }
+
+    /* Formatter */
+
+    public String getJsonValue() {
+        return "null";
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonNumber.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonNumber.java
new file mode 100644 (file)
index 0000000..401be4e
--- /dev/null
@@ -0,0 +1,104 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.text.MText;
+import java.math.BigDecimal;
+
+public class MJsonNumber extends MJsonValue {
+
+    protected BigDecimal value = null;
+
+    /* */
+
+    public MJsonNumber() throws MInvalidValueJsonException {
+        this("0");
+    }
+
+    public MJsonNumber(String x) throws MInvalidValueJsonException {
+        super();
+        //
+        this.parseString(x);
+    }
+
+    public MJsonNumber clone() {
+        MJsonNumber tmpMJsonNumber = null;
+        try {
+            tmpMJsonNumber = new MJsonNumber(this.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        return tmpMJsonNumber;
+    }
+
+    /* Value handlers */
+
+    public void setValue(Number x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        this.value = new BigDecimal(x.toString());
+    }
+
+    public BigDecimal getValue() {
+        return this.value;
+    }
+
+    /* Parsers */
+
+    protected static int getTokenLength(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        if (' ' == x.charAt(0)) {
+            return 0;
+        }
+        int position = 0;
+        int validPosition = 0;
+        BigDecimal y = null;
+        while (x.length() > position) {
+            if (' ' == x.charAt(position)) {
+                break;
+            }
+            else {
+                try {
+                    y = new BigDecimal(x.substring(0, position + 1));
+                    position++;
+                    validPosition = position;
+                }
+                catch (NumberFormatException exception) {
+                    position++;
+                }
+            }
+        }
+        return validPosition;
+    }
+
+    public void parseString(String x) throws MInvalidValueJsonException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        //
+        BigDecimal y = null;
+        try {
+            y = new BigDecimal(x);
+        }
+        catch (NumberFormatException exception) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json number.", x)); // no need to propagate exception
+        }
+        this.setValue(y);
+    }
+
+    /* Formatter */
+
+    public String getJsonValue() {
+        return this.getValue().toString();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonObject.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonObject.java
new file mode 100644 (file)
index 0000000..a64056c
--- /dev/null
@@ -0,0 +1,262 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+
+public class MJsonObject extends MJsonValue {
+
+    protected static enum ParsingMode {
+        START,
+        POST_NAME,
+        POST_NAME_SEPARATOR,
+        POST_VALUE,
+        POST_VALUE_SEPARATOR,
+        ERROR
+    };
+
+    protected LinkedHashMap<String, MJsonValue> values = new LinkedHashMap<String, MJsonValue>();
+
+    /* */
+
+    public MJsonObject() throws MInvalidValueJsonException {
+        this("{}");
+    }
+
+    public MJsonObject(String x) throws MInvalidValueJsonException {
+        super();
+        //
+        this.parseString(x);
+    }
+
+    public MJsonObject clone() {
+        MJsonObject tmpMJsonObject = null;
+        try {
+            tmpMJsonObject = new MJsonObject(this.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        return tmpMJsonObject;
+    }
+
+    /* Values handlers */
+
+    public void setValue(String key, MJsonValue x) {
+        if (MText.isBlank(key)) {
+            throw new IllegalArgumentException("Invalid 'key': null or empty.");
+        }
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        this.getValuesReference().put(key, x);
+    }
+
+    protected LinkedHashMap<String, MJsonValue> getValuesReference() {
+        return this.values;
+    }
+
+    public MJsonValue getValue(String key) {
+        if (MText.isBlank(key)) {
+            throw new IllegalArgumentException("Invalid 'key': null or empty.");
+        }
+        //
+        if (!this.containsKey(key)) {
+            throw new IllegalArgumentException(String.format("Invalid 'key': %s: not available.", key));
+        }
+        return this.getValuesReference().get(key).clone();
+    }
+
+    public int getValueCount() {
+        return this.getValuesReference().size();
+    }
+
+    public void removeValue(String key) {
+        if (MText.isBlank(key)) {
+            throw new IllegalArgumentException("Invalid 'key': null or empty.");
+        }
+        //
+        if (!this.containsKey(key)) {
+            throw new IllegalArgumentException(String.format("Invalid 'key': %s: not available.", key));
+        }
+        this.getValuesReference().remove(key);
+    }
+
+    public void clearValues() {
+        this.getValuesReference().clear();
+    }
+
+    public boolean containsKey(String key) {
+        if (MText.isBlank(key)) {
+            throw new IllegalArgumentException("Invalid 'key': null or empty.");
+        }
+        //
+        return this.getValuesReference().containsKey(key);
+    }
+
+    public LinkedHashSet<String> getKeys() {
+        LinkedHashSet<String> keys = new LinkedHashSet<String>();
+        for (String key: this.getValuesReference().keySet()) {
+            keys.add(key);
+        }
+        return keys;
+    }
+
+    /* Parsers */
+
+    protected static int getTokenLength(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        if ((2 > x.length()) || ('{' != x.charAt(0))) {
+            return 0;
+        }
+        int position = x.indexOf("}", 1);
+        while (-1 < position) {
+            try {
+                MJsonObject testValue = new MJsonObject();
+                testValue.parseString(x.substring(0, position + 1));
+                return position + 1;
+            }
+            catch (MInvalidValueJsonException exception) {
+                position = x.indexOf("}", position + 1);
+            }
+        }
+        return 0;
+    }
+
+    public void parseString(String x) throws MInvalidValueJsonException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        //
+        if ((2 > x.length()) || ('{' != x.charAt(0)) || ('}' != x.charAt(x.length() - 1))) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: must begin and end with curly brackets.", x));
+        }
+        String y = x.substring(1, x.length() - 1);
+        int parsingPosition = 0;
+        MJsonObject.ParsingMode parsingMode = MJsonObject.ParsingMode.START;
+        String lastKey = "";
+        while ((y.length() > parsingPosition) && (MJsonObject.ParsingMode.ERROR != parsingMode)) {
+            int c = y.codePointAt(parsingPosition);
+            switch (parsingMode) {
+                case START:
+                case POST_VALUE_SEPARATOR: // a name is expected
+                    if (MJsonValue.isWhitespace(c)) {
+                        parsingPosition++;
+                    }
+                    else if ((MJsonValue.isValueSeparator(c)) || (MJsonValue.isNameSeparator(c)) || (MJsonValue.isOpeningStructuralCharacter(c)) || (MJsonValue.isClosingStructuralCharacter(c))) {
+                        parsingMode = MJsonObject.ParsingMode.ERROR;
+                    }
+                    else {
+                        int offset = MJsonString.getTokenLength(y.substring(parsingPosition));
+                        if (0 < offset) {
+                            lastKey = (new MJsonString(y.substring(parsingPosition, parsingPosition + offset))).getValue();
+                            parsingPosition += offset;
+                            parsingMode = MJsonObject.ParsingMode.POST_NAME;
+                        }
+                        else {
+                            parsingMode = MJsonObject.ParsingMode.ERROR;
+                        }
+                    }
+                    break;
+                case POST_NAME:
+                    if (MJsonValue.isWhitespace(c)) {
+                        parsingPosition++;
+                    }
+                    else if (MJsonValue.isNameSeparator(c)) {
+                        parsingPosition++;
+                        parsingMode = MJsonObject.ParsingMode.POST_NAME_SEPARATOR;
+                    }
+                    else {
+                        parsingMode = MJsonObject.ParsingMode.ERROR;
+                    }
+                    break;
+                case POST_NAME_SEPARATOR: // a value is expected
+                    if (MJsonValue.isWhitespace(c)) {
+                        parsingPosition++;
+                    }
+                    else if ((MJsonValue.isValueSeparator(c)) || (MJsonValue.isNameSeparator(c)) || (MJsonValue.isClosingStructuralCharacter(c))) {
+                        parsingMode = MJsonObject.ParsingMode.ERROR;
+                    }
+                    else {
+                        int offset = 0;
+                        if (0 < (offset = MJsonNull.getTokenLength(y.substring(parsingPosition)))) {
+                            this.setValue(lastKey, new MJsonNull(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonBoolean.getTokenLength(y.substring(parsingPosition)))) {
+                            this.setValue(lastKey, new MJsonBoolean(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonNumber.getTokenLength(y.substring(parsingPosition)))) {
+                            this.setValue(lastKey, new MJsonNumber(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonString.getTokenLength(y.substring(parsingPosition)))) {
+                            this.setValue(lastKey, new MJsonString(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonArray.getTokenLength(y.substring(parsingPosition)))) {
+                            this.setValue(lastKey, new MJsonArray(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        else if (0 < (offset = MJsonObject.getTokenLength(y.substring(parsingPosition)))) {
+                            this.setValue(lastKey, new MJsonObject(y.substring(parsingPosition, parsingPosition + offset)));
+                        }
+                        if (0 < offset) {
+                            lastKey = "";
+                            parsingPosition += offset;
+                            parsingMode = MJsonObject.ParsingMode.POST_VALUE;
+                        }
+                        else {
+                            parsingMode = MJsonObject.ParsingMode.ERROR;
+                        }
+                    }
+                    break;
+                case POST_VALUE:
+                    if (MJsonValue.isWhitespace(c)) {
+                        parsingPosition++;
+                    }
+                    else if (MJsonValue.isValueSeparator(c)) {
+                        parsingPosition++;
+                        parsingMode = MJsonObject.ParsingMode.POST_VALUE_SEPARATOR;
+                    }
+                    else {
+                        parsingMode = MJsonObject.ParsingMode.ERROR;
+                    }
+                    break;
+                case ERROR: // malformed string
+                    break;
+            }
+        }
+        if ((MJsonObject.ParsingMode.POST_NAME == parsingMode) || (MJsonObject.ParsingMode.POST_NAME_SEPARATOR == parsingMode) || (MJsonObject.ParsingMode.POST_VALUE_SEPARATOR == parsingMode)) {
+            parsingMode = MJsonObject.ParsingMode.ERROR;
+        }
+        if (MJsonObject.ParsingMode.ERROR == parsingMode) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json object.", x));
+        }
+    }
+
+    /* Formatter */
+
+    public String getJsonValue() {
+        StringBuilder s = new StringBuilder("");
+        s.append("{");
+        int k = 0;
+        for (String key: this.getValuesReference().keySet()) {
+            if (0 < k) {
+                s.append(", ");
+            }
+            s.append("\"" + MJsonString.getEscapedString(key, false) + "\"");
+            s.append(": ");
+            s.append(this.getValuesReference().get(key).getJsonValue());
+            k++;
+        }
+        s.append("}");
+        return s.toString();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonString.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonString.java
new file mode 100644 (file)
index 0000000..2269530
--- /dev/null
@@ -0,0 +1,292 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MJsonString extends MJsonValue {
+
+    protected boolean extendedEscapeMode = false;
+
+    protected String value = null;
+
+    /* */
+
+    public MJsonString() throws MInvalidValueJsonException {
+        this("\"\"");
+    }
+
+    public MJsonString(String x) throws MInvalidValueJsonException {
+        this(x, false);
+    }
+
+    public MJsonString(String x, boolean extendedEscapeMode) throws MInvalidValueJsonException {
+        super();
+        //
+        this.setExtendedEscapeMode(extendedEscapeMode);
+        this.parseString(x);
+    }
+
+    public MJsonString clone() {
+        MJsonString tmpMJsonString = null;
+        try {
+            tmpMJsonString = new MJsonString(this.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        return tmpMJsonString;
+    }
+
+    /* Extended escape mode */
+
+    public void setExtendedEscapeMode(boolean extendedEscapeMode) {
+        this.extendedEscapeMode = extendedEscapeMode;
+    }
+
+    public boolean getExtendedEscapeMode() {
+        return this.extendedEscapeMode;
+    }
+
+    /* Value handlers */
+
+    public void setValue(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        this.value = x;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+
+    /* Helpers */
+
+    protected static String getEscapedString(String x, boolean extendedEscapeMode) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        StringBuilder y = new StringBuilder();
+        for (int i = 0; x.length() > i; i++) {
+            int c = x.codePointAt(i);
+            if (extendedEscapeMode) {
+                if (0x00001F >= c) { // control Ascii character (0x000000-0x00001F)
+                    y.append("\\u" + String.format("%4H", c).replace(" ", "0"));
+                }
+                else if (0x00007F >= c) { // non-control Ascii character (0x000020-0x00007F)
+                    if ('"' == c) {
+                        y.append("\\\"");
+                    }
+                    else if ('\\' == c) {
+                        y.append("\\\\");
+                    }
+                    else if ('/' == c) {
+                        y.append("\\/");
+                    }
+                    else {
+                        y.appendCodePoint(c);
+                    }
+                }
+                else if (0x00FFFF >= c) { // non-Ascii Bmp character (0x000080-0x00FFFF)
+                    y.append("\\u" + String.format("%4H", c).replace(" ", "0"));
+                }
+                else { // non-Bmp character (0x010000-0x10FFFF)
+                    int cc = c - 0x010000;
+                    int ch = 0xD800 + (cc >> 10);
+                    int cl = 0xDC00 + (cc & 0x03FF);
+                    y.append("\\u" + String.format("%4H", ch).replace(" ", "0") + "\\u" + String.format("%4H", cl).replace(" ", "0"));
+                    i++;
+                }
+            }
+            else {
+                if ('"' == c) {
+                    y.append("\\\"");
+                }
+                else if ('\\' == c) {
+                    y.append("\\\\");
+                }
+                else if ('/' == c) {
+                    y.append("\\/");
+                }
+                else if ('\b' == c) {
+                    y.append("\\b");
+                }
+                else if ('\f' == c) {
+                    y.append("\\f");
+                }
+                else if ('\n' == c) {
+                    y.append("\\n");
+                }
+                else if ('\r' == c) {
+                    y.append("\\r");
+                }
+                else if ('\t' == c) {
+                    y.append("\\t");
+                }
+                else if (0x00001F >= c) { // non-special control Ascii character (0x000000-0x00001F)
+                    y.append("\\u" + String.format("%4H", c).replace(" ", "0"));
+                }
+                else {
+                    y.appendCodePoint(c);
+                    if (0x010000 <= c) {
+                        i++;
+                    }
+                }
+            }
+        }
+        return y.toString();
+    }
+
+    protected static String getUnescapedString(String x) throws MInvalidValueJsonException {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        StringBuilder y = new StringBuilder();
+        for (int i = 0; x.length() > i; i++) {
+            if (x.indexOf("\\\"", i) == i) {
+                y.append("\"");
+                i++;
+            }
+            else if (x.indexOf("\\\\", i) == i) {
+                y.append("\\");
+                i++;
+            }
+            else if (x.indexOf("\\/", i) == i) {
+                y.append("/");
+                i++;
+            }
+            else if (x.indexOf("\\b", i) == i) {
+                y.append("\b");
+                i++;
+            }
+            else if (x.indexOf("\\f", i) == i) {
+                y.append("\f");
+                i++;
+            }
+            else if (x.indexOf("\\n", i) == i) {
+                y.append("\n");
+                i++;
+            }
+            else if (x.indexOf("\\r", i) == i) {
+                y.append("\r");
+                i++;
+            }
+            else if (x.indexOf("\\t", i) == i) {
+                y.append("\t");
+                i++;
+            }
+            else if (x.indexOf("\\u", i) == i) {
+                if ((i + 2 + 4) > x.length()) {
+                    throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
+                }
+                else {
+                    int ch = -1;
+                    try {
+                        ch = Integer.parseInt(x.substring(i + 2, i + 2 + 4), 16);
+                        i += 5;
+                        if ((0xD800 <= ch) && (0xDBFF >= ch)) {
+                            i++;
+                            if (x.indexOf("\\u", i) != i) {
+                                throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
+                            }
+                            else if ((i + 2 + 4) > x.length()) {
+                                throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
+                            }
+                            else {
+                                int cl = -1;
+                                try {
+                                    cl = Integer.parseInt(x.substring(i + 2, i + 2 + 4), 16);
+                                    i += 5;
+                                    if ((0xDC00 >= cl) || (0xDFFF <= cl)) {
+                                        throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
+                                    }
+                                    int c = ((ch - 0xD800) << 10) + (cl - 0xDC00) + 0x010000;
+                                    y.appendCodePoint(c);
+                                }
+                                catch (NumberFormatException exception) {
+                                    throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x)); // no need to propagate exception
+                                }
+                            }
+                        }
+                        else {
+                            y.appendCodePoint(ch);
+                        }
+                    }
+                    catch (NumberFormatException exception) {
+                        throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x)); // no need to propagate exception
+                    }
+                }
+            }
+            else {
+                int c = x.codePointAt(i);
+                if (0x010000 <= c) {
+                    i++;
+                }
+                y.appendCodePoint(c);
+            }
+        }
+        return y.toString();
+    }
+
+    /* Parsers */
+
+    protected static int getTokenLength(String x) {
+        if (null == x) {
+            throw new IllegalArgumentException("Invalid 'x': null.");
+        }
+        //
+        if ((2 > x.length()) || ('"' != x.charAt(0))) {
+            return 0;
+        }
+        if ('"' == x.charAt(1)) {
+            return 1 + 1;
+        }
+        String y = x.substring(1);
+        int quotationMarkPosition = 0;
+        while (-1 < (quotationMarkPosition = y.indexOf("\"", quotationMarkPosition + 1))) {
+            int c = 0;
+            StringBuilder s = new StringBuilder("");
+            while ((c <= quotationMarkPosition) && (y.substring(quotationMarkPosition - c, quotationMarkPosition).equals(s.toString()))) {
+                c++;
+                s.append("\\");
+            }
+            c--;
+            if (0 == (c % 2)) {
+                break;
+            }
+        }
+        if (-1 == quotationMarkPosition) {
+            return 0;
+        }
+        return (quotationMarkPosition + 1) + 1;
+    }
+
+    public void parseString(String x) throws MInvalidValueJsonException {
+        if (MText.isBlank(x)) {
+            throw new IllegalArgumentException("Invalid 'x': null or empty.");
+        }
+        //
+        if ((2 > x.length()) || ('"' != x.charAt(0)) || ('"' != x.charAt(x.length() - 1))) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
+        }
+        String y = x.substring(1, x.length() - 1);
+        if (-1 < y.replaceAll("\\\\\"", "__").indexOf("\"")) {
+            throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
+        }
+        this.setValue(MJsonString.getUnescapedString(y));
+    }
+
+    /* Formatter */
+
+    public String getJsonValue() {
+        return "\"" + MJsonString.getEscapedString(this.getValue(), this.getExtendedEscapeMode()) + "\"";
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/json/MJsonValue.java b/3.x/src/java/com/marcozanon/macaco/json/MJsonValue.java
new file mode 100644 (file)
index 0000000..bba0559
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.json;
+
+import com.marcozanon.macaco.MObject;
+
+public abstract class MJsonValue extends MObject {
+
+    /* */
+
+    public abstract MJsonValue clone();
+
+    /* Helpers */
+
+    protected static boolean isWhitespace(int c) {
+        return ((' ' == c) || ('\t' == c) || ('\n' == c) || ('\r' == c));
+    }
+
+    protected static boolean isValueSeparator(int c) {
+        return (',' == c);
+    }
+
+    protected static boolean isNameSeparator(int c) {
+        return (':' == c);
+    }
+
+    protected static boolean isOpeningStructuralCharacter(int c) {
+        return (('[' == c) || ('{' == c));
+    }
+
+    protected static boolean isClosingStructuralCharacter(int c) {
+        return ((']' == c) || ('}' == c));
+    }
+
+    /* Formatter */
+
+    public abstract String getJsonValue();
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/logging/MLogFilter.java b/3.x/src/java/com/marcozanon/macaco/logging/MLogFilter.java
new file mode 100644 (file)
index 0000000..a158309
--- /dev/null
@@ -0,0 +1,95 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.logging;
+
+import com.marcozanon.macaco.MObject;
+import java.util.LinkedList;
+
+public class MLogFilter extends MObject {
+
+    public static enum Threshold {
+        STANDARD,
+        HIGH,
+        DEBUG
+    };
+
+    protected MLogFilter.Threshold threshold = null;
+
+    protected LinkedList<MLogTarget> logTargets = new LinkedList<MLogTarget>();
+
+    /* */
+
+    public MLogFilter(MLogFilter.Threshold threshold) {
+        super();
+        //
+        this.setThreshold(threshold);
+    }
+
+    public void close() throws MLoggingException {
+        for (MLogTarget t: this.getLogTargetsReference()) {
+            t.close();
+        }
+    }
+
+    protected void finalize() {
+        try {
+            this.close();
+        }
+        catch (Exception exception) {
+        }
+    }
+
+    /* Threshold */
+
+    public void setThreshold(MLogFilter.Threshold threshold) {
+        if (null == threshold) {
+            throw new IllegalArgumentException("Invalid 'threshold': null.");
+        }
+        //
+        this.threshold = threshold;
+    }
+
+    public MLogFilter.Threshold getThreshold() {
+        return this.threshold;
+    }
+
+    /* Log targets */
+
+    public void addLogTarget(MLogTarget logTarget) {
+        if (null == logTarget) {
+            throw new IllegalArgumentException("Invalid 'logTarget': null.");
+        }
+        //
+        synchronized (this.logTargets) {
+            this.logTargets.add(logTarget);
+        }
+    }
+
+    protected LinkedList<MLogTarget> getLogTargetsReference() {
+        return this.logTargets;
+    }
+
+    /* Output */
+
+    public void appendMessage(MLogFilter.Threshold level, String message) throws MLoggingException {
+        this.appendMessage(level, message, 0);
+    }
+
+    public void appendMessage(MLogFilter.Threshold level, String message, int indentation) throws MLoggingException {
+        if (null == level) {
+            throw new IllegalArgumentException("Invalid 'level': null.");
+        }
+        //
+        if (level.ordinal() > this.getThreshold().ordinal()) {
+            return;
+        }
+        for (MLogTarget t: this.getLogTargetsReference()) {
+            t.appendMessage(message, indentation);
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/logging/MLogPlainTextFile.java b/3.x/src/java/com/marcozanon/macaco/logging/MLogPlainTextFile.java
new file mode 100644 (file)
index 0000000..0e3d16d
--- /dev/null
@@ -0,0 +1,106 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.logging;
+
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.text.MText;
+import java.io.BufferedWriter;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class MLogPlainTextFile extends MLogTarget {
+
+    protected String file = null;
+
+    protected BufferedWriter buffer = null;
+
+    /* */
+
+    public MLogPlainTextFile(String file) throws MLoggingException {
+        super();
+        //
+        if (MText.isBlank(file)) {
+            throw new IllegalArgumentException("Invalid 'file': null or empty.");
+        }
+        //
+        this.file = file;
+        try {
+            this.buffer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.getFile(), true), MInformation.TEXT_ENCODING));
+        }
+        catch (FileNotFoundException exception) {
+            throw new MLoggingException("Could not open file.", exception);
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+    }
+
+    public void close() throws MLoggingException {
+        try {
+            this.getBufferReference().close();
+        }
+        catch (IOException exception) {
+            throw new MLoggingException("Could not close file.", exception);
+        }
+    }
+
+    protected void finalize() {
+        try {
+            this.close();
+        }
+        catch (Exception exception) {
+        }
+    }
+
+    /* File */
+
+    protected String getFile() {
+        return this.file;
+    }
+
+    /* Buffer */
+
+    protected BufferedWriter getBufferReference() {
+        return this.buffer;
+    }
+
+    /* Output */
+
+    public void appendMessage(String message) throws MLoggingException {
+        this.appendMessage(message, 0);
+    }
+
+    public void appendMessage(String message, int indentation) throws MLoggingException {
+        if (null == message) {
+            throw new IllegalArgumentException("Invalid 'message': null.");
+        }
+        if (0 > indentation) {
+            throw new IllegalArgumentException(String.format("Invalid 'indentation': %s: cannot be negative.", indentation));
+        }
+        //
+        try {
+            String timestamp = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date());
+            StringBuilder separator = new StringBuilder(" ");
+            for (int i = 0; i < indentation; i++) {
+                separator.append(" ");
+            }
+            synchronized (this.getBufferReference()) {
+                this.getBufferReference().write(timestamp + separator + message);
+                this.getBufferReference().newLine();
+                this.getBufferReference().flush();
+            }
+        }
+        catch (IOException exception) {
+            throw new MLoggingException("Could not write to file.", exception);
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/logging/MLogTarget.java b/3.x/src/java/com/marcozanon/macaco/logging/MLogTarget.java
new file mode 100644 (file)
index 0000000..e0d8cdb
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.logging;
+
+import com.marcozanon.macaco.MObject;
+
+public abstract class MLogTarget extends MObject {
+
+    /* */
+
+    public abstract void close() throws MLoggingException;
+
+    protected abstract void finalize();
+
+    /* Output */
+
+    public abstract void appendMessage(String message) throws MLoggingException;
+
+    public abstract void appendMessage(String message, int indentation) throws MLoggingException;
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/logging/MLoggingException.java b/3.x/src/java/com/marcozanon/macaco/logging/MLoggingException.java
new file mode 100644 (file)
index 0000000..a9f758b
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.logging;
+
+import com.marcozanon.macaco.MException;
+
+@SuppressWarnings("serial")
+public class MLoggingException extends MException {
+
+    /* */
+
+    public MLoggingException() {
+        super();
+    }
+
+    public MLoggingException(String message) {
+        super(message);
+    }
+
+    public MLoggingException(Throwable error) {
+        super(error);
+    }
+
+    public MLoggingException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java b/3.x/src/java/com/marcozanon/macaco/sql/MConnectionSqlException.java
new file mode 100644 (file)
index 0000000..8339552
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+@SuppressWarnings("serial")
+public class MConnectionSqlException extends MSqlException {
+
+    /* */
+
+    public MConnectionSqlException() {
+        super();
+    }
+
+    public MConnectionSqlException(String message) {
+        super(message);
+    }
+
+    public MConnectionSqlException(Throwable error) {
+        super(error);
+    }
+
+    public MConnectionSqlException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MSqlConnection.java b/3.x/src/java/com/marcozanon/macaco/sql/MSqlConnection.java
new file mode 100644 (file)
index 0000000..b730de4
--- /dev/null
@@ -0,0 +1,237 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.LinkedList;
+
+public class MSqlConnection extends MObject {
+
+    public static enum TransactionStatus {
+        CLOSED,
+        SUCCESSFUL,
+        FAILED
+    };
+
+    protected String driver = null;
+    protected String url = null;
+    protected String username = null;
+    protected String password = null;
+
+    protected Connection connection = null;
+
+    protected MSqlConnection.TransactionStatus transactionStatus = MSqlConnection.TransactionStatus.CLOSED;
+
+    /* */
+
+    public MSqlConnection(String driver, String url, String username, String password) throws MConnectionSqlException {
+        super();
+        //
+        if (MText.isBlank(driver)) {
+            throw new IllegalArgumentException("Invalid 'driver': null or empty.");
+        }
+        if (MText.isBlank(url)) {
+            throw new IllegalArgumentException("Invalid 'url': null or empty.");
+        }
+        if (null == username) {
+            throw new IllegalArgumentException("Invalid 'username': null.");
+        }
+        if (null == password) {
+            throw new IllegalArgumentException("Invalid 'password': null.");
+        }
+        //
+        this.driver = driver;
+        this.url = url;
+        this.username = username;
+        this.password = password;
+        // load driver
+        try {
+            Class.forName(this.getDriver()).newInstance();
+        }
+        catch (ClassNotFoundException exception) {
+            throw new MConnectionSqlException("Could not load driver.", exception);
+        }
+        catch (IllegalAccessException exception) {
+            throw new MConnectionSqlException("Could not load driver.", exception);
+        }
+        catch (InstantiationException exception) {
+            throw new MConnectionSqlException("Could not load driver.", exception);
+        }
+        // establish connection
+        try {
+            this.connection = DriverManager.getConnection(this.getUrl(), this.getUsername(), this.getPassword());
+        }
+        catch (SQLException exception) {
+            throw new MConnectionSqlException("Could not get connection.", exception);
+        }
+        // set SQL mode
+        try {
+            this.getConnectionReference().createStatement().executeUpdate("SET SQL_MODE='ANSI'");
+        }
+        catch (SQLException exception) {
+            throw new MConnectionSqlException("Could not set SQL mode to ANSI.", exception);
+        }
+    }
+
+    public void close() throws MConnectionSqlException {
+        try {
+            this.getConnectionReference().close();
+        }
+        catch (SQLException exception) {
+            throw new MConnectionSqlException("Could not close connection.", exception);
+        }
+    }
+
+    protected void finalize() {
+        try {
+            this.close();
+        }
+        catch (Exception exception) {
+        }
+    }
+
+    /* Driver */
+
+    public String getDriver() {
+        return this.driver;
+    }
+
+    /* Url */
+
+    public String getUrl() {
+        return this.url;
+    }
+
+    /* Username */
+
+    public String getUsername() {
+        return this.username;
+    }
+
+    /* Password */
+
+    public String getPassword() {
+        return this.password;
+    }
+
+    /* Connection */
+
+    protected Connection getConnectionReference() {
+        return this.connection;
+    }
+
+    /* Transactions */
+
+    protected void setTransactionStatus(MSqlConnection.TransactionStatus transactionStatus) {
+        if (null == transactionStatus) {
+            throw new IllegalArgumentException("Invalid 'transactionStatus': null.");
+        }
+        //
+        this.transactionStatus = transactionStatus;
+    }
+
+    public MSqlConnection.TransactionStatus getTransactionStatus() {
+        return this.transactionStatus;
+    }
+
+    public void startTransaction() throws MTransactionSqlException {
+        if (MSqlConnection.TransactionStatus.CLOSED != this.getTransactionStatus()) {
+            throw new MTransactionSqlException("Nested transactions not allowed.");
+        }
+        try {
+            this.getConnectionReference().setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
+            this.getConnectionReference().setAutoCommit(false);
+            this.setTransactionStatus(MSqlConnection.TransactionStatus.SUCCESSFUL);
+        }
+        catch (SQLException exception) {
+            throw new MTransactionSqlException("Could not start transaction.", exception);
+        }
+    }
+
+    public void rollBackTransaction() throws MTransactionSqlException {
+        if (MSqlConnection.TransactionStatus.CLOSED == this.getTransactionStatus()) {
+            throw new MTransactionSqlException("Transaction not started.");
+        }
+        try {
+            this.getConnectionReference().rollback();
+            this.getConnectionReference().setAutoCommit(true);
+            this.setTransactionStatus(MSqlConnection.TransactionStatus.CLOSED);
+        }
+        catch (SQLException exception) {
+            this.setTransactionStatus(MSqlConnection.TransactionStatus.FAILED);
+            throw new MTransactionSqlException("Could not roll back transaction.", exception);
+        }
+    }
+
+    public MSqlConnection.TransactionStatus commitTransaction() throws MTransactionSqlException {
+        switch (this.getTransactionStatus()) {
+            case SUCCESSFUL:
+                try {
+                    this.getConnectionReference().commit();
+                    this.getConnectionReference().setAutoCommit(true);
+                    this.setTransactionStatus(MSqlConnection.TransactionStatus.CLOSED);
+                    return MSqlConnection.TransactionStatus.SUCCESSFUL;
+                }
+                catch (SQLException exception) {
+                    this.rollBackTransaction();
+                    return MSqlConnection.TransactionStatus.FAILED;
+                }
+            case FAILED:
+                this.rollBackTransaction();
+                return MSqlConnection.TransactionStatus.FAILED;
+            default: // instead of "case CLOSED:" (necessary to avoid Java compilation errors)
+                throw new MTransactionSqlException("Transaction not started.");
+        }
+    }
+
+    /* Statements */
+
+    public MSqlStatementResults executePreparedStatement(String statement) throws MStatementSqlException {
+        return this.executePreparedStatement(statement, new LinkedList<Object>());
+    }
+
+    public MSqlStatementResults executePreparedStatement(String statement, LinkedList<Object> parameters) throws MStatementSqlException {
+        if (MText.isBlank(statement)) {
+            throw new IllegalArgumentException("Invalid 'statement': null or empty.");
+        }
+        if (null == parameters) {
+            throw new IllegalArgumentException("Invalid 'parameters': null.");
+        }
+        //
+        MSqlStatementResults results = null;
+        PreparedStatement preparedStatement = null;
+        try {
+            // prepare the statement
+            preparedStatement = this.getConnectionReference().prepareStatement(statement, PreparedStatement.RETURN_GENERATED_KEYS);
+            for (int p = 0; parameters.size() > p; p++) {
+                preparedStatement.setObject(p + 1, parameters.get(p));
+            }
+            // execute the statement and parse the results
+            preparedStatement.execute();
+            results = new MSqlStatementResults(preparedStatement);
+        }
+        catch (SQLException exception) {
+            if (MSqlConnection.TransactionStatus.SUCCESSFUL == this.getTransactionStatus()) {
+                this.setTransactionStatus(MSqlConnection.TransactionStatus.FAILED);
+            }
+            throw new MStatementSqlException(String.format("Could not execute prepared statement: %s.", preparedStatement), exception);
+        }
+        return results;
+    }
+
+    /* Tables */
+
+    public MSqlTable getTable(String table, String primaryKey) {
+        return new MSqlTable(this, table, primaryKey);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java b/3.x/src/java/com/marcozanon/macaco/sql/MSqlConnectionGenerator.java
new file mode 100644 (file)
index 0000000..ce9dbd0
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+
+public class MSqlConnectionGenerator extends MObject {
+
+    protected String driver = null;
+    protected String url = null;
+    protected String username = null;
+    protected String password = null;
+
+    /* */
+
+    public MSqlConnectionGenerator(String driver, String url, String username, String password) {
+        super();
+        //
+        if (MText.isBlank(driver)) {
+            throw new IllegalArgumentException("Invalid 'driver': null or empty.");
+        }
+        if (MText.isBlank(url)) {
+            throw new IllegalArgumentException("Invalid 'url': null or empty.");
+        }
+        if (null == username) {
+            throw new IllegalArgumentException("Invalid 'username': null.");
+        }
+        if (null == password) {
+            throw new IllegalArgumentException("Invalid 'password': null.");
+        }
+        //
+        this.driver = driver;
+        this.url = url;
+        this.username = username;
+        this.password = password;
+    }
+
+    /* Driver */
+
+    public String getDriver() {
+        return this.driver;
+    }
+
+    /* Url */
+
+    public String getUrl() {
+        return this.url;
+    }
+
+    /* Username */
+
+    public String getUsername() {
+        return this.username;
+    }
+
+    /* Password */
+
+    public String getPassword() {
+        return this.password;
+    }
+
+    /* Generator */
+
+    public MSqlConnection getConnection() throws MConnectionSqlException {
+        return new MSqlConnection(this.getDriver(), this.getUrl(), this.getUsername(), this.getPassword());
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MSqlException.java b/3.x/src/java/com/marcozanon/macaco/sql/MSqlException.java
new file mode 100644 (file)
index 0000000..bfb7e3f
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+import com.marcozanon.macaco.MException;
+
+public abstract class MSqlException extends MException {
+
+    /* */
+
+    public MSqlException() {
+        super();
+    }
+
+    public MSqlException(String message) {
+        super(message);
+    }
+
+    public MSqlException(Throwable error) {
+        super(error);
+    }
+
+    public MSqlException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java b/3.x/src/java/com/marcozanon/macaco/sql/MSqlStatementResults.java
new file mode 100644 (file)
index 0000000..8b38290
--- /dev/null
@@ -0,0 +1,149 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+
+public class MSqlStatementResults extends MObject {
+
+    protected PreparedStatement preparedStatement = null;
+    protected ResultSet resultSet = null;
+
+    protected LinkedList<LinkedHashMap<String, Object>> records = new LinkedList<LinkedHashMap<String, Object>>();
+
+    protected LinkedHashSet<Object> generatedKeys = new LinkedHashSet<Object>();
+
+    /* */
+
+    public MSqlStatementResults(PreparedStatement preparedStatement) throws MStatementSqlException {
+        super();
+        //
+        if (null == preparedStatement) {
+            throw new IllegalArgumentException("Invalid 'preparedStatement': null.");
+        }
+        //
+        this.preparedStatement = preparedStatement;
+        //
+        try {
+            this.resultSet = this.getPreparedStatementReference().getResultSet();
+            if (null != this.getResultSetReference()) {
+                while (this.getResultSetReference().next()) {
+                    ResultSetMetaData resultSetMetaData = this.getResultSetReference().getMetaData();
+                    LinkedHashMap<String, Object> record = new LinkedHashMap<String, Object>();
+                    for (int f = 0; resultSetMetaData.getColumnCount() > f; f++) {
+                        String field = resultSetMetaData.getColumnLabel(f + 1);
+                        record.put(field, this.getResultSetReference().getObject(field));
+                    }
+                    this.getRecordsReference().add(record);
+                }
+            }
+        }
+        catch (SQLException exception) {
+            throw new MStatementSqlException("Could not retrieve statement records.", exception);
+        }
+        //
+        try {
+            ResultSet generatedKeysResultSet = this.getPreparedStatementReference().getGeneratedKeys();
+            while (generatedKeysResultSet.next()) {
+                this.getGeneratedKeysReference().add(generatedKeysResultSet.getObject(1));
+            }
+            generatedKeysResultSet.close();
+        }
+        catch (SQLException exception) {
+            throw new MStatementSqlException("Could not retrieve generated keys.", exception);
+        }
+    }
+
+    public void close() throws MConnectionSqlException {
+        try {
+            if (null != this.getResultSetReference()) {
+                this.getResultSetReference().close();
+            }
+            this.getPreparedStatementReference().close();
+        }
+        catch (SQLException exception) {
+            throw new MConnectionSqlException("Could not close statement and/or result set references.", exception);
+        }
+    }
+
+    protected void finalize() {
+        try {
+            this.close();
+        }
+        catch (Exception exception) {
+        }
+    }
+
+    /* References */
+
+    protected PreparedStatement getPreparedStatementReference() {
+        return this.preparedStatement;
+    }
+
+    public ResultSet getResultSetReference() {
+        return this.resultSet;
+    }
+
+    /* Records */
+
+    protected LinkedList<LinkedHashMap<String, Object>> getRecordsReference() {
+        return this.records;
+    }
+
+    public LinkedList<LinkedHashMap<String, Object>> getRecords() {
+        LinkedList<LinkedHashMap<String, Object>> tmpRecords = new LinkedList<LinkedHashMap<String, Object>>();
+        for (LinkedHashMap<String, Object> record: this.getRecordsReference()) {
+            LinkedHashMap<String, Object> tmpRecord = new LinkedHashMap<String, Object>();
+            for (String key: record.keySet()) {
+                tmpRecord.put(key, record.get(key));
+            }
+            tmpRecords.add(tmpRecord);
+        }
+        return tmpRecords;
+    }
+
+    public LinkedList<Object> getRecordsByField(String field) {
+        if (MText.isBlank(field)) {
+            throw new IllegalArgumentException("Invalid 'field': null or empty.");
+        }
+        //
+        LinkedList<Object> recordsByField = new LinkedList<Object>();
+        for (LinkedHashMap<String, Object> record: this.getRecordsReference()) {
+            Object r = record.get(field);
+            if (null == r) {
+                throw new IllegalArgumentException(String.format("Invalid 'field': %s.", field));
+            }
+            recordsByField.add(r);
+        }
+        return recordsByField;
+    }
+
+    /* Generated keys */
+
+    protected LinkedHashSet<Object> getGeneratedKeysReference() {
+        return this.generatedKeys;
+    }
+
+    public LinkedHashSet<Object> getGeneratedKeys() {
+        LinkedHashSet<Object> tmpGeneratedKeys = new LinkedHashSet<Object>();
+        Iterator i = this.getGeneratedKeysReference().iterator();
+        while (i.hasNext()) {
+            tmpGeneratedKeys.add(i.next());
+        }
+        return tmpGeneratedKeys;
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MSqlTable.java b/3.x/src/java/com/marcozanon/macaco/sql/MSqlTable.java
new file mode 100644 (file)
index 0000000..f7bfd14
--- /dev/null
@@ -0,0 +1,137 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+
+public class MSqlTable extends MObject {
+
+    protected MSqlConnection connection = null;
+    protected String table = null;
+    protected String primaryKey = null;
+
+    /* */
+
+    public MSqlTable(MSqlConnection connection, String table, String primaryKey) {
+        super();
+        //
+        if (null == connection) {
+            throw new IllegalArgumentException("Invalid 'connection': null.");
+        }
+        if (MText.isBlank(table)) {
+            throw new IllegalArgumentException("Invalid 'table': null or empty.");
+        }
+        if (MText.isBlank(primaryKey)) {
+            throw new IllegalArgumentException("Invalid 'primaryKey': null or empty.");
+        }
+        //
+        this.connection = connection;
+        this.table = table;
+        this.primaryKey = primaryKey;
+    }
+
+    /* Connection */
+
+    protected MSqlConnection getConnectionReference() {
+        return this.connection;
+    }
+
+    /* Table */
+
+    public String getTable() {
+        return this.table;
+    }
+
+    /* Primary key */
+
+    public String getPrimaryKey() {
+        return this.primaryKey;
+    }
+
+    /* Statements */
+
+    protected MSqlStatementResults insertRecord(LinkedHashMap<String, Object> map) throws MStatementSqlException {
+        if (null == map) {
+            throw new IllegalArgumentException("Invalid 'map': null.");
+        }
+        //
+        LinkedList<Object> p = new LinkedList<Object>();
+        StringBuilder fields = new StringBuilder("");
+        StringBuilder s = new StringBuilder("");
+        for (String field: map.keySet()) {
+            fields.append("\"" + this.getTable() + "\".\"" + field + "\", ");
+            s.append("?, ");
+            p.add(map.get(field));
+        }
+        fields.delete(fields.length() - 2, fields.length());
+        s.delete(s.length() - 2, s.length());
+        return this.getConnectionReference().executePreparedStatement(" INSERT INTO \"" + this.getTable() + "\""
+                                                                    + "             (" + fields + ")"
+                                                                    + " VALUES      (" + s + ")",
+                                                                      p);
+    }
+
+    protected MSqlStatementResults updateRecord(LinkedHashMap<String, Object> map, Object id) throws MStatementSqlException {
+        if (null == map) {
+            throw new IllegalArgumentException("Invalid 'map': null.");
+        }
+        if (null == id) {
+            throw new IllegalArgumentException("Invalid 'id': null.");
+        }
+        //
+        LinkedList<Object> p = new LinkedList<Object>();
+        StringBuilder s = new StringBuilder("");
+        for (String field: map.keySet()) {
+            s.append("\"" + this.getTable() + "\".\"" + field + "\" = ?, ");
+            p.add(map.get(field));
+        }
+        s.delete(s.length() - 2, s.length());
+        p.add(id);
+        return this.getConnectionReference().executePreparedStatement(" UPDATE  \"" + this.getTable() + "\""
+                                                                    + " SET     " + s
+                                                                    + " WHERE   (\"" + this.getTable() + "\".\"" + this.getPrimaryKey() + "\" = ?)",
+                                                                      p);
+    }
+
+    public MSqlStatementResults setRecord(LinkedHashMap<String, Object> map, Object id) throws MStatementSqlException {
+        if (null == id) {
+            return this.insertRecord(map);
+        }
+        else {
+            return this.updateRecord(map, id);
+        }
+    }
+
+    public MSqlStatementResults getRecord(Object id) throws MStatementSqlException {
+        if (null == id) {
+            throw new IllegalArgumentException("Invalid 'id': null.");
+        }
+        //
+        LinkedList<Object> p = new LinkedList<Object>();
+        p.add(id);
+        return this.getConnectionReference().executePreparedStatement(" SELECT  *"
+                                                                    + " FROM    \"" + this.getTable() + "\""
+                                                                    + " WHERE   (\"" + this.getTable() + "\".\"" + this.getPrimaryKey() + "\" = ?)",
+                                                                      p);
+    }
+
+    public MSqlStatementResults deleteRecord(Object id) throws MStatementSqlException {
+        if (null == id) {
+            throw new IllegalArgumentException("Invalid 'id': null.");
+        }
+        //
+        LinkedList<Object> p = new LinkedList<Object>();
+        p.add(id);
+        return this.getConnectionReference().executePreparedStatement(" DELETE FROM \"" + this.getTable() + "\""
+                                                                    + " WHERE       (\"" + this.getTable() + "\".\"" + this.getPrimaryKey() + "\" = ?)",
+                                                                      p);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MStatementSqlException.java b/3.x/src/java/com/marcozanon/macaco/sql/MStatementSqlException.java
new file mode 100644 (file)
index 0000000..71877e0
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+@SuppressWarnings("serial")
+public class MStatementSqlException extends MSqlException {
+
+    /* */
+
+    public MStatementSqlException() {
+        super();
+    }
+
+    public MStatementSqlException(String message) {
+        super(message);
+    }
+
+    public MStatementSqlException(Throwable error) {
+        super(error);
+    }
+
+    public MStatementSqlException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/sql/MTransactionSqlException.java b/3.x/src/java/com/marcozanon/macaco/sql/MTransactionSqlException.java
new file mode 100644 (file)
index 0000000..ede005f
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+@SuppressWarnings("serial")
+public class MTransactionSqlException extends MSqlException {
+
+    /* */
+
+    public MTransactionSqlException() {
+        super();
+    }
+
+    public MTransactionSqlException(String message) {
+        super(message);
+    }
+
+    public MTransactionSqlException(Throwable error) {
+        super(error);
+    }
+
+    public MTransactionSqlException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/text/MText.java b/3.x/src/java/com/marcozanon/macaco/text/MText.java
new file mode 100644 (file)
index 0000000..e22f343
--- /dev/null
@@ -0,0 +1,426 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.MObject;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class MText extends MObject {
+
+    /* Checks */
+
+    public static boolean isEmpty(String x) {
+        if ((null != x) && ("".equals(x))) {
+            return true;
+        }
+        return false;
+    }
+
+    public static boolean isBlank(String x) {
+        if ((null == x) || ("".equals(x))) {
+            return true;
+        }
+        return false;
+    }
+
+    /* Utility methods */
+
+    public static String repeat(String x, int times) {
+        if (1 > times) {
+            throw new IllegalArgumentException(String.format("Invalid 'times': %s.", times));
+        }
+        //
+        StringBuilder y = new StringBuilder("");
+        for (int i = 0; i < times; i++) {
+            y = y.append(x);
+        }
+        return y.toString();
+    }
+
+    /* Javascript escape */
+
+    public static String getJavascriptEscapedString(String x) {
+        if (null == x) {
+            return null;
+        }
+        //
+        String text = x;
+        //
+        text = text.replace("\\", "\\\\");
+        text = text.replace("'", "\\\'");
+        //
+        return text;
+    }
+
+    /* Xhtml escape and safety */
+
+    public static String getXhtmlEscapedString(String x) { // similar to PHP's htmlspecialchars()
+        if (null == x) {
+            return null;
+        }
+        //
+        String text = x;
+        //
+        text = text.replace("&", "&amp;");
+        text = text.replace("\"", "&quot;");
+        text = text.replace("'", "&apos;");
+        text = text.replace("<", "&lt;");
+        text = text.replace(">", "&gt;");
+        //
+        text = text.replace("\n", "<br />");
+        //
+        return text;
+    }
+
+    public static String getXhtmlNumericEntitiesString(String x) { // for compatibility with innerHTML
+        if (null == x) {
+            return null;
+        }
+        //
+        String text = x;
+        //
+        text = text.replace("&nbsp;", "&#160;");
+        text = text.replace("&iexcl;", "&#161;");
+        text = text.replace("&cent;", "&#162;");
+        text = text.replace("&pound;", "&#163;");
+        text = text.replace("&curren;", "&#164;");
+        text = text.replace("&yen;", "&#165;");
+        text = text.replace("&brvbar;", "&#166;");
+        text = text.replace("&sect;", "&#167;");
+        text = text.replace("&uml;", "&#168;");
+        text = text.replace("&copy;", "&#169;");
+        text = text.replace("&ordf;", "&#170;");
+        text = text.replace("&laquo;", "&#171;");
+        text = text.replace("&not;", "&#172;");
+        text = text.replace("&shy;", "&#173;");
+        text = text.replace("&reg;", "&#174;");
+        text = text.replace("&macr;", "&#175;");
+        text = text.replace("&deg;", "&#176;");
+        text = text.replace("&plusmn;", "&#177;");
+        text = text.replace("&sup2;", "&#178;");
+        text = text.replace("&sup3;", "&#179;");
+        text = text.replace("&acute;", "&#180;");
+        text = text.replace("&micro;", "&#181;");
+        text = text.replace("&para;", "&#182;");
+        text = text.replace("&middot;", "&#183;");
+        text = text.replace("&cedil;", "&#184;");
+        text = text.replace("&sup1;", "&#185;");
+        text = text.replace("&ordm;", "&#186;");
+        text = text.replace("&raquo;", "&#187;");
+        text = text.replace("&frac14;", "&#188;");
+        text = text.replace("&frac12;", "&#189;");
+        text = text.replace("&frac34;", "&#190;");
+        text = text.replace("&iquest;", "&#191;");
+        text = text.replace("&Agrave;", "&#192;");
+        text = text.replace("&Aacute;", "&#193;");
+        text = text.replace("&Acirc;", "&#194;");
+        text = text.replace("&Atilde;", "&#195;");
+        text = text.replace("&Auml;", "&#196;");
+        text = text.replace("&Aring;", "&#197;");
+        text = text.replace("&AElig;", "&#198;");
+        text = text.replace("&Ccedil;", "&#199;");
+        text = text.replace("&Egrave;", "&#200;");
+        text = text.replace("&Eacute;", "&#201;");
+        text = text.replace("&Ecirc;", "&#202;");
+        text = text.replace("&Euml;", "&#203;");
+        text = text.replace("&Igrave;", "&#204;");
+        text = text.replace("&Iacute;", "&#205;");
+        text = text.replace("&Icirc;", "&#206;");
+        text = text.replace("&Iuml;", "&#207;");
+        text = text.replace("&ETH;", "&#208;");
+        text = text.replace("&Ntilde;", "&#209;");
+        text = text.replace("&Ograve;", "&#210;");
+        text = text.replace("&Oacute;", "&#211;");
+        text = text.replace("&Ocirc;", "&#212;");
+        text = text.replace("&Otilde;", "&#213;");
+        text = text.replace("&Ouml;", "&#214;");
+        text = text.replace("&times;", "&#215;");
+        text = text.replace("&Oslash;", "&#216;");
+        text = text.replace("&Ugrave;", "&#217;");
+        text = text.replace("&Uacute;", "&#218;");
+        text = text.replace("&Ucirc;", "&#219;");
+        text = text.replace("&Uuml;", "&#220;");
+        text = text.replace("&Yacute;", "&#221;");
+        text = text.replace("&THORN;", "&#222;");
+        text = text.replace("&szlig;", "&#223;");
+        text = text.replace("&agrave;", "&#224;");
+        text = text.replace("&aacute;", "&#225;");
+        text = text.replace("&acirc;", "&#226;");
+        text = text.replace("&atilde;", "&#227;");
+        text = text.replace("&auml;", "&#228;");
+        text = text.replace("&aring;", "&#229;");
+        text = text.replace("&aelig;", "&#230;");
+        text = text.replace("&ccedil;", "&#231;");
+        text = text.replace("&egrave;", "&#232;");
+        text = text.replace("&eacute;", "&#233;");
+        text = text.replace("&ecirc;", "&#234;");
+        text = text.replace("&euml;", "&#235;");
+        text = text.replace("&igrave;", "&#236;");
+        text = text.replace("&iacute;", "&#237;");
+        text = text.replace("&icirc;", "&#238;");
+        text = text.replace("&iuml;", "&#239;");
+        text = text.replace("&eth;", "&#240;");
+        text = text.replace("&ntilde;", "&#241;");
+        text = text.replace("&ograve;", "&#242;");
+        text = text.replace("&oacute;", "&#243;");
+        text = text.replace("&ocirc;", "&#244;");
+        text = text.replace("&otilde;", "&#245;");
+        text = text.replace("&ouml;", "&#246;");
+        text = text.replace("&divide;", "&#247;");
+        text = text.replace("&oslash;", "&#248;");
+        text = text.replace("&ugrave;", "&#249;");
+        text = text.replace("&uacute;", "&#250;");
+        text = text.replace("&ucirc;", "&#251;");
+        text = text.replace("&uuml;", "&#252;");
+        text = text.replace("&yacute;", "&#253;");
+        text = text.replace("&thorn;", "&#254;");
+        text = text.replace("&yuml;", "&#255;");
+        text = text.replace("&OElig;", "&#338;");
+        text = text.replace("&oelig;", "&#339;");
+        text = text.replace("&Scaron;", "&#352;");
+        text = text.replace("&scaron;", "&#353;");
+        text = text.replace("&Yuml;", "&#376;");
+        text = text.replace("&fnof;", "&#402;");
+        text = text.replace("&circ;", "&#710;");
+        text = text.replace("&tilde;", "&#732;");
+        text = text.replace("&Alpha;", "&#913;");
+        text = text.replace("&Beta;", "&#914;");
+        text = text.replace("&Gamma;", "&#915;");
+        text = text.replace("&Delta;", "&#916;");
+        text = text.replace("&Epsilon;", "&#917;");
+        text = text.replace("&Zeta;", "&#918;");
+        text = text.replace("&Eta;", "&#919;");
+        text = text.replace("&Theta;", "&#920;");
+        text = text.replace("&Iota;", "&#921;");
+        text = text.replace("&Kappa;", "&#922;");
+        text = text.replace("&Lambda;", "&#923;");
+        text = text.replace("&Mu;", "&#924;");
+        text = text.replace("&Nu;", "&#925;");
+        text = text.replace("&Xi;", "&#926;");
+        text = text.replace("&Omicron;", "&#927;");
+        text = text.replace("&Pi;", "&#928;");
+        text = text.replace("&Rho;", "&#929;");
+        text = text.replace("&Sigma;", "&#931;");
+        text = text.replace("&Tau;", "&#932;");
+        text = text.replace("&Upsilon;", "&#933;");
+        text = text.replace("&Phi;", "&#934;");
+        text = text.replace("&Chi;", "&#935;");
+        text = text.replace("&Psi;", "&#936;");
+        text = text.replace("&Omega;", "&#937;");
+        text = text.replace("&alpha;", "&#945;");
+        text = text.replace("&beta;", "&#946;");
+        text = text.replace("&gamma;", "&#947;");
+        text = text.replace("&delta;", "&#948;");
+        text = text.replace("&epsilon;", "&#949;");
+        text = text.replace("&zeta;", "&#950;");
+        text = text.replace("&eta;", "&#951;");
+        text = text.replace("&theta;", "&#952;");
+        text = text.replace("&iota;", "&#953;");
+        text = text.replace("&kappa;", "&#954;");
+        text = text.replace("&lambda;", "&#955;");
+        text = text.replace("&mu;", "&#956;");
+        text = text.replace("&nu;", "&#957;");
+        text = text.replace("&xi;", "&#958;");
+        text = text.replace("&omicron;", "&#959;");
+        text = text.replace("&pi;", "&#960;");
+        text = text.replace("&rho;", "&#961;");
+        text = text.replace("&sigmaf;", "&#962;");
+        text = text.replace("&sigma;", "&#963;");
+        text = text.replace("&tau;", "&#964;");
+        text = text.replace("&upsilon;", "&#965;");
+        text = text.replace("&phi;", "&#966;");
+        text = text.replace("&chi;", "&#967;");
+        text = text.replace("&psi;", "&#968;");
+        text = text.replace("&omega;", "&#969;");
+        text = text.replace("&thetasym;", "&#977;");
+        text = text.replace("&upsih;", "&#978;");
+        text = text.replace("&piv;", "&#982;");
+        text = text.replace("&ensp;", "&#8194;");
+        text = text.replace("&emsp;", "&#8195;");
+        text = text.replace("&thinsp;", "&#8201;");
+        text = text.replace("&zwnj;", "&#8204;");
+        text = text.replace("&zwj;", "&#8205;");
+        text = text.replace("&lrm;", "&#8206;");
+        text = text.replace("&rlm;", "&#8207;");
+        text = text.replace("&ndash;", "&#8211;");
+        text = text.replace("&mdash;", "&#8212;");
+        text = text.replace("&lsquo;", "&#8216;");
+        text = text.replace("&rsquo;", "&#8217;");
+        text = text.replace("&sbquo;", "&#8218;");
+        text = text.replace("&ldquo;", "&#8220;");
+        text = text.replace("&rdquo;", "&#8221;");
+        text = text.replace("&bdquo;", "&#8222;");
+        text = text.replace("&dagger;", "&#8224;");
+        text = text.replace("&Dagger;", "&#8225;");
+        text = text.replace("&bull;", "&#8226;");
+        text = text.replace("&hellip;", "&#8230;");
+        text = text.replace("&permil;", "&#8240;");
+        text = text.replace("&prime;", "&#8242;");
+        text = text.replace("&Prime;", "&#8243;");
+        text = text.replace("&lsaquo;", "&#8249;");
+        text = text.replace("&rsaquo;", "&#8250;");
+        text = text.replace("&oline;", "&#8254;");
+        text = text.replace("&frasl;", "&#8260;");
+        text = text.replace("&euro;", "&#8364;");
+        text = text.replace("&image;", "&#8465;");
+        text = text.replace("&weierp;", "&#8472;");
+        text = text.replace("&real;", "&#8476;");
+        text = text.replace("&trade;", "&#8482;");
+        text = text.replace("&alefsym;", "&#8501;");
+        text = text.replace("&larr;", "&#8592;");
+        text = text.replace("&uarr;", "&#8593;");
+        text = text.replace("&rarr;", "&#8594;");
+        text = text.replace("&darr;", "&#8595;");
+        text = text.replace("&harr;", "&#8596;");
+        text = text.replace("&crarr;", "&#8629;");
+        text = text.replace("&lArr;", "&#8656;");
+        text = text.replace("&uArr;", "&#8657;");
+        text = text.replace("&rArr;", "&#8658;");
+        text = text.replace("&dArr;", "&#8659;");
+        text = text.replace("&hArr;", "&#8660;");
+        text = text.replace("&forall;", "&#8704;");
+        text = text.replace("&part;", "&#8706;");
+        text = text.replace("&exist;", "&#8707;");
+        text = text.replace("&empty;", "&#8709;");
+        text = text.replace("&nabla;", "&#8711;");
+        text = text.replace("&isin;", "&#8712;");
+        text = text.replace("&notin;", "&#8713;");
+        text = text.replace("&ni;", "&#8715;");
+        text = text.replace("&prod;", "&#8719;");
+        text = text.replace("&sum;", "&#8721;");
+        text = text.replace("&minus;", "&#8722;");
+        text = text.replace("&lowast;", "&#8727;");
+        text = text.replace("&radic;", "&#8730;");
+        text = text.replace("&prop;", "&#8733;");
+        text = text.replace("&infin;", "&#8734;");
+        text = text.replace("&ang;", "&#8736;");
+        text = text.replace("&and;", "&#8743;");
+        text = text.replace("&or;", "&#8744;");
+        text = text.replace("&cap;", "&#8745;");
+        text = text.replace("&cup;", "&#8746;");
+        text = text.replace("&int;", "&#8747;");
+        text = text.replace("&there4;", "&#8756;");
+        text = text.replace("&sim;", "&#8764;");
+        text = text.replace("&cong;", "&#8773;");
+        text = text.replace("&asymp;", "&#8776;");
+        text = text.replace("&ne;", "&#8800;");
+        text = text.replace("&equiv;", "&#8801;");
+        text = text.replace("&le;", "&#8804;");
+        text = text.replace("&ge;", "&#8805;");
+        text = text.replace("&sub;", "&#8834;");
+        text = text.replace("&sup;", "&#8835;");
+        text = text.replace("&nsub;", "&#8836;");
+        text = text.replace("&sube;", "&#8838;");
+        text = text.replace("&supe;", "&#8839;");
+        text = text.replace("&oplus;", "&#8853;");
+        text = text.replace("&otimes;", "&#8855;");
+        text = text.replace("&perp;", "&#8869;");
+        text = text.replace("&sdot;", "&#8901;");
+        text = text.replace("&lceil;", "&#8968;");
+        text = text.replace("&rceil;", "&#8969;");
+        text = text.replace("&lfloor;", "&#8970;");
+        text = text.replace("&rfloor;", "&#8971;");
+        text = text.replace("&lang;", "&#9001;");
+        text = text.replace("&rang;", "&#9002;");
+        text = text.replace("&loz;", "&#9674;");
+        text = text.replace("&spades;", "&#9824;");
+        text = text.replace("&clubs;", "&#9827;");
+        text = text.replace("&hearts;", "&#9829;");
+        text = text.replace("&diams;", "&#9830;");
+        //
+        return text;
+    }
+
+    public static String getXhtmlSafeString(String x) throws MXhtmlUnsafeStringTextException {
+        if (null == x) {
+            return null;
+        }
+        //
+        String text = x;
+        //
+        StringBuilder fakeXhtmlPageContent = new StringBuilder("");
+        fakeXhtmlPageContent.append(String.format("<?xml version=\"1.0\" encoding=\"%s\" ?>", MInformation.TEXT_ENCODING));
+        fakeXhtmlPageContent.append("<!DOCTYPE html SYSTEM \"fake-dtd\" >");
+        fakeXhtmlPageContent.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+        fakeXhtmlPageContent.append("<head><title /></head>");
+        fakeXhtmlPageContent.append(String.format("<body>%s</body>", text));
+        fakeXhtmlPageContent.append("</html>");
+        // validate Xhtml (without dangerous tags and event attributes)
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setValidating(true);
+            factory.setNamespaceAware(true);
+            SAXParser parser = factory.newSAXParser();
+            XMLReader reader = parser.getXMLReader();
+            reader.setEntityResolver(new EntityResolver() {
+
+                public InputSource resolveEntity(String publicId, String systemId) {
+                    return new InputSource(new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream("dtd/xhtml1-transitional-macaco-edit.dtd")));
+                }
+
+            });
+            reader.setContentHandler(new DefaultHandler() {
+
+                public void startElement(String namespaceUri, String strippedName, String tagName, Attributes attributes) throws SAXException {
+                    if ("script".equalsIgnoreCase(tagName)) {
+                        throw new SAXException(String.format("Tag not allowed: %s.", tagName));
+                    }
+                    for (int a = 0; attributes.getLength() > a; a++) {
+                        if (attributes.getLocalName(a).toLowerCase().startsWith("on")) {
+                            throw new SAXException(String.format("Attribute not allowed: %s.", attributes.getLocalName(a)));
+                        }
+                    }
+                }
+
+            });
+            reader.setErrorHandler(new ErrorHandler() {
+
+                public void error(SAXParseException exception) throws SAXException {
+                    throw new SAXException(exception);
+                }
+
+                public void fatalError(SAXParseException exception) throws SAXException {
+                    throw new SAXException(exception);
+                }
+
+                public void warning(SAXParseException exception) throws SAXException {
+                    throw new SAXException(exception);
+                }
+
+            });
+            //
+            reader.parse(new InputSource(new ByteArrayInputStream(fakeXhtmlPageContent.toString().getBytes(MInformation.TEXT_ENCODING))));
+        }
+        catch (ParserConfigurationException exception) { // cannot happen
+        }
+        catch (SAXException exception) {
+            throw new MXhtmlUnsafeStringTextException("Invalid 'x': unsafe tags or attributes inside.", exception);
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+        catch (IOException exception) { // cannot happen; put here not to bypass UnsupportedEncodingException
+        }
+        // also convert named entities to numeric entities
+        return MText.getXhtmlNumericEntitiesString(text);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/text/MTranslationException.java b/3.x/src/java/com/marcozanon/macaco/text/MTranslationException.java
new file mode 100644 (file)
index 0000000..67128dc
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+public abstract class MTranslationException extends MTextException {
+
+    /* */
+
+    public MTranslationException() {
+        super();
+    }
+
+    public MTranslationException(String message) {
+        super(message);
+    }
+
+    public MTranslationException(Throwable error) {
+        super(error);
+    }
+
+    public MTranslationException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java b/3.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java
new file mode 100644 (file)
index 0000000..a3001ba
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+@SuppressWarnings("serial")
+public class MTranslationFileParsingTextException extends MTranslationException {
+
+    /* */
+
+    public MTranslationFileParsingTextException() {
+        super();
+    }
+
+    public MTranslationFileParsingTextException(String message) {
+        super(message);
+    }
+
+    public MTranslationFileParsingTextException(Throwable error) {
+        super(error);
+    }
+
+    public MTranslationFileParsingTextException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/text/MTranslationValueNotFoundTextException.java b/3.x/src/java/com/marcozanon/macaco/text/MTranslationValueNotFoundTextException.java
new file mode 100644 (file)
index 0000000..0cc5991
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+@SuppressWarnings("serial")
+public class MTranslationValueNotFoundTextException extends MTranslationException {
+
+    /* */
+
+    public MTranslationValueNotFoundTextException() {
+        super();
+    }
+
+    public MTranslationValueNotFoundTextException(String message) {
+        super(message);
+    }
+
+    public MTranslationValueNotFoundTextException(Throwable error) {
+        super(error);
+    }
+
+    public MTranslationValueNotFoundTextException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/text/MTranslator.java b/3.x/src/java/com/marcozanon/macaco/text/MTranslator.java
new file mode 100644 (file)
index 0000000..86ec598
--- /dev/null
@@ -0,0 +1,187 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.MObject;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+
+public class MTranslator extends MObject {
+
+    protected String file = null;
+    protected Locale basicLocale = null;
+
+    protected LinkedHashMap<String, LinkedHashMap<String, String>> messages = new LinkedHashMap<String, LinkedHashMap<String, String>>();
+
+    /* */
+
+    public MTranslator(String file, Locale basicLocale) throws MTranslationFileParsingTextException {
+        super();
+        //
+        if (null == basicLocale) {
+            throw new IllegalArgumentException("Invalid 'basicLocale': null.");
+        }
+        //
+        this.file = file;
+        this.basicLocale = basicLocale;
+        //
+        this.parseFile(this.getFile());
+    }
+
+    public MTranslator clone() {
+        MTranslator tmpMTranslator = null;
+        try {
+            tmpMTranslator = new MTranslator(this.getFile(), this.getBasicLocale());
+        }
+        catch (MTranslationFileParsingTextException exception) { // should not happen
+        }
+        return tmpMTranslator;
+    }
+
+    /* File */
+
+    protected String getFile() {
+        return this.file;
+    }
+
+    /* Locale */
+
+    protected Locale getBasicLocale() {
+        return this.basicLocale;
+    }
+
+    /* Strings management */
+
+    protected LinkedHashMap<String, LinkedHashMap<String, String>> getMessagesReference() {
+        return this.messages;
+    }
+
+    public void parseFile(String file) throws MTranslationFileParsingTextException {
+        if (MText.isBlank(file)) {
+            throw new IllegalArgumentException("Invalid 'file': null or empty.");
+        }
+        //
+        LineNumberReader buffer = null;
+        try {
+            buffer = new LineNumberReader(new InputStreamReader(new FileInputStream(file), MInformation.TEXT_ENCODING));
+        }
+        catch (FileNotFoundException exception) {
+            throw new MTranslationFileParsingTextException("Could not open file.", exception);
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+        String message = null;
+        String line = null;
+        synchronized (this.getMessagesReference()) {
+            while (true) {
+                try {
+                    line = buffer.readLine();
+                }
+                catch (IOException exception) {
+                    throw new MTranslationFileParsingTextException("Could not read file.", exception);
+                }
+                if (null == line) {
+                    break;
+                }
+                line = line.trim();
+                if (MText.isEmpty(line)) {
+                    message = null;
+                    continue;
+                }
+                else if (null == message) {
+                    message = line;
+                    if (this.getMessagesReference().containsKey(message)) {
+                        throw new MTranslationFileParsingTextException(String.format("Invalid line: %s: duplicated message: %s.", buffer.getLineNumber(), message));
+                    }
+                    this.getMessagesReference().put(message, new LinkedHashMap<String, String>());
+                }
+                else {
+                    int a = line.indexOf("=");
+                    if (-1 == a) {
+                        throw new MTranslationFileParsingTextException(String.format("Invalid line: %s: string malformed: %s.", buffer.getLineNumber(), line));
+                    }
+                    String localeRepresentation = line.substring(0, a).trim();
+                    String translation = line.substring(a + 1).trim();
+                    if (this.getMessagesReference().get(message).containsKey(localeRepresentation)) {
+                        throw new MTranslationFileParsingTextException(String.format("Invalid line: %s: duplicated translation for locale: %s.", buffer.getLineNumber(), message));
+                    }
+                    this.getMessagesReference().get(message).put(localeRepresentation, translation);
+                }
+            }
+        }
+        try {
+            buffer.close();
+        }
+        catch (IOException exception) {
+            throw new MTranslationFileParsingTextException("Could not close file.", exception);
+        }
+    }
+
+    public void clear() {
+        synchronized (this.getMessagesReference()) {
+            this.getMessagesReference().clear();
+        }
+    }
+
+    public String t(String message, Locale locale) {
+        return this.getLenientTranslation(message, locale);
+    }
+
+    public String getLenientTranslation(String message, Locale locale) {
+        String translation = null;
+        try {
+            translation = this.getTranslation(message, locale, false);
+        }
+        catch (MTranslationValueNotFoundTextException exception) { // cannot happen
+        }
+        return translation;
+    }
+
+    public String getStrictTranslation(String message, Locale locale) throws MTranslationValueNotFoundTextException {
+        return this.getTranslation(message, locale, true);
+    }
+
+    protected String getTranslation(String message, Locale locale, boolean strictMode) throws MTranslationValueNotFoundTextException {
+        if (MText.isBlank(message)) {
+            throw new IllegalArgumentException("Invalid 'message': null or empty.");
+        }
+        if (null == locale) {
+            throw new IllegalArgumentException("Invalid 'locale': null.");
+        }
+        //
+        if (!this.getMessagesReference().containsKey(message)) {
+            if (strictMode) {
+                throw new MTranslationValueNotFoundTextException(String.format("Invalid 'message': %s: not available.", message));
+            }
+            return message;
+        }
+        if (this.getBasicLocale().equals(locale)) {
+            return message;
+        }
+        LinkedHashMap<String, String> messageTranslations = this.getMessagesReference().get(message);
+        String localeRepresentation = locale.toString();
+        if (!messageTranslations.containsKey(localeRepresentation)) {
+            if (strictMode) {
+                throw new MTranslationValueNotFoundTextException(String.format("Invalid 'locale': %s: translation not available for message: %s.", localeRepresentation, message));
+            }
+            String localeFallbackRepresentation = locale.getLanguage();
+            if (!messageTranslations.containsKey(localeFallbackRepresentation)) {
+                return message;
+            }
+            return messageTranslations.get(localeFallbackRepresentation);
+        }
+        return messageTranslations.get(localeRepresentation);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/text/MXhtmlUnsafeStringTextException.java b/3.x/src/java/com/marcozanon/macaco/text/MXhtmlUnsafeStringTextException.java
new file mode 100644 (file)
index 0000000..830d3a0
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+@SuppressWarnings("serial")
+public class MXhtmlUnsafeStringTextException extends MTextException {
+
+    /* */
+
+    public MXhtmlUnsafeStringTextException() {
+        super();
+    }
+
+    public MXhtmlUnsafeStringTextException(String message) {
+        super(message);
+    }
+
+    public MXhtmlUnsafeStringTextException(Throwable error) {
+        super(error);
+    }
+
+    public MXhtmlUnsafeStringTextException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MApplicationServletWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MApplicationServletWebException.java
new file mode 100644 (file)
index 0000000..5ae0672
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MApplicationServletWebException extends MWebException {
+
+    /* */
+
+    public MApplicationServletWebException() {
+        super();
+    }
+
+    public MApplicationServletWebException(String message) {
+        super(message);
+    }
+
+    public MApplicationServletWebException(Throwable error) {
+        super(error);
+    }
+
+    public MApplicationServletWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MBrowserPageRequestPreprocessingWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MBrowserPageRequestPreprocessingWebException.java
new file mode 100644 (file)
index 0000000..5859162
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MBrowserPageRequestPreprocessingWebException extends MWebException {
+
+    /* */
+
+    public MBrowserPageRequestPreprocessingWebException() {
+        super();
+    }
+
+    public MBrowserPageRequestPreprocessingWebException(String message) {
+        super(message);
+    }
+
+    public MBrowserPageRequestPreprocessingWebException(Throwable error) {
+        super(error);
+    }
+
+    public MBrowserPageRequestPreprocessingWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MDisplayWidgetNotFoundWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MDisplayWidgetNotFoundWebException.java
new file mode 100644 (file)
index 0000000..98f62f9
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MDisplayWidgetNotFoundWebException extends MSecurityWebException {
+
+    /* */
+
+    public MDisplayWidgetNotFoundWebException() {
+        super();
+    }
+
+    public MDisplayWidgetNotFoundWebException(String message) {
+        super(message);
+    }
+
+    public MDisplayWidgetNotFoundWebException(Throwable error) {
+        super(error);
+    }
+
+    public MDisplayWidgetNotFoundWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MDownloaderNotFoundWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MDownloaderNotFoundWebException.java
new file mode 100644 (file)
index 0000000..b622a0b
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MDownloaderNotFoundWebException extends MSecurityWebException {
+
+    /* */
+
+    public MDownloaderNotFoundWebException() {
+        super();
+    }
+
+    public MDownloaderNotFoundWebException(String message) {
+        super(message);
+    }
+
+    public MDownloaderNotFoundWebException(Throwable error) {
+        super(error);
+    }
+
+    public MDownloaderNotFoundWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidRemoteIpAddressWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidRemoteIpAddressWebException.java
new file mode 100644 (file)
index 0000000..530355e
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MInvalidRemoteIpAddressWebException extends MSecurityWebException {
+
+    /* */
+
+    public MInvalidRemoteIpAddressWebException() {
+        super();
+    }
+
+    public MInvalidRemoteIpAddressWebException(String message) {
+        super(message);
+    }
+
+    public MInvalidRemoteIpAddressWebException(Throwable error) {
+        super(error);
+    }
+
+    public MInvalidRemoteIpAddressWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidRequestWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidRequestWebException.java
new file mode 100644 (file)
index 0000000..cea9a29
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MInvalidRequestWebException extends MSecurityWebException {
+
+    /* */
+
+    public MInvalidRequestWebException() {
+        super();
+    }
+
+    public MInvalidRequestWebException(String message) {
+        super(message);
+    }
+
+    public MInvalidRequestWebException(Throwable error) {
+        super(error);
+    }
+
+    public MInvalidRequestWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidResourceWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidResourceWebException.java
new file mode 100644 (file)
index 0000000..bb4b693
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MInvalidResourceWebException extends MSecurityWebException {
+
+    /* */
+
+    public MInvalidResourceWebException() {
+        super();
+    }
+
+    public MInvalidResourceWebException(String message) {
+        super(message);
+    }
+
+    public MInvalidResourceWebException(Throwable error) {
+        super(error);
+    }
+
+    public MInvalidResourceWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidSecurityIdWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MInvalidSecurityIdWebException.java
new file mode 100644 (file)
index 0000000..d819138
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MInvalidSecurityIdWebException extends MSecurityWebException {
+
+    /* */
+
+    public MInvalidSecurityIdWebException() {
+        super();
+    }
+
+    public MInvalidSecurityIdWebException(String message) {
+        super(message);
+    }
+
+    public MInvalidSecurityIdWebException(Throwable error) {
+        super(error);
+    }
+
+    public MInvalidSecurityIdWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MMessagingWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MMessagingWebException.java
new file mode 100644 (file)
index 0000000..065a774
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MMessagingWebException extends MWebException {
+
+    /* */
+
+    public MMessagingWebException() {
+        super();
+    }
+
+    public MMessagingWebException(String message) {
+        super(message);
+    }
+
+    public MMessagingWebException(Throwable error) {
+        super(error);
+    }
+
+    public MMessagingWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoBrowserPageWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoBrowserPageWebException.java
new file mode 100644 (file)
index 0000000..b197a63
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoBrowserPageWebException extends MSetupWebException {
+
+    /* */
+
+    public MNoBrowserPageWebException() {
+        super();
+    }
+
+    public MNoBrowserPageWebException(String message) {
+        super(message);
+    }
+
+    public MNoBrowserPageWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoBrowserPageWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoCellContentWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoCellContentWebException.java
new file mode 100644 (file)
index 0000000..b4edb38
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoCellContentWebException extends MSetupWebException {
+
+    /* */
+
+    public MNoCellContentWebException() {
+        super();
+    }
+
+    public MNoCellContentWebException(String message) {
+        super(message);
+    }
+
+    public MNoCellContentWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoCellContentWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoLogFilterWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoLogFilterWebException.java
new file mode 100644 (file)
index 0000000..d3a765d
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoLogFilterWebException extends MSetupWebException {
+
+    /* */
+
+    public MNoLogFilterWebException() {
+        super();
+    }
+
+    public MNoLogFilterWebException(String message) {
+        super(message);
+    }
+
+    public MNoLogFilterWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoLogFilterWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoProcessableMessageWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoProcessableMessageWebException.java
new file mode 100644 (file)
index 0000000..d220328
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoProcessableMessageWebException extends MWebException {
+
+    /* */
+
+    public MNoProcessableMessageWebException() {
+        super();
+    }
+
+    public MNoProcessableMessageWebException(String message) {
+        super(message);
+    }
+
+    public MNoProcessableMessageWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoProcessableMessageWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoViewContentWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoViewContentWebException.java
new file mode 100644 (file)
index 0000000..8845611
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoViewContentWebException extends MSetupWebException {
+
+    /* */
+
+    public MNoViewContentWebException() {
+        super();
+    }
+
+    public MNoViewContentWebException(String message) {
+        super(message);
+    }
+
+    public MNoViewContentWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoViewContentWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoViewWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoViewWebException.java
new file mode 100644 (file)
index 0000000..806987e
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoViewWebException extends MSetupWebException {
+
+    /* */
+
+    public MNoViewWebException() {
+        super();
+    }
+
+    public MNoViewWebException(String message) {
+        super(message);
+    }
+
+    public MNoViewWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoViewWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNoWidgetIdWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNoWidgetIdWebException.java
new file mode 100644 (file)
index 0000000..75057f1
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNoWidgetIdWebException extends MSetupWebException {
+
+    /* */
+
+    public MNoWidgetIdWebException() {
+        super();
+    }
+
+    public MNoWidgetIdWebException(String message) {
+        super(message);
+    }
+
+    public MNoWidgetIdWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNoWidgetIdWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MNullPropertyWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MNullPropertyWebException.java
new file mode 100644 (file)
index 0000000..7272945
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MNullPropertyWebException extends MWebException {
+
+    /* */
+
+    public MNullPropertyWebException() {
+        super();
+    }
+
+    public MNullPropertyWebException(String message) {
+        super(message);
+    }
+
+    public MNullPropertyWebException(Throwable error) {
+        super(error);
+    }
+
+    public MNullPropertyWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MResponseWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MResponseWebException.java
new file mode 100644 (file)
index 0000000..b331080
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MResponseWebException extends MWebException {
+
+    /* */
+
+    public MResponseWebException() {
+        super();
+    }
+
+    public MResponseWebException(String message) {
+        super(message);
+    }
+
+    public MResponseWebException(Throwable error) {
+        super(error);
+    }
+
+    public MResponseWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MSecurityWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MSecurityWebException.java
new file mode 100644 (file)
index 0000000..e18dceb
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+public abstract class MSecurityWebException extends MWebException {
+
+    /* */
+
+    public MSecurityWebException() {
+        super();
+    }
+
+    public MSecurityWebException(String message) {
+        super(message);
+    }
+
+    public MSecurityWebException(Throwable error) {
+        super(error);
+    }
+
+    public MSecurityWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MSetupWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MSetupWebException.java
new file mode 100644 (file)
index 0000000..926ebce
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+public abstract class MSetupWebException extends MWebException {
+
+    /* */
+
+    public MSetupWebException() {
+        super();
+    }
+
+    public MSetupWebException(String message) {
+        super(message);
+    }
+
+    public MSetupWebException(Throwable error) {
+        super(error);
+    }
+
+    public MSetupWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MUnexpectedMessageWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MUnexpectedMessageWebException.java
new file mode 100644 (file)
index 0000000..b8e74e5
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MUnexpectedMessageWebException extends MSecurityWebException {
+
+    /* */
+
+    public MUnexpectedMessageWebException() {
+        super();
+    }
+
+    public MUnexpectedMessageWebException(String message) {
+        super(message);
+    }
+
+    public MUnexpectedMessageWebException(Throwable error) {
+        super(error);
+    }
+
+    public MUnexpectedMessageWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MUniqueWidgetIdNotAvailableWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MUniqueWidgetIdNotAvailableWebException.java
new file mode 100644 (file)
index 0000000..6264284
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MUniqueWidgetIdNotAvailableWebException extends MSetupWebException {
+
+    /* */
+
+    public MUniqueWidgetIdNotAvailableWebException() {
+        super();
+    }
+
+    public MUniqueWidgetIdNotAvailableWebException(String message) {
+        super(message);
+    }
+
+    public MUniqueWidgetIdNotAvailableWebException(Throwable error) {
+        super(error);
+    }
+
+    public MUniqueWidgetIdNotAvailableWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MValidationWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MValidationWebException.java
new file mode 100644 (file)
index 0000000..0e7fcab
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MValidationWebException extends MWebException {
+
+    /* */
+
+    public MValidationWebException() {
+        super();
+    }
+
+    public MValidationWebException(String message) {
+        super(message);
+    }
+
+    public MValidationWebException(Throwable error) {
+        super(error);
+    }
+
+    public MValidationWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MViewNotUnloadableWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MViewNotUnloadableWebException.java
new file mode 100644 (file)
index 0000000..59f7f20
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MViewNotUnloadableWebException extends MSetupWebException {
+
+    /* */
+
+    public MViewNotUnloadableWebException() {
+        super();
+    }
+
+    public MViewNotUnloadableWebException(String message) {
+        super(message);
+    }
+
+    public MViewNotUnloadableWebException(Throwable error) {
+        super(error);
+    }
+
+    public MViewNotUnloadableWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MViewThreadStoppingWebRuntimeException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MViewThreadStoppingWebRuntimeException.java
new file mode 100644 (file)
index 0000000..70aa85d
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+@SuppressWarnings("serial")
+public class MViewThreadStoppingWebRuntimeException extends MWebRuntimeException {
+
+    /* */
+
+    public MViewThreadStoppingWebRuntimeException() {
+        super();
+    }
+
+    public MViewThreadStoppingWebRuntimeException(String message) {
+        super(message);
+    }
+
+    public MViewThreadStoppingWebRuntimeException(Throwable error) {
+        super(error);
+    }
+
+    public MViewThreadStoppingWebRuntimeException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebApplicationContext.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebApplicationContext.java
new file mode 100644 (file)
index 0000000..d64e8df
--- /dev/null
@@ -0,0 +1,248 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+public abstract class MWebApplicationContext extends MObject {
+
+    protected MWebApplicationServlet applicationServlet = null;
+    protected HttpServletRequest request = null;
+    protected HttpServletResponse response = null;
+
+    protected String responseContentType = null;
+    protected byte[] responseContent = new byte[0];
+
+    protected boolean roamingMode = false;
+
+    /* */
+
+    public MWebApplicationContext(MWebApplicationServlet applicationServlet, HttpServletRequest request, HttpServletResponse response) {
+        super();
+        //
+        if (null == applicationServlet) {
+            throw new IllegalArgumentException("Invalid 'applicationServlet': null.");
+        }
+        //
+        this.applicationServlet = applicationServlet;
+        this.refreshReferences(request, response);
+    }
+
+    protected void refreshReferences(HttpServletRequest request, HttpServletResponse response) {
+        if (null == request) {
+            throw new IllegalArgumentException("Invalid 'request': null.");
+        }
+        if (null == response) {
+            throw new IllegalArgumentException("Invalid 'response': null.");
+        }
+        //
+        this.request = request;
+        this.response = response;
+    }
+
+    /* Application servlet */
+
+    public MWebApplicationServlet getApplicationServletReference() {
+        return this.applicationServlet;
+    }
+
+    /* Request */
+
+    public HttpServletRequest getRequestReference() {
+        return this.request;
+    }
+
+    /* Response */
+
+    public HttpServletResponse getResponseReference() {
+        return this.response;
+    }
+
+    /* Session */
+
+    public HttpSession getSessionReference() {
+        return this.getRequestReference().getSession(false);
+    }
+
+    /* Response content */
+
+    protected void setResponseContentType(String responseContentType) {
+        if (MText.isBlank(responseContentType)) {
+            throw new IllegalArgumentException("Invalid 'responseContentType': null or empty.");
+        }
+        //
+        this.responseContentType = responseContentType;
+    }
+
+    protected String getResponseContentType() {
+        return this.responseContentType;
+    }
+
+    protected void clearResponseContent() {
+        this.responseContentType = null;
+        this.responseContent = new byte[0];
+    }
+
+    protected void addPlainTextResponseContent(String responseContent) throws MResponseWebException {
+        if (MText.isBlank(responseContent)) {
+            throw new IllegalArgumentException("Invalid 'responseContent': null or empty.");
+        }
+        //
+        try {
+            this.addPlainTextResponseContent(responseContent.getBytes(MInformation.TEXT_ENCODING));
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+    }
+
+    protected void addPlainTextResponseContent(byte[] responseContent) throws MResponseWebException {
+        String currentResponseContentType = this.getResponseContentType();
+        if ((null != currentResponseContentType) && (!MInformation.HttpContentType.PLAIN.toString().equals(currentResponseContentType))) {
+            throw new MResponseWebException(String.format("Could not add plain text response content: content type already set to: %s.", currentResponseContentType));
+        }
+        //
+        this.setResponseContentType(MInformation.HttpContentType.PLAIN.toString());
+        this.addResponseContent(responseContent);
+    }
+
+    protected void setXhtmlResponseContent(String responseContent) throws MResponseWebException {
+        if (MText.isBlank(responseContent)) {
+            throw new IllegalArgumentException("Invalid 'responseContent': null or empty.");
+        }
+        //
+        try {
+            this.setXhtmlResponseContent(responseContent.getBytes(MInformation.TEXT_ENCODING));
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+    }
+
+    protected void setXhtmlResponseContent(byte[] responseContent) throws MResponseWebException {
+        String currentResponseContentType = this.getResponseContentType();
+        if ((null != currentResponseContentType) && (!MInformation.HttpContentType.XHTML.toString().equals(currentResponseContentType))) { // XHtml can only override plain text
+            throw new MResponseWebException(String.format("Could not set Xhtml response content: content type already set to: %s.", currentResponseContentType));
+        }
+        //
+        this.clearResponseContent();
+        this.setResponseContentType(MInformation.HttpContentType.XHTML.toString());
+        this.addResponseContent(responseContent);
+    }
+
+    protected void setRawResponseContent(byte[] responseContent, String responseContentType) throws MResponseWebException {
+        String currentResponseContentType = this.getResponseContentType();
+        if (null != currentResponseContentType) {
+            throw new MResponseWebException(String.format("Could not set raw response content: content type already set to: %s.", currentResponseContentType));
+        }
+        //
+        this.setResponseContentType(responseContentType);
+        this.addResponseContent(responseContent);
+    }
+
+    protected void addResponseContent(byte[] responseContent) {
+        if (null == responseContent) {
+            throw new IllegalArgumentException("Invalid 'responseContent': null.");
+        }
+        //
+        byte[] tmp = new byte[this.responseContent.length + responseContent.length];
+        System.arraycopy(this.responseContent, 0, tmp, 0, this.responseContent.length);
+        System.arraycopy(responseContent, 0, tmp, this.responseContent.length, responseContent.length);
+        this.responseContent = tmp;
+    }
+
+    protected byte[] getResponseContent() {
+        byte[] tmp = new byte[this.responseContent.length];
+        System.arraycopy(this.responseContent, 0, tmp, 0, this.responseContent.length);
+        return tmp;
+    }
+
+    /* Notification area */
+
+    public void addNotificationAreaMessage(boolean error, String message) throws MResponseWebException {
+        this.addNotificationAreaMessage(error, message, false);
+    }
+
+    public void addNotificationAreaMessage(boolean error, String message, boolean framedOutput) throws MResponseWebException {
+        if (MText.isBlank(message)) {
+            throw new IllegalArgumentException("Invalid 'message': null or empty.");
+        }
+        //
+        if (framedOutput) {
+            String NL = System.getProperty("line.separator");
+            StringBuilder content = new StringBuilder("");
+            content.append(String.format("<?xml version=\"1.0\" encoding=\"%s\" ?>", MInformation.TEXT_ENCODING) + NL);
+            content.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + NL);
+            content.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">" + NL);
+            content.append(NL);
+            content.append("    <head>" + NL);
+            content.append(String.format("        <meta http-equiv=\"Content-type\" content=\"application/xhtml+xml; charset=%s\" />", MInformation.TEXT_ENCODING) + NL);
+            content.append("        <title />" + NL);
+            content.append("    </head>" + NL);
+            content.append(NL);
+            content.append("    <body>" + NL);
+            content.append("        <script type=\"text/javascript\">" + NL);
+            content.append("        // <![CDATA[" + NL);
+            content.append(String.format("            parent.m_notificationArea.addMessage(%s, '%s');", error, MText.getJavascriptEscapedString(MText.getXhtmlEscapedString(message))));
+            content.append("        // ]]>" + NL);
+            content.append("        </script>" + NL);
+            content.append("    </body>" + NL);
+            content.append(NL);
+            content.append("</html>" + NL);
+            try {
+                HttpServletResponse response = this.getResponseReference();
+                response.setContentType(MInformation.HttpContentType.XHTML.toString());
+                Writer writer = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), MInformation.TEXT_ENCODING));
+                writer.write(content.toString());
+                writer.flush();
+                writer.close();
+            }
+            catch (UnsupportedEncodingException exception) { // cannot happen
+            }
+            catch (IOException exception) { // put here not to bypass UnsupportedEncodingException
+                throw new MResponseWebException("Could not add notification area message.", exception);
+            }
+        }
+        else {
+            this.addPlainTextResponseContent(String.format("m_notificationArea.addMessage(%s, '%s');", error, MText.getJavascriptEscapedString(MText.getXhtmlEscapedString(message))));
+        }
+    }
+
+    /* Roaming mode */
+
+    public void setRoamingMode(boolean roamingMode) {
+        this.roamingMode = roamingMode;
+    }
+
+    public boolean getRoamingMode() {
+        return this.roamingMode;
+    }
+
+    /* Context full Url */
+
+    public String getContextFullUrl() {
+        HttpServletRequest request = this.getRequestReference();
+        String contextFullUrl = null;
+        try {
+            contextFullUrl = (new URL(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath())).toString();
+        }
+        catch (MalformedURLException exception) { // cannot happen
+        }
+        return contextFullUrl;
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java
new file mode 100644 (file)
index 0000000..031b201
--- /dev/null
@@ -0,0 +1,356 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MHttpServlet;
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.json.MInvalidValueJsonException;
+import com.marcozanon.macaco.json.MJsonNumber;
+import com.marcozanon.macaco.json.MJsonObject;
+import com.marcozanon.macaco.json.MJsonString;
+import com.marcozanon.macaco.logging.MLogFilter;
+import com.marcozanon.macaco.logging.MLoggingException;
+import com.marcozanon.macaco.text.MText;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+public abstract class MWebApplicationServlet extends MHttpServlet {
+
+    protected static enum ErrorMode {
+        CLEAN,
+        SILENT,
+        DEBUG
+    };
+
+    protected boolean debugMode = false;
+
+    protected MLogFilter logFilter = null;
+
+    /* */
+
+    public void destroy() {
+        try {
+            this.getLogFilterReference().close();
+        }
+        catch (MLoggingException exception) {
+        }
+        catch (MNoLogFilterWebException exception) {
+        }
+    }
+
+    /* Debug mode */
+
+    public void setDebugMode(boolean debugMode) {
+        this.debugMode = debugMode;
+    }
+
+    public boolean getDebugMode() {
+        return this.debugMode;
+    }
+
+    /* Logging */
+
+    public void setLogFilter(MLogFilter logFilter) {
+        this.logFilter = logFilter;
+    }
+
+    public MLogFilter getLogFilterReference() throws MNoLogFilterWebException {
+        if (null == this.logFilter) {
+            throw new MNoLogFilterWebException("Invalid log filter: null.");
+        }
+        //
+        return this.logFilter;
+    }
+
+    public void appendLogMessage(MLogFilter.Threshold level, String message) {
+        try {
+            this.getLogFilterReference().appendMessage(level, message);
+        }
+        catch (MLoggingException exception) {
+            this.log("[FALLBACK] " + message);
+        }
+        catch (MNoLogFilterWebException exception) {
+            this.log("[FALLBACK] " + message);
+        }
+    }
+
+    /* Requests */
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) {
+        this.processRequest(request, response);
+    }
+
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
+        this.processRequest(request, response);
+    }
+
+    protected void onRequestPreprocessing(HttpServletRequest request, HttpServletResponse response) throws MApplicationServletWebException {
+    }
+
+    protected abstract void processCustomRequest(HttpServletRequest request, HttpServletResponse response, MWebBrowserPage browserPage);
+
+    protected void processRequest(HttpServletRequest request, HttpServletResponse response) {
+        try {
+            request.setCharacterEncoding(MInformation.TEXT_ENCODING);
+            //
+            this.onRequestPreprocessing(request, response);
+            // check session security and refresh session parameters
+            MWebBrowserPage browserPage = this.getSafeBrowserPageReference(request, response);
+            // check for request type
+            String pathInfo = request.getPathInfo();
+            if (null == pathInfo) { // standard request
+                synchronized (browserPage) {
+                    // forward request
+                    browserPage.onRequestPreprocessing();
+                    browserPage.processRequest();
+                    // return standard response
+                    try {
+                        this.returnStandardResponse(response, browserPage.getApplicationContextReference().getResponseContentType(), browserPage.getApplicationContextReference().getResponseContent(), (null != request.getParameter("message") ? true : false));
+                    }
+                    catch (UnsupportedEncodingException exception) { // cannot happen
+                    }
+                }
+            }
+            else if (pathInfo.startsWith("/custom")) { // custom request
+                synchronized (browserPage) {
+                    this.processCustomRequest(request, response, browserPage);
+                    return;
+                }
+            }
+            else if ("/null".equals(pathInfo)) { // null request (used by some widgets)
+                return;
+            }
+            else if ("/ping".equals(pathInfo)) { // ping request (used to prevent session timeout)
+                response.setContentType(MInformation.HttpContentType.PLAIN.toString());
+                return;
+            }
+            else if (pathInfo.startsWith("/coreResources/")) { // resource request
+                String resourceInfo = pathInfo.substring("/coreResources/".length()).replace("\\", "/");
+                if ((resourceInfo.startsWith("/")) || (resourceInfo.startsWith("\\")) || (resourceInfo.contains("..")) || (resourceInfo.contains("~"))) {
+                    throw new MInvalidResourceWebException(String.format("Invalid resource request: %s.", pathInfo));
+                }
+                String httpContentType = null;
+                if (resourceInfo.toLowerCase().endsWith(".css")) { // Css resource
+                    httpContentType = MInformation.HttpContentType.CSS.toString();
+                }
+                else if (resourceInfo.toLowerCase().endsWith(".gif")) { // Gif resource
+                    httpContentType = MInformation.HttpContentType.GIF.toString();
+                }
+                else if (resourceInfo.toLowerCase().endsWith(".htm")) { // TinyMCE (X)html resource
+                    httpContentType = MInformation.HttpContentType.HTML.toString();
+                }
+                else if ((resourceInfo.toLowerCase().endsWith(".jpg")) || (resourceInfo.toLowerCase().endsWith(".jpeg"))) { // Jpeg resource
+                    httpContentType = MInformation.HttpContentType.JPEG.toString();
+                }
+                else if (resourceInfo.toLowerCase().endsWith(".js")) { // Javascript resource
+                    httpContentType = MInformation.HttpContentType.JAVASCRIPT.toString();
+                }
+                else if (resourceInfo.toLowerCase().endsWith(".png")) { // Png resource
+                    httpContentType = MInformation.HttpContentType.PNG.toString();
+                }
+                else if (resourceInfo.toLowerCase().endsWith(".txt")) { // Plain text resource
+                    httpContentType = MInformation.HttpContentType.PLAIN.toString();
+                }
+                else {
+                    throw new MInvalidResourceWebException(String.format("Invalid resource request: %s.", pathInfo));
+                }
+                this.returnRawResponse(response, httpContentType, MInformation.getCoreResource(resourceInfo));
+            }
+            else {
+                throw new MInvalidRequestWebException(String.format("Invalid request: %s.", pathInfo));
+            }
+        }
+        catch (Exception exception) {
+            this.returnErrorResponse(response, exception, (null != request.getParameter("message") ? true : false));
+        }
+    }
+
+    /* Responses */
+
+    protected void returnStandardResponse(HttpServletResponse response, String contentType, byte[] content, boolean ajaxMode) throws IOException {
+        if (MText.isBlank(contentType)) {
+            contentType = MInformation.HttpContentType.PLAIN.toString();
+        }
+        // prepare response content
+        byte[] responseContent = null;
+        if (ajaxMode) {
+            try {
+                MJsonObject returnValue = new MJsonObject();
+                returnValue.setValue("errorMode", new MJsonNumber("" + MWebApplicationServlet.ErrorMode.CLEAN.ordinal()));
+                MJsonString jsonParameter = new MJsonString();
+                jsonParameter.setValue(new String(content, MInformation.TEXT_ENCODING));
+                returnValue.setValue("parameter", jsonParameter);
+                responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING);
+            }
+            catch (MInvalidValueJsonException exception) { // cannot happen
+            }
+        }
+        else {
+            responseContent = content;
+        }
+        //
+        try {
+            this.returnResponse(response, contentType, responseContent);
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+    }
+
+    protected void returnErrorResponse(HttpServletResponse response, Exception content, boolean ajaxMode) {
+        // log exception
+        this.appendLogMessage(MLogFilter.Threshold.DEBUG, String.format("Exception: %s.", MInformation.getExceptionAsString(content)));
+        // special check: maybe the client fired two or more consecutive (asynchronous) messages and some of them became unfireable later?
+        if (content instanceof MUnexpectedMessageWebException) {
+            return;
+        }
+        // set error mode
+        MWebApplicationServlet.ErrorMode errorMode = MWebApplicationServlet.ErrorMode.SILENT;
+        if (this.getDebugMode()) {
+            errorMode = MWebApplicationServlet.ErrorMode.DEBUG;
+        }
+        // prepare response content
+        byte[] responseContent = null;
+        try {
+            if (MWebApplicationServlet.ErrorMode.DEBUG == errorMode) {
+                if (ajaxMode) {
+                    try {
+                        MJsonObject returnValue = new MJsonObject();
+                        returnValue.setValue("errorMode", new MJsonNumber("" + errorMode.ordinal()));
+                        MJsonString jsonParameter = new MJsonString();
+                        if (null != content.getMessage()) {
+                            jsonParameter.setValue(content.getClass().getName() + ": " + content.getMessage());
+                        }
+                        else {
+                            jsonParameter.setValue(content.getClass().getName());
+                        }
+                        returnValue.setValue("parameter", jsonParameter);
+                        responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING);
+                    }
+                    catch (MInvalidValueJsonException exception) { // should not happen
+                    }
+                }
+                else {
+                    if (null != content.getMessage()) {
+                        responseContent = (content.getClass().getName() + ": " + content.getMessage()).getBytes(MInformation.TEXT_ENCODING);
+                    }
+                    else {
+                        responseContent = (content.getClass().getName()).getBytes(MInformation.TEXT_ENCODING);
+                    }
+                }
+            }
+            else {
+                if (ajaxMode) {
+                    responseContent = "An error occurred while processing the message.".getBytes(MInformation.TEXT_ENCODING);
+                }
+                else {
+                    responseContent = "An error occurred while processing the request.".getBytes(MInformation.TEXT_ENCODING);
+                }
+            }
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+        //
+        try {
+            this.returnResponse(response, MInformation.HttpContentType.PLAIN.toString(), responseContent);
+        }
+        catch (UnsupportedEncodingException exception) { // cannot happen
+        }
+        catch (IOException exception) { // put here not to bypass UnsupportedEncodingException
+        }
+    }
+
+    protected void returnRawResponse(HttpServletResponse response, String contentType, byte[] content) throws IOException {
+        this.returnResponse(response, contentType, content);
+    }
+
+    protected void returnResponse(HttpServletResponse response, String contentType, byte[] content) throws IOException { // some lines taken from http://onjava.com/pub/a/onjava/excerpt/jebp_3/index2.html
+        if (null == response) {
+            throw new IllegalArgumentException("Invalid 'response': null.");
+        }
+        if (MText.isBlank(contentType)) {
+            throw new IllegalArgumentException("Invalid 'contentType': null or empty.");
+        }
+        if (null == content) {
+            throw new IllegalArgumentException("Invalid 'content': null.");
+        }
+        // disable cache
+        response.setHeader("Expires", "Sun, 01 Nov 1992 02:00:00 GMT"); // already expired
+        response.setHeader("Pragma", "no-cache"); // standard HTTP/1.0 no-cache header
+        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // standard HTTP/1.1 no-cache header
+        // send response
+        response.setContentType(contentType);
+        response.getOutputStream().write(content);
+    }
+
+    /* Application context */
+
+    protected abstract MWebApplicationContext getInitializedApplicationContext(HttpServletRequest request, HttpServletResponse response) throws MApplicationServletWebException; // abstract => not static => no other static methods in this class
+
+    /* Browser page */
+
+    protected abstract MWebBrowserPage getInitializedBrowserPage(MWebApplicationContext applicationContext) throws MApplicationServletWebException; // abstract => not static => no other static methods in this class
+
+    /* Session */
+
+    protected synchronized MWebBrowserPage getSafeBrowserPageReference(HttpServletRequest request, HttpServletResponse response) throws MApplicationServletWebException, MInvalidRemoteIpAddressWebException {
+        if (null == request) {
+            throw new IllegalArgumentException("Invalid 'request': null.");
+        }
+        //
+        MWebApplicationContext applicationContext = null;
+        MWebBrowserPage browserPage = null;
+        HttpSession session = request.getSession(false);
+        if ((null == session) || (null == (MWebApplicationContext)session.getAttribute("m_applicationContext")) || (null == (MWebBrowserPage)session.getAttribute("m_browserPage"))) { // no previous valid session
+            if (null != session) {
+                // clear complete session (including persistent Serializable objects)
+                session.invalidate();
+            }
+            // setup whole new session
+            session = request.getSession();
+            response.setHeader("Set-Cookie", "JSESSIONID=" + session.getId() + "; HttpOnly");
+            session.setAttribute("m_remoteAddress", request.getRemoteAddr());
+            try {
+                // application context
+                applicationContext = this.getInitializedApplicationContext(request, response);
+                if (null == applicationContext) {
+                    throw new MApplicationServletWebException("Invalid application context: null.");
+                }
+                session.setAttribute("m_applicationContext", applicationContext);
+                // browser page
+                browserPage = this.getInitializedBrowserPage(applicationContext);
+                if (null == browserPage) {
+                    throw new MApplicationServletWebException("Invalid browser page: null.");
+                }
+                session.setAttribute("m_browserPage", browserPage);
+            }
+            catch (MApplicationServletWebException exception) {
+                session.invalidate();
+                throw new MApplicationServletWebException("Session not initialized.", exception);
+            }
+        }
+        else { // valid session
+            // retrieve application context, refresh references and clear response content
+            applicationContext = ((MWebApplicationContext)session.getAttribute("m_applicationContext"));
+            applicationContext.refreshReferences(request, response);
+            applicationContext.clearResponseContent();
+            // retrieve browser page
+            browserPage = ((MWebBrowserPage)session.getAttribute("m_browserPage"));
+            // check whether session and current ip match
+            String sessionRemoteAddress = (String)session.getAttribute("m_remoteAddress");
+            String currentRemoteAddress = request.getRemoteAddr();
+            if ((!applicationContext.getRoamingMode()) && (!sessionRemoteAddress.equals(currentRemoteAddress))) {
+                throw new MInvalidRemoteIpAddressWebException(String.format("Invalid request: no match for session (%s) and current (%s) ip addresses.", sessionRemoteAddress, currentRemoteAddress));
+            }
+        }
+        //
+        return browserPage;
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebBorder.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebBorder.java
new file mode 100644 (file)
index 0000000..c063496
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+
+public class MWebBorder extends MObject {
+
+    public static enum Style {
+        DASHED("dashed"),
+        DOTTED("dotted"),
+        DOUBLE("double"),
+        GROOVE("groove"),
+        INSET("inset"),
+        OUTSET("outset"),
+        RIDGE("ridge"),
+        SOLID("solid");
+        private String name = null;
+        private Style(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected MWebMeasure width = null;
+    protected MWebBorder.Style style = null;
+    protected MWebColor color = null;
+
+    /* */
+
+    public MWebBorder(MWebMeasure width, MWebBorder.Style style, MWebColor color) {
+        super();
+        //
+        if (null == width) {
+            throw new IllegalArgumentException("Invalid 'width': null.");
+        }
+        if (null == style) {
+            throw new IllegalArgumentException("Invalid 'style': null.");
+        }
+        if (null == color) {
+            throw new IllegalArgumentException("Invalid 'color': null.");
+        }
+        //
+        this.width = width;
+        this.style = style;
+        this.color = color;
+    }
+
+    public MWebBorder clone() {
+        return new MWebBorder(this.getWidthReference().clone(), this.getStyle(), this.getColorReference().clone());
+    }
+
+    /* Border */
+
+    protected MWebMeasure getWidthReference() {
+        return this.width;
+    }
+
+    protected MWebBorder.Style getStyle() {
+        return this.style;
+    }
+
+    protected MWebColor getColorReference() {
+        return this.color;
+    }
+
+    public Object[] getValue() {
+        Object[] value = new Object[3];
+        value[0] = this.getWidthReference().clone();
+        value[1] = this.getStyle();
+        value[2] = this.getColorReference().clone();
+        return value;
+    }
+
+    public String getCssValue() {
+        return this.getWidthReference().getCssValue() + " " + this.getStyle().toString() + " " + this.getColorReference().getCssValue();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebBreadcrumbs.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebBreadcrumbs.java
new file mode 100644 (file)
index 0000000..5d285eb
--- /dev/null
@@ -0,0 +1,133 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+
+public class MWebBreadcrumbs extends MWebDirectWidget {
+
+    protected String prefix = "";
+
+    /* */
+
+    public MWebBreadcrumbs(MWebApplicationContext applicationContext, String prefix) {
+        super(applicationContext);
+        //
+        this.setPrefix(prefix);
+    }
+
+    /* Prefix */
+
+    public void setPrefix(String prefix) {
+        this.setPrefix(prefix, true);
+    }
+
+    protected void setPrefix(String prefix, boolean refreshMode) {
+        if (null == prefix) {
+            throw new IllegalArgumentException("Invalid 'prefix': null.");
+        }
+        //
+        this.prefix = prefix;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public String getPrefix() {
+        return this.prefix;
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<div class=\"MWebBreadcrumbs %s\" style=\"display: inline-block;\" id=\"%s\"></div>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), this.getId()));
+        //
+        super.refresh();
+        //
+        StringBuilder content = new StringBuilder("");
+        content.append(String.format("<span class=\"MWebBreadcrumbPrefix %s\">%s</span>", customClasses, MText.getXhtmlEscapedString(this.getPrefix())));
+        LinkedList<String> viewBreadcrumbs = this.getViewReference().getBrowserPageReference().getViewBreadcrumbs();
+        for (int t = 0; viewBreadcrumbs.size() > t; t++) {
+            content.append(" ");
+            if (0 < t) {
+                content.append("» ");
+            }
+            if ((viewBreadcrumbs.size() - 1) > t)  {
+                String onItemSelectionFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onItemSelection', {'viewCount': '%s'});", this.getId(), viewBreadcrumbs.size() - 1 - t);
+                content.append(String.format("<span class=\"MWebBreadcrumbItem %s\" onclick=\"%s\">%s</span>", customClasses, onItemSelectionFunction, MText.getXhtmlEscapedString(viewBreadcrumbs.get(t))));
+            }
+            else {
+                content.append(String.format("<span class=\"MWebBreadcrumbLastItem %s\">%s</span>", customClasses, MText.getXhtmlEscapedString(viewBreadcrumbs.get(t))));
+            }
+        }
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content.toString())));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onItemSelection".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            String viewCount = parameters.get("viewCount");
+            if (null == viewCount) {
+                throw new MUnexpectedMessageWebException("Invalid message: view count parameter not available.");
+            }
+            int v = 0;
+            try {
+                v = Integer.parseInt(viewCount);
+            }
+            catch (NumberFormatException exception) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: view count parameter not recognized.", viewCount)); // no need to propagate exception
+            }
+            this.onItemSelection(v);
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onItemSelection(int viewCount) {
+        try {
+            this.getViewReference().getBrowserPageReference().unloadViewThreads(null, viewCount, null);
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MViewNotUnloadableWebException exception) {
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebBrowserPage.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebBrowserPage.java
new file mode 100644 (file)
index 0000000..0c1f0e2
--- /dev/null
@@ -0,0 +1,420 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.Random;
+
+public abstract class MWebBrowserPage extends MObject {
+
+    protected MWebApplicationContext applicationContext = null;
+
+    protected int securityId = -1;
+    protected String author = "";
+    protected String cssSource = null;
+
+    protected Object lastViewThreadReturnValue = null;
+    protected Exception lastViewThreadException = null;
+    protected MWebMessage processableMessage = null;
+    protected Object stoppingViewThreadCountMutexObject = new Object();
+    protected int stoppingViewThreadCount = 0;
+    protected boolean forcedLoopMode = false;
+    protected LinkedList<Thread> viewThreads = new LinkedList<Thread>();
+
+    protected LinkedList<String> viewBreadcrumbs = new LinkedList<String>();
+
+    /* */
+
+    public MWebBrowserPage(MWebApplicationContext applicationContext, MWebView defaultView) {
+        super();
+        //
+        if (null == applicationContext) {
+            throw new IllegalArgumentException("Invalid 'applicationContext': null.");
+        }
+        //
+        this.applicationContext = applicationContext;
+        this.loadViewThread(defaultView, false);
+    }
+
+    /* Application context */
+
+    public MWebApplicationContext getApplicationContextReference() {
+        return this.applicationContext;
+    }
+
+    /* Security id */
+
+    protected void resetSecurityId() {
+        this.securityId = (new Random((new Date()).getTime())).nextInt(Integer.MAX_VALUE);
+    }
+
+    protected int getSecurityId() {
+        return this.securityId;
+    }
+
+    /* Author */
+
+    public void setAuthor(String author) {
+        if (null == author) {
+            throw new IllegalArgumentException("Invalid 'author': null.");
+        }
+        //
+        this.author = author;
+        try {
+            this.refreshAuthor();
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    public String getAuthor() {
+        return this.author;
+    }
+
+    /* Css */
+
+    public void setCssSource(String cssSource) {
+        this.cssSource = cssSource;
+        try {
+            this.refreshCssSource();
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    public String getCssSource() {
+        return this.cssSource;
+    }
+
+    /* Views threads */
+
+    protected void setLastViewThreadReturnValue(Object lastViewThreadReturnValue) {
+        this.lastViewThreadReturnValue = lastViewThreadReturnValue;
+    }
+
+    protected Object getLastViewThreadReturnValueReference() {
+        return this.lastViewThreadReturnValue;
+    }
+
+    protected void setLastViewThreadException(Exception lastViewThreadException) {
+        this.lastViewThreadException = lastViewThreadException;
+    }
+
+    protected Exception getLastViewThreadExceptionReference() {
+        return this.lastViewThreadException;
+    }
+
+    protected void setProcessableMessage(MWebMessage processableMessage) {
+        if (null == processableMessage) {
+            throw new IllegalArgumentException("Invalid 'processableMessage': null.");
+        }
+        //
+        this.processableMessage = processableMessage;
+    }
+
+    protected MWebMessage getProcessableMessageReference() {
+        return this.processableMessage;
+    }
+
+    protected MWebMessage getProcessableMessage() throws MNoProcessableMessageWebException {
+        if (null == this.getProcessableMessageReference()) {
+            throw new MNoProcessableMessageWebException("Invalid processable message: reference null.");
+        }
+        //
+        return this.getProcessableMessageReference().clone();
+    }
+
+    protected void setStoppingViewThreadCount(int stoppingViewThreadCount) {
+        if (0 > stoppingViewThreadCount) {
+            throw new IllegalArgumentException(String.format("Invalid 'stoppingViewThreadCount': %s.", stoppingViewThreadCount));
+        }
+        //
+        synchronized (this.stoppingViewThreadCountMutexObject) {
+            this.stoppingViewThreadCount = stoppingViewThreadCount;
+        }
+    }
+
+    protected void decrementStoppingViewThreadCount() {
+        synchronized (this.stoppingViewThreadCountMutexObject) {
+            this.stoppingViewThreadCount--;
+        }
+    }
+
+    protected int getStoppingViewThreadCount() {
+        synchronized (this.stoppingViewThreadCountMutexObject) {
+            return this.stoppingViewThreadCount;
+        }
+    }
+
+    protected void setForcedLoopMode(boolean forcedLoopMode) {
+        this.forcedLoopMode = forcedLoopMode;
+    }
+
+    protected boolean getForcedLoopMode() {
+        return this.forcedLoopMode;
+    }
+
+    protected LinkedList<Thread> getViewThreadsReference() {
+        return this.viewThreads;
+    }
+
+    protected void loadViewThread(MWebView view) {
+        this.loadViewThread(view, true);
+    }
+
+    protected void loadViewThread(MWebView view, boolean start) {
+        if (null == view) {
+            throw new IllegalArgumentException("Invalid 'view': null.");
+        }
+        //
+        view.setBrowserPage(this);
+        //
+        synchronized (this.getViewThreadsReference()) {
+            this.setLastViewThreadReturnValue(null);
+            this.setLastViewThreadException(null);
+            //
+            this.getViewThreadsReference().add(new Thread(view));
+            this.getViewBreadcrumbsReference().add(view.getBreadcrumb());
+            //
+            if (start) {
+                try {
+                    this.setProcessableMessage(new MWebMessage("{\"widgetId\": \"\", \"event\": \"onRefresh\", \"parameters\": {}}"));
+                }
+                catch (MMessagingWebException exception) { // cannot happen
+                }
+                this.getCurrentViewThreadReference().start();
+            }
+        }
+    }
+
+    protected void unloadViewThreads(Object lastViewThreadReturnValue, int viewThreadCount, MWebView replacingView) throws MViewNotUnloadableWebException {
+        if ((null == lastViewThreadReturnValue) && (1 > viewThreadCount) && (null == replacingView)) {
+            throw new IllegalArgumentException("Invalid call mode: (null, < 1, null).");
+        }
+        if (1 > viewThreadCount) {
+            throw new IllegalArgumentException(String.format("Invalid 'viewThreadCount': %s.", viewThreadCount));
+        }
+        else if ((this.getViewThreadCount() <= viewThreadCount) && (null == replacingView)) {
+            throw new MViewNotUnloadableWebException("Invalid 'viewThreadCount': size exceeded.");
+        }
+        //
+        synchronized (this.getViewThreadsReference()) {
+            this.setForcedLoopMode(true);
+            //
+            this.setLastViewThreadReturnValue(lastViewThreadReturnValue);
+            this.setLastViewThreadException(null);
+            //
+            this.setStoppingViewThreadCount(viewThreadCount - 1); // calling view excluded
+            //
+            for (int x = viewThreadCount; x > 0; x--) {
+                Thread t = this.getViewThreadsReference().get(this.getViewThreadCount() - 1);
+                this.getViewThreadsReference().remove(this.getViewThreadCount() - 1);
+                this.getViewBreadcrumbsReference().remove(this.getViewBreadcrumbsReference().size() - 1);
+                synchronized (t) {
+                    t.notify();
+                }
+            }
+            while (this.getStoppingViewThreadCount() > 0) {
+            }
+            //
+            if (null != replacingView) {
+                replacingView.setBrowserPage(this);
+                this.loadViewThread(replacingView, false);
+            }
+            //
+            if (Thread.State.NEW == this.getCurrentViewThreadReference().getState()) {
+                try {
+                    this.setProcessableMessage(new MWebMessage("{\"widgetId\": \"\", \"event\": \"onRefresh\", \"parameters\": {}}"));
+                }
+                catch (MMessagingWebException exception) { // cannot happen
+                }
+                this.getCurrentViewThreadReference().start();
+            }
+            else {
+                synchronized (this.getCurrentViewThreadReference()) {
+                    this.getCurrentViewThreadReference().notify();
+                }
+            }
+            //
+            this.setForcedLoopMode(false);
+        }
+    }
+
+    protected int getViewThreadCount() {
+        synchronized (this.getViewThreadsReference()) {
+            return this.getViewThreadsReference().size();
+        }
+    }
+
+    protected Thread getCurrentViewThreadReference() {
+        synchronized (this.getViewThreadsReference()) {
+            return this.getViewThreadsReference().get(this.getViewThreadCount() - 1);
+        }
+    }
+
+    /* Breadcrumbs */
+
+    protected LinkedList<String> getViewBreadcrumbsReference() {
+        return this.viewBreadcrumbs;
+    }
+
+    public LinkedList<String> getViewBreadcrumbs() {
+        LinkedList<String> viewBreadcrumbs = new LinkedList<String>();
+        for (String viewBreadcrumb: this.getViewBreadcrumbsReference()) {
+            viewBreadcrumbs.add(viewBreadcrumb);
+        }
+        return viewBreadcrumbs;
+    }
+
+    /* Redirection */
+
+    public void redirect(String url) throws MResponseWebException {
+        if (MText.isBlank(url)) {
+            throw new IllegalArgumentException("Invalid 'url': null or empty.");
+        }
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("window.location = '%s';", MText.getJavascriptEscapedString(url)));
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MResponseWebException {
+        this.resetSecurityId();
+        //
+        String cssSource = MText.getXhtmlEscapedString(this.getCssSource());
+        if (null == cssSource) {
+            cssSource = String.format("%s/coreResources/css/default.css", this.getApplicationContextReference().getRequestReference().getRequestURL());
+        }
+        //
+        String NL = System.getProperty("line.separator");
+        StringBuilder content = new StringBuilder("");
+        content.append(String.format("<?xml version=\"1.0\" encoding=\"%s\" ?>", MInformation.TEXT_ENCODING) + NL);
+        content.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + NL);
+        content.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">" + NL);
+        content.append(NL);
+        content.append("    <head>" + NL);
+        content.append(String.format("        <meta name=\"author\" content=\"%s\" />", MText.getXhtmlEscapedString(this.getAuthor())) + NL);
+        content.append(String.format("        <meta name=\"generator\" content=\"%s\" />", MText.getXhtmlEscapedString(MInformation.getMacacoFullName())) + NL);
+        content.append(String.format("        <meta http-equiv=\"Content-type\" content=\"%s\" />", MInformation.HttpContentType.XHTML.toString()) + NL);
+        content.append(String.format("        <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />", cssSource) + NL);
+        content.append("        <title>Loading...</title>" + NL);
+        content.append(String.format("        <script type=\"text/javascript\" src=\"%s/coreResources/javascript/$.js\" />", this.getApplicationContextReference().getRequestReference().getRequestURL()) + NL);
+        content.append(String.format("        <script type=\"text/javascript\" src=\"%s/coreResources/javascript/MWebCustomJsonHelper.js\" />", this.getApplicationContextReference().getRequestReference().getRequestURL()) + NL);
+        content.append(String.format("        <script type=\"text/javascript\" src=\"%s/coreResources/javascript/MWebMessageInterface.js\" />", this.getApplicationContextReference().getRequestReference().getRequestURL()) + NL);
+        content.append(String.format("        <script type=\"text/javascript\" src=\"%s/coreResources/javascript/MWebNotificationArea.js\" />", this.getApplicationContextReference().getRequestReference().getRequestURL()) + NL);
+        content.append(String.format("        <script type=\"text/javascript\" src=\"%s/coreResources/javascript/TinyMCE/tiny_mce.js\" />", this.getApplicationContextReference().getRequestReference().getRequestURL()) + NL);
+        content.append("        <style type=\"text/css\" id=\"m_styleSheet\">" + NL);
+        content.append("        </style>" + NL);
+        content.append("        <script type=\"text/javascript\">" + NL);
+        content.append("        // <![CDATA[" + NL);
+        content.append("            if ('Gecko' == $getRenderingEngine()) {" + NL);
+        content.append("                $('m_styleSheet').innerHTML = '* { -moz-box-sizing: border-box; }';" + NL);
+        content.append("            }" + NL);
+        content.append("            else if ('Ie' == $getRenderingEngine()) {" + NL);
+        content.append("                $('m_styleSheet').innerHTML = '* { -ms-box-sizing: border-box; }';" + NL);
+        content.append("            }" + NL);
+        content.append("            else if ('Webkit' == $getRenderingEngine()) {" + NL);
+        content.append("                $('m_styleSheet').innerHTML = '* { -webkit-box-sizing: border-box; }';" + NL);
+        content.append("            }" + NL);
+        content.append("            else {" + NL);
+        content.append("                $('m_styleSheet').innerHTML = '* { box-sizing: border-box; }';" + NL);
+        content.append("            }" + NL);
+        content.append("            var m_notificationArea = new MWebNotificationArea();" + NL);
+        content.append("            var m_waitingIcon = new Image();" + NL);
+        content.append(String.format("            m_waitingIcon.src = '%s/coreResources/gif/waitingIcon.gif';", this.getApplicationContextReference().getRequestReference().getRequestURL()) + NL);
+        content.append(String.format("            var m_messageInterface = new MWebMessageInterface('%s', '%s', m_waitingIcon);", this.getApplicationContextReference().getRequestReference().getRequestURL(), this.getSecurityId()) + NL);
+        content.append(String.format("            setInterval('m_messageInterface.sendPingRequest();', %s * 1000);", (int)Math.floor(this.getApplicationContextReference().getRequestReference().getSession(false).getMaxInactiveInterval() / 2)) + NL);
+        content.append("        // ]]>" + NL);
+        content.append("        </script>" + NL);
+        content.append("    </head>" + NL);
+        content.append(NL);
+        content.append("    <body onload=\"javascript: m_messageInterface.fireMessage('', 'onRefresh', {});\" onmousemove=\"javascript: m_notificationArea.hide();\" onkeypress=\"javascript: m_notificationArea.hide();\">" + NL);
+        content.append("        <iframe style=\"display: none;\" id=\"m_downloader\" src=\"\"></iframe>" + NL);
+        content.append("        <iframe style=\"display: none;\" id=\"m_uploader\" src=\"\"></iframe>" + NL);
+        content.append("        <div class=\"MWebView\" id=\"m_view\">Loading...</div>" + NL);
+        content.append("    </body>" + NL);
+        content.append(NL);
+        content.append("</html>" + NL);
+        //
+        this.getApplicationContextReference().setXhtmlResponseContent(content.toString());
+    }
+
+    protected void refreshAuthor() throws MResponseWebException { // inspired by http://www.programminghelp.com/forums/Topic81-20-1.aspx#bm334
+        String commands = "metaTags = $T('meta');"
+                        + "for (m = 0; m < metaTags.length; m++) {"
+                        + "    if ('author' == metaTags[m].getAttribute('name')) {"
+                        + "        metaTags[m].setAttribute('content', '%s');"
+                        + "    }"
+                        + "}";
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format(commands, MText.getJavascriptEscapedString(this.getAuthor())));
+    }
+
+    protected void refreshCssSource() throws MResponseWebException { // inspired by http://www.thesitewizard.com/javascripts/change-style-sheets.shtml
+        String cssSource = this.getCssSource();
+        if (null == cssSource) {
+            cssSource = String.format("%s/coreResources/css/default.css", this.getApplicationContextReference().getRequestReference().getRequestURL());
+        }
+        //
+        String commands = "linkTags = $T('link');"
+                        + "for (l = 0; l < linkTags.length; l++) {"
+                        + "    if ('stylesheet' == linkTags[l].rel) {"
+                        + "        linkTags[l].href = '%s';"
+                        + "    }"
+                        + "}";
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format(commands, MText.getJavascriptEscapedString(cssSource)));
+    }
+
+    /* Requests */
+
+    protected void onRequestPreprocessing() throws MBrowserPageRequestPreprocessingWebException {
+    }
+
+    protected void processRequest() throws Exception {
+        // check for proper security id, then determine request type
+        String securityId = this.getApplicationContextReference().getRequestReference().getParameter("securityId");
+        if (null == securityId) {
+            this.refresh();
+        }
+        else if (Integer.parseInt(securityId) != this.getSecurityId()) {
+            throw new MInvalidSecurityIdWebException(String.format("Invalid request: no match for security ids (%s vs %s).", securityId, this.getSecurityId()));
+        }
+        else {
+            String message = this.getApplicationContextReference().getRequestReference().getParameter("message");
+            if (null == message) {
+                throw new MUnexpectedMessageWebException("Invalid request: message null.");
+            }
+            //
+            this.setProcessableMessage(new MWebMessage(message));
+            //
+            this.setLastViewThreadReturnValue(null);
+            this.setLastViewThreadException(null);
+            //
+            if (Thread.State.NEW == this.getCurrentViewThreadReference().getState()) {
+                this.getCurrentViewThreadReference().start();
+            }
+            else {
+                synchronized (this.getCurrentViewThreadReference()) {
+                    this.getCurrentViewThreadReference().notify();
+                }
+            }
+            //
+            while (true) {
+                if (null != this.getLastViewThreadExceptionReference()) {
+                    throw this.getLastViewThreadExceptionReference();
+                }
+                if ((Thread.State.WAITING == this.getCurrentViewThreadReference().getState()) && (!this.getForcedLoopMode())) {
+                    break;
+                }
+            }
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebCellWidget.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebCellWidget.java
new file mode 100644 (file)
index 0000000..d8ec016
--- /dev/null
@@ -0,0 +1,160 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+public abstract class MWebCellWidget extends MWebDisplayWidget {
+
+    public static enum VerticalAlignment {
+        TOP("top"),
+        MIDDLE("middle"),
+        BOTTOM("bottom");
+        private String name = null;
+        private VerticalAlignment(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    public static enum HorizontalAlignment {
+        LEFT("left"),
+        CENTER("center"),
+        RIGHT("right");
+        private String name = null;
+        private HorizontalAlignment(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected MWebCellWidget.VerticalAlignment verticalAlignment = null;
+    protected MWebCellWidget.HorizontalAlignment horizontalAlignment = null;
+
+    /* */
+
+    public MWebCellWidget(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public void cloneCellWidgetProperties(MWebCellWidget cellWidget) {
+        super.cloneDisplayWidgetProperties(cellWidget);
+        //
+        cellWidget.setVerticalAlignment(this.getVerticalAlignment());
+        cellWidget.setHorizontalAlignment(this.getHorizontalAlignment());
+    }
+
+    /* Vertical alignment */
+
+    public void setVerticalAlignment(MWebCellWidget.VerticalAlignment verticalAlignment) {
+        this.setVerticalAlignment(verticalAlignment, true);
+    }
+
+    protected void setVerticalAlignment(MWebCellWidget.VerticalAlignment verticalAlignment, boolean refreshMode) {
+        this.verticalAlignment = verticalAlignment;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshVerticalAlignment(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebCellWidget.VerticalAlignment getVerticalAlignment() {
+        return this.verticalAlignment;
+    }
+
+    public String getFormattedVerticalAlignment() throws MNullPropertyWebException {
+        if (null == this.getVerticalAlignment()) {
+            throw new MNullPropertyWebException("Invalid vertical alignment: property null.");
+        }
+        return this.getVerticalAlignment().toString();
+    }
+
+    /* Horizontal alignment */
+
+    public void setHorizontalAlignment(MWebCellWidget.HorizontalAlignment horizontalAlignment) {
+        this.setHorizontalAlignment(horizontalAlignment, true);
+    }
+
+    protected void setHorizontalAlignment(MWebCellWidget.HorizontalAlignment horizontalAlignment, boolean refreshMode) {
+        this.horizontalAlignment = horizontalAlignment;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshHorizontalAlignment(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebCellWidget.HorizontalAlignment getHorizontalAlignment() {
+        return this.horizontalAlignment;
+    }
+
+    public String getFormattedHorizontalAlignment() throws MNullPropertyWebException {
+        if (null == this.getHorizontalAlignment()) {
+            throw new MNullPropertyWebException("Invalid horizontal alignment: property null.");
+        }
+        return this.getHorizontalAlignment().toString();
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        super.refresh();
+        //
+        this.refreshVerticalAlignment(true);
+        this.refreshHorizontalAlignment(true);
+    }
+
+    protected void refreshVerticalAlignment(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').verticalAlign = '%s'; }", this.getId(), this.getId(), this.getFormattedVerticalAlignment()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('verticalAlign'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshHorizontalAlignment(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').textAlign = '%s'; }", this.getId(), this.getId(), this.getFormattedHorizontalAlignment()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('textAlign'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebCheckBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebCheckBox.java
new file mode 100644 (file)
index 0000000..5a7f744
--- /dev/null
@@ -0,0 +1,172 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebCheckBox extends MWebDirectWidget {
+
+    protected Boolean checkedMode = false;
+
+    protected boolean enabledMode = true;
+
+    /* */
+
+    public MWebCheckBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebCheckBox(MWebApplicationContext applicationContext, Boolean checkedMode) {
+        this(applicationContext);
+        //
+        this.setCheckedMode(checkedMode);
+    }
+
+    /* Focus */
+
+    public void setFocus() {
+        try {
+            this.refreshFocus();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    /* Checked mode */
+
+    public void setCheckedMode(Boolean checkedMode) {
+        this.setCheckedMode(checkedMode, true);
+    }
+
+    protected void setCheckedMode(Boolean checkedMode, boolean refreshMode) {
+        if (null == checkedMode) {
+            throw new IllegalArgumentException("Invalid 'checkedMode': null.");
+        }
+        //
+        this.checkedMode = checkedMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshCheckedMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public Boolean getCheckedMode() {
+        return this.checkedMode;
+    }
+
+    /* Enabled mode */
+
+    public void setEnabledMode(boolean enabledMode) {
+        this.setEnabledMode(enabledMode, true);
+    }
+
+    protected void setEnabledMode(boolean enabledMode, boolean refreshMode) {
+        this.enabledMode = enabledMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshEnabledMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getEnabledMode() {
+        return this.enabledMode;
+    }
+
+    /* Refresh */
+
+    protected void refreshFocus() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').focus(); }", this.getId(), this.getId()));
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onChangeFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onChange', {'checkedMode': (this.checked ? '1' : '0')});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<input type=\"checkbox\" class=\"MWebCheckBox %s\" style=\"display: inline-block;\" onchange=\"%s\" id=\"%s\" />'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onChangeFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshCheckedMode();
+        this.refreshEnabledMode();
+    }
+
+    protected void refreshCheckedMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').checked = %s; }", this.getId(), this.getId(), this.getCheckedMode()));
+    }
+
+    protected void refreshEnabledMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').disabled = %s; }", this.getId(), this.getId(), !this.getEnabledMode()));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onChange".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            String checkedMode = parameters.get("checkedMode");
+            if (null == checkedMode) {
+                throw new MUnexpectedMessageWebException("Invalid message: checked mode parameter not available.");
+            }
+            else if ((!"0".equals(checkedMode)) && (!"1".equals(checkedMode))) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: checked mode parameter not recognized.", checkedMode));
+            }
+            this.onChange("1".equals(checkedMode));
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onChange(boolean checkedMode) {
+        this.setCheckedMode(checkedMode, false);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebColor.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebColor.java
new file mode 100644 (file)
index 0000000..837deaa
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+
+public class MWebColor extends MObject {
+
+    protected Integer color = null;
+
+    /* */
+
+    public MWebColor(Integer color) {
+        super();
+        //
+        if (null == color) {
+            throw new IllegalArgumentException("Invalid 'color': null.");
+        }
+        else if ((0 > color.intValue()) || (0xFFFFFF < color.intValue())) {
+            throw new IllegalArgumentException(String.format("Invalid 'color': %s.", color));
+        }
+        //
+        this.color = color;
+    }
+
+    public MWebColor clone() {
+        return new MWebColor(this.getValue());
+    }
+
+    /* Color */
+
+    public Integer getValue() {
+        return this.color;
+    }
+
+    public String getCssValue() {
+        return "#" + String.format("%6H", this.getValue()).replace(" ", "0");
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebComboBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebComboBox.java
new file mode 100644 (file)
index 0000000..b3befb5
--- /dev/null
@@ -0,0 +1,342 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+
+public class MWebComboBox extends MWebDirectWidget {
+
+    public static enum TextAlignment {
+        LEFT("left"),
+        CENTER("center"),
+        RIGHT("right");
+        private String name = null;
+        private TextAlignment(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected LinkedHashMap<String, String> items = new LinkedHashMap<String, String>();
+    protected String selectedItemKey = "";
+    protected MWebComboBox.TextAlignment textAlignment = null;
+
+    protected boolean enabledMode = true;
+
+    /* */
+
+    public MWebComboBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebComboBox(MWebApplicationContext applicationContext, LinkedHashMap<String, String> items, String selectedItemKey) {
+        this(applicationContext);
+        //
+        this.setItems(items, selectedItemKey);
+    }
+
+    /* Focus */
+
+    public void setFocus() {
+        try {
+            this.refreshFocus();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    /* Items */
+
+    public void setItems(LinkedHashMap<String, String> items, String selectedItemKey) {
+        this.setItems(items, selectedItemKey, true);
+    }
+
+    protected void setItems(LinkedHashMap<String, String> items, String selectedItemKey, boolean refreshMode) {
+        if (null == items) {
+            throw new IllegalArgumentException("Invalid 'items': null.");
+        }
+        else {
+            for (String k: items.keySet()) {
+                if (MText.isBlank(k)) {
+                    throw new IllegalArgumentException("Invalid 'items': item key null or empty.");
+                }
+                else if (null == items.get(k)) {
+                    throw new IllegalArgumentException("Invalid 'items': item null.");
+                }
+            }
+        }
+        //
+        this.items = items;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshItems();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+        //
+        this.setSelectedItem(selectedItemKey, refreshMode);
+    }
+
+    protected LinkedHashMap<String, String> getItemsReference() {
+        return this.items;
+    }
+
+    public LinkedHashMap<String, String> getItems() {
+        LinkedHashMap<String, String> tmpItems = new LinkedHashMap<String, String>();
+        for (String itemKey: this.getItemsReference().keySet()) {
+            tmpItems.put(itemKey, this.getItemsReference().get(itemKey));
+        }
+        return tmpItems;
+    }
+
+    public LinkedHashSet<String> getItemKeys() {
+        LinkedHashSet<String> tmpItemKeys = new LinkedHashSet<String>();
+        for (String itemKey: this.getItemsReference().keySet()) {
+            tmpItemKeys.add(itemKey);
+        }
+        return tmpItemKeys;
+    }
+
+    public void setSelectedItem(String selectedItemKey) {
+        this.setSelectedItem(selectedItemKey, true);
+    }
+
+    protected void setSelectedItem(String selectedItemKey, boolean refreshMode) {
+        if (null == selectedItemKey) {
+            throw new IllegalArgumentException("Invalid 'selectedItemKey': null.");
+        }
+        else if ((!MText.isEmpty(selectedItemKey)) && (!this.getItemsReference().containsKey(selectedItemKey))) {
+            throw new IllegalArgumentException(String.format("Invalid 'selectedItemKey': %s: not available.", selectedItemKey));
+        }
+        //
+        this.selectedItemKey = selectedItemKey;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshSelectedItem();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getSelectedItemKey() {
+        return this.selectedItemKey;
+    }
+
+    public int getSelectedItemIndex() {
+        String selectedItemKey = this.getSelectedItemKey();
+        int selectedItemIndex = 0;
+        if (MText.isEmpty(selectedItemKey)) {
+            return selectedItemIndex;
+        }
+        for (String k: this.getItemsReference().keySet()) {
+            selectedItemIndex++;
+            if (k.equals(selectedItemKey)) {
+                break;
+            }
+        }
+        return selectedItemIndex;
+    }
+
+    /* Text alignment */
+
+    public void setTextAlignment(MWebComboBox.TextAlignment textAlignment) {
+        this.setTextAlignment(textAlignment, true);
+    }
+
+    protected void setTextAlignment(MWebComboBox.TextAlignment textAlignment, boolean refreshMode) {
+        this.textAlignment = textAlignment;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshTextAlignment(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebComboBox.TextAlignment getTextAlignment() {
+        return this.textAlignment;
+    }
+
+    public String getFormattedTextAlignment() throws MNullPropertyWebException {
+        if (null == this.getTextAlignment()) {
+            throw new MNullPropertyWebException("Invalid text alignment: property null.");
+        }
+        return this.getTextAlignment().toString();
+    }
+
+    /* Enabled mode */
+
+    public void setEnabledMode(boolean enabledMode) {
+        this.setEnabledMode(enabledMode, true);
+    }
+
+    protected void setEnabledMode(boolean enabledMode, boolean refreshMode) {
+        this.enabledMode = enabledMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshEnabledMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getEnabledMode() {
+        return this.enabledMode;
+    }
+
+    /* Refresh */
+
+    protected void refreshFocus() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').focus(); }", this.getId(), this.getId()));
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onBlurFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onBlur', {'selectedItemKey': this.value});", this.getId());
+        String onChangeFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onChange', {'selectedItemKey': this.value});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<select class=\"MWebComboBox %s\" style=\"display: inline-block;\" onblur=\"%s\" onchange=\"%s\" id=\"%s\"><option value=\"\"></option></select>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onBlurFunction), MText.getJavascriptEscapedString(onChangeFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshItems();
+        this.refreshSelectedItem();
+        this.refreshTextAlignment(true);
+        this.refreshEnabledMode();
+    }
+
+    protected void refreshItems() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').options.length = 0; }", this.getId(), this.getId()));
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').options[$('%s').options.length] = new Option('', ''); }", this.getId(), this.getId(), this.getId()));
+        for (String itemKey: this.getItemsReference().keySet()) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').options[$('%s').options.length] = new Option('%s', '%s'); }", this.getId(), this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getItemsReference().get(itemKey)), MText.getJavascriptEscapedString(itemKey)));
+        }
+    }
+
+    protected void refreshSelectedItem() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').selectedIndex = %s; }", this.getId(), this.getId(), this.getSelectedItemIndex()));
+    }
+
+    protected void refreshTextAlignment(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').textAlign = '%s'; }", this.getId(), this.getId(), this.getFormattedTextAlignment()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('textAlign'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshEnabledMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').disabled = %s; }", this.getId(), this.getId(), !this.getEnabledMode()));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onBlur".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            String selectedItemKey = parameters.get("selectedItemKey");
+            if (null == selectedItemKey) {
+                throw new MUnexpectedMessageWebException("Invalid message: selected item key parameter not available.");
+            }
+            else if ((!MText.isEmpty(selectedItemKey)) && (!this.getItemsReference().keySet().contains(selectedItemKey))) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected item key parameter not recognized.", selectedItemKey));
+            }
+            this.onBlur(selectedItemKey);
+        }
+        else if ("onChange".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            String selectedItemKey = parameters.get("selectedItemKey");
+            if (null == selectedItemKey) {
+                throw new MUnexpectedMessageWebException("Invalid message: selected item key parameter not available.");
+            }
+            else if ((!MText.isEmpty(selectedItemKey)) && (!this.getItemsReference().keySet().contains(selectedItemKey))) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected item key parameter not recognized.", selectedItemKey));
+            }
+            this.onChange(selectedItemKey);
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onBlur(String selectedItemKey) {
+        this.setSelectedItem(selectedItemKey, false);
+    }
+
+    public void onChange(String selectedItemKey) {
+        this.setSelectedItem(selectedItemKey, false);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDateBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDateBox.java
new file mode 100644 (file)
index 0000000..053c485
--- /dev/null
@@ -0,0 +1,106 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.conversion.MDateConverter;
+import com.marcozanon.macaco.conversion.MFormatConversionException;
+import com.marcozanon.macaco.text.MText;
+import java.util.Date;
+
+public class MWebDateBox extends MWebTextBox {
+
+    protected MDateConverter dateConverter = null;
+
+    /* */
+
+    public MWebDateBox(MWebApplicationContext applicationContext, MDateConverter dateConverter) {
+        super(applicationContext);
+        //
+        if (null == dateConverter) {
+            throw new IllegalArgumentException("Invalid 'dateConverter': null.");
+        }
+        //
+        this.dateConverter = dateConverter;
+    }
+
+    public MWebDateBox(MWebApplicationContext applicationContext, MDateConverter dateConverter, String text) {
+        this(applicationContext, dateConverter);
+        //
+        this.setText(text);
+    }
+
+    public MWebDateBox(MWebApplicationContext applicationContext, MDateConverter dateConverter, Date date) {
+        this(applicationContext, dateConverter);
+        //
+        this.setDate(date);
+    }
+
+    /* Date converter */
+
+    protected MDateConverter getDateConverterReference() {
+        return this.dateConverter;
+    }
+
+    public MDateConverter getDateConverter() {
+        return this.getDateConverterReference().clone();
+    }
+
+    /* Date conversion */
+
+    public void setDate(Date date) {
+        if (null == date) {
+            this.setText("");
+        }
+        else {
+            this.setText(this.getDateConverterReference().getStringFromDate(date));
+        }
+    }
+
+    public Date getDate() throws MFormatConversionException {
+        String text = this.getText();
+        if (!MText.isEmpty(text)) {
+            return this.getDateConverterReference().getDateFromString(text);
+        }
+        return null;
+    }
+
+    /* Validation */
+
+    public void validate() throws MValidationWebException {
+        String text = this.getText();
+        if (!MText.isEmpty(text)) {
+            try {
+                MDateConverter dateConverter = this.getDateConverterReference();
+                this.setText(dateConverter.getStringFromDate(dateConverter.getDateFromString(text)));
+            }
+            catch (MFormatConversionException exception) {
+                throw new MValidationWebException(String.format("Invalid date: %s.", text), exception);
+            }
+        }
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onBlurFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onBlur', {'text': this.value});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<input type=\"text\" class=\"MWebDateBox %s\" style=\"display: inline-block;\" onblur=\"%s\" id=\"%s\" />'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onBlurFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshTextAlignment(true);
+        this.refreshMaximumLength();
+        this.refreshEnabledMode();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDirectWidget.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDirectWidget.java
new file mode 100644 (file)
index 0000000..7d8c057
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+public abstract class MWebDirectWidget extends MWebDisplayWidget {
+
+    /* */
+
+    public MWebDirectWidget(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDisplayWidget.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDisplayWidget.java
new file mode 100644 (file)
index 0000000..0ec0cc3
--- /dev/null
@@ -0,0 +1,929 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+
+public abstract class MWebDisplayWidget extends MWebWidget {
+
+    public static enum Side {
+        TOP("top"),
+        RIGHT("right"),
+        BOTTOM("bottom"),
+        LEFT("left");
+        private String name = null;
+        private Side(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    public static enum TextDirection {
+        LTR("ltr"),
+        RTL("rtl");
+        private String name = null;
+        private TextDirection(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected String customClasses = null;
+
+    protected MWebMeasure width = null;
+    protected MWebMeasure height = null;
+    protected MWebColor foregroundColor = null;
+    protected MWebColor backgroundColor = null;
+    protected MWebBorder topBorder = null;
+    protected MWebBorder rightBorder = null;
+    protected MWebBorder bottomBorder = null;
+    protected MWebBorder leftBorder = null;
+    protected MWebFont font = null;
+    protected MWebMeasure topPadding = null;
+    protected MWebMeasure rightPadding = null;
+    protected MWebMeasure bottomPadding = null;
+    protected MWebMeasure leftPadding = null;
+    protected MWebDisplayWidget.TextDirection textDirection = null;
+
+    protected boolean visibleMode = true;
+
+    /* */
+
+    public MWebDisplayWidget(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public void cloneDisplayWidgetProperties(MWebDisplayWidget displayWidget) {
+        displayWidget.setWidth(this.getWidth());
+        displayWidget.setHeight(this.getHeight());
+        displayWidget.setForegroundColor(this.getForegroundColor());
+        displayWidget.setBackgroundColor(this.getBackgroundColor());
+        displayWidget.setTopBorder(this.getTopBorder());
+        displayWidget.setRightBorder(this.getRightBorder());
+        displayWidget.setBottomBorder(this.getBottomBorder());
+        displayWidget.setLeftBorder(this.getLeftBorder());
+        displayWidget.setFont(this.getFont());
+        displayWidget.setTopPadding(this.getTopPadding());
+        displayWidget.setRightPadding(this.getRightPadding());
+        displayWidget.setBottomPadding(this.getBottomPadding());
+        displayWidget.setLeftPadding(this.getLeftPadding());
+        displayWidget.setTextDirection(this.getTextDirection());
+        displayWidget.setVisibleMode(this.getVisibleMode());
+    }
+
+    /* Custom classes */
+
+    public void setCustomClasses(String customClasses) {
+        this.setCustomClasses(customClasses, true);
+    }
+
+    protected void setCustomClasses(String customClasses, boolean refreshMode) {
+        if (MText.isEmpty(customClasses)) {
+            throw new IllegalArgumentException("Invalid 'customClasses': empty.");
+        }
+        //
+        this.customClasses = customClasses;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public String getCustomClasses() {
+        return this.customClasses;
+    }
+
+    /* Width */
+
+    public void setWidth(MWebMeasure width) {
+        this.setWidth(width, true);
+    }
+
+    protected void setWidth(MWebMeasure width, boolean refreshMode) {
+        this.width = width;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshWidth(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebMeasure getWidthReference() {
+        return this.width;
+    }
+
+    public MWebMeasure getWidth() {
+        if (null == this.getWidthReference()) {
+            return null;
+        }
+        return this.getWidthReference().clone();
+    }
+
+    public String getFormattedWidth() throws MNullPropertyWebException {
+        if (null == this.getWidthReference()) {
+            throw new MNullPropertyWebException("Invalid width: reference null.");
+        }
+        return this.getWidthReference().getCssValue();
+    }
+
+    /* Height */
+
+    public void setHeight(MWebMeasure height) {
+        this.setHeight(height, true);
+    }
+
+    protected void setHeight(MWebMeasure height, boolean refreshMode) {
+        this.height = height;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshHeight(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebMeasure getHeightReference() {
+        return this.height;
+    }
+
+    public MWebMeasure getHeight() {
+        if (null == this.getHeightReference()) {
+            return null;
+        }
+        return this.getHeightReference().clone();
+    }
+
+    public String getFormattedHeight() throws MNullPropertyWebException {
+        if (null == this.getHeightReference()) {
+            throw new MNullPropertyWebException("Invalid height: reference null.");
+        }
+        return this.getHeightReference().getCssValue();
+    }
+
+    /* Foreground color */
+
+    public void setForegroundColor(MWebColor foregroundColor) {
+        this.setForegroundColor(foregroundColor, true);
+    }
+
+    protected void setForegroundColor(MWebColor foregroundColor, boolean refreshMode) {
+        this.foregroundColor = foregroundColor;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshForegroundColor(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebColor getForegroundColorReference() {
+        return this.foregroundColor;
+    }
+
+    public MWebColor getForegroundColor() {
+        if (null == this.getForegroundColorReference()) {
+            return null;
+        }
+        return this.getForegroundColorReference().clone();
+    }
+
+    public String getFormattedForegroundColor() throws MNullPropertyWebException {
+        if (null == this.getForegroundColorReference()) {
+            throw new MNullPropertyWebException("Invalid foreground color: reference null.");
+        }
+        return this.getForegroundColorReference().getCssValue();
+    }
+
+    /* Background color */
+
+    public void setBackgroundColor(MWebColor backgroundColor) {
+        this.setBackgroundColor(backgroundColor, true);
+    }
+
+    protected void setBackgroundColor(MWebColor backgroundColor, boolean refreshMode) {
+        this.backgroundColor = backgroundColor;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshBackgroundColor(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebColor getBackgroundColorReference() {
+        return this.backgroundColor;
+    }
+
+    public MWebColor getBackgroundColor() {
+        if (null == this.getBackgroundColorReference()) {
+            return null;
+        }
+        return this.getBackgroundColorReference().clone();
+    }
+
+    public String getFormattedBackgroundColor() throws MNullPropertyWebException {
+        if (null == this.getBackgroundColorReference()) {
+            throw new MNullPropertyWebException("Invalid background color: reference null.");
+        }
+        return this.getBackgroundColorReference().getCssValue();
+    }
+
+    /* Borders */
+
+    public void setTopBorder(MWebBorder border) {
+        this.setTopBorder(border, true);
+    }
+
+    protected void setTopBorder(MWebBorder border, boolean refreshMode) {
+        this.setBorder(border, MWebDisplayWidget.Side.TOP, refreshMode);
+    }
+
+    public void setRightBorder(MWebBorder border) {
+        this.setRightBorder(border, true);
+    }
+
+    protected void setRightBorder(MWebBorder border, boolean refreshMode) {
+        this.setBorder(border, MWebDisplayWidget.Side.RIGHT, refreshMode);
+    }
+
+    public void setBottomBorder(MWebBorder border) {
+        this.setBottomBorder(border, true);
+    }
+
+    protected void setBottomBorder(MWebBorder border, boolean refreshMode) {
+        this.setBorder(border, MWebDisplayWidget.Side.BOTTOM, refreshMode);
+    }
+
+    public void setLeftBorder(MWebBorder border) {
+        this.setLeftBorder(border, true);
+    }
+
+    protected void setLeftBorder(MWebBorder border, boolean refreshMode) {
+        this.setBorder(border, MWebDisplayWidget.Side.LEFT, refreshMode);
+    }
+
+    public void setBorder(MWebBorder border) {
+        this.setBorder(border, null, true);
+    }
+
+    protected void setBorder(MWebBorder border, boolean refreshMode) {
+        this.setBorder(border, null, refreshMode);
+    }
+
+    public void setBorder(MWebBorder border, MWebDisplayWidget.Side borderSide) {
+        this.setBorder(border, borderSide, true);
+    }
+
+    protected void setBorder(MWebBorder border, MWebDisplayWidget.Side borderSide, boolean refreshMode) {
+        if (null == borderSide) {
+            this.topBorder = border;
+            this.rightBorder = border;
+            this.bottomBorder = border;
+            this.leftBorder = border;
+        }
+        else if (MWebDisplayWidget.Side.TOP == borderSide) {
+            this.topBorder = border;
+        }
+        else if (MWebDisplayWidget.Side.RIGHT == borderSide) {
+            this.rightBorder = border;
+        }
+        else if (MWebDisplayWidget.Side.BOTTOM == borderSide) {
+            this.bottomBorder = border;
+        }
+        else if (MWebDisplayWidget.Side.LEFT == borderSide) {
+            this.leftBorder = border;
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refreshBorder(borderSide, false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebBorder getTopBorderReference() {
+        return this.topBorder;
+    }
+
+    public MWebBorder getTopBorder() {
+        if (null == this.getTopBorderReference()) {
+            return null;
+        }
+        return this.getTopBorderReference().clone();
+    }
+
+    public String getFormattedTopBorder() throws MNullPropertyWebException {
+        if (null == this.getTopBorderReference()) {
+            throw new MNullPropertyWebException("Invalid top border: reference null.");
+        }
+        return this.getTopBorderReference().getCssValue();
+    }
+
+    protected MWebBorder getRightBorderReference() {
+        return this.rightBorder;
+    }
+
+    public MWebBorder getRightBorder() {
+        if (null == this.getRightBorderReference()) {
+            return null;
+        }
+        return this.getRightBorderReference().clone();
+    }
+
+    public String getFormattedRightBorder() throws MNullPropertyWebException {
+        if (null == this.getRightBorderReference()) {
+            throw new MNullPropertyWebException("Invalid right border: reference null.");
+        }
+        return this.getRightBorderReference().getCssValue();
+    }
+
+    protected MWebBorder getBottomBorderReference() {
+        return this.bottomBorder;
+    }
+
+    public MWebBorder getBottomBorder() {
+        if (null == this.getBottomBorderReference()) {
+            return null;
+        }
+        return this.getBottomBorderReference().clone();
+    }
+
+    public String getFormattedBottomBorder() throws MNullPropertyWebException {
+        if (null == this.getBottomBorderReference()) {
+            throw new MNullPropertyWebException("Invalid bottom border: reference null.");
+        }
+        return this.getBottomBorderReference().getCssValue();
+    }
+
+    protected MWebBorder getLeftBorderReference() {
+        return this.leftBorder;
+    }
+
+    public MWebBorder getLeftBorder() {
+        if (null == this.getLeftBorderReference()) {
+            return null;
+        }
+        return this.getLeftBorderReference().clone();
+    }
+
+    public String getFormattedLeftBorder() throws MNullPropertyWebException {
+        if (null == this.getLeftBorderReference()) {
+            throw new MNullPropertyWebException("Invalid left border: reference null.");
+        }
+        return this.getLeftBorderReference().getCssValue();
+    }
+
+    /* Font */
+
+    public void setFont(MWebFont font) {
+        this.setFont(font, true);
+    }
+
+    protected void setFont(MWebFont font, boolean refreshMode) {
+        this.font = font;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshFont(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebFont getFontReference() {
+        return this.font;
+    }
+
+    public MWebFont getFont() {
+        if (null == this.getFontReference()) {
+            return null;
+        }
+        return this.getFontReference().clone();
+    }
+
+    public String[] getFormattedFont() throws MNullPropertyWebException {
+        if (null == this.getFontReference()) {
+            throw new MNullPropertyWebException("Invalid font: reference null.");
+        }
+        return this.getFontReference().getCssValue();
+    }
+
+    /* Paddings */
+
+    public void setTopPadding(MWebMeasure padding) {
+        this.setTopPadding(padding, true);
+    }
+
+    protected void setTopPadding(MWebMeasure padding, boolean refreshMode) {
+        this.setPadding(padding, MWebDisplayWidget.Side.TOP, refreshMode);
+    }
+
+    public void setRightPadding(MWebMeasure padding) {
+        this.setRightPadding(padding, true);
+    }
+
+    protected void setRightPadding(MWebMeasure padding, boolean refreshMode) {
+        this.setPadding(padding, MWebDisplayWidget.Side.RIGHT, refreshMode);
+    }
+
+    public void setBottomPadding(MWebMeasure padding) {
+        this.setBottomPadding(padding, true);
+    }
+
+    protected void setBottomPadding(MWebMeasure padding, boolean refreshMode) {
+        this.setPadding(padding, MWebDisplayWidget.Side.BOTTOM, refreshMode);
+    }
+
+    public void setLeftPadding(MWebMeasure padding) {
+        this.setLeftPadding(padding, true);
+    }
+
+    protected void setLeftPadding(MWebMeasure padding, boolean refreshMode) {
+        this.setPadding(padding, MWebDisplayWidget.Side.LEFT, refreshMode);
+    }
+
+    public void setPadding(MWebMeasure padding) {
+        this.setPadding(padding, null, true);
+    }
+
+    protected void setPadding(MWebMeasure padding, boolean refreshMode) {
+        this.setPadding(padding, null, refreshMode);
+    }
+
+    public void setPadding(MWebMeasure padding, MWebDisplayWidget.Side paddingSide) {
+        this.setPadding(padding, paddingSide, true);
+    }
+
+    protected void setPadding(MWebMeasure padding, MWebDisplayWidget.Side paddingSide, boolean refreshMode) {
+        if (null == paddingSide) {
+            this.topPadding = padding;
+            this.rightPadding = padding;
+            this.bottomPadding = padding;
+            this.leftPadding = padding;
+        }
+        else if (MWebDisplayWidget.Side.TOP == paddingSide) {
+            this.topPadding = padding;
+        }
+        else if (MWebDisplayWidget.Side.RIGHT == paddingSide) {
+            this.rightPadding = padding;
+        }
+        else if (MWebDisplayWidget.Side.BOTTOM == paddingSide) {
+            this.bottomPadding = padding;
+        }
+        else if (MWebDisplayWidget.Side.LEFT == paddingSide) {
+            this.leftPadding = padding;
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refreshPadding(paddingSide, false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    protected MWebMeasure getTopPaddingReference() {
+        return this.topPadding;
+    }
+
+    public MWebMeasure getTopPadding() {
+        if (null == this.getTopPaddingReference()) {
+            return null;
+        }
+        return this.getTopPaddingReference().clone();
+    }
+
+    public String getFormattedTopPadding() throws MNullPropertyWebException {
+        if (null == this.getTopPaddingReference()) {
+            throw new MNullPropertyWebException("Invalid top padding: reference null.");
+        }
+        return this.getTopPaddingReference().getCssValue();
+    }
+
+    protected MWebMeasure getRightPaddingReference() {
+        return this.rightPadding;
+    }
+
+    public MWebMeasure getRightPadding() {
+        if (null == this.getRightPaddingReference()) {
+            return null;
+        }
+        return this.getRightPaddingReference().clone();
+    }
+
+    public String getFormattedRightPadding() throws MNullPropertyWebException {
+        if (null == this.getRightPaddingReference()) {
+            throw new MNullPropertyWebException("Invalid right padding: reference null.");
+        }
+        return this.getRightPaddingReference().getCssValue();
+    }
+
+    protected MWebMeasure getBottomPaddingReference() {
+        return this.bottomPadding;
+    }
+
+    public MWebMeasure getBottomPadding() {
+        if (null == this.getBottomPaddingReference()) {
+            return null;
+        }
+        return this.getBottomPaddingReference().clone();
+    }
+
+    public String getFormattedBottomPadding() throws MNullPropertyWebException {
+        if (null == this.getBottomPaddingReference()) {
+            throw new MNullPropertyWebException("Invalid bottom padding: reference null.");
+        }
+        return this.getBottomPaddingReference().getCssValue();
+    }
+
+    protected MWebMeasure getLeftPaddingReference() {
+        return this.leftPadding;
+    }
+
+    public MWebMeasure getLeftPadding() {
+        if (null == this.getLeftPaddingReference()) {
+            return null;
+        }
+        return this.getLeftPaddingReference().clone();
+    }
+
+    public String getFormattedLeftPadding() throws MNullPropertyWebException {
+        if (null == this.getLeftPaddingReference()) {
+            throw new MNullPropertyWebException("Invalid left padding: reference null.");
+        }
+        return this.getLeftPaddingReference().getCssValue();
+    }
+
+    /* Text direction */
+
+    public void setTextDirection(MWebDisplayWidget.TextDirection textDirection) {
+        this.setTextDirection(textDirection, true);
+    }
+
+    protected void setTextDirection(MWebDisplayWidget.TextDirection textDirection, boolean refreshMode) {
+        this.textDirection = textDirection;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshTextDirection(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebDisplayWidget.TextDirection getTextDirection() {
+        return this.textDirection;
+    }
+
+    public String getFormattedTextDirection() throws MNullPropertyWebException {
+        if (null == this.getTextDirection()) {
+            throw new MNullPropertyWebException("Invalid text direction: property null.");
+        }
+        return this.getTextDirection().toString();
+    }
+
+    /* Visible mode */
+
+    public void setVisibleMode(boolean visibleMode) {
+        this.setVisibleMode(visibleMode, true);
+    }
+
+    protected void setVisibleMode(boolean visibleMode, boolean refreshMode) {
+        this.visibleMode = visibleMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshVisibleMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getVisibleMode() {
+        return this.visibleMode;
+    }
+
+    /* Display widgets */
+
+    protected MWebDisplayWidget getDisplayWidgetReferenceById(String id) throws MDisplayWidgetNotFoundWebException {
+        if (MText.isBlank(id)) {
+            throw new IllegalArgumentException("Invalid 'id': null or empty.");
+        }
+        //
+        String myId = null;
+        try {
+            myId = this.getId();
+        }
+        catch (MNoWidgetIdWebException exception) {
+            throw new MDisplayWidgetNotFoundWebException("Display widget id not available."); // no need to propagate exception
+        }
+        if (myId.equals(id)) {
+            return this;
+        }
+        throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: display widget not available on this path.", id));
+    }
+
+    /* Validation */
+
+    public void validate() throws MValidationWebException {
+    }
+
+    /* Refresh */
+
+    public void checkPresence() throws MNoBrowserPageWebException, MNoViewWebException {
+        this.getViewReference().checkPresence();
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        this.refreshWidth(true);
+        this.refreshHeight(true);
+        this.refreshForegroundColor(true);
+        this.refreshBackgroundColor(true);
+        this.refreshBorder(null, true);
+        this.refreshFont(true);
+        this.refreshPadding(null, true);
+        this.refreshTextDirection(true);
+        //
+        this.refreshVisibleMode();
+    }
+
+    protected void refreshWidth(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').width = '%s'; }", this.getId(), this.getId(), this.getFormattedWidth()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('width'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshHeight(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').height = '%s'; }", this.getId(), this.getId(), this.getFormattedHeight()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('height'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshForegroundColor(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').color = '%s'; }", this.getId(), this.getId(), this.getFormattedForegroundColor()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('color'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshBackgroundColor(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').backgroundColor = '%s'; }", this.getId(), this.getId(), this.getFormattedBackgroundColor()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('backgroundColor'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshBorder(MWebDisplayWidget.Side borderSide, boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (null == borderSide) {
+            this.refreshBorder(MWebDisplayWidget.Side.TOP, directRefreshMode);
+            this.refreshBorder(MWebDisplayWidget.Side.RIGHT, directRefreshMode);
+            this.refreshBorder(MWebDisplayWidget.Side.BOTTOM, directRefreshMode);
+            this.refreshBorder(MWebDisplayWidget.Side.LEFT, directRefreshMode);
+        }
+        else {
+            String temporaryBorderSide = null;
+            try {
+                String formattedBorder = null;
+                if (MWebDisplayWidget.Side.TOP == borderSide) {
+                    temporaryBorderSide = "Top";
+                    formattedBorder = this.getFormattedTopBorder();
+                }
+                else if (MWebDisplayWidget.Side.RIGHT == borderSide) {
+                    temporaryBorderSide = "Right";
+                    formattedBorder = this.getFormattedRightBorder();
+                }
+                else if (MWebDisplayWidget.Side.BOTTOM == borderSide) {
+                    temporaryBorderSide = "Bottom";
+                    formattedBorder = this.getFormattedBottomBorder();
+                }
+                else if (MWebDisplayWidget.Side.LEFT == borderSide) {
+                    temporaryBorderSide = "Left";
+                    formattedBorder = this.getFormattedLeftBorder();
+                }
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').border%s = '%s'; }", this.getId(), this.getId(), temporaryBorderSide, formattedBorder));
+            }
+            catch (MNullPropertyWebException exception) {
+                if (!directRefreshMode) {
+                    this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('border%s'); }", this.getId(), this.getId(), temporaryBorderSide));
+                }
+            }
+        }
+    }
+
+    protected void refreshFont(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            String[] formattedFont = this.getFormattedFont();
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').font = '%s'; }", this.getId(), this.getId(), formattedFont[0]));
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').textDecoration = '%s'; }", this.getId(), this.getId(), formattedFont[1]));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('font'); }", this.getId(), this.getId()));
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('textDecoration'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshPadding(MWebDisplayWidget.Side paddingSide, boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (null == paddingSide) {
+            this.refreshPadding(MWebDisplayWidget.Side.TOP, directRefreshMode);
+            this.refreshPadding(MWebDisplayWidget.Side.RIGHT, directRefreshMode);
+            this.refreshPadding(MWebDisplayWidget.Side.BOTTOM, directRefreshMode);
+            this.refreshPadding(MWebDisplayWidget.Side.LEFT, directRefreshMode);
+        }
+        else {
+            String temporaryPaddingSide = null;
+            try {
+                String formattedPadding = null;
+                if (MWebDisplayWidget.Side.TOP == paddingSide) {
+                    temporaryPaddingSide = "Top";
+                    formattedPadding = this.getFormattedTopPadding();
+                }
+                else if (MWebDisplayWidget.Side.RIGHT == paddingSide) {
+                    temporaryPaddingSide = "Right";
+                    formattedPadding = this.getFormattedRightPadding();
+                }
+                else if (MWebDisplayWidget.Side.BOTTOM == paddingSide) {
+                    temporaryPaddingSide = "Bottom";
+                    formattedPadding = this.getFormattedBottomPadding();
+                }
+                else if (MWebDisplayWidget.Side.LEFT == paddingSide) {
+                    temporaryPaddingSide = "Left";
+                    formattedPadding = this.getFormattedLeftPadding();
+                }
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').padding%s = '%s'; }", this.getId(), this.getId(), temporaryPaddingSide, formattedPadding));
+            }
+            catch (MNullPropertyWebException exception) {
+                if (!directRefreshMode) {
+                    this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('padding%s'); }", this.getId(), this.getId(), temporaryPaddingSide));
+                }
+            }
+        }
+    }
+
+    protected void refreshTextDirection(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').direction = '%s'; }", this.getId(), this.getId(), this.getFormattedTextDirection()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('direction'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshVisibleMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (this.getVisibleMode()) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').visibility = 'visible'; }", this.getId(), this.getId()));
+        }
+        else {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').visibility = 'hidden'; }", this.getId(), this.getId()));
+        }
+    }
+
+    /* Messages */
+
+    public void onRefresh() {
+        try {
+            this.refresh();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+        catch (MUniqueWidgetIdNotAvailableWebException exception) {
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDownloader.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebDownloader.java
new file mode 100644 (file)
index 0000000..a163088
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.json.MInvalidValueJsonException;
+import com.marcozanon.macaco.json.MJsonObject;
+import com.marcozanon.macaco.json.MJsonString;
+import java.util.LinkedHashMap;
+
+public class MWebDownloader extends MWebWidget {
+
+    /* */
+
+    public MWebDownloader(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    /* Downloads */
+
+    public void forceDownload() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        MJsonObject downloadMessage = null;
+        try {
+            downloadMessage = new MJsonObject();
+            downloadMessage.setValue("widgetId", new MJsonString("\"" + this.getId() + "\""));
+            downloadMessage.setValue("event", new MJsonString("\"" + "onDownload" + "\""));
+            downloadMessage.setValue("parameters", new MJsonObject());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+        }
+        //
+        MWebBrowserPage browserPage = this.getViewReference().getBrowserPageReference();
+        String destinationUrl = this.getApplicationContextReference().getRequestReference().getRequestURL().toString();
+        String parameters = "securityId=" + browserPage.getSecurityId() + "&message=" + downloadMessage.getJsonValue();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("$('m_downloader').src = '%s?%s';", destinationUrl, parameters));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onDownload".equals(event)) {
+            this.onDownload();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onDownload() {
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebException.java
new file mode 100644 (file)
index 0000000..4bee9aa
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MException;
+
+public abstract class MWebException extends MException {
+
+    /* */
+
+    public MWebException() {
+        super();
+    }
+
+    public MWebException(String message) {
+        super(message);
+    }
+
+    public MWebException(Throwable error) {
+        super(error);
+    }
+
+    public MWebException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebExtendedTextBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebExtendedTextBox.java
new file mode 100644 (file)
index 0000000..1f5b221
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MWebExtendedTextBox extends MWebTextBox {
+
+    /* */
+
+    public MWebExtendedTextBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebExtendedTextBox(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onBlurFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onBlur', {'text': this.value});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<textarea class=\"MWebExtendedTextBox %s\" style=\"display: inline-block;\" onblur=\"%s\" id=\"%s\" cols=\"1\" rows=\"1\"></textarea>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onBlurFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshTextAlignment(true);
+        this.refreshMaximumLength();
+        this.refreshEnabledMode();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebFont.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebFont.java
new file mode 100644 (file)
index 0000000..eba7f87
--- /dev/null
@@ -0,0 +1,159 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+
+public class MWebFont extends MObject {
+
+    public static enum Style {
+        ITALIC("italic"),
+        NORMAL("normal"),
+        OBLIQUE("oblique");
+        private String name = null;
+        private Style(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    public static enum Variant {
+        NORMAL("normal"),
+        SMALL_CAPS("small-caps");
+        private String name = null;
+        private Variant(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    public static enum Weight {
+        BOLD("bold"),
+        BOLDER("bolder"),
+        LIGHTER("lighter"),
+        NORMAL("normal");
+        private String name = null;
+        private Weight(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    public static final String MONOSPACE_FAMILY = "monospace";
+    public static final String SANS_SERIF_FAMILY = "sans-serif";
+    public static final String SERIF_FAMILY = "serif";
+
+    public static enum Decoration {
+        BLINK("blink"),
+        LINE_THROUGH("line-through"),
+        NONE("none"),
+        OVERLINE("overline"),
+        UNDERLINE("underline");
+        private String name = null;
+        private Decoration(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected MWebFont.Style style = null;
+    protected MWebFont.Variant variant = null;
+    protected MWebFont.Weight weight = null;
+    protected MWebMeasure size = null;
+    protected String family = null;
+    protected MWebFont.Decoration decoration = null;
+
+    /* */
+
+    public MWebFont(MWebFont.Style style, MWebFont.Variant variant, MWebFont.Weight weight, MWebMeasure size, String family, MWebFont.Decoration decoration) {
+        super();
+        //
+        if (null == style) {
+            throw new IllegalArgumentException("Invalid 'style': null.");
+        }
+        if (null == variant) {
+            throw new IllegalArgumentException("Invalid 'variant': null.");
+        }
+        if (null == weight) {
+            throw new IllegalArgumentException("Invalid 'weight': null.");
+        }
+        if (null == size) {
+            throw new IllegalArgumentException("Invalid 'size': null.");
+        }
+        if (MText.isBlank(family)) {
+            throw new IllegalArgumentException("Invalid 'family': null or empty.");
+        }
+        if (null == decoration) {
+            throw new IllegalArgumentException("Invalid 'decoration': null.");
+        }
+        //
+        this.style = style;
+        this.variant = variant;
+        this.weight = weight;
+        this.size = size;
+        this.family = family;
+        this.decoration = decoration;
+    }
+
+    public MWebFont clone() {
+        return new MWebFont(this.getStyle(), this.getVariant(), this.getWeight(), this.getSizeReference().clone(), this.getFamily(), this.getDecoration());
+    }
+
+    /* Font */
+
+    protected MWebFont.Style getStyle() {
+        return this.style;
+    }
+
+    protected MWebFont.Variant getVariant() {
+        return this.variant;
+    }
+
+    protected MWebFont.Weight getWeight() {
+        return this.weight;
+    }
+
+    protected MWebMeasure getSizeReference() {
+        return this.size;
+    }
+
+    protected String getFamily() {
+        return this.family;
+    }
+
+    protected MWebFont.Decoration getDecoration() {
+        return this.decoration;
+    }
+
+    public Object[] getValue() {
+        Object[] value = new Object[6];
+        value[0] = this.getStyle();
+        value[1] = this.getVariant();
+        value[2] = this.getWeight();
+        value[3] = this.getSizeReference().clone();
+        value[4] = this.getFamily();
+        value[5] = this.getDecoration();
+        return value;
+    }
+
+    public String[] getCssValue() {
+        String[] formattedValue = new String[2];
+        formattedValue[0] = this.getStyle().toString() + " " + this.getVariant().toString() + " " + this.getWeight().toString() + " " + this.getSizeReference().getCssValue() + " " + this.getFamily();
+        formattedValue[1] = this.getDecoration().toString();
+        return formattedValue;
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebGridLayout.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebGridLayout.java
new file mode 100644 (file)
index 0000000..fb2aa71
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebGridLayout extends MWebDirectWidget {
+
+    protected MWebGridLayoutCell[][] cells = null;
+
+    /* */
+
+    public MWebGridLayout(MWebApplicationContext applicationContext, int rowCount, int columnCount) {
+        super(applicationContext);
+        //
+        this.setWidth(new MWebMeasure(100, MWebMeasure.Unit.PERCENT)); // manual override
+        //
+        if (1 > rowCount) {
+            throw new IllegalArgumentException(String.format("Invalid 'rowCount': %s.", rowCount));
+        }
+        if (1 > columnCount) {
+            throw new IllegalArgumentException(String.format("Invalid 'columnCount': %s.", columnCount));
+        }
+        //
+        this.cells = new MWebGridLayoutCell[rowCount][columnCount];
+        for (int r = 0; r < rowCount; r++) {
+            for (int c = 0; c < columnCount; c++) {
+                this.cells[r][c] = new MWebGridLayoutCell(this.getApplicationContextReference(), this);
+            }
+        }
+    }
+
+    /* Cells */
+
+    public int getRowCount() {
+        if (null == this.getCellsReference()) {
+            return 0;
+        }
+        return this.getCellsReference().length;
+    }
+
+    public int getColumnCount() {
+        if (null == this.getCellsReference()) {
+            return 0;
+        }
+        return this.getCellsReference()[0].length;
+    }
+
+    protected MWebGridLayoutCell[][] getCellsReference() {
+        return this.cells;
+    }
+
+    public MWebGridLayoutCell getCellReference(int rowIndex, int columnIndex) {
+        if ((0 > rowIndex) || ((this.getCellsReference().length - 1) < rowIndex)) {
+            throw new IllegalArgumentException(String.format("Invalid 'rowIndex': %s.", rowIndex));
+        }
+        if ((0 > columnIndex) || ((this.getCellsReference()[0].length - 1) < columnIndex)) {
+            throw new IllegalArgumentException(String.format("Invalid 'columnIndex': %s.", columnIndex));
+        }
+        //
+        return this.getCellsReference()[rowIndex][columnIndex];
+    }
+
+    /* View */
+
+    protected void setView(MWebView view) throws MUniqueWidgetIdNotAvailableWebException {
+        super.setView(view);
+        //
+        for (int r = 0; this.getRowCount() > r; r++) {
+            for (int c = 0; this.getColumnCount() > c; c++) {
+                this.getCellReference(r, c).setView(view);
+            }
+        }
+    }
+
+    /* Display widgets */
+
+    protected MWebDisplayWidget getDisplayWidgetReferenceById(String id) throws MDisplayWidgetNotFoundWebException {
+        try {
+            return super.getDisplayWidgetReferenceById(id);
+        }
+        catch (MDisplayWidgetNotFoundWebException exception) {
+            for (int r = 0; this.getRowCount() > r; r++) {
+                for (int c = 0; this.getColumnCount() > c; c++) {
+                    try {
+                        return this.getCellReference(r, c).getDisplayWidgetReferenceById(id);
+                    }
+                    catch (MDisplayWidgetNotFoundWebException exception2) {
+                    }
+                }
+            }
+            throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: display widget not available on this path.", id)); // no need to propagate exception
+        }
+    }
+
+    /* Refresh */
+
+    protected boolean isCellRefreshable(int rowIndex, int columnIndex) {
+        if ((0 > rowIndex) || ((this.getCellsReference().length - 1) < rowIndex)) {
+            throw new IllegalArgumentException(String.format("Invalid 'rowIndex': %s.", rowIndex));
+        }
+        if ((0 > columnIndex) || ((this.getCellsReference()[0].length - 1) < columnIndex)) {
+            throw new IllegalArgumentException(String.format("Invalid 'columnIndex': %s.", columnIndex));
+        }
+        //
+        int[][] cellsRefreshableMode = new int[rowIndex + 1][columnIndex + 1]; // to avoid recursion
+        for (int r = 0; r <= rowIndex; r++) {
+            for (int c = 0; c <= columnIndex; c++) {
+                if (0 > cellsRefreshableMode[r][c]) {
+                    continue;
+                }
+                cellsRefreshableMode[r][c] = 1;
+                int rs = this.getCellReference(r, c).getRowSpan();
+                int cs = this.getCellReference(r, c).getColumnSpan();
+                if ((1 < rs) || (1 < cs)) {
+                    for (int rsi = r + 1; Math.min(rowIndex, r + rs - 1) >= rsi; rsi++) {
+                        for (int csi = c + 1; Math.min(columnIndex, c + cs - 1) >= csi; csi++) {
+                            cellsRefreshableMode[rsi][csi] = -1;
+                        }
+                    }
+                }
+                if ((r == rowIndex) && (c == columnIndex)) {
+                    return true;
+                }
+                if ((0 < cellsRefreshableMode[r][c]) && ((r + this.getCellReference(r, c).getRowSpan() - 1) >= rowIndex) && ((c + this.getCellReference(r, c).getColumnSpan() - 1) >= columnIndex)) {
+                    return false;
+                }
+            }
+        }
+        //
+        return true; // necessary to avoid Java compilation errors
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        StringBuilder content = new StringBuilder("");
+        content.append(String.format("<table class=\"MWebGridLayoutTable %s\" style=\"display: inline-table;\" id=\"%s\">", customClasses, this.getId()));
+        for (int r = 0; this.getRowCount() > r; r++) {
+            content.append(String.format("<tr class=\"MWebGridLayoutRow %s\">", customClasses));
+            for (int c = 0; this.getColumnCount() > c; c++) {
+                String displayedMode = "";
+                if (!this.isCellRefreshable(r, c)) {
+                    displayedMode = "display: none;";
+                    this.getCellReference(r, c).setVisibleMode(false, false); 
+                }
+                content.append(String.format("<td class=\"MWebGridLayoutCell %s\" style=\"%s\" id=\"%s\" rowspan=\"%s\" colspan=\"%s\"></td>", customClasses, displayedMode, this.getCellReference(r, c).getId(), Math.min(this.getCellReference(r, c).getRowSpan(), this.getRowCount() - r), Math.min(this.getCellReference(r, c).getColumnSpan(), this.getColumnCount() - c)));
+            }
+            content.append("</tr>");
+        }
+        content.append("</table>");
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content.toString())));
+        //
+        for (int r = 0; this.getRowCount() > r; r++) {
+            for (int c = 0; this.getColumnCount() > c; c++) {
+                this.getCellReference(r, c).onRefresh();
+            }
+        }
+        //
+        super.refresh();
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebGridLayoutCell.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebGridLayoutCell.java
new file mode 100644 (file)
index 0000000..359f152
--- /dev/null
@@ -0,0 +1,211 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import java.util.LinkedHashMap;
+
+public class MWebGridLayoutCell extends MWebCellWidget {
+
+    protected MWebDirectWidget content = null;
+
+    protected MWebGridLayout container = null;
+
+    protected int rowSpan = 1;
+    protected int columnSpan = 1;
+
+    /* */
+
+    public MWebGridLayoutCell(MWebApplicationContext applicationContext, MWebGridLayout container) {
+        super(applicationContext);
+        //
+        if (null == container) {
+            throw new IllegalArgumentException("Invalid 'container': null.");
+        }
+        //
+        this.container = container;
+    }
+
+    /* Content */
+
+    public void setContent(MWebDirectWidget directWidget) throws MUniqueWidgetIdNotAvailableWebException {
+        this.setContent(directWidget, true);
+    }
+
+    protected void setContent(MWebDirectWidget directWidget, boolean refreshMode) throws MUniqueWidgetIdNotAvailableWebException {
+        try {
+            this.getContentReference().setView(null);
+        }
+        catch (MNoCellContentWebException exception) {
+        }
+        catch (MUniqueWidgetIdNotAvailableWebException exception) { // cannot happen
+        }
+        //
+        this.content = directWidget;
+        //
+        MWebDirectWidget content = null;
+        try {
+            content = this.getContentReference();
+            content.setView(this.getViewReference());
+        }
+        catch (MNoCellContentWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+            content.setView(null);
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refreshContent();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebDirectWidget getContentReference() throws MNoCellContentWebException {
+        if (null == this.content) {
+            throw new MNoCellContentWebException("Invalid content: null.");
+        }
+        //
+        return this.content;
+    }
+
+    /* View */
+
+    protected void setView(MWebView view) throws MUniqueWidgetIdNotAvailableWebException {
+        super.setView(view);
+        //
+        try {
+            this.getContentReference().setView(view);
+        }
+        catch (MNoCellContentWebException exception) {
+        }
+    }
+
+    /* Container */
+
+    public MWebGridLayout getContainerReference() {
+        return this.container;
+    }
+
+    /* Span */
+
+    public void setRowSpan(int rowSpan) {
+        if (1 > rowSpan) {
+            throw new IllegalArgumentException("Invalid 'rowSpan': must be > 1.");
+        }
+        //
+        this.rowSpan = rowSpan;
+        //
+        try {
+            this.getContainerReference().refresh();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+        catch (MUniqueWidgetIdNotAvailableWebException exception) {
+        }
+    }
+
+    public int getRowSpan() {
+        return this.rowSpan;
+    }
+
+    public void setColumnSpan(int columnSpan) {
+        if (1 > columnSpan) {
+            throw new IllegalArgumentException("Invalid 'columnSpan': must be > 1.");
+        }
+        //
+        this.columnSpan = columnSpan;
+        //
+        try {
+            this.getContainerReference().refresh();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+        catch (MUniqueWidgetIdNotAvailableWebException exception) {
+        }
+    }
+
+    public int getColumnSpan() {
+        return this.columnSpan;
+    }
+
+    /* Display widgets */
+
+    protected MWebDisplayWidget getDisplayWidgetReferenceById(String id) throws MDisplayWidgetNotFoundWebException {
+        try {
+            return super.getDisplayWidgetReferenceById(id);
+        }
+        catch (MDisplayWidgetNotFoundWebException exception) {
+            try {
+                return this.getContentReference().getDisplayWidgetReferenceById(id);
+            }
+            catch (MDisplayWidgetNotFoundWebException exception2) {
+                throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: display widget not available on this path.", id)); // no need to propagate exception
+            }
+            catch (MNoCellContentWebException exception2) {
+                throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: no cell content.", id)); // no need to propagate exception
+            }
+        }
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        this.refreshContent();
+        //
+        super.refresh();
+    }
+
+    protected void refreshContent() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        MWebDirectWidget content = null;
+        try {
+            content = this.getContentReference();
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '<div id=\"%s\"></div>'; }", this.getId(), this.getId(), content.getId()));
+            content.onRefresh();
+        }
+        catch (MNoCellContentWebException exception) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = ''; }", this.getId(), this.getId()));
+        }
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebImage.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebImage.java
new file mode 100644 (file)
index 0000000..6688ddf
--- /dev/null
@@ -0,0 +1,157 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebImage extends MWebDirectWidget {
+
+    protected String imageSource = null;
+    protected String alternativeText = "";
+
+    /* */
+
+    public MWebImage(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebImage(MWebApplicationContext applicationContext, String imageSource, String alternativeText) {
+        this(applicationContext);
+        //
+        this.setImageSource(imageSource);
+        this.setAlternativeText(alternativeText);
+    }
+
+    /* Image source */
+
+    public void setImageSource(String imageSource) {
+        this.setImageSource(imageSource, true);
+    }
+
+    protected void setImageSource(String imageSource, boolean refreshMode) {
+        this.imageSource = imageSource;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshImageSource();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getImageSource() {
+        return this.imageSource;
+    }
+
+    /* Alternative text */
+
+    public void setAlternativeText(String alternativeText) {
+        this.setAlternativeText(alternativeText, true);
+    }
+
+    protected void setAlternativeText(String alternativeText, boolean refreshMode) {
+        if (null == alternativeText) {
+            throw new IllegalArgumentException("Invalid 'alternativeText': null.");
+        }
+        //
+        this.alternativeText = alternativeText;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshAlternativeText();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getAlternativeText() {
+        return this.alternativeText;
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onClick', {});", this.getId());
+        String onDoubleClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onDoubleClick', {});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<img class=\"MWebImage %s\" style=\"display: inline-block;\" onclick=\"%s\" ondblclick=\"%s\" id=\"%s\" src=\"%s/null\" alt=\"\" />'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onClickFunction), MText.getJavascriptEscapedString(onDoubleClickFunction), this.getId(), this.getApplicationContextReference().getRequestReference().getRequestURL()));
+        //
+        super.refresh();
+        //
+        this.refreshImageSource();
+        this.refreshAlternativeText();
+    }
+
+    protected void refreshImageSource() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (null == this.getImageSource()) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').src = '%s/null'; }", this.getId(), this.getId(), this.getApplicationContextReference().getRequestReference().getRequestURL()));
+        }
+        else {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').src = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getImageSource())));
+        }
+    }
+
+    protected void refreshAlternativeText() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').alt = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getAlternativeText())));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onClick".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            this.onClick();
+        }
+        else if ("onDoubleClick".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            this.onDoubleClick();
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onClick() {
+    }
+
+    public void onDoubleClick() {
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebImageButton.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebImageButton.java
new file mode 100644 (file)
index 0000000..e01c168
--- /dev/null
@@ -0,0 +1,308 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebImageButton extends MWebDirectWidget {
+
+    public static enum ImageAlignment {
+        TOP("top"),
+        RIGHT("right"),
+        BOTTOM("bottom"),
+        LEFT("left");
+        private String name = null;
+        private ImageAlignment(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected String text = "";
+    protected String imageSource = null;
+    protected MWebImageButton.ImageAlignment imageAlignment = null;
+
+    protected boolean enabledMode = true;
+
+    /* */
+
+    public MWebImageButton(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebImageButton(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    public MWebImageButton(MWebApplicationContext applicationContext, String text, String imageSource, MWebImageButton.ImageAlignment imageAlignment) {
+        this(applicationContext, text);
+        //
+        this.setImageSource(imageSource);
+        this.setImageAlignment(imageAlignment);
+    }
+
+    /* Focus */
+
+    public void setFocus() {
+        try {
+            this.refreshFocus();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    /* Text */
+
+    public void setText(String text) {
+        this.setText(text, true);
+    }
+
+    protected void setText(String text, boolean refreshMode) {
+        if (null == text) {
+            throw new IllegalArgumentException("Invalid 'text': null.");
+        }
+        //
+        this.text = text;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshText();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    /* Image source */
+
+    public void setImageSource(String imageSource) {
+        this.setImageSource(imageSource, true);
+    }
+
+    protected void setImageSource(String imageSource, boolean refreshMode) {
+        this.imageSource = imageSource;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshImageSource();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getImageSource() {
+        return this.imageSource;
+    }
+
+    /* Image alignment */
+
+    public void setImageAlignment(MWebImageButton.ImageAlignment imageAlignment) {
+        this.setImageAlignment(imageAlignment, true);
+    }
+
+    protected void setImageAlignment(MWebImageButton.ImageAlignment imageAlignment, boolean refreshMode) {
+        this.imageAlignment = imageAlignment;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public MWebImageButton.ImageAlignment getImageAlignment() {
+        return this.imageAlignment;
+    }
+
+    public String getFormattedImageAlignment() throws MNullPropertyWebException {
+        if (null == this.getImageAlignment()) {
+            throw new MNullPropertyWebException("Invalid image alignment: property null.");
+        }
+        return this.getImageAlignment().toString();
+    }
+
+    /* Enabled mode */
+
+    public void setEnabledMode(boolean enabledMode) {
+        this.setEnabledMode(enabledMode, true);
+    }
+
+    protected void setEnabledMode(boolean enabledMode, boolean refreshMode) {
+        this.enabledMode = enabledMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshEnabledMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getEnabledMode() {
+        return this.enabledMode;
+    }
+
+    /* Refresh */
+
+    protected void refreshFocus() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').focus(); }", this.getId(), this.getId()));
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        StringBuilder imageContent = new StringBuilder(String.format("<td class=\"MWebImageButtonImageCell %s\"><img class=\"MWebImageButtonImage %s\" id=\"%s_image\" src=\"%s/null\" alt=\"\" /></td>", customClasses, customClasses, this.getId(), this.getApplicationContextReference().getRequestReference().getRequestURL()));
+        StringBuilder textContent = new StringBuilder(String.format("<td class=\"MWebImageButtonTextCell %s\" id=\"%s_textCell\"></td>", customClasses, this.getId()));
+        StringBuilder content = new StringBuilder("");
+        content.append(String.format("<table class=\"MWebImageButtonTable %s\">", customClasses));
+        MWebImageButton.ImageAlignment imageAlignment = this.getImageAlignment();
+        if (null == imageAlignment) {
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(textContent);
+            content.append("</tr>");
+        }
+        else if (MWebImageButton.ImageAlignment.TOP == imageAlignment) {
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(imageContent);
+            content.append("</tr>");
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(textContent);
+            content.append("</tr>");
+        }
+        else if (MWebImageButton.ImageAlignment.RIGHT == imageAlignment) {
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(textContent);
+            content.append(imageContent);
+            content.append("</tr>");
+        }
+        else if (MWebImageButton.ImageAlignment.BOTTOM == imageAlignment) {
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(textContent);
+            content.append("</tr>");
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(imageContent);
+            content.append("</tr>");
+        }
+        else if (MWebImageButton.ImageAlignment.LEFT == imageAlignment) {
+            content.append(String.format("<tr class=\"MWebImageButtonRow %s\">", customClasses));
+            content.append(imageContent);
+            content.append(textContent);
+            content.append("</tr>");
+        }
+        content.append("</table>");
+        String onClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onClick', {});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<button class=\"MWebImageButton %s\" style=\"display: inline-block;\" onclick=\"%s\" id=\"%s\">%s</button>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onClickFunction), this.getId(), MText.getJavascriptEscapedString(content.toString())));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshImageSource();
+        this.refreshEnabledMode();
+    }
+
+    protected void refreshText() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s_textCell').innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getText())));
+    }
+
+    protected void refreshImageSource() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getFormattedImageAlignment();
+            if (null == this.getImageSource()) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s_image').src = '%s/null'; }", this.getId(), this.getId(), this.getApplicationContextReference().getRequestReference().getRequestURL()));
+            }
+            else {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s_image').src = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getImageSource())));
+            }
+        }
+        catch (MNullPropertyWebException exception) {
+        }
+    }
+
+    protected void refreshEnabledMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').disabled = %s; }", this.getId(), this.getId(), !this.getEnabledMode()));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onClick".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            this.onClick();
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onClick() {
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebLabel.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebLabel.java
new file mode 100644 (file)
index 0000000..13ef9ea
--- /dev/null
@@ -0,0 +1,179 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebLabel extends MWebDirectWidget {
+
+    public static enum TextAlignment {
+        LEFT("left"),
+        CENTER("center"),
+        RIGHT("right"),
+        JUSTIFIED("justify");
+        private String name = null;
+        private TextAlignment(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected String text = "";
+    protected MWebLabel.TextAlignment textAlignment = null;
+
+    /* */
+
+    public MWebLabel(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebLabel(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    /* Text */
+
+    public void setText(String text) {
+        this.setText(text, true);
+    }
+
+    protected void setText(String text, boolean refreshMode) {
+        if (null == text) {
+            throw new IllegalArgumentException("Invalid 'text': null.");
+        }
+        //
+        this.text = text;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshText();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    /* Text alignment */
+
+    public void setTextAlignment(MWebLabel.TextAlignment textAlignment) {
+        this.setTextAlignment(textAlignment, true);
+    }
+
+    protected void setTextAlignment(MWebLabel.TextAlignment textAlignment, boolean refreshMode) {
+        this.textAlignment = textAlignment;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshTextAlignment(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebLabel.TextAlignment getTextAlignment() {
+        return this.textAlignment;
+    }
+
+    public String getFormattedTextAlignment() throws MNullPropertyWebException {
+        if (null == this.getTextAlignment()) {
+            throw new MNullPropertyWebException("Invalid text alignment: property null.");
+        }
+        return this.getTextAlignment().toString();
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onClick', {});", this.getId());
+        String onDoubleClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onDoubleClick', {});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<div class=\"MWebLabel %s\" style=\"display: inline-block;\" onclick=\"%s\" ondblclick=\"%s\" id=\"%s\"></div>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onClickFunction), MText.getJavascriptEscapedString(onDoubleClickFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshTextAlignment(true);
+    }
+
+    protected void refreshText() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(MText.getXhtmlEscapedString(this.getText()))));
+    }
+
+    protected void refreshTextAlignment(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').textAlign = '%s'; }", this.getId(), this.getId(), this.getFormattedTextAlignment()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('textAlign'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onClick".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            this.onClick();
+        }
+        else if ("onDoubleClick".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            this.onDoubleClick();
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onClick() {
+    }
+
+    public void onDoubleClick() {
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebMeasure.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebMeasure.java
new file mode 100644 (file)
index 0000000..6d56825
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+
+public class MWebMeasure extends MObject {
+
+    public static enum Unit {
+        CM("cm"),
+        EM("em"),
+        EX("ex"),
+        IN("in"),
+        MM("mm"),
+        PC("pc"),
+        PERCENT("%"),
+        PT("pt"),
+        PX("px");
+        private String name = null;
+        private Unit(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected Number number = null;
+    protected MWebMeasure.Unit unit = null;
+
+    /* */
+
+    public MWebMeasure(Number number, MWebMeasure.Unit unit) {
+        super();
+        //
+        if (null == number) {
+            throw new IllegalArgumentException("Invalid 'number': null.");
+        }
+        if (null == unit) {
+            throw new IllegalArgumentException("Invalid 'unit': null.");
+        }
+        //
+        this.number = number;
+        this.unit = unit;
+    }
+
+    public MWebMeasure clone() {
+        return new MWebMeasure(this.getNumber(), this.getUnit());
+    }
+
+    /* Measure */
+
+    protected Number getNumber() {
+        return this.number;
+    }
+
+    protected MWebMeasure.Unit getUnit() {
+        return this.unit;
+    }
+
+    public Object[] getValue() {
+        Object[] value = new Object[2];
+        value[0] = this.getNumber();
+        value[1] = this.getUnit();
+        return value;
+    }
+
+    public String getCssValue() {
+        return this.getNumber() + this.getUnit().toString();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebMessage.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebMessage.java
new file mode 100644 (file)
index 0000000..2e0ebda
--- /dev/null
@@ -0,0 +1,131 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.json.MInvalidValueJsonException;
+import com.marcozanon.macaco.json.MJsonObject;
+import com.marcozanon.macaco.json.MJsonString;
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebMessage extends MObject {
+
+    protected String widgetId = null;
+    protected String event = null;
+    protected LinkedHashMap<String, String> parameters = null;
+
+    /* */
+
+    public MWebMessage(String message) throws MMessagingWebException {
+        super();
+        //
+        if (MText.isBlank(message)) {
+            throw new IllegalArgumentException("Invalid 'message': null or empty.");
+        }
+        //
+        MJsonObject jsonMessage = null;
+        try {
+            jsonMessage = new MJsonObject(message);
+        }
+        catch (MInvalidValueJsonException exception) {
+            throw new MMessagingWebException("Invalid 'message': not a Json object."); // no need to propagate exception
+        }
+        // parse widget id component
+        if (!jsonMessage.containsKey("widgetId")) {
+            throw new MMessagingWebException("Invalid 'message': no widget id key.");
+        }
+        try {
+            this.widgetId = ((MJsonString)jsonMessage.getValue("widgetId")).getValue();
+        }
+        catch (ClassCastException exception) {
+            throw new MMessagingWebException("Invalid 'message': invalid widget id."); // no need to propagate exception
+        }
+        // parse event component
+        if (!jsonMessage.containsKey("event")) {
+            throw new MMessagingWebException("Invalid 'message': no event key.");
+        }
+        try {
+            String temporaryEvent = ((MJsonString)jsonMessage.getValue("event")).getValue();
+            if (MText.isEmpty(temporaryEvent)) {
+                throw new MMessagingWebException("Invalid 'message': event empty.");
+            }
+            this.event = temporaryEvent;
+        }
+        catch (ClassCastException exception) {
+            throw new MMessagingWebException("Invalid 'message': invalid event."); // no need to propagate exception
+        }
+        // parse parameters component
+        if (!jsonMessage.containsKey("parameters")) {
+            throw new MMessagingWebException("Invalid 'message': no parameters key.");
+        }
+        this.parameters = new LinkedHashMap<String, String>();
+        try {
+            MJsonObject temporaryParameters = (MJsonObject)jsonMessage.getValue("parameters");
+            for (String key: temporaryParameters.getKeys()) {
+                this.parameters.put(key, ((MJsonString)temporaryParameters.getValue(key)).getValue());
+            }
+        }
+        catch (ClassCastException exception) {
+            throw new MMessagingWebException("Invalid 'message': invalid parameters."); // no need to propagate exception
+        }
+    }
+
+    public MWebMessage clone() {
+        try {
+            MJsonString tmpString = null;
+            MJsonObject tmpMessage = new MJsonObject();
+            //
+            tmpString = new MJsonString();
+            tmpString.setValue(this.getWidgetId());
+            tmpMessage.setValue("widgetId", tmpString);
+            //
+            tmpString = new MJsonString();
+            tmpString.setValue(this.getEvent());
+            tmpMessage.setValue("event", tmpString);
+            //
+            MJsonObject tmpMessageParameters = new MJsonObject();
+            for (String parameterKey: this.getParametersReference().keySet()) {
+                tmpString = new MJsonString();
+                tmpString.setValue(this.getParametersReference().get(parameterKey));
+                tmpMessageParameters.setValue(parameterKey, tmpString);
+            }
+            tmpMessage.setValue("parameters", tmpMessageParameters);
+            //
+            return new MWebMessage(tmpMessage.getJsonValue());
+        }
+        catch (MInvalidValueJsonException exception) { // cannot happen
+            return null; // necessary to avoid Java compilation errors
+        }
+        catch (MMessagingWebException exception) { // cannot happen
+            return null; // necessary to avoid Java compilation errors
+        }
+    }
+
+    /* Components */
+
+    public String getWidgetId() {
+        return this.widgetId;
+    }
+
+    public String getEvent() {
+        return this.event;
+    }
+
+    protected LinkedHashMap<String, String> getParametersReference() {
+        return this.parameters;
+    }
+
+    public LinkedHashMap<String, String> getParameters() {
+        LinkedHashMap<String, String> tmpParameters = new LinkedHashMap<String, String>();
+        for (String key: this.getParametersReference().keySet()) {
+            tmpParameters.put(key, this.getParametersReference().get(key));
+        }
+        return tmpParameters;
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebNumberBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebNumberBox.java
new file mode 100644 (file)
index 0000000..d92e7e9
--- /dev/null
@@ -0,0 +1,106 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.conversion.MFormatConversionException;
+import com.marcozanon.macaco.conversion.MNumberConverter;
+import com.marcozanon.macaco.text.MText;
+import java.math.BigDecimal;
+
+public class MWebNumberBox extends MWebTextBox {
+
+    protected MNumberConverter numberConverter = null;
+
+    /* */
+
+    public MWebNumberBox(MWebApplicationContext applicationContext, MNumberConverter numberConverter) {
+        super(applicationContext);
+        //
+        if (null == numberConverter) {
+            throw new IllegalArgumentException("Invalid 'numberConverter': null.");
+        }
+        //
+        this.numberConverter = numberConverter;
+    }
+
+    public MWebNumberBox(MWebApplicationContext applicationContext, MNumberConverter numberConverter, String text) {
+        this(applicationContext, numberConverter);
+        //
+        this.setText(text);
+    }
+
+    public MWebNumberBox(MWebApplicationContext applicationContext, MNumberConverter numberConverter, BigDecimal number) {
+        this(applicationContext, numberConverter);
+        //
+        this.setNumber(number);
+    }
+
+    /* Number converter */
+
+    protected MNumberConverter getNumberConverterReference() {
+        return this.numberConverter;
+    }
+
+    public MNumberConverter getNumberConverter() {
+        return this.getNumberConverterReference().clone();
+    }
+
+    /* Number conversion */
+
+    public void setNumber(BigDecimal number) {
+        if (null == number) {
+            this.setText("");
+        }
+        else {
+            this.setText(this.getNumberConverterReference().getStringFromNumber(number));
+        }
+    }
+
+    public BigDecimal getNumber() throws MFormatConversionException {
+        String text = this.getText();
+        if (!MText.isEmpty(text)) {
+            return this.getNumberConverterReference().getNumberFromString(text);
+        }
+        return null;
+    }
+
+    /* Validation */
+
+    public void validate() throws MValidationWebException {
+        String text = this.getText();
+        if (!MText.isEmpty(text)) {
+            try {
+                MNumberConverter numberConverter = this.getNumberConverterReference();
+                this.setText(numberConverter.getStringFromNumber(numberConverter.getNumberFromString(text)));
+            }
+            catch (MFormatConversionException exception) {
+                throw new MValidationWebException(String.format("Invalid number: %s.", text), exception);
+            }
+        }
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onBlurFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onBlur', {'text': this.value});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<input type=\"text\" class=\"MWebNumberBox %s\" style=\"display: inline-block;\" onblur=\"%s\" id=\"%s\" />'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onBlurFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshTextAlignment(true);
+        this.refreshMaximumLength();
+        this.refreshEnabledMode();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebPasswordBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebPasswordBox.java
new file mode 100644 (file)
index 0000000..91a857c
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MWebPasswordBox extends MWebTextBox {
+
+    /* */
+
+    public MWebPasswordBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebPasswordBox(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onBlurFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onBlur', {'text': this.value});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<input type=\"password\" class=\"MWebPasswordBox %s\" style=\"display: inline-block;\" onblur=\"%s\" id=\"%s\" />'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onBlurFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshTextAlignment(true);
+        this.refreshMaximumLength();
+        this.refreshEnabledMode();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebRuntimeException.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebRuntimeException.java
new file mode 100644 (file)
index 0000000..7331856
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MRuntimeException;
+
+public abstract class MWebRuntimeException extends MRuntimeException {
+
+    /* */
+
+    public MWebRuntimeException() {
+        super();
+    }
+
+    public MWebRuntimeException(String message) {
+        super(message);
+    }
+
+    public MWebRuntimeException(Throwable error) {
+        super(error);
+    }
+
+    public MWebRuntimeException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebSimpleTextBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebSimpleTextBox.java
new file mode 100644 (file)
index 0000000..63eba85
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MWebSimpleTextBox extends MWebTextBox {
+
+    /* */
+
+    public MWebSimpleTextBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebSimpleTextBox(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onBlurFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onBlur', {'text': this.value});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<input type=\"text\" class=\"MWebSimpleTextBox %s\" style=\"display: inline-block;\" onblur=\"%s\" id=\"%s\" />'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onBlurFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+        this.refreshTextAlignment(true);
+        this.refreshMaximumLength();
+        this.refreshEnabledMode();
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebTable.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebTable.java
new file mode 100644 (file)
index 0000000..d51da3b
--- /dev/null
@@ -0,0 +1,737 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+
+public abstract class MWebTable extends MWebDirectWidget {
+
+    protected LinkedHashMap<String, MWebTableCell> columnHeaders = null;
+
+    protected String primaryKey = null;
+
+    protected String sortKey = null;
+    protected boolean ascendingSortMode = true;
+
+    protected int rowsPerPage = 10;
+    protected Integer selectedPage = null;
+
+    protected int rowCount = 0;
+    protected LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>> rowSubset = new LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>>();
+
+    protected boolean selectableRowMode = false;
+    protected LinkedHashSet<String> selectedRowKeys = new LinkedHashSet<String>();
+
+    /* */
+
+    public MWebTable(MWebApplicationContext applicationContext, LinkedHashMap<String, MWebTableCell> columnHeaders, String primaryKey) {
+        super(applicationContext);
+        //
+        if (null == columnHeaders) {
+            throw new IllegalArgumentException("Invalid 'columnHeaders': null.");
+        }
+        else {
+            for (String columnKey: columnHeaders.keySet()) {
+                if (MText.isBlank(columnKey)) {
+                    throw new IllegalArgumentException("Invalid 'columnHeaders': column key null or empty.");
+                }
+                else if (null == columnHeaders.get(columnKey)) {
+                    throw new IllegalArgumentException("Invalid 'columnHeaders': table cell null.");
+                }
+            }
+        }
+        if (MText.isBlank(primaryKey)) {
+            throw new IllegalArgumentException("Invalid 'primaryKey': null or empty.");
+        }
+        //
+        this.columnHeaders = columnHeaders;
+        this.primaryKey = primaryKey;
+    }
+
+    /* Column headers */
+
+    protected LinkedHashMap<String, MWebTableCell> getColumnHeadersReference() {
+        return this.columnHeaders;
+    }
+
+    public LinkedHashMap<String, MWebTableCell> getColumnHeaders() {
+        LinkedHashMap<String, MWebTableCell> tmpColumnHeaders = new LinkedHashMap<String, MWebTableCell>();
+        for (String key: this.getColumnHeadersReference().keySet()) {
+            tmpColumnHeaders.put(key, this.getColumnHeadersReference().get(key).clone());
+        }
+        return tmpColumnHeaders;
+    }
+
+    public LinkedHashSet<String> getColumnHeaderKeys() {
+        LinkedHashSet<String> tmpColumnHeaderKeys = new LinkedHashSet<String>();
+        Iterator i = this.getColumnHeadersReference().keySet().iterator();
+        while (i.hasNext()) {
+            tmpColumnHeaderKeys.add((String)i.next());
+        }
+        return tmpColumnHeaderKeys;
+    }
+
+    /* Primary key */
+
+    public String getPrimaryKey() {
+        return this.primaryKey;
+    }
+
+    /* Sorting */
+
+    public void setSortKey(String sortKey, boolean ascendingSortMode) {
+        this.setSortKey(sortKey, ascendingSortMode, true);
+    }
+
+    protected void setSortKey(String sortKey, boolean ascendingSortMode, boolean refreshMode) {
+        if (MText.isEmpty(sortKey)) {
+            throw new IllegalArgumentException("Invalid 'sortKey': empty.");
+        }
+        //
+        if (null == sortKey) {
+            this.sortKey = null;
+            this.ascendingSortMode = true;
+        }
+        else {
+            this.sortKey = sortKey;
+            this.ascendingSortMode = ascendingSortMode;
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public String getSortKey() {
+        return this.sortKey;
+    }
+
+    public boolean getAscendingSortMode() {
+        return this.ascendingSortMode;
+    }
+
+    /* Page selection */
+
+    public void setRowsPerPage(int rowsPerPage) {
+        this.setRowsPerPage(rowsPerPage, true);
+    }
+
+    protected void setRowsPerPage(int rowsPerPage, boolean refreshMode) {
+        if (1 > rowsPerPage) {
+            throw new IllegalArgumentException(String.format("Invalid 'rowsPerPage': %s: must be positive.", rowsPerPage));
+        }
+        //
+        this.rowsPerPage = rowsPerPage;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public int getRowsPerPage() {
+        return this.rowsPerPage;
+    }
+
+    public void setSelectedPage(Integer selectedPage) {
+        this.setSelectedPage(selectedPage, true);
+    }
+
+    protected void setSelectedPage(Integer selectedPage, boolean refreshMode) {
+        if ((0 == this.getRowCount()) && (null != selectedPage)) {
+            this.selectedPage = 1;
+            return;
+        }
+        else if ((null != selectedPage) && ((1 > selectedPage.intValue()) || (selectedPage.intValue() > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
+            throw new IllegalArgumentException(String.format("Invalid 'selectedPage': %s: out of range.", selectedPage));
+        }
+        //
+        this.clearSelectedRowKeys();
+        //
+        this.selectedPage = selectedPage;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public Integer getSelectedPage() {
+        return this.selectedPage;
+    }
+
+    protected void resetSelectedPage() {
+        Integer selectedPage = this.getSelectedPage();
+        if (null == selectedPage) {
+            return;
+        }
+        else if (0 == this.getRowCount()) {
+            this.setSelectedPage(null);
+        }
+        else if (selectedPage.intValue() < 1) {
+            this.setSelectedPage(1);
+        }
+        else if (selectedPage.intValue() > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())) {
+            this.setSelectedPage((int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage()));
+        }
+    }
+
+    /* Rows */
+
+    public void loadRows(LinkedList<LinkedHashMap<String, String>> rows) throws MUniqueWidgetIdNotAvailableWebException {
+        this.loadRows(rows, true);
+    }
+
+    protected void loadRows(LinkedList<LinkedHashMap<String, String>> rows, boolean refreshMode) throws MUniqueWidgetIdNotAvailableWebException {
+        if (null == rows) {
+            throw new IllegalArgumentException("Invalid 'rows': null.");
+        }
+        else {
+            for (LinkedHashMap<String, String> row: rows) {
+                if (null == row) {
+                    throw new IllegalArgumentException("Invalid 'rows': row null.");
+                }
+                for (String columnKey: row.keySet()) {
+                    if (MText.isBlank(columnKey)) {
+                        throw new IllegalArgumentException("Invalid 'rows': column key null or empty.");
+                    }
+                }
+            }
+        }
+        //
+        this.rowCount = rows.size();
+        this.resetSelectedPage();
+        //
+        int firstRow = 0;
+        int lastRow = this.getRowCount() - 1;
+        Integer selectedPage = this.getSelectedPage();
+        if (null != selectedPage) {
+            firstRow = (selectedPage.intValue() - 1) * this.getRowsPerPage();
+            lastRow = Math.min((selectedPage.intValue() * this.getRowsPerPage()) - 1, lastRow);
+        }
+        LinkedList<LinkedHashMap<String, String>> tmpRowSubset = new LinkedList<LinkedHashMap<String, String>>();
+        for (int r = firstRow; r < (lastRow + 1); r++) {
+            tmpRowSubset.add(rows.get(r));
+        }
+        LinkedHashMap<String, MWebTableCell> columnHeaders = this.getColumnHeadersReference();
+        LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>> rowSubset = new LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>>();
+        for (LinkedHashMap<String, String> tmpRow: tmpRowSubset) {
+            String primaryKeyValue = tmpRow.get(this.getPrimaryKey());
+            if (null == primaryKeyValue) {
+                throw new IllegalArgumentException("Invalid row: primary key value null.");
+            }
+            LinkedHashMap<String, MWebTableCell> row = new LinkedHashMap<String, MWebTableCell>();
+            for (String columnKey: columnHeaders.keySet()) {
+                String text = null;
+                if (null == tmpRow.get(columnKey)) {
+                    text = "";
+                }
+                else {
+                    text = tmpRow.get(columnKey);
+                }
+                row.put(columnKey, new MWebTableCell(this.getApplicationContextReference(), text, null, null));
+            }
+            rowSubset.put(primaryKeyValue, row);
+        }
+        //
+        for (LinkedHashMap<String, MWebTableCell> row: this.getRowSubsetReference().values()) {
+            for (MWebTableCell rowCell: row.values()) {
+                try {
+                    rowCell.setView(null);
+                }
+                catch (MUniqueWidgetIdNotAvailableWebException exception) { // cannot happen
+                }
+            }
+        }
+        //
+        this.rowSubset = rowSubset;
+        //
+        for (LinkedHashMap<String, MWebTableCell> row: this.getRowSubsetReference().values()) {
+            for (MWebTableCell rowCell: row.values()) {
+                try {
+                    rowCell.setView(this.getViewReference());
+                }
+                catch (MNoViewWebException exception) {
+                }
+            }
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public int getRowCount() {
+        return this.rowCount;
+    }
+
+    protected LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>> getRowSubsetReference() {
+        return this.rowSubset;
+    }
+
+    public LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>> getRowSubset() {
+        LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>> tmpRowSubset = new LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>>();
+        for (String rowKey: this.getRowSubsetReference().keySet()) {
+            LinkedHashMap<String, MWebTableCell> tmpRow = new LinkedHashMap<String, MWebTableCell>();
+            for (String columnKey: this.getRowSubsetReference().get(rowKey).keySet()) {
+                tmpRow.put(columnKey, this.getRowSubsetReference().get(rowKey).get(columnKey).clone());
+            }
+            tmpRowSubset.put(rowKey, tmpRow);
+        }
+        return tmpRowSubset;
+    }
+
+    public LinkedHashSet<String> getRowSubsetKeys() {
+        LinkedHashSet<String> tmpRowSubsetKeys = new LinkedHashSet<String>();
+        Iterator i = this.getRowSubsetReference().keySet().iterator();
+        while (i.hasNext()) {
+            tmpRowSubsetKeys.add((String)i.next());
+        }
+        return tmpRowSubsetKeys;
+    }
+
+    /* Row selection */
+
+    public void setSelectableRowMode(boolean selectableRowMode) {
+        this.setSelectableRowMode(selectableRowMode, true);
+    }
+
+    protected void setSelectableRowMode(boolean selectableRowMode, boolean refreshMode) {
+        if (!selectableRowMode) {
+            this.clearSelectedRowKeys();
+        }
+        this.selectableRowMode = selectableRowMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public boolean getSelectableRowMode() {
+        return this.selectableRowMode;
+    }
+
+    protected LinkedHashSet<String> getSelectedRowKeysReference() {
+        return this.selectedRowKeys;
+    }
+
+    public LinkedHashSet<String> getSelectedRowKeys() {
+        LinkedHashSet<String> tmpSelectedRowKeys = new LinkedHashSet<String>();
+        Iterator i = this.getSelectedRowKeysReference().iterator();
+        while (i.hasNext()) {
+            tmpSelectedRowKeys.add((String)i.next());
+        }
+        return tmpSelectedRowKeys;
+    }
+
+    protected void clearSelectedRowKeys() {
+        this.getSelectedRowKeysReference().clear();
+    }
+
+    public void setRowSelectedMode(String primaryKeyValue, boolean selectedMode) {
+        this.setRowSelectedMode(primaryKeyValue, selectedMode, true);
+    }
+
+    protected void setRowSelectedMode(String primaryKeyValue, boolean selectedMode, boolean refreshMode) {
+        if (MText.isBlank(primaryKeyValue)) {
+            throw new IllegalArgumentException("Invalid 'primaryKeyValue': null or empty.");
+        }
+        //
+        if (selectedMode) {
+            this.getSelectedRowKeysReference().add(primaryKeyValue);
+        }
+        else {
+            this.getSelectedRowKeysReference().remove(primaryKeyValue);
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public boolean getRowSelectedMode(String primaryKeyValue) {
+        if (MText.isBlank(primaryKeyValue)) {
+            throw new IllegalArgumentException("Invalid 'primaryKeyValue': null or empty.");
+        }
+        //
+        return this.getSelectedRowKeys().contains(primaryKeyValue);
+    }
+
+    public boolean getRowSubsetSelectedMode() {
+        return this.getSelectedRowKeysReference().size() == this.getRowSubsetReference().size();
+    }
+
+    public void toggleRowSubsetSelectedMode() {
+        this.toggleRowSubsetSelectedMode(true);
+    }
+
+    protected void toggleRowSubsetSelectedMode(boolean refreshMode) {
+        if (this.getRowSubsetSelectedMode()) {
+            this.clearSelectedRowKeys();
+        }
+        else {
+            this.clearSelectedRowKeys();
+            for (String primaryKeyValue: this.getRowSubsetReference().keySet()) {
+                this.setRowSelectedMode(primaryKeyValue, true, false);
+            }
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    /* View */
+
+    protected void setView(MWebView view) throws MUniqueWidgetIdNotAvailableWebException {
+        super.setView(view);
+        //
+        for (MWebTableCell cell: this.getColumnHeadersReference().values()) {
+            cell.setView(view);
+        }
+        //
+        for (LinkedHashMap<String, MWebTableCell> row: this.getRowSubsetReference().values()) {
+            for (MWebTableCell rowCell: row.values()) {
+                rowCell.setView(view);
+            }
+        }
+    }
+
+    /* Display widgets */
+
+    protected MWebDisplayWidget getDisplayWidgetReferenceById(String id) throws MDisplayWidgetNotFoundWebException {
+        try {
+            return super.getDisplayWidgetReferenceById(id);
+        }
+        catch (MDisplayWidgetNotFoundWebException exception) {
+            for (MWebTableCell columnHeaderCell: this.getColumnHeadersReference().values()) {
+                try {
+                    return columnHeaderCell.getDisplayWidgetReferenceById(id);
+                }
+                catch (MDisplayWidgetNotFoundWebException exception2) {
+                }
+            }
+            for (LinkedHashMap<String, MWebTableCell> row: this.getRowSubsetReference().values()) {
+                for (MWebTableCell rowCell: row.values()) {
+                    try {
+                        return rowCell.getDisplayWidgetReferenceById(id);
+                    }
+                    catch (MDisplayWidgetNotFoundWebException exception2) {
+                    }
+                }
+            }
+            throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: display widget not available on this path.", id)); // no need to propagate exception
+        }
+    }
+
+    /* Refresh */
+
+    protected void customizeRowSubset() {
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        StringBuilder content = new StringBuilder("");
+        LinkedHashMap<String, MWebTableCell> columnHeaders = this.getColumnHeadersReference();
+        Integer selectedPage = this.getSelectedPage();
+        LinkedHashMap<String, LinkedHashMap<String, MWebTableCell>> rowSubset = this.getRowSubsetReference();
+        content.append(String.format("<table class=\"MWebTable %s\" style=\"display: inline-table;\" id=\"%s\">", customClasses, this.getId()));
+        //
+        content.append(String.format("<tr class=\"MWebTableColumnHeaderRow %s\">", customClasses));
+        if (this.getSelectableRowMode()) {
+            String onRowSubsetSelectedModeToggleFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onRowSubsetSelectedModeToggle', {});", this.getId());
+            content.append(String.format("<th class=\"MWebTableColumnHeaderRowSelectionCell %s\"><input type=\"checkbox\" class=\"MWebTableColumnHeaderRowSelector %s\" onclick=\"%s\" /></th>", customClasses, customClasses, onRowSubsetSelectedModeToggleFunction));
+        }
+        for (String columnKey: columnHeaders.keySet()) {
+            String onSortFunction = "";
+            if (!MText.isEmpty(columnHeaders.get(columnKey).getText())) {
+                onSortFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onSort', {'sortKey': '%s'});", this.getId(), MText.getJavascriptEscapedString(columnKey));
+            }
+            content.append(String.format("<th class=\"MWebTableColumnHeaderCell %s\" onclick=\"%s\" id=\"%s\"></th>", customClasses, MText.getXhtmlEscapedString(onSortFunction), columnHeaders.get(columnKey).getId()));
+        }
+        content.append("</tr>");
+        //
+        for (String primaryKeyValue: rowSubset.keySet()) {
+            content.append(String.format("<tr class=\"MWebTableRow %s\">", customClasses));
+            if (this.getSelectableRowMode()) {
+                String onRowSelectedModeToggleFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onRowSelectedModeToggle', {'primaryKeyValue': '%s'});", this.getId(), MText.getJavascriptEscapedString(primaryKeyValue));
+                String checkedMode = "";
+                if (this.getRowSelectedMode(primaryKeyValue)) {
+                    checkedMode = "checked=\"checked\"";
+                }
+                content.append(String.format("<th class=\"MWebTableRowSelectionCell %s\"><input type=\"checkbox\" class=\"MWebTableRowSelector %s\" onclick=\"%s\" %s /></th>", customClasses, customClasses, MText.getXhtmlEscapedString(onRowSelectedModeToggleFunction), checkedMode));
+            }
+            for (String columnKey: rowSubset.get(primaryKeyValue).keySet()) {
+                String onCellClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onCellClick', {'primaryKeyValue': '%s', 'columnKey': '%s'});", this.getId(), MText.getJavascriptEscapedString(primaryKeyValue), MText.getJavascriptEscapedString(columnKey));
+                content.append(String.format("<td class=\"MWebTableCell %s\" onclick=\"%s\" id=\"%s\"></td>", customClasses, MText.getXhtmlEscapedString(onCellClickFunction), rowSubset.get(primaryKeyValue).get(columnKey).getId()));
+            }
+            content.append("</tr>");
+        }
+        //
+        content.append(String.format("<tr class=\"MWebTablePageChangerRow %s\">", customClasses));
+        int columnSpan = columnHeaders.size();
+        if (this.getSelectableRowMode()) {
+            columnSpan++;
+        }
+        String onPageSelectionFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onPageSelection', {'selectedPage': this.value});", this.getId());
+        content.append(String.format("<td class=\"MWebTablePageChangerCell %s\" colspan=\"%s\"><select class=\"MWebTablePageChanger %s\" onchange=\"%s\">", customClasses, columnSpan, customClasses, onPageSelectionFunction));
+        String selectedMode = "";
+        if (null == selectedPage) {
+            selectedMode = "selected=\"selected\"";
+        }
+        content.append(String.format("<option value=\"\" %s>*</option>", selectedMode));
+        int rowCount = this.getRowCount();
+        int rowsPerPage = this.getRowsPerPage();
+        if (0 < rowCount) {
+            int p = 0;
+            int firstRow = 0;
+            int lastRow = 0;
+            for (p = 1; (int)Math.ceil((float)rowCount / (float)rowsPerPage) >= p; p++) {
+                firstRow = (p - 1) * rowsPerPage;
+                lastRow = Math.min((p * rowsPerPage) - 1, rowCount - 1);
+                if ((null != selectedPage) && (selectedPage.intValue() == p)) {
+                    selectedMode = "selected=\"selected\"";
+                }
+                else {
+                    selectedMode = "";
+                }
+                content.append(String.format("<option value=\"%s\" %s>%s (%s - %s)</option>", p, selectedMode, p, (firstRow + 1), (lastRow + 1)));
+            }
+        }
+        content.append("</select></td>");
+        content.append("</tr>");
+        //
+        content.append("</table>");
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content.toString())));
+        //
+        String sortKey = this.getSortKey();
+        for (String columnKey: columnHeaders.keySet()) {
+            MWebTableCell columnHeaderCell = columnHeaders.get(columnKey);
+            columnHeaderCell.onRefresh();
+            String sortIndicator = "";
+            if (columnKey.equals(sortKey)) {
+                if (true == this.getAscendingSortMode()) {
+                    sortIndicator = "+";
+                }
+                else {
+                    sortIndicator = "-";
+                }
+            }
+            else {
+                sortIndicator = "";
+            }
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '%s<br />' + $('%s').innerHTML; }", this.getId(), columnHeaderCell.getId(), sortIndicator, columnHeaderCell.getId()));
+        }
+        //
+        this.customizeRowSubset();
+        //
+        for (LinkedHashMap<String, MWebTableCell> row: rowSubset.values()) {
+            for (MWebTableCell rowCell: row.values()) {
+                rowCell.onRefresh();
+            }
+        }
+        //
+        super.refresh();
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onCellClick".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            String primaryKeyValue = parameters.get("primaryKeyValue");
+            String columnKey = parameters.get("columnKey");
+            if (null == primaryKeyValue) {
+                throw new MUnexpectedMessageWebException("Invalid message: primary key value parameter not available.");
+            }
+            else if (!this.getRowSubsetKeys().contains(primaryKeyValue)) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: primary key value parameter not recognized.", primaryKeyValue));
+            }
+            if (null == columnKey) {
+                throw new MUnexpectedMessageWebException("Invalid message: column key parameter not available.");
+            }
+            else if (!this.getColumnHeaderKeys().contains(columnKey)) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: column key parameter not recognized.", columnKey));
+            }
+            this.onCellClick(primaryKeyValue, columnKey);
+        }
+        else if ("onPageSelection".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            String selectedPage = parameters.get("selectedPage");
+            if (null == selectedPage) {
+                throw new MUnexpectedMessageWebException("Invalid message: selected page parameter not available.");
+            }
+            else if ((!MText.isEmpty(selectedPage)) && ((1 > Integer.parseInt(selectedPage)) || (Integer.parseInt(selectedPage) > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected page parameter out of range.", selectedPage));
+            }
+            this.onPageSelection(selectedPage);
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else if ("onRowSelectedModeToggle".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            String primaryKeyValue = parameters.get("primaryKeyValue");
+            if (null == primaryKeyValue) {
+                throw new MUnexpectedMessageWebException("Invalid message: primary key value parameter not available.");
+            }
+            else if (!this.getRowSubsetKeys().contains(primaryKeyValue)) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: primary key value parameter not recognized.", primaryKeyValue));
+            }
+            this.onRowSelectedModeToggle(primaryKeyValue);
+        }
+        else if ("onRowSubsetSelectedModeToggle".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            this.onRowSubsetSelectedModeToggle();
+        }
+        else if ("onSort".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            String sortKey = parameters.get("sortKey");
+            if (null == sortKey) {
+                throw new MUnexpectedMessageWebException("Invalid message: sort key parameter not available.");
+            }
+            else if (!this.getColumnHeaderKeys().contains(sortKey)) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: sort key parameter not recognized.", sortKey));
+            }
+            this.onSort(sortKey);
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onCellClick(String primaryKeyValue, String columnKey) {
+    }
+
+    public void onPageSelection(String selectedPage) {
+        if (MText.isEmpty(selectedPage)) {
+            this.setSelectedPage(null);
+        }
+        else {
+            this.setSelectedPage(new Integer(selectedPage));
+        }
+    }
+
+    public void onRowSelectedModeToggle(String primaryKeyValue) {
+        this.setRowSelectedMode(primaryKeyValue, !this.getRowSelectedMode(primaryKeyValue));
+    }
+
+    public void onRowSubsetSelectedModeToggle() {
+        this.toggleRowSubsetSelectedMode();
+    }
+
+    public void onSort(String sortKey) {
+        if (sortKey.equals(this.getSortKey())) {
+            this.setSortKey(sortKey, !this.getAscendingSortMode());
+        }
+        else {
+            this.setSortKey(sortKey, true);
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebTableCell.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebTableCell.java
new file mode 100644 (file)
index 0000000..9e6441e
--- /dev/null
@@ -0,0 +1,172 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public class MWebTableCell extends MWebCellWidget {
+
+    protected String text = "";
+    protected String imageSource = null;
+    protected String externalLinkPrefix = null;
+
+    /* */
+
+    public MWebTableCell(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebTableCell(MWebApplicationContext applicationContext, String text, String imageSource, String externalLinkPrefix) {
+        this(applicationContext);
+        //
+        this.setText(text);
+        this.setImageSource(imageSource);
+        this.setExternalLinkPrefix(externalLinkPrefix);
+    }
+
+    public MWebTableCell clone() {
+        MWebTableCell tableCell = new MWebTableCell(this.getApplicationContextReference(), this.getText(), this.getImageSource(), this.getExternalLinkPrefix());
+        this.cloneCellWidgetProperties(tableCell);
+        return tableCell;
+    }
+
+    /* Text */
+
+    public void setText(String text) {
+        this.setText(text, true);
+    }
+
+    protected void setText(String text, boolean refreshMode) {
+        if (null == text) {
+            throw new IllegalArgumentException("Invalid 'text': null.");
+        }
+        //
+        this.text = text;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshContent();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    /* Image source */
+
+    public void setImageSource(String imageSource) {
+        this.setImageSource(imageSource, true);
+    }
+
+    protected void setImageSource(String imageSource, boolean refreshMode) {
+        this.imageSource = imageSource;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshContent();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getImageSource() {
+        return this.imageSource;
+    }
+
+    /* External link prefix */
+
+    public void setExternalLinkPrefix(String externalLinkPrefix) {
+        this.setExternalLinkPrefix(externalLinkPrefix, true);
+    }
+
+    protected void setExternalLinkPrefix(String externalLinkPrefix, boolean refreshMode) {
+        if (MText.isEmpty(externalLinkPrefix)) {
+            throw new IllegalArgumentException("Invalid 'externalLinkPrefix': empty.");
+        }
+        //
+        this.externalLinkPrefix = externalLinkPrefix;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshContent();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getExternalLinkPrefix() {
+        return this.externalLinkPrefix;
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        this.refreshContent();
+        //
+        super.refresh();
+    }
+
+    protected void refreshContent() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        String content = null;
+        String text = this.getText();
+        String imageSource = this.getImageSource();
+        String externalLinkPrefix = this.getExternalLinkPrefix();
+        if (null == imageSource) {
+            content = MText.getXhtmlEscapedString(text);
+        }
+        else {
+            content = String.format("<img src=\"%s\" alt=\"%s\" />", MText.getXhtmlEscapedString(imageSource), MText.getXhtmlEscapedString(text));
+        }
+        if (null != externalLinkPrefix) {
+            content = String.format("<a href=\"%s\">%s</a>", MText.getXhtmlEscapedString(externalLinkPrefix + text), content);
+        }
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content)));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebTextBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebTextBox.java
new file mode 100644 (file)
index 0000000..4cb6bec
--- /dev/null
@@ -0,0 +1,260 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public abstract class MWebTextBox extends MWebDirectWidget {
+
+    public static enum TextAlignment {
+        LEFT("left"),
+        CENTER("center"),
+        RIGHT("right");
+        private String name = null;
+        private TextAlignment(String name) {
+            this.name = name;
+        }
+        public String toString() {
+            return this.name;
+        }
+    };
+
+    protected String text = "";
+    protected MWebTextBox.TextAlignment textAlignment = null;
+    protected Integer maximumLength = null;
+
+    protected boolean enabledMode = true;
+
+    /* */
+
+    public MWebTextBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    /* Focus */
+
+    public void setFocus() {
+        try {
+            this.refreshFocus();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    /* Text */
+
+    public void setText(String text) {
+        this.setText(text, true);
+    }
+
+    protected void setText(String text, boolean refreshMode) {
+        if (null == text) {
+            throw new IllegalArgumentException("Invalid 'text': null.");
+        }
+        //
+        this.text = text;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshText();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    /* Text alignment */
+
+    public void setTextAlignment(MWebTextBox.TextAlignment textAlignment) {
+        this.setTextAlignment(textAlignment, true);
+    }
+
+    protected void setTextAlignment(MWebTextBox.TextAlignment textAlignment, boolean refreshMode) {
+        this.textAlignment = textAlignment;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshTextAlignment(false);
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebTextBox.TextAlignment getTextAlignment() {
+        return this.textAlignment;
+    }
+
+    public String getFormattedTextAlignment() throws MNullPropertyWebException {
+        if (null == this.getTextAlignment()) {
+            throw new MNullPropertyWebException("Invalid text alignment: property null.");
+        }
+        return this.getTextAlignment().toString();
+    }
+
+    /* Maximum length */
+
+    public void setMaximumLength(Integer maximumLength) {
+        this.setMaximumLength(maximumLength, true);
+    }
+
+    protected void setMaximumLength(Integer maximumLength, boolean refreshMode) {
+        if ((null != maximumLength) && (0 > maximumLength.intValue())) {
+            throw new IllegalArgumentException("Invalid 'maximumLength': negative number.");
+        }
+        //
+        this.maximumLength = maximumLength;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshMaximumLength();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public Integer getMaximumLength() {
+        return this.maximumLength;
+    }
+
+    public String getFormattedMaximumLength() throws MNullPropertyWebException {
+        if (null == this.getMaximumLength()) {
+            throw new MNullPropertyWebException("Invalid maximum length: property null.");
+        }
+        return this.getMaximumLength().toString();
+    }
+
+    /* Enabled mode */
+
+    public void setEnabledMode(boolean enabledMode) {
+        this.setEnabledMode(enabledMode, true);
+    }
+
+    protected void setEnabledMode(boolean enabledMode, boolean refreshMode) {
+        this.enabledMode = enabledMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshEnabledMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getEnabledMode() {
+        return this.enabledMode;
+    }
+
+    /* Refresh */
+
+    protected void refreshFocus() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').focus(); }", this.getId(), this.getId()));
+    }
+
+    protected void refreshText() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').value = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getText())));
+    }
+
+    protected void refreshTextAlignment(boolean directRefreshMode) throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $S('%s').textAlign = '%s'; }", this.getId(), this.getId(), this.getFormattedTextAlignment()));
+        }
+        catch (MNullPropertyWebException exception) {
+            if (!directRefreshMode) {
+                this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('textAlign'); }", this.getId(), this.getId()));
+            }
+        }
+    }
+
+    protected void refreshMaximumLength() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').maxLength = '%s'; }", this.getId(), this.getId(), this.getFormattedMaximumLength()));
+        }
+        catch (MNullPropertyWebException exception) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').removeAttribute('maxLength'); }", this.getId(), this.getId()));
+        }
+    }
+
+    protected void refreshEnabledMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').disabled = %s; }", this.getId(), this.getId(), !this.getEnabledMode()));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onBlur".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            String text = parameters.get("text");
+            if (null == text) {
+                throw new MUnexpectedMessageWebException("Invalid message: text parameter not available.");
+            }
+            this.onBlur(text);
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onBlur(String text) {
+        this.setText(text, false);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebUploader.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebUploader.java
new file mode 100644 (file)
index 0000000..cf48316
--- /dev/null
@@ -0,0 +1,154 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.Part;
+
+public class MWebUploader extends MWebDirectWidget {
+
+    protected boolean enabledMode = true;
+
+    /* */
+
+    public MWebUploader(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    /* Focus */
+
+    public void setFocus() {
+        try {
+            this.refreshFocus();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    /* Enabled mode */
+
+    public void setEnabledMode(boolean enabledMode) {
+        this.setEnabledMode(enabledMode, true);
+    }
+
+    protected void setEnabledMode(boolean enabledMode, boolean refreshMode) {
+        this.enabledMode = enabledMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshEnabledMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getEnabledMode() {
+        return this.enabledMode;
+    }
+
+    /* Content disposition */
+
+    protected String getFileName(Part part) { // taken and adapted from http://java-x.blogspot.com/2010/08/file-upload-with-servlet-30.html
+        if (null == part) {
+            throw new IllegalArgumentException("Invalid 'part': null.");
+        }
+        //
+        for (String cd: part.getHeader("content-disposition").split(";")) {
+            if (cd.trim().startsWith("filename")) {
+                return cd.substring(cd.indexOf("=") + 1).trim().replace("\"", "");
+            }
+        }
+        return null;
+    }
+
+    /* Refresh */
+
+    protected void refreshFocus() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s_file').focus(); }", this.getId(), this.getId()));
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onUploadFunction = String.format("javascript: m_messageInterface.fireUploadFakeMessage('%s');", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<form class=\"MWebUploader %s\" id=\"%s\" action=\"#\" enctype=\"multipart/form-data\" method=\"post\" target=\"m_uploader\"><input type=\"file\" class=\"MWebUploaderFile %s\" style=\"display: inline-block;\" onchange=\"%s\" id=\"%s_file\" name=\"%s_file\" /></form>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onUploadFunction), this.getId(), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshEnabledMode();
+    }
+
+    protected void refreshEnabledMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s_file').disabled = %s; }", this.getId(), this.getId(), !this.getEnabledMode()));
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else if ("onUpload".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            HttpServletRequest request = this.getApplicationContextReference().getRequestReference();
+            Collection<Part> parts = null;
+            try {
+                parts = request.getParts();
+            }
+            catch (IllegalStateException exception) {
+                throw new MUnexpectedMessageWebException("Invalid message: size exceeded."); // no need to propagate exception
+               }
+            catch (IOException exception) {
+                throw new MUnexpectedMessageWebException("Invalid message: I/O error."); // no need to propagate exception
+               }
+            catch (ServletException exception) {
+                throw new MUnexpectedMessageWebException("Invalid message: not a multipart/form-data request."); // no need to propagate exception
+               }
+            if (1 != parts.size()) {
+                throw new MUnexpectedMessageWebException("Invalid message: there must be exactly one part.");
+            }
+            this.onUpload(parts.iterator().next());
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onUpload(Part part) {
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebVerticalMenu.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebVerticalMenu.java
new file mode 100644 (file)
index 0000000..991eb9c
--- /dev/null
@@ -0,0 +1,289 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+
+public class MWebVerticalMenu extends MWebDirectWidget {
+
+    protected String title = null;
+
+    protected boolean accordionMode = true;
+
+    protected LinkedHashMap<String, MWebVerticalMenuItem> items = new LinkedHashMap<String, MWebVerticalMenuItem>();
+    protected String selectedItemKey = null;
+
+    /* */
+
+    public MWebVerticalMenu(MWebApplicationContext applicationContext, String title) {
+        super(applicationContext);
+        //
+        this.title = title;
+    }
+
+    public MWebVerticalMenu(MWebApplicationContext applicationContext, String title, LinkedHashMap<String, MWebVerticalMenuItem> items, String selectedItemKey) {
+        this(applicationContext, title);
+        //
+        this.setItems(items, selectedItemKey);
+    }
+
+    /* Title */
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    /* Accordion mode */
+
+    public void setAccordionMode(boolean accordionMode) {
+        this.setAccordionMode(accordionMode, true);
+    }
+
+    protected void setAccordionMode(boolean accordionMode, boolean refreshMode) {
+        this.accordionMode = accordionMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public boolean getAccordionMode() {
+        return this.accordionMode;
+    }
+
+    /* Items */
+
+    public void setItems(LinkedHashMap<String, MWebVerticalMenuItem> items, String selectedItemKey) {
+        this.setItems(items, selectedItemKey, true);
+    }
+
+    protected void setItems(LinkedHashMap<String, MWebVerticalMenuItem> items, String selectedItemKey, boolean refreshMode) {
+        if (null == items) {
+            throw new IllegalArgumentException("Invalid 'items': null.");
+        }
+        else {
+            for (String k: items.keySet()) {
+                if (MText.isBlank(k)) {
+                    throw new IllegalArgumentException("Invalid 'items': item key null or empty.");
+                }
+                else if (null == items.get(k)) {
+                    throw new IllegalArgumentException("Invalid 'items': item null.");
+                }
+            }
+        }
+        //
+        this.items = items;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+        //
+        this.setSelectedItem(selectedItemKey, refreshMode);
+    }
+
+    protected LinkedHashMap<String, MWebVerticalMenuItem> getItemsReference() {
+        return this.items;
+    }
+
+    public LinkedHashMap<String, MWebVerticalMenuItem> getItems() {
+        LinkedHashMap<String, MWebVerticalMenuItem> tmpItems = new LinkedHashMap<String, MWebVerticalMenuItem>();
+        for (String key: this.getItemsReference().keySet()) {
+            tmpItems.put(key, this.getItemsReference().get(key).clone());
+        }
+        return tmpItems;
+    }
+
+    public LinkedHashSet<String> getItemKeys() {
+        LinkedHashSet<String> tmpItemKeys = new LinkedHashSet<String>();
+        for (String itemKey: this.getItemsReference().keySet()) {
+            tmpItemKeys.add(itemKey);
+        }
+        return tmpItemKeys;
+    }
+
+    public void setSelectedItem(String selectedItemKey) {
+        this.setSelectedItem(selectedItemKey, true);
+    }
+
+    protected void setSelectedItem(String selectedItemKey, boolean refreshMode) {
+        if (MText.isEmpty(selectedItemKey)) {
+            throw new IllegalArgumentException("Invalid 'selectedItemKey': empty.");
+        }
+        else if ((null != selectedItemKey) && (!this.getItemsReference().containsKey(selectedItemKey))) {
+            throw new IllegalArgumentException(String.format("Invalid 'selectedItemKey': %s: not available.", selectedItemKey));
+        }
+        //
+        this.selectedItemKey = selectedItemKey;
+        //
+        if (refreshMode) {
+            try {
+                this.refresh(); // must refresh everything
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+            catch (MUniqueWidgetIdNotAvailableWebException exception) {
+            }
+        }
+    }
+
+    public String getSelectedItemKey() {
+        return this.selectedItemKey;
+    }
+
+    /* Refresh */
+
+    protected String getItemContent(String parentItemKey) throws MNoWidgetIdWebException { // code partly taken from http://www.codecodex.com/wiki/Count_the_number_of_occurrences_of_a_specific_character_in_a_string
+        if (MText.isEmpty(parentItemKey)) {
+            throw new IllegalArgumentException("Invalid 'parentItemKey': empty.");
+        }
+        //
+        if (null == parentItemKey) {
+            parentItemKey = ""; // rewritten for better readability
+        }
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        int parentItemLevel = parentItemKey.replaceAll("[^.]", "").length();
+        StringBuilder itemContent = new StringBuilder("");
+        if ((0 == parentItemLevel) && (null != this.getTitle())) {
+            itemContent.append(String.format("<tr class=\"MWebVerticalMenuTitleRow %s\">", customClasses));
+            itemContent.append(String.format("<td class=\"MWebVerticalMenuTitleCell %s\" colspan=\"2\">%s</td>", customClasses, MText.getXhtmlEscapedString(this.getTitle())));
+            itemContent.append("</tr>");
+        }
+        String lastItemKey = "";
+        for (String itemKey: this.getItemsReference().keySet()) {
+            lastItemKey = itemKey;
+            if (!itemKey.startsWith(parentItemKey)) {
+                continue;
+            }
+            if (itemKey.replaceAll("[^.]", "").length() != (parentItemLevel + 1)) {
+                continue;
+            }
+            itemContent.append(String.format("<tr class=\"MWebVerticalMenuRow %s\">", customClasses));
+            String text = this.getItemsReference().get(itemKey).getText();
+            if (!MText.isEmpty(text)) {
+                String imageSource = this.getItemsReference().get(itemKey).getImageSource();
+                if (null == imageSource) {
+                    imageSource = String.format("%s/null", this.getApplicationContextReference().getRequestReference().getRequestURL());
+                }
+                String imageClass = "MWebVerticalMenuImageCell";
+                String textClass = "MWebVerticalMenuTextCell";
+                if (itemKey.equals(this.getSelectedItemKey())) {
+                    imageClass = "MWebVerticalMenuSelectedImageCell";
+                    textClass = "MWebVerticalMenuSelectedTextCell";
+                }
+                String onItemSelectionFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onItemSelection', {'selectedItemKey': '%s'});", this.getId(), MText.getJavascriptEscapedString(itemKey));
+                itemContent.append(String.format("<td class=\"%s %s\" onclick=\"%s\" id=\"%s\"><img class=\"MWebVerticalMenuImage %s\" src=\"%s\" alt=\"\" /></td>", imageClass, customClasses, MText.getXhtmlEscapedString(onItemSelectionFunction), this.getId() + MText.getXhtmlEscapedString(itemKey) + "-imageCell", customClasses, MText.getXhtmlEscapedString(imageSource)));
+                itemContent.append(String.format("<td class=\"%s %s\" onclick=\"%s\" id=\"%s\">%s</td>", textClass, customClasses, MText.getXhtmlEscapedString(onItemSelectionFunction), this.getId() + MText.getXhtmlEscapedString(itemKey) + "-textCell", MText.getXhtmlEscapedString(text)));
+            }
+            else {
+                itemContent.append(String.format("<td class=\"MWebVerticalMenuSeparatorCell %s\" id=\"%s\" colspan=\"2\"></td>", customClasses, this.getId() + MText.getXhtmlEscapedString(itemKey) + "-separatorCell"));
+            }
+            itemContent.append("</tr>");
+            //
+            if ((!this.getAccordionMode()) || (this.getAccordionMode() && (null != this.getSelectedItemKey()) && (this.getSelectedItemKey().startsWith(itemKey)))) {
+                String childItemContent = this.getItemContent(itemKey);
+                if (!MText.isEmpty(childItemContent.toString())) {
+                    itemContent.append(String.format("<tr class=\"MWebVerticalMenuRow %s\">", customClasses));
+                    itemContent.append(String.format("<td class=\"MWebVerticalMenuImageCell\" />", customClasses));
+                    itemContent.append(String.format("<td class=\"MWebVerticalMenuChildTableCell %s\" id=\"%s\">%s</td>", customClasses, this.getId() + MText.getXhtmlEscapedString(itemKey) + "-childCell", childItemContent));
+                    itemContent.append("</tr>");
+                }
+            }
+        }
+        //
+        StringBuilder content = new StringBuilder("");
+        if (!MText.isEmpty(itemContent.toString())) {
+            if (MText.isEmpty(parentItemKey)) {
+                content.append(String.format("<table class=\"MWebVerticalMenuTable %s\" style=\"display: inline-table;\" id=\"%s\">", customClasses, this.getId()));
+            }
+            else {
+                content.append(String.format("<table class=\"MWebVerticalMenuChildTable %s\" style=\"display: inline-table; width: 100%%;\" id=\"%s\">", customClasses, this.getId() + MText.getXhtmlEscapedString(lastItemKey) + "-childTable"));
+            }
+            content.append(itemContent);
+            content.append("</table>");
+        }
+        return content.toString();
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String content = this.getItemContent(null);
+        if (MText.isEmpty(content)) {
+            content = String.format("<div id=\"%s\"></div>", this.getId());
+        }
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content)));
+        //
+        super.refresh();
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onItemSelection".equals(event)) {
+            if (!this.getVisibleMode()) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden.", event));
+            }
+            String selectedItemKey = parameters.get("selectedItemKey");
+            if (null == selectedItemKey) {
+                throw new MUnexpectedMessageWebException("Invalid message: selected item key parameter not available.");
+            }
+            else if (!this.getItemsReference().keySet().contains(selectedItemKey)) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected item key parameter not recognized.", selectedItemKey));
+            }
+            this.onItemSelection(selectedItemKey);
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onItemSelection(String selectedItemKey) {
+        this.setSelectedItem(selectedItemKey);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebVerticalMenuItem.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebVerticalMenuItem.java
new file mode 100644 (file)
index 0000000..1dee092
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+
+public class MWebVerticalMenuItem extends MObject {
+
+    protected MWebApplicationContext applicationContext = null;
+
+    protected String text = "";
+    protected String imageSource = null;
+
+    /* */
+
+    public MWebVerticalMenuItem(MWebApplicationContext applicationContext) {
+        super();
+        //
+        if (null == applicationContext) {
+            throw new IllegalArgumentException("Invalid 'applicationContext': null.");
+        }
+        //
+        this.applicationContext = applicationContext;
+    }
+
+    public MWebVerticalMenuItem(MWebApplicationContext applicationContext, String text, String imageSource) {
+        this(applicationContext);
+        //
+        if (null == text) {
+            throw new IllegalArgumentException("Invalid 'text': null.");
+        }
+        //
+        this.text = text;
+        this.imageSource = imageSource;
+    }
+
+    public MWebVerticalMenuItem clone() {
+        return new MWebVerticalMenuItem(this.getApplicationContextReference(), this.getText(), this.getImageSource());
+    }
+
+    /* Application context */
+
+    public MWebApplicationContext getApplicationContextReference() {
+        return this.applicationContext;
+    }
+
+    /* Text */
+
+    public String getText() {
+        return this.text;
+    }
+
+    /* Image source */
+
+    public String getImageSource() {
+        return this.imageSource;
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebView.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebView.java
new file mode 100644 (file)
index 0000000..f072c4a
--- /dev/null
@@ -0,0 +1,425 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+
+public class MWebView extends MObject implements Runnable {
+
+    protected MWebApplicationContext applicationContext = null;
+
+    protected MWebBrowserPage browserPage = null;
+
+    protected String breadcrumb = null;
+    protected String title = "";
+
+    protected LinkedList<MWebDownloader> downloaders = new LinkedList<MWebDownloader>();
+    protected MWebDirectWidget content = null;
+
+    protected LinkedHashSet<Long> uniqueWidgetIds = new LinkedHashSet<Long>();
+    protected long uniqueWidgetIdsPointer = 0;
+
+    /* */
+
+    public MWebView(MWebApplicationContext applicationContext, String breadcrumb) {
+        super();
+        //
+        if (null == applicationContext) {
+            throw new IllegalArgumentException("Invalid 'applicationContext': null.");
+        }
+        if (MText.isBlank(breadcrumb)) {
+            throw new IllegalArgumentException("Invalid 'breadcrumb': null or empty.");
+        }
+        //
+        this.applicationContext = applicationContext;
+        this.breadcrumb = breadcrumb;
+    }
+
+    public void run() {
+        while (true) {
+            try {
+                this.processMessage(this.getBrowserPageReference().getProcessableMessage());
+            }
+            catch (MViewThreadStoppingWebRuntimeException exception) {
+                break;
+            }
+            catch (Exception exception) { // any other exception; put here not to bypass MViewThreadStoppingWebRuntimeException
+                try {
+                    this.getBrowserPageReference().setLastViewThreadException(exception);
+                }
+                catch (MNoBrowserPageWebException exception2) {
+                }
+            }
+            //
+            try {
+                synchronized (Thread.currentThread()) {
+                    Thread.currentThread().wait();
+                }
+            }
+            catch (InterruptedException exception) {
+            }
+        }
+    }
+
+    public Object openView(MWebView view) throws MNoBrowserPageWebException {
+        this.getBrowserPageReference().loadViewThread(view);
+        try {
+            synchronized (Thread.currentThread()) {
+                Thread.currentThread().wait();
+            }
+        }
+        catch (InterruptedException exception) {
+        }
+        //
+        if (this.getBrowserPageReference().getStoppingViewThreadCount() > 0) {
+            this.getBrowserPageReference().decrementStoppingViewThreadCount();
+            throw new MViewThreadStoppingWebRuntimeException("View thread stopping...");
+        }
+        //
+        try {
+            this.refresh();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+        //
+        return this.getBrowserPageReference().getLastViewThreadReturnValueReference();
+    }
+
+    public void close(Object returnValue) throws MNoBrowserPageWebException, MViewNotUnloadableWebException {
+        this.getBrowserPageReference().unloadViewThreads(returnValue, 1, null);
+        throw new MViewThreadStoppingWebRuntimeException("View thread stopping...");
+    }
+
+    public void close(int n) throws MNoBrowserPageWebException, MViewNotUnloadableWebException {
+        this.getBrowserPageReference().unloadViewThreads(null, n, null);
+        throw new MViewThreadStoppingWebRuntimeException("View thread stopping...");
+    }
+
+    public void closeAll(MWebView replacingView) throws MNoBrowserPageWebException, MViewNotUnloadableWebException {
+        this.getBrowserPageReference().unloadViewThreads(null, this.getBrowserPageReference().getViewThreadCount(), replacingView);
+        throw new MViewThreadStoppingWebRuntimeException("View thread stopping...");
+    }
+
+    /* Application context */
+
+    public MWebApplicationContext getApplicationContextReference() {
+        return this.applicationContext;
+    }
+
+    /* Browser page */
+
+    protected void setBrowserPage(MWebBrowserPage browserPage) {
+        this.browserPage = browserPage;
+    }
+
+    public MWebBrowserPage getBrowserPageReference() throws MNoBrowserPageWebException {
+        if (null == this.browserPage) {
+            throw new MNoBrowserPageWebException("Invalid browser page: reference null.");
+        }
+        //
+        return this.browserPage;
+    }
+
+    /* Breadcrumb */
+
+    public String getBreadcrumb() {
+        return this.breadcrumb;
+    }
+
+    /* Title */
+
+    public void setTitle(String title) {
+        this.setTitle(title, true);
+    }
+
+    protected void setTitle(String title, boolean refreshMode) {
+        if (null == title) {
+            throw new IllegalArgumentException("Invalid 'title': null.");
+        }
+        //
+        this.title = title;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshTitle();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    /* Downloaders */
+
+    public void addDownloader(MWebDownloader downloader) throws MUniqueWidgetIdNotAvailableWebException {
+        if (null == downloader) {
+            throw new IllegalArgumentException("Invalid 'downloader': null.");
+        }
+        //
+        downloader.setView(this);
+        this.getDownloadersReference().add(downloader);
+    }
+
+    public void setDownloader(int index, MWebDownloader downloader) throws MUniqueWidgetIdNotAvailableWebException {
+        if ((0 > index) || ((this.getDownloadersReference().size() - 1) < index)) {
+            throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
+        }
+        if (null == downloader) {
+            throw new IllegalArgumentException("Invalid 'downloader': null.");
+        }
+        //
+        downloader.setView(this);
+        this.getDownloadersReference().set(index, downloader);
+    }
+
+    protected LinkedList<MWebDownloader> getDownloadersReference() {
+        return this.downloaders;
+    }
+
+    public MWebDownloader getDownloaderReference(int index) {
+        if ((0 > index) || ((this.getDownloadersReference().size() - 1) < index)) {
+            throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
+        }
+        //
+        return this.getDownloadersReference().get(index);
+    }
+
+    public MWebDownloader getDownloaderReferenceById(String id) throws MDownloaderNotFoundWebException {
+        if (MText.isBlank(id)) {
+            throw new IllegalArgumentException("Invalid 'id': null or empty.");
+        }
+        //
+        for (MWebDownloader downloader: this.getDownloadersReference()) {
+            try {
+                if (downloader.getId().equals(id)) {
+                    return downloader;
+                }
+            }
+            catch (MNoWidgetIdWebException exception) { // cannot happen
+            }
+        }
+        throw new MDownloaderNotFoundWebException(String.format("Invalid 'id': %s.", id));
+    }
+
+    public int getDownloaderCount() {
+        return this.getDownloadersReference().size();
+    }
+
+    public void removeDownloader(int index) {
+        if ((0 > index) || ((this.getDownloadersReference().size() - 1) < index)) {
+            throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
+        }
+        //
+        try {
+            this.getDownloaderReference(index).setView(null);
+        }
+        catch (MUniqueWidgetIdNotAvailableWebException exception) { // cannot happen
+        }
+        this.getDownloadersReference().remove(index);
+    }
+
+    public void clearDownloaders() {
+        this.getDownloadersReference().clear();
+    }
+
+    /* Content */
+
+    public void setContent(MWebDirectWidget directWidget) throws MUniqueWidgetIdNotAvailableWebException {
+        this.setContent(directWidget, true);
+    }
+
+    protected void setContent(MWebDirectWidget directWidget, boolean refreshMode) throws MUniqueWidgetIdNotAvailableWebException {
+        try {
+            this.getContentReference().setView(null);
+        }
+        catch (MNoViewContentWebException exception) {
+        }
+        catch (MUniqueWidgetIdNotAvailableWebException exception) { // cannot happen
+        }
+        //
+        this.content = directWidget;
+        //
+        try {
+            this.getContentReference().setView(this);
+        }
+        catch (MNoViewContentWebException exception) {
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refreshContent();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public MWebDirectWidget getContentReference() throws MNoViewContentWebException {
+        if (null == this.content) {
+            throw new MNoViewContentWebException("Invalid content: reference null.");
+        }
+        //
+        return this.content;
+    }
+
+    /* Display widgets */
+
+    protected MWebDisplayWidget getDisplayWidgetReferenceById(String id) throws MDisplayWidgetNotFoundWebException {
+        try {
+            return this.getContentReference().getDisplayWidgetReferenceById(id);
+        }
+        catch (MDisplayWidgetNotFoundWebException exception) {
+            throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: display widget not available on this path.", id)); // no need to propagate exception
+        }
+        catch (MNoViewContentWebException exception) {
+            throw new MDisplayWidgetNotFoundWebException(String.format("Invalid 'id': %s: no view content.", id)); // no need to propagate exception
+        }
+    }
+
+    /* Unique widget ids */
+
+    protected LinkedHashSet<Long> getUniqueWidgetIdsReference() {
+        return this.uniqueWidgetIds;
+    }
+
+    public long getUniqueWidgetId() throws MUniqueWidgetIdNotAvailableWebException {
+        long p = this.uniqueWidgetIdsPointer;
+        //
+        while (true) {
+            if (Long.MAX_VALUE == this.uniqueWidgetIdsPointer) {
+                this.uniqueWidgetIdsPointer = 0;
+            }
+            else {
+                this.uniqueWidgetIdsPointer++;
+            }
+            if (p == this.uniqueWidgetIdsPointer) {
+                throw new MUniqueWidgetIdNotAvailableWebException("Unique widget id not available: too many widgets registered.");
+            }
+            else if (!this.getUniqueWidgetIdsReference().contains(new Long(this.uniqueWidgetIdsPointer))) {
+                this.getUniqueWidgetIdsReference().add(new Long(this.uniqueWidgetIdsPointer));
+                return this.uniqueWidgetIdsPointer;
+            }
+        }
+    }
+
+    public void freeUniqueWidgetId(long uniqueWidgetId) {
+        if (uniqueWidgetId <= 0) {
+            throw new IllegalArgumentException("Invalid 'uniqueWidgetId': must be positive.");
+        }
+        //
+        this.getUniqueWidgetIdsReference().remove(new Long(uniqueWidgetId));
+    }
+
+    /* Refresh */
+
+    public void checkPresence() throws MNoBrowserPageWebException {
+        this.getBrowserPageReference();
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent("$disableWysiwygBoxEditors();");
+        //
+        this.refreshContent();
+        //
+        this.refreshTitle();
+    }
+
+    protected void refreshContent() throws MNoBrowserPageWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        try {
+            MWebDisplayWidget content = this.getContentReference();
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("$('m_view').innerHTML = '<div id=\"%s\"></div>';", content.getId()));
+            content.onRefresh();
+        }
+        catch (MNoViewContentWebException exception) {
+            this.getApplicationContextReference().addPlainTextResponseContent("$('m_view').innerHTML = '';");
+        }
+    }
+
+    protected void refreshTitle() throws MNoBrowserPageWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("document.title = '%s';", MText.getJavascriptEscapedString(this.getTitle())));
+    }
+
+    /* Messages */
+
+    protected void onMessagePreprocessing() {
+    }
+
+    protected void processMessage(MWebMessage message) throws MUnexpectedMessageWebException {
+        if (null == message) {
+            throw new IllegalArgumentException("Invalid 'message': null.");
+        }
+        //
+        this.onMessagePreprocessing();
+        // parse message and forward it to view or to appropriate widgets
+        String widgetId = message.getWidgetId();
+        String event = message.getEvent();
+        LinkedHashMap<String, String> parameters = message.getParameters();
+        if (MText.isEmpty(widgetId)) { // no widget id = view
+            if ("onRefresh".equals(event)) {
+                this.onRefresh();
+            }
+            else {
+                throw new MUnexpectedMessageWebException(String.format("Invalid 'message': %s: event not recognized.", event));
+            }
+        }
+        else {
+            try { // first search through downloaders...
+                this.getDownloaderReferenceById(widgetId).processMessage(event, parameters);
+            }
+            catch (MDownloaderNotFoundWebException exception) {
+                try { // ...then through display widgets
+                    this.getDisplayWidgetReferenceById(widgetId).processMessage(event, parameters);
+                }
+                catch (MDisplayWidgetNotFoundWebException exception2) {
+                    throw new MUnexpectedMessageWebException(String.format("Invalid 'message': %s: widget not found.", widgetId)); // no need to propagate exception
+                }
+                catch (MUnexpectedMessageWebException exception2) {
+                    throw new MUnexpectedMessageWebException("Invalid 'message': not suitable.", exception2);
+                }
+            }
+            catch (MUnexpectedMessageWebException exception) {
+                throw new MUnexpectedMessageWebException("Invalid 'message': not suitable.", exception);
+            }
+        }
+    }
+
+    public void onRefresh() {
+        try {
+            this.refresh();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebWidget.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebWidget.java
new file mode 100644 (file)
index 0000000..c3c7392
--- /dev/null
@@ -0,0 +1,89 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
+import java.util.LinkedHashMap;
+
+public abstract class MWebWidget extends MObject {
+
+    protected MWebApplicationContext applicationContext = null;
+
+    protected MWebView view = null;
+
+    protected String id = null;
+
+    /* */
+
+    public MWebWidget(MWebApplicationContext applicationContext) {
+        super();
+        //
+        if (null == applicationContext) {
+            throw new IllegalArgumentException("Invalid 'applicationContext': null.");
+        }
+        //
+        this.applicationContext = applicationContext;
+    }
+
+    /* Application context */
+
+    public MWebApplicationContext getApplicationContextReference() {
+        return this.applicationContext;
+    }
+
+    /* View */
+
+    protected void setView(MWebView view) throws MUniqueWidgetIdNotAvailableWebException {
+        try {
+            this.getViewReference().freeUniqueWidgetId((new Long(this.getId().substring("m_widget".length()))).longValue());
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        //
+        this.view = view;
+        //
+        if (null == view) {
+            this.id = null;
+        }
+        else {
+            this.id = (new Long(view.getUniqueWidgetId())).toString();
+        }
+    }
+
+    public MWebView getViewReference() throws MNoViewWebException {
+        if (null == this.view) {
+            throw new MNoViewWebException("Invalid view: reference null.");
+        }
+        //
+        return this.view;
+    }
+
+    /* Id */
+
+    public String getId() throws MNoWidgetIdWebException {
+        if (null == this.id) {
+            throw new MNoWidgetIdWebException("Invalid id: reference null.");
+        }
+        //
+        return "m_widget" + this.id;
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        if (MText.isBlank(event)) {
+            throw new IllegalArgumentException("Invalid 'event': null or empty.");
+        }
+        if (null == parameters) {
+            throw new IllegalArgumentException("Invalid 'parameters': null.");
+        }
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebWysiwygBox.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebWysiwygBox.java
new file mode 100644 (file)
index 0000000..e026693
--- /dev/null
@@ -0,0 +1,200 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+import com.marcozanon.macaco.text.MXhtmlUnsafeStringTextException;
+import java.util.LinkedHashMap;
+
+public class MWebWysiwygBox extends MWebDirectWidget {
+
+    protected String text = "";
+
+    protected boolean enabledMode = true;
+    protected boolean displayedMode = false; // for internal use only
+
+    /* */
+
+    public MWebWysiwygBox(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebWysiwygBox(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    /* Focus */
+
+    public void setFocus() {
+        try {
+            this.refreshFocus();
+        }
+        catch (MNoBrowserPageWebException exception) {
+        }
+        catch (MNoViewWebException exception) {
+        }
+        catch (MNoWidgetIdWebException exception) {
+        }
+        catch (MResponseWebException exception) {
+        }
+    }
+
+    /* Text */
+
+    public void setText(String text) {
+        this.setText(text, true);
+    }
+
+    protected void setText(String text, boolean refreshMode) {
+        if (null == text) {
+            throw new IllegalArgumentException("Invalid 'text': null.");
+        }
+        //
+        try {
+            this.text = MText.getXhtmlSafeString(text);
+        }
+        catch (MXhtmlUnsafeStringTextException exception) {
+            throw new IllegalArgumentException(String.format("Invalid 'text': %s: unsafe Xhtml tags or attributes inside.", text)); // no need to propagate exception
+        }
+        //
+        if (refreshMode) {
+            try {
+                this.refreshText();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    /* Enabled mode */
+
+    public void setEnabledMode(boolean enabledMode) {
+        this.setEnabledMode(enabledMode, true);
+    }
+
+    protected void setEnabledMode(boolean enabledMode, boolean refreshMode) {
+        this.enabledMode = enabledMode;
+        //
+        if (refreshMode) {
+            try {
+                this.refreshEnabledMode();
+            }
+            catch (MNoBrowserPageWebException exception) {
+            }
+            catch (MNoViewWebException exception) {
+            }
+            catch (MNoWidgetIdWebException exception) {
+            }
+            catch (MResponseWebException exception) {
+            }
+        }
+    }
+
+    public boolean getEnabledMode() {
+        return this.enabledMode;
+    }
+
+    /* Refresh */
+
+    protected void refreshFocus() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (this.getEnabledMode()) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $focusWysiwygBoxEditor('%s'); }", this.getId(), this.getId()));
+        }
+    }
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        this.displayedMode = false;
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        customClasses = customClasses + " " + this.getId();
+        StringBuilder content = new StringBuilder("");
+        content.append(String.format("<div class=\"MWebWysiwygBox %s\" style=\"display: inline-block;\" id=\"%s\" cols=\"1\" rows=\"1\"></div>", customClasses, this.getId()));
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content.toString())));
+        //
+        super.refresh();
+        //
+        this.refreshEnabledMode();
+        this.refreshText();
+    }
+
+    protected void refreshEnabledMode() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (this.getEnabledMode()) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $enableWysiwygBoxEditor('%s', '%s'); }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getText())));
+            this.displayedMode = true;
+        }
+        else {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $disableWysiwygBoxEditor('%s'); }", this.getId(), this.getId()));
+            this.displayedMode = false;
+        }
+    }
+
+    protected void refreshText() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        if (this.getEnabledMode() && this.displayedMode) {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $fillWysiwygBoxEditor('%s', '%s'); }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getText())));
+        }
+        else {
+            this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(this.getText())));
+        }
+    }
+
+    /* Messages */
+
+    protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
+        super.processMessage(event, parameters);
+        //
+        if ("onBlur".equals(event)) {
+            if ((!this.getVisibleMode()) || (!this.getEnabledMode())) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not fireable while hidden or disabled.", event));
+            }
+            String text = parameters.get("text");
+            if (null == text) {
+                throw new MUnexpectedMessageWebException("Invalid message: text parameter not available.");
+            }
+            try {
+                String y = MText.getXhtmlSafeString(text);
+            }
+            catch (MXhtmlUnsafeStringTextException exception) {
+                throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: unsafe Xhtml tags or attributes inside.", text)); // no need to propagate exception
+            }
+            this.onBlur(text);
+        }
+        else if ("onRefresh".equals(event)) {
+            this.onRefresh();
+        }
+        else {
+            throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: event not recognized.", event));
+        }
+    }
+
+    public void onBlur(String text) {
+        this.setText(text, false);
+    }
+
+}
diff --git a/3.x/src/java/com/marcozanon/macaco/web/ui/MWebXhtmlLabel.java b/3.x/src/java/com/marcozanon/macaco/web/ui/MWebXhtmlLabel.java
new file mode 100644 (file)
index 0000000..b22c35a
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.web.ui;
+
+import com.marcozanon.macaco.text.MText;
+
+public class MWebXhtmlLabel extends MWebLabel {
+
+    /* */
+
+    public MWebXhtmlLabel(MWebApplicationContext applicationContext) {
+        super(applicationContext);
+    }
+
+    public MWebXhtmlLabel(MWebApplicationContext applicationContext, String text) {
+        this(applicationContext);
+        //
+        this.setText(text);
+    }
+
+    /* Refresh */
+
+    protected void refresh() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException, MUniqueWidgetIdNotAvailableWebException {
+        this.checkPresence();
+        //
+        String customClasses = MText.getXhtmlEscapedString(this.getCustomClasses());
+        if (null == customClasses) {
+            customClasses = "";
+        }
+        String onClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onClick', {});", this.getId());
+        String onDoubleClickFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onDoubleClick', {});", this.getId());
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '<div class=\"MWebXhtmlLabel %s\" style=\"display: inline-block;\" onclick=\"%s\" ondblclick=\"%s\" id=\"%s\"></div>'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(customClasses), MText.getJavascriptEscapedString(onClickFunction), MText.getJavascriptEscapedString(onDoubleClickFunction), this.getId()));
+        //
+        super.refresh();
+        //
+        this.refreshText();
+    }
+
+    protected void refreshText() throws MNoBrowserPageWebException, MNoViewWebException, MNoWidgetIdWebException, MResponseWebException {
+        this.checkPresence();
+        //
+        this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(MText.getXhtmlNumericEntitiesString(this.getText()))));
+    }
+
+}
diff --git a/3.x/src/resources/css/default.css b/3.x/src/resources/css/default.css
new file mode 100644 (file)
index 0000000..fee6d1c
--- /dev/null
@@ -0,0 +1,442 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+/* */
+
+html, body {
+    margin: 0px;
+    padding: 2px;
+    font-style: normal;
+    font-variant: normal;
+    font-weight: normal;
+    font-size: 10px;
+    font-family: sans-serif;
+    text-decoration: none;
+    direction: ltr;
+    color: #444444;
+    background-color: #f7f7f7;
+}
+
+* {
+    font-size: 10px;
+}
+
+/* Breadcrumbs */
+
+.MWebBreadcrumbs {
+    padding: 4px;
+    color: #444444;
+    background-color: #e6f0f7;
+    border: 2px solid #003f7f;
+    text-align: left;
+}
+
+.MWebBreadcrumbItem {
+    cursor: pointer;
+}
+.MWebBreadcrumbItem:hover {
+    text-decoration: underline;
+}
+
+.MWebBreadcrumbLastItem {
+    font-weight: bold;
+}
+
+.MWebBreadcrumbPrefix {
+    font-weight: bold;
+}
+
+/* Check box */
+
+.MWebCheckBox {
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebCheckBox[disabled] {
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Combo box */
+
+.MWebComboBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebComboBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Date box */
+
+.MWebDateBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebDateBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Extended text box */
+
+.MWebExtendedTextBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebExtendedTextBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Grid layout */
+
+.MWebGridLayoutTable {
+    border-spacing: 0px;
+}
+
+.MWebGridLayoutRow {
+    background-color: #f7f7f7;
+    vertical-align: middle;
+}
+
+.MWebGridLayoutCell {
+    padding: 2px;
+    text-align: left;
+}
+
+/* Image */
+
+.MWebImage {
+    color: #444444;
+    background-color: #f7f7f7;
+    border: none;
+}
+
+/* Image button */
+
+.MWebImageButton {
+    color: #ffff00;
+    background-color: #003f7f;
+    border-top: 2px solid #005fbf;
+    border-right: 2px solid #002040;
+    border-bottom: 2px solid #002040;
+    border-left: 2px solid #005fbf;
+    cursor: pointer;
+}
+.MWebImageButton[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+    cursor: auto;
+}
+
+.MWebImageButtonTable {
+    width: 100%;
+    height: 100%;
+}
+
+.MWebImageButtonRow {
+    vertical-align: middle;
+}
+
+.MWebImageButtonImageCell {
+    text-align: center;
+}
+
+.MWebImageButtonImage {
+    border: none;
+}
+
+.MWebImageButtonTextCell {
+    text-align: center;
+}
+
+/* Label */
+
+.MWebLabel {
+}
+
+/* Notification area */
+
+.MWebNotificationArea {
+    top: 4px;
+    left: 4px;
+    width: 480px;
+    font-size: 120%;
+    background-color: #ffff77;
+    border: 2px solid #ffff00;
+}
+
+.MWebNotificationAreaStandardMessage {
+    margin: 2px;
+    padding: 2px;
+    color: #444444;
+    background-color: #ffff77;
+    border: 2px solid #000000;
+    text-align: center;
+}
+
+.MWebNotificationAreaErrorMessage {
+    margin: 2px;
+    padding: 2px;
+    color: #444444;
+    background-color: #ffaaaa;
+    border: 2px solid #000000;
+    text-align: center;
+}
+
+/* Number box */
+
+.MWebNumberBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebNumberBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Password box */
+
+.MWebPasswordBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebPasswordBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Simple text box */
+
+.MWebSimpleTextBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebSimpleTextBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Table */
+
+.MWebTable {
+    border: 2px solid #003f7f;
+    border-spacing: 0px;
+}
+
+.MWebTableColumnHeaderRow {
+    height: 16px;
+    background-color: #e6f0f7;
+    vertical-align: middle;
+}
+
+.MWebTableColumnHeaderRowSelectionCell {
+    padding: 4px;
+    width: 16px;
+    border-bottom: 1px solid #003f7f;
+    text-align: center;
+}
+
+.MWebTableColumnHeaderRowSelector {
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+
+.MWebTableColumnHeaderCell {
+    padding: 4px;
+    color: #444444;
+    border-bottom: 1px solid #003f7f;
+    text-align: center;
+    cursor: pointer;
+}
+
+.MWebTableRow {
+    height: 16px;
+    background-color: #ffffff;
+    vertical-align: middle;
+}
+.MWebTableRow:hover {
+    background-color: #e6f0f7;
+}
+
+.MWebTableRowSelectionCell {
+    padding: 4px;
+    width: 16px;
+    border-bottom: 1px solid #003f7f;
+    text-align: center;
+}
+
+.MWebTableRowSelector {
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+
+.MWebTableCell {
+    padding: 4px;
+    color: #444444;
+    border-bottom: 1px solid #003f7f;
+    text-align: center;
+    cursor: pointer;
+}
+
+.MWebTablePageChangerRow {
+    height: 16px;
+    background-color: #e6f0f7;
+    vertical-align: middle;
+}
+
+.MWebTablePageChangerCell {
+    padding: 4px;
+    text-align: right;
+}
+
+.MWebTablePageChanger {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+
+/* Uploader */
+
+.MWebUploader {
+}
+
+.MWebUploaderFile {
+    width: 100%;
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebUploaderFile[disabled] {
+    width: 100%;
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Vertical menu */
+
+.MWebVerticalMenuTable {
+    border: 2px solid #003f7f;
+    border-spacing: 0px;
+}
+
+.MWebVerticalMenuChildTable {
+    border: none;
+    border-spacing: 0px;
+}
+
+.MWebVerticalMenuTitleRow {
+    height: 16px;
+    background-color: #003f7f;
+    vertical-align: middle;
+}
+
+.MWebVerticalMenuTitleCell {
+    padding: 4px;
+    font-weight: bold;
+    color: #e6f0f7;
+    text-align: left;
+}
+
+.MWebVerticalMenuRow {
+    height: 16px;
+    background-color: #e6f0f7;
+    vertical-align: middle;
+    cursor: pointer;
+}
+
+.MWebVerticalMenuImageCell {
+    padding: 4px;
+    width: 16px;
+    text-align: center;
+}
+
+.MWebVerticalMenuSelectedImageCell {
+    padding: 4px;
+    width: 16px;
+    text-align: center;
+}
+
+.MWebVerticalMenuImage {
+    width: 16px;
+    height: 16px;
+    color: #444444;
+    background-color: #e6f0f7;
+    border: none;
+}
+
+.MWebVerticalMenuTextCell {
+    padding: 4px;
+    color: #444444;
+    text-align: left;
+}
+.MWebVerticalMenuTextCell:hover {
+    text-decoration: underline;
+}
+
+.MWebVerticalMenuSelectedTextCell {
+    padding: 4px;
+    font-weight: bold;
+    color: #444444;
+    text-align: left;
+}
+
+.MWebVerticalMenuSeparatorCell {
+    padding: 4px;
+}
+
+.MWebVerticalMenuChildTableCell {
+    padding: 0px;
+}
+
+/* View */
+
+.MWebView {
+}
+
+/* Waiting icon */
+
+.MWebWaitingIcon {
+    top: 0px;
+    right: 0px;
+    width: 32px;
+    height: 32px;
+    border: 2px solid #ffff00;
+}
+
+/* Wysiwyg box */
+
+.MWebWysiwygBox {
+    color: #444444;
+    background-color: #ffffff;
+    border: 1px solid #444444;
+}
+.MWebWysiwygBox[disabled] {
+    color: #8a8a8a;
+    background-color: #cccccc;
+    border: 1px solid #8a8a8a;
+}
+
+/* Xhtml label */
+
+.MWebXhtmlLabel {
+}
diff --git a/3.x/src/resources/dtd/xhtml1-transitional-macaco-edit.dtd b/3.x/src/resources/dtd/xhtml1-transitional-macaco-edit.dtd
new file mode 100644 (file)
index 0000000..40fc248
--- /dev/null
@@ -0,0 +1,1719 @@
+<!--
+   Extensible HTML version 1.0 Transitional DTD
+
+   This is the same as HTML 4 Transitional except for
+   changes due to the differences between XML and SGML.
+
+   Namespace = http://www.w3.org/1999/xhtml
+
+   For further information, see: http://www.w3.org/TR/xhtml1
+
+   Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+   All Rights Reserved. 
+
+   This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+   $Revision: 1.2 $
+   $Date: 2002/08/01 18:37:55 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!--<!ENTITY % HTMLlat1 PUBLIC
+   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+   "xhtml-lat1.ent">
+%HTMLlat1;-->
+<!-- MACACO: BEGIN "xhtml-lat1.ent" -->
+<!-- Portions (C) International Organization for Standardization 1986
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+    <!ENTITY % HTMLlat1 PUBLIC
+       "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+    %HTMLlat1;
+-->
+
+<!ENTITY nbsp   "&#160;"> <!-- no-break space = non-breaking space,
+                                  U+00A0 ISOnum -->
+<!ENTITY iexcl  "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent   "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound  "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen    "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+                                  U+00A6 ISOnum -->
+<!ENTITY sect   "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml    "&#168;"> <!-- diaeresis = spacing diaeresis,
+                                  U+00A8 ISOdia -->
+<!ENTITY copy   "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf   "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo  "&#171;"> <!-- left-pointing double angle quotation mark
+                                  = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not    "&#172;"> <!-- not sign = angled dash,
+                                  U+00AC ISOnum -->
+<!ENTITY shy    "&#173;"> <!-- soft hyphen = discretionary hyphen,
+                                  U+00AD ISOnum -->
+<!ENTITY reg    "&#174;"> <!-- registered sign = registered trade mark sign,
+                                  U+00AE ISOnum -->
+<!ENTITY macr   "&#175;"> <!-- macron = spacing macron = overline
+                                  = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg    "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+                                  U+00B1 ISOnum -->
+<!ENTITY sup2   "&#178;"> <!-- superscript two = superscript digit two
+                                  = squared, U+00B2 ISOnum -->
+<!ENTITY sup3   "&#179;"> <!-- superscript three = superscript digit three
+                                  = cubed, U+00B3 ISOnum -->
+<!ENTITY acute  "&#180;"> <!-- acute accent = spacing acute,
+                                  U+00B4 ISOdia -->
+<!ENTITY micro  "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para   "&#182;"> <!-- pilcrow sign = paragraph sign,
+                                  U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+                                  = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil  "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1   "&#185;"> <!-- superscript one = superscript digit one,
+                                  U+00B9 ISOnum -->
+<!ENTITY ordm   "&#186;"> <!-- masculine ordinal indicator,
+                                  U+00BA ISOnum -->
+<!ENTITY raquo  "&#187;"> <!-- right-pointing double angle quotation mark
+                                  = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+                                  = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+                                  = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+                                  = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+                                  = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+                                  = latin capital letter A grave,
+                                  U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+                                  U+00C1 ISOlat1 -->
+<!ENTITY Acirc  "&#194;"> <!-- latin capital letter A with circumflex,
+                                  U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+                                  U+00C3 ISOlat1 -->
+<!ENTITY Auml   "&#196;"> <!-- latin capital letter A with diaeresis,
+                                  U+00C4 ISOlat1 -->
+<!ENTITY Aring  "&#197;"> <!-- latin capital letter A with ring above
+                                  = latin capital letter A ring,
+                                  U+00C5 ISOlat1 -->
+<!ENTITY AElig  "&#198;"> <!-- latin capital letter AE
+                                  = latin capital ligature AE,
+                                  U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+                                  U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+                                  U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+                                  U+00C9 ISOlat1 -->
+<!ENTITY Ecirc  "&#202;"> <!-- latin capital letter E with circumflex,
+                                  U+00CA ISOlat1 -->
+<!ENTITY Euml   "&#203;"> <!-- latin capital letter E with diaeresis,
+                                  U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+                                  U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+                                  U+00CD ISOlat1 -->
+<!ENTITY Icirc  "&#206;"> <!-- latin capital letter I with circumflex,
+                                  U+00CE ISOlat1 -->
+<!ENTITY Iuml   "&#207;"> <!-- latin capital letter I with diaeresis,
+                                  U+00CF ISOlat1 -->
+<!ENTITY ETH    "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+                                  U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+                                  U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+                                  U+00D3 ISOlat1 -->
+<!ENTITY Ocirc  "&#212;"> <!-- latin capital letter O with circumflex,
+                                  U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+                                  U+00D5 ISOlat1 -->
+<!ENTITY Ouml   "&#214;"> <!-- latin capital letter O with diaeresis,
+                                  U+00D6 ISOlat1 -->
+<!ENTITY times  "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+                                  = latin capital letter O slash,
+                                  U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+                                  U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+                                  U+00DA ISOlat1 -->
+<!ENTITY Ucirc  "&#219;"> <!-- latin capital letter U with circumflex,
+                                  U+00DB ISOlat1 -->
+<!ENTITY Uuml   "&#220;"> <!-- latin capital letter U with diaeresis,
+                                  U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+                                  U+00DD ISOlat1 -->
+<!ENTITY THORN  "&#222;"> <!-- latin capital letter THORN,
+                                  U+00DE ISOlat1 -->
+<!ENTITY szlig  "&#223;"> <!-- latin small letter sharp s = ess-zed,
+                                  U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+                                  = latin small letter a grave,
+                                  U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+                                  U+00E1 ISOlat1 -->
+<!ENTITY acirc  "&#226;"> <!-- latin small letter a with circumflex,
+                                  U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+                                  U+00E3 ISOlat1 -->
+<!ENTITY auml   "&#228;"> <!-- latin small letter a with diaeresis,
+                                  U+00E4 ISOlat1 -->
+<!ENTITY aring  "&#229;"> <!-- latin small letter a with ring above
+                                  = latin small letter a ring,
+                                  U+00E5 ISOlat1 -->
+<!ENTITY aelig  "&#230;"> <!-- latin small letter ae
+                                  = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+                                  U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+                                  U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+                                  U+00E9 ISOlat1 -->
+<!ENTITY ecirc  "&#234;"> <!-- latin small letter e with circumflex,
+                                  U+00EA ISOlat1 -->
+<!ENTITY euml   "&#235;"> <!-- latin small letter e with diaeresis,
+                                  U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+                                  U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+                                  U+00ED ISOlat1 -->
+<!ENTITY icirc  "&#238;"> <!-- latin small letter i with circumflex,
+                                  U+00EE ISOlat1 -->
+<!ENTITY iuml   "&#239;"> <!-- latin small letter i with diaeresis,
+                                  U+00EF ISOlat1 -->
+<!ENTITY eth    "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+                                  U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+                                  U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+                                  U+00F3 ISOlat1 -->
+<!ENTITY ocirc  "&#244;"> <!-- latin small letter o with circumflex,
+                                  U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+                                  U+00F5 ISOlat1 -->
+<!ENTITY ouml   "&#246;"> <!-- latin small letter o with diaeresis,
+                                  U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+                                  = latin small letter o slash,
+                                  U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+                                  U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+                                  U+00FA ISOlat1 -->
+<!ENTITY ucirc  "&#251;"> <!-- latin small letter u with circumflex,
+                                  U+00FB ISOlat1 -->
+<!ENTITY uuml   "&#252;"> <!-- latin small letter u with diaeresis,
+                                  U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+                                  U+00FD ISOlat1 -->
+<!ENTITY thorn  "&#254;"> <!-- latin small letter thorn,
+                                  U+00FE ISOlat1 -->
+<!ENTITY yuml   "&#255;"> <!-- latin small letter y with diaeresis,
+                                  U+00FF ISOlat1 -->
+<!-- MACACO: END "xhtml-lat1.ent" -->
+
+<!--<!ENTITY % HTMLsymbol PUBLIC
+   "-//W3C//ENTITIES Symbols for XHTML//EN"
+   "xhtml-symbol.ent">
+%HTMLsymbol;-->
+<!-- MACACO: BEGIN "xhtml-symbol.ent" -->
+<!-- Mathematical, Greek and Symbolic characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+     <!ENTITY % HTMLsymbol PUBLIC
+        "-//W3C//ENTITIES Symbols for XHTML//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+     %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+     New names (i.e., not in ISO 8879 list) do not clash with any
+     existing ISO 8879 entity names. ISO 10646 character numbers
+     are given for each character, in hex. values are decimal
+     conversions of the ISO 10646 values and refer to the document
+     character set. Names are Unicode names. 
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof     "&#402;"> <!-- latin small letter f with hook = function
+                                    = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha    "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta     "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma    "&#915;"> <!-- greek capital letter gamma,
+                                    U+0393 ISOgrk3 -->
+<!ENTITY Delta    "&#916;"> <!-- greek capital letter delta,
+                                    U+0394 ISOgrk3 -->
+<!ENTITY Epsilon  "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta     "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta      "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta    "&#920;"> <!-- greek capital letter theta,
+                                    U+0398 ISOgrk3 -->
+<!ENTITY Iota     "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa    "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda   "&#923;"> <!-- greek capital letter lamda,
+                                    U+039B ISOgrk3 -->
+<!ENTITY Mu       "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu       "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi       "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron  "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi       "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho      "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma    "&#931;"> <!-- greek capital letter sigma,
+                                    U+03A3 ISOgrk3 -->
+<!ENTITY Tau      "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon  "&#933;"> <!-- greek capital letter upsilon,
+                                    U+03A5 ISOgrk3 -->
+<!ENTITY Phi      "&#934;"> <!-- greek capital letter phi,
+                                    U+03A6 ISOgrk3 -->
+<!ENTITY Chi      "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi      "&#936;"> <!-- greek capital letter psi,
+                                    U+03A8 ISOgrk3 -->
+<!ENTITY Omega    "&#937;"> <!-- greek capital letter omega,
+                                    U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha    "&#945;"> <!-- greek small letter alpha,
+                                    U+03B1 ISOgrk3 -->
+<!ENTITY beta     "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma    "&#947;"> <!-- greek small letter gamma,
+                                    U+03B3 ISOgrk3 -->
+<!ENTITY delta    "&#948;"> <!-- greek small letter delta,
+                                    U+03B4 ISOgrk3 -->
+<!ENTITY epsilon  "&#949;"> <!-- greek small letter epsilon,
+                                    U+03B5 ISOgrk3 -->
+<!ENTITY zeta     "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta      "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta    "&#952;"> <!-- greek small letter theta,
+                                    U+03B8 ISOgrk3 -->
+<!ENTITY iota     "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa    "&#954;"> <!-- greek small letter kappa,
+                                    U+03BA ISOgrk3 -->
+<!ENTITY lambda   "&#955;"> <!-- greek small letter lamda,
+                                    U+03BB ISOgrk3 -->
+<!ENTITY mu       "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu       "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi       "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron  "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi       "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho      "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf   "&#962;"> <!-- greek small letter final sigma,
+                                    U+03C2 ISOgrk3 -->
+<!ENTITY sigma    "&#963;"> <!-- greek small letter sigma,
+                                    U+03C3 ISOgrk3 -->
+<!ENTITY tau      "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon  "&#965;"> <!-- greek small letter upsilon,
+                                    U+03C5 ISOgrk3 -->
+<!ENTITY phi      "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi      "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi      "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega    "&#969;"> <!-- greek small letter omega,
+                                    U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek theta symbol,
+                                    U+03D1 NEW -->
+<!ENTITY upsih    "&#978;"> <!-- greek upsilon with hook symbol,
+                                    U+03D2 NEW -->
+<!ENTITY piv      "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull     "&#8226;"> <!-- bullet = black small circle,
+                                     U+2022 ISOpub  -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip   "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+                                     U+2026 ISOpub  -->
+<!ENTITY prime    "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime    "&#8243;"> <!-- double prime = seconds = inches,
+                                     U+2033 ISOtech -->
+<!ENTITY oline    "&#8254;"> <!-- overline = spacing overscore,
+                                     U+203E NEW -->
+<!ENTITY frasl    "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp   "&#8472;"> <!-- script capital P = power set
+                                     = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image    "&#8465;"> <!-- black-letter capital I = imaginary part,
+                                     U+2111 ISOamso -->
+<!ENTITY real     "&#8476;"> <!-- black-letter capital R = real part symbol,
+                                     U+211C ISOamso -->
+<!ENTITY trade    "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym  "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+                                     U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+     U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr     "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr     "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr     "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr     "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr     "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr    "&#8629;"> <!-- downwards arrow with corner leftwards
+                                     = carriage return, U+21B5 NEW -->
+<!ENTITY lArr     "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+    but also does not have any other character for that function. So lArr can
+    be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr     "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr     "&#8658;"> <!-- rightwards double arrow,
+                                     U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have 
+     another character with this function so rArr can be used for 'implies'
+     as ISOtech suggests -->
+<!ENTITY dArr     "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr     "&#8660;"> <!-- left right double arrow,
+                                     U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall   "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part     "&#8706;"> <!-- partial differential, U+2202 ISOtech  -->
+<!ENTITY exist    "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty    "&#8709;"> <!-- empty set = null set, U+2205 ISOamso -->
+<!ENTITY nabla    "&#8711;"> <!-- nabla = backward difference,
+                                     U+2207 ISOtech -->
+<!ENTITY isin     "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin    "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni       "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!ENTITY prod     "&#8719;"> <!-- n-ary product = product sign,
+                                     U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+     the same glyph might be used for both -->
+<!ENTITY sum      "&#8721;"> <!-- n-ary summation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+     though the same glyph might be used for both -->
+<!ENTITY minus    "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast   "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic    "&#8730;"> <!-- square root = radical sign,
+                                     U+221A ISOtech -->
+<!ENTITY prop     "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin    "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang      "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and      "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or       "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap      "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup      "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int      "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4   "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim      "&#8764;"> <!-- tilde operator = varies with = similar to,
+                                     U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+     although the same glyph might be used to represent both  -->
+<!ENTITY cong     "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp    "&#8776;"> <!-- almost equal to = asymptotic to,
+                                     U+2248 ISOamsr -->
+<!ENTITY ne       "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv    "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le       "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge       "&#8805;"> <!-- greater-than or equal to,
+                                     U+2265 ISOtech -->
+<!ENTITY sub      "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup      "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!ENTITY nsub     "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube     "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe     "&#8839;"> <!-- superset of or equal to,
+                                     U+2287 ISOtech -->
+<!ENTITY oplus    "&#8853;"> <!-- circled plus = direct sum,
+                                     U+2295 ISOamsb -->
+<!ENTITY otimes   "&#8855;"> <!-- circled times = vector product,
+                                     U+2297 ISOamsb -->
+<!ENTITY perp     "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+                                     U+22A5 ISOtech -->
+<!ENTITY sdot     "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil    "&#8968;"> <!-- left ceiling = APL upstile,
+                                     U+2308 ISOamsc  -->
+<!ENTITY rceil    "&#8969;"> <!-- right ceiling, U+2309 ISOamsc  -->
+<!ENTITY lfloor   "&#8970;"> <!-- left floor = APL downstile,
+                                     U+230A ISOamsc  -->
+<!ENTITY rfloor   "&#8971;"> <!-- right floor, U+230B ISOamsc  -->
+<!ENTITY lang     "&#9001;"> <!-- left-pointing angle bracket = bra,
+                                     U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than sign' 
+     or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang     "&#9002;"> <!-- right-pointing angle bracket = ket,
+                                     U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than sign' 
+     or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz      "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades   "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs    "&#9827;"> <!-- black club suit = shamrock,
+                                     U+2663 ISOpub -->
+<!ENTITY hearts   "&#9829;"> <!-- black heart suit = valentine,
+                                     U+2665 ISOpub -->
+<!ENTITY diams    "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
+<!-- MACACO: END "xhtml-symbol.ent" -->
+
+<!--<!ENTITY % HTMLspecial PUBLIC
+   "-//W3C//ENTITIES Special for XHTML//EN"
+   "xhtml-special.ent">
+%HTMLspecial;-->
+<!-- MACACO: BEGIN "xhtml-special.ent" -->
+<!-- Special characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+     <!ENTITY % HTMLspecial PUBLIC
+        "-//W3C//ENTITIES Special for XHTML//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+     %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+     New names (i.e., not in ISO 8879 list) do not clash with any
+     existing ISO 8879 entity names. ISO 10646 character numbers
+     are given for each character, in hex. values are decimal
+     conversions of the ISO 10646 values and refer to the document
+     character set. Names are Unicode names. 
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot    "&#34;"> <!--  quotation mark, U+0022 ISOnum -->
+<!ENTITY amp     "&#38;#38;"> <!--  ampersand, U+0026 ISOnum -->
+<!ENTITY lt      "&#38;#60;"> <!--  less-than sign, U+003C ISOnum -->
+<!ENTITY gt      "&#62;"> <!--  greater-than sign, U+003E ISOnum -->
+<!ENTITY apos   "&#39;"> <!--  apostrophe = APL quote, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig   "&#338;"> <!--  latin capital ligature OE,
+                                    U+0152 ISOlat2 -->
+<!ENTITY oelig   "&#339;"> <!--  latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron  "&#352;"> <!--  latin capital letter S with caron,
+                                    U+0160 ISOlat2 -->
+<!ENTITY scaron  "&#353;"> <!--  latin small letter s with caron,
+                                    U+0161 ISOlat2 -->
+<!ENTITY Yuml    "&#376;"> <!--  latin capital letter Y with diaeresis,
+                                    U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ    "&#710;"> <!--  modifier letter circumflex accent,
+                                    U+02C6 ISOpub -->
+<!ENTITY tilde   "&#732;"> <!--  small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp    "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp    "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp  "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj    "&#8204;"> <!-- zero width non-joiner,
+                                    U+200C NEW RFC 2070 -->
+<!ENTITY zwj     "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm     "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm     "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash   "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash   "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo   "&#8216;"> <!-- left single quotation mark,
+                                    U+2018 ISOnum -->
+<!ENTITY rsquo   "&#8217;"> <!-- right single quotation mark,
+                                    U+2019 ISOnum -->
+<!ENTITY sbquo   "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo   "&#8220;"> <!-- left double quotation mark,
+                                    U+201C ISOnum -->
+<!ENTITY rdquo   "&#8221;"> <!-- right double quotation mark,
+                                    U+201D ISOnum -->
+<!ENTITY bdquo   "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger  "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger  "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil  "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo  "&#8249;"> <!-- single left-pointing angle quotation mark,
+                                    U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo  "&#8250;"> <!-- single right-pointing angle quotation mark,
+                                    U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+
+<!-- Currency Symbols -->
+<!ENTITY euro   "&#8364;"> <!--  euro sign, U+20AC NEW -->
+<!-- MACACO: END "xhtml-special.ent" -->
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+    <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+    <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+    <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+    <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+    <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+    <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+    <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+    <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+    <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+    <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+    <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+    <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+    <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+    <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+    <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+    <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+    <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+    <!-- pixel, percentage, or relative -->
+
+<!ENTITY % Pixels "CDATA">
+    <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+    <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+    Black  = #000000    Green  = #008000
+    Silver = #C0C0C0    Lime   = #00FF00
+    Gray   = #808080    Olive  = #808000
+    White  = #FFFFFF    Yellow = #FFFF00
+    Maroon = #800000    Navy   = #000080
+    Red    = #FF0000    Blue   = #0000FF
+    Purple = #800080    Teal   = #008080
+    Fuchsia= #FF00FF    Aqua   = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+  id       document-wide unique id
+  class    space separated list of classes
+  style    associated style info
+  title    advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id          ID             #IMPLIED
+  class       CDATA          #IMPLIED
+  style       %StyleSheet;   #IMPLIED
+  title       %Text;         #IMPLIED"
+  >
+
+<!-- internationalization attributes
+  lang        language code (backwards compatible)
+  xml:lang    language code (as per XML 1.0 spec)
+  dir         direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang        %LanguageCode; #IMPLIED
+  xml:lang    %LanguageCode; #IMPLIED
+  dir         (ltr|rtl)      #IMPLIED"
+  >
+
+<!-- attributes for common UI events
+  onclick     a pointer button was clicked
+  ondblclick  a pointer button was double clicked
+  onmousedown a pointer button was pressed down
+  onmouseup   a pointer button was released
+  onmousemove a pointer was moved onto the element
+  onmouseout  a pointer was moved away from the element
+  onkeypress  a key was pressed and released
+  onkeydown   a key was pressed down
+  onkeyup     a key was released
+-->
+<!ENTITY % events
+ "onclick     %Script;       #IMPLIED
+  ondblclick  %Script;       #IMPLIED
+  onmousedown %Script;       #IMPLIED
+  onmouseup   %Script;       #IMPLIED
+  onmouseover %Script;       #IMPLIED
+  onmousemove %Script;       #IMPLIED
+  onmouseout  %Script;       #IMPLIED
+  onkeypress  %Script;       #IMPLIED
+  onkeydown   %Script;       #IMPLIED
+  onkeyup     %Script;       #IMPLIED"
+  >
+
+<!-- attributes for elements that can get the focus
+  accesskey   accessibility key character
+  tabindex    position in tabbing order
+  onfocus     the element got the focus
+  onblur      the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey   %Character;    #IMPLIED
+  tabindex    %Number;       #IMPLIED
+  onfocus     %Script;       #IMPLIED
+  onblur      %Script;       #IMPLIED"
+  >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+     align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+   "object | applet | img | map | iframe">
+       
+<!ENTITY % special.basic
+       "br | span | bdo">
+
+<!ENTITY % special
+   "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+                      | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+                   samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
+
+<!ENTITY % block
+    "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+   "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+     font, or basefont -->
+
+<!ENTITY % pre.content
+   "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+          %inline.forms; | %misc.inline;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+   "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+      table | br | span | bdo | object | applet | img | map |
+      %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+  %i18n;
+  id          ID             #IMPLIED
+  xmlns       %URI;          #FIXED 'http://www.w3.org/1999/xhtml'
+  >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+     title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+     ((title, %head.misc;, (base, %head.misc;)?) |
+      (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+  %i18n;
+  id          ID             #IMPLIED
+  profile     %URI;          #IMPLIED
+  >
+
+<!-- The title element is not considered part of the flow of text.
+       It should be displayed, for example as the page header or
+       window title. Exactly one title is required per document.
+    -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title 
+  %i18n;
+  id          ID             #IMPLIED
+  >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+  id          ID             #IMPLIED
+  href        %URI;          #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+  %i18n;
+  id          ID             #IMPLIED
+  http-equiv  CDATA          #IMPLIED
+  name        CDATA          #IMPLIED
+  content     CDATA          #REQUIRED
+  scheme      CDATA          #IMPLIED
+  >
+
+<!--
+  Relationship values can be used in principle:
+
+   a) for document specific toolbars/menus when used
+      with the link element in document head e.g.
+        start, contents, previous, next, index, end, help
+   b) to link to a separate style sheet (rel="stylesheet")
+   c) to make a link to a script (rel="script")
+   d) by stylesheets to control how collections of
+      html nodes are rendered into printed documents
+   e) to make a link to a printable version of this document
+      e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+  %attrs;
+  charset     %Charset;      #IMPLIED
+  href        %URI;          #IMPLIED
+  hreflang    %LanguageCode; #IMPLIED
+  type        %ContentType;  #IMPLIED
+  rel         %LinkTypes;    #IMPLIED
+  rev         %LinkTypes;    #IMPLIED
+  media       %MediaDesc;    #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+  %i18n;
+  id          ID             #IMPLIED
+  type        %ContentType;  #REQUIRED
+  media       %MediaDesc;    #IMPLIED
+  title       %Text;         #IMPLIED
+  xml:space   (preserve)     #FIXED 'preserve'
+  >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+  id          ID             #IMPLIED
+  charset     %Charset;      #IMPLIED
+  type        %ContentType;  #REQUIRED
+  language    CDATA          #IMPLIED
+  src         %URI;          #IMPLIED
+  defer       (defer)        #IMPLIED
+  xml:space   (preserve)     #FIXED 'preserve'
+  >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+  %attrs;
+  >
+
+<!--======================= Frames =======================================-->
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+  %coreattrs;
+  longdesc    %URI;          #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  src         %URI;          #IMPLIED
+  frameborder (1|0)          "1"
+  marginwidth %Pixels;       #IMPLIED
+  marginheight %Pixels;      #IMPLIED
+  scrolling   (yes|no|auto)  "auto"
+  align       %ImgAlign;     #IMPLIED
+  height      %Length;       #IMPLIED
+  width       %Length;       #IMPLIED
+  >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes %Flow;>
+<!ATTLIST noframes
+  %attrs;
+  >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+  %attrs;
+  onload      %Script;       #IMPLIED
+  onunload    %Script;       #IMPLIED
+  background  %URI;          #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  text        %Color;        #IMPLIED
+  link        %Color;        #IMPLIED
+  vlink       %Color;        #IMPLIED
+  alink       %Color;        #IMPLIED
+  >
+
+<!ELEMENT div %Flow;>  <!-- generic language/style container -->
+<!ATTLIST div
+  %attrs;
+  %TextAlign;
+  >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+  %attrs;
+  %TextAlign;
+  >
+
+<!--=================== Headings =========================================-->
+
+<!--
+  There are six levels of headings from h1 (the most important)
+  to h6 (the least important).
+-->
+
+<!ELEMENT h1  %Inline;>
+<!ATTLIST h1
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+  %attrs;
+  %TextAlign;
+  >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+  %attrs;
+  type        %ULStyle;     #IMPLIED
+  compact     (compact)     #IMPLIED
+  >
+
+<!-- Ordered list numbering style
+
+    1   arabic numbers      1, 2, 3, ...
+    a   lower alpha         a, b, c, ...
+    A   upper alpha         A, B, C, ...
+    i   lower roman         i, ii, iii, ...
+    I   upper roman         I, II, III, ...
+
+    The style is applied to the sequence number which by default
+    is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+  %attrs;
+  type        %OLStyle;      #IMPLIED
+  compact     (compact)      #IMPLIED
+  start       %Number;       #IMPLIED
+  >
+
+<!-- single column list (DEPRECATED) --> 
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+  %attrs;
+  compact     (compact)     #IMPLIED
+  >
+
+<!-- multiple column list (DEPRECATED) --> 
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+  %attrs;
+  compact     (compact)     #IMPLIED
+  >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+  %attrs;
+  type        %LIStyle;      #IMPLIED
+  value       %Number;       #IMPLIED
+  >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+  %attrs;
+  compact     (compact)      #IMPLIED
+  >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+  %attrs;
+  >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+  %attrs;
+  >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+  %attrs;
+  >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+  %attrs;
+  align       (left|center|right) #IMPLIED
+  noshade     (noshade)      #IMPLIED
+  size        %Pixels;       #IMPLIED
+  width       %Length;       #IMPLIED
+  >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding 
+        "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+  %attrs;
+  width       %Number;      #IMPLIED
+  xml:space   (preserve)    #FIXED 'preserve'
+  >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+  %attrs;
+  cite        %URI;          #IMPLIED
+  >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+  %attrs;
+  >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+  ins/del are allowed in block and inline content, but its
+  inappropriate to include block content within an ins element
+  occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+  %attrs;
+  cite        %URI;          #IMPLIED
+  datetime    %Datetime;     #IMPLIED
+  >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+  %attrs;
+  cite        %URI;          #IMPLIED
+  datetime    %Datetime;     #IMPLIED
+  >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+  %attrs;
+  %focus;
+  charset     %Charset;      #IMPLIED
+  type        %ContentType;  #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  href        %URI;          #IMPLIED
+  hreflang    %LanguageCode; #IMPLIED
+  rel         %LinkTypes;    #IMPLIED
+  rev         %LinkTypes;    #IMPLIED
+  shape       %Shape;        "rect"
+  coords      %Coords;       #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+  %attrs;
+  >
+
+<!ELEMENT bdo %Inline;>  <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+  %coreattrs;
+  %events;
+  lang        %LanguageCode; #IMPLIED
+  xml:lang    %LanguageCode; #IMPLIED
+  dir         (ltr|rtl)      #REQUIRED
+  >
+
+<!ELEMENT br EMPTY>   <!-- forced line break -->
+<!ATTLIST br
+  %coreattrs;
+  clear       (left|all|right|none) "none"
+  >
+
+<!ELEMENT em %Inline;>   <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;>   <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;>   <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;>   <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;>   <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;>  <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;>   <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;>   <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;>   <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;>   <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;>   <!-- inlined quote -->
+<!ATTLIST q
+  %attrs;
+  cite        %URI;          #IMPLIED
+  >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;>   <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;>   <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;>   <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;>   <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;>   <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;>   <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;>   <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;>   <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY>  <!-- base font size -->
+<!ATTLIST basefont
+  id          ID             #IMPLIED
+  size        CDATA          #REQUIRED
+  color       %Color;        #IMPLIED
+  face        CDATA          #IMPLIED
+  >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+  %coreattrs;
+  %i18n;
+  size        CDATA          #IMPLIED
+  color       %Color;        #IMPLIED
+  face        CDATA          #IMPLIED
+  >
+
+<!--==================== Object ======================================-->
+<!--
+  object is used to embed objects as part of HTML pages.
+  param elements should precede other content. Parameters
+  can also be expressed as attribute/value pairs on the
+  object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+  %attrs;
+  declare     (declare)      #IMPLIED
+  classid     %URI;          #IMPLIED
+  codebase    %URI;          #IMPLIED
+  data        %URI;          #IMPLIED
+  type        %ContentType;  #IMPLIED
+  codetype    %ContentType;  #IMPLIED
+  archive     %UriList;      #IMPLIED
+  standby     %Text;         #IMPLIED
+  height      %Length;       #IMPLIED
+  width       %Length;       #IMPLIED
+  usemap      %URI;          #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  tabindex    %Number;       #IMPLIED
+  align       %ImgAlign;     #IMPLIED
+  border      %Pixels;       #IMPLIED
+  hspace      %Pixels;       #IMPLIED
+  vspace      %Pixels;       #IMPLIED
+  >
+
+<!--
+  param is used to supply a named property value.
+  In XML it would seem natural to follow RDF and support an
+  abbreviated syntax where the param elements are replaced
+  by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+  id          ID             #IMPLIED
+  name        CDATA          #REQUIRED
+  value       CDATA          #IMPLIED
+  valuetype   (data|ref|object) "data"
+  type        %ContentType;  #IMPLIED
+  >
+
+<!--=================== Java applet ==================================-->
+<!--
+  One of code or object attributes must be present.
+  Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+  %coreattrs;
+  codebase    %URI;          #IMPLIED
+  archive     CDATA          #IMPLIED
+  code        CDATA          #IMPLIED
+  object      CDATA          #IMPLIED
+  alt         %Text;         #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  width       %Length;       #REQUIRED
+  height      %Length;       #REQUIRED
+  align       %ImgAlign;     #IMPLIED
+  hspace      %Pixels;       #IMPLIED
+  vspace      %Pixels;       #IMPLIED
+  >
+
+<!--=================== Images ===========================================-->
+
+<!--
+   To avoid accessibility problems for people who aren't
+   able to see the image, you should provide a text
+   description using the alt and longdesc attributes.
+   In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+  %attrs;
+  src         %URI;          #REQUIRED
+  alt         %Text;         #REQUIRED
+  name        NMTOKEN        #IMPLIED
+  longdesc    %URI;          #IMPLIED
+  height      %Length;       #IMPLIED
+  width       %Length;       #IMPLIED
+  usemap      %URI;          #IMPLIED
+  ismap       (ismap)        #IMPLIED
+  align       %ImgAlign;     #IMPLIED
+  border      %Length;       #IMPLIED
+  hspace      %Pixels;       #IMPLIED
+  vspace      %Pixels;       #IMPLIED
+  >
+
+<!-- usemap points to a map element which may be in this document
+  or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+     separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+  %i18n;
+  %events;
+  id          ID             #REQUIRED
+  class       CDATA          #IMPLIED
+  style       %StyleSheet;   #IMPLIED
+  title       %Text;         #IMPLIED
+  name        CDATA          #IMPLIED
+  >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+  %attrs;
+  %focus;
+  shape       %Shape;        "rect"
+  coords      %Coords;       #IMPLIED
+  href        %URI;          #IMPLIED
+  nohref      (nohref)       #IMPLIED
+  alt         %Text;         #REQUIRED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;>   <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+  %attrs;
+  action      %URI;          #REQUIRED
+  method      (get|post)     "get"
+  name        NMTOKEN        #IMPLIED
+  enctype     %ContentType;  "application/x-www-form-urlencoded"
+  onsubmit    %Script;       #IMPLIED
+  onreset     %Script;       #IMPLIED
+  accept      %ContentTypes; #IMPLIED
+  accept-charset %Charsets;  #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!--
+  Each label must not contain more than ONE field
+  Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+  %attrs;
+  for         IDREF          #IMPLIED
+  accesskey   %Character;    #IMPLIED
+  onfocus     %Script;       #IMPLIED
+  onblur      %Script;       #IMPLIED
+  >
+
+<!ENTITY % InputType
+  "(text | password | checkbox |
+    radio | submit | reset |
+    file | hidden | image | button)"
+   >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY>     <!-- form control -->
+<!ATTLIST input
+  %attrs;
+  %focus;
+  type        %InputType;    "text"
+  name        CDATA          #IMPLIED
+  value       CDATA          #IMPLIED
+  checked     (checked)      #IMPLIED
+  disabled    (disabled)     #IMPLIED
+  readonly    (readonly)     #IMPLIED
+  size        CDATA          #IMPLIED
+  maxlength   %Number;       #IMPLIED
+  src         %URI;          #IMPLIED
+  alt         CDATA          #IMPLIED
+  usemap      %URI;          #IMPLIED
+  onselect    %Script;       #IMPLIED
+  onchange    %Script;       #IMPLIED
+  accept      %ContentTypes; #IMPLIED
+  align       %ImgAlign;     #IMPLIED
+  >
+
+<!ELEMENT select (optgroup|option)+>  <!-- option selector -->
+<!ATTLIST select
+  %attrs;
+  name        CDATA          #IMPLIED
+  size        %Number;       #IMPLIED
+  multiple    (multiple)     #IMPLIED
+  disabled    (disabled)     #IMPLIED
+  tabindex    %Number;       #IMPLIED
+  onfocus     %Script;       #IMPLIED
+  onblur      %Script;       #IMPLIED
+  onchange    %Script;       #IMPLIED
+  >
+
+<!ELEMENT optgroup (option)+>   <!-- option group -->
+<!ATTLIST optgroup
+  %attrs;
+  disabled    (disabled)     #IMPLIED
+  label       %Text;         #REQUIRED
+  >
+
+<!ELEMENT option (#PCDATA)>     <!-- selectable choice -->
+<!ATTLIST option
+  %attrs;
+  selected    (selected)     #IMPLIED
+  disabled    (disabled)     #IMPLIED
+  label       %Text;         #IMPLIED
+  value       CDATA          #IMPLIED
+  >
+
+<!ELEMENT textarea (#PCDATA)>     <!-- multi-line text field -->
+<!ATTLIST textarea
+  %attrs;
+  %focus;
+  name        CDATA          #IMPLIED
+  rows        %Number;       #REQUIRED
+  cols        %Number;       #REQUIRED
+  disabled    (disabled)     #IMPLIED
+  readonly    (readonly)     #IMPLIED
+  onselect    %Script;       #IMPLIED
+  onchange    %Script;       #IMPLIED
+  >
+
+<!--
+  The fieldset element is used to group form fields.
+  Only one legend element should occur in the content
+  and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+  %attrs;
+  >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;>     <!-- fieldset label -->
+<!ATTLIST legend
+  %attrs;
+  accesskey   %Character;    #IMPLIED
+  align       %LAlign;       #IMPLIED
+  >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+--> 
+<!ELEMENT button %button.content;>  <!-- push button -->
+<!ATTLIST button
+  %attrs;
+  %focus;
+  name        CDATA          #IMPLIED
+  value       CDATA          #IMPLIED
+  type        (button|submit|reset) "submit"
+  disabled    (disabled)     #IMPLIED
+  >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+  %coreattrs;
+  %i18n;
+  prompt      %Text;         #IMPLIED
+  >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+     "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+  
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+  char        alignment char, e.g. char=':'
+  charoff     offset for alignment char
+-->
+<!ENTITY % cellhalign
+  "align      (left|center|right|justify|char) #IMPLIED
+   char       %Character;    #IMPLIED
+   charoff    %Length;       #IMPLIED"
+  >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+  "valign     (top|middle|bottom|baseline) #IMPLIED"
+  >
+
+<!ELEMENT table
+     (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption  %Inline;>
+<!ELEMENT thead    (tr)+>
+<!ELEMENT tfoot    (tr)+>
+<!ELEMENT tbody    (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col      EMPTY>
+<!ELEMENT tr       (th|td)+>
+<!ELEMENT th       %Flow;>
+<!ELEMENT td       %Flow;>
+
+<!ATTLIST table
+  %attrs;
+  summary     %Text;         #IMPLIED
+  width       %Length;       #IMPLIED
+  border      %Pixels;       #IMPLIED
+  frame       %TFrame;       #IMPLIED
+  rules       %TRules;       #IMPLIED
+  cellspacing %Length;       #IMPLIED
+  cellpadding %Length;       #IMPLIED
+  align       %TAlign;       #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+  %attrs;
+  align       %CAlign;       #IMPLIED
+  >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+  %attrs;
+  span        %Number;       "1"
+  width       %MultiLength;  #IMPLIED
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+     width=64        width in screen pixels
+     width=0.5*      relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+  %attrs;
+  span        %Number;       "1"
+  width       %MultiLength;  #IMPLIED
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!--
+    Use thead to duplicate headers when breaking table
+    across page boundaries, or for static headers when
+    tbody sections are rendered in scrolling panel.
+
+    Use tfoot to duplicate footers when breaking table
+    across page boundaries, or for static footers when
+    tbody sections are rendered in scrolling panel.
+
+    Use multiple tbody sections when rules are needed
+    between groups of table rows.
+-->
+<!ATTLIST thead
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!ATTLIST tfoot
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!ATTLIST tbody
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!ATTLIST tr
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  bgcolor     %Color;        #IMPLIED
+  >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+  %attrs;
+  abbr        %Text;         #IMPLIED
+  axis        CDATA          #IMPLIED
+  headers     IDREFS         #IMPLIED
+  scope       %Scope;        #IMPLIED
+  rowspan     %Number;       "1"
+  colspan     %Number;       "1"
+  %cellhalign;
+  %cellvalign;
+  nowrap      (nowrap)       #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  width       %Length;       #IMPLIED
+  height      %Length;       #IMPLIED
+  >
+
+<!ATTLIST td
+  %attrs;
+  abbr        %Text;         #IMPLIED
+  axis        CDATA          #IMPLIED
+  headers     IDREFS         #IMPLIED
+  scope       %Scope;        #IMPLIED
+  rowspan     %Number;       "1"
+  colspan     %Number;       "1"
+  %cellhalign;
+  %cellvalign;
+  nowrap      (nowrap)       #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  width       %Length;       #IMPLIED
+  height      %Length;       #IMPLIED
+  >
diff --git a/3.x/src/resources/gif/waitingIcon.gif b/3.x/src/resources/gif/waitingIcon.gif
new file mode 100644 (file)
index 0000000..2f69669
Binary files /dev/null and b/3.x/src/resources/gif/waitingIcon.gif differ
diff --git a/3.x/src/resources/javascript/$.js b/3.x/src/resources/javascript/$.js
new file mode 100644 (file)
index 0000000..9537aaa
--- /dev/null
@@ -0,0 +1,107 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+function $(id) {
+    return document.getElementById(id);
+}
+
+function $S(id) {
+    return $(id).style;
+}
+
+function $T(tag) {
+    return document.getElementsByTagName(tag);
+}
+
+function $getRenderingEngine() { // inspired by http://www.javascriptkit.com/javatutors/navigator.shtml
+    if (/WebKit/.test(navigator.userAgent)) {
+        return 'Webkit';
+    }
+    else if (/Gecko/.test(navigator.userAgent)) {
+        return 'Gecko';
+    }
+    else if (/MSIE/.test(navigator.userAgent)) {
+        return 'Ie';
+    }
+    else if (/Opera/.test(navigator.userAgent)) {
+        return 'Opera';
+    }
+    else {
+        return null;
+    }
+}
+
+function $getApplicationPageWidth() {
+    var x = 0;
+    if (self.innerWidth) {
+        x = self.innerWidth;
+    }
+    else if ((document.documentElement) && (document.documentElement.clientWidth)) {
+        x = document.documentElement.clientWidth;
+    }
+    else if (document.body) {
+        x = document.body.clientWidth;
+    }
+    return x;
+}
+
+function $getApplicationPageHeight() {
+    var y = 0;
+    if (self.innerHeight) {
+        y = self.innerHeight;
+    }
+    else if ((document.documentElement) && (document.documentElement.clientHeight)) {
+        y = document.documentElement.clientHeight;
+    }
+    else if (document.body) {
+        y = document.body.clientHeight;
+    }
+    return y;
+}
+
+function $enableWysiwygBoxEditor(id, content) {
+    tinyMCE.init({
+        setup: function(editor) { // adapted from http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=79723
+            editor.onInit.add(function(editor) {
+                editor.setContent(content);
+                tinyMCE.dom.Event.add(editor.getWin(), 'blur', function(event) {
+                    m_messageInterface.fireMessage(id, 'onBlur', {'text': editor.getContent()});
+                });
+            });
+        },
+        mode: 'none',
+        theme: 'advanced',
+        plugins: 'paste, directionality',
+        entity_encoding: 'raw',
+        theme_advanced_buttons1: 'pasteword, |, undo, redo, |, fontselect, fontsizeselect, |, bold, italic, underline, strikethrough, |, justifyleft, justifycenter, justifyright, justifyfull, |, ltr, rtl, |, bullist, numlist, outdent, indent, |, forecolor, backcolor, |, link, unlink, image',
+        theme_advanced_buttons2: '',
+        theme_advanced_buttons3: '',
+        theme_advanced_buttons4: '',
+        theme_advanced_toolbar_location: 'top',
+        theme_advanced_toolbar_align: 'left'
+    });
+    tinyMCE.execCommand('mceAddControl', false, id);
+}
+
+function $focusWysiwygBoxEditor(id) {
+    tinyMCE.execCommand('mceFocus', false, id);
+}
+
+function $fillWysiwygBoxEditor(id, content) {
+    tinyMCE.execInstanceCommand(id, 'mceSetContent', false, content);
+}
+
+function $disableWysiwygBoxEditor(id) {
+    tinyMCE.execCommand('mceRemoveControl', false, id);
+}
+
+function $disableWysiwygBoxEditors() { // adapted from http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12319
+    if ('undefined' != typeof(tinyMCE)) {
+        for (id in tinyMCE.editors) {
+            tinyMCE.execCommand('mceRemoveControl', false, id);
+        }
+    }
+}
diff --git a/3.x/src/resources/javascript/MWebCustomJsonHelper.js b/3.x/src/resources/javascript/MWebCustomJsonHelper.js
new file mode 100644 (file)
index 0000000..774578a
--- /dev/null
@@ -0,0 +1,120 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+function MWebCustomJsonHelper() { // CAUTION: partial Json implementation (for Macaco only)
+
+    this.encodeArray = function(x) {
+        var string = '';
+        var n = 0;
+        for (p in x) {
+            n++;
+            if (1 < n) {
+                string += ', ';
+            }
+            string += this.encode(x[p]);
+        }
+        return '[' + string + ']';
+    }
+
+    this.encodeBoolean = function(x) {
+        return x.toString();
+    }
+
+    this.encodeNull = function(x) {
+        return 'null';
+    }
+
+    this.encodeNumber = function(x) {
+        return x.toString();
+    }
+
+    this.encodeObject = function(x) {
+        var string = '';
+        var n = 0;
+        for (var p in x) {
+            n++;
+            if (1 < n) {
+                string += ', ';
+            }
+            string += this.encodeString(p) + ': ' + this.encode(x[p]);
+        }
+        return '{' + string + '}';
+    }
+
+    this.encodeString = function(x) {
+        var string = '';
+        for (var c = 0; c < x.length; c++) {
+            if ('"' == x[c]) {
+                string += '\\\"';
+            }
+            else if ('\\' == x[c]) {
+                string += '\\\\';
+            }
+            else if ('/' == x[c]) {
+                string += '\\/';
+            }
+            else if ('\b' == x[c]) {
+                string += '\\b';
+            }
+            else if ('\f' == x[c]) {
+                string += '\\f';
+            }
+            else if ('\n' == x[c]) {
+                string += '\\n';
+            }
+            else if ('\r' == x[c]) {
+                string += '\\r';
+            }
+            else if ('\t' == x[c]) {
+                string += '\\t';
+            }
+            else if (0x001F >= x[c]) { // non-special control Ascii character
+                var s = x.charCodeAt(c).toString(16).toUpperCase();
+                while (4 > s.length) {
+                    s = '0' + s;
+                }
+                string += '\\u' + s;
+            }
+            else {
+                string += x[c];
+            }
+        }
+        return '"' + string + '"';
+    }
+
+    this.encode = function(x) {
+        var string = null;
+        switch (typeof(x)) {
+            case 'boolean':
+                string = this.encodeBoolean(x);
+                break;
+            case 'number':
+                string = this.encodeNumber(x);
+                break;
+            case 'object':
+                if (null == x) {
+                    string = this.encodeNull(x);
+                }
+                else if (Array == x.constructor) {
+                    string = this.encodeArray(x);
+                }
+                else {
+                    string = this.encodeObject(x);
+                }
+                break;
+            case 'string':
+                string = this.encodeString(x);
+                break;
+            }
+            return string;
+    }
+
+    this.decode = function(x) {
+        x = x.replace(/(\\r)?\\n/gi, "\\\\n").replace(/(\\u000D)?(\\u000A)/gi, "\\\\n");
+        return eval('(' + x + ')'); // CAUTION: for trusted sources only!
+    }
+
+}
diff --git a/3.x/src/resources/javascript/MWebMessageInterface.js b/3.x/src/resources/javascript/MWebMessageInterface.js
new file mode 100644 (file)
index 0000000..f46e42e
--- /dev/null
@@ -0,0 +1,198 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+function MWebMessageInterface(destinationUrl, securityId, waitingIcon) {
+
+    MWebMessageInterface.CLEAN_ERROR_MODE = 0;
+    MWebMessageInterface.SILENT_ERROR_MODE = 1;
+    MWebMessageInterface.DEBUG_ERROR_MODE = 2;
+
+    this.destinationUrl = destinationUrl;
+    this.securityId = securityId;
+    this.waitingIcon = waitingIcon;
+    this.messageQueue = new Array();
+    this.interval = window.setInterval('m_messageInterface.runMessageProcessingLoop();', 5);
+
+    /* Ajax interface */
+
+    this.getAjaxInterface = function() { // modified from http://developer.mozilla.org/en/docs/AJAX:Getting_Started
+        var ajaxInterface = null;
+        if (window.XMLHttpRequest) { // all modern browsers...
+            ajaxInterface = new XMLHttpRequest();
+        }
+        return ajaxInterface;
+    }
+
+    /* Message processing */
+
+    this.enterWaitingMode = function() {
+        var i1 = $('m_waitingIcon');
+        if (null == i1) {
+            i1 = document.createElement('img');
+            i1.className = 'MWebWaitingIcon';
+            i1.style.display = 'none';
+            i1.style.zIndex = '9999';
+            i1.style.position = 'fixed';
+            i1.style.opacity = '0.95';
+            i1.setAttribute('id', 'm_waitingIcon');
+            i1.src = this.waitingIcon.src;
+            i1.alt = 'Loading...';
+            document.body.appendChild(i1);
+        }
+        $S('m_waitingIcon').display = 'block';
+        return true;
+    }
+
+    this.quitWaitingMode = function() {
+        $S('m_waitingIcon').display = 'none';
+        return true;
+    }
+
+    this.fireMessage = function(widgetId, event, parameters) {
+        this.messageQueue.push(new Array(widgetId, event, parameters, false));
+        return true;
+    }
+
+    this.runMessageProcessingLoop = function() {
+        if (0 == this.messageQueue.length) {
+            try {
+                this.quitWaitingMode();
+            }
+            catch (exception) {
+            }
+            return true;
+        }
+        else if (this.messageQueue[0][4]) {
+            return true;
+        }
+        try {
+            this.enterWaitingMode();
+        }
+        catch (exception) {
+        }
+        this.messageQueue[0][4] = true;
+        var message = this.messageQueue[0];
+        this.processMessage(message[0], message[1], message[2]);
+        return true;
+    }
+
+    this.getMessageString = function(widgetId, event, parameters) {
+        for (var p in parameters) {
+            parameters[p] = '' + parameters[p];
+        }
+        return (new MWebCustomJsonHelper()).encode({'widgetId': '' + widgetId, 'event': '' + event, 'parameters': parameters});
+    }
+
+    this.processMessage = function(widgetId, event, parameters) {
+        try {
+            var ajaxInterface = this.getAjaxInterface();
+            if (null == ajaxInterface) {
+                throw new Error('Unable to instantiate Ajax interface.');
+            }
+            var parameters = 'securityId=' + this.securityId + '&message=' + encodeURIComponent(this.getMessageString(widgetId, event, parameters));
+            var messageInterface = this;
+            ajaxInterface.open('POST', this.destinationUrl, true);
+            ajaxInterface.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+            ajaxInterface.setRequestHeader('Content-length', parameters.length);
+            ajaxInterface.setRequestHeader('Connection', 'close');
+            ajaxInterface.onreadystatechange = function() {
+                try {
+                    if (4 > ajaxInterface.readyState) {
+                        return true;
+                    }
+                    if ((200 != ajaxInterface.status) || (!messageInterface.evaluateServerOutput(ajaxInterface.responseText))) {
+                        throw new Error('Unable to parse message.');
+                    }
+                    messageInterface.messageQueue.shift();
+                    return true;
+                }
+                catch (exception) {
+                    return messageInterface.processException(exception);
+                }
+            };
+            ajaxInterface.send(parameters);
+        }
+        catch (exception) {
+            return this.processException(exception);
+        }
+        return true;
+    }
+
+    this.evaluateServerOutput = function(responseText) {
+        var responseValue = (new MWebCustomJsonHelper()).decode(responseText);
+        var errorMode = responseValue.errorMode;
+        var parameter = responseValue.parameter;
+        if (MWebMessageInterface.DEBUG_ERROR_MODE == errorMode) {
+            window.alert('Exception: ' + parameter + '.');
+            return false;
+        }
+        else if (MWebMessageInterface.SILENT_ERROR_MODE == errorMode) {
+            return false;
+        }
+        else { // MWebMessageInterface.CLEAN_ERROR_MODE
+            eval(parameter);
+            return true;
+        }
+    }
+
+    /* Upload fake message processing */
+
+    this.fireUploadFakeMessage = function(widgetId) {
+        this.enterWaitingMode();
+        $(widgetId).action = this.destinationUrl + '?securityId=' + this.securityId + '&message=' + encodeURIComponent(this.getMessageString(widgetId, 'onUpload', {}));
+        $(widgetId).submit();
+        $(widgetId).action = '#';
+        $(widgetId).reset();
+        this.quitWaitingMode();
+        return true;
+    }
+
+    /* Pings */
+
+    this.sendPingRequest = function() {
+        try {
+            var ajaxInterface = this.getAjaxInterface();
+            if (null == ajaxInterface) {
+                throw new Error('Unable to instantiate Ajax interface.');
+            }
+            var messageInterface = this;
+            ajaxInterface.open('GET', this.destinationUrl + '/ping', false);
+            ajaxInterface.setRequestHeader('Content-type', 'text/plain');
+            ajaxInterface.setRequestHeader('Content-length', '0');
+            ajaxInterface.setRequestHeader('Connection', 'close');
+            ajaxInterface.onreadystatechange = function() {
+                try {
+                    if (4 > ajaxInterface.readyState) {
+                        return true;
+                    }
+                    if (200 != ajaxInterface.status) {
+                        throw new Error('Unable to parse message.');
+                    }
+                    return true;
+                }
+                catch (exception) {
+                    return messageInterface.processException(exception);
+                }
+            };
+            ajaxInterface.send(null);
+        }
+        catch (exception) {
+            return this.processException(exception);
+        }
+        return true;
+    }
+
+    /* Exceptions */
+
+    this.processException = function(exception) {
+        if (window.confirm('Message processing failed. ' + exception.message + '\n\nPage will be refreshed to synchronize state.')) {
+            document.location.reload();
+        }
+        this.messageQueue = new Array();
+        return false;
+    }
+
+}
diff --git a/3.x/src/resources/javascript/MWebNotificationArea.js b/3.x/src/resources/javascript/MWebNotificationArea.js
new file mode 100644 (file)
index 0000000..870a25f
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2012 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+function MWebNotificationArea() {
+
+    this.defaultOpacity = 0.95;
+    this.opacityDecrementFactor = 40;
+    this.visible = false;
+    this.fading = false;
+    this.interval = null;
+
+    /* Area visualization */
+
+    this.addMessage = function(error, message) {
+        var i = $('m_notificationArea');
+        if (null == i) {
+            i = document.createElement('div');
+            i.className = 'MWebNotificationArea';
+            i.style.display = 'none';
+            i.style.zIndex = '9999';
+            i.style.position = 'fixed';
+            i.setAttribute('id', 'm_notificationArea');
+            document.body.appendChild(i);
+        }
+        var className = 'MWebNotificationAreaStandardMessage';
+        if (error) {
+            className = 'MWebNotificationAreaErrorMessage';
+        }
+        i.innerHTML += '<div class="' + className + '">' + message + '</div>';
+        if (this.fading) {
+            clearInterval(this.interval);
+            this.interval = null;
+            this.fading = false;
+        }
+        i.style.opacity = this.defaultOpacity;
+        this.visible = true;
+        i.style.display = 'block';
+        return true;
+    }
+
+    this.hide = function() {
+        if ((!this.visible) || (this.fading)) {
+            return true;
+        }
+        var i = $('m_notificationArea');
+        if (null != i) {
+            this.fading = true;
+            this.interval = setInterval('m_notificationArea.fadeOut(m_notificationArea.defaultOpacity / ' + this.opacityDecrementFactor + ')', 50);
+        }
+        return true;
+    }
+
+    this.fadeOut = function(opacityDecrement) {
+        if (!this.visible) {
+            return true;
+        }
+        var i = $('m_notificationArea');
+        if (null != i) {
+            if (0.1 > i.style.opacity) {
+                clearInterval(this.interval);
+                this.interval = null;
+                i.style.display = 'none';
+                i.innerHTML = '';
+                this.fading = false;
+                this.visible = false;
+                return true;
+            }
+            i.style.opacity -= opacityDecrement;
+        }
+        return true;
+    }
+
+}
diff --git a/3.x/src/resources/javascript/TinyMCE/langs/en.js b/3.x/src/resources/javascript/TinyMCE/langs/en.js
new file mode 100644 (file)
index 0000000..19324f7
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n({en:{common:{"more_colors":"More Colors...","invalid_data":"Error: Invalid values entered, these are marked in red.","popup_blocked":"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.","clipboard_no_support":"Currently not supported by your browser, use keyboard shortcuts instead.","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","not_set":"-- Not Set --","class_name":"Class",browse:"Browse",close:"Close",cancel:"Cancel",update:"Update",insert:"Insert",apply:"Apply","edit_confirm":"Do you want to use the WYSIWYG mode for this textarea?","invalid_data_number":"{#field} must be a number","invalid_data_min":"{#field} must be a number greater than {#min}","invalid_data_size":"{#field} must be a number or percentage",value:"(value)"},contextmenu:{full:"Full",right:"Right",center:"Center",left:"Left",align:"Alignment"},insertdatetime:{"day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","inserttime_desc":"Insert Time","insertdate_desc":"Insert Date","time_fmt":"%H:%M:%S","date_fmt":"%Y-%m-%d"},print:{"print_desc":"Print"},preview:{"preview_desc":"Preview"},directionality:{"rtl_desc":"Direction Right to Left","ltr_desc":"Direction Left to Right"},layer:{content:"New layer...","absolute_desc":"Toggle Absolute Positioning","backward_desc":"Move Backward","forward_desc":"Move Forward","insertlayer_desc":"Insert New Layer"},save:{"save_desc":"Save","cancel_desc":"Cancel All Changes"},nonbreaking:{"nonbreaking_desc":"Insert Non-Breaking Space Character"},iespell:{download:"ieSpell not detected. Do you want to install it now?","iespell_desc":"Check Spelling"},advhr:{"delta_height":"","delta_width":"","advhr_desc":"Insert Horizontal Line"},emotions:{"delta_height":"","delta_width":"","emotions_desc":"Emotions"},searchreplace:{"replace_desc":"Find/Replace","delta_width":"","delta_height":"","search_desc":"Find"},advimage:{"delta_width":"","image_desc":"Insert/Edit Image","delta_height":""},advlink:{"delta_height":"","delta_width":"","link_desc":"Insert/Edit Link"},xhtmlxtras:{"attribs_delta_height":"","attribs_delta_width":"","ins_delta_height":"","ins_delta_width":"","del_delta_height":"","del_delta_width":"","acronym_delta_height":"","acronym_delta_width":"","abbr_delta_height":"","abbr_delta_width":"","cite_delta_height":"","cite_delta_width":"","attribs_desc":"Insert/Edit Attributes","ins_desc":"Insertion","del_desc":"Deletion","acronym_desc":"Acronym","abbr_desc":"Abbreviation","cite_desc":"Citation"},style:{"delta_height":"","delta_width":"",desc:"Edit CSS Style"},paste:{"plaintext_mode_stick":"Paste is now in plain text mode. Click again to toggle back to regular paste mode.","plaintext_mode":"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.","selectall_desc":"Select All","paste_word_desc":"Paste from Word","paste_text_desc":"Paste as Plain Text"},"paste_dlg":{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."},table:{"merge_cells_delta_height":"","merge_cells_delta_width":"","table_delta_height":"","table_delta_width":"","cellprops_delta_height":"","cellprops_delta_width":"","rowprops_delta_height":"","rowprops_delta_width":"",cell:"Cell",col:"Column",row:"Row",del:"Delete Table","copy_row_desc":"Copy Table Row","cut_row_desc":"Cut Table Row","paste_row_after_desc":"Paste Table Row After","paste_row_before_desc":"Paste Table Row Before","props_desc":"Table Properties","cell_desc":"Table Cell Properties","row_desc":"Table Row Properties","merge_cells_desc":"Merge Table Cells","split_cells_desc":"Split Merged Table Cells","delete_col_desc":"Delete Column","col_after_desc":"Insert Column After","col_before_desc":"Insert Column Before","delete_row_desc":"Delete Row","row_after_desc":"Insert Row After","row_before_desc":"Insert Row Before",desc:"Insert/Edit Table"},autosave:{"warning_message":"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?","restore_content":"Restore auto-saved content.","unload_msg":"The changes you made will be lost if you navigate away from this page."},fullscreen:{desc:"Toggle Full Screen Mode"},media:{"delta_height":"","delta_width":"",edit:"Edit Embedded Media",desc:"Insert/Edit Embedded Media"},fullpage:{desc:"Document Properties","delta_width":"","delta_height":""},template:{desc:"Insert Predefined Template Content"},visualchars:{desc:"Show/Hide Visual Control Characters"},spellchecker:{desc:"Toggle Spell Checker",menu:"Spell Checker Settings","ignore_word":"Ignore Word","ignore_words":"Ignore All",langs:"Languages",wait:"Please wait...",sug:"Suggestions","no_sug":"No Suggestions","no_mpell":"No misspellings found.","learn_word":"Learn word"},pagebreak:{desc:"Insert Page Break for Printing"},advlist:{types:"Types",def:"Default","lower_alpha":"Lower Alpha","lower_greek":"Lower Greek","lower_roman":"Lower Roman","upper_alpha":"Upper Alpha","upper_roman":"Upper Roman",circle:"Circle",disc:"Disc",square:"Square"},colors:{"333300":"Dark olive","993300":"Burnt orange","000000":"Black","003300":"Dark green","003366":"Dark azure","000080":"Navy Blue","333399":"Indigo","333333":"Very dark gray","800000":"Maroon",FF6600:"Orange","808000":"Olive","008000":"Green","008080":"Teal","0000FF":"Blue","666699":"Grayish blue","808080":"Gray",FF0000:"Red",FF9900:"Amber","99CC00":"Yellow green","339966":"Sea green","33CCCC":"Turquoise","3366FF":"Royal blue","800080":"Purple","999999":"Medium gray",FF00FF:"Magenta",FFCC00:"Gold",FFFF00:"Yellow","00FF00":"Lime","00FFFF":"Aqua","00CCFF":"Sky blue","993366":"Brown",C0C0C0:"Silver",FF99CC:"Pink",FFCC99:"Peach",FFFF99:"Light yellow",CCFFCC:"Pale green",CCFFFF:"Pale cyan","99CCFF":"Light sky blue",CC99FF:"Plum",FFFFFF:"White"},aria:{"rich_text_area":"Rich Text Area"},wordcount:{words:"Words:"},visualblocks:{desc:'Show/hide block elements'}}});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/license.txt b/3.x/src/resources/javascript/TinyMCE/license.txt
new file mode 100644 (file)
index 0000000..60d6d4c
--- /dev/null
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE\r
+                      Version 2.1, February 1999\r
+\r
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.\r
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+[This is the first released version of the Lesser GPL.  It also counts\r
+ as the successor of the GNU Library Public License, version 2, hence\r
+ the version number 2.1.]\r
+\r
+                           Preamble\r
+\r
+  The licenses for most software are designed to take away your\r
+freedom to share and change it.  By contrast, the GNU General Public\r
+Licenses are intended to guarantee your freedom to share and change\r
+free software--to make sure the software is free for all its users.\r
+\r
+  This license, the Lesser General Public License, applies to some\r
+specially designated software packages--typically libraries--of the\r
+Free Software Foundation and other authors who decide to use it.  You\r
+can use it too, but we suggest you first think carefully about whether\r
+this license or the ordinary General Public License is the better\r
+strategy to use in any particular case, based on the explanations below.\r
+\r
+  When we speak of free software, we are referring to freedom of use,\r
+not price.  Our General Public Licenses are designed to make sure that\r
+you have the freedom to distribute copies of free software (and charge\r
+for this service if you wish); that you receive source code or can get\r
+it if you want it; that you can change the software and use pieces of\r
+it in new free programs; and that you are informed that you can do\r
+these things.\r
+\r
+  To protect your rights, we need to make restrictions that forbid\r
+distributors to deny you these rights or to ask you to surrender these\r
+rights.  These restrictions translate to certain responsibilities for\r
+you if you distribute copies of the library or if you modify it.\r
+\r
+  For example, if you distribute copies of the library, whether gratis\r
+or for a fee, you must give the recipients all the rights that we gave\r
+you.  You must make sure that they, too, receive or can get the source\r
+code.  If you link other code with the library, you must provide\r
+complete object files to the recipients, so that they can relink them\r
+with the library after making changes to the library and recompiling\r
+it.  And you must show them these terms so they know their rights.\r
+\r
+  We protect your rights with a two-step method: (1) we copyright the\r
+library, and (2) we offer you this license, which gives you legal\r
+permission to copy, distribute and/or modify the library.\r
+\r
+  To protect each distributor, we want to make it very clear that\r
+there is no warranty for the free library.  Also, if the library is\r
+modified by someone else and passed on, the recipients should know\r
+that what they have is not the original version, so that the original\r
+author's reputation will not be affected by problems that might be\r
+introduced by others.\r
+\r
+  Finally, software patents pose a constant threat to the existence of\r
+any free program.  We wish to make sure that a company cannot\r
+effectively restrict the users of a free program by obtaining a\r
+restrictive license from a patent holder.  Therefore, we insist that\r
+any patent license obtained for a version of the library must be\r
+consistent with the full freedom of use specified in this license.\r
+\r
+  Most GNU software, including some libraries, is covered by the\r
+ordinary GNU General Public License.  This license, the GNU Lesser\r
+General Public License, applies to certain designated libraries, and\r
+is quite different from the ordinary General Public License.  We use\r
+this license for certain libraries in order to permit linking those\r
+libraries into non-free programs.\r
+\r
+  When a program is linked with a library, whether statically or using\r
+a shared library, the combination of the two is legally speaking a\r
+combined work, a derivative of the original library.  The ordinary\r
+General Public License therefore permits such linking only if the\r
+entire combination fits its criteria of freedom.  The Lesser General\r
+Public License permits more lax criteria for linking other code with\r
+the library.\r
+\r
+  We call this license the "Lesser" General Public License because it\r
+does Less to protect the user's freedom than the ordinary General\r
+Public License.  It also provides other free software developers Less\r
+of an advantage over competing non-free programs.  These disadvantages\r
+are the reason we use the ordinary General Public License for many\r
+libraries.  However, the Lesser license provides advantages in certain\r
+special circumstances.\r
+\r
+  For example, on rare occasions, there may be a special need to\r
+encourage the widest possible use of a certain library, so that it becomes\r
+a de-facto standard.  To achieve this, non-free programs must be\r
+allowed to use the library.  A more frequent case is that a free\r
+library does the same job as widely used non-free libraries.  In this\r
+case, there is little to gain by limiting the free library to free\r
+software only, so we use the Lesser General Public License.\r
+\r
+  In other cases, permission to use a particular library in non-free\r
+programs enables a greater number of people to use a large body of\r
+free software.  For example, permission to use the GNU C Library in\r
+non-free programs enables many more people to use the whole GNU\r
+operating system, as well as its variant, the GNU/Linux operating\r
+system.\r
+\r
+  Although the Lesser General Public License is Less protective of the\r
+users' freedom, it does ensure that the user of a program that is\r
+linked with the Library has the freedom and the wherewithal to run\r
+that program using a modified version of the Library.\r
+\r
+  The precise terms and conditions for copying, distribution and\r
+modification follow.  Pay close attention to the difference between a\r
+"work based on the library" and a "work that uses the library".  The\r
+former contains code derived from the library, whereas the latter must\r
+be combined with the library in order to run.\r
+\r
+                 GNU LESSER GENERAL PUBLIC LICENSE\r
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+  0. This License Agreement applies to any software library or other\r
+program which contains a notice placed by the copyright holder or\r
+other authorized party saying it may be distributed under the terms of\r
+this Lesser General Public License (also called "this License").\r
+Each licensee is addressed as "you".\r
+\r
+  A "library" means a collection of software functions and/or data\r
+prepared so as to be conveniently linked with application programs\r
+(which use some of those functions and data) to form executables.\r
+\r
+  The "Library", below, refers to any such software library or work\r
+which has been distributed under these terms.  A "work based on the\r
+Library" means either the Library or any derivative work under\r
+copyright law: that is to say, a work containing the Library or a\r
+portion of it, either verbatim or with modifications and/or translated\r
+straightforwardly into another language.  (Hereinafter, translation is\r
+included without limitation in the term "modification".)\r
+\r
+  "Source code" for a work means the preferred form of the work for\r
+making modifications to it.  For a library, complete source code means\r
+all the source code for all modules it contains, plus any associated\r
+interface definition files, plus the scripts used to control compilation\r
+and installation of the library.\r
+\r
+  Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope.  The act of\r
+running a program using the Library is not restricted, and output from\r
+such a program is covered only if its contents constitute a work based\r
+on the Library (independent of the use of the Library in a tool for\r
+writing it).  Whether that is true depends on what the Library does\r
+and what the program that uses the Library does.\r
+  \r
+  1. You may copy and distribute verbatim copies of the Library's\r
+complete source code as you receive it, in any medium, provided that\r
+you conspicuously and appropriately publish on each copy an\r
+appropriate copyright notice and disclaimer of warranty; keep intact\r
+all the notices that refer to this License and to the absence of any\r
+warranty; and distribute a copy of this License along with the\r
+Library.\r
+\r
+  You may charge a fee for the physical act of transferring a copy,\r
+and you may at your option offer warranty protection in exchange for a\r
+fee.\r
+\r
+  2. You may modify your copy or copies of the Library or any portion\r
+of it, thus forming a work based on the Library, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+    a) The modified work must itself be a software library.\r
+\r
+    b) You must cause the files modified to carry prominent notices\r
+    stating that you changed the files and the date of any change.\r
+\r
+    c) You must cause the whole of the work to be licensed at no\r
+    charge to all third parties under the terms of this License.\r
+\r
+    d) If a facility in the modified Library refers to a function or a\r
+    table of data to be supplied by an application program that uses\r
+    the facility, other than as an argument passed when the facility\r
+    is invoked, then you must make a good faith effort to ensure that,\r
+    in the event an application does not supply such function or\r
+    table, the facility still operates, and performs whatever part of\r
+    its purpose remains meaningful.\r
+\r
+    (For example, a function in a library to compute square roots has\r
+    a purpose that is entirely well-defined independent of the\r
+    application.  Therefore, Subsection 2d requires that any\r
+    application-supplied function or table used by this function must\r
+    be optional: if the application does not supply it, the square\r
+    root function must still compute square roots.)\r
+\r
+These requirements apply to the modified work as a whole.  If\r
+identifiable sections of that work are not derived from the Library,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works.  But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Library, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote\r
+it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Library.\r
+\r
+In addition, mere aggregation of another work not based on the Library\r
+with the Library (or with a work based on the Library) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+  3. You may opt to apply the terms of the ordinary GNU General Public\r
+License instead of this License to a given copy of the Library.  To do\r
+this, you must alter all the notices that refer to this License, so\r
+that they refer to the ordinary GNU General Public License, version 2,\r
+instead of to this License.  (If a newer version than version 2 of the\r
+ordinary GNU General Public License has appeared, then you can specify\r
+that version instead if you wish.)  Do not make any other change in\r
+these notices.\r
+\r
+  Once this change is made in a given copy, it is irreversible for\r
+that copy, so the ordinary GNU General Public License applies to all\r
+subsequent copies and derivative works made from that copy.\r
+\r
+  This option is useful when you wish to copy part of the code of\r
+the Library into a program that is not a library.\r
+\r
+  4. You may copy and distribute the Library (or a portion or\r
+derivative of it, under Section 2) in object code or executable form\r
+under the terms of Sections 1 and 2 above provided that you accompany\r
+it with the complete corresponding machine-readable source code, which\r
+must be distributed under the terms of Sections 1 and 2 above on a\r
+medium customarily used for software interchange.\r
+\r
+  If distribution of object code is made by offering access to copy\r
+from a designated place, then offering equivalent access to copy the\r
+source code from the same place satisfies the requirement to\r
+distribute the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+  5. A program that contains no derivative of any portion of the\r
+Library, but is designed to work with the Library by being compiled or\r
+linked with it, is called a "work that uses the Library".  Such a\r
+work, in isolation, is not a derivative work of the Library, and\r
+therefore falls outside the scope of this License.\r
+\r
+  However, linking a "work that uses the Library" with the Library\r
+creates an executable that is a derivative of the Library (because it\r
+contains portions of the Library), rather than a "work that uses the\r
+library".  The executable is therefore covered by this License.\r
+Section 6 states terms for distribution of such executables.\r
+\r
+  When a "work that uses the Library" uses material from a header file\r
+that is part of the Library, the object code for the work may be a\r
+derivative work of the Library even though the source code is not.\r
+Whether this is true is especially significant if the work can be\r
+linked without the Library, or if the work is itself a library.  The\r
+threshold for this to be true is not precisely defined by law.\r
+\r
+  If such an object file uses only numerical parameters, data\r
+structure layouts and accessors, and small macros and small inline\r
+functions (ten lines or less in length), then the use of the object\r
+file is unrestricted, regardless of whether it is legally a derivative\r
+work.  (Executables containing this object code plus portions of the\r
+Library will still fall under Section 6.)\r
+\r
+  Otherwise, if the work is a derivative of the Library, you may\r
+distribute the object code for the work under the terms of Section 6.\r
+Any executables containing that work also fall under Section 6,\r
+whether or not they are linked directly with the Library itself.\r
+\r
+  6. As an exception to the Sections above, you may also combine or\r
+link a "work that uses the Library" with the Library to produce a\r
+work containing portions of the Library, and distribute that work\r
+under terms of your choice, provided that the terms permit\r
+modification of the work for the customer's own use and reverse\r
+engineering for debugging such modifications.\r
+\r
+  You must give prominent notice with each copy of the work that the\r
+Library is used in it and that the Library and its use are covered by\r
+this License.  You must supply a copy of this License.  If the work\r
+during execution displays copyright notices, you must include the\r
+copyright notice for the Library among them, as well as a reference\r
+directing the user to the copy of this License.  Also, you must do one\r
+of these things:\r
+\r
+    a) Accompany the work with the complete corresponding\r
+    machine-readable source code for the Library including whatever\r
+    changes were used in the work (which must be distributed under\r
+    Sections 1 and 2 above); and, if the work is an executable linked\r
+    with the Library, with the complete machine-readable "work that\r
+    uses the Library", as object code and/or source code, so that the\r
+    user can modify the Library and then relink to produce a modified\r
+    executable containing the modified Library.  (It is understood\r
+    that the user who changes the contents of definitions files in the\r
+    Library will not necessarily be able to recompile the application\r
+    to use the modified definitions.)\r
+\r
+    b) Use a suitable shared library mechanism for linking with the\r
+    Library.  A suitable mechanism is one that (1) uses at run time a\r
+    copy of the library already present on the user's computer system,\r
+    rather than copying library functions into the executable, and (2)\r
+    will operate properly with a modified version of the library, if\r
+    the user installs one, as long as the modified version is\r
+    interface-compatible with the version that the work was made with.\r
+\r
+    c) Accompany the work with a written offer, valid for at\r
+    least three years, to give the same user the materials\r
+    specified in Subsection 6a, above, for a charge no more\r
+    than the cost of performing this distribution.\r
+\r
+    d) If distribution of the work is made by offering access to copy\r
+    from a designated place, offer equivalent access to copy the above\r
+    specified materials from the same place.\r
+\r
+    e) Verify that the user has already received a copy of these\r
+    materials or that you have already sent this user a copy.\r
+\r
+  For an executable, the required form of the "work that uses the\r
+Library" must include any data and utility programs needed for\r
+reproducing the executable from it.  However, as a special exception,\r
+the materials to be distributed need not include anything that is\r
+normally distributed (in either source or binary form) with the major\r
+components (compiler, kernel, and so on) of the operating system on\r
+which the executable runs, unless that component itself accompanies\r
+the executable.\r
+\r
+  It may happen that this requirement contradicts the license\r
+restrictions of other proprietary libraries that do not normally\r
+accompany the operating system.  Such a contradiction means you cannot\r
+use both them and the Library together in an executable that you\r
+distribute.\r
+\r
+  7. You may place library facilities that are a work based on the\r
+Library side-by-side in a single library together with other library\r
+facilities not covered by this License, and distribute such a combined\r
+library, provided that the separate distribution of the work based on\r
+the Library and of the other library facilities is otherwise\r
+permitted, and provided that you do these two things:\r
+\r
+    a) Accompany the combined library with a copy of the same work\r
+    based on the Library, uncombined with any other library\r
+    facilities.  This must be distributed under the terms of the\r
+    Sections above.\r
+\r
+    b) Give prominent notice with the combined library of the fact\r
+    that part of it is a work based on the Library, and explaining\r
+    where to find the accompanying uncombined form of the same work.\r
+\r
+  8. You may not copy, modify, sublicense, link with, or distribute\r
+the Library except as expressly provided under this License.  Any\r
+attempt otherwise to copy, modify, sublicense, link with, or\r
+distribute the Library is void, and will automatically terminate your\r
+rights under this License.  However, parties who have received copies,\r
+or rights, from you under this License will not have their licenses\r
+terminated so long as such parties remain in full compliance.\r
+\r
+  9. You are not required to accept this License, since you have not\r
+signed it.  However, nothing else grants you permission to modify or\r
+distribute the Library or its derivative works.  These actions are\r
+prohibited by law if you do not accept this License.  Therefore, by\r
+modifying or distributing the Library (or any work based on the\r
+Library), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Library or works based on it.\r
+\r
+  10. Each time you redistribute the Library (or any work based on the\r
+Library), the recipient automatically receives a license from the\r
+original licensor to copy, distribute, link with or modify the Library\r
+subject to these terms and conditions.  You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties with\r
+this License.\r
+\r
+  11. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License.  If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Library at all.  For example, if a patent\r
+license would not permit royalty-free redistribution of the Library by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Library.\r
+\r
+If any portion of this section is held invalid or unenforceable under any\r
+particular circumstance, the balance of the section is intended to apply,\r
+and the section as a whole is intended to apply in other circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system which is\r
+implemented by public license practices.  Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+  12. If the distribution and/or use of the Library is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Library under this License may add\r
+an explicit geographical distribution limitation excluding those countries,\r
+so that distribution is permitted only in or among countries not thus\r
+excluded.  In such case, this License incorporates the limitation as if\r
+written in the body of this License.\r
+\r
+  13. The Free Software Foundation may publish revised and/or new\r
+versions of the Lesser General Public License from time to time.\r
+Such new versions will be similar in spirit to the present version,\r
+but may differ in detail to address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number.  If the Library\r
+specifies a version number of this License which applies to it and\r
+"any later version", you have the option of following the terms and\r
+conditions either of that version or of any later version published by\r
+the Free Software Foundation.  If the Library does not specify a\r
+license version number, you may choose any version ever published by\r
+the Free Software Foundation.\r
+\r
+  14. If you wish to incorporate parts of the Library into other free\r
+programs whose distribution conditions are incompatible with these,\r
+write to the author to ask for permission.  For software which is\r
+copyrighted by the Free Software Foundation, write to the Free\r
+Software Foundation; we sometimes make exceptions for this.  Our\r
+decision will be guided by the two goals of preserving the free status\r
+of all derivatives of our free software and of promoting the sharing\r
+and reuse of software generally.\r
+\r
+                           NO WARRANTY\r
+\r
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\r
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\r
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\r
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\r
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\r
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\r
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
+\r
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\r
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\r
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\r
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\r
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\r
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\r
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\r
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\r
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r
+DAMAGES.\r
+\r
+                    END OF TERMS AND CONDITIONS\r
+\r
+           How to Apply These Terms to Your New Libraries\r
+\r
+  If you develop a new library, and you want it to be of the greatest\r
+possible use to the public, we recommend making it free software that\r
+everyone can redistribute and change.  You can do so by permitting\r
+redistribution under these terms (or, alternatively, under the terms of the\r
+ordinary General Public License).\r
+\r
+  To apply these terms, attach the following notices to the library.  It is\r
+safest to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least the\r
+"copyright" line and a pointer to where the full notice is found.\r
+\r
+    <one line to give the library's name and a brief idea of what it does.>\r
+    Copyright (C) <year>  <name of author>\r
+\r
+    This library is free software; you can redistribute it and/or\r
+    modify it under the terms of the GNU Lesser General Public\r
+    License as published by the Free Software Foundation; either\r
+    version 2.1 of the License, or (at your option) any later version.\r
+\r
+    This library is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+    Lesser General Public License for more details.\r
+\r
+    You should have received a copy of the GNU Lesser General Public\r
+    License along with this library; if not, write to the Free Software\r
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the library, if\r
+necessary.  Here is a sample; alter the names:\r
+\r
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the\r
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\r
+\r
+  <signature of Ty Coon>, 1 April 1990\r
+  Ty Coon, President of Vice\r
+\r
+That's all there is to it!\r
+\r
+\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advhr/css/advhr.css b/3.x/src/resources/javascript/TinyMCE/plugins/advhr/css/advhr.css
new file mode 100644 (file)
index 0000000..0e22834
--- /dev/null
@@ -0,0 +1,5 @@
+input.radio {border:1px none #000; background:transparent; vertical-align:middle;}\r
+.panel_wrapper div.current {height:80px;}\r
+#width {width:50px; vertical-align:middle;}\r
+#width2 {width:50px; vertical-align:middle;}\r
+#size {width:100px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advhr/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/advhr/editor_plugin.js
new file mode 100644 (file)
index 0000000..4d3b062
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AdvancedHRPlugin",{init:function(a,b){a.addCommand("mceAdvancedHr",function(){a.windowManager.open({file:b+"/rule.htm",width:250+parseInt(a.getLang("advhr.delta_width",0)),height:160+parseInt(a.getLang("advhr.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("advhr",{title:"advhr.advhr_desc",cmd:"mceAdvancedHr"});a.onNodeChange.add(function(d,c,e){c.setActive("advhr",e.nodeName=="HR")});a.onClick.add(function(c,d){d=d.target;if(d.nodeName==="HR"){c.selection.select(d)}})},getInfo:function(){return{longname:"Advanced HR",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advhr",tinymce.plugins.AdvancedHRPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advhr/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/advhr/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..0c652d3
--- /dev/null
@@ -0,0 +1,57 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.AdvancedHRPlugin', {\r
+               init : function(ed, url) {\r
+                       // Register commands\r
+                       ed.addCommand('mceAdvancedHr', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/rule.htm',\r
+                                       width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),\r
+                                       height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('advhr', {\r
+                               title : 'advhr.advhr_desc',\r
+                               cmd : 'mceAdvancedHr'\r
+                       });\r
+\r
+                       ed.onNodeChange.add(function(ed, cm, n) {\r
+                               cm.setActive('advhr', n.nodeName == 'HR');\r
+                       });\r
+\r
+                       ed.onClick.add(function(ed, e) {\r
+                               e = e.target;\r
+\r
+                               if (e.nodeName === 'HR')\r
+                                       ed.selection.select(e);\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Advanced HR',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advhr/js/rule.js b/3.x/src/resources/javascript/TinyMCE/plugins/advhr/js/rule.js
new file mode 100644 (file)
index 0000000..b6cbd66
--- /dev/null
@@ -0,0 +1,43 @@
+var AdvHRDialog = {\r
+       init : function(ed) {\r
+               var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;\r
+\r
+               w = dom.getAttrib(n, 'width');\r
+               f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');\r
+               f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';\r
+               f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');\r
+               selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');\r
+       },\r
+\r
+       update : function() {\r
+               var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';\r
+\r
+               h = '<hr';\r
+\r
+               if (f.size.value) {\r
+                       h += ' size="' + f.size.value + '"';\r
+                       st += ' height:' + f.size.value + 'px;';\r
+               }\r
+\r
+               if (f.width.value) {\r
+                       h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';\r
+                       st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';\r
+               }\r
+\r
+               if (f.noshade.checked) {\r
+                       h += ' noshade="noshade"';\r
+                       st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';\r
+               }\r
+\r
+               if (ed.settings.inline_styles)\r
+                       h += ' style="' + tinymce.trim(st) + '"';\r
+\r
+               h += ' />';\r
+\r
+               ed.execCommand("mceInsertContent", false, h);\r
+               tinyMCEPopup.close();\r
+       }\r
+};\r
+\r
+tinyMCEPopup.requireLangPack();\r
+tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advhr/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/advhr/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..0c3bf15
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No Shadow",width:"Width",normal:"Normal",widthunits:"Units"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advhr/rule.htm b/3.x/src/resources/javascript/TinyMCE/plugins/advhr/rule.htm
new file mode 100644 (file)
index 0000000..843e1f8
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advhr.advhr_desc}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/rule.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <link href="css/advhr.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body role="application">\r
+<form onsubmit="AdvHRDialog.update();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li>\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                       <tr role="group" aria-labelledby="width_label">\r
+                                               <td><label id="width_label" for="width">{#advhr_dlg.width}</label></td>\r
+                                               <td class="nowrap">\r
+                                                       <input id="width" name="width" type="text" value="" class="mceFocus" />\r
+                                                       <span style="display:none;" id="width_unit_label">{#advhr_dlg.widthunits}</span>\r
+                                                       <select name="width2" id="width2" aria-labelledby="width_unit_label">\r
+                                                               <option value="">px</option>\r
+                                                               <option value="%">%</option>\r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td><label for="size">{#advhr_dlg.size}</label></td>\r
+                                               <td><select id="size" name="size">\r
+                                                       <option value="">{#advhr_dlg.normal}</option>\r
+                                                       <option value="1">1</option>\r
+                                                       <option value="2">2</option>\r
+                                                       <option value="3">3</option>\r
+                                                       <option value="4">4</option>\r
+                                                       <option value="5">5</option>\r
+                                               </select></td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td><label for="noshade">{#advhr_dlg.noshade}</label></td>\r
+                                               <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>\r
+                                       </tr>\r
+                       </table>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/css/advimage.css b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/css/advimage.css
new file mode 100644 (file)
index 0000000..0a6251a
--- /dev/null
@@ -0,0 +1,13 @@
+#src_list, #over_list, #out_list {width:280px;}\r
+.mceActionPanel {margin-top:7px;}\r
+.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;}\r
+.checkbox {border:0;}\r
+.panel_wrapper div.current {height:305px;}\r
+#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}\r
+#align, #classlist {width:150px;}\r
+#width, #height {vertical-align:middle; width:50px; text-align:center;}\r
+#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;}\r
+#class_list {width:180px;}\r
+input {width: 280px;}\r
+#constrain, #onmousemovecheck {width:auto;}\r
+#id, #dir, #lang, #usemap, #longdesc {width:200px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/editor_plugin.js
new file mode 100644 (file)
index 0000000..d613a61
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..d2678cb
--- /dev/null
@@ -0,0 +1,50 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.AdvancedImagePlugin', {\r
+               init : function(ed, url) {\r
+                       // Register commands\r
+                       ed.addCommand('mceAdvImage', function() {\r
+                               // Internal image object like a flash placeholder\r
+                               if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)\r
+                                       return;\r
+\r
+                               ed.windowManager.open({\r
+                                       file : url + '/image.htm',\r
+                                       width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),\r
+                                       height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('image', {\r
+                               title : 'advimage.image_desc',\r
+                               cmd : 'mceAdvImage'\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Advanced image',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/image.htm b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/image.htm
new file mode 100644 (file)
index 0000000..ed16b3d
--- /dev/null
@@ -0,0 +1,235 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advimage_dlg.dialog_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/image.js"></script>\r
+       <link href="css/advimage.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body id="advimage" style="display: none" role="application" aria-labelledby="app_title">\r
+       <span id="app_title" style="display:none">{#advimage_dlg.dialog_title}</span>\r
+       <form onsubmit="ImageDialog.insert();return false;" action="#"> \r
+               <div class="tabs">\r
+                       <ul>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>\r
+                               <li id="appearance_tab" aria-controls="appearance_panel"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="general_panel" class="panel current">\r
+                               <fieldset>\r
+                                               <legend>{#advimage_dlg.general}</legend>\r
+\r
+                                               <table role="presentation" class="properties">\r
+                                                       <tr>\r
+                                                               <td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>\r
+                                                               <td colspan="2"><table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr> \r
+                                                                               <td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" aria-required="true" /></td> \r
+                                                                               <td id="srcbrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table></td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><label for="src_list">{#advimage_dlg.image_list}</label></td>\r
+                                                               <td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;ImageDialog.showPreviewImage(this.options[this.selectedIndex].value);"><option value=""></option></select></td>\r
+                                                       </tr>\r
+                                                       <tr> \r
+                                                               <td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td> \r
+                                                               <td colspan="2"><input id="alt" name="alt" type="text" value="" /></td> \r
+                                                       </tr> \r
+                                                       <tr> \r
+                                                               <td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td> \r
+                                                               <td colspan="2"><input id="title" name="title" type="text" value="" /></td> \r
+                                                       </tr>\r
+                                               </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#advimage_dlg.preview}</legend>\r
+                                       <div id="prev"></div>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="appearance_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#advimage_dlg.tab_appearance}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr> \r
+                                                       <td class="column1"><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td> \r
+                                                       <td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();"> \r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="baseline">{#advimage_dlg.align_baseline}</option>\r
+                                                                       <option value="top">{#advimage_dlg.align_top}</option>\r
+                                                                       <option value="middle">{#advimage_dlg.align_middle}</option>\r
+                                                                       <option value="bottom">{#advimage_dlg.align_bottom}</option>\r
+                                                                       <option value="text-top">{#advimage_dlg.align_texttop}</option>\r
+                                                                       <option value="text-bottom">{#advimage_dlg.align_textbottom}</option>\r
+                                                                       <option value="left">{#advimage_dlg.align_left}</option>\r
+                                                                       <option value="right">{#advimage_dlg.align_right}</option>\r
+                                                               </select> \r
+                                                       </td>\r
+                                                       <td rowspan="6" valign="top">\r
+                                                               <div class="alignPreview">\r
+                                                                       <img id="alignSampleImg" src="img/sample.gif" alt="{#advimage_dlg.example_img}" />\r
+                                                                       Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam\r
+                                                                       nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum\r
+                                                                       edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam\r
+                                                                       erat volutpat.\r
+                                                               </div>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr role="group" aria-labelledby="widthlabel">\r
+                                                       <td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>\r
+                                                       <td class="nowrap">\r
+                                                               <span style="display:none" id="width_voiceLabel">{#advimage_dlg.width}</span>\r
+                                                               <input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" aria-labelledby="width_voiceLabel" /> x \r
+                                                               <span style="display:none" id="height_voiceLabel">{#advimage_dlg.height}</span>\r
+                                                               <input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" aria-labelledby="height_voiceLabel" /> px\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td>&nbsp;</td>\r
+                                                       <td><table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>\r
+                                                                               <td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td>\r
+                                                                       </tr>\r
+                                                               </table></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="vspacelabel" for="vspace">{#advimage_dlg.vspace}</label></td> \r
+                                                       <td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" />\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr> \r
+                                                       <td class="column1"><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td> \r
+                                                       <td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td> \r
+                                                       <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="class_list">{#class_name}</label></td>\r
+                                                       <td colspan="2"><select id="class_list" name="class_list" class="mceEditableSelect"><option value=""></option></select></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td> \r
+                                                       <td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td> \r
+                                               </tr>\r
+\r
+                                               <!-- <tr>\r
+                                                       <td class="column1"><label id="classeslabel" for="classes">{#advimage_dlg.classes}</label></td> \r
+                                                       <td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td> \r
+                                               </tr> -->\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="advanced_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#advimage_dlg.swap_image}</legend>\r
+\r
+                                       <input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" aria-controls="onmouseoversrc onmouseoutsrc" />\r
+                                       <label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">\r
+                                                       <tr>\r
+                                                               <td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td> \r
+                                                               <td><table role="presentation" border="0" cellspacing="0" cellpadding="0"> \r
+                                                                       <tr> \r
+                                                                               <td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td> \r
+                                                                               <td id="onmouseoversrccontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table></td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><label for="over_list">{#advimage_dlg.image_list}</label></td>\r
+                                                               <td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>\r
+                                                       </tr>\r
+                                                       <tr> \r
+                                                               <td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td> \r
+                                                               <td class="column2"><table role="presentation" border="0" cellspacing="0" cellpadding="0"> \r
+                                                                       <tr> \r
+                                                                               <td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td> \r
+                                                                               <td id="onmouseoutsrccontainer">&nbsp;</td>\r
+                                                                       </tr> \r
+                                                               </table></td> \r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><label for="out_list">{#advimage_dlg.image_list}</label></td>\r
+                                                               <td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>\r
+                                                       </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#advimage_dlg.misc}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="idlabel" for="id">{#advimage_dlg.id}</label></td> \r
+                                                       <td><input id="id" name="id" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="dirlabel" for="dir">{#advimage_dlg.langdir}</label></td> \r
+                                                       <td>\r
+                                                               <select id="dir" name="dir" onchange="ImageDialog.changeAppearance();"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="ltr">{#advimage_dlg.ltr}</option> \r
+                                                                               <option value="rtl">{#advimage_dlg.rtl}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="langlabel" for="lang">{#advimage_dlg.langcode}</label></td> \r
+                                                       <td>\r
+                                                               <input id="lang" name="lang" type="text" value="" />\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="usemaplabel" for="usemap">{#advimage_dlg.map}</label></td> \r
+                                                       <td>\r
+                                                               <input id="usemap" name="usemap" type="text" value="" />\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td>\r
+                                                       <td><table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="longdesc" name="longdesc" type="text" value="" /></td>\r
+                                                                               <td id="longdesccontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                       </table></td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body> \r
+</html> \r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/img/sample.gif b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/img/sample.gif
new file mode 100644 (file)
index 0000000..53bf689
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/img/sample.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/js/image.js b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/js/image.js
new file mode 100644 (file)
index 0000000..f0b7c6e
--- /dev/null
@@ -0,0 +1,464 @@
+var ImageDialog = {\r
+       preInit : function() {\r
+               var url;\r
+\r
+               tinyMCEPopup.requireLangPack();\r
+\r
+               if (url = tinyMCEPopup.getParam("external_image_list_url"))\r
+                       document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
+       },\r
+\r
+       init : function(ed) {\r
+               var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList');\r
+\r
+               tinyMCEPopup.resizeToInnerSize();\r
+               this.fillClassList('class_list');\r
+               this.fillFileList('src_list', fl);\r
+               this.fillFileList('over_list', fl);\r
+               this.fillFileList('out_list', fl);\r
+               TinyMCE_EditableSelects.init();\r
+\r
+               if (n.nodeName == 'IMG') {\r
+                       nl.src.value = dom.getAttrib(n, 'src');\r
+                       nl.width.value = dom.getAttrib(n, 'width');\r
+                       nl.height.value = dom.getAttrib(n, 'height');\r
+                       nl.alt.value = dom.getAttrib(n, 'alt');\r
+                       nl.title.value = dom.getAttrib(n, 'title');\r
+                       nl.vspace.value = this.getAttrib(n, 'vspace');\r
+                       nl.hspace.value = this.getAttrib(n, 'hspace');\r
+                       nl.border.value = this.getAttrib(n, 'border');\r
+                       selectByValue(f, 'align', this.getAttrib(n, 'align'));\r
+                       selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);\r
+                       nl.style.value = dom.getAttrib(n, 'style');\r
+                       nl.id.value = dom.getAttrib(n, 'id');\r
+                       nl.dir.value = dom.getAttrib(n, 'dir');\r
+                       nl.lang.value = dom.getAttrib(n, 'lang');\r
+                       nl.usemap.value = dom.getAttrib(n, 'usemap');\r
+                       nl.longdesc.value = dom.getAttrib(n, 'longdesc');\r
+                       nl.insert.value = ed.getLang('update');\r
+\r
+                       if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))\r
+                               nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');\r
+\r
+                       if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))\r
+                               nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');\r
+\r
+                       if (ed.settings.inline_styles) {\r
+                               // Move attribs to styles\r
+                               if (dom.getAttrib(n, 'align'))\r
+                                       this.updateStyle('align');\r
+\r
+                               if (dom.getAttrib(n, 'hspace'))\r
+                                       this.updateStyle('hspace');\r
+\r
+                               if (dom.getAttrib(n, 'border'))\r
+                                       this.updateStyle('border');\r
+\r
+                               if (dom.getAttrib(n, 'vspace'))\r
+                                       this.updateStyle('vspace');\r
+                       }\r
+               }\r
+\r
+               // Setup browse button\r
+               document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');\r
+               if (isVisible('srcbrowser'))\r
+                       document.getElementById('src').style.width = '260px';\r
+\r
+               // Setup browse button\r
+               document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');\r
+               if (isVisible('overbrowser'))\r
+                       document.getElementById('onmouseoversrc').style.width = '260px';\r
+\r
+               // Setup browse button\r
+               document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');\r
+               if (isVisible('outbrowser'))\r
+                       document.getElementById('onmouseoutsrc').style.width = '260px';\r
+\r
+               // If option enabled default contrain proportions to checked\r
+               if (ed.getParam("advimage_constrain_proportions", true))\r
+                       f.constrain.checked = true;\r
+\r
+               // Check swap image if valid data\r
+               if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)\r
+                       this.setSwapImage(true);\r
+               else\r
+                       this.setSwapImage(false);\r
+\r
+               this.changeAppearance();\r
+               this.showPreviewImage(nl.src.value, 1);\r
+       },\r
+\r
+       insert : function(file, title) {\r
+               var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];\r
+\r
+               if (f.src.value === '') {\r
+                       if (ed.selection.getNode().nodeName == 'IMG') {\r
+                               ed.dom.remove(ed.selection.getNode());\r
+                               ed.execCommand('mceRepaint');\r
+                       }\r
+\r
+                       tinyMCEPopup.close();\r
+                       return;\r
+               }\r
+\r
+               if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {\r
+                       if (!f.alt.value) {\r
+                               tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {\r
+                                       if (s)\r
+                                               t.insertAndClose();\r
+                               });\r
+\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               t.insertAndClose();\r
+       },\r
+\r
+       insertAndClose : function() {\r
+               var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;\r
+\r
+               tinyMCEPopup.restoreSelection();\r
+\r
+               // Fixes crash in Safari\r
+               if (tinymce.isWebKit)\r
+                       ed.getWin().focus();\r
+\r
+               if (!ed.settings.inline_styles) {\r
+                       args = {\r
+                               vspace : nl.vspace.value,\r
+                               hspace : nl.hspace.value,\r
+                               border : nl.border.value,\r
+                               align : getSelectValue(f, 'align')\r
+                       };\r
+               } else {\r
+                       // Remove deprecated values\r
+                       args = {\r
+                               vspace : '',\r
+                               hspace : '',\r
+                               border : '',\r
+                               align : ''\r
+                       };\r
+               }\r
+\r
+               tinymce.extend(args, {\r
+                       src : nl.src.value.replace(/ /g, '%20'),\r
+                       width : nl.width.value,\r
+                       height : nl.height.value,\r
+                       alt : nl.alt.value,\r
+                       title : nl.title.value,\r
+                       'class' : getSelectValue(f, 'class_list'),\r
+                       style : nl.style.value,\r
+                       id : nl.id.value,\r
+                       dir : nl.dir.value,\r
+                       lang : nl.lang.value,\r
+                       usemap : nl.usemap.value,\r
+                       longdesc : nl.longdesc.value\r
+               });\r
+\r
+               args.onmouseover = args.onmouseout = '';\r
+\r
+               if (f.onmousemovecheck.checked) {\r
+                       if (nl.onmouseoversrc.value)\r
+                               args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";\r
+\r
+                       if (nl.onmouseoutsrc.value)\r
+                               args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";\r
+               }\r
+\r
+               el = ed.selection.getNode();\r
+\r
+               if (el && el.nodeName == 'IMG') {\r
+                       ed.dom.setAttribs(el, args);\r
+               } else {\r
+                       tinymce.each(args, function(value, name) {\r
+                               if (value === "") {\r
+                                       delete args[name];\r
+                               }\r
+                       });\r
+\r
+                       ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});\r
+                       ed.undoManager.add();\r
+               }\r
+\r
+               tinyMCEPopup.editor.execCommand('mceRepaint');\r
+               tinyMCEPopup.editor.focus();\r
+               tinyMCEPopup.close();\r
+       },\r
+\r
+       getAttrib : function(e, at) {\r
+               var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;\r
+\r
+               if (ed.settings.inline_styles) {\r
+                       switch (at) {\r
+                               case 'align':\r
+                                       if (v = dom.getStyle(e, 'float'))\r
+                                               return v;\r
+\r
+                                       if (v = dom.getStyle(e, 'vertical-align'))\r
+                                               return v;\r
+\r
+                                       break;\r
+\r
+                               case 'hspace':\r
+                                       v = dom.getStyle(e, 'margin-left')\r
+                                       v2 = dom.getStyle(e, 'margin-right');\r
+\r
+                                       if (v && v == v2)\r
+                                               return parseInt(v.replace(/[^0-9]/g, ''));\r
+\r
+                                       break;\r
+\r
+                               case 'vspace':\r
+                                       v = dom.getStyle(e, 'margin-top')\r
+                                       v2 = dom.getStyle(e, 'margin-bottom');\r
+                                       if (v && v == v2)\r
+                                               return parseInt(v.replace(/[^0-9]/g, ''));\r
+\r
+                                       break;\r
+\r
+                               case 'border':\r
+                                       v = 0;\r
+\r
+                                       tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {\r
+                                               sv = dom.getStyle(e, 'border-' + sv + '-width');\r
+\r
+                                               // False or not the same as prev\r
+                                               if (!sv || (sv != v && v !== 0)) {\r
+                                                       v = 0;\r
+                                                       return false;\r
+                                               }\r
+\r
+                                               if (sv)\r
+                                                       v = sv;\r
+                                       });\r
+\r
+                                       if (v)\r
+                                               return parseInt(v.replace(/[^0-9]/g, ''));\r
+\r
+                                       break;\r
+                       }\r
+               }\r
+\r
+               if (v = dom.getAttrib(e, at))\r
+                       return v;\r
+\r
+               return '';\r
+       },\r
+\r
+       setSwapImage : function(st) {\r
+               var f = document.forms[0];\r
+\r
+               f.onmousemovecheck.checked = st;\r
+               setBrowserDisabled('overbrowser', !st);\r
+               setBrowserDisabled('outbrowser', !st);\r
+\r
+               if (f.over_list)\r
+                       f.over_list.disabled = !st;\r
+\r
+               if (f.out_list)\r
+                       f.out_list.disabled = !st;\r
+\r
+               f.onmouseoversrc.disabled = !st;\r
+               f.onmouseoutsrc.disabled  = !st;\r
+       },\r
+\r
+       fillClassList : function(id) {\r
+               var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
+\r
+               if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {\r
+                       cl = [];\r
+\r
+                       tinymce.each(v.split(';'), function(v) {\r
+                               var p = v.split('=');\r
+\r
+                               cl.push({'title' : p[0], 'class' : p[1]});\r
+                       });\r
+               } else\r
+                       cl = tinyMCEPopup.editor.dom.getClasses();\r
+\r
+               if (cl.length > 0) {\r
+                       lst.options.length = 0;\r
+                       lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');\r
+\r
+                       tinymce.each(cl, function(o) {\r
+                               lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);\r
+                       });\r
+               } else\r
+                       dom.remove(dom.getParent(id, 'tr'));\r
+       },\r
+\r
+       fillFileList : function(id, l) {\r
+               var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
+\r
+               l = typeof(l) === 'function' ? l() : window[l];\r
+               lst.options.length = 0;\r
+\r
+               if (l && l.length > 0) {\r
+                       lst.options[lst.options.length] = new Option('', '');\r
+\r
+                       tinymce.each(l, function(o) {\r
+                               lst.options[lst.options.length] = new Option(o[0], o[1]);\r
+                       });\r
+               } else\r
+                       dom.remove(dom.getParent(id, 'tr'));\r
+       },\r
+\r
+       resetImageData : function() {\r
+               var f = document.forms[0];\r
+\r
+               f.elements.width.value = f.elements.height.value = '';\r
+       },\r
+\r
+       updateImageData : function(img, st) {\r
+               var f = document.forms[0];\r
+\r
+               if (!st) {\r
+                       f.elements.width.value = img.width;\r
+                       f.elements.height.value = img.height;\r
+               }\r
+\r
+               this.preloadImg = img;\r
+       },\r
+\r
+       changeAppearance : function() {\r
+               var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');\r
+\r
+               if (img) {\r
+                       if (ed.getParam('inline_styles')) {\r
+                               ed.dom.setAttrib(img, 'style', f.style.value);\r
+                       } else {\r
+                               img.align = f.align.value;\r
+                               img.border = f.border.value;\r
+                               img.hspace = f.hspace.value;\r
+                               img.vspace = f.vspace.value;\r
+                       }\r
+               }\r
+       },\r
+\r
+       changeHeight : function() {\r
+               var f = document.forms[0], tp, t = this;\r
+\r
+               if (!f.constrain.checked || !t.preloadImg) {\r
+                       return;\r
+               }\r
+\r
+               if (f.width.value == "" || f.height.value == "")\r
+                       return;\r
+\r
+               tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;\r
+               f.height.value = tp.toFixed(0);\r
+       },\r
+\r
+       changeWidth : function() {\r
+               var f = document.forms[0], tp, t = this;\r
+\r
+               if (!f.constrain.checked || !t.preloadImg) {\r
+                       return;\r
+               }\r
+\r
+               if (f.width.value == "" || f.height.value == "")\r
+                       return;\r
+\r
+               tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;\r
+               f.width.value = tp.toFixed(0);\r
+       },\r
+\r
+       updateStyle : function(ty) {\r
+               var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});\r
+\r
+               if (tinyMCEPopup.editor.settings.inline_styles) {\r
+                       // Handle align\r
+                       if (ty == 'align') {\r
+                               dom.setStyle(img, 'float', '');\r
+                               dom.setStyle(img, 'vertical-align', '');\r
+\r
+                               v = getSelectValue(f, 'align');\r
+                               if (v) {\r
+                                       if (v == 'left' || v == 'right')\r
+                                               dom.setStyle(img, 'float', v);\r
+                                       else\r
+                                               img.style.verticalAlign = v;\r
+                               }\r
+                       }\r
+\r
+                       // Handle border\r
+                       if (ty == 'border') {\r
+                               b = img.style.border ? img.style.border.split(' ') : [];\r
+                               bStyle = dom.getStyle(img, 'border-style');\r
+                               bColor = dom.getStyle(img, 'border-color');\r
+\r
+                               dom.setStyle(img, 'border', '');\r
+\r
+                               v = f.border.value;\r
+                               if (v || v == '0') {\r
+                                       if (v == '0')\r
+                                               img.style.border = isIE ? '0' : '0 none none';\r
+                                       else {\r
+                                               var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9);\r
+\r
+                                               if (b.length == 3 && b[isOldIE ? 2 : 1])\r
+                                                       bStyle = b[isOldIE ? 2 : 1];\r
+                                               else if (!bStyle || bStyle == 'none')\r
+                                                       bStyle = 'solid';\r
+                                               if (b.length == 3 && b[isIE ? 0 : 2])\r
+                                                       bColor = b[isOldIE ? 0 : 2];\r
+                                               else if (!bColor || bColor == 'none')\r
+                                                       bColor = 'black';\r
+                                               img.style.border = v + 'px ' + bStyle + ' ' + bColor;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       // Handle hspace\r
+                       if (ty == 'hspace') {\r
+                               dom.setStyle(img, 'marginLeft', '');\r
+                               dom.setStyle(img, 'marginRight', '');\r
+\r
+                               v = f.hspace.value;\r
+                               if (v) {\r
+                                       img.style.marginLeft = v + 'px';\r
+                                       img.style.marginRight = v + 'px';\r
+                               }\r
+                       }\r
+\r
+                       // Handle vspace\r
+                       if (ty == 'vspace') {\r
+                               dom.setStyle(img, 'marginTop', '');\r
+                               dom.setStyle(img, 'marginBottom', '');\r
+\r
+                               v = f.vspace.value;\r
+                               if (v) {\r
+                                       img.style.marginTop = v + 'px';\r
+                                       img.style.marginBottom = v + 'px';\r
+                               }\r
+                       }\r
+\r
+                       // Merge\r
+                       dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText), 'img');\r
+               }\r
+       },\r
+\r
+       changeMouseMove : function() {\r
+       },\r
+\r
+       showPreviewImage : function(u, st) {\r
+               if (!u) {\r
+                       tinyMCEPopup.dom.setHTML('prev', '');\r
+                       return;\r
+               }\r
+\r
+               if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))\r
+                       this.resetImageData();\r
+\r
+               u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);\r
+\r
+               if (!st)\r
+                       tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');\r
+               else\r
+                       tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');\r
+       }\r
+};\r
+\r
+ImageDialog.preInit();\r
+tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advimage/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/advimage/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..5f122e2
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.advimage_dlg',{"image_list":"Image List","align_right":"Right","align_left":"Left","align_textbottom":"Text Bottom","align_texttop":"Text Top","align_bottom":"Bottom","align_middle":"Middle","align_top":"Top","align_baseline":"Baseline",align:"Alignment",hspace:"Horizontal Space",vspace:"Vertical Space",dimensions:"Dimensions",border:"Border",list:"Image List",alt:"Image Description",src:"Image URL","dialog_title":"Insert/Edit Image","missing_alt":"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.","example_img":"Appearance Preview Image",misc:"Miscellaneous",mouseout:"For Mouse Out",mouseover:"For Mouse Over","alt_image":"Alternative Image","swap_image":"Swap Image",map:"Image Map",id:"ID",rtl:"Right to Left",ltr:"Left to Right",classes:"Classes",style:"Style","long_desc":"Long Description Link",langcode:"Language Code",langdir:"Language Direction","constrain_proportions":"Constrain Proportions",preview:"Preview",title:"Title",general:"General","tab_advanced":"Advanced","tab_appearance":"Appearance","tab_general":"General",width:"Width",height:"Height"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlink/css/advlink.css b/3.x/src/resources/javascript/TinyMCE/plugins/advlink/css/advlink.css
new file mode 100644 (file)
index 0000000..1436431
--- /dev/null
@@ -0,0 +1,8 @@
+.mceLinkList, .mceAnchorList, #targetlist {width:280px;}\r
+.mceActionPanel {margin-top:7px;}\r
+.panel_wrapper div.current {height:320px;}\r
+#classlist, #title, #href {width:280px;}\r
+#popupurl, #popupname {width:200px;}\r
+#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;}\r
+#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;}\r
+#events_panel input {width:200px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlink/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/advlink/editor_plugin.js
new file mode 100644 (file)
index 0000000..983fe5a
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AdvancedLinkPlugin",{init:function(a,b){this.editor=a;a.addCommand("mceAdvLink",function(){var c=a.selection;if(c.isCollapsed()&&!a.dom.getParent(c.getNode(),"A")){return}a.windowManager.open({file:b+"/link.htm",width:480+parseInt(a.getLang("advlink.delta_width",0)),height:400+parseInt(a.getLang("advlink.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("link",{title:"advlink.link_desc",cmd:"mceAdvLink"});a.addShortcut("ctrl+k","advlink.advlink_desc","mceAdvLink");a.onNodeChange.add(function(d,c,f,e){c.setDisabled("link",e&&f.nodeName!="A");c.setActive("link",f.nodeName=="A"&&!f.name)})},getInfo:function(){return{longname:"Advanced link",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlink",tinymce.plugins.AdvancedLinkPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlink/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/advlink/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..14e46a7
--- /dev/null
@@ -0,0 +1,61 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {\r
+               init : function(ed, url) {\r
+                       this.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceAdvLink', function() {\r
+                               var se = ed.selection;\r
+\r
+                               // No selection and not in link\r
+                               if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))\r
+                                       return;\r
+\r
+                               ed.windowManager.open({\r
+                                       file : url + '/link.htm',\r
+                                       width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),\r
+                                       height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('link', {\r
+                               title : 'advlink.link_desc',\r
+                               cmd : 'mceAdvLink'\r
+                       });\r
+\r
+                       ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');\r
+\r
+                       ed.onNodeChange.add(function(ed, cm, n, co) {\r
+                               cm.setDisabled('link', co && n.nodeName != 'A');\r
+                               cm.setActive('link', n.nodeName == 'A' && !n.name);\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Advanced link',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlink/js/advlink.js b/3.x/src/resources/javascript/TinyMCE/plugins/advlink/js/advlink.js
new file mode 100644 (file)
index 0000000..9ca955c
--- /dev/null
@@ -0,0 +1,539 @@
+/* Functions for the advlink plugin popup */\r
+\r
+tinyMCEPopup.requireLangPack();\r
+\r
+var templates = {\r
+       "window.open" : "window.open('${url}','${target}','${options}')"\r
+};\r
+\r
+function preinit() {\r
+       var url;\r
+\r
+       if (url = tinyMCEPopup.getParam("external_link_list_url"))\r
+               document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
+}\r
+\r
+function changeClass() {\r
+       var f = document.forms[0];\r
+\r
+       f.classes.value = getSelectValue(f, 'classlist');\r
+}\r
+\r
+function init() {\r
+       tinyMCEPopup.resizeToInnerSize();\r
+\r
+       var formObj = document.forms[0];\r
+       var inst = tinyMCEPopup.editor;\r
+       var elm = inst.selection.getNode();\r
+       var action = "insert";\r
+       var html;\r
+\r
+       document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');\r
+       document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');\r
+       document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');\r
+\r
+       // Link list\r
+       html = getLinkListHTML('linklisthref','href');\r
+       if (html == "")\r
+               document.getElementById("linklisthrefrow").style.display = 'none';\r
+       else\r
+               document.getElementById("linklisthrefcontainer").innerHTML = html;\r
+\r
+       // Anchor list\r
+       html = getAnchorListHTML('anchorlist','href');\r
+       if (html == "")\r
+               document.getElementById("anchorlistrow").style.display = 'none';\r
+       else\r
+               document.getElementById("anchorlistcontainer").innerHTML = html;\r
+\r
+       // Resize some elements\r
+       if (isVisible('hrefbrowser'))\r
+               document.getElementById('href').style.width = '260px';\r
+\r
+       if (isVisible('popupurlbrowser'))\r
+               document.getElementById('popupurl').style.width = '180px';\r
+\r
+       elm = inst.dom.getParent(elm, "A");\r
+       if (elm == null) {\r
+               var prospect = inst.dom.create("p", null, inst.selection.getContent());\r
+               if (prospect.childNodes.length === 1) {\r
+                       elm = prospect.firstChild;\r
+               }\r
+       }\r
+\r
+       if (elm != null && elm.nodeName == "A")\r
+               action = "update";\r
+\r
+       formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); \r
+\r
+       setPopupControlsDisabled(true);\r
+\r
+       if (action == "update") {\r
+               var href = inst.dom.getAttrib(elm, 'href');\r
+               var onclick = inst.dom.getAttrib(elm, 'onclick');\r
+\r
+               // Setup form data\r
+               setFormValue('href', href);\r
+               setFormValue('title', inst.dom.getAttrib(elm, 'title'));\r
+               setFormValue('id', inst.dom.getAttrib(elm, 'id'));\r
+               setFormValue('style', inst.dom.getAttrib(elm, "style"));\r
+               setFormValue('rel', inst.dom.getAttrib(elm, 'rel'));\r
+               setFormValue('rev', inst.dom.getAttrib(elm, 'rev'));\r
+               setFormValue('charset', inst.dom.getAttrib(elm, 'charset'));\r
+               setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang'));\r
+               setFormValue('dir', inst.dom.getAttrib(elm, 'dir'));\r
+               setFormValue('lang', inst.dom.getAttrib(elm, 'lang'));\r
+               setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));\r
+               setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));\r
+               setFormValue('type', inst.dom.getAttrib(elm, 'type'));\r
+               setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus'));\r
+               setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur'));\r
+               setFormValue('onclick', onclick);\r
+               setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick'));\r
+               setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown'));\r
+               setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup'));\r
+               setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover'));\r
+               setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove'));\r
+               setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout'));\r
+               setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress'));\r
+               setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown'));\r
+               setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup'));\r
+               setFormValue('target', inst.dom.getAttrib(elm, 'target'));\r
+               setFormValue('classes', inst.dom.getAttrib(elm, 'class'));\r
+\r
+               // Parse onclick data\r
+               if (onclick != null && onclick.indexOf('window.open') != -1)\r
+                       parseWindowOpen(onclick);\r
+               else\r
+                       parseFunction(onclick);\r
+\r
+               // Select by the values\r
+               selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir'));\r
+               selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel'));\r
+               selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev'));\r
+               selectByValue(formObj, 'linklisthref', href);\r
+\r
+               if (href.charAt(0) == '#')\r
+                       selectByValue(formObj, 'anchorlist', href);\r
+\r
+               addClassesToList('classlist', 'advlink_styles');\r
+\r
+               selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true);\r
+               selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);\r
+       } else\r
+               addClassesToList('classlist', 'advlink_styles');\r
+}\r
+\r
+function checkPrefix(n) {\r
+       if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))\r
+               n.value = 'mailto:' + n.value;\r
+\r
+       if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))\r
+               n.value = 'http://' + n.value;\r
+}\r
+\r
+function setFormValue(name, value) {\r
+       document.forms[0].elements[name].value = value;\r
+}\r
+\r
+function parseWindowOpen(onclick) {\r
+       var formObj = document.forms[0];\r
+\r
+       // Preprocess center code\r
+       if (onclick.indexOf('return false;') != -1) {\r
+               formObj.popupreturn.checked = true;\r
+               onclick = onclick.replace('return false;', '');\r
+       } else\r
+               formObj.popupreturn.checked = false;\r
+\r
+       var onClickData = parseLink(onclick);\r
+\r
+       if (onClickData != null) {\r
+               formObj.ispopup.checked = true;\r
+               setPopupControlsDisabled(false);\r
+\r
+               var onClickWindowOptions = parseOptions(onClickData['options']);\r
+               var url = onClickData['url'];\r
+\r
+               formObj.popupname.value = onClickData['target'];\r
+               formObj.popupurl.value = url;\r
+               formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');\r
+               formObj.popupheight.value = getOption(onClickWindowOptions, 'height');\r
+\r
+               formObj.popupleft.value = getOption(onClickWindowOptions, 'left');\r
+               formObj.popuptop.value = getOption(onClickWindowOptions, 'top');\r
+\r
+               if (formObj.popupleft.value.indexOf('screen') != -1)\r
+                       formObj.popupleft.value = "c";\r
+\r
+               if (formObj.popuptop.value.indexOf('screen') != -1)\r
+                       formObj.popuptop.value = "c";\r
+\r
+               formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";\r
+               formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";\r
+               formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";\r
+               formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";\r
+               formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";\r
+               formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";\r
+               formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";\r
+\r
+               buildOnClick();\r
+       }\r
+}\r
+\r
+function parseFunction(onclick) {\r
+       var formObj = document.forms[0];\r
+       var onClickData = parseLink(onclick);\r
+\r
+       // TODO: Add stuff here\r
+}\r
+\r
+function getOption(opts, name) {\r
+       return typeof(opts[name]) == "undefined" ? "" : opts[name];\r
+}\r
+\r
+function setPopupControlsDisabled(state) {\r
+       var formObj = document.forms[0];\r
+\r
+       formObj.popupname.disabled = state;\r
+       formObj.popupurl.disabled = state;\r
+       formObj.popupwidth.disabled = state;\r
+       formObj.popupheight.disabled = state;\r
+       formObj.popupleft.disabled = state;\r
+       formObj.popuptop.disabled = state;\r
+       formObj.popuplocation.disabled = state;\r
+       formObj.popupscrollbars.disabled = state;\r
+       formObj.popupmenubar.disabled = state;\r
+       formObj.popupresizable.disabled = state;\r
+       formObj.popuptoolbar.disabled = state;\r
+       formObj.popupstatus.disabled = state;\r
+       formObj.popupreturn.disabled = state;\r
+       formObj.popupdependent.disabled = state;\r
+\r
+       setBrowserDisabled('popupurlbrowser', state);\r
+}\r
+\r
+function parseLink(link) {\r
+       link = link.replace(new RegExp('&#39;', 'g'), "'");\r
+\r
+       var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");\r
+\r
+       // Is function name a template function\r
+       var template = templates[fnName];\r
+       if (template) {\r
+               // Build regexp\r
+               var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));\r
+               var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";\r
+               var replaceStr = "";\r
+               for (var i=0; i<variableNames.length; i++) {\r
+                       // Is string value\r
+                       if (variableNames[i].indexOf("'${") != -1)\r
+                               regExp += "'(.*)'";\r
+                       else // Number value\r
+                               regExp += "([0-9]*)";\r
+\r
+                       replaceStr += "$" + (i+1);\r
+\r
+                       // Cleanup variable name\r
+                       variableNames[i] = variableNames[i].replace(new RegExp("[^A-Za-z0-9]", "gi"), "");\r
+\r
+                       if (i != variableNames.length-1) {\r
+                               regExp += "\\s*,\\s*";\r
+                               replaceStr += "<delim>";\r
+                       } else\r
+                               regExp += ".*";\r
+               }\r
+\r
+               regExp += "\\);?";\r
+\r
+               // Build variable array\r
+               var variables = [];\r
+               variables["_function"] = fnName;\r
+               var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('<delim>');\r
+               for (var i=0; i<variableNames.length; i++)\r
+                       variables[variableNames[i]] = variableValues[i];\r
+\r
+               return variables;\r
+       }\r
+\r
+       return null;\r
+}\r
+\r
+function parseOptions(opts) {\r
+       if (opts == null || opts == "")\r
+               return [];\r
+\r
+       // Cleanup the options\r
+       opts = opts.toLowerCase();\r
+       opts = opts.replace(/;/g, ",");\r
+       opts = opts.replace(/[^0-9a-z=,]/g, "");\r
+\r
+       var optionChunks = opts.split(',');\r
+       var options = [];\r
+\r
+       for (var i=0; i<optionChunks.length; i++) {\r
+               var parts = optionChunks[i].split('=');\r
+\r
+               if (parts.length == 2)\r
+                       options[parts[0]] = parts[1];\r
+       }\r
+\r
+       return options;\r
+}\r
+\r
+function buildOnClick() {\r
+       var formObj = document.forms[0];\r
+\r
+       if (!formObj.ispopup.checked) {\r
+               formObj.onclick.value = "";\r
+               return;\r
+       }\r
+\r
+       var onclick = "window.open('";\r
+       var url = formObj.popupurl.value;\r
+\r
+       onclick += url + "','";\r
+       onclick += formObj.popupname.value + "','";\r
+\r
+       if (formObj.popuplocation.checked)\r
+               onclick += "location=yes,";\r
+\r
+       if (formObj.popupscrollbars.checked)\r
+               onclick += "scrollbars=yes,";\r
+\r
+       if (formObj.popupmenubar.checked)\r
+               onclick += "menubar=yes,";\r
+\r
+       if (formObj.popupresizable.checked)\r
+               onclick += "resizable=yes,";\r
+\r
+       if (formObj.popuptoolbar.checked)\r
+               onclick += "toolbar=yes,";\r
+\r
+       if (formObj.popupstatus.checked)\r
+               onclick += "status=yes,";\r
+\r
+       if (formObj.popupdependent.checked)\r
+               onclick += "dependent=yes,";\r
+\r
+       if (formObj.popupwidth.value != "")\r
+               onclick += "width=" + formObj.popupwidth.value + ",";\r
+\r
+       if (formObj.popupheight.value != "")\r
+               onclick += "height=" + formObj.popupheight.value + ",";\r
+\r
+       if (formObj.popupleft.value != "") {\r
+               if (formObj.popupleft.value != "c")\r
+                       onclick += "left=" + formObj.popupleft.value + ",";\r
+               else\r
+                       onclick += "left='+(screen.availWidth/2-" + (formObj.popupwidth.value/2) + ")+',";\r
+       }\r
+\r
+       if (formObj.popuptop.value != "") {\r
+               if (formObj.popuptop.value != "c")\r
+                       onclick += "top=" + formObj.popuptop.value + ",";\r
+               else\r
+                       onclick += "top='+(screen.availHeight/2-" + (formObj.popupheight.value/2) + ")+',";\r
+       }\r
+\r
+       if (onclick.charAt(onclick.length-1) == ',')\r
+               onclick = onclick.substring(0, onclick.length-1);\r
+\r
+       onclick += "');";\r
+\r
+       if (formObj.popupreturn.checked)\r
+               onclick += "return false;";\r
+\r
+       // tinyMCE.debug(onclick);\r
+\r
+       formObj.onclick.value = onclick;\r
+\r
+       if (formObj.href.value == "")\r
+               formObj.href.value = url;\r
+}\r
+\r
+function setAttrib(elm, attrib, value) {\r
+       var formObj = document.forms[0];\r
+       var valueElm = formObj.elements[attrib.toLowerCase()];\r
+       var dom = tinyMCEPopup.editor.dom;\r
+\r
+       if (typeof(value) == "undefined" || value == null) {\r
+               value = "";\r
+\r
+               if (valueElm)\r
+                       value = valueElm.value;\r
+       }\r
+\r
+       // Clean up the style\r
+       if (attrib == 'style')\r
+               value = dom.serializeStyle(dom.parseStyle(value), 'a');\r
+\r
+       dom.setAttrib(elm, attrib, value);\r
+}\r
+\r
+function getAnchorListHTML(id, target) {\r
+       var ed = tinyMCEPopup.editor, nodes = ed.dom.select('a'), name, i, len, html = "";\r
+\r
+       for (i=0, len=nodes.length; i<len; i++) {\r
+               if ((name = ed.dom.getAttrib(nodes[i], "name")) != "")\r
+                       html += '<option value="#' + name + '">' + name + '</option>';\r
+       }\r
+\r
+       if (html == "")\r
+               return "";\r
+\r
+       html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"'\r
+               + ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"'\r
+               + '>'\r
+               + '<option value="">---</option>'\r
+               + html\r
+               + '</select>';\r
+\r
+       return html;\r
+}\r
+\r
+function insertAction() {\r
+       var inst = tinyMCEPopup.editor;\r
+       var elm, elementArray, i;\r
+\r
+       elm = inst.selection.getNode();\r
+       checkPrefix(document.forms[0].href);\r
+\r
+       elm = inst.dom.getParent(elm, "A");\r
+\r
+       // Remove element if there is no href\r
+       if (!document.forms[0].href.value) {\r
+               i = inst.selection.getBookmark();\r
+               inst.dom.remove(elm, 1);\r
+               inst.selection.moveToBookmark(i);\r
+               tinyMCEPopup.execCommand("mceEndUndoLevel");\r
+               tinyMCEPopup.close();\r
+               return;\r
+       }\r
+\r
+       // Create new anchor elements\r
+       if (elm == null) {\r
+               inst.getDoc().execCommand("unlink", false, null);\r
+               tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});\r
+\r
+               elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});\r
+               for (i=0; i<elementArray.length; i++)\r
+                       setAllAttribs(elm = elementArray[i]);\r
+       } else\r
+               setAllAttribs(elm);\r
+\r
+       // Don't move caret if selection was image\r
+       if (elm.childNodes.length != 1 || elm.firstChild.nodeName != 'IMG') {\r
+               inst.focus();\r
+               inst.selection.select(elm);\r
+               inst.selection.collapse(0);\r
+               tinyMCEPopup.storeSelection();\r
+       }\r
+\r
+       tinyMCEPopup.execCommand("mceEndUndoLevel");\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function setAllAttribs(elm) {\r
+       var formObj = document.forms[0];\r
+       var href = formObj.href.value.replace(/ /g, '%20');\r
+       var target = getSelectValue(formObj, 'targetlist');\r
+\r
+       setAttrib(elm, 'href', href);\r
+       setAttrib(elm, 'title');\r
+       setAttrib(elm, 'target', target == '_self' ? '' : target);\r
+       setAttrib(elm, 'id');\r
+       setAttrib(elm, 'style');\r
+       setAttrib(elm, 'class', getSelectValue(formObj, 'classlist'));\r
+       setAttrib(elm, 'rel');\r
+       setAttrib(elm, 'rev');\r
+       setAttrib(elm, 'charset');\r
+       setAttrib(elm, 'hreflang');\r
+       setAttrib(elm, 'dir');\r
+       setAttrib(elm, 'lang');\r
+       setAttrib(elm, 'tabindex');\r
+       setAttrib(elm, 'accesskey');\r
+       setAttrib(elm, 'type');\r
+       setAttrib(elm, 'onfocus');\r
+       setAttrib(elm, 'onblur');\r
+       setAttrib(elm, 'onclick');\r
+       setAttrib(elm, 'ondblclick');\r
+       setAttrib(elm, 'onmousedown');\r
+       setAttrib(elm, 'onmouseup');\r
+       setAttrib(elm, 'onmouseover');\r
+       setAttrib(elm, 'onmousemove');\r
+       setAttrib(elm, 'onmouseout');\r
+       setAttrib(elm, 'onkeypress');\r
+       setAttrib(elm, 'onkeydown');\r
+       setAttrib(elm, 'onkeyup');\r
+\r
+       // Refresh in old MSIE\r
+       if (tinyMCE.isMSIE5)\r
+               elm.outerHTML = elm.outerHTML;\r
+}\r
+\r
+function getSelectValue(form_obj, field_name) {\r
+       var elm = form_obj.elements[field_name];\r
+\r
+       if (!elm || elm.options == null || elm.selectedIndex == -1)\r
+               return "";\r
+\r
+       return elm.options[elm.selectedIndex].value;\r
+}\r
+\r
+function getLinkListHTML(elm_id, target_form_element, onchange_func) {\r
+       if (typeof(tinyMCELinkList) == "undefined" || tinyMCELinkList.length == 0)\r
+               return "";\r
+\r
+       var html = "";\r
+\r
+       html += '<select id="' + elm_id + '" name="' + elm_id + '"';\r
+       html += ' class="mceLinkList" onchange="this.form.' + target_form_element + '.value=';\r
+       html += 'this.options[this.selectedIndex].value;';\r
+\r
+       if (typeof(onchange_func) != "undefined")\r
+               html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';\r
+\r
+       html += '"><option value="">---</option>';\r
+\r
+       for (var i=0; i<tinyMCELinkList.length; i++)\r
+               html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';\r
+\r
+       html += '</select>';\r
+\r
+       return html;\r
+\r
+       // tinyMCE.debug('-- image list start --', html, '-- image list end --');\r
+}\r
+\r
+function getTargetListHTML(elm_id, target_form_element) {\r
+       var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');\r
+       var html = '';\r
+\r
+       html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value=';\r
+       html += 'this.options[this.selectedIndex].value;">';\r
+       html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';\r
+       html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';\r
+       html += '<option value="_parent">' + tinyMCEPopup.getLang('advlink_dlg.target_parent') + ' (_parent)</option>';\r
+       html += '<option value="_top">' + tinyMCEPopup.getLang('advlink_dlg.target_top') + ' (_top)</option>';\r
+\r
+       for (var i=0; i<targets.length; i++) {\r
+               var key, value;\r
+\r
+               if (targets[i] == "")\r
+                       continue;\r
+\r
+               key = targets[i].split('=')[0];\r
+               value = targets[i].split('=')[1];\r
+\r
+               html += '<option value="' + key + '">' + value + ' (' + key + ')</option>';\r
+       }\r
+\r
+       html += '</select>';\r
+\r
+       return html;\r
+}\r
+\r
+// While loading\r
+preinit();\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlink/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/advlink/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..3169a56
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.advlink_dlg',{"target_name":"Target Name",classes:"Classes",style:"Style",id:"ID","popup_position":"Position (X/Y)",langdir:"Language Direction","popup_size":"Size","popup_dependent":"Dependent (Mozilla/Firefox Only)","popup_resizable":"Make Window Resizable","popup_location":"Show Location Bar","popup_menubar":"Show Menu Bar","popup_toolbar":"Show Toolbars","popup_statusbar":"Show Status Bar","popup_scrollbars":"Show Scrollbars","popup_return":"Insert \'return false\'","popup_name":"Window Name","popup_url":"Popup URL",popup:"JavaScript Popup","target_blank":"Open in New Window","target_top":"Open in Top Frame (Replaces All Frames)","target_parent":"Open in Parent Window/Frame","target_same":"Open in This Window/Frame","anchor_names":"Anchors","popup_opts":"Options","advanced_props":"Advanced Properties","event_props":"Events","popup_props":"Popup Properties","general_props":"General Properties","advanced_tab":"Advanced","events_tab":"Events","popup_tab":"Popup","general_tab":"General",list:"Link List","is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",titlefield:"Title",target:"Target",url:"Link URL",title:"Insert/Edit Link","link_list":"Link List",rtl:"Right to Left",ltr:"Left to Right",accesskey:"AccessKey",tabindex:"TabIndex",rev:"Relationship Target to Page",rel:"Relationship Page to Target",mime:"Target MIME Type",encoding:"Target Character Encoding",langcode:"Language Code","target_langcode":"Target Language",width:"Width",height:"Height"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlink/link.htm b/3.x/src/resources/javascript/TinyMCE/plugins/advlink/link.htm
new file mode 100644 (file)
index 0000000..8ab7c2a
--- /dev/null
@@ -0,0 +1,338 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advlink_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="js/advlink.js"></script>\r
+       <link href="css/advlink.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body id="advlink" style="display: none" role="application" onload="javascript:mcTabs.displayTab('general_tab','general_panel', true);" aria-labelledby="app_label">\r
+       <span class="mceVoiceLabel" id="app_label" style="display:none;">{#advlink_dlg.title}</span>\r
+       <form onsubmit="insertAction();return false;" action="#">\r
+               <div class="tabs" role="presentation">\r
+                       <ul>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel" ><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advlink_dlg.general_tab}</a></span></li>\r
+                               <li id="popup_tab" aria-controls="popup_panel" ><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{#advlink_dlg.popup_tab}</a></span></li>\r
+                               <li id="events_tab" aria-controls="events_panel"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#advlink_dlg.events_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advlink_dlg.advanced_tab}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper" role="presentation">\r
+                       <div id="general_panel" class="panel current">\r
+                               <fieldset>\r
+                                       <legend>{#advlink_dlg.general_props}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0" role="presentation">\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label id="hreflabel" for="href">{#advlink_dlg.url}</label></td>\r
+                                                               <td><table border="0" cellspacing="0" cellpadding="0">\r
+                                                       <tr>\r
+                                                               <td><input id="href" name="href" type="text" class="mceFocus" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" aria-required="true" /></td>\r
+                                                               <td id="hrefbrowsercontainer">&nbsp;</td>\r
+                                                       </tr>\r
+                                                       </table></td>\r
+                                               </tr>\r
+                                               <tr id="linklisthrefrow">\r
+                                                       <td class="column1"><label for="linklisthref">{#advlink_dlg.list}</label></td>\r
+                                                       <td colspan="2" id="linklisthrefcontainer"><select id="linklisthref"><option value=""></option></select></td>\r
+                                               </tr>\r
+                                               <tr id="anchorlistrow">\r
+                                                       <td class="column1"><label for="anchorlist">{#advlink_dlg.anchor_names}</label></td>\r
+                                                       <td colspan="2" id="anchorlistcontainer"><select id="anchorlist"><option value=""></option></select></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td><label id="targetlistlabel" for="targetlist">{#advlink_dlg.target}</label></td>\r
+                                                       <td id="targetlistcontainer"><select id="targetlist"><option value=""></option></select></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label id="titlelabel" for="title">{#advlink_dlg.titlefield}</label></td>\r
+                                                       <td><input id="title" name="title" type="text" value="" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td><label id="classlabel" for="classlist">{#class_name}</label></td>\r
+                                                       <td>\r
+                                                                <select id="classlist" name="classlist" onchange="changeClass();">\r
+                                                                       <option value="" selected="selected">{#not_set}</option>\r
+                                                                </select>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="popup_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#advlink_dlg.popup_props}</legend>\r
+\r
+                                       <input type="checkbox" id="ispopup" name="ispopup" class="radio" onclick="setPopupControlsDisabled(!this.checked);buildOnClick();" />\r
+                                       <label id="ispopuplabel" for="ispopup">{#advlink_dlg.popup}</label>\r
+\r
+                                       <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="popupurl">{#advlink_dlg.popup_url}</label>&nbsp;</td>\r
+                                                       <td>\r
+                                                               <table border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" name="popupurl" id="popupurl" value="" onchange="buildOnClick();" /></td>\r
+                                                                               <td id="popupurlbrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="popupname">{#advlink_dlg.popup_name}</label>&nbsp;</td>\r
+                                                       <td><input type="text" name="popupname" id="popupname" value="" onchange="buildOnClick();" /></td>\r
+                                               </tr>\r
+                                               <tr role="group" aria-labelledby="popup_size_label">\r
+                                                       <td class="nowrap"><label id="popup_size_label">{#advlink_dlg.popup_size}</label>&nbsp;</td>\r
+                                                       <td class="nowrap">\r
+                                                               <span style="display:none" id="width_voiceLabel">{#advlink_dlg.width}</span>\r
+                                                               <input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" aria-labelledby="width_voiceLabel" /> x\r
+                                                               <span style="display:none" id="height_voiceLabel">{#advlink_dlg.height}</span>\r
+                                                               <input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" aria-labelledby="height_voiceLabel" /> px\r
+                                                       </td>\r
+                                               </tr>\r
+                                               <tr role="group" aria-labelledby="popup_position_label center_hint">\r
+                                                       <td class="nowrap" id="labelleft"><label id="popup_position_label">{#advlink_dlg.popup_position}</label>&nbsp;</td>\r
+                                                       <td class="nowrap">\r
+                                                               <span style="display:none" id="x_voiceLabel">X</span>\r
+                                                               <input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" aria-labelledby="x_voiceLabel" /> /                                \r
+                                                               <span style="display:none" id="y_voiceLabel">Y</span>\r
+                                                               <input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" aria-labelledby="y_voiceLabel" /> <span id="center_hint">(c /c = center)</span>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <fieldset>\r
+                                               <legend>{#advlink_dlg.popup_opts}</legend>\r
+\r
+                                               <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
+                                                       <tr>\r
+                                                               <td><input type="checkbox" id="popuplocation" name="popuplocation" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popuplocationlabel" for="popuplocation">{#advlink_dlg.popup_location}</label></td>\r
+                                                               <td><input type="checkbox" id="popupscrollbars" name="popupscrollbars" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popupscrollbarslabel" for="popupscrollbars">{#advlink_dlg.popup_scrollbars}</label></td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><input type="checkbox" id="popupmenubar" name="popupmenubar" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popupmenubarlabel" for="popupmenubar">{#advlink_dlg.popup_menubar}</label></td>\r
+                                                               <td><input type="checkbox" id="popupresizable" name="popupresizable" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popupresizablelabel" for="popupresizable">{#advlink_dlg.popup_resizable}</label></td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><input type="checkbox" id="popuptoolbar" name="popuptoolbar" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popuptoolbarlabel" for="popuptoolbar">{#advlink_dlg.popup_toolbar}</label></td>\r
+                                                               <td><input type="checkbox" id="popupdependent" name="popupdependent" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popupdependentlabel" for="popupdependent">{#advlink_dlg.popup_dependent}</label></td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><input type="checkbox" id="popupstatus" name="popupstatus" class="checkbox" onchange="buildOnClick();" /></td>\r
+                                                               <td class="nowrap"><label id="popupstatuslabel" for="popupstatus">{#advlink_dlg.popup_statusbar}</label></td>\r
+                                                               <td><input type="checkbox" id="popupreturn" name="popupreturn" class="checkbox" onchange="buildOnClick();" checked="checked" /></td>\r
+                                                               <td class="nowrap"><label id="popupreturnlabel" for="popupreturn">{#advlink_dlg.popup_return}</label></td>\r
+                                                       </tr>\r
+                                               </table>\r
+                                       </fieldset>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="advanced_panel" class="panel">\r
+                       <fieldset>\r
+                                       <legend>{#advlink_dlg.advanced_props}</legend>\r
+\r
+                                       <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="idlabel" for="id">{#advlink_dlg.id}</label></td> \r
+                                                       <td><input id="id" name="id" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="stylelabel" for="style">{#advlink_dlg.style}</label></td>\r
+                                                       <td><input type="text" id="style" name="style" value="" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="classeslabel" for="classes">{#advlink_dlg.classes}</label></td>\r
+                                                       <td><input type="text" id="classes" name="classes" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="targetlabel" for="target">{#advlink_dlg.target_name}</label></td>\r
+                                                       <td><input type="text" id="target" name="target" value="" onchange="selectByValue(this.form,'targetlist',this.value,true);" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="dirlabel" for="dir">{#advlink_dlg.langdir}</label></td> \r
+                                                       <td>\r
+                                                               <select id="dir" name="dir"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="ltr">{#advlink_dlg.ltr}</option> \r
+                                                                               <option value="rtl">{#advlink_dlg.rtl}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="hreflanglabel" for="hreflang">{#advlink_dlg.target_langcode}</label></td>\r
+                                                       <td><input type="text" id="hreflang" name="hreflang" value="" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="langlabel" for="lang">{#advlink_dlg.langcode}</label></td> \r
+                                                       <td>\r
+                                                               <input id="lang" name="lang" type="text" value="" />\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="charsetlabel" for="charset">{#advlink_dlg.encoding}</label></td>\r
+                                                       <td><input type="text" id="charset" name="charset" value="" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="typelabel" for="type">{#advlink_dlg.mime}</label></td>\r
+                                                       <td><input type="text" id="type" name="type" value="" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="rellabel" for="rel">{#advlink_dlg.rel}</label></td>\r
+                                                       <td><select id="rel" name="rel"> \r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="lightbox">Lightbox</option> \r
+                                                                       <option value="alternate">Alternate</option> \r
+                                                                       <option value="designates">Designates</option> \r
+                                                                       <option value="stylesheet">Stylesheet</option> \r
+                                                                       <option value="start">Start</option> \r
+                                                                       <option value="next">Next</option> \r
+                                                                       <option value="prev">Prev</option> \r
+                                                                       <option value="contents">Contents</option> \r
+                                                                       <option value="index">Index</option> \r
+                                                                       <option value="glossary">Glossary</option> \r
+                                                                       <option value="copyright">Copyright</option> \r
+                                                                       <option value="chapter">Chapter</option> \r
+                                                                       <option value="subsection">Subsection</option> \r
+                                                                       <option value="appendix">Appendix</option> \r
+                                                                       <option value="help">Help</option> \r
+                                                                       <option value="bookmark">Bookmark</option>\r
+                                                                       <option value="nofollow">No Follow</option>\r
+                                                                       <option value="tag">Tag</option>\r
+                                                               </select> \r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="revlabel" for="rev">{#advlink_dlg.rev}</label></td>\r
+                                                       <td><select id="rev" name="rev"> \r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="alternate">Alternate</option> \r
+                                                                       <option value="designates">Designates</option> \r
+                                                                       <option value="stylesheet">Stylesheet</option> \r
+                                                                       <option value="start">Start</option> \r
+                                                                       <option value="next">Next</option> \r
+                                                                       <option value="prev">Prev</option> \r
+                                                                       <option value="contents">Contents</option> \r
+                                                                       <option value="index">Index</option> \r
+                                                                       <option value="glossary">Glossary</option> \r
+                                                                       <option value="copyright">Copyright</option> \r
+                                                                       <option value="chapter">Chapter</option> \r
+                                                                       <option value="subsection">Subsection</option> \r
+                                                                       <option value="appendix">Appendix</option> \r
+                                                                       <option value="help">Help</option> \r
+                                                                       <option value="bookmark">Bookmark</option> \r
+                                                               </select> \r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="tabindexlabel" for="tabindex">{#advlink_dlg.tabindex}</label></td>\r
+                                                       <td><input type="text" id="tabindex" name="tabindex" value="" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="accesskeylabel" for="accesskey">{#advlink_dlg.accesskey}</label></td>\r
+                                                       <td><input type="text" id="accesskey" name="accesskey" value="" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                                       <legend>{#advlink_dlg.event_props}</legend>\r
+\r
+                                       <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onfocus">onfocus</label></td> \r
+                                                       <td><input id="onfocus" name="onfocus" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onblur">onblur</label></td> \r
+                                                       <td><input id="onblur" name="onblur" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onclick">onclick</label></td> \r
+                                                       <td><input id="onclick" name="onclick" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="ondblclick">ondblclick</label></td> \r
+                                                       <td><input id="ondblclick" name="ondblclick" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onmousedown">onmousedown</label></td> \r
+                                                       <td><input id="onmousedown" name="onmousedown" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onmouseup">onmouseup</label></td> \r
+                                                       <td><input id="onmouseup" name="onmouseup" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onmouseover">onmouseover</label></td> \r
+                                                       <td><input id="onmouseover" name="onmouseover" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onmousemove">onmousemove</label></td> \r
+                                                       <td><input id="onmousemove" name="onmousemove" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onmouseout">onmouseout</label></td> \r
+                                                       <td><input id="onmouseout" name="onmouseout" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onkeypress">onkeypress</label></td> \r
+                                                       <td><input id="onkeypress" name="onkeypress" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onkeydown">onkeydown</label></td> \r
+                                                       <td><input id="onkeydown" name="onkeydown" type="text" value="" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="onkeyup">onkeyup</label></td> \r
+                                                       <td><input id="onkeyup" name="onkeyup" type="text" value="" /></td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlist/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/advlist/editor_plugin.js
new file mode 100644 (file)
index 0000000..57ecce6
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,i,g=f.editor;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){i=f[d][0]}function c(j,l){var k=true;a(l.styles,function(n,m){if(g.dom.getStyle(j,m)!=n){k=false;return false}});return k}function h(){var k,l=g.dom,j=g.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,i)){g.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(i){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,i.styles);k.removeAttribute("data-mce-style")}}g.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){h()}});e.onRenderMenu.add(function(j,k){k.onHideMenu.add(function(){if(f.bookmark){g.selection.moveToBookmark(f.bookmark);f.bookmark=0}});k.onShowMenu.add(function(){var n=g.dom,m=n.getParent(g.selection.getNode(),"ol,ul"),l;if(m||i){l=f[d];a(k.items,function(o){var p=true;o.setSelected(0);if(m&&!o.isDisabled()){a(l,function(q){if(q.id==o.id){if(!c(m,q)){p=false;return false}}});if(p){o.setSelected(1)}}});if(!m){k.items[i.id].setSelected(1)}}g.focus();if(tinymce.isIE){f.bookmark=g.selection.getBookmark(1)}});k.add({id:g.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(l){if(f.isIE7&&l.styles.listStyleType=="lower-greek"){return}l.id=g.dom.uniqueId();k.add({id:l.id,title:l.title,onclick:function(){i=l;h()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/advlist/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/advlist/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..a8f046b
--- /dev/null
@@ -0,0 +1,176 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.plugins.AdvListPlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       function buildFormats(str) {\r
+                               var formats = [];\r
+\r
+                               each(str.split(/,/), function(type) {\r
+                                       formats.push({\r
+                                               title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')),\r
+                                               styles : {\r
+                                                       listStyleType : type == 'default' ? '' : type\r
+                                               }\r
+                                       });\r
+                               });\r
+\r
+                               return formats;\r
+                       };\r
+\r
+                       // Setup number formats from config or default\r
+                       t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");\r
+                       t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");\r
+\r
+                       if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent))\r
+                               t.isIE7 = true;\r
+               },\r
+\r
+               createControl: function(name, cm) {\r
+                       var t = this, btn, format, editor = t.editor;\r
+\r
+                       if (name == 'numlist' || name == 'bullist') {\r
+                               // Default to first item if it's a default item\r
+                               if (t[name][0].title == 'advlist.def')\r
+                                       format = t[name][0];\r
+\r
+                               function hasFormat(node, format) {\r
+                                       var state = true;\r
+\r
+                                       each(format.styles, function(value, name) {\r
+                                               // Format doesn't match\r
+                                               if (editor.dom.getStyle(node, name) != value) {\r
+                                                       state = false;\r
+                                                       return false;\r
+                                               }\r
+                                       });\r
+\r
+                                       return state;\r
+                               };\r
+\r
+                               function applyListFormat() {\r
+                                       var list, dom = editor.dom, sel = editor.selection;\r
+\r
+                                       // Check for existing list element\r
+                                       list = dom.getParent(sel.getNode(), 'ol,ul');\r
+\r
+                                       // Switch/add list type if needed\r
+                                       if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))\r
+                                               editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');\r
+\r
+                                       // Append styles to new list element\r
+                                       if (format) {\r
+                                               list = dom.getParent(sel.getNode(), 'ol,ul');\r
+                                               if (list) {\r
+                                                       dom.setStyles(list, format.styles);\r
+                                                       list.removeAttribute('data-mce-style');\r
+                                               }\r
+                                       }\r
+\r
+                                       editor.focus();\r
+                               };\r
+\r
+                               btn = cm.createSplitButton(name, {\r
+                                       title : 'advanced.' + name + '_desc',\r
+                                       'class' : 'mce_' + name,\r
+                                       onclick : function() {\r
+                                               applyListFormat();\r
+                                       }\r
+                               });\r
+\r
+                               btn.onRenderMenu.add(function(btn, menu) {\r
+                                       menu.onHideMenu.add(function() {\r
+                                               if (t.bookmark) {\r
+                                                       editor.selection.moveToBookmark(t.bookmark);\r
+                                                       t.bookmark = 0;\r
+                                               }\r
+                                       });\r
+\r
+                                       menu.onShowMenu.add(function() {\r
+                                               var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList;\r
+\r
+                                               if (list || format) {\r
+                                                       fmtList = t[name];\r
+\r
+                                                       // Unselect existing items\r
+                                                       each(menu.items, function(item) {\r
+                                                               var state = true;\r
+\r
+                                                               item.setSelected(0);\r
+\r
+                                                               if (list && !item.isDisabled()) {\r
+                                                                       each(fmtList, function(fmt) {\r
+                                                                               if (fmt.id == item.id) {\r
+                                                                                       if (!hasFormat(list, fmt)) {\r
+                                                                                               state = false;\r
+                                                                                               return false;\r
+                                                                                       }\r
+                                                                               }\r
+                                                                       });\r
+\r
+                                                                       if (state)\r
+                                                                               item.setSelected(1);\r
+                                                               }\r
+                                                       });\r
+\r
+                                                       // Select the current format\r
+                                                       if (!list)\r
+                                                               menu.items[format.id].setSelected(1);\r
+                                               }\r
+       \r
+                                               editor.focus();\r
+\r
+                                               // IE looses it's selection so store it away and restore it later\r
+                                               if (tinymce.isIE) {\r
+                                                       t.bookmark = editor.selection.getBookmark(1);\r
+                                               }\r
+                                       });\r
+\r
+                                       menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);\r
+\r
+                                       each(t[name], function(item) {\r
+                                               // IE<8 doesn't support lower-greek, skip it\r
+                                               if (t.isIE7 && item.styles.listStyleType == 'lower-greek')\r
+                                                       return;\r
+\r
+                                               item.id = editor.dom.uniqueId();\r
+\r
+                                               menu.add({id : item.id, title : item.title, onclick : function() {\r
+                                                       format = item;\r
+                                                       applyListFormat();\r
+                                               }});\r
+                                       });\r
+                               });\r
+\r
+                               return btn;\r
+                       }\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Advanced lists',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autolink/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/autolink/editor_plugin.js
new file mode 100644 (file)
index 0000000..d1c3502
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;a.onKeyDown.addToTop(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});if(tinyMCE.isIE){return}a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng(true).cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}if(n.nodeType==3){a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}var m=a.toString();if(m.charAt(m.length-1)=="."){a.setEnd(n,c-1)}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])&&!/^mailto:/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);i.nodeChanged();if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autolink/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/autolink/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..c05fbbc
--- /dev/null
@@ -0,0 +1,184 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2011, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       tinymce.create('tinymce.plugins.AutolinkPlugin', {
+       /**
+       * Initializes the plugin, this will be executed after the plugin has been created.
+       * This call is done before the editor instance has finished it's initialization so use the onInit event
+       * of the editor instance to intercept that event.
+       *
+       * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+       * @param {string} url Absolute URL to where the plugin is located.
+       */
+
+       init : function(ed, url) {
+               var t = this;
+
+               // Add a key down handler
+               ed.onKeyDown.addToTop(function(ed, e) {
+                       if (e.keyCode == 13)
+                               return t.handleEnter(ed);
+               });
+
+               // Internet Explorer has built-in automatic linking for most cases
+               if (tinyMCE.isIE)
+                       return;
+
+               ed.onKeyPress.add(function(ed, e) {
+                       if (e.which == 41)
+                               return t.handleEclipse(ed);
+               });
+
+               // Add a key up handler
+               ed.onKeyUp.add(function(ed, e) {
+                       if (e.keyCode == 32)
+                               return t.handleSpacebar(ed);
+                       });
+              },
+
+               handleEclipse : function(ed) {
+                       this.parseCurrentLine(ed, -1, '(', true);
+               },
+
+               handleSpacebar : function(ed) {
+                        this.parseCurrentLine(ed, 0, '', true);
+                },
+
+               handleEnter : function(ed) {
+                       this.parseCurrentLine(ed, -1, '', false);
+               },
+
+               parseCurrentLine : function(ed, end_offset, delimiter, goback) {
+                       var r, end, start, endContainer, bookmark, text, matches, prev, len;
+
+                       // We need at least five characters to form a URL,
+                       // hence, at minimum, five characters from the beginning of the line.
+                       r = ed.selection.getRng(true).cloneRange();
+                       if (r.startOffset < 5) {
+                               // During testing, the caret is placed inbetween two text nodes. 
+                               // The previous text node contains the URL.
+                               prev = r.endContainer.previousSibling;
+                               if (prev == null) {
+                                       if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
+                                               return;
+
+                                       prev = r.endContainer.firstChild.nextSibling;
+                               }
+                               len = prev.length;
+                               r.setStart(prev, len);
+                               r.setEnd(prev, len);
+
+                               if (r.endOffset < 5)
+                                       return;
+
+                               end = r.endOffset;
+                               endContainer = prev;
+                       } else {
+                               endContainer = r.endContainer;
+
+                               // Get a text node
+                               if (endContainer.nodeType != 3 && endContainer.firstChild) {
+                                       while (endContainer.nodeType != 3 && endContainer.firstChild)
+                                               endContainer = endContainer.firstChild;
+
+                                       // Move range to text node
+                                       if (endContainer.nodeType == 3) {
+                                               r.setStart(endContainer, 0);
+                                               r.setEnd(endContainer, endContainer.nodeValue.length);
+                                       }
+                               }
+
+                               if (r.endOffset == 1)
+                                       end = 2;
+                               else
+                                       end = r.endOffset - 1 - end_offset;
+                       }
+
+                       start = end;
+
+                       do
+                       {
+                               // Move the selection one character backwards.
+                               r.setStart(endContainer, end - 2);
+                               r.setEnd(endContainer, end - 1);
+                               end -= 1;
+
+                               // Loop until one of the following is found: a blank space, &nbsp;, delimeter, (end-2) >= 0
+                       } while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
+
+                       if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
+                               r.setStart(endContainer, end);
+                               r.setEnd(endContainer, start);
+                               end += 1;
+                       } else if (r.startOffset == 0) {
+                               r.setStart(endContainer, 0);
+                               r.setEnd(endContainer, start);
+                       }
+                       else {
+                               r.setStart(endContainer, end);
+                               r.setEnd(endContainer, start);
+                       }
+
+                       // Exclude last . from word like "www.site.com."
+                       var text = r.toString();
+                       if (text.charAt(text.length - 1) == '.') {
+                               r.setEnd(endContainer, start - 1);
+                       }
+
+                       text = r.toString();
+                       matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);
+
+                       if (matches) {
+                               if (matches[1] == 'www.') {
+                                       matches[1] = 'http://www.';
+                               } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
+                                       matches[1] = 'mailto:' + matches[1];
+                               }
+
+                               bookmark = ed.selection.getBookmark();
+
+                               ed.selection.setRng(r);
+                               tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);
+                               ed.selection.moveToBookmark(bookmark);
+                               ed.nodeChanged();
+
+                               // TODO: Determine if this is still needed.
+                               if (tinyMCE.isWebKit) {
+                                       // move the caret to its original position
+                                       ed.selection.collapse(false);
+                                       var max = Math.min(endContainer.length, start + 1);
+                                       r.setStart(endContainer, max);
+                                       r.setEnd(endContainer, max);
+                                       ed.selection.setRng(r);
+                               }
+                       }
+               },
+
+               /**
+               * Returns information about the plugin as a name/value array.
+               * The current keys are longname, author, authorurl, infourl and version.
+               *
+               * @return {Object} Name/value array containing information about the plugin.
+               */
+               getInfo : function() {
+                       return {
+                               longname : 'Autolink',
+                               author : 'Moxiecode Systems AB',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
+                       };
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
+})();
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autoresize/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/autoresize/editor_plugin.js
new file mode 100644 (file)
index 0000000..46d9dc3
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var j,i=a.getDoc(),f=i.body,l=i.documentElement,h=tinymce.DOM,k=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:(tinymce.isWebKit&&f.clientHeight==0?0:f.offsetHeight);if(g>d.autoresize_min_height){k=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){k=d.autoresize_max_height;f.style.overflowY="auto";l.style.overflowY="auto"}else{f.style.overflowY="hidden";l.style.overflowY="hidden";f.scrollTop=0}if(k!==e){j=k-e;h.setStyle(h.get(a.id+"_ifr"),"height",k+"px");e=k;if(tinymce.isWebKit&&j<0){b()}}}d.editor=a;d.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight));d.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0));a.onInit.add(function(f){f.dom.setStyle(f.getBody(),"paddingBottom",f.getParam("autoresize_bottom_margin",50)+"px")});a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onLoad.add(b);a.onLoadContent.add(b)}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autoresize/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/autoresize/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..7673bcf
--- /dev/null
@@ -0,0 +1,119 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       /**
+        * Auto Resize
+        *
+        * This plugin automatically resizes the content area to fit its content height.
+        * It will retain a minimum height, which is the height of the content area when
+        * it's initialized.
+        */
+       tinymce.create('tinymce.plugins.AutoResizePlugin', {
+               /**
+                * Initializes the plugin, this will be executed after the plugin has been created.
+                * This call is done before the editor instance has finished it's initialization so use the onInit event
+                * of the editor instance to intercept that event.
+                *
+                * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+                * @param {string} url Absolute URL to where the plugin is located.
+                */
+               init : function(ed, url) {
+                       var t = this, oldSize = 0;
+
+                       if (ed.getParam('fullscreen_is_enabled'))
+                               return;
+
+                       /**
+                        * This method gets executed each time the editor needs to resize.
+                        */
+                       function resize() {
+                               var deltaSize, d = ed.getDoc(), body = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
+
+                               // Get height differently depending on the browser used
+                               myHeight = tinymce.isIE ? body.scrollHeight : (tinymce.isWebKit && body.clientHeight == 0 ? 0 : body.offsetHeight);
+
+                               // Don't make it smaller than the minimum height
+                               if (myHeight > t.autoresize_min_height)
+                                       resizeHeight = myHeight;
+
+                               // If a maximum height has been defined don't exceed this height
+                               if (t.autoresize_max_height && myHeight > t.autoresize_max_height) {
+                                       resizeHeight = t.autoresize_max_height;
+                                       body.style.overflowY = "auto";
+                                       de.style.overflowY = "auto"; // Old IE
+                               } else {
+                                       body.style.overflowY = "hidden";
+                                       de.style.overflowY = "hidden"; // Old IE
+                                       body.scrollTop = 0;
+                               }
+
+                               // Resize content element
+                               if (resizeHeight !== oldSize) {
+                                       deltaSize = resizeHeight - oldSize;
+                                       DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
+                                       oldSize = resizeHeight;
+
+                                       // WebKit doesn't decrease the size of the body element until the iframe gets resized
+                                       // So we need to continue to resize the iframe down until the size gets fixed
+                                       if (tinymce.isWebKit && deltaSize < 0)
+                                               resize();
+                               }
+                       };
+
+                       t.editor = ed;
+
+                       // Define minimum height
+                       t.autoresize_min_height = parseInt(ed.getParam('autoresize_min_height', ed.getElement().offsetHeight));
+
+                       // Define maximum height
+                       t.autoresize_max_height = parseInt(ed.getParam('autoresize_max_height', 0));
+
+                       // Add padding at the bottom for better UX
+                       ed.onInit.add(function(ed){
+                               ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px');
+                       });
+
+                       // Add appropriate listeners for resizing content area
+                       ed.onChange.add(resize);
+                       ed.onSetContent.add(resize);
+                       ed.onPaste.add(resize);
+                       ed.onKeyUp.add(resize);
+                       ed.onPostRender.add(resize);
+
+                       if (ed.getParam('autoresize_on_init', true)) {
+                               ed.onLoad.add(resize);
+                               ed.onLoadContent.add(resize);
+                       }
+
+                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
+                       ed.addCommand('mceAutoResize', resize);
+               },
+
+               /**
+                * Returns information about the plugin as a name/value array.
+                * The current keys are longname, author, authorurl, infourl and version.
+                *
+                * @return {Object} Name/value array containing information about the plugin.
+                */
+               getInfo : function() {
+                       return {
+                               longname : 'Auto Resize',
+                               author : 'Moxiecode Systems AB',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize',
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
+                       };
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
+})();
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autosave/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/autosave/editor_plugin.js
new file mode 100644 (file)
index 0000000..6da98ff
--- /dev/null
@@ -0,0 +1 @@
+(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){if(!i.removed){h.storeDraft();i.nodeChanged()}},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,j=h.storage,i;if(j){i=j.getItem(h.key);if(i){h.editor.setContent(i);h.onRestoreDraft.dispatch(h,{content:i})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autosave/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/autosave/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..8b308f5
--- /dev/null
@@ -0,0 +1,433 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ *\r
+ * Adds auto-save capability to the TinyMCE text editor to rescue content\r
+ * inadvertently lost. This plugin was originally developed by Speednet\r
+ * and that project can be found here: http://code.google.com/p/tinyautosave/\r
+ *\r
+ * TECHNOLOGY DISCUSSION:\r
+ * \r
+ * The plugin attempts to use the most advanced features available in the current browser to save\r
+ * as much content as possible.  There are a total of four different methods used to autosave the\r
+ * content.  In order of preference, they are:\r
+ * \r
+ * 1. localStorage - A new feature of HTML 5, localStorage can store megabytes of data per domain\r
+ * on the client computer. Data stored in the localStorage area has no expiration date, so we must\r
+ * manage expiring the data ourselves.  localStorage is fully supported by IE8, and it is supposed\r
+ * to be working in Firefox 3 and Safari 3.2, but in reality is is flaky in those browsers.  As\r
+ * HTML 5 gets wider support, the AutoSave plugin will use it automatically. In Windows Vista/7,\r
+ * localStorage is stored in the following folder:\r
+ * C:\Users\[username]\AppData\Local\Microsoft\Internet Explorer\DOMStore\[tempFolder]\r
+ * \r
+ * 2. sessionStorage - A new feature of HTML 5, sessionStorage works similarly to localStorage,\r
+ * except it is designed to expire after a certain amount of time.  Because the specification\r
+ * around expiration date/time is very loosely-described, it is preferrable to use locaStorage and\r
+ * manage the expiration ourselves.  sessionStorage has similar storage characteristics to\r
+ * localStorage, although it seems to have better support by Firefox 3 at the moment.  (That will\r
+ * certainly change as Firefox continues getting better at HTML 5 adoption.)\r
+ * \r
+ * 3. UserData - A very under-exploited feature of Microsoft Internet Explorer, UserData is a\r
+ * way to store up to 128K of data per "document", or up to 1MB of data per domain, on the client\r
+ * computer.  The feature is available for IE 5+, which makes it available for every version of IE\r
+ * supported by TinyMCE.  The content is persistent across browser restarts and expires on the\r
+ * date/time specified, just like a cookie.  However, the data is not cleared when the user clears\r
+ * cookies on the browser, which makes it well-suited for rescuing autosaved content.  UserData,\r
+ * like other Microsoft IE browser technologies, is implemented as a behavior attached to a\r
+ * specific DOM object, so in this case we attach the behavior to the same DOM element that the\r
+ * TinyMCE editor instance is attached to.\r
+ */\r
+\r
+(function(tinymce) {\r
+       // Setup constants to help the compressor to reduce script size\r
+       var PLUGIN_NAME = 'autosave',\r
+               RESTORE_DRAFT = 'restoredraft',\r
+               TRUE = true,\r
+               undefined,\r
+               unloadHandlerAdded,\r
+               Dispatcher = tinymce.util.Dispatcher;\r
+\r
+       /**\r
+        * This plugin adds auto-save capability to the TinyMCE text editor to rescue content\r
+        * inadvertently lost. By using localStorage.\r
+        *\r
+        * @class tinymce.plugins.AutoSave\r
+        */\r
+       tinymce.create('tinymce.plugins.AutoSave', {\r
+               /**\r
+                * Initializes the plugin, this will be executed after the plugin has been created.\r
+                * This call is done before the editor instance has finished it's initialization so use the onInit event\r
+                * of the editor instance to intercept that event.\r
+                *\r
+                * @method init\r
+                * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
+                * @param {string} url Absolute URL to where the plugin is located.\r
+                */\r
+               init : function(ed, url) {\r
+                       var self = this, settings = ed.settings;\r
+\r
+                       self.editor = ed;\r
+\r
+                       // Parses the specified time string into a milisecond number 10m, 10s etc.\r
+                       function parseTime(time) {\r
+                               var multipels = {\r
+                                       s : 1000,\r
+                                       m : 60000\r
+                               };\r
+\r
+                               time = /^(\d+)([ms]?)$/.exec('' + time);\r
+\r
+                               return (time[2] ? multipels[time[2]] : 1) * parseInt(time);\r
+                       };\r
+\r
+                       // Default config\r
+                       tinymce.each({\r
+                               ask_before_unload : TRUE,\r
+                               interval : '30s',\r
+                               retention : '20m',\r
+                               minlength : 50\r
+                       }, function(value, key) {\r
+                               key = PLUGIN_NAME + '_' + key;\r
+\r
+                               if (settings[key] === undefined)\r
+                                       settings[key] = value;\r
+                       });\r
+\r
+                       // Parse times\r
+                       settings.autosave_interval = parseTime(settings.autosave_interval);\r
+                       settings.autosave_retention = parseTime(settings.autosave_retention);\r
+\r
+                       // Register restore button\r
+                       ed.addButton(RESTORE_DRAFT, {\r
+                               title : PLUGIN_NAME + ".restore_content",\r
+                               onclick : function() {\r
+                                       if (ed.getContent({draft: true}).replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi, "").length > 0) {\r
+                                               // Show confirm dialog if the editor isn't empty\r
+                                               ed.windowManager.confirm(\r
+                                                       PLUGIN_NAME + ".warning_message",\r
+                                                       function(ok) {\r
+                                                               if (ok)\r
+                                                                       self.restoreDraft();\r
+                                                       }\r
+                                               );\r
+                                       } else\r
+                                               self.restoreDraft();\r
+                               }\r
+                       });\r
+\r
+                       // Enable/disable restoredraft button depending on if there is a draft stored or not\r
+                       ed.onNodeChange.add(function() {\r
+                               var controlManager = ed.controlManager;\r
+\r
+                               if (controlManager.get(RESTORE_DRAFT))\r
+                                       controlManager.setDisabled(RESTORE_DRAFT, !self.hasDraft());\r
+                       });\r
+\r
+                       ed.onInit.add(function() {\r
+                               // Check if the user added the restore button, then setup auto storage logic\r
+                               if (ed.controlManager.get(RESTORE_DRAFT)) {\r
+                                       // Setup storage engine\r
+                                       self.setupStorage(ed);\r
+\r
+                                       // Auto save contents each interval time\r
+                                       setInterval(function() {\r
+                                               if (!ed.removed) {\r
+                                                       self.storeDraft();\r
+                                                       ed.nodeChanged();\r
+                                               }\r
+                                       }, settings.autosave_interval);\r
+                               }\r
+                       });\r
+\r
+                       /**\r
+                        * This event gets fired when a draft is stored to local storage.\r
+                        *\r
+                        * @event onStoreDraft\r
+                        * @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.\r
+                        * @param {Object} draft Draft object containing the HTML contents of the editor.\r
+                        */\r
+                       self.onStoreDraft = new Dispatcher(self);\r
+\r
+                       /**\r
+                        * This event gets fired when a draft is restored from local storage.\r
+                        *\r
+                        * @event onStoreDraft\r
+                        * @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.\r
+                        * @param {Object} draft Draft object containing the HTML contents of the editor.\r
+                        */\r
+                       self.onRestoreDraft = new Dispatcher(self);\r
+\r
+                       /**\r
+                        * This event gets fired when a draft removed/expired.\r
+                        *\r
+                        * @event onRemoveDraft\r
+                        * @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.\r
+                        * @param {Object} draft Draft object containing the HTML contents of the editor.\r
+                        */\r
+                       self.onRemoveDraft = new Dispatcher(self);\r
+\r
+                       // Add ask before unload dialog only add one unload handler\r
+                       if (!unloadHandlerAdded) {\r
+                               window.onbeforeunload = tinymce.plugins.AutoSave._beforeUnloadHandler;\r
+                               unloadHandlerAdded = TRUE;\r
+                       }\r
+               },\r
+\r
+               /**\r
+                * Returns information about the plugin as a name/value array.\r
+                * The current keys are longname, author, authorurl, infourl and version.\r
+                *\r
+                * @method getInfo\r
+                * @return {Object} Name/value array containing information about the plugin.\r
+                */\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Auto save',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               /**\r
+                * Returns an expiration date UTC string.\r
+                *\r
+                * @method getExpDate\r
+                * @return {String} Expiration date UTC string.\r
+                */\r
+               getExpDate : function() {\r
+                       return new Date(\r
+                               new Date().getTime() + this.editor.settings.autosave_retention\r
+                       ).toUTCString();\r
+               },\r
+\r
+               /**\r
+                * This method will setup the storage engine. If the browser has support for it.\r
+                *\r
+                * @method setupStorage\r
+                */\r
+               setupStorage : function(ed) {\r
+                       var self = this, testKey = PLUGIN_NAME + '_test', testVal = "OK";\r
+\r
+                       self.key = PLUGIN_NAME + ed.id;\r
+\r
+                       // Loop though each storage engine type until we find one that works\r
+                       tinymce.each([\r
+                               function() {\r
+                                       // Try HTML5 Local Storage\r
+                                       if (localStorage) {\r
+                                               localStorage.setItem(testKey, testVal);\r
+\r
+                                               if (localStorage.getItem(testKey) === testVal) {\r
+                                                       localStorage.removeItem(testKey);\r
+\r
+                                                       return localStorage;\r
+                                               }\r
+                                       }\r
+                               },\r
+\r
+                               function() {\r
+                                       // Try HTML5 Session Storage\r
+                                       if (sessionStorage) {\r
+                                               sessionStorage.setItem(testKey, testVal);\r
+\r
+                                               if (sessionStorage.getItem(testKey) === testVal) {\r
+                                                       sessionStorage.removeItem(testKey);\r
+\r
+                                                       return sessionStorage;\r
+                                               }\r
+                                       }\r
+                               },\r
+\r
+                               function() {\r
+                                       // Try IE userData\r
+                                       if (tinymce.isIE) {\r
+                                               ed.getElement().style.behavior = "url('#default#userData')";\r
+\r
+                                               // Fake localStorage on old IE\r
+                                               return {\r
+                                                       autoExpires : TRUE,\r
+\r
+                                                       setItem : function(key, value) {\r
+                                                               var userDataElement = ed.getElement();\r
+\r
+                                                               userDataElement.setAttribute(key, value);\r
+                                                               userDataElement.expires = self.getExpDate();\r
+\r
+                                                               try {\r
+                                                                       userDataElement.save("TinyMCE");\r
+                                                               } catch (e) {\r
+                                                                       // Ignore, saving might fail if "Userdata Persistence" is disabled in IE\r
+                                                               }\r
+                                                       },\r
+\r
+                                                       getItem : function(key) {\r
+                                                               var userDataElement = ed.getElement();\r
+\r
+                                                               try {\r
+                                                                       userDataElement.load("TinyMCE");\r
+                                                                       return userDataElement.getAttribute(key);\r
+                                                               } catch (e) {\r
+                                                                       // Ignore, loading might fail if "Userdata Persistence" is disabled in IE\r
+                                                                       return null;\r
+                                                               }\r
+                                                       },\r
+\r
+                                                       removeItem : function(key) {\r
+                                                               ed.getElement().removeAttribute(key);\r
+                                                       }\r
+                                               };\r
+                                       }\r
+                               },\r
+                       ], function(setup) {\r
+                               // Try executing each function to find a suitable storage engine\r
+                               try {\r
+                                       self.storage = setup();\r
+\r
+                                       if (self.storage)\r
+                                               return false;\r
+                               } catch (e) {\r
+                                       // Ignore\r
+                               }\r
+                       });\r
+               },\r
+\r
+               /**\r
+                * This method will store the current contents in the the storage engine.\r
+                *\r
+                * @method storeDraft\r
+                */\r
+               storeDraft : function() {\r
+                       var self = this, storage = self.storage, editor = self.editor, expires, content;\r
+\r
+                       // Is the contents dirty\r
+                       if (storage) {\r
+                               // If there is no existing key and the contents hasn't been changed since\r
+                               // it's original value then there is no point in saving a draft\r
+                               if (!storage.getItem(self.key) && !editor.isDirty())\r
+                                       return;\r
+\r
+                               // Store contents if the contents if longer than the minlength of characters\r
+                               content = editor.getContent({draft: true});\r
+                               if (content.length > editor.settings.autosave_minlength) {\r
+                                       expires = self.getExpDate();\r
+\r
+                                       // Store expiration date if needed IE userData has auto expire built in\r
+                                       if (!self.storage.autoExpires)\r
+                                               self.storage.setItem(self.key + "_expires", expires);\r
+\r
+                                       self.storage.setItem(self.key, content);\r
+                                       self.onStoreDraft.dispatch(self, {\r
+                                               expires : expires,\r
+                                               content : content\r
+                                       });\r
+                               }\r
+                       }\r
+               },\r
+\r
+               /**\r
+                * This method will restore the contents from the storage engine back to the editor.\r
+                *\r
+                * @method restoreDraft\r
+                */\r
+               restoreDraft : function() {\r
+                       var self = this, storage = self.storage, content;\r
+\r
+                       if (storage) {\r
+                               content = storage.getItem(self.key);\r
+\r
+                               if (content) {\r
+                                       self.editor.setContent(content);\r
+                                       self.onRestoreDraft.dispatch(self, {\r
+                                               content : content\r
+                                       });\r
+                               }\r
+                       }\r
+               },\r
+\r
+               /**\r
+                * This method will return true/false if there is a local storage draft available.\r
+                *\r
+                * @method hasDraft\r
+                * @return {boolean} true/false state if there is a local draft.\r
+                */\r
+               hasDraft : function() {\r
+                       var self = this, storage = self.storage, expDate, exists;\r
+\r
+                       if (storage) {\r
+                               // Does the item exist at all\r
+                               exists = !!storage.getItem(self.key);\r
+                               if (exists) {\r
+                                       // Storage needs autoexpire\r
+                                       if (!self.storage.autoExpires) {\r
+                                               expDate = new Date(storage.getItem(self.key + "_expires"));\r
+\r
+                                               // Contents hasn't expired\r
+                                               if (new Date().getTime() < expDate.getTime())\r
+                                                       return TRUE;\r
+\r
+                                               // Remove it if it has\r
+                                               self.removeDraft();\r
+                                       } else\r
+                                               return TRUE;\r
+                               }\r
+                       }\r
+\r
+                       return false;\r
+               },\r
+\r
+               /**\r
+                * Removes the currently stored draft.\r
+                *\r
+                * @method removeDraft\r
+                */\r
+               removeDraft : function() {\r
+                       var self = this, storage = self.storage, key = self.key, content;\r
+\r
+                       if (storage) {\r
+                               // Get current contents and remove the existing draft\r
+                               content = storage.getItem(key);\r
+                               storage.removeItem(key);\r
+                               storage.removeItem(key + "_expires");\r
+\r
+                               // Dispatch remove event if we had any contents\r
+                               if (content) {\r
+                                       self.onRemoveDraft.dispatch(self, {\r
+                                               content : content\r
+                                       });\r
+                               }\r
+                       }\r
+               },\r
+\r
+               "static" : {\r
+                       // Internal unload handler will be called before the page is unloaded\r
+                       _beforeUnloadHandler : function(e) {\r
+                               var msg;\r
+\r
+                               tinymce.each(tinyMCE.editors, function(ed) {\r
+                                       // Store a draft for each editor instance\r
+                                       if (ed.plugins.autosave)\r
+                                               ed.plugins.autosave.storeDraft();\r
+\r
+                                       // Never ask in fullscreen mode\r
+                                       if (ed.getParam("fullscreen_is_enabled"))\r
+                                               return;\r
+\r
+                                       // Setup a return message if the editor is dirty\r
+                                       if (!msg && ed.isDirty() && ed.getParam("autosave_ask_before_unload"))\r
+                                               msg = ed.getLang("autosave.unload_msg");\r
+                               });\r
+\r
+                               return msg;\r
+                       }\r
+               }\r
+       });\r
+\r
+       tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSave);\r
+})(tinymce);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/autosave/langs/en.js b/3.x/src/resources/javascript/TinyMCE/plugins/autosave/langs/en.js
new file mode 100644 (file)
index 0000000..fce6bd3
--- /dev/null
@@ -0,0 +1,4 @@
+tinyMCE.addI18n('en.autosave',{\r
+restore_content: "Restore auto-saved content",\r
+warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?"\r
+});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/bbcode/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/bbcode/editor_plugin.js
new file mode 100644 (file)
index 0000000..8f8821f
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/<font>(.*?)<\/font>/gi,"$1");b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<u>/gi,"[u]");b(/<blockquote[^>]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/<br \/>/gi,"\n");b(/<br\/>/gi,"\n");b(/<br>/gi,"\n");b(/<p>/gi,"");b(/<\/p>/gi,"\n");b(/&nbsp;|\u00a0/gi," ");b(/&quot;/gi,'"');b(/&lt;/gi,"<");b(/&gt;/gi,">");b(/&amp;/gi,"&");return a},_punbb_bbcode2html:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/\n/gi,"<br />");b(/\[b\]/gi,"<strong>");b(/\[\/b\]/gi,"</strong>");b(/\[i\]/gi,"<em>");b(/\[\/i\]/gi,"</em>");b(/\[u\]/gi,"<u>");b(/\[\/u\]/gi,"</u>");b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');b(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>');b(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;');b(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;');return a}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/bbcode/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/bbcode/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..4e7eb33
--- /dev/null
@@ -0,0 +1,120 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.BBCodePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();\r
+\r
+                       ed.onBeforeSetContent.add(function(ed, o) {\r
+                               o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
+                       });\r
+\r
+                       ed.onPostProcess.add(function(ed, o) {\r
+                               if (o.set)\r
+                                       o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
+\r
+                               if (o.get)\r
+                                       o.content = t['_' + dialect + '_html2bbcode'](o.content);\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'BBCode Plugin',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               // HTML -> BBCode in PunBB dialect\r
+               _punbb_html2bbcode : function(s) {\r
+                       s = tinymce.trim(s);\r
+\r
+                       function rep(re, str) {\r
+                               s = s.replace(re, str);\r
+                       };\r
+\r
+                       // example: <strong> to [b]\r
+                       rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");\r
+                       rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");\r
+                       rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");\r
+                       rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");\r
+                       rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");\r
+                       rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");\r
+                       rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");\r
+                       rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");\r
+                       rep(/<font>(.*?)<\/font>/gi,"$1");\r
+                       rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");\r
+                       rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");\r
+                       rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");\r
+                       rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");\r
+                       rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");\r
+                       rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");\r
+                       rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");\r
+                       rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");\r
+                       rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");\r
+                       rep(/<\/(strong|b)>/gi,"[/b]");\r
+                       rep(/<(strong|b)>/gi,"[b]");\r
+                       rep(/<\/(em|i)>/gi,"[/i]");\r
+                       rep(/<(em|i)>/gi,"[i]");\r
+                       rep(/<\/u>/gi,"[/u]");\r
+                       rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");\r
+                       rep(/<u>/gi,"[u]");\r
+                       rep(/<blockquote[^>]*>/gi,"[quote]");\r
+                       rep(/<\/blockquote>/gi,"[/quote]");\r
+                       rep(/<br \/>/gi,"\n");\r
+                       rep(/<br\/>/gi,"\n");\r
+                       rep(/<br>/gi,"\n");\r
+                       rep(/<p>/gi,"");\r
+                       rep(/<\/p>/gi,"\n");\r
+                       rep(/&nbsp;|\u00a0/gi," ");\r
+                       rep(/&quot;/gi,"\"");\r
+                       rep(/&lt;/gi,"<");\r
+                       rep(/&gt;/gi,">");\r
+                       rep(/&amp;/gi,"&");\r
+\r
+                       return s; \r
+               },\r
+\r
+               // BBCode -> HTML from PunBB dialect\r
+               _punbb_bbcode2html : function(s) {\r
+                       s = tinymce.trim(s);\r
+\r
+                       function rep(re, str) {\r
+                               s = s.replace(re, str);\r
+                       };\r
+\r
+                       // example: [b] to <strong>\r
+                       rep(/\n/gi,"<br />");\r
+                       rep(/\[b\]/gi,"<strong>");\r
+                       rep(/\[\/b\]/gi,"</strong>");\r
+                       rep(/\[i\]/gi,"<em>");\r
+                       rep(/\[\/i\]/gi,"</em>");\r
+                       rep(/\[u\]/gi,"<u>");\r
+                       rep(/\[\/u\]/gi,"</u>");\r
+                       rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");\r
+                       rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
+                       rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");\r
+                       rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");\r
+                       rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;");\r
+                       rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;");\r
+\r
+                       return s; \r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/contextmenu/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/contextmenu/editor_plugin.js
new file mode 100644 (file)
index 0000000..2ed042c
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(f){var i=this,g,d,j,e;i.editor=f;d=f.settings.contextmenu_never_use_native;i.onContextMenu=new tinymce.util.Dispatcher(this);e=function(k){h(f,k)};g=f.onContextMenu.add(function(k,l){if((j!==0?j:l.ctrlKey)&&!d){return}a.cancel(l);if(l.target.nodeName=="IMG"){k.selection.select(l.target)}i._getMenu(k).showMenu(l.clientX||l.pageX,l.clientY||l.pageY);a.add(k.getDoc(),"click",e);k.nodeChanged()});f.onRemove.add(function(){if(i._menu){i._menu.removeAll()}});function h(k,l){j=0;if(l&&l.button==2){j=l.ctrlKey;return}if(i._menu){i._menu.removeAll();i._menu.destroy();a.remove(k.getDoc(),"click",e);i._menu=null}}f.onMouseDown.add(h);f.onKeyDown.add(h);f.onKeyDown.add(function(k,l){if(l.shiftKey&&!l.ctrlKey&&!l.altKey&&l.keyCode===121){a.cancel(l);g(k,l)}})},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(e){var g=this,d=g._menu,j=e.selection,f=j.isCollapsed(),h=j.getNode()||e.getBody(),i,k;if(d){d.removeAll();d.destroy()}k=b.getPos(e.getContentAreaContainer());d=e.controlManager.createDropMenu("contextmenu",{offset_x:k.x+e.getParam("contextmenu_offset_x",0),offset_y:k.y+e.getParam("contextmenu_offset_y",0),constrain:1,keyboard_focus:true});g._menu=d;d.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(f);d.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(f);d.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((h.nodeName=="A"&&!e.dom.getAttrib(h,"name"))||!f){d.addSeparator();d.add({title:"advanced.link_desc",icon:"link",cmd:e.plugins.advlink?"mceAdvLink":"mceLink",ui:true});d.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}d.addSeparator();d.add({title:"advanced.image_desc",icon:"image",cmd:e.plugins.advimage?"mceAdvImage":"mceImage",ui:true});d.addSeparator();i=d.addMenu({title:"contextmenu.align"});i.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});i.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});i.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});i.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});g.onContextMenu.dispatch(g,d,h,f);return d}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/contextmenu/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/contextmenu/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..48b0fff
--- /dev/null
@@ -0,0 +1,163 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;\r
+\r
+       /**\r
+        * This plugin a context menu to TinyMCE editor instances.\r
+        *\r
+        * @class tinymce.plugins.ContextMenu\r
+        */\r
+       tinymce.create('tinymce.plugins.ContextMenu', {\r
+               /**\r
+                * Initializes the plugin, this will be executed after the plugin has been created.\r
+                * This call is done before the editor instance has finished it's initialization so use the onInit event\r
+                * of the editor instance to intercept that event.\r
+                *\r
+                * @method init\r
+                * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
+                * @param {string} url Absolute URL to where the plugin is located.\r
+                */\r
+               init : function(ed) {\r
+                       var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey, hideMenu;\r
+\r
+                       t.editor = ed;\r
+\r
+                       contextmenuNeverUseNative = ed.settings.contextmenu_never_use_native;\r
+\r
+                       /**\r
+                        * This event gets fired when the context menu is shown.\r
+                        *\r
+                        * @event onContextMenu\r
+                        * @param {tinymce.plugins.ContextMenu} sender Plugin instance sending the event.\r
+                        * @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.\r
+                        */\r
+                       t.onContextMenu = new tinymce.util.Dispatcher(this);\r
+\r
+                       hideMenu = function(e) {\r
+                               hide(ed, e);\r
+                       };\r
+\r
+                       showMenu = ed.onContextMenu.add(function(ed, e) {\r
+                               // Block TinyMCE menu on ctrlKey and work around Safari issue\r
+                               if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative)\r
+                                       return;\r
+\r
+                               Event.cancel(e);\r
+\r
+                               // Select the image if it's clicked. WebKit would other wise expand the selection\r
+                               if (e.target.nodeName == 'IMG')\r
+                                       ed.selection.select(e.target);\r
+\r
+                               t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageY);\r
+                               Event.add(ed.getDoc(), 'click', hideMenu);\r
+\r
+                               ed.nodeChanged();\r
+                       });\r
+                       \r
+                       ed.onRemove.add(function() {\r
+                               if (t._menu)\r
+                                       t._menu.removeAll();\r
+                       });\r
+\r
+                       function hide(ed, e) {\r
+                               realCtrlKey = 0;\r
+\r
+                               // Since the contextmenu event moves\r
+                               // the selection we need to store it away\r
+                               if (e && e.button == 2) {\r
+                                       realCtrlKey = e.ctrlKey;\r
+                                       return;\r
+                               }\r
+\r
+                               if (t._menu) {\r
+                                       t._menu.removeAll();\r
+                                        t._menu.destroy();\r
+                                       Event.remove(ed.getDoc(), 'click', hideMenu);\r
+                                       t._menu = null;\r
+                               }\r
+                       };\r
+\r
+                       ed.onMouseDown.add(hide);\r
+                       ed.onKeyDown.add(hide);\r
+                       ed.onKeyDown.add(function(ed, e) {\r
+                               if (e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode === 121) {\r
+                                       Event.cancel(e);\r
+                                       showMenu(ed, e);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               /**\r
+                * Returns information about the plugin as a name/value array.\r
+                * The current keys are longname, author, authorurl, infourl and version.\r
+                *\r
+                * @method getInfo\r
+                * @return {Object} Name/value array containing information about the plugin.\r
+                */\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Contextmenu',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               _getMenu : function(ed) {\r
+                       var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p;\r
+\r
+                       if (m) {\r
+                               m.removeAll();\r
+                               m.destroy();\r
+                       }\r
+\r
+                       p = DOM.getPos(ed.getContentAreaContainer());\r
+\r
+                       m = ed.controlManager.createDropMenu('contextmenu', {\r
+                               offset_x : p.x + ed.getParam('contextmenu_offset_x', 0),\r
+                               offset_y : p.y + ed.getParam('contextmenu_offset_y', 0),\r
+                               constrain : 1,\r
+                               keyboard_focus: true\r
+                       });\r
+\r
+                       t._menu = m;\r
+\r
+                       m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col);\r
+                       m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col);\r
+                       m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'});\r
+\r
+                       if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) {\r
+                               m.addSeparator();\r
+                               m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});\r
+                               m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});\r
+                       }\r
+\r
+                       m.addSeparator();\r
+                       m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});\r
+\r
+                       m.addSeparator();\r
+                       am = m.addMenu({title : 'contextmenu.align'});\r
+                       am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'});\r
+                       am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'});\r
+                       am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'});\r
+                       am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'});\r
+\r
+                       t.onContextMenu.dispatch(t, m, el, col);\r
+\r
+                       return m;\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/directionality/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/directionality/editor_plugin.js
new file mode 100644 (file)
index 0000000..90847e7
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(b,c){var d=this;d.editor=b;function a(e){var h=b.dom,g,f=b.selection.getSelectedBlocks();if(f.length){g=h.getAttrib(f[0],"dir");tinymce.each(f,function(i){if(!h.getParent(i.parentNode,"*[dir='"+e+"']",h.getRoot())){if(g!=e){h.setAttrib(i,"dir",e)}else{h.setAttrib(i,"dir",null)}}});b.nodeChanged()}}b.addCommand("mceDirectionLTR",function(){a("ltr")});b.addCommand("mceDirectionRTL",function(){a("rtl")});b.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});b.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});b.onNodeChange.add(d._nodeChange,d)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/directionality/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/directionality/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..b134014
--- /dev/null
@@ -0,0 +1,85 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.Directionality', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       function setDir(dir) {\r
+                               var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();\r
+\r
+                               if (blocks.length) {\r
+                                       curDir = dom.getAttrib(blocks[0], "dir");\r
+\r
+                                       tinymce.each(blocks, function(block) {\r
+                                               // Add dir to block if the parent block doesn't already have that dir\r
+                                               if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {\r
+                                                       if (curDir != dir) {\r
+                                                               dom.setAttrib(block, "dir", dir);\r
+                                                       } else {\r
+                                                               dom.setAttrib(block, "dir", null);\r
+                                                       }\r
+                                               }\r
+                                       });\r
+\r
+                                       ed.nodeChanged();\r
+                               }\r
+                       }\r
+\r
+                       ed.addCommand('mceDirectionLTR', function() {\r
+                               setDir("ltr");\r
+                       });\r
+\r
+                       ed.addCommand('mceDirectionRTL', function() {\r
+                               setDir("rtl");\r
+                       });\r
+\r
+                       ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});\r
+                       ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});\r
+\r
+                       ed.onNodeChange.add(t._nodeChange, t);\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Directionality',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _nodeChange : function(ed, cm, n) {\r
+                       var dom = ed.dom, dir;\r
+\r
+                       n = dom.getParent(n, dom.isBlock);\r
+                       if (!n) {\r
+                               cm.setDisabled('ltr', 1);\r
+                               cm.setDisabled('rtl', 1);\r
+                               return;\r
+                       }\r
+\r
+                       dir = dom.getAttrib(n, 'dir');\r
+                       cm.setActive('ltr', dir == "ltr");\r
+                       cm.setDisabled('ltr', 0);\r
+                       cm.setActive('rtl', dir == "rtl");\r
+                       cm.setDisabled('rtl', 0);\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/editor_plugin.js
new file mode 100644 (file)
index 0000000..dbdd8ff
--- /dev/null
@@ -0,0 +1 @@
+(function(a){a.create("tinymce.plugins.EmotionsPlugin",{init:function(b,c){b.addCommand("mceEmotion",function(){b.windowManager.open({file:c+"/emotions.htm",width:250+parseInt(b.getLang("emotions.delta_width",0)),height:160+parseInt(b.getLang("emotions.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("emotions",{title:"emotions.emotions_desc",cmd:"mceEmotion"})},getInfo:function(){return{longname:"Emotions",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("emotions",a.plugins.EmotionsPlugin)})(tinymce);
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..71d5416
--- /dev/null
@@ -0,0 +1,43 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function(tinymce) {\r
+       tinymce.create('tinymce.plugins.EmotionsPlugin', {\r
+               init : function(ed, url) {\r
+                       // Register commands\r
+                       ed.addCommand('mceEmotion', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/emotions.htm',\r
+                                       width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)),\r
+                                       height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'});\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Emotions',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);\r
+})(tinymce);
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/emotions.htm b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/emotions.htm
new file mode 100644 (file)
index 0000000..1013556
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#emotions_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/emotions.js"></script>\r
+</head>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#emotions_dlg.title}</span>\r
+<div align="center">\r
+       <div class="title">{#emotions_dlg.title}:<br /><br /></div>\r
+\r
+       <table id="emoticon_table" role="presentation" border="0" cellspacing="0" cellpadding="4">\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.cool}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.cry}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}"  /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.frown}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.innocent}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}. {#emotions_dlg.usage}"  /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}"/></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.smile}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.tongue_out}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.wink}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.yell}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+       </table>\r
+       <div>{#emotions_dlg.usage}</div>\r
+</div>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cool.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cool.gif
new file mode 100644 (file)
index 0000000..ba90cc3
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cool.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cry.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cry.gif
new file mode 100644 (file)
index 0000000..74d897a
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-cry.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-embarassed.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-embarassed.gif
new file mode 100644 (file)
index 0000000..963a96b
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-embarassed.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-foot-in-mouth.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-foot-in-mouth.gif
new file mode 100644 (file)
index 0000000..c7cf101
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-foot-in-mouth.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-frown.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-frown.gif
new file mode 100644 (file)
index 0000000..716f55e
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-frown.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-innocent.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-innocent.gif
new file mode 100644 (file)
index 0000000..334d49e
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-innocent.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-kiss.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-kiss.gif
new file mode 100644 (file)
index 0000000..4efd549
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-kiss.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-laughing.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-laughing.gif
new file mode 100644 (file)
index 0000000..82c5b18
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-laughing.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-money-mouth.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-money-mouth.gif
new file mode 100644 (file)
index 0000000..ca2451e
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-money-mouth.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-sealed.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-sealed.gif
new file mode 100644 (file)
index 0000000..fe66220
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-sealed.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-smile.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-smile.gif
new file mode 100644 (file)
index 0000000..fd27edf
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-smile.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-surprised.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-surprised.gif
new file mode 100644 (file)
index 0000000..0cc9bb7
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-surprised.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-tongue-out.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-tongue-out.gif
new file mode 100644 (file)
index 0000000..2075dc1
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-tongue-out.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-undecided.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-undecided.gif
new file mode 100644 (file)
index 0000000..bef7e25
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-undecided.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-wink.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-wink.gif
new file mode 100644 (file)
index 0000000..0631c76
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-wink.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-yell.gif b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-yell.gif
new file mode 100644 (file)
index 0000000..648e6e8
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/img/smiley-yell.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/js/emotions.js b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/js/emotions.js
new file mode 100644 (file)
index 0000000..b360f20
--- /dev/null
@@ -0,0 +1,43 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var EmotionsDialog = {\r
+       addKeyboardNavigation: function(){\r
+               var tableElm, cells, settings;\r
+                       \r
+               cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table");\r
+                       \r
+               settings ={\r
+                       root: "emoticon_table",\r
+                       items: cells\r
+               };\r
+               cells[0].tabindex=0;\r
+               tinyMCEPopup.dom.addClass(cells[0], "mceFocus");\r
+               if (tinymce.isGecko) {\r
+                       cells[0].focus();               \r
+               } else {\r
+                       setTimeout(function(){\r
+                               cells[0].focus();\r
+                       }, 100);\r
+               }\r
+               tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);\r
+       }, \r
+       init : function(ed) {\r
+               tinyMCEPopup.resizeToInnerSize();\r
+               this.addKeyboardNavigation();\r
+       },\r
+\r
+       insert : function(file, title) {\r
+               var ed = tinyMCEPopup.editor, dom = ed.dom;\r
+\r
+               tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', {\r
+                       src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file,\r
+                       alt : ed.getLang(title),\r
+                       title : ed.getLang(title),\r
+                       border : 0\r
+               }));\r
+\r
+               tinyMCEPopup.close();\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/emotions/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/emotions/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..037c4b5
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert Emotion",usage:"Use left and right arrows to navigate.",yell:"Yell",wink:"Wink",undecided:"Undecided","tongue_out":"Tongue Out",surprised:"Surprised",smile:"Smile",sealed:"Sealed","money_mouth":"Money Mouth",laughing:"Laughing",kiss:"Kiss",innocent:"Innocent",frown:"Frown","foot_in_mouth":"Foot in Mouth",embarassed:"Embarassed"});
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/dialog.htm b/3.x/src/resources/javascript/TinyMCE/plugins/example/dialog.htm
new file mode 100644 (file)
index 0000000..50b2b34
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#example_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/dialog.js"></script>\r
+</head>\r
+<body>\r
+\r
+<form onsubmit="ExampleDialog.insert();return false;" action="#">\r
+       <p>Here is a example dialog.</p>\r
+       <p>Selected text: <input id="someval" name="someval" type="text" class="text" /></p>\r
+       <p>Custom arg: <input id="somearg" name="somearg" type="text" class="text" /></p>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="button" id="insert" name="insert" value="{#insert}" onclick="ExampleDialog.insert();" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/example/editor_plugin.js
new file mode 100644 (file)
index 0000000..ec1f81e
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.PluginManager.requireLangPack("example");tinymce.create("tinymce.plugins.ExamplePlugin",{init:function(a,b){a.addCommand("mceExample",function(){a.windowManager.open({file:b+"/dialog.htm",width:320+parseInt(a.getLang("example.delta_width",0)),height:120+parseInt(a.getLang("example.delta_height",0)),inline:1},{plugin_url:b,some_custom_arg:"custom arg"})});a.addButton("example",{title:"example.desc",cmd:"mceExample",image:b+"/img/example.gif"});a.onNodeChange.add(function(d,c,e){c.setActive("example",e.nodeName=="IMG")})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Example plugin",author:"Some author",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example",version:"1.0"}}});tinymce.PluginManager.add("example",tinymce.plugins.ExamplePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/example/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..9a0e7da
--- /dev/null
@@ -0,0 +1,84 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       // Load plugin specific language pack\r
+       tinymce.PluginManager.requireLangPack('example');\r
+\r
+       tinymce.create('tinymce.plugins.ExamplePlugin', {\r
+               /**\r
+                * Initializes the plugin, this will be executed after the plugin has been created.\r
+                * This call is done before the editor instance has finished it's initialization so use the onInit event\r
+                * of the editor instance to intercept that event.\r
+                *\r
+                * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
+                * @param {string} url Absolute URL to where the plugin is located.\r
+                */\r
+               init : function(ed, url) {\r
+                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');\r
+                       ed.addCommand('mceExample', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/dialog.htm',\r
+                                       width : 320 + parseInt(ed.getLang('example.delta_width', 0)),\r
+                                       height : 120 + parseInt(ed.getLang('example.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url, // Plugin absolute URL\r
+                                       some_custom_arg : 'custom arg' // Custom argument\r
+                               });\r
+                       });\r
+\r
+                       // Register example button\r
+                       ed.addButton('example', {\r
+                               title : 'example.desc',\r
+                               cmd : 'mceExample',\r
+                               image : url + '/img/example.gif'\r
+                       });\r
+\r
+                       // Add a node change handler, selects the button in the UI when a image is selected\r
+                       ed.onNodeChange.add(function(ed, cm, n) {\r
+                               cm.setActive('example', n.nodeName == 'IMG');\r
+                       });\r
+               },\r
+\r
+               /**\r
+                * Creates control instances based in the incomming name. This method is normally not\r
+                * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons\r
+                * but you sometimes need to create more complex controls like listboxes, split buttons etc then this\r
+                * method can be used to create those.\r
+                *\r
+                * @param {String} n Name of the control to create.\r
+                * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.\r
+                * @return {tinymce.ui.Control} New control instance or null if no control was created.\r
+                */\r
+               createControl : function(n, cm) {\r
+                       return null;\r
+               },\r
+\r
+               /**\r
+                * Returns information about the plugin as a name/value array.\r
+                * The current keys are longname, author, authorurl, infourl and version.\r
+                *\r
+                * @return {Object} Name/value array containing information about the plugin.\r
+                */\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Example plugin',\r
+                               author : 'Some author',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',\r
+                               version : "1.0"\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/img/example.gif b/3.x/src/resources/javascript/TinyMCE/plugins/example/img/example.gif
new file mode 100644 (file)
index 0000000..1ab5da4
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/example/img/example.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/js/dialog.js b/3.x/src/resources/javascript/TinyMCE/plugins/example/js/dialog.js
new file mode 100644 (file)
index 0000000..fa83411
--- /dev/null
@@ -0,0 +1,19 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var ExampleDialog = {\r
+       init : function() {\r
+               var f = document.forms[0];\r
+\r
+               // Get the selected contents as text and place it in the input\r
+               f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});\r
+               f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg');\r
+       },\r
+\r
+       insert : function() {\r
+               // Insert the contents from the input into the document\r
+               tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value);\r
+               tinyMCEPopup.close();\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/langs/en.js b/3.x/src/resources/javascript/TinyMCE/plugins/example/langs/en.js
new file mode 100644 (file)
index 0000000..e0784f8
--- /dev/null
@@ -0,0 +1,3 @@
+tinyMCE.addI18n('en.example',{\r
+       desc : 'This is just a template button'\r
+});\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/example/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..ebcf948
--- /dev/null
@@ -0,0 +1,3 @@
+tinyMCE.addI18n('en.example_dlg',{\r
+       title : 'This is just a example title'\r
+});\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example_dependency/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/example_dependency/editor_plugin.js
new file mode 100644 (file)
index 0000000..0a4551d
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.ExampleDependencyPlugin",{init:function(a,b){},getInfo:function(){return{longname:"Example Dependency plugin",author:"Some author",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example_dependency",version:"1.0"}}});tinymce.PluginManager.add("example_dependency",tinymce.plugins.ExampleDependencyPlugin,["example"])})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/example_dependency/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/example_dependency/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..e1c55e4
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+
+       tinymce.create('tinymce.plugins.ExampleDependencyPlugin', {
+               /**
+                * Initializes the plugin, this will be executed after the plugin has been created.
+                * This call is done before the editor instance has finished it's initialization so use the onInit event
+                * of the editor instance to intercept that event.
+                *
+                * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+                * @param {string} url Absolute URL to where the plugin is located.
+                */
+               init : function(ed, url) {
+               },
+
+
+               /**
+                * Returns information about the plugin as a name/value array.
+                * The current keys are longname, author, authorurl, infourl and version.
+                *
+                * @return {Object} Name/value array containing information about the plugin.
+                */
+               getInfo : function() {
+                       return {
+                               longname : 'Example Dependency plugin',
+                               author : 'Some author',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example_dependency',
+                               version : "1.0"
+                       };
+               }
+       });
+
+       /**
+        * Register the plugin, specifying the list of the plugins that this plugin depends on.  They are specified in a list, with the list loaded in order.
+        * plugins in this list will be initialised when this plugin is initialized. (before the init method is called).
+        * plugins in a depends list should typically be specified using the short name).  If neccesary this can be done
+        * with an object which has the url to the plugin and the shortname.
+        */
+       tinymce.PluginManager.add('example_dependency', tinymce.plugins.ExampleDependencyPlugin, ['example']);
+})();
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/css/fullpage.css b/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/css/fullpage.css
new file mode 100644 (file)
index 0000000..2675cec
--- /dev/null
@@ -0,0 +1,143 @@
+/* Hide the advanced tab */\r
+#advanced_tab {\r
+       display: none;\r
+}\r
+\r
+#metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright {\r
+       width: 280px;\r
+}\r
+\r
+#doctype, #docencoding {\r
+       width: 200px;\r
+}\r
+\r
+#langcode {\r
+       width: 30px;\r
+}\r
+\r
+#bgimage {\r
+       width: 220px;   \r
+}\r
+\r
+#fontface {\r
+       width: 240px;\r
+}\r
+\r
+#leftmargin, #rightmargin, #topmargin, #bottommargin {\r
+       width: 50px;\r
+}\r
+\r
+.panel_wrapper div.current {\r
+       height: 400px;\r
+}\r
+\r
+#stylesheet, #style {\r
+       width: 240px;\r
+}\r
+\r
+#doctypes {\r
+       width: 200px;\r
+}\r
+\r
+/* Head list classes */\r
+\r
+.headlistwrapper {\r
+       width: 100%;\r
+}\r
+\r
+.selected {\r
+       border: 1px solid #0A246A;\r
+       background-color: #B6BDD2;\r
+}\r
+\r
+.toolbar {\r
+       width: 100%;\r
+}\r
+\r
+#headlist {\r
+       width: 100%;\r
+       margin-top: 3px;\r
+       font-size: 11px;\r
+}\r
+\r
+#info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element {\r
+       display: none;\r
+}\r
+\r
+#addmenu {\r
+       position: absolute;\r
+       border: 1px solid gray;\r
+       display: none;\r
+       z-index: 100;\r
+       background-color: white;\r
+}\r
+\r
+#addmenu a {\r
+       display: block;\r
+       width: 100%;\r
+       line-height: 20px;\r
+       text-decoration: none;\r
+       background-color: white;\r
+}\r
+\r
+#addmenu a:hover {\r
+       background-color: #B6BDD2;\r
+       color: black;\r
+}\r
+\r
+#addmenu span {\r
+       padding-left: 10px;\r
+       padding-right: 10px;\r
+}\r
+\r
+#updateElementPanel {\r
+       display: none;\r
+}\r
+\r
+#script_element .panel_wrapper div.current {\r
+       height: 108px;\r
+}\r
+\r
+#style_element .panel_wrapper div.current {\r
+       height: 108px;\r
+}\r
+\r
+#link_element  .panel_wrapper div.current {\r
+       height: 140px;\r
+}\r
+\r
+#element_script_value {\r
+       width: 100%;\r
+       height: 100px;\r
+}\r
+\r
+#element_comment_value {\r
+       width: 100%;\r
+       height: 120px;\r
+}\r
+\r
+#element_style_value {\r
+       width: 100%;\r
+       height: 100px;\r
+}\r
+\r
+#element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title {\r
+       width: 250px;\r
+}\r
+\r
+.updateElementButton {\r
+       margin-top: 3px;\r
+}\r
+\r
+/* MSIE specific styles */\r
+\r
+* html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton {\r
+       width: 22px;\r
+       height: 22px;\r
+}\r
+\r
+textarea {\r
+       height: 55px;\r
+}\r
+\r
+.panel_wrapper div.current {height:420px;}
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/editor_plugin.js
new file mode 100644 (file)
index 0000000..dcf7602
--- /dev/null
@@ -0,0 +1 @@
+(function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype="<!DOCTYPE"+i.value+">"}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n<l.length;n++){p=l[n];if(p.attr("name")==m){if(o){p.attr("content",o)}else{p.remove()}return}}if(o){j=new a("meta",1);j.attr("name",m);j.attr("content",o);j.shortEnded=true;i(j)}});j=f.getAll("link")[0];if(j&&j.attr("rel")=="stylesheet"){if(g.stylesheet){j.attr("href",g.stylesheet)}else{j.remove()}}else{if(g.stylesheet){j=new a("link",1);j.attr({rel:"stylesheet",text:"text/css",href:g.stylesheet});j.shortEnded=true;i(j)}}j=f.getAll("body")[0];if(j){c(j,"dir",g.langdir);c(j,"style",g.style);c(j,"vlink",g.visited_color);c(j,"link",g.link_color);c(j,"alink",g.active_color);e.setAttribs(this.editor.getBody(),{style:g.style,dir:g.dir,vLink:g.visited_color,link:g.link_color,aLink:g.active_color})}j=f.getAll("html")[0];if(j){c(j,"lang",g.langcode);c(j,"xml:lang",g.langcode)}h=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(f);this.head=h.substring(0,h.indexOf("</body>"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("<body");if(i!=-1){i=h.indexOf(">",i);m.head=k(h.substring(0,i+1));c=h.indexOf("</body",i);if(c==-1){c=h.length}d.content=h.substring(i+1,c);m.foot=k(h.substring(c))}else{m.head=this._getDefaultHeader();m.foot="\n</body>\n</html>"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}e.remove("fullpage_styles");if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l);j=e.get("fullpage_styles");if(j.styleSheet){j.styleSheet.cssText=l}}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='<?xml version="1.0" encoding="'+c.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}f+=c.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');f+="\n<html>\n<head>\n";if(e=c.getParam("fullpage_default_title")){f+="<title>"+e+"</title>\n"}if(e=c.getParam("fullpage_default_encoding")){f+='<meta http-equiv="Content-Type" content="text/html; charset='+e+'" />\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="</head>\n<body"+(d?' style="'+d+'"':"")+">\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..23de7c5
--- /dev/null
@@ -0,0 +1,405 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var each = tinymce.each, Node = tinymce.html.Node;\r
+\r
+       tinymce.create('tinymce.plugins.FullPagePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceFullPageProperties', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/fullpage.htm',\r
+                                       width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)),\r
+                                       height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url,\r
+                                       data : t._htmlToData()\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});\r
+\r
+                       ed.onBeforeSetContent.add(t._setContent, t);\r
+                       ed.onGetContent.add(t._getContent, t);\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Fullpage',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private plugin internal methods\r
+\r
+               _htmlToData : function() {\r
+                       var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor;\r
+\r
+                       function getAttr(elm, name) {\r
+                               var value = elm.attr(name);\r
+\r
+                               return value || '';\r
+                       };\r
+\r
+                       // Default some values\r
+                       data.fontface = editor.getParam("fullpage_default_fontface", "");\r
+                       data.fontsize = editor.getParam("fullpage_default_fontsize", "");\r
+\r
+                       // Parse XML PI\r
+                       elm = headerFragment.firstChild;\r
+                       if (elm.type == 7) {\r
+                               data.xml_pi = true;\r
+                               matches = /encoding="([^"]+)"/.exec(elm.value);\r
+                               if (matches)\r
+                                       data.docencoding = matches[1];\r
+                       }\r
+\r
+                       // Parse doctype\r
+                       elm = headerFragment.getAll('#doctype')[0];\r
+                       if (elm)\r
+                               data.doctype = '<!DOCTYPE' + elm.value + ">"; \r
+\r
+                       // Parse title element\r
+                       elm = headerFragment.getAll('title')[0];\r
+                       if (elm && elm.firstChild) {\r
+                               data.metatitle = elm.firstChild.value;\r
+                       }\r
+\r
+                       // Parse meta elements\r
+                       each(headerFragment.getAll('meta'), function(meta) {\r
+                               var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;\r
+\r
+                               if (name)\r
+                                       data['meta' + name.toLowerCase()] = meta.attr('content');\r
+                               else if (httpEquiv == "Content-Type") {\r
+                                       matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));\r
+\r
+                                       if (matches)\r
+                                               data.docencoding = matches[1];\r
+                               }\r
+                       });\r
+\r
+                       // Parse html attribs\r
+                       elm = headerFragment.getAll('html')[0];\r
+                       if (elm)\r
+                               data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');\r
+       \r
+                       // Parse stylesheet\r
+                       elm = headerFragment.getAll('link')[0];\r
+                       if (elm && elm.attr('rel') == 'stylesheet')\r
+                               data.stylesheet = elm.attr('href');\r
+\r
+                       // Parse body parts\r
+                       elm = headerFragment.getAll('body')[0];\r
+                       if (elm) {\r
+                               data.langdir = getAttr(elm, 'dir');\r
+                               data.style = getAttr(elm, 'style');\r
+                               data.visited_color = getAttr(elm, 'vlink');\r
+                               data.link_color = getAttr(elm, 'link');\r
+                               data.active_color = getAttr(elm, 'alink');\r
+                       }\r
+\r
+                       return data;\r
+               },\r
+\r
+               _dataToHtml : function(data) {\r
+                       var headerFragment, headElement, html, elm, value, dom = this.editor.dom;\r
+\r
+                       function setAttr(elm, name, value) {\r
+                               elm.attr(name, value ? value : undefined);\r
+                       };\r
+\r
+                       function addHeadNode(node) {\r
+                               if (headElement.firstChild)\r
+                                       headElement.insert(node, headElement.firstChild);\r
+                               else\r
+                                       headElement.append(node);\r
+                       };\r
+\r
+                       headerFragment = this._parseHeader();\r
+                       headElement = headerFragment.getAll('head')[0];\r
+                       if (!headElement) {\r
+                               elm = headerFragment.getAll('html')[0];\r
+                               headElement = new Node('head', 1);\r
+\r
+                               if (elm.firstChild)\r
+                                       elm.insert(headElement, elm.firstChild, true);\r
+                               else\r
+                                       elm.append(headElement);\r
+                       }\r
+\r
+                       // Add/update/remove XML-PI\r
+                       elm = headerFragment.firstChild;\r
+                       if (data.xml_pi) {\r
+                               value = 'version="1.0"';\r
+\r
+                               if (data.docencoding)\r
+                                       value += ' encoding="' + data.docencoding + '"';\r
+\r
+                               if (elm.type != 7) {\r
+                                       elm = new Node('xml', 7);\r
+                                       headerFragment.insert(elm, headerFragment.firstChild, true);\r
+                               }\r
+\r
+                               elm.value = value;\r
+                       } else if (elm && elm.type == 7)\r
+                               elm.remove();\r
+\r
+                       // Add/update/remove doctype\r
+                       elm = headerFragment.getAll('#doctype')[0];\r
+                       if (data.doctype) {\r
+                               if (!elm) {\r
+                                       elm = new Node('#doctype', 10);\r
+\r
+                                       if (data.xml_pi)\r
+                                               headerFragment.insert(elm, headerFragment.firstChild);\r
+                                       else\r
+                                               addHeadNode(elm);\r
+                               }\r
+\r
+                               elm.value = data.doctype.substring(9, data.doctype.length - 1);\r
+                       } else if (elm)\r
+                               elm.remove();\r
+\r
+                       // Add/update/remove title\r
+                       elm = headerFragment.getAll('title')[0];\r
+                       if (data.metatitle) {\r
+                               if (!elm) {\r
+                                       elm = new Node('title', 1);\r
+                                       elm.append(new Node('#text', 3)).value = data.metatitle;\r
+                                       addHeadNode(elm);\r
+                               }\r
+                       }\r
+\r
+                       // Add meta encoding\r
+                       if (data.docencoding) {\r
+                               elm = null;\r
+                               each(headerFragment.getAll('meta'), function(meta) {\r
+                                       if (meta.attr('http-equiv') == 'Content-Type')\r
+                                               elm = meta;\r
+                               });\r
+\r
+                               if (!elm) {\r
+                                       elm = new Node('meta', 1);\r
+                                       elm.attr('http-equiv', 'Content-Type');\r
+                                       elm.shortEnded = true;\r
+                                       addHeadNode(elm);\r
+                               }\r
+\r
+                               elm.attr('content', 'text/html; charset=' + data.docencoding);\r
+                       }\r
+\r
+                       // Add/update/remove meta\r
+                       each('keywords,description,author,copyright,robots'.split(','), function(name) {\r
+                               var nodes = headerFragment.getAll('meta'), i, meta, value = data['meta' + name];\r
+\r
+                               for (i = 0; i < nodes.length; i++) {\r
+                                       meta = nodes[i];\r
+\r
+                                       if (meta.attr('name') == name) {\r
+                                               if (value)\r
+                                                       meta.attr('content', value);\r
+                                               else\r
+                                                       meta.remove();\r
+\r
+                                               return;\r
+                                       }\r
+                               }\r
+\r
+                               if (value) {\r
+                                       elm = new Node('meta', 1);\r
+                                       elm.attr('name', name);\r
+                                       elm.attr('content', value);\r
+                                       elm.shortEnded = true;\r
+\r
+                                       addHeadNode(elm);\r
+                               }\r
+                       });\r
+\r
+                       // Add/update/delete link\r
+                       elm = headerFragment.getAll('link')[0];\r
+                       if (elm && elm.attr('rel') == 'stylesheet') {\r
+                               if (data.stylesheet)\r
+                                       elm.attr('href', data.stylesheet);\r
+                               else\r
+                                       elm.remove();\r
+                       } else if (data.stylesheet) {\r
+                               elm = new Node('link', 1);\r
+                               elm.attr({\r
+                                       rel : 'stylesheet',\r
+                                       text : 'text/css',\r
+                                       href : data.stylesheet\r
+                               });\r
+                               elm.shortEnded = true;\r
+\r
+                               addHeadNode(elm);\r
+                       }\r
+\r
+                       // Update body attributes\r
+                       elm = headerFragment.getAll('body')[0];\r
+                       if (elm) {\r
+                               setAttr(elm, 'dir', data.langdir);\r
+                               setAttr(elm, 'style', data.style);\r
+                               setAttr(elm, 'vlink', data.visited_color);\r
+                               setAttr(elm, 'link', data.link_color);\r
+                               setAttr(elm, 'alink', data.active_color);\r
+\r
+                               // Update iframe body as well\r
+                               dom.setAttribs(this.editor.getBody(), {\r
+                                       style : data.style,\r
+                                       dir : data.dir,\r
+                                       vLink : data.visited_color,\r
+                                       link : data.link_color,\r
+                                       aLink : data.active_color\r
+                               });\r
+                       }\r
+\r
+                       // Set html attributes\r
+                       elm = headerFragment.getAll('html')[0];\r
+                       if (elm) {\r
+                               setAttr(elm, 'lang', data.langcode);\r
+                               setAttr(elm, 'xml:lang', data.langcode);\r
+                       }\r
+\r
+                       // Serialize header fragment and crop away body part\r
+                       html = new tinymce.html.Serializer({\r
+                               validate: false,\r
+                               indent: true,\r
+                               apply_source_formatting : true,\r
+                               indent_before: 'head,html,body,meta,title,script,link,style',\r
+                               indent_after: 'head,html,body,meta,title,script,link,style'\r
+                       }).serialize(headerFragment);\r
+\r
+                       this.head = html.substring(0, html.indexOf('</body>'));\r
+               },\r
+\r
+               _parseHeader : function() {\r
+                       // Parse the contents with a DOM parser\r
+                       return new tinymce.html.DomParser({\r
+                               validate: false,\r
+                               root_name: '#document'\r
+                       }).parse(this.head);\r
+               },\r
+\r
+               _setContent : function(ed, o) {\r
+                       var self = this, startPos, endPos, content = o.content, headerFragment, styles = '', dom = self.editor.dom, elm;\r
+\r
+                       function low(s) {\r
+                               return s.replace(/<\/?[A-Z]+/g, function(a) {\r
+                                       return a.toLowerCase();\r
+                               })\r
+                       };\r
+\r
+                       // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate\r
+                       if (o.format == 'raw' && self.head)\r
+                               return;\r
+\r
+                       if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))\r
+                               return;\r
+\r
+                       // Parse out head, body and footer\r
+                       content = content.replace(/<(\/?)BODY/gi, '<$1body');\r
+                       startPos = content.indexOf('<body');\r
+\r
+                       if (startPos != -1) {\r
+                               startPos = content.indexOf('>', startPos);\r
+                               self.head = low(content.substring(0, startPos + 1));\r
+\r
+                               endPos = content.indexOf('</body', startPos);\r
+                               if (endPos == -1)\r
+                                       endPos = content.length;\r
+\r
+                               o.content = content.substring(startPos + 1, endPos);\r
+                               self.foot = low(content.substring(endPos));\r
+                       } else {\r
+                               self.head = this._getDefaultHeader();\r
+                               self.foot = '\n</body>\n</html>';\r
+                       }\r
+\r
+                       // Parse header and update iframe\r
+                       headerFragment = self._parseHeader();\r
+                       each(headerFragment.getAll('style'), function(node) {\r
+                               if (node.firstChild)\r
+                                       styles += node.firstChild.value;\r
+                       });\r
+\r
+                       elm = headerFragment.getAll('body')[0];\r
+                       if (elm) {\r
+                               dom.setAttribs(self.editor.getBody(), {\r
+                                       style : elm.attr('style') || '',\r
+                                       dir : elm.attr('dir') || '',\r
+                                       vLink : elm.attr('vlink') || '',\r
+                                       link : elm.attr('link') || '',\r
+                                       aLink : elm.attr('alink') || ''\r
+                               });\r
+                       }\r
+\r
+                       dom.remove('fullpage_styles');\r
+\r
+                       if (styles) {\r
+                               dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles);\r
+\r
+                               // Needed for IE 6/7\r
+                               elm = dom.get('fullpage_styles');\r
+                               if (elm.styleSheet)\r
+                                       elm.styleSheet.cssText = styles;\r
+                       }\r
+               },\r
+\r
+               _getDefaultHeader : function() {\r
+                       var header = '', editor = this.editor, value, styles = '';\r
+\r
+                       if (editor.getParam('fullpage_default_xml_pi'))\r
+                               header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';\r
+\r
+                       header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');\r
+                       header += '\n<html>\n<head>\n';\r
+\r
+                       if (value = editor.getParam('fullpage_default_title'))\r
+                               header += '<title>' + value + '</title>\n';\r
+\r
+                       if (value = editor.getParam('fullpage_default_encoding'))\r
+                               header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';\r
+\r
+                       if (value = editor.getParam('fullpage_default_font_family'))\r
+                               styles += 'font-family: ' + value + ';';\r
+\r
+                       if (value = editor.getParam('fullpage_default_font_size'))\r
+                               styles += 'font-size: ' + value + ';';\r
+\r
+                       if (value = editor.getParam('fullpage_default_text_color'))\r
+                               styles += 'color: ' + value + ';';\r
+\r
+                       header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';\r
+\r
+                       return header;\r
+               },\r
+\r
+               _getContent : function(ed, o) {\r
+                       var self = this;\r
+\r
+                       if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view'))\r
+                               o.content = tinymce.trim(self.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(self.foot);\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/fullpage.htm b/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/fullpage.htm
new file mode 100644 (file)
index 0000000..14ab865
--- /dev/null
@@ -0,0 +1,259 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#fullpage_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="js/fullpage.js"></script>\r
+       <link href="css/fullpage.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body id="fullpage" style="display: none">\r
+<form onsubmit="FullPageDialog.update();return false;" name="fullpage" action="#">\r
+               <div class="tabs">\r
+                       <ul>\r
+                               <li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li>\r
+                               <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="meta_panel" class="panel current">\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.meta_props}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="metatitle">{#fullpage_dlg.meta_title}</label>&nbsp;</td>\r
+                                                       <td><input type="text" id="metatitle" name="metatitle" value="" class="mceFocus" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="metakeywords">{#fullpage_dlg.meta_keywords}</label>&nbsp;</td>\r
+                                                       <td><textarea id="metakeywords" name="metakeywords" rows="4"></textarea></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="metadescription">{#fullpage_dlg.meta_description}</label>&nbsp;</td>\r
+                                                       <td><textarea id="metadescription" name="metadescription" rows="4"></textarea></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="metaauthor">{#fullpage_dlg.author}</label>&nbsp;</td>\r
+                                                       <td><input type="text" id="metaauthor" name="metaauthor" value="" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="metacopyright">{#fullpage_dlg.copyright}</label>&nbsp;</td>\r
+                                                       <td><input type="text" id="metacopyright" name="metacopyright" value="" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="metarobots">{#fullpage_dlg.meta_robots}</label>&nbsp;</td>\r
+                                                       <td>\r
+                                                               <select id="metarobots" name="metarobots">\r
+                                                                                       <option value="">{#not_set}</option> \r
+                                                                                       <option value="index,follow">{#fullpage_dlg.meta_index_follow}</option>\r
+                                                                                       <option value="index,nofollow">{#fullpage_dlg.meta_index_nofollow}</option>\r
+                                                                                       <option value="noindex,follow">{#fullpage_dlg.meta_noindex_follow}</option>\r
+                                                                                       <option value="noindex,nofollow">{#fullpage_dlg.meta_noindex_nofollow}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.langprops}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="docencoding">{#fullpage_dlg.encoding}</label></td> \r
+                                                       <td>\r
+                                                               <select id="docencoding" name="docencoding"> \r
+                                                                               <option value="">{#not_set}</option>\r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="doctype">{#fullpage_dlg.doctypes}</label>&nbsp;</td>\r
+                                                       <td>\r
+                                                               <select id="doctype" name="doctype">\r
+                                                                               <option value="">{#not_set}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="langcode">{#fullpage_dlg.langcode}</label>&nbsp;</td>\r
+                                                       <td><input type="text" id="langcode" name="langcode" value="" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="langdir">{#fullpage_dlg.langdir}</label></td> \r
+                                                       <td>\r
+                                                               <select id="langdir" name="langdir"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="ltr">{#fullpage_dlg.ltr}</option> \r
+                                                                               <option value="rtl">{#fullpage_dlg.rtl}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="nowrap"><label for="xml_pi">{#fullpage_dlg.xml_pi}</label>&nbsp;</td>\r
+                                                       <td><input type="checkbox" id="xml_pi" name="xml_pi" class="checkbox" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="appearance_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.appearance_textprops}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td> \r
+                                                       <td>\r
+                                                               <select id="fontface" name="fontface" onchange="FullPageDialog.changedStyleProp();">\r
+                                                                               <option value="">{#not_set}</option>\r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td> \r
+                                                       <td>\r
+                                                               <select id="fontsize" name="fontsize" onchange="FullPageDialog.changedStyleProp();">\r
+                                                                               <option value="">{#not_set}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="textcolor">{#fullpage_dlg.textcolor}</label></td> \r
+                                                       <td>\r
+                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');FullPageDialog.changedStyleProp();" /></td>\r
+                                                                               <td id="textcolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.appearance_bgprops}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="bgimage">{#fullpage_dlg.bgimage}</label></td> \r
+                                                       <td>\r
+                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bgimage" name="bgimage" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
+                                                                               <td id="bgimage_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="bgcolor">{#fullpage_dlg.bgcolor}</label></td> \r
+                                                       <td>\r
+                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');FullPageDialog.changedStyleProp();" /></td>\r
+                                                                               <td id="bgcolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.appearance_marginprops}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td> \r
+                                                       <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
+                                                       <td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td> \r
+                                                       <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td> \r
+                                                       <td><input id="topmargin" name="topmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
+                                                       <td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td> \r
+                                                       <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.appearance_linkprops}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="link_color">{#fullpage_dlg.link_color}</label></td> \r
+                                                       <td>\r
+                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');FullPageDialog.changedStyleProp();" /></td>\r
+                                                                               <td id="link_color_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td class="column1"><label for="visited_color">{#fullpage_dlg.visited_color}</label></td> \r
+                                                       <td>\r
+                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');FullPageDialog.changedStyleProp();" /></td>\r
+                                                                               <td id="visited_color_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="active_color">{#fullpage_dlg.active_color}</label></td> \r
+                                                       <td>\r
+                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');FullPageDialog.changedStyleProp();" /></td>\r
+                                                                               <td id="active_color_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>&nbsp;</td>\r
+                                                       <td>&nbsp;</td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#fullpage_dlg.appearance_style}</legend>\r
+\r
+                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="stylesheet">{#fullpage_dlg.stylesheet}</label></td> \r
+                                                       <td><table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="stylesheet" name="stylesheet" type="text" value="" /></td>\r
+                                                                               <td id="stylesheet_browsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="style">{#fullpage_dlg.style}</label></td> \r
+                                                       <td><input id="style" name="style" type="text" value="" onchange="FullPageDialog.changedStyle();" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="update" value="{#update}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/js/fullpage.js b/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/js/fullpage.js
new file mode 100644 (file)
index 0000000..3f672ad
--- /dev/null
@@ -0,0 +1,232 @@
+/**\r
+ * fullpage.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinyMCEPopup.requireLangPack();\r
+\r
+       var defaultDocTypes = \r
+               'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +\r
+               'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +\r
+               'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +\r
+               'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +\r
+               'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +\r
+               'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +\r
+               'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';\r
+\r
+       var defaultEncodings = \r
+               'Western european (iso-8859-1)=iso-8859-1,' +\r
+               'Central European (iso-8859-2)=iso-8859-2,' +\r
+               'Unicode (UTF-8)=utf-8,' +\r
+               'Chinese traditional (Big5)=big5,' +\r
+               'Cyrillic (iso-8859-5)=iso-8859-5,' +\r
+               'Japanese (iso-2022-jp)=iso-2022-jp,' +\r
+               'Greek (iso-8859-7)=iso-8859-7,' +\r
+               'Korean (iso-2022-kr)=iso-2022-kr,' +\r
+               'ASCII (us-ascii)=us-ascii';\r
+\r
+       var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';\r
+       var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';\r
+\r
+       function setVal(id, value) {\r
+               var elm = document.getElementById(id);\r
+\r
+               if (elm) {\r
+                       value = value || '';\r
+\r
+                       if (elm.nodeName == "SELECT")\r
+                               selectByValue(document.forms[0], id, value);\r
+                       else if (elm.type == "checkbox")\r
+                               elm.checked = !!value;\r
+                       else\r
+                               elm.value = value;\r
+               }\r
+       };\r
+\r
+       function getVal(id) {\r
+               var elm = document.getElementById(id);\r
+\r
+               if (elm.nodeName == "SELECT")\r
+                       return elm.options[elm.selectedIndex].value;\r
+\r
+               if (elm.type == "checkbox")\r
+                       return elm.checked;\r
+\r
+               return elm.value;\r
+       };\r
+\r
+       window.FullPageDialog = {\r
+               changedStyle : function() {\r
+                       var val, styles = tinyMCEPopup.editor.dom.parseStyle(getVal('style'));\r
+\r
+                       setVal('fontface', styles['font-face']);\r
+                       setVal('fontsize', styles['font-size']);\r
+                       setVal('textcolor', styles['color']);\r
+\r
+                       if (val = styles['background-image'])\r
+                               setVal('bgimage', val.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"));\r
+                       else\r
+                               setVal('bgimage', '');\r
+\r
+                       setVal('bgcolor', styles['background-color']);\r
+\r
+                       // Reset margin form elements\r
+                       setVal('topmargin', '');\r
+                       setVal('rightmargin', '');\r
+                       setVal('bottommargin', '');\r
+                       setVal('leftmargin', '');\r
+\r
+                       // Expand margin\r
+                       if (val = styles['margin']) {\r
+                               val = val.split(' ');\r
+                               styles['margin-top'] = val[0] || '';\r
+                               styles['margin-right'] = val[1] || val[0] || '';\r
+                               styles['margin-bottom'] = val[2] || val[0] || '';\r
+                               styles['margin-left'] = val[3] || val[0] || '';\r
+                       }\r
+\r
+                       if (val = styles['margin-top'])\r
+                               setVal('topmargin', val.replace(/px/, ''));\r
+\r
+                       if (val = styles['margin-right'])\r
+                               setVal('rightmargin', val.replace(/px/, ''));\r
+\r
+                       if (val = styles['margin-bottom'])\r
+                               setVal('bottommargin', val.replace(/px/, ''));\r
+\r
+                       if (val = styles['margin-left'])\r
+                               setVal('leftmargin', val.replace(/px/, ''));\r
+\r
+                       updateColor('bgcolor_pick', 'bgcolor');\r
+                       updateColor('textcolor_pick', 'textcolor');\r
+               },\r
+\r
+               changedStyleProp : function() {\r
+                       var val, dom = tinyMCEPopup.editor.dom, styles = dom.parseStyle(getVal('style'));\r
+       \r
+                       styles['font-face'] = getVal('fontface');\r
+                       styles['font-size'] = getVal('fontsize');\r
+                       styles['color'] = getVal('textcolor');\r
+                       styles['background-color'] = getVal('bgcolor');\r
+\r
+                       if (val = getVal('bgimage'))\r
+                               styles['background-image'] = "url('" + val + "')";\r
+                       else\r
+                               styles['background-image'] = '';\r
+\r
+                       delete styles['margin'];\r
+\r
+                       if (val = getVal('topmargin'))\r
+                               styles['margin-top'] = val + "px";\r
+                       else\r
+                               styles['margin-top'] = '';\r
+\r
+                       if (val = getVal('rightmargin'))\r
+                               styles['margin-right'] = val + "px";\r
+                       else\r
+                               styles['margin-right'] = '';\r
+\r
+                       if (val = getVal('bottommargin'))\r
+                               styles['margin-bottom'] = val + "px";\r
+                       else\r
+                               styles['margin-bottom'] = '';\r
+\r
+                       if (val = getVal('leftmargin'))\r
+                               styles['margin-left'] = val + "px";\r
+                       else\r
+                               styles['margin-left'] = '';\r
+\r
+                       // Serialize, parse and reserialize this will compress redundant styles\r
+                       setVal('style', dom.serializeStyle(dom.parseStyle(dom.serializeStyle(styles))));\r
+                       this.changedStyle();\r
+               },\r
+               \r
+               update : function() {\r
+                       var data = {};\r
+\r
+                       tinymce.each(tinyMCEPopup.dom.select('select,input,textarea'), function(node) {\r
+                               data[node.id] = getVal(node.id);\r
+                       });\r
+\r
+                       tinyMCEPopup.editor.plugins.fullpage._dataToHtml(data);\r
+                       tinyMCEPopup.close();\r
+               }\r
+       };\r
+       \r
+       function init() {\r
+               var form = document.forms[0], i, item, list, editor = tinyMCEPopup.editor;\r
+\r
+               // Setup doctype select box\r
+               list = editor.getParam("fullpage_doctypes", defaultDocTypes).split(',');\r
+               for (i = 0; i < list.length; i++) {\r
+                       item = list[i].split('=');\r
+\r
+                       if (item.length > 1)\r
+                               addSelectValue(form, 'doctype', item[0], item[1]);\r
+               }\r
+\r
+               // Setup fonts select box\r
+               list = editor.getParam("fullpage_fonts", defaultFontNames).split(';');\r
+               for (i = 0; i < list.length; i++) {\r
+                       item = list[i].split('=');\r
+\r
+                       if (item.length > 1)\r
+                               addSelectValue(form, 'fontface', item[0], item[1]);\r
+               }\r
+\r
+               // Setup fontsize select box\r
+               list = editor.getParam("fullpage_fontsizes", defaultFontSizes).split(',');\r
+               for (i = 0; i < list.length; i++)\r
+                       addSelectValue(form, 'fontsize', list[i], list[i]);\r
+\r
+               // Setup encodings select box\r
+               list = editor.getParam("fullpage_encodings", defaultEncodings).split(',');\r
+               for (i = 0; i < list.length; i++) {\r
+                       item = list[i].split('=');\r
+\r
+                       if (item.length > 1)\r
+                               addSelectValue(form, 'docencoding', item[0], item[1]);\r
+               }\r
+\r
+               // Setup color pickers\r
+               document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
+               document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');\r
+               document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');\r
+               document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');\r
+               document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');\r
+               document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');\r
+               document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');\r
+\r
+               // Resize some elements\r
+               if (isVisible('stylesheetbrowser'))\r
+                       document.getElementById('stylesheet').style.width = '220px';\r
+\r
+               if (isVisible('link_href_browser'))\r
+                       document.getElementById('element_link_href').style.width = '230px';\r
+\r
+               if (isVisible('bgimage_browser'))\r
+                       document.getElementById('bgimage').style.width = '210px';\r
+\r
+               // Update form\r
+               tinymce.each(tinyMCEPopup.getWindowArg('data'), function(value, key) {\r
+                       setVal(key, value);\r
+               });\r
+\r
+               FullPageDialog.changedStyle();\r
+\r
+               // Update colors\r
+               updateColor('textcolor_pick', 'textcolor');\r
+               updateColor('bgcolor_pick', 'bgcolor');\r
+               updateColor('visited_color_pick', 'visited_color');\r
+               updateColor('active_color_pick', 'active_color');\r
+               updateColor('link_color_pick', 'link_color');\r
+       };\r
+\r
+       tinyMCEPopup.onInit.add(init);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/fullpage/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..516edc7
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.fullpage_dlg',{title:"Document Properties","meta_tab":"General","appearance_tab":"Appearance","advanced_tab":"Advanced","meta_props":"Meta Information",langprops:"Language and Encoding","meta_title":"Title","meta_keywords":"Keywords","meta_description":"Description","meta_robots":"Robots",doctypes:"Doctype",langcode:"Language Code",langdir:"Language Direction",ltr:"Left to Right",rtl:"Right to Left","xml_pi":"XML Declaration",encoding:"Character Encoding","appearance_bgprops":"Background Properties","appearance_marginprops":"Body Margins","appearance_linkprops":"Link Colors","appearance_textprops":"Text Properties",bgcolor:"Background Color",bgimage:"Background Image","left_margin":"Left Margin","right_margin":"Right Margin","top_margin":"Top Margin","bottom_margin":"Bottom Margin","text_color":"Text Color","font_size":"Font Size","font_face":"Font Face","link_color":"Link Color","hover_color":"Hover Color","visited_color":"Visited Color","active_color":"Active Color",textcolor:"Color",fontsize:"Font Size",fontface:"Font Family","meta_index_follow":"Index and Follow the Links","meta_index_nofollow":"Index and Don\'t Follow the Links","meta_noindex_follow":"Do Not Index but Follow the Links","meta_noindex_nofollow":"Do Not Index and Don\'t Follow the Links","appearance_style":"Stylesheet and Style Properties",stylesheet:"Stylesheet",style:"Style",author:"Author",copyright:"Copyright",add:"Add New Element",remove:"Remove Selected Element",moveup:"Move Selected Element Up",movedown:"Move Selected Element Down","head_elements":"Head Elements",info:"Information","add_title":"Title Element","add_meta":"Meta Element","add_script":"Script Element","add_style":"Style Element","add_link":"Link Element","add_base":"Base Element","add_comment":"Comment Node","title_element":"Title Element","script_element":"Script Element","style_element":"Style Element","base_element":"Base Element","link_element":"Link Element","meta_element":"Meta Element","comment_element":"Comment",src:"Source",language:"Language",href:"HREF",target:"Target",type:"Type",charset:"Charset",defer:"Defer",media:"Media",properties:"Properties",name:"Name",value:"Value",content:"Content",rel:"Rel",rev:"Rev",hreflang:"HREF Lang","general_props":"General","advanced_props":"Advanced"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/editor_plugin.js
new file mode 100644 (file)
index 0000000..a2eb034
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().getElementsByTagName("table")[0]);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..524b487
--- /dev/null
@@ -0,0 +1,159 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var DOM = tinymce.DOM;\r
+\r
+       tinymce.create('tinymce.plugins.FullScreenPlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this, s = {}, vp, posCss;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceFullScreen', function() {\r
+                               var win, de = DOM.doc.documentElement;\r
+\r
+                               if (ed.getParam('fullscreen_is_enabled')) {\r
+                                       if (ed.getParam('fullscreen_new_window'))\r
+                                               closeFullscreen(); // Call to close in new window\r
+                                       else {\r
+                                               DOM.win.setTimeout(function() {\r
+                                                       tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);\r
+                                                       tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());\r
+                                                       tinyMCE.remove(ed);\r
+                                                       DOM.remove('mce_fullscreen_container');\r
+                                                       de.style.overflow = ed.getParam('fullscreen_html_overflow');\r
+                                                       DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));\r
+                                                       DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));\r
+                                                       tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings\r
+                                               }, 10);\r
+                                       }\r
+\r
+                                       return;\r
+                               }\r
+\r
+                               if (ed.getParam('fullscreen_new_window')) {\r
+                                       win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);\r
+                                       try {\r
+                                               win.resizeTo(screen.availWidth, screen.availHeight);\r
+                                       } catch (e) {\r
+                                               // Ignore\r
+                                       }\r
+                               } else {\r
+                                       tinyMCE.oldSettings = tinyMCE.settings; // Store old settings\r
+                                       s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';\r
+                                       s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);\r
+                                       vp = DOM.getViewPort();\r
+                                       s.fullscreen_scrollx = vp.x;\r
+                                       s.fullscreen_scrolly = vp.y;\r
+\r
+                                       // Fixes an Opera bug where the scrollbars doesn't reappear\r
+                                       if (tinymce.isOpera && s.fullscreen_overflow == 'visible')\r
+                                               s.fullscreen_overflow = 'auto';\r
+\r
+                                       // Fixes an IE bug where horizontal scrollbars would appear\r
+                                       if (tinymce.isIE && s.fullscreen_overflow == 'scroll')\r
+                                               s.fullscreen_overflow = 'auto';\r
+\r
+                                       // Fixes an IE bug where the scrollbars doesn't reappear\r
+                                       if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))\r
+                                               s.fullscreen_html_overflow = 'auto';\r
+\r
+                                       if (s.fullscreen_overflow == '0px')\r
+                                               s.fullscreen_overflow = '';\r
+\r
+                                       DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');\r
+                                       de.style.overflow = 'hidden'; //Fix for IE6/7\r
+                                       vp = DOM.getViewPort();\r
+                                       DOM.win.scrollTo(0, 0);\r
+\r
+                                       if (tinymce.isIE)\r
+                                               vp.h -= 1;\r
+\r
+                                       // Use fixed position if it exists\r
+                                       if (tinymce.isIE6 || document.compatMode == 'BackCompat')\r
+                                               posCss = 'absolute;top:' + vp.y;\r
+                                       else\r
+                                               posCss = 'fixed;top:0';\r
+\r
+                                       n = DOM.add(DOM.doc.body, 'div', {\r
+                                               id : 'mce_fullscreen_container',\r
+                                               style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});\r
+                                       DOM.add(n, 'div', {id : 'mce_fullscreen'});\r
+\r
+                                       tinymce.each(ed.settings, function(v, n) {\r
+                                               s[n] = v;\r
+                                       });\r
+\r
+                                       s.id = 'mce_fullscreen';\r
+                                       s.width = n.clientWidth;\r
+                                       s.height = n.clientHeight - 15;\r
+                                       s.fullscreen_is_enabled = true;\r
+                                       s.fullscreen_editor_id = ed.id;\r
+                                       s.theme_advanced_resizing = false;\r
+                                       s.save_onsavecallback = function() {\r
+                                               ed.setContent(tinyMCE.get(s.id).getContent());\r
+                                               ed.execCommand('mceSave');\r
+                                       };\r
+\r
+                                       tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {\r
+                                               s[k] = v;\r
+                                       });\r
+\r
+                                       if (s.theme_advanced_toolbar_location === 'external')\r
+                                               s.theme_advanced_toolbar_location = 'top';\r
+\r
+                                       t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);\r
+                                       t.fullscreenEditor.onInit.add(function() {\r
+                                               t.fullscreenEditor.setContent(ed.getContent());\r
+                                               t.fullscreenEditor.focus();\r
+                                       });\r
+\r
+                                       t.fullscreenEditor.render();\r
+\r
+                                       t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');\r
+                                       t.fullscreenElement.update();\r
+                                       //document.body.overflow = 'hidden';\r
+\r
+                                       t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {\r
+                                               var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;\r
+\r
+                                               // Get outer/inner size to get a delta size that can be used to calc the new iframe size\r
+                                               outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]);\r
+                                               innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);\r
+\r
+                                               fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);\r
+                                       });\r
+                               }\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});\r
+\r
+                       ed.onNodeChange.add(function(ed, cm) {\r
+                               cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Fullscreen',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/fullscreen.htm b/3.x/src/resources/javascript/TinyMCE/plugins/fullscreen/fullscreen.htm
new file mode 100644 (file)
index 0000000..ffe528e
--- /dev/null
@@ -0,0 +1,110 @@
+<!DOCTYPE html>\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title></title>\r
+       <meta http-equiv="X-UA-Compatible" content="IE=edge" />\r
+       <script type="text/javascript" src="../../tiny_mce.js"></script>\r
+       <script type="text/javascript">\r
+               function patchCallback(settings, key) {\r
+                       if (settings[key])\r
+                               settings[key] = "window.opener." + settings[key];\r
+               }\r
+\r
+               var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;\r
+\r
+               // Clone array\r
+               for (var n in paSe)\r
+                       settings[n] = paSe[n];\r
+\r
+               // Override options for fullscreen\r
+               for (var n in paSe.fullscreen_settings)\r
+                       settings[n] = paSe.fullscreen_settings[n];\r
+\r
+               // Patch callbacks, make them point to window.opener\r
+               patchCallback(settings, 'urlconverter_callback');\r
+               patchCallback(settings, 'insertlink_callback');\r
+               patchCallback(settings, 'insertimage_callback');\r
+               patchCallback(settings, 'setupcontent_callback');\r
+               patchCallback(settings, 'save_callback');\r
+               patchCallback(settings, 'onchange_callback');\r
+               patchCallback(settings, 'init_instance_callback');\r
+               patchCallback(settings, 'file_browser_callback');\r
+               patchCallback(settings, 'cleanup_callback');\r
+               patchCallback(settings, 'execcommand_callback');\r
+               patchCallback(settings, 'oninit');\r
+\r
+               // Set options\r
+               delete settings.id;\r
+               settings['mode'] = 'exact';\r
+               settings['elements'] = 'fullscreenarea';\r
+               settings['add_unload_trigger'] = false;\r
+               settings['ask'] = false;\r
+               settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();\r
+               settings['fullscreen_is_enabled'] = true;\r
+               settings['fullscreen_editor_id'] = oeID;\r
+               settings['theme_advanced_resizing'] = false;\r
+               settings['strict_loading_mode'] = true;\r
+\r
+               settings.save_onsavecallback = function() {\r
+                       window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});\r
+                       window.opener.tinyMCE.get(oeID).execCommand('mceSave');\r
+                       window.close();\r
+               };\r
+\r
+               function unloadHandler(e) {\r
+                       moveContent();\r
+               }\r
+\r
+               function moveContent() {\r
+                       window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());\r
+               }\r
+\r
+               function closeFullscreen() {\r
+                       moveContent();\r
+                       window.close();\r
+               }\r
+\r
+               function doParentSubmit() {\r
+                       moveContent();\r
+\r
+                       if (window.opener.tinyMCE.selectedInstance.formElement.form)\r
+                               window.opener.tinyMCE.selectedInstance.formElement.form.submit();\r
+\r
+                       window.close();\r
+\r
+                       return false;\r
+               }\r
+\r
+               function render() {\r
+                       var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;\r
+\r
+                       e.value = window.opener.tinyMCE.get(oeID).getContent();\r
+\r
+                       vp = dom.getViewPort();\r
+                       settings.width = vp.w;\r
+                       settings.height = vp.h - 15;\r
+\r
+                       tinymce.dom.Event.add(window, 'resize', function() {\r
+                               var vp = dom.getViewPort();\r
+\r
+                               tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);\r
+                       });\r
+\r
+                       tinyMCE.init(settings);\r
+               }\r
+\r
+               // Add onunload\r
+               tinymce.dom.Event.add(window, "beforeunload", unloadHandler);\r
+       </script>\r
+</head>\r
+<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">\r
+<form onsubmit="doParentSubmit();">\r
+<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>\r
+</form>\r
+\r
+<script type="text/javascript">\r
+       render();\r
+</script>\r
+\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/iespell/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/iespell/editor_plugin.js
new file mode 100644 (file)
index 0000000..e9cba10
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.IESpell",{init:function(a,b){var c=this,d;if(!tinymce.isIE){return}c.editor=a;a.addCommand("mceIESpell",function(){try{d=new ActiveXObject("ieSpell.ieSpellExtension");d.CheckDocumentNode(a.getDoc().documentElement)}catch(f){if(f.number==-2146827859){a.windowManager.confirm(a.getLang("iespell.download"),function(e){if(e){window.open("http://www.iespell.com/download.php","ieSpellDownload","")}})}else{a.windowManager.alert("Error Loading ieSpell: Exception "+f.number)}}});a.addButton("iespell",{title:"iespell.iespell_desc",cmd:"mceIESpell"})},getInfo:function(){return{longname:"IESpell (IE Only)",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("iespell",tinymce.plugins.IESpell)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/iespell/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/iespell/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..1b2bb98
--- /dev/null
@@ -0,0 +1,54 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.IESpell', {\r
+               init : function(ed, url) {\r
+                       var t = this, sp;\r
+\r
+                       if (!tinymce.isIE)\r
+                               return;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceIESpell', function() {\r
+                               try {\r
+                                       sp = new ActiveXObject("ieSpell.ieSpellExtension");\r
+                                       sp.CheckDocumentNode(ed.getDoc().documentElement);\r
+                               } catch (e) {\r
+                                       if (e.number == -2146827859) {\r
+                                               ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) {\r
+                                                       if (s)\r
+                                                               window.open('http://www.iespell.com/download.php', 'ieSpellDownload', '');\r
+                                               });\r
+                                       } else\r
+                                               ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number);\r
+                               }\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'});\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'IESpell (IE Only)',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/editor_plugin.js
new file mode 100644 (file)
index 0000000..8bb96f9
--- /dev/null
@@ -0,0 +1 @@
+(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(s,j){var z=this,i,k="",r=z.editor,g=0,v=0,h,m,o,q,l,x,y,n;s=s||{};j=j||{};if(!s.inline){return z.parent(s,j)}n=z._frontWindow();if(n&&d.get(n.id+"_ifr")){n.focussedElement=d.get(n.id+"_ifr").contentWindow.document.activeElement}if(!s.type){z.bookmark=r.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240)+(tinymce.isIE?8:0);s.min_width=parseInt(s.min_width||150);s.min_height=parseInt(s.min_height||100);s.max_width=parseInt(s.max_width||2000);s.max_height=parseInt(s.max_height||2000);s.left=s.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(s.width/2)));s.top=s.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(s.height/2)));s.movable=s.resizable=true;j.mce_width=s.width;j.mce_height=s.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=s.auto_focus;z.features=s;z.params=j;z.onOpen.dispatch(z,s,j);if(s.type){k+=" mceModal";if(s.type){k+=" mce"+s.type.substring(0,1).toUpperCase()+s.type.substring(1)}s.resizable=false}if(s.statusbar){k+=" mceStatusbar"}if(s.resizable){k+=" mceResizable"}if(s.minimizable){k+=" mceMinimizable"}if(s.maximizable){k+=" mceMaximizable"}if(s.movable){k+=" mceMovable"}z._addAll(d.doc.body,["div",{id:i,role:"dialog","aria-labelledby":s.type?i+"_content":i+"_title","class":(r.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},s.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft",tabindex:"0"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight",tabindex:"0"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!s.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;v+=d.get(i+"_top").clientHeight;v+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:s.top,left:s.left,width:s.width+g,height:s.height+v});y=s.url||s.file;if(y){if(tinymce.relaxedDomain){y+=(y.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}y=tinymce._addVer(y)}if(!s.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:s.width,height:s.height});d.setAttrib(i+"_ifr","src",y)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(s.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",s.content.replace("\n","<br />"));a.add(i,"keyup",function(f){var p=27;if(f.keyCode===p){s.button_func(false);return a.cancel(f)}});a.add(i,"keydown",function(f){var t,p=9;if(f.keyCode===p){t=d.select("a.mceCancel",i+"_wrapper")[0];if(t&&t!==f.target){t.focus()}else{d.get(i+"_ok").focus()}return a.cancel(f)}})}o=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=z.windows[i];z.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceClose"){z.close(null,i);return a.cancel(t)}else{if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return z._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return z._startDrag(i,t,u.className.substring(13))}}}}}}});q=a.add(i,"click",function(f){var p=f.target;z.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":z.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":s.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});a.add([i+"_left",i+"_right"],"focus",function(p){var t=d.get(i+"_ifr");if(t){var f=t.contentWindow.document.body;var u=d.select(":input:enabled,*[tabindex=0]",f);if(p.target.id===(i+"_left")){u[u.length-1].focus()}else{u[0].focus()}}else{d.get(i+"_ok").focus()}});x=z.windows[i]={id:i,mousedown_func:o,click_func:q,element:new b(i,{blocker:1,container:r.getContainer()}),iframeElement:new b(i+"_ifr"),features:s,deltaWidth:g,deltaHeight:v};x.iframeElement.on("focus",function(){z.focus(i)});if(z.count==0&&z.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(z.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:z.zIndex-1}});d.show("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","true")}else{d.setStyle("mceModalBlocker","z-index",z.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}d.setAttrib(i,"aria-hidden","false");z.focus(i);z._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}z.count++;return x},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h;if(f.focussedElement){f.focussedElement.focus()}else{if(d.get(h+"_ok")){d.get(f.id+"_ok").focus()}else{if(d.get(f.id+"_ifr")){d.get(f.id+"_ifr").focus()}}}}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(i,k){var g=this,f,j=d.doc,h,k;k=g._findId(k||i);if(!g.windows[k]){g.parent(i);return}g.count--;if(g.count==0){d.remove("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","false");g.editor.focus()}if(f=g.windows[k]){g.onClose.dispatch(g);a.remove(j,"mousedown",f.mousedownFunc);a.remove(j,"click",f.clickFunc);a.clear(k);a.clear(k+"_ifr");d.setAttrib(k+"_ifr","src",'javascript:""');f.element.remove();delete g.windows[k];h=g._frontWindow();if(h){g.focus(h.id)}}},_frontWindow:function(){var g,f=0;e(this.windows,function(h){if(h.zIndex>f){g=h;f=h.zIndex}});return g},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..67123ca
--- /dev/null
@@ -0,0 +1,699 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;\r
+\r
+       tinymce.create('tinymce.plugins.InlinePopups', {\r
+               init : function(ed, url) {\r
+                       // Replace window manager\r
+                       ed.onBeforeRenderUI.add(function() {\r
+                               ed.windowManager = new tinymce.InlineWindowManager(ed);\r
+                               DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'InlinePopups',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {\r
+               InlineWindowManager : function(ed) {\r
+                       var t = this;\r
+\r
+                       t.parent(ed);\r
+                       t.zIndex = 300000;\r
+                       t.count = 0;\r
+                       t.windows = {};\r
+               },\r
+\r
+               open : function(f, p) {\r
+                       var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;\r
+\r
+                       f = f || {};\r
+                       p = p || {};\r
+\r
+                       // Run native windows\r
+                       if (!f.inline)\r
+                               return t.parent(f, p);\r
+\r
+                       parentWindow = t._frontWindow();\r
+                       if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {\r
+                               parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;\r
+                       }\r
+                       \r
+                       // Only store selection if the type is a normal window\r
+                       if (!f.type)\r
+                               t.bookmark = ed.selection.getBookmark(1);\r
+\r
+                       id = DOM.uniqueId();\r
+                       vp = DOM.getViewPort();\r
+                       f.width = parseInt(f.width || 320);\r
+                       f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);\r
+                       f.min_width = parseInt(f.min_width || 150);\r
+                       f.min_height = parseInt(f.min_height || 100);\r
+                       f.max_width = parseInt(f.max_width || 2000);\r
+                       f.max_height = parseInt(f.max_height || 2000);\r
+                       f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));\r
+                       f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));\r
+                       f.movable = f.resizable = true;\r
+                       p.mce_width = f.width;\r
+                       p.mce_height = f.height;\r
+                       p.mce_inline = true;\r
+                       p.mce_window_id = id;\r
+                       p.mce_auto_focus = f.auto_focus;\r
+\r
+                       // Transpose\r
+//                     po = DOM.getPos(ed.getContainer());\r
+//                     f.left -= po.x;\r
+//                     f.top -= po.y;\r
+\r
+                       t.features = f;\r
+                       t.params = p;\r
+                       t.onOpen.dispatch(t, f, p);\r
+\r
+                       if (f.type) {\r
+                               opt += ' mceModal';\r
+\r
+                               if (f.type)\r
+                                       opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);\r
+\r
+                               f.resizable = false;\r
+                       }\r
+\r
+                       if (f.statusbar)\r
+                               opt += ' mceStatusbar';\r
+\r
+                       if (f.resizable)\r
+                               opt += ' mceResizable';\r
+\r
+                       if (f.minimizable)\r
+                               opt += ' mceMinimizable';\r
+\r
+                       if (f.maximizable)\r
+                               opt += ' mceMaximizable';\r
+\r
+                       if (f.movable)\r
+                               opt += ' mceMovable';\r
+\r
+                       // Create DOM objects\r
+                       t._addAll(DOM.doc.body, \r
+                               ['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'}, \r
+                                       ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},\r
+                                               ['div', {id : id + '_top', 'class' : 'mceTop'}, \r
+                                                       ['div', {'class' : 'mceLeft'}],\r
+                                                       ['div', {'class' : 'mceCenter'}],\r
+                                                       ['div', {'class' : 'mceRight'}],\r
+                                                       ['span', {id : id + '_title'}, f.title || '']\r
+                                               ],\r
+\r
+                                               ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, \r
+                                                       ['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],\r
+                                                       ['span', {id : id + '_content'}],\r
+                                                       ['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]\r
+                                               ],\r
+\r
+                                               ['div', {id : id + '_bottom', 'class' : 'mceBottom'},\r
+                                                       ['div', {'class' : 'mceLeft'}],\r
+                                                       ['div', {'class' : 'mceCenter'}],\r
+                                                       ['div', {'class' : 'mceRight'}],\r
+                                                       ['span', {id : id + '_status'}, 'Content']\r
+                                               ],\r
+\r
+                                               ['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
+                                               ['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
+                                               ['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
+                                               ['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
+                                               ['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],\r
+                                               ['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]\r
+                                       ]\r
+                               ]\r
+                       );\r
+\r
+                       DOM.setStyles(id, {top : -10000, left : -10000});\r
+\r
+                       // Fix gecko rendering bug, where the editors iframe messed with window contents\r
+                       if (tinymce.isGecko)\r
+                               DOM.setStyle(id, 'overflow', 'auto');\r
+\r
+                       // Measure borders\r
+                       if (!f.type) {\r
+                               dw += DOM.get(id + '_left').clientWidth;\r
+                               dw += DOM.get(id + '_right').clientWidth;\r
+                               dh += DOM.get(id + '_top').clientHeight;\r
+                               dh += DOM.get(id + '_bottom').clientHeight;\r
+                       }\r
+\r
+                       // Resize window\r
+                       DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});\r
+\r
+                       u = f.url || f.file;\r
+                       if (u) {\r
+                               if (tinymce.relaxedDomain)\r
+                                       u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;\r
+\r
+                               u = tinymce._addVer(u);\r
+                       }\r
+\r
+                       if (!f.type) {\r
+                               DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});\r
+                               DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});\r
+                               DOM.setAttrib(id + '_ifr', 'src', u);\r
+                       } else {\r
+                               DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');\r
+\r
+                               if (f.type == 'confirm')\r
+                                       DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');\r
+\r
+                               DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});\r
+                               DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));\r
+                               \r
+                               Event.add(id, 'keyup', function(evt) {\r
+                                       var VK_ESCAPE = 27;\r
+                                       if (evt.keyCode === VK_ESCAPE) {\r
+                                               f.button_func(false);\r
+                                               return Event.cancel(evt);\r
+                                       }\r
+                               });\r
+\r
+                               Event.add(id, 'keydown', function(evt) {\r
+                                       var cancelButton, VK_TAB = 9;\r
+                                       if (evt.keyCode === VK_TAB) {\r
+                                               cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];\r
+                                               if (cancelButton && cancelButton !== evt.target) {\r
+                                                       cancelButton.focus();\r
+                                               } else {\r
+                                                       DOM.get(id + '_ok').focus();\r
+                                               }\r
+                                               return Event.cancel(evt);\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       // Register events\r
+                       mdf = Event.add(id, 'mousedown', function(e) {\r
+                               var n = e.target, w, vp;\r
+\r
+                               w = t.windows[id];\r
+                               t.focus(id);\r
+\r
+                               if (n.nodeName == 'A' || n.nodeName == 'a') {\r
+                                       if (n.className == 'mceClose') {\r
+                                               t.close(null, id);\r
+                                               return Event.cancel(e);\r
+                                       } else if (n.className == 'mceMax') {\r
+                                               w.oldPos = w.element.getXY();\r
+                                               w.oldSize = w.element.getSize();\r
+\r
+                                               vp = DOM.getViewPort();\r
+\r
+                                               // Reduce viewport size to avoid scrollbars\r
+                                               vp.w -= 2;\r
+                                               vp.h -= 2;\r
+\r
+                                               w.element.moveTo(vp.x, vp.y);\r
+                                               w.element.resizeTo(vp.w, vp.h);\r
+                                               DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});\r
+                                               DOM.addClass(id + '_wrapper', 'mceMaximized');\r
+                                       } else if (n.className == 'mceMed') {\r
+                                               // Reset to old size\r
+                                               w.element.moveTo(w.oldPos.x, w.oldPos.y);\r
+                                               w.element.resizeTo(w.oldSize.w, w.oldSize.h);\r
+                                               w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);\r
+\r
+                                               DOM.removeClass(id + '_wrapper', 'mceMaximized');\r
+                                       } else if (n.className == 'mceMove')\r
+                                               return t._startDrag(id, e, n.className);\r
+                                       else if (DOM.hasClass(n, 'mceResize'))\r
+                                               return t._startDrag(id, e, n.className.substring(13));\r
+                               }\r
+                       });\r
+\r
+                       clf = Event.add(id, 'click', function(e) {\r
+                               var n = e.target;\r
+\r
+                               t.focus(id);\r
+\r
+                               if (n.nodeName == 'A' || n.nodeName == 'a') {\r
+                                       switch (n.className) {\r
+                                               case 'mceClose':\r
+                                                       t.close(null, id);\r
+                                                       return Event.cancel(e);\r
+\r
+                                               case 'mceButton mceOk':\r
+                                               case 'mceButton mceCancel':\r
+                                                       f.button_func(n.className == 'mceButton mceOk');\r
+                                                       return Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       });\r
+                       \r
+                       // Make sure the tab order loops within the dialog.\r
+                       Event.add([id + '_left', id + '_right'], 'focus', function(evt) {\r
+                               var iframe = DOM.get(id + '_ifr');\r
+                               if (iframe) {\r
+                                       var body = iframe.contentWindow.document.body;\r
+                                       var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);\r
+                                       if (evt.target.id === (id + '_left')) {\r
+                                               focusable[focusable.length - 1].focus();\r
+                                       } else {\r
+                                               focusable[0].focus();\r
+                                       }\r
+                               } else {\r
+                                       DOM.get(id + '_ok').focus();\r
+                               }\r
+                       });\r
+                       \r
+                       // Add window\r
+                       w = t.windows[id] = {\r
+                               id : id,\r
+                               mousedown_func : mdf,\r
+                               click_func : clf,\r
+                               element : new Element(id, {blocker : 1, container : ed.getContainer()}),\r
+                               iframeElement : new Element(id + '_ifr'),\r
+                               features : f,\r
+                               deltaWidth : dw,\r
+                               deltaHeight : dh\r
+                       };\r
+\r
+                       w.iframeElement.on('focus', function() {\r
+                               t.focus(id);\r
+                       });\r
+\r
+                       // Setup blocker\r
+                       if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {\r
+                               DOM.add(DOM.doc.body, 'div', {\r
+                                       id : 'mceModalBlocker',\r
+                                       'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',\r
+                                       style : {zIndex : t.zIndex - 1}\r
+                               });\r
+\r
+                               DOM.show('mceModalBlocker'); // Reduces flicker in IE\r
+                               DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');\r
+                       } else\r
+                               DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);\r
+\r
+                       if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))\r
+                               DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});\r
+\r
+                       DOM.setAttrib(id, 'aria-hidden', 'false');\r
+                       t.focus(id);\r
+                       t._fixIELayout(id, 1);\r
+\r
+                       // Focus ok button\r
+                       if (DOM.get(id + '_ok'))\r
+                               DOM.get(id + '_ok').focus();\r
+                       t.count++;\r
+\r
+                       return w;\r
+               },\r
+\r
+               focus : function(id) {\r
+                       var t = this, w;\r
+\r
+                       if (w = t.windows[id]) {\r
+                               w.zIndex = this.zIndex++;\r
+                               w.element.setStyle('zIndex', w.zIndex);\r
+                               w.element.update();\r
+\r
+                               id = id + '_wrapper';\r
+                               DOM.removeClass(t.lastId, 'mceFocus');\r
+                               DOM.addClass(id, 'mceFocus');\r
+                               t.lastId = id;\r
+                               \r
+                               if (w.focussedElement) {\r
+                                       w.focussedElement.focus();\r
+                               } else if (DOM.get(id + '_ok')) {\r
+                                       DOM.get(w.id + '_ok').focus();\r
+                               } else if (DOM.get(w.id + '_ifr')) {\r
+                                       DOM.get(w.id + '_ifr').focus();\r
+                               }\r
+                       }\r
+               },\r
+\r
+               _addAll : function(te, ne) {\r
+                       var i, n, t = this, dom = tinymce.DOM;\r
+\r
+                       if (is(ne, 'string'))\r
+                               te.appendChild(dom.doc.createTextNode(ne));\r
+                       else if (ne.length) {\r
+                               te = te.appendChild(dom.create(ne[0], ne[1]));\r
+\r
+                               for (i=2; i<ne.length; i++)\r
+                                       t._addAll(te, ne[i]);\r
+                       }\r
+               },\r
+\r
+               _startDrag : function(id, se, ac) {\r
+                       var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;\r
+\r
+                       // Get positons and sizes\r
+//                     cp = DOM.getPos(t.editor.getContainer());\r
+                       cp = {x : 0, y : 0};\r
+                       vp = DOM.getViewPort();\r
+\r
+                       // Reduce viewport size to avoid scrollbars while dragging\r
+                       vp.w -= 2;\r
+                       vp.h -= 2;\r
+\r
+                       sex = se.screenX;\r
+                       sey = se.screenY;\r
+                       dx = dy = dw = dh = 0;\r
+\r
+                       // Handle mouse up\r
+                       mu = Event.add(d, 'mouseup', function(e) {\r
+                               Event.remove(d, 'mouseup', mu);\r
+                               Event.remove(d, 'mousemove', mm);\r
+\r
+                               if (eb)\r
+                                       eb.remove();\r
+\r
+                               we.moveBy(dx, dy);\r
+                               we.resizeBy(dw, dh);\r
+                               sz = we.getSize();\r
+                               DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});\r
+                               t._fixIELayout(id, 1);\r
+\r
+                               return Event.cancel(e);\r
+                       });\r
+\r
+                       if (ac != 'Move')\r
+                               startMove();\r
+\r
+                       function startMove() {\r
+                               if (eb)\r
+                                       return;\r
+\r
+                               t._fixIELayout(id, 0);\r
+\r
+                               // Setup event blocker\r
+                               DOM.add(d.body, 'div', {\r
+                                       id : 'mceEventBlocker',\r
+                                       'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),\r
+                                       style : {zIndex : t.zIndex + 1}\r
+                               });\r
+\r
+                               if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))\r
+                                       DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});\r
+\r
+                               eb = new Element('mceEventBlocker');\r
+                               eb.update();\r
+\r
+                               // Setup placeholder\r
+                               p = we.getXY();\r
+                               sz = we.getSize();\r
+                               sx = cp.x + p.x - vp.x;\r
+                               sy = cp.y + p.y - vp.y;\r
+                               DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});\r
+                               ph = new Element('mcePlaceHolder');\r
+                       };\r
+\r
+                       // Handle mouse move/drag\r
+                       mm = Event.add(d, 'mousemove', function(e) {\r
+                               var x, y, v;\r
+\r
+                               startMove();\r
+\r
+                               x = e.screenX - sex;\r
+                               y = e.screenY - sey;\r
+\r
+                               switch (ac) {\r
+                                       case 'ResizeW':\r
+                                               dx = x;\r
+                                               dw = 0 - x;\r
+                                               break;\r
+\r
+                                       case 'ResizeE':\r
+                                               dw = x;\r
+                                               break;\r
+\r
+                                       case 'ResizeN':\r
+                                       case 'ResizeNW':\r
+                                       case 'ResizeNE':\r
+                                               if (ac == "ResizeNW") {\r
+                                                       dx = x;\r
+                                                       dw = 0 - x;\r
+                                               } else if (ac == "ResizeNE")\r
+                                                       dw = x;\r
+\r
+                                               dy = y;\r
+                                               dh = 0 - y;\r
+                                               break;\r
+\r
+                                       case 'ResizeS':\r
+                                       case 'ResizeSW':\r
+                                       case 'ResizeSE':\r
+                                               if (ac == "ResizeSW") {\r
+                                                       dx = x;\r
+                                                       dw = 0 - x;\r
+                                               } else if (ac == "ResizeSE")\r
+                                                       dw = x;\r
+\r
+                                               dh = y;\r
+                                               break;\r
+\r
+                                       case 'mceMove':\r
+                                               dx = x;\r
+                                               dy = y;\r
+                                               break;\r
+                               }\r
+\r
+                               // Boundary check\r
+                               if (dw < (v = w.features.min_width - sz.w)) {\r
+                                       if (dx !== 0)\r
+                                               dx += dw - v;\r
+\r
+                                       dw = v;\r
+                               }\r
+       \r
+                               if (dh < (v = w.features.min_height - sz.h)) {\r
+                                       if (dy !== 0)\r
+                                               dy += dh - v;\r
+\r
+                                       dh = v;\r
+                               }\r
+\r
+                               dw = Math.min(dw, w.features.max_width - sz.w);\r
+                               dh = Math.min(dh, w.features.max_height - sz.h);\r
+                               dx = Math.max(dx, vp.x - (sx + vp.x));\r
+                               dy = Math.max(dy, vp.y - (sy + vp.y));\r
+                               dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));\r
+                               dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));\r
+\r
+                               // Move if needed\r
+                               if (dx + dy !== 0) {\r
+                                       if (sx + dx < 0)\r
+                                               dx = 0;\r
+       \r
+                                       if (sy + dy < 0)\r
+                                               dy = 0;\r
+\r
+                                       ph.moveTo(sx + dx, sy + dy);\r
+                               }\r
+\r
+                               // Resize if needed\r
+                               if (dw + dh !== 0)\r
+                                       ph.resizeTo(sz.w + dw, sz.h + dh);\r
+\r
+                               return Event.cancel(e);\r
+                       });\r
+\r
+                       return Event.cancel(se);\r
+               },\r
+\r
+               resizeBy : function(dw, dh, id) {\r
+                       var w = this.windows[id];\r
+\r
+                       if (w) {\r
+                               w.element.resizeBy(dw, dh);\r
+                               w.iframeElement.resizeBy(dw, dh);\r
+                       }\r
+               },\r
+\r
+               close : function(win, id) {\r
+                       var t = this, w, d = DOM.doc, fw, id;\r
+\r
+                       id = t._findId(id || win);\r
+\r
+                       // Probably not inline\r
+                       if (!t.windows[id]) {\r
+                               t.parent(win);\r
+                               return;\r
+                       }\r
+\r
+                       t.count--;\r
+\r
+                       if (t.count == 0) {\r
+                               DOM.remove('mceModalBlocker');\r
+                               DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');\r
+                               t.editor.focus();\r
+                       }\r
+\r
+                       if (w = t.windows[id]) {\r
+                               t.onClose.dispatch(t);\r
+                               Event.remove(d, 'mousedown', w.mousedownFunc);\r
+                               Event.remove(d, 'click', w.clickFunc);\r
+                               Event.clear(id);\r
+                               Event.clear(id + '_ifr');\r
+\r
+                               DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak\r
+                               w.element.remove();\r
+                               delete t.windows[id];\r
+\r
+                               fw = t._frontWindow();\r
+\r
+                               if (fw)\r
+                                       t.focus(fw.id);\r
+                       }\r
+               },\r
+               \r
+               // Find front most window\r
+               _frontWindow : function() {\r
+                       var fw, ix = 0;\r
+                       // Find front most window and focus that\r
+                       each (this.windows, function(w) {\r
+                               if (w.zIndex > ix) {\r
+                                       fw = w;\r
+                                       ix = w.zIndex;\r
+                               }\r
+                       });\r
+                       return fw;\r
+               },\r
+\r
+               setTitle : function(w, ti) {\r
+                       var e;\r
+\r
+                       w = this._findId(w);\r
+\r
+                       if (e = DOM.get(w + '_title'))\r
+                               e.innerHTML = DOM.encode(ti);\r
+               },\r
+\r
+               alert : function(txt, cb, s) {\r
+                       var t = this, w;\r
+\r
+                       w = t.open({\r
+                               title : t,\r
+                               type : 'alert',\r
+                               button_func : function(s) {\r
+                                       if (cb)\r
+                                               cb.call(s || t, s);\r
+\r
+                                       t.close(null, w.id);\r
+                               },\r
+                               content : DOM.encode(t.editor.getLang(txt, txt)),\r
+                               inline : 1,\r
+                               width : 400,\r
+                               height : 130\r
+                       });\r
+               },\r
+\r
+               confirm : function(txt, cb, s) {\r
+                       var t = this, w;\r
+\r
+                       w = t.open({\r
+                               title : t,\r
+                               type : 'confirm',\r
+                               button_func : function(s) {\r
+                                       if (cb)\r
+                                               cb.call(s || t, s);\r
+\r
+                                       t.close(null, w.id);\r
+                               },\r
+                               content : DOM.encode(t.editor.getLang(txt, txt)),\r
+                               inline : 1,\r
+                               width : 400,\r
+                               height : 130\r
+                       });\r
+               },\r
+\r
+               // Internal functions\r
+\r
+               _findId : function(w) {\r
+                       var t = this;\r
+\r
+                       if (typeof(w) == 'string')\r
+                               return w;\r
+\r
+                       each(t.windows, function(wo) {\r
+                               var ifr = DOM.get(wo.id + '_ifr');\r
+\r
+                               if (ifr && w == ifr.contentWindow) {\r
+                                       w = wo.id;\r
+                                       return false;\r
+                               }\r
+                       });\r
+\r
+                       return w;\r
+               },\r
+\r
+               _fixIELayout : function(id, s) {\r
+                       var w, img;\r
+\r
+                       if (!tinymce.isIE6)\r
+                               return;\r
+\r
+                       // Fixes the bug where hover flickers and does odd things in IE6\r
+                       each(['n','s','w','e','nw','ne','sw','se'], function(v) {\r
+                               var e = DOM.get(id + '_resize_' + v);\r
+\r
+                               DOM.setStyles(e, {\r
+                                       width : s ? e.clientWidth : '',\r
+                                       height : s ? e.clientHeight : '',\r
+                                       cursor : DOM.getStyle(e, 'cursor', 1)\r
+                               });\r
+\r
+                               DOM.setStyle(id + "_bottom", 'bottom', '-1px');\r
+\r
+                               e = 0;\r
+                       });\r
+\r
+                       // Fixes graphics glitch\r
+                       if (w = this.windows[id]) {\r
+                               // Fixes rendering bug after resize\r
+                               w.element.hide();\r
+                               w.element.show();\r
+\r
+                               // Forced a repaint of the window\r
+                               //DOM.get(id).style.filter = '';\r
+\r
+                               // IE has a bug where images used in CSS won't get loaded\r
+                               // sometimes when the cache in the browser is disabled\r
+                               // This fix tries to solve it by loading the images using the image object\r
+                               each(DOM.select('div,a', id), function(e, i) {\r
+                                       if (e.currentStyle.backgroundImage != 'none') {\r
+                                               img = new Image();\r
+                                               img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');\r
+                                       }\r
+                               });\r
+\r
+                               DOM.get(id).style.filter = '';\r
+                       }\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);\r
+})();\r
+\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/alert.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/alert.gif
new file mode 100644 (file)
index 0000000..2191398
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/alert.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/button.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/button.gif
new file mode 100644 (file)
index 0000000..f957e49
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/button.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif
new file mode 100644 (file)
index 0000000..6baf64a
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif
new file mode 100644 (file)
index 0000000..20acbbf
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/corners.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/corners.gif
new file mode 100644 (file)
index 0000000..d5de1cc
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/corners.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif
new file mode 100644 (file)
index 0000000..c2a2ad4
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif
new file mode 100644 (file)
index 0000000..0b4cc36
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/window.css b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/skins/clearlooks2/window.css
new file mode 100644 (file)
index 0000000..a50d4fc
--- /dev/null
@@ -0,0 +1,90 @@
+/* Clearlooks 2 */
+
+/* Reset */
+.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block}
+
+/* General */
+.clearlooks2 {position:absolute; direction:ltr}
+.clearlooks2 .mceWrapper {position:static}
+.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%}
+.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)}
+.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none}
+
+/* Top */
+.clearlooks2 .mceTop, .clearlooks2 .mceTop div {top:0; width:100%; height:23px}
+.clearlooks2 .mceTop .mceLeft {width:6px; background:url(img/corners.gif)}
+.clearlooks2 .mceTop .mceCenter {right:6px; width:100%; height:23px; background:url(img/horizontal.gif) 12px 0; clip:rect(auto auto auto 12px)}
+.clearlooks2 .mceTop .mceRight {right:0; width:6px; height:23px; background:url(img/corners.gif) -12px 0}
+.clearlooks2 .mceTop span {width:100%; text-align:center; vertical-align:middle; line-height:23px; font-weight:bold}
+.clearlooks2 .mceFocus .mceTop .mceLeft {background:url(img/corners.gif) -6px 0}
+.clearlooks2 .mceFocus .mceTop .mceCenter {background:url(img/horizontal.gif) 0 -23px}
+.clearlooks2 .mceFocus .mceTop .mceRight {background:url(img/corners.gif) -18px 0}
+.clearlooks2 .mceFocus .mceTop span {color:#FFF}
+
+/* Middle */
+.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0}
+.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)}
+.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:url(img/vertical.gif) -5px 0}
+.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF}
+.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:url(img/vertical.gif)}
+
+/* Bottom */
+.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px}
+.clearlooks2 .mceBottom {left:0; bottom:0; width:100%}
+.clearlooks2 .mceBottom div {top:0}
+.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:url(img/corners.gif) -34px -6px}
+.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%; background:url(img/horizontal.gif) 0 -46px}
+.clearlooks2 .mceBottom .mceRight {right:0; width:5px; background: url(img/corners.gif) -34px 0}
+.clearlooks2 .mceBottom span {display:none}
+.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px}
+.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0}
+.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px}
+.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0}
+.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px}
+
+/* Actions */
+.clearlooks2 a {width:29px; height:16px; top:3px;}
+.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0}
+.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0}
+.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0}
+.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0}
+.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px}
+.clearlooks2 .mceMovable .mceMove {display:block}
+.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px}
+.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px}
+.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px}
+.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px}
+.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
+.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
+.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px}
+.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px}
+.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px}
+
+/* Resize */
+.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px}
+.clearlooks2 .mceResizable .mceResize {display:block}
+.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none}
+.clearlooks2 .mceMinimizable .mceMin {display:block}
+.clearlooks2 .mceMaximizable .mceMax {display:block}
+.clearlooks2 .mceMaximized .mceMed {display:block}
+.clearlooks2 .mceMaximized .mceMax {display:none}
+.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize}
+.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize}
+.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize}
+.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;}
+.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize}
+.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
+.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize}
+.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize}
+
+/* Alert/Confirm */
+.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0}
+.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px}
+.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal}
+.clearlooks2 a:hover {font-weight:bold;}
+.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#D6D7D5}
+.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px}
+.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)}
+.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
+.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
+.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/template.htm b/3.x/src/resources/javascript/TinyMCE/plugins/inlinepopups/template.htm
new file mode 100644 (file)
index 0000000..f9ec642
--- /dev/null
@@ -0,0 +1,387 @@
+<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<title>Template for dialogs</title>\r
+<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css" />\r
+</head>\r
+<body>\r
+\r
+<div class="mceEditor">\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:10px;">\r
+               <div class="mceWrapper">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Blured</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:420px;">\r
+               <div class="mceWrapper mceMovable mceFocus">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Focused</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:120px;">\r
+               <div class="mceWrapper mceMovable mceFocus mceStatusbar">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:120px;">\r
+               <div class="mceWrapper mceMovable mceFocus mceStatusbar mceResizable">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar, Resizable</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:230px;">\r
+               <div class="mceWrapper mceMovable mceFocus mceResizable mceMaximizable">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Resizable, Maximizable</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:230px;">\r
+               <div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximizable">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Blurred, Maximizable, Statusbar, Resizable</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:340px;">\r
+               <div class="mceWrapper mceMovable mceFocus mceResizable mceMaximized mceMinimizable mceMaximizable">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Maximized, Maximizable, Minimizable</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:340px;">\r
+               <div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximized mceMinimizable mceMaximizable">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Blured</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>Content</span>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Statusbar text.</span>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceMin" href="#"></a>\r
+                       <a class="mceMax" href="#"></a>\r
+                       <a class="mceMed" href="#"></a>\r
+                       <a class="mceClose" href="#"></a>\r
+                       <a class="mceResize mceResizeN" href="#"></a>\r
+                       <a class="mceResize mceResizeS" href="#"></a>\r
+                       <a class="mceResize mceResizeW" href="#"></a>\r
+                       <a class="mceResize mceResizeE" href="#"></a>\r
+                       <a class="mceResize mceResizeNW" href="#"></a>\r
+                       <a class="mceResize mceResizeNE" href="#"></a>\r
+                       <a class="mceResize mceResizeSW" href="#"></a>\r
+                       <a class="mceResize mceResizeSE" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:130px; left:10px; top:450px;">\r
+               <div class="mceWrapper mceMovable mceFocus mceModal mceAlert">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Alert</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                               </span>\r
+                               <div class="mceRight"></div>\r
+                               <div class="mceIcon"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceButton mceOk" href="#">Ok</a>\r
+                       <a class="mceClose" href="#"></a>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="clearlooks2" style="width:400px; height:130px; left:420px; top:450px;">\r
+               <div class="mceWrapper mceMovable mceFocus mceModal mceConfirm">\r
+                       <div class="mceTop">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                               <span>Confirm</span>\r
+                       </div>\r
+\r
+                       <div class="mceMiddle">\r
+                               <div class="mceLeft"></div>\r
+                               <span>\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       This is a very long error message. This is a very long error message.\r
+                                       </span>\r
+                               <div class="mceRight"></div>\r
+                               <div class="mceIcon"></div>\r
+                       </div>\r
+\r
+                       <div class="mceBottom">\r
+                               <div class="mceLeft"></div>\r
+                               <div class="mceCenter"></div>\r
+                               <div class="mceRight"></div>\r
+                       </div>\r
+\r
+                       <a class="mceMove" href="#"></a>\r
+                       <a class="mceButton mceOk" href="#">Ok</a>\r
+                       <a class="mceButton mceCancel" href="#">Cancel</a>\r
+                       <a class="mceClose" href="#"></a>\r
+               </div>\r
+       </div>\r
+</div>\r
+\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/insertdatetime/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/insertdatetime/editor_plugin.js
new file mode 100644 (file)
index 0000000..938ce6b
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.InsertDateTime",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertDate",function(){var d=c._getDateTime(new Date(),a.getParam("plugin_insertdate_dateFormat",a.getLang("insertdatetime.date_fmt")));a.execCommand("mceInsertContent",false,d)});a.addCommand("mceInsertTime",function(){var d=c._getDateTime(new Date(),a.getParam("plugin_insertdate_timeFormat",a.getLang("insertdatetime.time_fmt")));a.execCommand("mceInsertContent",false,d)});a.addButton("insertdate",{title:"insertdatetime.insertdate_desc",cmd:"mceInsertDate"});a.addButton("inserttime",{title:"insertdatetime.inserttime_desc",cmd:"mceInsertTime"})},getInfo:function(){return{longname:"Insert date/time",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getDateTime:function(e,a){var c=this.editor;function b(g,d){g=""+g;if(g.length<d){for(var f=0;f<(d-g.length);f++){g="0"+g}}return g}a=a.replace("%D","%m/%d/%y");a=a.replace("%r","%I:%M:%S %p");a=a.replace("%Y",""+e.getFullYear());a=a.replace("%y",""+e.getYear());a=a.replace("%m",b(e.getMonth()+1,2));a=a.replace("%d",b(e.getDate(),2));a=a.replace("%H",""+b(e.getHours(),2));a=a.replace("%M",""+b(e.getMinutes(),2));a=a.replace("%S",""+b(e.getSeconds(),2));a=a.replace("%I",""+((e.getHours()+11)%12+1));a=a.replace("%p",""+(e.getHours()<12?"AM":"PM"));a=a.replace("%B",""+c.getLang("insertdatetime.months_long").split(",")[e.getMonth()]);a=a.replace("%b",""+c.getLang("insertdatetime.months_short").split(",")[e.getMonth()]);a=a.replace("%A",""+c.getLang("insertdatetime.day_long").split(",")[e.getDay()]);a=a.replace("%a",""+c.getLang("insertdatetime.day_short").split(",")[e.getDay()]);a=a.replace("%%","%");return a}});tinymce.PluginManager.add("insertdatetime",tinymce.plugins.InsertDateTime)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/insertdatetime/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/insertdatetime/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..181c791
--- /dev/null
@@ -0,0 +1,83 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.InsertDateTime', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       ed.addCommand('mceInsertDate', function() {\r
+                               var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_dateFormat", ed.getLang('insertdatetime.date_fmt')));\r
+\r
+                               ed.execCommand('mceInsertContent', false, str);\r
+                       });\r
+\r
+                       ed.addCommand('mceInsertTime', function() {\r
+                               var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_timeFormat", ed.getLang('insertdatetime.time_fmt')));\r
+\r
+                               ed.execCommand('mceInsertContent', false, str);\r
+                       });\r
+\r
+                       ed.addButton('insertdate', {title : 'insertdatetime.insertdate_desc', cmd : 'mceInsertDate'});\r
+                       ed.addButton('inserttime', {title : 'insertdatetime.inserttime_desc', cmd : 'mceInsertTime'});\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Insert date/time',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _getDateTime : function(d, fmt) {\r
+                       var ed = this.editor;\r
+\r
+                       function addZeros(value, len) {\r
+                               value = "" + value;\r
+\r
+                               if (value.length < len) {\r
+                                       for (var i=0; i<(len-value.length); i++)\r
+                                               value = "0" + value;\r
+                               }\r
+\r
+                               return value;\r
+                       };\r
+\r
+                       fmt = fmt.replace("%D", "%m/%d/%y");\r
+                       fmt = fmt.replace("%r", "%I:%M:%S %p");\r
+                       fmt = fmt.replace("%Y", "" + d.getFullYear());\r
+                       fmt = fmt.replace("%y", "" + d.getYear());\r
+                       fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));\r
+                       fmt = fmt.replace("%d", addZeros(d.getDate(), 2));\r
+                       fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));\r
+                       fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));\r
+                       fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));\r
+                       fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));\r
+                       fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));\r
+                       fmt = fmt.replace("%B", "" + ed.getLang("insertdatetime.months_long").split(',')[d.getMonth()]);\r
+                       fmt = fmt.replace("%b", "" + ed.getLang("insertdatetime.months_short").split(',')[d.getMonth()]);\r
+                       fmt = fmt.replace("%A", "" + ed.getLang("insertdatetime.day_long").split(',')[d.getDay()]);\r
+                       fmt = fmt.replace("%a", "" + ed.getLang("insertdatetime.day_short").split(',')[d.getDay()]);\r
+                       fmt = fmt.replace("%%", "%");\r
+\r
+                       return fmt;\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('insertdatetime', tinymce.plugins.InsertDateTime);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/layer/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/layer/editor_plugin.js
new file mode 100644 (file)
index 0000000..ca3857a
--- /dev/null
@@ -0,0 +1 @@
+(function(){function a(b){do{if(b.className&&b.className.indexOf("mceItemLayer")!=-1){return b}}while(b=b.parentNode)}tinymce.create("tinymce.plugins.Layer",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceInsertLayer",d._insertLayer,d);b.addCommand("mceMoveForward",function(){d._move(1)});b.addCommand("mceMoveBackward",function(){d._move(-1)});b.addCommand("mceMakeAbsolute",function(){d._toggleAbsolute()});b.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});b.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});b.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});b.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});b.onInit.add(function(){var e=b.dom;if(tinymce.isIE){b.getDoc().execCommand("2D-Position",false,true)}});b.onMouseUp.add(function(f,h){var g=a(h.target);if(g){f.dom.setAttrib(g,"data-mce-style","")}});b.onMouseDown.add(function(f,j){var h=j.target,i=f.getDoc(),g;if(tinymce.isGecko){if(a(h)){if(i.designMode!=="on"){i.designMode="on";h=i.body;g=h.parentNode;g.removeChild(h);g.appendChild(h)}}else{if(i.designMode=="on"){i.designMode="off"}}}});b.onNodeChange.add(d._nodeChange,d);b.onVisualAid.add(d._visualAid,d)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(c,b,f){var d,e;d=this._getParentLayer(f);e=c.dom.getParent(f,"DIV,P,IMG");if(!e){b.setDisabled("absolute",1);b.setDisabled("moveforward",1);b.setDisabled("movebackward",1)}else{b.setDisabled("absolute",0);b.setDisabled("moveforward",!d);b.setDisabled("movebackward",!d);b.setActive("absolute",d&&d.style.position.toLowerCase()=="absolute")}},_visualAid:function(b,d,c){var f=b.dom;tinymce.each(f.select("div,p",d),function(g){if(/^(absolute|relative|fixed)$/i.test(g.style.position)){if(c){f.addClass(g,"mceItemVisualAid")}else{f.removeClass(g,"mceItemVisualAid")}f.addClass(g,"mceItemLayer")}})},_move:function(j){var c=this.editor,g,h=[],f=this._getParentLayer(c.selection.getNode()),e=-1,k=-1,b;b=[];tinymce.walk(c.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){b.push(d)}},"childNodes");for(g=0;g<b.length;g++){h[g]=b[g].style.zIndex?parseInt(b[g].style.zIndex):0;if(e<0&&b[g]==f){e=g}}if(j<0){for(g=0;g<h.length;g++){if(h[g]<h[e]){k=g;break}}if(k>-1){b[e].style.zIndex=h[k];b[k].style.zIndex=h[e]}else{if(h[e]>0){b[e].style.zIndex=h[e]-1}}}else{for(g=0;g<h.length;g++){if(h[g]>h[e]){k=g;break}}if(k>-1){b[e].style.zIndex=h[k];b[k].style.zIndex=h[e]}else{b[e].style.zIndex=h[e]+1}}c.execCommand("mceRepaint")},_getParentLayer:function(b){return this.editor.dom.getParent(b,function(c){return c.nodeType==1&&/^(absolute|relative|static)$/i.test(c.style.position)})},_insertLayer:function(){var c=this.editor,e=c.dom,d=e.getPos(e.getParent(c.selection.getNode(),"*")),b=c.getBody();c.dom.add(b,"div",{style:{position:"absolute",left:d.x,top:(d.y>20?d.y:20),width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},c.selection.getContent()||c.getLang("layer.content"));if(tinymce.isIE){e.setHTML(b,b.innerHTML)}},_toggleAbsolute:function(){var b=this.editor,c=this._getParentLayer(b.selection.getNode());if(!c){c=b.dom.getParent(b.selection.getNode(),"DIV,P,IMG")}if(c){if(c.style.position.toLowerCase()=="absolute"){b.dom.setStyles(c,{position:"",left:"",top:"",width:"",height:""});b.dom.removeClass(c,"mceItemVisualAid");b.dom.removeClass(c,"mceItemLayer")}else{if(c.style.left==""){c.style.left=20+"px"}if(c.style.top==""){c.style.top=20+"px"}if(c.style.width==""){c.style.width=c.width?(c.width+"px"):"100px"}if(c.style.height==""){c.style.height=c.height?(c.height+"px"):"100px"}c.style.position="absolute";b.dom.setAttrib(c,"data-mce-style","");b.addVisual(b.getBody())}b.execCommand("mceRepaint");b.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/layer/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/layer/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..daed280
--- /dev/null
@@ -0,0 +1,262 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       function findParentLayer(node) {\r
+               do {\r
+                       if (node.className && node.className.indexOf('mceItemLayer') != -1) {\r
+                               return node;\r
+                       }\r
+               } while (node = node.parentNode);\r
+       };\r
+\r
+       tinymce.create('tinymce.plugins.Layer', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceInsertLayer', t._insertLayer, t);\r
+\r
+                       ed.addCommand('mceMoveForward', function() {\r
+                               t._move(1);\r
+                       });\r
+\r
+                       ed.addCommand('mceMoveBackward', function() {\r
+                               t._move(-1);\r
+                       });\r
+\r
+                       ed.addCommand('mceMakeAbsolute', function() {\r
+                               t._toggleAbsolute();\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('moveforward', {title : 'layer.forward_desc', cmd : 'mceMoveForward'});\r
+                       ed.addButton('movebackward', {title : 'layer.backward_desc', cmd : 'mceMoveBackward'});\r
+                       ed.addButton('absolute', {title : 'layer.absolute_desc', cmd : 'mceMakeAbsolute'});\r
+                       ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'});\r
+\r
+                       ed.onInit.add(function() {\r
+                               var dom = ed.dom;\r
+\r
+                               if (tinymce.isIE)\r
+                                       ed.getDoc().execCommand('2D-Position', false, true);\r
+                       });\r
+\r
+                       // Remove serialized styles when selecting a layer since it might be changed by a drag operation\r
+                       ed.onMouseUp.add(function(ed, e) {\r
+                               var layer = findParentLayer(e.target);\r
+       \r
+                               if (layer) {\r
+                                       ed.dom.setAttrib(layer, 'data-mce-style', '');\r
+                               }\r
+                       });\r
+\r
+                       // Fixes edit focus issues with layers on Gecko\r
+                       // This will enable designMode while inside a layer and disable it when outside\r
+                       ed.onMouseDown.add(function(ed, e) {\r
+                               var node = e.target, doc = ed.getDoc(), parent;\r
+\r
+                               if (tinymce.isGecko) {\r
+                                       if (findParentLayer(node)) {\r
+                                               if (doc.designMode !== 'on') {\r
+                                                       doc.designMode = 'on';\r
+\r
+                                                       // Repaint caret\r
+                                                       node = doc.body;\r
+                                                       parent = node.parentNode;\r
+                                                       parent.removeChild(node);\r
+                                                       parent.appendChild(node);\r
+                                               }\r
+                                       } else if (doc.designMode == 'on') {\r
+                                               doc.designMode = 'off';\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       ed.onNodeChange.add(t._nodeChange, t);\r
+                       ed.onVisualAid.add(t._visualAid, t);\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Layer',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _nodeChange : function(ed, cm, n) {\r
+                       var le, p;\r
+\r
+                       le = this._getParentLayer(n);\r
+                       p = ed.dom.getParent(n, 'DIV,P,IMG');\r
+\r
+                       if (!p) {\r
+                               cm.setDisabled('absolute', 1);\r
+                               cm.setDisabled('moveforward', 1);\r
+                               cm.setDisabled('movebackward', 1);\r
+                       } else {\r
+                               cm.setDisabled('absolute', 0);\r
+                               cm.setDisabled('moveforward', !le);\r
+                               cm.setDisabled('movebackward', !le);\r
+                               cm.setActive('absolute', le && le.style.position.toLowerCase() == "absolute");\r
+                       }\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _visualAid : function(ed, e, s) {\r
+                       var dom = ed.dom;\r
+\r
+                       tinymce.each(dom.select('div,p', e), function(e) {\r
+                               if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {\r
+                                       if (s)\r
+                                               dom.addClass(e, 'mceItemVisualAid');\r
+                                       else\r
+                                               dom.removeClass(e, 'mceItemVisualAid');\r
+\r
+                                       dom.addClass(e, 'mceItemLayer');\r
+                               }\r
+                       });\r
+               },\r
+\r
+               _move : function(d) {\r
+                       var ed = this.editor, i, z = [], le = this._getParentLayer(ed.selection.getNode()), ci = -1, fi = -1, nl;\r
+\r
+                       nl = [];\r
+                       tinymce.walk(ed.getBody(), function(n) {\r
+                               if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position))\r
+                                       nl.push(n); \r
+                       }, 'childNodes');\r
+\r
+                       // Find z-indexes\r
+                       for (i=0; i<nl.length; i++) {\r
+                               z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex) : 0;\r
+\r
+                               if (ci < 0 && nl[i] == le)\r
+                                       ci = i;\r
+                       }\r
+\r
+                       if (d < 0) {\r
+                               // Move back\r
+\r
+                               // Try find a lower one\r
+                               for (i=0; i<z.length; i++) {\r
+                                       if (z[i] < z[ci]) {\r
+                                               fi = i;\r
+                                               break;\r
+                                       }\r
+                               }\r
+\r
+                               if (fi > -1) {\r
+                                       nl[ci].style.zIndex = z[fi];\r
+                                       nl[fi].style.zIndex = z[ci];\r
+                               } else {\r
+                                       if (z[ci] > 0)\r
+                                               nl[ci].style.zIndex = z[ci] - 1;\r
+                               }\r
+                       } else {\r
+                               // Move forward\r
+\r
+                               // Try find a higher one\r
+                               for (i=0; i<z.length; i++) {\r
+                                       if (z[i] > z[ci]) {\r
+                                               fi = i;\r
+                                               break;\r
+                                       }\r
+                               }\r
+\r
+                               if (fi > -1) {\r
+                                       nl[ci].style.zIndex = z[fi];\r
+                                       nl[fi].style.zIndex = z[ci];\r
+                               } else\r
+                                       nl[ci].style.zIndex = z[ci] + 1;\r
+                       }\r
+\r
+                       ed.execCommand('mceRepaint');\r
+               },\r
+\r
+               _getParentLayer : function(n) {\r
+                       return this.editor.dom.getParent(n, function(n) {\r
+                               return n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position);\r
+                       });\r
+               },\r
+\r
+               _insertLayer : function() {\r
+                       var ed = this.editor, dom = ed.dom, p = dom.getPos(dom.getParent(ed.selection.getNode(), '*')), body = ed.getBody();\r
+\r
+                       ed.dom.add(body, 'div', {\r
+                               style : {\r
+                                       position : 'absolute',\r
+                                       left : p.x,\r
+                                       top : (p.y > 20 ? p.y : 20),\r
+                                       width : 100,\r
+                                       height : 100\r
+                               },\r
+                               'class' : 'mceItemVisualAid mceItemLayer'\r
+                       }, ed.selection.getContent() || ed.getLang('layer.content'));\r
+\r
+                       // Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7\r
+                       if (tinymce.isIE)\r
+                               dom.setHTML(body, body.innerHTML);\r
+               },\r
+\r
+               _toggleAbsolute : function() {\r
+                       var ed = this.editor, le = this._getParentLayer(ed.selection.getNode());\r
+\r
+                       if (!le)\r
+                               le = ed.dom.getParent(ed.selection.getNode(), 'DIV,P,IMG');\r
+\r
+                       if (le) {\r
+                               if (le.style.position.toLowerCase() == "absolute") {\r
+                                       ed.dom.setStyles(le, {\r
+                                               position : '',\r
+                                               left : '',\r
+                                               top : '',\r
+                                               width : '',\r
+                                               height : ''\r
+                                       });\r
+\r
+                                       ed.dom.removeClass(le, 'mceItemVisualAid');\r
+                                       ed.dom.removeClass(le, 'mceItemLayer');\r
+                               } else {\r
+                                       if (le.style.left == "")\r
+                                               le.style.left = 20 + 'px';\r
+\r
+                                       if (le.style.top == "")\r
+                                               le.style.top = 20 + 'px';\r
+\r
+                                       if (le.style.width == "")\r
+                                               le.style.width = le.width ? (le.width + 'px') : '100px';\r
+\r
+                                       if (le.style.height == "")\r
+                                               le.style.height = le.height ? (le.height + 'px') : '100px';\r
+\r
+                                       le.style.position = "absolute";\r
+\r
+                                       ed.dom.setAttrib(le, 'data-mce-style', '');\r
+                                       ed.addVisual(ed.getBody());\r
+                               }\r
+\r
+                               ed.execCommand('mceRepaint');\r
+                               ed.nodeChanged();\r
+                       }\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('layer', tinymce.plugins.Layer);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/legacyoutput/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/legacyoutput/editor_plugin.js
new file mode 100644 (file)
index 0000000..2ed5f41
--- /dev/null
@@ -0,0 +1 @@
+(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(f){d.addValidElements(f+"[*]")});if(!d.getElementRule("font")){d.addValidElements("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.getElementRule(f),g;if(h){if(!h.attributes.align){h.attributes.align={};h.attributesOrder.push("align")}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/legacyoutput/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/legacyoutput/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..3cdcde5
--- /dev/null
@@ -0,0 +1,139 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ *\r
+ * This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align\r
+ * attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash\r
+ *\r
+ * However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are\r
+ * not apart of the newer specifications for HTML and XHTML.\r
+ */\r
+\r
+(function(tinymce) {\r
+       // Override inline_styles setting to force TinyMCE to produce deprecated contents\r
+       tinymce.onAddEditor.addToTop(function(tinymce, editor) {\r
+               editor.settings.inline_styles = false;\r
+       });\r
+\r
+       // Create the legacy ouput plugin\r
+       tinymce.create('tinymce.plugins.LegacyOutput', {\r
+               init : function(editor) {\r
+                       editor.onInit.add(function() {\r
+                               var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',\r
+                                       fontSizes = tinymce.explode(editor.settings.font_size_style_values),\r
+                                       schema = editor.schema;\r
+\r
+                               // Override some internal formats to produce legacy elements and attributes\r
+                               editor.formatter.register({\r
+                                       // Change alignment formats to use the deprecated align attribute\r
+                                       alignleft : {selector : alignElements, attributes : {align : 'left'}},\r
+                                       aligncenter : {selector : alignElements, attributes : {align : 'center'}},\r
+                                       alignright : {selector : alignElements, attributes : {align : 'right'}},\r
+                                       alignfull : {selector : alignElements, attributes : {align : 'justify'}},\r
+\r
+                                       // Change the basic formatting elements to use deprecated element types
+                                       bold : [\r
+                                               {inline : 'b', remove : 'all'},\r
+                                               {inline : 'strong', remove : 'all'},\r
+                                               {inline : 'span', styles : {fontWeight : 'bold'}}\r
+                                       ],\r
+                                       italic : [\r
+                                               {inline : 'i', remove : 'all'},\r
+                                               {inline : 'em', remove : 'all'},\r
+                                               {inline : 'span', styles : {fontStyle : 'italic'}}\r
+                                       ],\r
+                                       underline : [\r
+                                               {inline : 'u', remove : 'all'},\r
+                                               {inline : 'span', styles : {textDecoration : 'underline'}, exact : true}\r
+                                       ],\r
+                                       strikethrough : [\r
+                                               {inline : 'strike', remove : 'all'},\r
+                                               {inline : 'span', styles : {textDecoration: 'line-through'}, exact : true}\r
+                                       ],
+\r
+                                       // Change font size and font family to use the deprecated font element\r
+                                       fontname : {inline : 'font', attributes : {face : '%value'}},\r
+                                       fontsize : {\r
+                                               inline : 'font',\r
+                                               attributes : {\r
+                                                       size : function(vars) {\r
+                                                               return tinymce.inArray(fontSizes, vars.value) + 1;\r
+                                                       }\r
+                                               }\r
+                                       },\r
+\r
+                                       // Setup font elements for colors as well\r
+                                       forecolor : {inline : 'font', attributes : {color : '%value'}},\r
+                                       hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}}\r
+                               });\r
+\r
+                               // Check that deprecated elements are allowed if not add them\r
+                               tinymce.each('b,i,u,strike'.split(','), function(name) {\r
+                                       schema.addValidElements(name + '[*]');\r
+                               });\r
+\r
+                               // Add font element if it's missing\r
+                               if (!schema.getElementRule("font"))\r
+                                       schema.addValidElements("font[face|size|color|style]");\r
+\r
+                               // Add the missing and depreacted align attribute for the serialization engine\r
+                               tinymce.each(alignElements.split(','), function(name) {\r
+                                       var rule = schema.getElementRule(name), found;\r
+\r
+                                       if (rule) {\r
+                                               if (!rule.attributes.align) {\r
+                                                       rule.attributes.align = {};\r
+                                                       rule.attributesOrder.push('align');\r
+                                               }\r
+                                       }\r
+                               });\r
+\r
+                               // Listen for the onNodeChange event so that we can do special logic for the font size and font name drop boxes\r
+                               editor.onNodeChange.add(function(editor, control_manager) {\r
+                                       var control, fontElm, fontName, fontSize;\r
+\r
+                                       // Find font element get it's name and size\r
+                                       fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');\r
+                                       if (fontElm) {\r
+                                               fontName = fontElm.face;\r
+                                               fontSize = fontElm.size;\r
+                                       }\r
+\r
+                                       // Select/unselect the font name in droplist\r
+                                       if (control = control_manager.get('fontselect')) {\r
+                                               control.select(function(value) {\r
+                                                       return value == fontName;\r
+                                               });\r
+                                       }\r
+\r
+                                       // Select/unselect the font size in droplist\r
+                                       if (control = control_manager.get('fontsizeselect')) {\r
+                                               control.select(function(value) {\r
+                                                       var index = tinymce.inArray(fontSizes, value.fontSize);\r
+\r
+                                                       return index + 1 == fontSize;\r
+                                               });\r
+                                       }\r
+                               });\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'LegacyOutput',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('legacyoutput', tinymce.plugins.LegacyOutput);\r
+})(tinymce);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/lists/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/lists/editor_plugin.js
new file mode 100644 (file)
index 0000000..ec21b25
--- /dev/null
@@ -0,0 +1 @@
+(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{return v&&u.tagName==="P"&&t.tagName==="P"}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(y){var v="TABBING";var s="EMPTY";var J="ESCAPE";var z="PARAGRAPH";var N="UNKNOWN";var x=N;function E(U){return U.keyCode===tinymce.VK.TAB&&!(U.altKey||U.ctrlKey)&&(y.queryCommandState("InsertUnorderedList")||y.queryCommandState("InsertOrderedList"))}function w(){var U=B();var W=U.parentNode.parentNode;var V=U.parentNode.lastChild===U;return V&&!t(W)&&P(U)}function t(U){if(n(U)){return U.parentNode&&U.parentNode.tagName==="LI"}else{return U.tagName==="LI"}}function F(){return y.selection.isCollapsed()&&P(B())}function B(){var U=y.selection.getStart();return((U.tagName=="BR"||U.tagName=="")&&U.parentNode.tagName=="LI")?U.parentNode:U}function P(U){var V=U.childNodes.length;if(U.tagName==="LI"){return V==0?true:V==1&&(U.firstChild.tagName==""||U.firstChild.tagName=="BR"||H(U))}return false}function H(U){var V=tinymce.grep(U.parentNode.childNodes,function(Y){return Y.tagName=="LI"});var W=U==V[V.length-1];var X=U.firstChild;return tinymce.isIE9&&W&&(X.nodeValue==String.fromCharCode(160)||X.nodeValue==String.fromCharCode(32))}function T(U){return U.keyCode===tinymce.VK.ENTER}function A(U){return T(U)&&!U.shiftKey}function M(U){if(E(U)){return v}else{if(A(U)&&w()){return N}else{if(A(U)&&F()){return s}else{return N}}}}function D(U,V){if(x==v||x==s||tinymce.isGecko&&x==J){r.cancel(V)}}function C(){var U=y.selection.getRng(true);var V=U.startContainer;if(V.nodeType==3){var W=V.nodeValue;if(tinymce.isIE9&&W.length>1&&W.charCodeAt(W.length-1)==32){return(U.endOffset==W.length-1)}else{return(U.endOffset==W.length)}}else{if(V.nodeType==1){return U.endOffset==V.childNodes.length}}return false}function I(){var W=y.selection.getNode();var V="h1,h2,h3,h4,h5,h6,p,div";var U=y.dom.is(W,V)&&W.parentNode.tagName==="LI"&&W.parentNode.lastChild===W;return y.selection.isCollapsed()&&U&&C()}function K(W,Y){if(A(Y)&&I()){var X=W.selection.getNode();var V=W.dom.create("li");var U=W.dom.getParent(X,"li");W.dom.insertAfter(V,U);if(tinymce.isIE6||tinymce.isIE7||tinyMCE.isIE8){W.selection.setCursorLocation(V,1)}else{W.selection.setCursorLocation(V,0)}Y.preventDefault()}}function u(X,Z){var ac;if(!tinymce.isGecko){return}var V=X.selection.getStart();if(Z.keyCode!=tinymce.VK.BACKSPACE||V.tagName!=="IMG"){return}function W(ag){var ah=ag.firstChild;var af=null;do{if(!ah){break}if(ah.tagName==="LI"){af=ah}}while(ah=ah.nextSibling);return af}function ae(ag,af){while(ag.childNodes.length>0){af.appendChild(ag.childNodes[0])}}ac=V.parentNode.previousSibling;if(!ac){return}var aa;if(ac.tagName==="UL"||ac.tagName==="OL"){aa=ac}else{if(ac.previousSibling&&(ac.previousSibling.tagName==="UL"||ac.previousSibling.tagName==="OL")){aa=ac.previousSibling}else{return}}var ad=W(aa);var U=X.dom.createRng();U.setStart(ad,1);U.setEnd(ad,1);X.selection.setRng(U);X.selection.collapse(true);var Y=X.selection.getBookmark();var ab=V.parentNode.cloneNode(true);if(ab.tagName==="P"||ab.tagName==="DIV"){ae(ab,ad)}else{ad.appendChild(ab)}V.parentNode.parentNode.removeChild(V.parentNode);X.selection.moveToBookmark(Y)}function G(U){var V=y.dom.getParent(U,"ol,ul");if(V!=null){var W=V.lastChild;y.selection.setCursorLocation(W,0)}}this.ed=y;y.addCommand("Indent",this.indent,this);y.addCommand("Outdent",this.outdent,this);y.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);y.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);y.onInit.add(function(){y.editorCommands.addCommands({outdent:function(){var V=y.selection,W=y.dom;function U(X){X=W.getParent(X,W.isBlock);return X&&(parseInt(y.dom.getStyle(X,"margin-left")||0,10)+parseInt(y.dom.getStyle(X,"padding-left")||0,10))>0}return U(V.getStart())||U(V.getEnd())||y.queryCommandState("InsertOrderedList")||y.queryCommandState("InsertUnorderedList")}},"state")});y.onKeyUp.add(function(V,W){if(x==v){V.execCommand(W.shiftKey?"Outdent":"Indent",true,null);x=N;return r.cancel(W)}else{if(x==s){var U=B();var Y=V.settings.list_outdent_on_enter===true||W.shiftKey;V.execCommand(Y?"Outdent":"Indent",true,null);if(tinymce.isIE){G(U)}return r.cancel(W)}else{if(x==J){if(tinymce.isIE6||tinymce.isIE7||tinymce.isIE8){var X=V.getDoc().createTextNode("\uFEFF");V.selection.getNode().appendChild(X)}else{if(tinymce.isIE9||tinymce.isGecko){V.execCommand("Outdent");return r.cancel(W)}}}}}});function L(V,U){var W=y.getDoc().createTextNode("\uFEFF");V.insertBefore(W,U);y.selection.setCursorLocation(W,0);y.execCommand("mceRepaint")}function R(V,X){if(T(X)){var U=B();if(U){var W=U.parentNode;var Y=W&&W.parentNode;if(Y&&Y.nodeName=="LI"&&Y.firstChild==W&&U==W.firstChild){L(Y,W)}}}}function S(V,X){if(T(X)){var U=B();if(V.dom.select("ul li",U).length===1){var W=U.firstChild;L(U,W)}}}function Q(W,aa){function X(ab){var ad=[];var ae=new tinymce.dom.TreeWalker(ab.firstChild,ab);for(var ac=ae.current();ac;ac=ae.next()){if(W.dom.is(ac,"ol,ul,li")){ad.push(ac)}}return ad}if(aa.keyCode==tinymce.VK.BACKSPACE){var U=B();if(U){var Z=W.dom.getParent(U,"ol,ul"),V=W.selection.getRng();if(Z&&Z.firstChild===U&&V.startOffset==0){var Y=X(U);Y.unshift(U);W.execCommand("Outdent",false,Y);W.undoManager.add();return r.cancel(aa)}}}}function O(V,X){var U=B();if(X.keyCode===tinymce.VK.BACKSPACE&&V.dom.is(U,"li")&&U.parentNode.firstChild!==U){if(V.dom.select("ul,ol",U).length===1){var Z=U.previousSibling;V.dom.remove(V.dom.select("br",U));V.dom.remove(U,true);var W=tinymce.grep(Z.childNodes,function(aa){return aa.nodeType===3});if(W.length===1){var Y=W[0];V.selection.setCursorLocation(Y,Y.length)}V.undoManager.add();return r.cancel(X)}}}y.onKeyDown.add(function(U,V){x=M(V)});y.onKeyDown.add(D);y.onKeyDown.add(u);y.onKeyDown.add(K);if(tinymce.isGecko){y.onKeyUp.add(R)}if(tinymce.isIE8){y.onKeyUp.add(S)}if(tinymce.isGecko||tinymce.isWebKit){y.onKeyDown.add(Q)}if(tinymce.isWebKit){y.onKeyDown.add(O)}},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(t){if(t.tagName==="LI"&&(M.tagName==="P"||G.length>1)){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true)}return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(P,L,N){var t,O=P,M;while(!I.isBlock(P.parentNode)&&P.parentNode!==I.getRoot()){P=I.split(P.parentNode,P.previousSibling);P=P.nextSibling;O=P}if(N){t=N.cloneNode(true);P.parentNode.insertBefore(t,P);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");P.parentNode.insertBefore(t,P)}while(O&&O!=L){M=O.nextSibling;t.appendChild(O);O=M}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(U){if(U.hasAttribute&&U.hasAttribute("_mce_bogus")){return true}if(P(N,U)){I.addClass(U,"_mce_tagged_br");N=S(U)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w&&!H||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D,elements:this.selectedBlocks()}}else{B={defaultAction:x,elements:this.selectedBlocks(),processEvenIfEmpty:true}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true),elements:this.selectedBlocks()})},outdent:function(y,x){var w=this,u=w.ed,z=u.dom,s=[];function A(t){var C,B,D;if(!d(u,t,s)){if(z.getStyle(t,"margin-left")!==""||z.getStyle(t,"padding-left")!==""){return w.adjustPaddingFunction(false)(t)}D=z.getStyle(t,"text-align",true);if(D==="center"||D==="right"){z.setStyle(t,"text-align","left");return}t=c(t,z);C=t.parentNode;B=t.parentNode.parentNode;if(B.tagName==="P"){z.split(B,t.parentNode)}else{z.split(C,t);if(B.tagName==="LI"){z.split(B,t)}else{if(!z.is(B,"ol,ul")){z.rename(t,"p")}}}s.push(t)}}var v=x&&tinymce.is(x,"array")?x:this.selectedBlocks();this.process({LI:A,defaultAction:this.adjustPaddingFunction(false),elements:v});e(s,m)},process:function(y){var F=this,w=F.ed.selection,z=F.ed.dom,E,u;function B(t){var s=tinymce.grep(t.childNodes,function(H){return !(H.nodeName==="BR"||H.nodeName==="SPAN"&&z.getAttrib(H,"data-mce-type")=="bookmark"||H.nodeType==3&&(H.nodeValue==String.fromCharCode(160)||H.nodeValue==""))});return s.length===0}function x(s){z.removeClass(s,"_mce_act_on");if(!s||s.nodeType!==1||!y.processEvenIfEmpty&&E.length>1&&B(s)){return}s=k(s,z);var t=y[s.tagName];if(!t){t=y.defaultAction}t(s)}function v(s){F.splitSafeEach(s.childNodes,x,true)}function C(s,t){return t>=0&&s.hasChildNodes()&&t<s.childNodes.length&&s.childNodes[t].tagName==="BR"}function D(){var t=w.getNode();var s=z.getParent(t,"td");return s!==null}E=y.elements;u=w.getRng(true);if(!u.collapsed){if(C(u.endContainer,u.endOffset-1)){u.setEnd(u.endContainer,u.endOffset-1);w.setRng(u)}if(C(u.startContainer,u.startOffset)){u.setStart(u.startContainer,u.startOffset+1);w.setRng(u)}}if(tinymce.isIE8){var G=F.ed.selection.getNode();if(G.tagName==="LI"&&!(G.parentNode.lastChild===G)){var A=F.ed.getDoc().createTextNode("\uFEFF");G.appendChild(A)}}g=w.getBookmark();y.OL=y.UL=v;F.splitSafeEach(E,x);w.moveToBookmark(g);g=null;if(!D()){F.ed.execCommand("mceRepaint")}},splitSafeEach:function(u,t,s){if(s||(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent)))){this.classBasedEach(u,t)}else{e(u,t)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},selectedBlocks:function(){var s=this.ed,t=s.selection.getSelectedBlocks();return t.length==0?[s.dom.getRoot()]:t},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}());
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/lists/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/lists/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..1000ef7
--- /dev/null
@@ -0,0 +1,955 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2011, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       var each = tinymce.each, Event = tinymce.dom.Event, bookmark;
+
+       // Skips text nodes that only contain whitespace since they aren't semantically important.
+       function skipWhitespaceNodes(e, next) {
+               while (e && (e.nodeType === 8 || (e.nodeType === 3 && /^[ \t\n\r]*$/.test(e.nodeValue)))) {
+                       e = next(e);
+               }
+               return e;
+       }
+
+       function skipWhitespaceNodesBackwards(e) {
+               return skipWhitespaceNodes(e, function(e) {
+                       return e.previousSibling;
+               });
+       }
+
+       function skipWhitespaceNodesForwards(e) {
+               return skipWhitespaceNodes(e, function(e) {
+                       return e.nextSibling;
+               });
+       }
+
+       function hasParentInList(ed, e, list) {
+               return ed.dom.getParent(e, function(p) {
+                       return tinymce.inArray(list, p) !== -1;
+               });
+       }
+
+       function isList(e) {
+               return e && (e.tagName === 'OL' || e.tagName === 'UL');
+       }
+
+       function splitNestedLists(element, dom) {
+               var tmp, nested, wrapItem;
+               tmp = skipWhitespaceNodesBackwards(element.lastChild);
+               while (isList(tmp)) {
+                       nested = tmp;
+                       tmp = skipWhitespaceNodesBackwards(nested.previousSibling);
+               }
+               if (nested) {
+                       wrapItem = dom.create('li', { style: 'list-style-type: none;'});
+                       dom.split(element, nested);
+                       dom.insertAfter(wrapItem, nested);
+                       wrapItem.appendChild(nested);
+                       wrapItem.appendChild(nested);
+                       element = wrapItem.previousSibling;
+               }
+               return element;
+       }
+
+       function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {
+               e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);
+               return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);
+       }
+
+       function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {
+               var prev = skipWhitespaceNodesBackwards(e.previousSibling);
+               if (prev) {
+                       return attemptMerge(prev, e, allowDifferentListStyles ? prev : false, mergeParagraphs);
+               } else {
+                       return e;
+               }
+       }
+
+       function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {
+               var next = skipWhitespaceNodesForwards(e.nextSibling);
+               if (next) {
+                       return attemptMerge(e, next, allowDifferentListStyles ? next : false, mergeParagraphs);
+               } else {
+                       return e;
+               }
+       }
+
+       function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {
+               if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {
+                       return merge(e1, e2, differentStylesMasterElement);
+               } else if (e1 && e1.tagName === 'LI' && isList(e2)) {
+                       // Fix invalidly nested lists.
+                       e1.appendChild(e2);
+               }
+               return e2;
+       }
+
+       function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {
+               if (!e1 || !e2) {
+                       return false;
+               } else if (e1.tagName === 'LI' && e2.tagName === 'LI') {
+                       return e2.style.listStyleType === 'none' || containsOnlyAList(e2);
+               } else if (isList(e1)) {
+                       return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);
+               } else return mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P';
+       }
+
+       function isListForIndent(e) {
+               var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);
+               return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));
+       }
+
+       function containsOnlyAList(e) {
+               var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);
+               return firstChild && lastChild && firstChild === lastChild && isList(firstChild);
+       }
+
+       function merge(e1, e2, masterElement) {
+               var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);
+               if (e1.tagName === 'P') {
+                       e1.appendChild(e1.ownerDocument.createElement('br'));
+               }
+               while (e2.firstChild) {
+                       e1.appendChild(e2.firstChild);
+               }
+               if (masterElement) {
+                       e1.style.listStyleType = masterElement.style.listStyleType;
+               }
+               e2.parentNode.removeChild(e2);
+               attemptMerge(lastOriginal, firstNew, false);
+               return e1;
+       }
+
+       function findItemToOperateOn(e, dom) {
+               var item;
+               if (!dom.is(e, 'li,ol,ul')) {
+                       item = dom.getParent(e, 'li');
+                       if (item) {
+                               e = item;
+                       }
+               }
+               return e;
+       }
+
+       tinymce.create('tinymce.plugins.Lists', {
+               init: function(ed) {
+                       var LIST_TABBING = 'TABBING';
+                       var LIST_EMPTY_ITEM = 'EMPTY';
+                       var LIST_ESCAPE = 'ESCAPE';
+                       var LIST_PARAGRAPH = 'PARAGRAPH';
+                       var LIST_UNKNOWN = 'UNKNOWN';
+                       var state = LIST_UNKNOWN;
+
+                       function isTabInList(e) {
+                               // Don't indent on Ctrl+Tab or Alt+Tab
+                               return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) &&
+                                       (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
+                       }
+
+                       function isOnLastListItem() {
+                               var li = getLi();
+                               var grandParent = li.parentNode.parentNode;
+                               var isLastItem = li.parentNode.lastChild === li;
+                               return isLastItem && !isNestedList(grandParent) && isEmptyListItem(li);
+                       }
+
+                       function isNestedList(grandParent) {
+                               if (isList(grandParent)) {
+                                       return grandParent.parentNode && grandParent.parentNode.tagName === 'LI';
+                               } else {
+                                       return  grandParent.tagName === 'LI';
+                               }
+                       }
+
+                       function isInEmptyListItem() {
+                               return ed.selection.isCollapsed() && isEmptyListItem(getLi());
+                       }
+
+                       function getLi() {
+                               var n = ed.selection.getStart();
+                               // Get start will return BR if the LI only contains a BR or an empty element as we use these to fix caret position
+                               return ((n.tagName == 'BR' || n.tagName == '') && n.parentNode.tagName == 'LI') ? n.parentNode : n;
+                       }
+
+                       function isEmptyListItem(li) {
+                               var numChildren = li.childNodes.length;
+                               if (li.tagName === 'LI') {
+                                       return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || li.firstChild.tagName == 'BR' || isEmptyIE9Li(li));
+                               }
+                               return false;
+                       }
+
+                       function isEmptyIE9Li(li) {
+                               // only consider this to be last item if there is no list item content or that content is nbsp or space since IE9 creates these
+                               var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.tagName == 'LI'});
+                               var isLastLi = li == lis[lis.length - 1];
+                               var child = li.firstChild;
+                               return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32));
+                       }
+
+                       function isEnter(e) {
+                               return e.keyCode === tinymce.VK.ENTER;
+                       }
+
+                       function isEnterWithoutShift(e) {
+                               return isEnter(e) && !e.shiftKey;
+                       }
+
+                       function getListKeyState(e) {
+                               if (isTabInList(e)) {
+                                       return LIST_TABBING;
+                               } else if (isEnterWithoutShift(e) && isOnLastListItem()) {
+                                       // Returns LIST_UNKNOWN since breaking out of lists is handled by the EnterKey.js logic now
+                                       //return LIST_ESCAPE;
+                                       return LIST_UNKNOWN;
+                               } else if (isEnterWithoutShift(e) && isInEmptyListItem()) {
+                                       return LIST_EMPTY_ITEM;
+                               } else {
+                                       return LIST_UNKNOWN;
+                               }
+                       }
+
+                       function cancelDefaultEvents(ed, e) {
+                               // list escape is done manually using outdent as it does not create paragraphs correctly in td's
+                               if (state == LIST_TABBING || state == LIST_EMPTY_ITEM || tinymce.isGecko && state == LIST_ESCAPE) {
+                                       Event.cancel(e);
+                               }
+                       }
+
+                       function isCursorAtEndOfContainer() {
+                               var range = ed.selection.getRng(true);
+                               var startContainer = range.startContainer;
+                               if (startContainer.nodeType == 3) {
+                                       var value = startContainer.nodeValue;
+                                       if (tinymce.isIE9 && value.length > 1 && value.charCodeAt(value.length-1) == 32) {
+                                               // IE9 places a space on the end of the text in some cases so ignore last char
+                                               return (range.endOffset == value.length-1);
+                                       } else {
+                                               return (range.endOffset == value.length);
+                                       }
+                               } else if (startContainer.nodeType == 1) {
+                                       return range.endOffset == startContainer.childNodes.length;
+                               }
+                               return false;
+                       }
+
+                       /*
+                               If we are at the end of a list item surrounded with an element, pressing enter should create a
+                               new list item instead without splitting the element e.g. don't want to create new P or H1 tag
+                         */
+                       function isEndOfListItem() {
+                               var node = ed.selection.getNode();
+                               var validElements = 'h1,h2,h3,h4,h5,h6,p,div';
+                               var isLastParagraphOfLi = ed.dom.is(node, validElements) && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node;
+                               return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer();
+                       }
+
+                       // Creates a new list item after the current selection's list item parent
+                       function createNewLi(ed, e) {
+                               if (isEnterWithoutShift(e) && isEndOfListItem()) {
+                                       var node = ed.selection.getNode();
+                                       var li = ed.dom.create("li");
+                                       var parentLi = ed.dom.getParent(node, 'li');
+                                       ed.dom.insertAfter(li, parentLi);
+
+                                       // Move caret to new list element.
+                                       if (tinymce.isIE6 || tinymce.isIE7 || tinyMCE.isIE8) {
+                                               // Removed this line since it would create an odd <&nbsp;> tag and placing the caret inside an empty LI is handled and should be handled by the selection logic
+                                               //li.appendChild(ed.dom.create("&nbsp;")); // IE needs an element within the bullet point
+                                               ed.selection.setCursorLocation(li, 1);
+                                       } else {
+                                               ed.selection.setCursorLocation(li, 0);
+                                       }
+                                       e.preventDefault();
+                               }
+                       }
+
+                       function imageJoiningListItem(ed, e) {
+                               var prevSibling;
+
+                               if (!tinymce.isGecko)
+                                       return;
+
+                               var n = ed.selection.getStart();
+                               if (e.keyCode != tinymce.VK.BACKSPACE || n.tagName !== 'IMG')
+                                       return;
+
+                               function lastLI(node) {
+                                       var child = node.firstChild;
+                                       var li = null;
+                                       do {
+                                               if (!child)
+                                                       break;
+
+                                               if (child.tagName === 'LI')
+                                                       li = child;
+                                       } while (child = child.nextSibling);
+
+                                       return li;
+                               }
+
+                               function addChildren(parentNode, destination) {
+                                       while (parentNode.childNodes.length > 0)
+                                               destination.appendChild(parentNode.childNodes[0]);
+                               }
+
+                               // Check if there is a previous sibling
+                               prevSibling = n.parentNode.previousSibling;
+                               if (!prevSibling)
+                                       return;
+
+                               var ul;
+                               if (prevSibling.tagName === 'UL' || prevSibling.tagName === 'OL')
+                                       ul = prevSibling;
+                               else if (prevSibling.previousSibling && (prevSibling.previousSibling.tagName === 'UL' || prevSibling.previousSibling.tagName === 'OL'))
+                                       ul = prevSibling.previousSibling;
+                               else
+                                       return;
+
+                               var li = lastLI(ul);
+
+                               // move the caret to the end of the list item
+                               var rng = ed.dom.createRng();
+                               rng.setStart(li, 1);
+                               rng.setEnd(li, 1);
+                               ed.selection.setRng(rng);
+                               ed.selection.collapse(true);
+
+                               // save a bookmark at the end of the list item
+                               var bookmark = ed.selection.getBookmark();
+
+                               // copy the image an its text to the list item
+                               var clone = n.parentNode.cloneNode(true);
+                               if (clone.tagName === 'P' || clone.tagName === 'DIV')
+                                       addChildren(clone, li);
+                               else
+                                       li.appendChild(clone);
+
+                               // remove the old copy of the image
+                               n.parentNode.parentNode.removeChild(n.parentNode);
+
+                               // move the caret where we saved the bookmark
+                               ed.selection.moveToBookmark(bookmark);
+                       }
+
+                       // fix the cursor position to ensure it is correct in IE
+                       function setCursorPositionToOriginalLi(li) {
+                               var list = ed.dom.getParent(li, 'ol,ul');
+                               if (list != null) {
+                                       var lastLi = list.lastChild;
+                                       // Removed this line since IE9 would report an DOM character error and placing the caret inside an empty LI is handled and should be handled by the selection logic
+                                       //lastLi.appendChild(ed.getDoc().createElement(''));
+                                       ed.selection.setCursorLocation(lastLi, 0);
+                               }
+                       }
+
+                       this.ed = ed;
+                       ed.addCommand('Indent', this.indent, this);
+                       ed.addCommand('Outdent', this.outdent, this);
+                       ed.addCommand('InsertUnorderedList', function() {
+                               this.applyList('UL', 'OL');
+                       }, this);
+                       ed.addCommand('InsertOrderedList', function() {
+                               this.applyList('OL', 'UL');
+                       }, this);
+
+                       ed.onInit.add(function() {
+                               ed.editorCommands.addCommands({
+                                       'outdent': function() {
+                                               var sel = ed.selection, dom = ed.dom;
+
+                                               function hasStyleIndent(n) {
+                                                       n = dom.getParent(n, dom.isBlock);
+                                                       return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;
+                                               }
+
+                                               return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');
+                                       }
+                               }, 'state');
+                       });
+
+                       ed.onKeyUp.add(function(ed, e) {
+                               if (state == LIST_TABBING) {
+                                       ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
+                                       state = LIST_UNKNOWN;
+                                       return Event.cancel(e);
+                               } else if (state == LIST_EMPTY_ITEM) {
+                                       var li = getLi();
+                                       var shouldOutdent =  ed.settings.list_outdent_on_enter === true || e.shiftKey;
+                                       ed.execCommand(shouldOutdent ? 'Outdent' : 'Indent', true, null);
+                                       if (tinymce.isIE) {
+                                               setCursorPositionToOriginalLi(li);
+                                       }
+
+                                       return Event.cancel(e);
+                               } else if (state == LIST_ESCAPE) {
+                                       if (tinymce.isIE6 || tinymce.isIE7 || tinymce.isIE8) {
+                                               // append a zero sized nbsp so that caret is positioned correctly in IE after escaping and applying formatting.
+                                               // if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after
+                                               // escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.
+                                               var n = ed.getDoc().createTextNode('\uFEFF');
+                                               ed.selection.getNode().appendChild(n);
+                                       } else if (tinymce.isIE9 || tinymce.isGecko) {
+                                               // IE9 does not escape the list so we use outdent to do this and cancel the default behaviour
+                                               // Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves
+                                               ed.execCommand('Outdent');
+                                               return Event.cancel(e);
+                                       }
+                               }
+                       });
+
+                       function fixListItem(parent, reference) {
+                               // a zero-sized non-breaking space is placed in the empty list item so that the nested list is
+                               // displayed on the below line instead of next to it
+                               var n = ed.getDoc().createTextNode('\uFEFF');
+                               parent.insertBefore(n, reference);
+                               ed.selection.setCursorLocation(n, 0);
+                               // repaint to remove rendering artifact. only visible when creating new list
+                               ed.execCommand('mceRepaint');
+                       }
+
+                       function fixIndentedListItemForGecko(ed, e) {
+                               if (isEnter(e)) {
+                                       var li = getLi();
+                                       if (li) {
+                                               var parent = li.parentNode;
+                                               var grandParent = parent && parent.parentNode;
+                                               if (grandParent && grandParent.nodeName == 'LI' && grandParent.firstChild == parent && li == parent.firstChild) {
+                                                       fixListItem(grandParent, parent);
+                                               }
+                                       }
+                               }
+                       }
+
+                       function fixIndentedListItemForIE8(ed, e) {
+                               if (isEnter(e)) {
+                                       var li = getLi();
+                                       if (ed.dom.select('ul li', li).length === 1) {
+                                               var list = li.firstChild;
+                                               fixListItem(li, list);
+                                       }
+                               }
+                       }
+
+                       function fixDeletingFirstCharOfList(ed, e) {
+                               function listElements(li) {
+                                       var elements = [];
+                                       var walker = new tinymce.dom.TreeWalker(li.firstChild, li);
+                                       for (var node = walker.current(); node; node = walker.next()) {
+                                               if (ed.dom.is(node, 'ol,ul,li')) {
+                                                       elements.push(node);
+                                               }
+                                       }
+                                       return elements;
+                               }
+
+                               if (e.keyCode == tinymce.VK.BACKSPACE) {
+                                       var li = getLi();
+                                       if (li) {
+                                               var list = ed.dom.getParent(li, 'ol,ul'),
+                                                       rng  = ed.selection.getRng();
+                                               if (list && list.firstChild === li && rng.startOffset == 0) {
+                                                       var elements = listElements(li);
+                                                       elements.unshift(li);
+                                                       ed.execCommand("Outdent", false, elements);
+                                                       ed.undoManager.add();
+                                                       return Event.cancel(e);
+                                               }
+                                       }
+                               }
+                       }
+
+                       function fixDeletingEmptyLiInWebkit(ed, e) {
+                               var li = getLi();
+                               if (e.keyCode === tinymce.VK.BACKSPACE && ed.dom.is(li, 'li') && li.parentNode.firstChild!==li) {
+                                       if (ed.dom.select('ul,ol', li).length === 1) {
+                                               var prevLi = li.previousSibling;
+                                               ed.dom.remove(ed.dom.select('br', li));
+                                               ed.dom.remove(li, true);
+                                               var textNodes = tinymce.grep(prevLi.childNodes, function(n){ return n.nodeType === 3 });
+                                               if (textNodes.length === 1) {
+                                                       var textNode = textNodes[0];
+                                                       ed.selection.setCursorLocation(textNode, textNode.length);
+                                               }
+                                               ed.undoManager.add();
+                                               return Event.cancel(e);
+                                       }
+                               }
+                       }
+
+                       ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });
+                       ed.onKeyDown.add(cancelDefaultEvents);
+                       ed.onKeyDown.add(imageJoiningListItem);
+                       ed.onKeyDown.add(createNewLi);
+
+                       if (tinymce.isGecko) {
+                               ed.onKeyUp.add(fixIndentedListItemForGecko);
+                       }
+                       if (tinymce.isIE8) {
+                               ed.onKeyUp.add(fixIndentedListItemForIE8);
+                       }
+                       if (tinymce.isGecko || tinymce.isWebKit) {
+                               ed.onKeyDown.add(fixDeletingFirstCharOfList);
+                       }
+                       if (tinymce.isWebKit) {
+                               ed.onKeyDown.add(fixDeletingEmptyLiInWebkit);
+                       }
+               },
+
+               applyList: function(targetListType, oppositeListType) {
+                       var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,
+                                       selectedBlocks = ed.selection.getSelectedBlocks();
+
+                       function cleanupBr(e) {
+                               if (e && e.tagName === 'BR') {
+                                       dom.remove(e);
+                               }
+                       }
+
+                       function makeList(element) {
+                               var list = dom.create(targetListType), li;
+
+                               function adjustIndentForNewList(element) {
+                                       // If there's a margin-left, outdent one level to account for the extra list margin.
+                                       if (element.style.marginLeft || element.style.paddingLeft) {
+                                               t.adjustPaddingFunction(false)(element);
+                                       }
+                               }
+
+                               if (element.tagName === 'LI') {
+                                       // No change required.
+                               } else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
+                                       processBrs(element, function(startSection, br) {
+                                               doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);
+                                               li = startSection.parentNode;
+                                               adjustIndentForNewList(li);
+                                               cleanupBr(br);
+                                       });
+                                       if (li) {
+                                               if (li.tagName === 'LI' && (element.tagName === 'P' || selectedBlocks.length > 1)) {
+                                                       dom.split(li.parentNode.parentNode, li.parentNode);
+                                               }
+                                               attemptMergeWithAdjacent(li.parentNode, true);
+                                       }
+                                       return;
+                               } else {
+                                       // Put the list around the element.
+                                       li = dom.create('li');
+                                       dom.insertAfter(li, element);
+                                       li.appendChild(element);
+                                       adjustIndentForNewList(element);
+                                       element = li;
+                               }
+                               dom.insertAfter(list, element);
+                               list.appendChild(element);
+                               attemptMergeWithAdjacent(list, true);
+                               applied.push(element);
+                       }
+
+                       function doWrapList(start, end, template) {
+                               var li, n = start, tmp;
+                               while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
+                                       start = dom.split(start.parentNode, start.previousSibling);
+                                       start = start.nextSibling;
+                                       n = start;
+                               }
+                               if (template) {
+                                       li = template.cloneNode(true);
+                                       start.parentNode.insertBefore(li, start);
+                                       while (li.firstChild) dom.remove(li.firstChild);
+                                       li = dom.rename(li, 'li');
+                               } else {
+                                       li = dom.create('li');
+                                       start.parentNode.insertBefore(li, start);
+                               }
+                               while (n && n != end) {
+                                       tmp = n.nextSibling;
+                                       li.appendChild(n);
+                                       n = tmp;
+                               }
+                               if (li.childNodes.length === 0) {
+                                       li.innerHTML = '<br _mce_bogus="1" />';
+                               }
+                               makeList(li);
+                       }
+
+                       function processBrs(element, callback) {
+                               var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,
+                                               breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
+
+                               function isAnyPartSelected(start, end) {
+                                       var r = dom.createRng(), sel;
+                                       bookmark.keep = true;
+                                       ed.selection.moveToBookmark(bookmark);
+                                       bookmark.keep = false;
+                                       sel = ed.selection.getRng(true);
+                                       if (!end) {
+                                               end = start.parentNode.lastChild;
+                                       }
+                                       r.setStartBefore(start);
+                                       r.setEndAfter(end);
+                                       return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);
+                               }
+
+                               function nextLeaf(br) {
+                                       if (br.nextSibling)
+                                               return br.nextSibling;
+                                       if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())
+                                               return nextLeaf(br.parentNode);
+                               }
+
+                               // Split on BRs within the range and process those.
+                               startSection = element.firstChild;
+                               // First mark the BRs that have any part of the previous section selected.
+                               var trailingContentSelected = false;
+                               each(dom.select(breakElements, element), function(br) {
+                                       if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
+                                               return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
+                                       }
+                                       if (isAnyPartSelected(startSection, br)) {
+                                               dom.addClass(br, '_mce_tagged_br');
+                                               startSection = nextLeaf(br);
+                                       }
+                               });
+                               trailingContentSelected = (startSection && isAnyPartSelected(startSection, undefined));
+                               startSection = element.firstChild;
+                               each(dom.select(breakElements, element), function(br) {
+                                       // Got a section from start to br.
+                                       var tmp = nextLeaf(br);
+                                       if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
+                                               return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
+                                       }
+                                       if (dom.hasClass(br, '_mce_tagged_br')) {
+                                               callback(startSection, br, previousBR);
+                                               previousBR = null;
+                                       } else {
+                                               previousBR = br;
+                                       }
+                                       startSection = tmp;
+                               });
+                               if (trailingContentSelected) {
+                                       callback(startSection, undefined, previousBR);
+                               }
+                       }
+
+                       function wrapList(element) {
+                               processBrs(element, function(startSection, br, previousBR) {
+                                       // Need to indent this part
+                                       doWrapList(startSection, br);
+                                       cleanupBr(br);
+                                       cleanupBr(previousBR);
+                               });
+                       }
+
+                       function changeList(element) {
+                               if (tinymce.inArray(applied, element) !== -1) {
+                                       return;
+                               }
+                               if (element.parentNode.tagName === oppositeListType) {
+                                       dom.split(element.parentNode, element);
+                                       makeList(element);
+                                       attemptMergeWithNext(element.parentNode, false);
+                               }
+                               applied.push(element);
+                       }
+
+                       function convertListItemToParagraph(element) {
+                               var child, nextChild, mergedElement, splitLast;
+                               if (tinymce.inArray(applied, element) !== -1) {
+                                       return;
+                               }
+                               element = splitNestedLists(element, dom);
+                               while (dom.is(element.parentNode, 'ol,ul,li')) {
+                                       dom.split(element.parentNode, element);
+                               }
+                               // Push the original element we have from the selection, not the renamed one.
+                               applied.push(element);
+                               element = dom.rename(element, 'p');
+                               mergedElement = attemptMergeWithAdjacent(element, false, ed.settings.force_br_newlines);
+                               if (mergedElement === element) {
+                                       // Now split out any block elements that can't be contained within a P.
+                                       // Manually iterate to ensure we handle modifications correctly (doesn't work with tinymce.each)
+                                       child = element.firstChild;
+                                       while (child) {
+                                               if (dom.isBlock(child)) {
+                                                       child = dom.split(child.parentNode, child);
+                                                       splitLast = true;
+                                                       nextChild = child.nextSibling && child.nextSibling.firstChild;
+                                               } else {
+                                                       nextChild = child.nextSibling;
+                                                       if (splitLast && child.tagName === 'BR') {
+                                                               dom.remove(child);
+                                                       }
+                                                       splitLast = false;
+                                               }
+                                               child = nextChild;
+                                       }
+                               }
+                       }
+
+                       each(selectedBlocks, function(e) {
+                               e = findItemToOperateOn(e, dom);
+                               if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {
+                                       hasOppositeType = true;
+                               } else if (e.tagName === targetListType || (e.tagName === 'LI' && e.parentNode.tagName === targetListType)) {
+                                       hasSameType = true;
+                               } else {
+                                       hasNonList = true;
+                               }
+                       });
+
+                       if (hasNonList &&!hasSameType || hasOppositeType || selectedBlocks.length === 0) {
+                               actions = {
+                                       'LI': changeList,
+                                       'H1': makeList,
+                                       'H2': makeList,
+                                       'H3': makeList,
+                                       'H4': makeList,
+                                       'H5': makeList,
+                                       'H6': makeList,
+                                       'P': makeList,
+                                       'BODY': makeList,
+                                       'DIV': selectedBlocks.length > 1 ? makeList : wrapList,
+                                       defaultAction: wrapList,
+                                       elements: this.selectedBlocks()
+                               };
+                       } else {
+                               actions = {
+                                       defaultAction: convertListItemToParagraph,
+                                       elements: this.selectedBlocks(),
+                                       processEvenIfEmpty: true
+                               };
+                       }
+                       this.process(actions);
+               },
+
+               indent: function() {
+                       var ed = this.ed, dom = ed.dom, indented = [];
+
+                       function createWrapItem(element) {
+                               var wrapItem = dom.create('li', { style: 'list-style-type: none;'});
+                               dom.insertAfter(wrapItem, element);
+                               return wrapItem;
+                       }
+
+                       function createWrapList(element) {
+                               var wrapItem = createWrapItem(element),
+                                               list = dom.getParent(element, 'ol,ul'),
+                                               listType = list.tagName,
+                                               listStyle = dom.getStyle(list, 'list-style-type'),
+                                               attrs = {},
+                                               wrapList;
+                               if (listStyle !== '') {
+                                       attrs.style = 'list-style-type: ' + listStyle + ';';
+                               }
+                               wrapList = dom.create(listType, attrs);
+                               wrapItem.appendChild(wrapList);
+                               return wrapList;
+                       }
+
+                       function indentLI(element) {
+                               if (!hasParentInList(ed, element, indented)) {
+                                       element = splitNestedLists(element, dom);
+                                       var wrapList = createWrapList(element);
+                                       wrapList.appendChild(element);
+                                       attemptMergeWithAdjacent(wrapList.parentNode, false);
+                                       attemptMergeWithAdjacent(wrapList, false);
+                                       indented.push(element);
+                               }
+                       }
+
+                       this.process({
+                               'LI': indentLI,
+                               defaultAction: this.adjustPaddingFunction(true),
+                               elements: this.selectedBlocks()
+                       });
+
+               },
+
+               outdent: function(ui, elements) {
+                       var t = this, ed = t.ed, dom = ed.dom, outdented = [];
+
+                       function outdentLI(element) {
+                               var listElement, targetParent, align;
+                               if (!hasParentInList(ed, element, outdented)) {
+                                       if (dom.getStyle(element, 'margin-left') !== '' || dom.getStyle(element, 'padding-left') !== '') {
+                                               return t.adjustPaddingFunction(false)(element);
+                                       }
+                                       align = dom.getStyle(element, 'text-align', true);
+                                       if (align === 'center' || align === 'right') {
+                                               dom.setStyle(element, 'text-align', 'left');
+                                               return;
+                                       }
+                                       element = splitNestedLists(element, dom);
+                                       listElement = element.parentNode;
+                                       targetParent = element.parentNode.parentNode;
+                                       if (targetParent.tagName === 'P') {
+                                               dom.split(targetParent, element.parentNode);
+                                       } else {
+                                               dom.split(listElement, element);
+                                               if (targetParent.tagName === 'LI') {
+                                                       // Nested list, need to split the LI and go back out to the OL/UL element.
+                                                       dom.split(targetParent, element);
+                                               } else if (!dom.is(targetParent, 'ol,ul')) {
+                                                       dom.rename(element, 'p');
+                                               }
+                                       }
+                                       outdented.push(element);
+                               }
+                       }
+
+                       var listElements = elements && tinymce.is(elements, 'array') ? elements : this.selectedBlocks();
+                       this.process({
+                               'LI': outdentLI,
+                               defaultAction: this.adjustPaddingFunction(false),
+                               elements: listElements
+                       });
+
+                       each(outdented, attemptMergeWithAdjacent);
+               },
+
+               process: function(actions) {
+                       var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
+
+                       function isEmptyElement(element) {
+                               var excludeBrsAndBookmarks = tinymce.grep(element.childNodes, function(n) {
+                                       return !(n.nodeName === 'BR' || n.nodeName === 'SPAN' && dom.getAttrib(n, 'data-mce-type') == 'bookmark'
+                                                       || n.nodeType == 3 && (n.nodeValue == String.fromCharCode(160) || n.nodeValue == ''));
+                               });
+                               return excludeBrsAndBookmarks.length === 0;
+                       }
+
+                       function processElement(element) {
+                               dom.removeClass(element, '_mce_act_on');
+                               if (!element || element.nodeType !== 1 || ! actions.processEvenIfEmpty && selectedBlocks.length > 1 && isEmptyElement(element)) {
+                                       return;
+                               }
+                               element = findItemToOperateOn(element, dom);
+                               var action = actions[element.tagName];
+                               if (!action) {
+                                       action = actions.defaultAction;
+                               }
+                               action(element);
+                       }
+
+                       function recurse(element) {
+                               t.splitSafeEach(element.childNodes, processElement, true);
+                       }
+
+                       function brAtEdgeOfSelection(container, offset) {
+                               return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&
+                                               container.childNodes[offset].tagName === 'BR';
+                       }
+
+                       function isInTable() {
+                               var n = sel.getNode();
+                               var p = dom.getParent(n, 'td');
+                               return p !== null;
+                       }
+
+                       selectedBlocks = actions.elements;
+
+                       r = sel.getRng(true);
+                       if (!r.collapsed) {
+                               if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {
+                                       r.setEnd(r.endContainer, r.endOffset - 1);
+                                       sel.setRng(r);
+                               }
+                               if (brAtEdgeOfSelection(r.startContainer, r.startOffset)) {
+                                       r.setStart(r.startContainer, r.startOffset + 1);
+                                       sel.setRng(r);
+                               }
+                       }
+
+
+                       if (tinymce.isIE8) {
+                               // append a zero sized nbsp so that caret is restored correctly using bookmark
+                               var s = t.ed.selection.getNode();
+                               if (s.tagName === 'LI' && !(s.parentNode.lastChild === s)) {
+                                       var i = t.ed.getDoc().createTextNode('\uFEFF');
+                                       s.appendChild(i);
+                               }
+                       }
+
+                       bookmark = sel.getBookmark();
+                       actions.OL = actions.UL = recurse;
+                       t.splitSafeEach(selectedBlocks, processElement);
+                       sel.moveToBookmark(bookmark);
+                       bookmark = null;
+
+                       // we avoid doing repaint in a table as this will move the caret out of the table in Firefox 3.6
+                       if (!isInTable()) {
+                               // Avoids table or image handles being left behind in Firefox.
+                               t.ed.execCommand('mceRepaint');
+                       }
+               },
+
+               splitSafeEach: function(elements, f, forceClassBase) {
+                       if (forceClassBase ||
+                               (tinymce.isGecko &&
+                                       (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
+                                        /Firefox\/3\.[0-4]/.test(navigator.userAgent)))) {
+                               this.classBasedEach(elements, f);
+                       } else {
+                               each(elements, f);
+                       }
+               },
+
+               classBasedEach: function(elements, f) {
+                       var dom = this.ed.dom, nodes, element;
+                       // Mark nodes
+                       each(elements, function(element) {
+                               dom.addClass(element, '_mce_act_on');
+                       });
+                       nodes = dom.select('._mce_act_on');
+                       while (nodes.length > 0) {
+                               element = nodes.shift();
+                               dom.removeClass(element, '_mce_act_on');
+                               f(element);
+                               nodes = dom.select('._mce_act_on');
+                       }
+               },
+
+               adjustPaddingFunction: function(isIndent) {
+                       var indentAmount, indentUnits, ed = this.ed;
+                       indentAmount = ed.settings.indentation;
+                       indentUnits = /[a-z%]+/i.exec(indentAmount);
+                       indentAmount = parseInt(indentAmount, 10);
+                       return function(element) {
+                               var currentIndent, newIndentAmount;
+                               currentIndent = parseInt(ed.dom.getStyle(element, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(element, 'padding-left') || 0, 10);
+                               if (isIndent) {
+                                       newIndentAmount = currentIndent + indentAmount;
+                               } else {
+                                       newIndentAmount = currentIndent - indentAmount;
+                               }
+                               ed.dom.setStyle(element, 'padding-left', '');
+                               ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');
+                       };
+               },
+
+               selectedBlocks: function() {
+                       var ed = this.ed, selectedBlocks = ed.selection.getSelectedBlocks();
+                       return selectedBlocks.length == 0 ? [ ed.dom.getRoot() ] : selectedBlocks;
+               },
+
+               getInfo: function() {
+                       return {
+                               longname : 'Lists',
+                               author : 'Moxiecode Systems AB',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists',
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
+                       };
+               }
+       });
+       tinymce.PluginManager.add("lists", tinymce.plugins.Lists);
+}());
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/css/media.css b/3.x/src/resources/javascript/TinyMCE/plugins/media/css/media.css
new file mode 100644 (file)
index 0000000..0c45c7f
--- /dev/null
@@ -0,0 +1,17 @@
+#id, #name, #hspace, #vspace, #class_name, #align { width: 100px }\r
+#hspace, #vspace { width: 50px }\r
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }\r
+#flash_base, #flash_flashvars, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px }\r
+#width, #height { width: 40px }\r
+#src, #media_type { width: 250px }\r
+#class { width: 120px }\r
+#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto }\r
+.panel_wrapper div.current { height: 420px; overflow: auto }\r
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }\r
+.mceAddSelectValue { background-color: #DDDDDD }\r
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }\r
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }\r
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }\r
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }\r
+#qt_qtsrc { width: 200px }\r
+iframe {border: 1px solid gray}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/media/editor_plugin.js
new file mode 100644 (file)
index 0000000..9ac42e0
--- /dev/null
@@ -0,0 +1 @@
+(function(){var b=tinymce.explode("id,name,width,height,style,align,class,hspace,vspace,bgcolor,type"),a=tinymce.makeMap(b.join(",")),f=tinymce.html.Node,d,i,h=tinymce.util.JSON,g;d=[["Flash","d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["ShockWave","166b1bca-3f9c-11cf-8075-444553540000","application/x-director","http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],["WindowsMedia","6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a","application/x-mplayer2","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],["QuickTime","02bf25d5-8c17-4b23-bc80-d3488abddc6b","video/quicktime","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],["RealMedia","cfcdaa03-8be4-11cf-b84b-0020afbbccfa","audio/x-pn-realaudio-plugin","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["Java","8ad9c840-044e-11d1-b3e9-00805f499d93","application/x-java-applet","http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],["Silverlight","dfeaf541-f3e1-4c24-acac-99c30715084a","application/x-silverlight-2"],["Iframe"],["Video"],["EmbeddedAudio"],["Audio"]];function e(j){return typeof(j)=="string"?j.replace(/[^0-9%]/g,""):j}function c(m){var l,j,k;if(m&&!m.splice){j=[];for(k=0;true;k++){if(m[k]){j[k]=m[k]}else{break}}return j}return m}tinymce.create("tinymce.plugins.MediaPlugin",{init:function(n,j){var r=this,l={},m,p,q,k;function o(s){return s&&s.nodeName==="IMG"&&n.dom.hasClass(s,"mceItemMedia")}r.editor=n;r.url=j;i="";for(m=0;m<d.length;m++){k=d[m][0];q={name:k,clsids:tinymce.explode(d[m][1]||""),mimes:tinymce.explode(d[m][2]||""),codebase:d[m][3]};for(p=0;p<q.clsids.length;p++){l["clsid:"+q.clsids[p]]=q}for(p=0;p<q.mimes.length;p++){l[q.mimes[p]]=q}l["mceItem"+k]=q;l[k.toLowerCase()]=q;i+=(i?"|":"")+k}tinymce.each(n.getParam("media_types","video=mp4,m4v,ogv,webm;silverlight=xap;flash=swf,flv;shockwave=dcr;quicktime=mov,qt,mpg,mpeg;shockwave=dcr;windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;realmedia=rm,ra,ram;java=jar;audio=mp3,ogg").split(";"),function(v){var s,u,t;v=v.split(/=/);u=tinymce.explode(v[1].toLowerCase());for(s=0;s<u.length;s++){t=l[v[0].toLowerCase()];if(t){l[u[s]]=t}}});i=new RegExp("write("+i+")\\(([^)]+)\\)");r.lookup=l;n.onPreInit.add(function(){n.schema.addValidElements("object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]");n.parser.addNodeFilter("object,embed,video,audio,script,iframe",function(s){var t=s.length;while(t--){r.objectToImg(s[t])}});n.serializer.addNodeFilter("img",function(s,u,t){var v=s.length,w;while(v--){w=s[v];if((w.attr("class")||"").indexOf("mceItemMedia")!==-1){r.imgToObject(w,t)}}})});n.onInit.add(function(){if(n.theme&&n.theme.onResolveName){n.theme.onResolveName.add(function(s,t){if(t.name==="img"&&n.dom.hasClass(t.node,"mceItemMedia")){t.name="media"}})}if(n&&n.plugins.contextmenu){n.plugins.contextmenu.onContextMenu.add(function(t,u,s){if(s.nodeName==="IMG"&&s.className.indexOf("mceItemMedia")!==-1){u.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});n.addCommand("mceMedia",function(){var t,s;s=n.selection.getNode();if(o(s)){t=n.dom.getAttrib(s,"data-mce-json");if(t){t=h.parse(t);tinymce.each(b,function(u){var v=n.dom.getAttrib(s,u);if(v){t[u]=v}});t.type=r.getType(s.className).name.toLowerCase()}}if(!t){t={type:"flash",video:{sources:[]},params:{}}}n.windowManager.open({file:j+"/media.htm",width:430+parseInt(n.getLang("media.delta_width",0)),height:500+parseInt(n.getLang("media.delta_height",0)),inline:1},{plugin_url:j,data:t})});n.addButton("media",{title:"media.desc",cmd:"mceMedia"});n.onNodeChange.add(function(t,s,u){s.setActive("media",o(u))})},convertUrl:function(l,o){var k=this,n=k.editor,m=n.settings,p=m.url_converter,j=m.url_converter_scope||k;if(!l){return l}if(o){return n.documentBaseURI.toAbsolute(l)}return p.call(j,l,"src","object")},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},dataToImg:function(m,k){var r=this,o=r.editor,p=o.documentBaseURI,j,q,n,l;m.params.src=r.convertUrl(m.params.src,k);q=m.video.attrs;if(q){q.src=r.convertUrl(q.src,k)}if(q){q.poster=r.convertUrl(q.poster,k)}j=c(m.video.sources);if(j){for(l=0;l<j.length;l++){j[l].src=r.convertUrl(j[l].src,k)}}n=r.editor.dom.create("img",{id:m.id,style:m.style,align:m.align,hspace:m.hspace,vspace:m.vspace,src:r.editor.theme.url+"/img/trans.gif","class":"mceItemMedia mceItem"+r.getType(m.type).name,"data-mce-json":h.serialize(m,"'")});n.width=m.width=e(m.width||(m.type=="audio"?"300":"320"));n.height=m.height=e(m.height||(m.type=="audio"?"32":"240"));return n},dataToHtml:function(j,k){return this.editor.serializer.serialize(this.dataToImg(j,k),{forced_root_block:"",force_absolute:k})},htmlToData:function(l){var k,j,m;m={type:"flash",video:{sources:[]},params:{}};k=this.editor.parser.parse(l);j=k.getAll("img")[0];if(j){m=h.parse(j.attr("data-mce-json"));m.type=this.getType(j.attr("class")).name.toLowerCase();tinymce.each(b,function(n){var o=j.attr(n);if(o){m[n]=o}})}return m},getType:function(m){var k,j,l;j=tinymce.explode(m," ");for(k=0;k<j.length;k++){l=this.lookup[j[k]];if(l){return l}}},imgToObject:function(z,o){var u=this,p=u.editor,C,H,j,t,I,y,G,w,k,E,s,q,A,D,m,x,l,B,F;function r(n,J){var N,M,O,L,K;K=p.getParam("flash_video_player_url",u.convertUrl(u.url+"/moxieplayer.swf"));if(K){N=p.documentBaseURI;G.params.src=K;if(p.getParam("flash_video_player_absvideourl",true)){n=N.toAbsolute(n||"",true);J=N.toAbsolute(J||"",true)}O="";M=p.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"});tinymce.each(M,function(Q,P){Q=Q.replace(/\$url/,n||"");Q=Q.replace(/\$poster/,J||"");if(Q.length>0){O+=(O?"&":"")+P+"="+escape(Q)}});if(O.length){G.params.flashvars=O}L=p.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(L,function(Q,P){G.params[P]=""+Q})}}G=z.attr("data-mce-json");if(!G){return}G=h.parse(G);q=this.getType(z.attr("class"));B=z.attr("data-mce-style");if(!B){B=z.attr("style");if(B){B=p.dom.serializeStyle(p.dom.parseStyle(B,"img"))}}G.width=z.attr("width")||G.width;G.height=z.attr("height")||G.height;if(q.name==="Iframe"){x=new f("iframe",1);tinymce.each(b,function(n){var J=z.attr(n);if(n=="class"&&J){J=J.replace(/mceItem.+ ?/g,"")}if(J&&J.length>0){x.attr(n,J)}});for(I in G.params){x.attr(I,G.params[I])}x.attr({style:B,src:G.params.src});z.replace(x);return}if(this.editor.settings.media_use_script){x=new f("script",1).attr("type","text/javascript");y=new f("#text",3);y.value="write"+q.name+"("+h.serialize(tinymce.extend(G.params,{width:z.attr("width"),height:z.attr("height")}))+");";x.append(y);z.replace(x);return}if(q.name==="Video"&&G.video.sources[0]){C=new f("video",1).attr(tinymce.extend({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B},G.video.attrs));if(G.video.attrs){l=G.video.attrs.poster}k=G.video.sources=c(G.video.sources);for(A=0;A<k.length;A++){if(/\.mp4$/.test(k[A].src)){m=k[A].src}}if(!k[0].type){C.attr("src",k[0].src);k.splice(0,1)}for(A=0;A<k.length;A++){w=new f("source",1).attr(k[A]);w.shortEnded=true;C.append(w)}if(m){r(m,l);q=u.getType("flash")}else{G.params.src=""}}if(q.name==="Audio"&&G.video.sources[0]){F=new f("audio",1).attr(tinymce.extend({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B},G.video.attrs));if(G.video.attrs){l=G.video.attrs.poster}k=G.video.sources=c(G.video.sources);if(!k[0].type){F.attr("src",k[0].src);k.splice(0,1)}for(A=0;A<k.length;A++){w=new f("source",1).attr(k[A]);w.shortEnded=true;F.append(w)}G.params.src=""}if(q.name==="EmbeddedAudio"){j=new f("embed",1);j.shortEnded=true;j.attr({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B,type:z.attr("type")});for(I in G.params){j.attr(I,G.params[I])}tinymce.each(b,function(n){if(G[n]&&n!="type"){j.attr(n,G[n])}});G.params.src=""}if(G.params.src){if(/\.flv$/i.test(G.params.src)){r(G.params.src,"")}if(o&&o.force_absolute){G.params.src=p.documentBaseURI.toAbsolute(G.params.src)}H=new f("object",1).attr({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B});tinymce.each(b,function(n){var J=G[n];if(n=="class"&&J){J=J.replace(/mceItem.+ ?/g,"")}if(J&&n!="type"){H.attr(n,J)}});for(I in G.params){s=new f("param",1);s.shortEnded=true;y=G.params[I];if(I==="src"&&q.name==="WindowsMedia"){I="url"}s.attr({name:I,value:y});H.append(s)}if(this.editor.getParam("media_strict",true)){H.attr({data:G.params.src,type:q.mimes[0]})}else{H.attr({classid:"clsid:"+q.clsids[0],codebase:q.codebase});j=new f("embed",1);j.shortEnded=true;j.attr({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B,type:q.mimes[0]});for(I in G.params){j.attr(I,G.params[I])}tinymce.each(b,function(n){if(G[n]&&n!="type"){j.attr(n,G[n])}});H.append(j)}if(G.object_html){y=new f("#text",3);y.raw=true;y.value=G.object_html;H.append(y)}if(C){C.append(H)}}if(C){if(G.video_html){y=new f("#text",3);y.raw=true;y.value=G.video_html;C.append(y)}}if(F){if(G.video_html){y=new f("#text",3);y.raw=true;y.value=G.video_html;F.append(y)}}var v=C||F||H||j;if(v){z.replace(v)}else{z.remove()}},objectToImg:function(C){var L,k,F,s,M,N,y,A,x,G,E,t,q,I,B,l,K,o,H=this.lookup,m,z,v=this.editor.settings.url_converter,n=this.editor.settings.url_converter_scope,w,r,D,j;function u(O){return new tinymce.html.Serializer({inner:true,validate:false}).serialize(O)}function J(P,O){return H[(P.attr(O)||"").toLowerCase()]}function p(P){var O=P.replace(/^.*\.([^.]+)$/,"$1");return H[O.toLowerCase()||""]}if(!C.parent){return}if(C.name==="script"){if(C.firstChild){m=i.exec(C.firstChild.value)}if(!m){return}o=m[1];K={video:{},params:h.parse(m[2])};A=K.params.width;x=K.params.height}K=K||{video:{},params:{}};M=new f("img",1);M.attr({src:this.editor.theme.url+"/img/trans.gif"});N=C.name;if(N==="video"||N=="audio"){F=C;L=C.getAll("object")[0];k=C.getAll("embed")[0];A=F.attr("width");x=F.attr("height");y=F.attr("id");K.video={attrs:{},sources:[]};z=K.video.attrs;for(N in F.attributes.map){z[N]=F.attributes.map[N]}B=C.attr("src");if(B){K.video.sources.push({src:v.call(n,B,"src",C.name)})}l=F.getAll("source");for(E=0;E<l.length;E++){B=l[E].remove();K.video.sources.push({src:v.call(n,B.attr("src"),"src","source"),type:B.attr("type"),media:B.attr("media")})}if(z.poster){z.poster=v.call(n,z.poster,"poster",C.name)}}if(C.name==="object"){L=C;k=C.getAll("embed")[0]}if(C.name==="embed"){k=C}if(C.name==="iframe"){s=C;o="Iframe"}if(L){A=A||L.attr("width");x=x||L.attr("height");G=G||L.attr("style");y=y||L.attr("id");w=w||L.attr("hspace");r=r||L.attr("vspace");D=D||L.attr("align");j=j||L.attr("bgcolor");K.name=L.attr("name");I=L.getAll("param");for(E=0;E<I.length;E++){q=I[E];N=q.remove().attr("name");if(!a[N]){K.params[N]=q.attr("value")}}K.params.src=K.params.src||L.attr("data")}if(k){A=A||k.attr("width");x=x||k.attr("height");G=G||k.attr("style");y=y||k.attr("id");w=w||k.attr("hspace");r=r||k.attr("vspace");D=D||k.attr("align");j=j||k.attr("bgcolor");for(N in k.attributes.map){if(!a[N]&&!K.params[N]){K.params[N]=k.attributes.map[N]}}}if(s){A=e(s.attr("width"));x=e(s.attr("height"));G=G||s.attr("style");y=s.attr("id");w=s.attr("hspace");r=s.attr("vspace");D=s.attr("align");j=s.attr("bgcolor");tinymce.each(b,function(O){M.attr(O,s.attr(O))});for(N in s.attributes.map){if(!a[N]&&!K.params[N]){K.params[N]=s.attributes.map[N]}}}if(K.params.movie){K.params.src=K.params.src||K.params.movie;delete K.params.movie}if(K.params.src){K.params.src=v.call(n,K.params.src,"src","object")}if(F){if(C.name==="video"){o=H.video.name}else{if(C.name==="audio"){o=H.audio.name}}}if(L&&!o){o=(J(L,"clsid")||J(L,"classid")||J(L,"type")||{}).name}if(k&&!o){o=(J(k,"type")||p(K.params.src)||{}).name}if(k&&o=="EmbeddedAudio"){K.params.type=k.attr("type")}C.replace(M);if(k){k.remove()}if(L){t=u(L.remove());if(t){K.object_html=t}}if(F){t=u(F.remove());if(t){K.video_html=t}}K.hspace=w;K.vspace=r;K.align=D;K.bgcolor=j;M.attr({id:y,"class":"mceItemMedia mceItem"+(o||"Flash"),style:G,width:A||(C.name=="audio"?"300":"320"),height:x||(C.name=="audio"?"32":"240"),hspace:w,vspace:r,align:D,bgcolor:j,"data-mce-json":h.serialize(K,"'")})}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/media/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..33a5805
--- /dev/null
@@ -0,0 +1,898 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,\r
+               mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;\r
+\r
+       // Media types supported by this plugin\r
+       mediaTypes = [\r
+               // Type, clsid:s, mime types, codebase\r
+               ["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],\r
+               ["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],\r
+               ["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],\r
+               ["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],\r
+               ["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],\r
+               ["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],\r
+               ["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],\r
+               ["Iframe"],\r
+               ["Video"],\r
+               ["EmbeddedAudio"],\r
+               ["Audio"]\r
+       ];\r
+\r
+       function normalizeSize(size) {\r
+               return typeof(size) == "string" ? size.replace(/[^0-9%]/g, '') : size;\r
+       }\r
+\r
+       function toArray(obj) {\r
+               var undef, out, i;\r
+\r
+               if (obj && !obj.splice) {\r
+                       out = [];\r
+\r
+                       for (i = 0; true; i++) {\r
+                               if (obj[i])\r
+                                       out[i] = obj[i];\r
+                               else\r
+                                       break;\r
+                       }\r
+\r
+                       return out;\r
+               }\r
+\r
+               return obj;\r
+       };\r
+\r
+       tinymce.create('tinymce.plugins.MediaPlugin', {\r
+               init : function(ed, url) {\r
+                       var self = this, lookup = {}, i, y, item, name;\r
+\r
+                       function isMediaImg(node) {\r
+                               return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');\r
+                       };\r
+\r
+                       self.editor = ed;\r
+                       self.url = url;\r
+\r
+                       // Parse media types into a lookup table\r
+                       scriptRegExp = '';\r
+                       for (i = 0; i < mediaTypes.length; i++) {\r
+                               name = mediaTypes[i][0];\r
+\r
+                               item = {\r
+                                       name : name,\r
+                                       clsids : tinymce.explode(mediaTypes[i][1] || ''),\r
+                                       mimes : tinymce.explode(mediaTypes[i][2] || ''),\r
+                                       codebase : mediaTypes[i][3]\r
+                               };\r
+\r
+                               for (y = 0; y < item.clsids.length; y++)\r
+                                       lookup['clsid:' + item.clsids[y]] = item;\r
+\r
+                               for (y = 0; y < item.mimes.length; y++)\r
+                                       lookup[item.mimes[y]] = item;\r
+\r
+                               lookup['mceItem' + name] = item;\r
+                               lookup[name.toLowerCase()] = item;\r
+\r
+                               scriptRegExp += (scriptRegExp ? '|' : '') + name;\r
+                       }\r
+\r
+                       // Handle the media_types setting\r
+                       tinymce.each(ed.getParam("media_types",\r
+                               "video=mp4,m4v,ogv,webm;" +\r
+                               "silverlight=xap;" +\r
+                               "flash=swf,flv;" +\r
+                               "shockwave=dcr;" +\r
+                               "quicktime=mov,qt,mpg,mpeg;" +\r
+                               "shockwave=dcr;" +\r
+                               "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +\r
+                               "realmedia=rm,ra,ram;" +\r
+                               "java=jar;" +\r
+                               "audio=mp3,ogg"\r
+                       ).split(';'), function(item) {\r
+                               var i, extensions, type;\r
+\r
+                               item = item.split(/=/);\r
+                               extensions = tinymce.explode(item[1].toLowerCase());\r
+                               for (i = 0; i < extensions.length; i++) {\r
+                                       type = lookup[item[0].toLowerCase()];\r
+\r
+                                       if (type)\r
+                                               lookup[extensions[i]] = type;\r
+                               }\r
+                       });\r
+\r
+                       scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');\r
+                       self.lookup = lookup;\r
+\r
+                       ed.onPreInit.add(function() {\r
+                               // Allow video elements\r
+                               ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');\r
+\r
+                               // Convert video elements to image placeholder\r
+                               ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {\r
+                                       var i = nodes.length;\r
+\r
+                                       while (i--)\r
+                                               self.objectToImg(nodes[i]);\r
+                               });\r
+\r
+                               // Convert image placeholders to video elements\r
+                               ed.serializer.addNodeFilter('img', function(nodes, name, args) {\r
+                                       var i = nodes.length, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)\r
+                                                       self.imgToObject(node, args);\r
+                                       }\r
+                               });\r
+                       });\r
+\r
+                       ed.onInit.add(function() {\r
+                               // Display "media" instead of "img" in element path\r
+                               if (ed.theme && ed.theme.onResolveName) {\r
+                                       ed.theme.onResolveName.add(function(theme, path_object) {\r
+                                               if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))\r
+                                                       path_object.name = 'media';\r
+                                       });\r
+                               }\r
+\r
+                               // Add contect menu if it's loaded\r
+                               if (ed && ed.plugins.contextmenu) {\r
+                                       ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {\r
+                                               if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)\r
+                                                       menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});\r
+                                       });\r
+                               }\r
+                       });\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceMedia', function() {\r
+                               var data, img;\r
+\r
+                               img = ed.selection.getNode();\r
+                               if (isMediaImg(img)) {\r
+                                       data = ed.dom.getAttrib(img, 'data-mce-json');\r
+                                       if (data) {\r
+                                               data = JSON.parse(data);\r
+\r
+                                               // Add some extra properties to the data object\r
+                                               tinymce.each(rootAttributes, function(name) {\r
+                                                       var value = ed.dom.getAttrib(img, name);\r
+\r
+                                                       if (value)\r
+                                                               data[name] = value;\r
+                                               });\r
+\r
+                                               data.type = self.getType(img.className).name.toLowerCase();\r
+                                       }\r
+                               }\r
+\r
+                               if (!data) {\r
+                                       data = {\r
+                                               type : 'flash',\r
+                                               video: {sources:[]},\r
+                                               params: {}\r
+                                       };\r
+                               }\r
+\r
+                               ed.windowManager.open({\r
+                                       file : url + '/media.htm',\r
+                                       width : 430 + parseInt(ed.getLang('media.delta_width', 0)),\r
+                                       height : 500 + parseInt(ed.getLang('media.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url,\r
+                                       data : data\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});\r
+\r
+                       // Update media selection status\r
+                       ed.onNodeChange.add(function(ed, cm, node) {\r
+                               cm.setActive('media', isMediaImg(node));\r
+                       });\r
+               },\r
+\r
+               convertUrl : function(url, force_absolute) {\r
+                       var self = this, editor = self.editor, settings = editor.settings,\r
+                               urlConverter = settings.url_converter,\r
+                               urlConverterScope = settings.url_converter_scope || self;\r
+\r
+                       if (!url)\r
+                               return url;\r
+\r
+                       if (force_absolute)\r
+                               return editor.documentBaseURI.toAbsolute(url);\r
+\r
+                       return urlConverter.call(urlConverterScope, url, 'src', 'object');\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Media',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               /**\r
+                * Converts the JSON data object to an img node.\r
+                */\r
+               dataToImg : function(data, force_absolute) {\r
+                       var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;\r
+\r
+                       data.params.src = self.convertUrl(data.params.src, force_absolute);\r
+\r
+                       attrs = data.video.attrs;\r
+                       if (attrs)\r
+                               attrs.src = self.convertUrl(attrs.src, force_absolute);\r
+\r
+                       if (attrs)\r
+                               attrs.poster = self.convertUrl(attrs.poster, force_absolute);\r
+\r
+                       sources = toArray(data.video.sources);\r
+                       if (sources) {\r
+                               for (i = 0; i < sources.length; i++)\r
+                                       sources[i].src = self.convertUrl(sources[i].src, force_absolute);\r
+                       }\r
+\r
+                       img = self.editor.dom.create('img', {\r
+                               id : data.id,\r
+                               style : data.style,\r
+                               align : data.align,\r
+                               hspace : data.hspace,\r
+                               vspace : data.vspace,\r
+                               src : self.editor.theme.url + '/img/trans.gif',\r
+                               'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,\r
+                               'data-mce-json' : JSON.serialize(data, "'")\r
+                       });\r
+\r
+                       img.width = data.width = normalizeSize(data.width || (data.type == 'audio' ? "300" : "320"));\r
+                       img.height = data.height = normalizeSize(data.height || (data.type == 'audio' ? "32" : "240"));\r
+\r
+                       return img;\r
+               },\r
+\r
+               /**\r
+                * Converts the JSON data object to a HTML string.\r
+                */\r
+               dataToHtml : function(data, force_absolute) {\r
+                       return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});\r
+               },\r
+\r
+               /**\r
+                * Converts the JSON data object to a HTML string.\r
+                */\r
+               htmlToData : function(html) {\r
+                       var fragment, img, data;\r
+\r
+                       data = {\r
+                               type : 'flash',\r
+                               video: {sources:[]},\r
+                               params: {}\r
+                       };\r
+\r
+                       fragment = this.editor.parser.parse(html);\r
+                       img = fragment.getAll('img')[0];\r
+\r
+                       if (img) {\r
+                               data = JSON.parse(img.attr('data-mce-json'));\r
+                               data.type = this.getType(img.attr('class')).name.toLowerCase();\r
+\r
+                               // Add some extra properties to the data object\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = img.attr(name);\r
+\r
+                                       if (value)\r
+                                               data[name] = value;\r
+                               });\r
+                       }\r
+\r
+                       return data;\r
+               },\r
+\r
+               /**\r
+                * Get type item by extension, class, clsid or mime type.\r
+                *\r
+                * @method getType\r
+                * @param {String} value Value to get type item by.\r
+                * @return {Object} Type item object or undefined.\r
+                */\r
+               getType : function(value) {\r
+                       var i, values, typeItem;\r
+\r
+                       // Find type by checking the classes\r
+                       values = tinymce.explode(value, ' ');\r
+                       for (i = 0; i < values.length; i++) {\r
+                               typeItem = this.lookup[values[i]];\r
+\r
+                               if (typeItem)\r
+                                       return typeItem;\r
+                       }\r
+               },\r
+\r
+               /**\r
+                * Converts a tinymce.html.Node image element to video/object/embed.\r
+                */\r
+               imgToObject : function(node, args) {\r
+                       var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,\r
+                               source, sources, params, param, typeItem, i, item, mp4Source, replacement,\r
+                               posterSrc, style, audio;\r
+\r
+                       // Adds the flash player\r
+                       function addPlayer(video_src, poster_src) {\r
+                               var baseUri, flashVars, flashVarsOutput, params, flashPlayer;\r
+\r
+                               flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));\r
+                               if (flashPlayer) {\r
+                                       baseUri = editor.documentBaseURI;\r
+                                       data.params.src = flashPlayer;\r
+\r
+                                       // Convert the movie url to absolute urls\r
+                                       if (editor.getParam('flash_video_player_absvideourl', true)) {\r
+                                               video_src = baseUri.toAbsolute(video_src || '', true);\r
+                                               poster_src = baseUri.toAbsolute(poster_src || '', true);\r
+                                       }\r
+\r
+                                       // Generate flash vars\r
+                                       flashVarsOutput = '';\r
+                                       flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});\r
+                                       tinymce.each(flashVars, function(value, name) {\r
+                                               // Replace $url and $poster variables in flashvars value\r
+                                               value = value.replace(/\$url/, video_src || '');\r
+                                               value = value.replace(/\$poster/, poster_src || '');\r
+\r
+                                               if (value.length > 0)\r
+                                                       flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);\r
+                                       });\r
+\r
+                                       if (flashVarsOutput.length)\r
+                                               data.params.flashvars = flashVarsOutput;\r
+\r
+                                       params = editor.getParam('flash_video_player_params', {\r
+                                               allowfullscreen: true,\r
+                                               allowscriptaccess: true\r
+                                       });\r
+\r
+                                       tinymce.each(params, function(value, name) {\r
+                                               data.params[name] = "" + value;\r
+                                       });\r
+                               }\r
+                       };\r
+\r
+                       data = node.attr('data-mce-json');\r
+                       if (!data)\r
+                               return;\r
+\r
+                       data = JSON.parse(data);\r
+                       typeItem = this.getType(node.attr('class'));\r
+\r
+                       style = node.attr('data-mce-style');\r
+                       if (!style) {\r
+                               style = node.attr('style');\r
+\r
+                               if (style)\r
+                                       style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));\r
+                       }\r
+\r
+                       // Use node width/height to override the data width/height when the placeholder is resized\r
+                       data.width = node.attr('width') || data.width;\r
+                       data.height = node.attr('height') || data.height;\r
+\r
+                       // Handle iframe\r
+                       if (typeItem.name === 'Iframe') {\r
+                               replacement = new Node('iframe', 1);\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = node.attr(name);\r
+\r
+                                       if (name == 'class' && value)\r
+                                               value = value.replace(/mceItem.+ ?/g, '');\r
+\r
+                                       if (value && value.length > 0)\r
+                                               replacement.attr(name, value);\r
+                               });\r
+\r
+                               for (name in data.params)\r
+                                       replacement.attr(name, data.params[name]);\r
+\r
+                               replacement.attr({\r
+                                       style: style,\r
+                                       src: data.params.src\r
+                               });\r
+\r
+                               node.replace(replacement);\r
+\r
+                               return;\r
+                       }\r
+\r
+                       // Handle scripts\r
+                       if (this.editor.settings.media_use_script) {\r
+                               replacement = new Node('script', 1).attr('type', 'text/javascript');\r
+\r
+                               value = new Node('#text', 3);\r
+                               value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {\r
+                                       width: node.attr('width'),\r
+                                       height: node.attr('height')\r
+                               })) + ');';\r
+\r
+                               replacement.append(value);\r
+                               node.replace(replacement);\r
+\r
+                               return;\r
+                       }\r
+\r
+                       // Add HTML5 video element\r
+                       if (typeItem.name === 'Video' && data.video.sources[0]) {\r
+                               // Create new object element\r
+                               video = new Node('video', 1).attr(tinymce.extend({\r
+                                       id : node.attr('id'),\r
+                                       width: normalizeSize(node.attr('width')),\r
+                                       height: normalizeSize(node.attr('height')),\r
+                                       style : style\r
+                               }, data.video.attrs));\r
+\r
+                               // Get poster source and use that for flash fallback\r
+                               if (data.video.attrs)\r
+                                       posterSrc = data.video.attrs.poster;\r
+\r
+                               sources = data.video.sources = toArray(data.video.sources);\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       if (/\.mp4$/.test(sources[i].src))\r
+                                               mp4Source = sources[i].src;\r
+                               }\r
+\r
+                               if (!sources[0].type) {\r
+                                       video.attr('src', sources[0].src);\r
+                                       sources.splice(0, 1);\r
+                               }\r
+\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       source = new Node('source', 1).attr(sources[i]);\r
+                                       source.shortEnded = true;\r
+                                       video.append(source);\r
+                               }\r
+\r
+                               // Create flash fallback for video if we have a mp4 source\r
+                               if (mp4Source) {\r
+                                       addPlayer(mp4Source, posterSrc);\r
+                                       typeItem = self.getType('flash');\r
+                               } else\r
+                                       data.params.src = '';\r
+                       }\r
+\r
+                       // Add HTML5 audio element\r
+                       if (typeItem.name === 'Audio' && data.video.sources[0]) {\r
+                               // Create new object element\r
+                               audio = new Node('audio', 1).attr(tinymce.extend({\r
+                                       id : node.attr('id'),\r
+                                       width: normalizeSize(node.attr('width')),\r
+                                       height: normalizeSize(node.attr('height')),\r
+                                       style : style\r
+                               }, data.video.attrs));\r
+\r
+                               // Get poster source and use that for flash fallback\r
+                               if (data.video.attrs)\r
+                                       posterSrc = data.video.attrs.poster;\r
+\r
+                               sources = data.video.sources = toArray(data.video.sources);\r
+                               if (!sources[0].type) {\r
+                                       audio.attr('src', sources[0].src);\r
+                                       sources.splice(0, 1);\r
+                               }\r
+\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       source = new Node('source', 1).attr(sources[i]);\r
+                                       source.shortEnded = true;\r
+                                       audio.append(source);\r
+                               }\r
+\r
+                               data.params.src = '';\r
+                       }\r
+\r
+                       if (typeItem.name === 'EmbeddedAudio') {\r
+                               embed = new Node('embed', 1);\r
+                               embed.shortEnded = true;\r
+                               embed.attr({\r
+                                       id: node.attr('id'),\r
+                                       width: normalizeSize(node.attr('width')),\r
+                                       height: normalizeSize(node.attr('height')),\r
+                                       style : style,\r
+                                       type: node.attr('type')\r
+                               });\r
+\r
+                               for (name in data.params)\r
+                                       embed.attr(name, data.params[name]);\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       if (data[name] && name != 'type')\r
+                                               embed.attr(name, data[name]);\r
+                               });\r
+\r
+                               data.params.src = '';\r
+                       }\r
+\r
+                       // Do we have a params src then we can generate object\r
+                       if (data.params.src) {\r
+                               // Is flv movie add player for it\r
+                               if (/\.flv$/i.test(data.params.src))\r
+                                       addPlayer(data.params.src, '');\r
+\r
+                               if (args && args.force_absolute)\r
+                                       data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);\r
+\r
+                               // Create new object element\r
+                               object = new Node('object', 1).attr({\r
+                                       id : node.attr('id'),\r
+                                       width: normalizeSize(node.attr('width')),\r
+                                       height: normalizeSize(node.attr('height')),\r
+                                       style : style\r
+                               });\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = data[name];\r
+\r
+                                       if (name == 'class' && value)\r
+                                               value = value.replace(/mceItem.+ ?/g, '');\r
+\r
+                                       if (value && name != 'type')\r
+                                               object.attr(name, value);\r
+                               });\r
+\r
+                               // Add params\r
+                               for (name in data.params) {\r
+                                       param = new Node('param', 1);\r
+                                       param.shortEnded = true;\r
+                                       value = data.params[name];\r
+\r
+                                       // Windows media needs to use url instead of src for the media URL\r
+                                       if (name === 'src' && typeItem.name === 'WindowsMedia')\r
+                                               name = 'url';\r
+\r
+                                       param.attr({name: name, value: value});\r
+                                       object.append(param);\r
+                               }\r
+\r
+                               // Setup add type and classid if strict is disabled\r
+                               if (this.editor.getParam('media_strict', true)) {\r
+                                       object.attr({\r
+                                               data: data.params.src,\r
+                                               type: typeItem.mimes[0]\r
+                                       });\r
+                               } else {\r
+                                       object.attr({\r
+                                               classid: "clsid:" + typeItem.clsids[0],\r
+                                               codebase: typeItem.codebase\r
+                                       });\r
+\r
+                                       embed = new Node('embed', 1);\r
+                                       embed.shortEnded = true;\r
+                                       embed.attr({\r
+                                               id: node.attr('id'),\r
+                                               width: normalizeSize(node.attr('width')),\r
+                                               height: normalizeSize(node.attr('height')),\r
+                                               style : style,\r
+                                               type: typeItem.mimes[0]\r
+                                       });\r
+\r
+                                       for (name in data.params)\r
+                                               embed.attr(name, data.params[name]);\r
+\r
+                                       tinymce.each(rootAttributes, function(name) {\r
+                                               if (data[name] && name != 'type')\r
+                                                       embed.attr(name, data[name]);\r
+                                       });\r
+\r
+                                       object.append(embed);\r
+                               }\r
+\r
+                               // Insert raw HTML\r
+                               if (data.object_html) {\r
+                                       value = new Node('#text', 3);\r
+                                       value.raw = true;\r
+                                       value.value = data.object_html;\r
+                                       object.append(value);\r
+                               }\r
+\r
+                               // Append object to video element if it exists\r
+                               if (video)\r
+                                       video.append(object);\r
+                       }\r
+\r
+                       if (video) {\r
+                               // Insert raw HTML\r
+                               if (data.video_html) {\r
+                                       value = new Node('#text', 3);\r
+                                       value.raw = true;\r
+                                       value.value = data.video_html;\r
+                                       video.append(value);\r
+                               }\r
+                       }\r
+\r
+                       if (audio) {\r
+                               // Insert raw HTML\r
+                               if (data.video_html) {\r
+                                       value = new Node('#text', 3);\r
+                                       value.raw = true;\r
+                                       value.value = data.video_html;\r
+                                       audio.append(value);\r
+                               }\r
+                       }\r
+\r
+                       var n = video || audio || object || embed;\r
+                       if (n)\r
+                               node.replace(n);\r
+                       else\r
+                               node.remove();\r
+               },\r
+\r
+               /**\r
+                * Converts a tinymce.html.Node video/object/embed to an img element.\r
+                *\r
+                * The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:\r
+                * <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />\r
+                *\r
+                * The JSON structure will be like this:\r
+                * {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}\r
+                */\r
+               objectToImg : function(node) {\r
+                       var object, embed, video, iframe, img, name, id, width, height, style, i, html,\r
+                               param, params, source, sources, data, type, lookup = this.lookup,\r
+                               matches, attrs, urlConverter = this.editor.settings.url_converter,\r
+                               urlConverterScope = this.editor.settings.url_converter_scope,\r
+                               hspace, vspace, align, bgcolor;\r
+\r
+                       function getInnerHTML(node) {\r
+                               return new tinymce.html.Serializer({\r
+                                       inner: true,\r
+                                       validate: false\r
+                               }).serialize(node);\r
+                       };\r
+\r
+                       function lookupAttribute(o, attr) {\r
+                               return lookup[(o.attr(attr) || '').toLowerCase()];\r
+                       }\r
+\r
+                       function lookupExtension(src) {\r
+                               var ext = src.replace(/^.*\.([^.]+)$/, '$1');\r
+                               return lookup[ext.toLowerCase() || ''];\r
+                       }\r
+\r
+                       // If node isn't in document\r
+                       if (!node.parent)\r
+                               return;\r
+\r
+                       // Handle media scripts\r
+                       if (node.name === 'script') {\r
+                               if (node.firstChild)\r
+                                       matches = scriptRegExp.exec(node.firstChild.value);\r
+\r
+                               if (!matches)\r
+                                       return;\r
+\r
+                               type = matches[1];\r
+                               data = {video : {}, params : JSON.parse(matches[2])};\r
+                               width = data.params.width;\r
+                               height = data.params.height;\r
+                       }\r
+\r
+                       // Setup data objects\r
+                       data = data || {\r
+                               video : {},\r
+                               params : {}\r
+                       };\r
+\r
+                       // Setup new image object\r
+                       img = new Node('img', 1);\r
+                       img.attr({\r
+                               src : this.editor.theme.url + '/img/trans.gif'\r
+                       });\r
+\r
+                       // Video element\r
+                       name = node.name;\r
+                       if (name === 'video' || name == 'audio') {\r
+                               video = node;\r
+                               object = node.getAll('object')[0];\r
+                               embed = node.getAll('embed')[0];\r
+                               width = video.attr('width');\r
+                               height = video.attr('height');\r
+                               id = video.attr('id');\r
+                               data.video = {attrs : {}, sources : []};\r
+\r
+                               // Get all video attributes\r
+                               attrs = data.video.attrs;\r
+                               for (name in video.attributes.map)\r
+                                       attrs[name] = video.attributes.map[name];\r
+\r
+                               source = node.attr('src');\r
+                               if (source)\r
+                                       data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});\r
+\r
+                               // Get all sources\r
+                               sources = video.getAll("source");\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       source = sources[i].remove();\r
+\r
+                                       data.video.sources.push({\r
+                                               src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),\r
+                                               type: source.attr('type'),\r
+                                               media: source.attr('media')\r
+                                       });\r
+                               }\r
+\r
+                               // Convert the poster URL\r
+                               if (attrs.poster)\r
+                                       attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);\r
+                       }\r
+\r
+                       // Object element\r
+                       if (node.name === 'object') {\r
+                               object = node;\r
+                               embed = node.getAll('embed')[0];\r
+                       }\r
+\r
+                       // Embed element\r
+                       if (node.name === 'embed')\r
+                               embed = node;\r
+\r
+                       // Iframe element\r
+                       if (node.name === 'iframe') {\r
+                               iframe = node;\r
+                               type = 'Iframe';\r
+                       }\r
+\r
+                       if (object) {\r
+                               // Get width/height\r
+                               width = width || object.attr('width');\r
+                               height = height || object.attr('height');\r
+                               style = style || object.attr('style');\r
+                               id = id || object.attr('id');\r
+                               hspace = hspace || object.attr('hspace');\r
+                               vspace = vspace || object.attr('vspace');\r
+                               align = align || object.attr('align');\r
+                               bgcolor = bgcolor || object.attr('bgcolor');\r
+                               data.name = object.attr('name');\r
+\r
+                               // Get all object params\r
+                               params = object.getAll("param");\r
+                               for (i = 0; i < params.length; i++) {\r
+                                       param = params[i];\r
+                                       name = param.remove().attr('name');\r
+\r
+                                       if (!excludedAttrs[name])\r
+                                               data.params[name] = param.attr('value');\r
+                               }\r
+\r
+                               data.params.src = data.params.src || object.attr('data');\r
+                       }\r
+\r
+                       if (embed) {\r
+                               // Get width/height\r
+                               width = width || embed.attr('width');\r
+                               height = height || embed.attr('height');\r
+                               style = style || embed.attr('style');\r
+                               id = id || embed.attr('id');\r
+                               hspace = hspace || embed.attr('hspace');\r
+                               vspace = vspace || embed.attr('vspace');\r
+                               align = align || embed.attr('align');\r
+                               bgcolor = bgcolor || embed.attr('bgcolor');\r
+\r
+                               // Get all embed attributes\r
+                               for (name in embed.attributes.map) {\r
+                                       if (!excludedAttrs[name] && !data.params[name])\r
+                                               data.params[name] = embed.attributes.map[name];\r
+                               }\r
+                       }\r
+\r
+                       if (iframe) {\r
+                               // Get width/height\r
+                               width = normalizeSize(iframe.attr('width'));\r
+                               height = normalizeSize(iframe.attr('height'));\r
+                               style = style || iframe.attr('style');\r
+                               id = iframe.attr('id');\r
+                               hspace = iframe.attr('hspace');\r
+                               vspace = iframe.attr('vspace');\r
+                               align = iframe.attr('align');\r
+                               bgcolor = iframe.attr('bgcolor');\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       img.attr(name, iframe.attr(name));\r
+                               });\r
+\r
+                               // Get all iframe attributes\r
+                               for (name in iframe.attributes.map) {\r
+                                       if (!excludedAttrs[name] && !data.params[name])\r
+                                               data.params[name] = iframe.attributes.map[name];\r
+                               }\r
+                       }\r
+\r
+                       // Use src not movie\r
+                       if (data.params.movie) {\r
+                               data.params.src = data.params.src || data.params.movie;\r
+                               delete data.params.movie;\r
+                       }\r
+\r
+                       // Convert the URL to relative/absolute depending on configuration\r
+                       if (data.params.src)\r
+                               data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');\r
+\r
+                       if (video) {\r
+                               if (node.name === 'video')\r
+                                       type = lookup.video.name;\r
+                               else if (node.name === 'audio')\r
+                                       type = lookup.audio.name;\r
+                       }\r
+\r
+                       if (object && !type)\r
+                               type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;\r
+\r
+                       if (embed && !type)\r
+                               type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;\r
+\r
+                       // for embedded audio we preserve the original specified type\r
+                       if (embed && type == 'EmbeddedAudio') {\r
+                               data.params.type = embed.attr('type');\r
+                       }\r
+\r
+                       // Replace the video/object/embed element with a placeholder image containing the data\r
+                       node.replace(img);\r
+\r
+                       // Remove embed\r
+                       if (embed)\r
+                               embed.remove();\r
+\r
+                       // Serialize the inner HTML of the object element\r
+                       if (object) {\r
+                               html = getInnerHTML(object.remove());\r
+\r
+                               if (html)\r
+                                       data.object_html = html;\r
+                       }\r
+\r
+                       // Serialize the inner HTML of the video element\r
+                       if (video) {\r
+                               html = getInnerHTML(video.remove());\r
+\r
+                               if (html)\r
+                                       data.video_html = html;\r
+                       }\r
+\r
+                       data.hspace = hspace;\r
+                       data.vspace = vspace;\r
+                       data.align = align;\r
+                       data.bgcolor = bgcolor;\r
+\r
+                       // Set width/height of placeholder\r
+                       img.attr({\r
+                               id : id,\r
+                               'class' : 'mceItemMedia mceItem' + (type || 'Flash'),\r
+                               style : style,\r
+                               width : width || (node.name == 'audio' ? "300" : "320"),\r
+                               height : height || (node.name == 'audio' ? "32" : "240"),\r
+                               hspace : hspace,\r
+                               vspace : vspace,\r
+                               align : align,\r
+                               bgcolor : bgcolor,\r
+                               "data-mce-json" : JSON.serialize(data, "'")\r
+                       });\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/js/embed.js b/3.x/src/resources/javascript/TinyMCE/plugins/media/js/embed.js
new file mode 100644 (file)
index 0000000..f8dc810
--- /dev/null
@@ -0,0 +1,73 @@
+/**\r
+ * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.\r
+ */\r
+\r
+function writeFlash(p) {\r
+       writeEmbed(\r
+               'D27CDB6E-AE6D-11cf-96B8-444553540000',\r
+               'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',\r
+               'application/x-shockwave-flash',\r
+               p\r
+       );\r
+}\r
+\r
+function writeShockWave(p) {\r
+       writeEmbed(\r
+       '166B1BCA-3F9C-11CF-8075-444553540000',\r
+       'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',\r
+       'application/x-director',\r
+               p\r
+       );\r
+}\r
+\r
+function writeQuickTime(p) {\r
+       writeEmbed(\r
+               '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',\r
+               'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',\r
+               'video/quicktime',\r
+               p\r
+       );\r
+}\r
+\r
+function writeRealMedia(p) {\r
+       writeEmbed(\r
+               'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',\r
+               'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',\r
+               'audio/x-pn-realaudio-plugin',\r
+               p\r
+       );\r
+}\r
+\r
+function writeWindowsMedia(p) {\r
+       p.url = p.src;\r
+       writeEmbed(\r
+               '6BF52A52-394A-11D3-B153-00C04F79FAA6',\r
+               'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',\r
+               'application/x-mplayer2',\r
+               p\r
+       );\r
+}\r
+\r
+function writeEmbed(cls, cb, mt, p) {\r
+       var h = '', n;\r
+\r
+       h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';\r
+       h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';\r
+       h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';\r
+       h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';\r
+       h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';\r
+       h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';\r
+       h += '>';\r
+\r
+       for (n in p)\r
+               h += '<param name="' + n + '" value="' + p[n] + '">';\r
+\r
+       h += '<embed type="' + mt + '"';\r
+\r
+       for (n in p)\r
+               h += n + '="' + p[n] + '" ';\r
+\r
+       h += '></embed></object>';\r
+\r
+       document.write(h);\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/js/media.js b/3.x/src/resources/javascript/TinyMCE/plugins/media/js/media.js
new file mode 100644 (file)
index 0000000..f6a081a
--- /dev/null
@@ -0,0 +1,503 @@
+(function() {\r
+       var url;\r
+\r
+       if (url = tinyMCEPopup.getParam("media_external_list_url"))\r
+               document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
+\r
+       function get(id) {\r
+               return document.getElementById(id);\r
+       }\r
+\r
+       function clone(obj) {\r
+               var i, len, copy, attr;\r
+\r
+               if (null == obj || "object" != typeof obj)\r
+                       return obj;\r
+\r
+               // Handle Array\r
+               if ('length' in obj) {\r
+                       copy = [];\r
+\r
+                       for (i = 0, len = obj.length; i < len; ++i) {\r
+                               copy[i] = clone(obj[i]);\r
+                       }\r
+\r
+                       return copy;\r
+               }\r
+\r
+               // Handle Object\r
+               copy = {};\r
+               for (attr in obj) {\r
+                       if (obj.hasOwnProperty(attr))\r
+                               copy[attr] = clone(obj[attr]);\r
+               }\r
+\r
+               return copy;\r
+       }\r
+\r
+       function getVal(id) {\r
+               var elm = get(id);\r
+\r
+               if (elm.nodeName == "SELECT")\r
+                       return elm.options[elm.selectedIndex].value;\r
+\r
+               if (elm.type == "checkbox")\r
+                       return elm.checked;\r
+\r
+               return elm.value;\r
+       }\r
+\r
+       function setVal(id, value, name) {\r
+               if (typeof(value) != 'undefined' && value != null) {\r
+                       var elm = get(id);\r
+\r
+                       if (elm.nodeName == "SELECT")\r
+                               selectByValue(document.forms[0], id, value);\r
+                       else if (elm.type == "checkbox") {\r
+                               if (typeof(value) == 'string') {\r
+                                       value = value.toLowerCase();\r
+                                       value = (!name && value === 'true') || (name && value === name.toLowerCase());\r
+                               }\r
+                               elm.checked = !!value;\r
+                       } else\r
+                               elm.value = value;\r
+               }\r
+       }\r
+\r
+       window.Media = {\r
+               init : function() {\r
+                       var html, editor, self = this;\r
+\r
+                       self.editor = editor = tinyMCEPopup.editor;\r
+\r
+                       // Setup file browsers and color pickers\r
+                       get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');\r
+                       get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');\r
+                       get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
+                       get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media');\r
+                       get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media');\r
+                       get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media');\r
+                       get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');\r
+                       get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','image','media');\r
+\r
+                       html = self.getMediaListHTML('medialist', 'src', 'media', 'media');\r
+                       if (html == "")\r
+                               get("linklistrow").style.display = 'none';\r
+                       else\r
+                               get("linklistcontainer").innerHTML = html;\r
+\r
+                       if (isVisible('filebrowser'))\r
+                               get('src').style.width = '230px';\r
+\r
+                       if (isVisible('video_filebrowser_altsource1'))\r
+                               get('video_altsource1').style.width = '220px';\r
+\r
+                       if (isVisible('video_filebrowser_altsource2'))\r
+                               get('video_altsource2').style.width = '220px';\r
+\r
+                       if (isVisible('audio_filebrowser_altsource1'))\r
+                               get('audio_altsource1').style.width = '220px';\r
+\r
+                       if (isVisible('audio_filebrowser_altsource2'))\r
+                               get('audio_altsource2').style.width = '220px';\r
+\r
+                       if (isVisible('filebrowser_poster'))\r
+                               get('video_poster').style.width = '220px';\r
+\r
+                       editor.dom.setOuterHTML(get('media_type'), self.getMediaTypeHTML(editor));\r
+\r
+                       self.setDefaultDialogSettings(editor);\r
+                       self.data = clone(tinyMCEPopup.getWindowArg('data'));\r
+                       self.dataToForm();\r
+                       self.preview();\r
+\r
+                       updateColor('bgcolor_pick', 'bgcolor');\r
+               },\r
+\r
+               insert : function() {\r
+                       var editor = tinyMCEPopup.editor;\r
+\r
+                       this.formToData();\r
+                       editor.execCommand('mceRepaint');\r
+                       tinyMCEPopup.restoreSelection();\r
+                       editor.selection.setNode(editor.plugins.media.dataToImg(this.data));\r
+                       tinyMCEPopup.close();\r
+               },\r
+\r
+               preview : function() {\r
+                       get('prev').innerHTML = this.editor.plugins.media.dataToHtml(this.data, true);\r
+               },\r
+\r
+               moveStates : function(to_form, field) {\r
+                       var data = this.data, editor = this.editor,\r
+                               mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;\r
+\r
+                       defaultStates = {\r
+                               // QuickTime\r
+                               quicktime_autoplay : true,\r
+                               quicktime_controller : true,\r
+\r
+                               // Flash\r
+                               flash_play : true,\r
+                               flash_loop : true,\r
+                               flash_menu : true,\r
+\r
+                               // WindowsMedia\r
+                               windowsmedia_autostart : true,\r
+                               windowsmedia_enablecontextmenu : true,\r
+                               windowsmedia_invokeurls : true,\r
+\r
+                               // RealMedia\r
+                               realmedia_autogotourl : true,\r
+                               realmedia_imagestatus : true\r
+                       };\r
+\r
+                       function parseQueryParams(str) {\r
+                               var out = {};\r
+\r
+                               if (str) {\r
+                                       tinymce.each(str.split('&'), function(item) {\r
+                                               var parts = item.split('=');\r
+\r
+                                               out[unescape(parts[0])] = unescape(parts[1]);\r
+                                       });\r
+                               }\r
+\r
+                               return out;\r
+                       };\r
+\r
+                       function setOptions(type, names) {\r
+                               var i, name, formItemName, value, list;\r
+\r
+                               if (type == data.type || type == 'global') {\r
+                                       names = tinymce.explode(names);\r
+                                       for (i = 0; i < names.length; i++) {\r
+                                               name = names[i];\r
+                                               formItemName = type == 'global' ? name : type + '_' + name;\r
+\r
+                                               if (type == 'global')\r
+                                               list = data;\r
+                                       else if (type == 'video' || type == 'audio') {\r
+                                                       list = data.video.attrs;\r
+\r
+                                                       if (!list && !to_form)\r
+                                                       data.video.attrs = list = {};\r
+                                               } else\r
+                                               list = data.params;\r
+\r
+                                               if (list) {\r
+                                                       if (to_form) {\r
+                                                               setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : '');\r
+                                                       } else {\r
+                                                               delete list[name];\r
+\r
+                                                               value = getVal(formItemName);\r
+                                                               if ((type == 'video' || type == 'audio') && value === true)\r
+                                                                       value = name;\r
+\r
+                                                               if (defaultStates[formItemName]) {\r
+                                                                       if (value !== defaultStates[formItemName]) {\r
+                                                                               value = "" + value;\r
+                                                                               list[name] = value;\r
+                                                                       }\r
+                                                               } else if (value) {\r
+                                                                       value = "" + value;\r
+                                                                       list[name] = value;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       if (!to_form) {\r
+                               data.type = get('media_type').options[get('media_type').selectedIndex].value;\r
+                               data.width = getVal('width');\r
+                               data.height = getVal('height');\r
+\r
+                               // Switch type based on extension\r
+                               src = getVal('src');\r
+                               if (field == 'src') {\r
+                                       ext = src.replace(/^.*\.([^.]+)$/, '$1');\r
+                                       if (typeInfo = mediaPlugin.getType(ext))\r
+                                               data.type = typeInfo.name.toLowerCase();\r
+\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               if (data.type == "video" || data.type == "audio") {\r
+                                       if (!data.video.sources)\r
+                                               data.video.sources = [];\r
+\r
+                                       data.video.sources[0] = {src: getVal('src')};\r
+                               }\r
+                       }\r
+\r
+                       // Hide all fieldsets and show the one active\r
+                       get('video_options').style.display = 'none';\r
+                       get('audio_options').style.display = 'none';\r
+                       get('flash_options').style.display = 'none';\r
+                       get('quicktime_options').style.display = 'none';\r
+                       get('shockwave_options').style.display = 'none';\r
+                       get('windowsmedia_options').style.display = 'none';\r
+                       get('realmedia_options').style.display = 'none';\r
+                       get('embeddedaudio_options').style.display = 'none';\r
+\r
+                       if (get(data.type + '_options'))\r
+                               get(data.type + '_options').style.display = 'block';\r
+\r
+                       setVal('media_type', data.type);\r
+\r
+                       setOptions('flash', 'play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars');\r
+                       setOptions('quicktime', 'loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc');\r
+                       setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');\r
+                       setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');\r
+                       setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');\r
+                       setOptions('video', 'poster,autoplay,loop,muted,preload,controls');\r
+                       setOptions('audio', 'autoplay,loop,preload,controls');\r
+                       setOptions('embeddedaudio', 'autoplay,loop,controls');\r
+                       setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');\r
+\r
+                       if (to_form) {\r
+                               if (data.type == 'video') {\r
+                                       if (data.video.sources[0])\r
+                                               setVal('src', data.video.sources[0].src);\r
+\r
+                                       src = data.video.sources[1];\r
+                                       if (src)\r
+                                               setVal('video_altsource1', src.src);\r
+\r
+                                       src = data.video.sources[2];\r
+                                       if (src)\r
+                                               setVal('video_altsource2', src.src);\r
+                } else if (data.type == 'audio') {\r
+                    if (data.video.sources[0])\r
+                        setVal('src', data.video.sources[0].src);\r
+                    \r
+                    src = data.video.sources[1];\r
+                    if (src)\r
+                        setVal('audio_altsource1', src.src);\r
+                    \r
+                    src = data.video.sources[2];\r
+                    if (src)\r
+                        setVal('audio_altsource2', src.src);\r
+                               } else {\r
+                                       // Check flash vars\r
+                                       if (data.type == 'flash') {\r
+                                               tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) {\r
+                                                       if (value == '$url')\r
+                                                               data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || '';\r
+                                               });\r
+                                       }\r
+\r
+                                       setVal('src', data.params.src);\r
+                               }\r
+                       } else {\r
+                               src = getVal("src");\r
+\r
+                               // YouTube *NEW*\r
+                               if (src.match(/youtu.be\/[a-z1-9.-_]+/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://www.youtube.com/embed/' + src.match(/youtu.be\/([a-z1-9.-_]+)/)[1];\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               // YouTube\r
+                               if (src.match(/youtube.com(.+)v=([^&]+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1];\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               // Google video\r
+                               if (src.match(/video.google.com(.+)docid=([^&]+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 326;\r
+                                       data.type = 'flash';\r
+                                       src = 'http://video.google.com/googleplayer.swf?docId=' + src.match(/docid=([^&]+)/)[1] + '&hl=en';\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+                               \r
+                               // Vimeo\r
+                               if (src.match(/vimeo.com\/([0-9]+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://player.vimeo.com/video/' + src.match(/vimeo.com\/([0-9]+)/)[1];\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+            \r
+                               // stream.cz\r
+                               if (src.match(/stream.cz\/((?!object).)*\/([0-9]+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://www.stream.cz/object/' + src.match(/stream.cz\/[^/]+\/([0-9]+)/)[1];\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+                               \r
+                               // Google maps\r
+                               if (src.match(/maps.google.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://maps.google.com/maps/ms?msid=' + src.match(/msid=(.+)/)[1] + "&output=embed";\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               if (data.type == 'video') {\r
+                                       if (!data.video.sources)\r
+                                               data.video.sources = [];\r
+\r
+                                       data.video.sources[0] = {src : src};\r
+\r
+                                       src = getVal("video_altsource1");\r
+                                       if (src)\r
+                                               data.video.sources[1] = {src : src};\r
+\r
+                                       src = getVal("video_altsource2");\r
+                                       if (src)\r
+                                               data.video.sources[2] = {src : src};\r
+                } else if (data.type == 'audio') {\r
+                    if (!data.video.sources)\r
+                        data.video.sources = [];\r
+                    \r
+                    data.video.sources[0] = {src : src};\r
+                    \r
+                    src = getVal("audio_altsource1");\r
+                    if (src)\r
+                        data.video.sources[1] = {src : src};\r
+                    \r
+                    src = getVal("audio_altsource2");\r
+                    if (src)\r
+                        data.video.sources[2] = {src : src};\r
+                               } else\r
+                                       data.params.src = src;\r
+\r
+                               // Set default size\r
+                setVal('width', data.width || (data.type == 'audio' ? 300 : 320));\r
+                setVal('height', data.height || (data.type == 'audio' ? 32 : 240));\r
+                       }\r
+               },\r
+\r
+               dataToForm : function() {\r
+                       this.moveStates(true);\r
+               },\r
+\r
+               formToData : function(field) {\r
+                       if (field == "width" || field == "height")\r
+                               this.changeSize(field);\r
+\r
+                       if (field == 'source') {\r
+                               this.moveStates(false, field);\r
+                               setVal('source', this.editor.plugins.media.dataToHtml(this.data));\r
+                               this.panel = 'source';\r
+                       } else {\r
+                               if (this.panel == 'source') {\r
+                                       this.data = clone(this.editor.plugins.media.htmlToData(getVal('source')));\r
+                                       this.dataToForm();\r
+                                       this.panel = '';\r
+                               }\r
+\r
+                               this.moveStates(false, field);\r
+                               this.preview();\r
+                       }\r
+               },\r
+\r
+               beforeResize : function() {\r
+            this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);\r
+            this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);\r
+               },\r
+\r
+               changeSize : function(type) {\r
+                       var width, height, scale, size;\r
+\r
+                       if (get('constrain').checked) {\r
+                width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);\r
+                height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);\r
+\r
+                               if (type == 'width') {\r
+                                       this.height = Math.round((width / this.width) * height);\r
+                                       setVal('height', this.height);\r
+                               } else {\r
+                                       this.width = Math.round((height / this.height) * width);\r
+                                       setVal('width', this.width);\r
+                               }\r
+                       }\r
+               },\r
+\r
+               getMediaListHTML : function() {\r
+                       if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {\r
+                               var html = "";\r
+\r
+                               html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">';\r
+                               html += '<option value="">---</option>';\r
+\r
+                               for (var i=0; i<tinyMCEMediaList.length; i++)\r
+                                       html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';\r
+\r
+                               html += '</select>';\r
+\r
+                               return html;\r
+                       }\r
+\r
+                       return "";\r
+               },\r
+\r
+               getMediaTypeHTML : function(editor) {\r
+                       function option(media_type, element) {\r
+                               if (!editor.schema.getElementRule(element || media_type)) {\r
+                                       return '';\r
+                               }\r
+\r
+                               return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>'\r
+                       }\r
+\r
+                       var html = "";\r
+\r
+                       html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">';\r
+                       html += option("video");\r
+                       html += option("audio");\r
+                       html += option("flash", "object");\r
+                       html += option("quicktime", "object");\r
+                       html += option("shockwave", "object");\r
+                       html += option("windowsmedia", "object");\r
+                       html += option("realmedia", "object");\r
+                       html += option("iframe");\r
+\r
+                       if (editor.getParam('media_embedded_audio', false)) {\r
+                               html += option('embeddedaudio', "object");\r
+                       }\r
+\r
+                       html += '</select>';\r
+                       return html;\r
+               },\r
+\r
+               setDefaultDialogSettings : function(editor) {\r
+                       var defaultDialogSettings = editor.getParam("media_dialog_defaults", {});\r
+                       tinymce.each(defaultDialogSettings, function(v, k) {\r
+                               setVal(k, v);\r
+                       });\r
+               }\r
+       };\r
+\r
+       tinyMCEPopup.requireLangPack();\r
+       tinyMCEPopup.onInit.add(function() {\r
+               Media.init();\r
+       });\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/media/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..ecef3a8
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.media_dlg',{list:"List",file:"File/URL",advanced:"Advanced",general:"General",title:"Insert/Edit Embedded Media","align_top_left":"Top Left","align_center":"Center","align_left":"Left","align_bottom":"Bottom","align_right":"Right","align_top":"Top","qt_stream_warn":"Streamed RTSP resources should be added to the QT Source field under the Advanced tab.\nYou should also add a non-streamed version to the Source field.",qtsrc:"QT Source",progress:"Progress",sound:"Sound",swstretchvalign:"Stretch V-Align",swstretchhalign:"Stretch H-Align",swstretchstyle:"Stretch Style",scriptcallbacks:"Script Callbacks","align_top_right":"Top Right",uimode:"UI Mode",rate:"Rate",playcount:"Play Count",defaultframe:"Default Frame",currentposition:"Current Position",currentmarker:"Current Marker",captioningid:"Captioning ID",baseurl:"Base URL",balance:"Balance",windowlessvideo:"Windowless Video",stretchtofit:"Stretch to Fit",mute:"Mute",invokeurls:"Invoke URLs",fullscreen:"Full Screen",enabled:"Enabled",autostart:"Auto Start",volume:"Volume",target:"Target",qtsrcchokespeed:"Choke Speed",href:"HREF",endtime:"End Time",starttime:"Start Time",enablejavascript:"Enable JavaScript",correction:"No Correction",targetcache:"Target Cache",playeveryframe:"Play Every Frame",kioskmode:"Kiosk Mode",controller:"Controller",menu:"Show Menu",loop:"Loop",play:"Auto Play",hspace:"H-Space",vspace:"V-Space","class_name":"Class",name:"Name",id:"ID",type:"Type",size:"Dimensions",preview:"Preview","constrain_proportions":"Constrain Proportions",controls:"Controls",numloop:"Num Loops",console:"Console",cache:"Cache",autohref:"Auto HREF",liveconnect:"SWLiveConnect",flashvars:"Flash Vars",base:"Base",bgcolor:"Background",wmode:"WMode",salign:"SAlign",align:"Align",scale:"Scale",quality:"Quality",shuffle:"Shuffle",prefetch:"Prefetch",nojava:"No Java",maintainaspect:"Maintain Aspect",imagestatus:"Image Status",center:"Center",autogotourl:"Auto Goto URL","shockwave_options":"Shockwave Options","rmp_options":"Real Media Player Options","wmp_options":"Windows Media Player Options","qt_options":"QuickTime Options","flash_options":"Flash Options",hidden:"Hidden","align_bottom_left":"Bottom Left","align_bottom_right":"Bottom Right","html5_video_options":"HTML5 Video Options",altsource1:"Alternative source 1",altsource2:"Alternative source 2",preload:"Preload",poster:"Poster",source:"Source","html5_audio_options":"Audio Options","preload_none":"Don\'t Preload","preload_metadata":"Preload video metadata","preload_auto":"Let user\'s browser decide", "embedded_audio_options":"Embedded Audio Options", video:"HTML5 Video", audio:"HTML5 Audio", flash:"Flash", quicktime:"QuickTime", shockwave:"Shockwave", windowsmedia:"Windows Media", realmedia:"Real Media", iframe:"Iframe", embeddedaudio:"Embedded Audio" }); 
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/media.htm b/3.x/src/resources/javascript/TinyMCE/plugins/media/media.htm
new file mode 100644 (file)
index 0000000..957d83a
--- /dev/null
@@ -0,0 +1,922 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#media_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/media.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <link href="css/media.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body style="display: none" role="application">\r
+<form onsubmit="Media.insert();return false;" action="#">\r
+               <div class="tabs" role="presentation">\r
+                       <ul>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.general}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>\r
+                               <li id="source_tab" aria-controls="source_panel"><span><a href="javascript:mcTabs.displayTab('source_tab','source_panel');Media.formToData('source');" onmousedown="return false;">{#media_dlg.source}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="general_panel" class="panel current">\r
+                               <fieldset>\r
+                                       <legend>{#media_dlg.general}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                                       <tr>\r
+                                                               <td><label for="media_type">{#media_dlg.type}</label></td>\r
+                                                               <td>\r
+                                                                       <select id="media_type"></select>\r
+                                                               </td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                       <td><label for="src">{#media_dlg.file}</label></td>\r
+                                                               <td>\r
+                                                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="Media.formToData();" /></td>\r
+                                                                               <td id="filebrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                                       </table>\r
+                                                               </td>\r
+                                                       </tr>\r
+                                                       <tr id="linklistrow">\r
+                                                               <td><label for="linklist">{#media_dlg.list}</label></td>\r
+                                                               <td id="linklistcontainer"><select id="linklist"><option value=""></option></select></td>\r
+                                                       </tr>\r
+                                                       <tr>\r
+                                                               <td><label for="width">{#media_dlg.size}</label></td>\r
+                                                               <td>\r
+                                                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                               <tr>\r
+                                                                                       <td><input type="text" id="width" name="width" value="" class="size" onchange="Media.formToData('width');" onfocus="Media.beforeResize();" /> x <input type="text" id="height" name="height" value="" class="size" onfocus="Media.beforeResize();" onchange="Media.formToData('height');" /></td>\r
+                                                                                       <td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" checked="checked" /></td>\r
+                                                                                       <td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>\r
+                                                                               </tr>\r
+                                                                       </table>\r
+                                                               </td>\r
+                                                       </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset>\r
+                                       <legend>{#media_dlg.preview}</legend>\r
+                                       <div id="prev"></div>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="advanced_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#media_dlg.advanced}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">\r
+                                               <tr>\r
+                                                       <td><label for="id">{#media_dlg.id}</label></td>\r
+                                                       <td><input type="text" id="id" name="id" onchange="Media.formToData();" /></td>\r
+                                                       <td><label for="name">{#media_dlg.name}</label></td>\r
+                                                       <td><input type="text" id="name" name="name" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="align">{#media_dlg.align}</label></td>\r
+                                                       <td>\r
+                                                               <select id="align" name="align" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="top">{#media_dlg.align_top}</option>\r
+                                                                       <option value="right">{#media_dlg.align_right}</option>\r
+                                                                       <option value="bottom">{#media_dlg.align_bottom}</option>\r
+                                                                       <option value="left">{#media_dlg.align_left}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');Media.formToData();" /></td>\r
+                                                                               <td id="bgcolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="vspace">{#media_dlg.vspace}</label></td>\r
+                                                       <td><input type="text" id="vspace" name="vspace" class="number" onchange="Media.formToData();" /></td>\r
+                                                       <td><label for="hspace">{#media_dlg.hspace}</label></td>\r
+                                                       <td><input type="text" id="hspace" name="hspace" class="number" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="video_options">\r
+                                       <legend>{#media_dlg.html5_video_options}</legend>\r
+\r
+                                       <table role="presentation">\r
+                                               <tr>\r
+                                                       <td><label for="video_altsource1">{#media_dlg.altsource1}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="video_altsource1" name="video_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="video_altsource1_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="video_altsource2">{#media_dlg.altsource2}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="video_altsource2" name="video_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="video_altsource2_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="video_poster">{#media_dlg.poster}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="video_poster" name="video_poster" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="video_poster_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="video_preload">{#media_dlg.preload}</label></td>\r
+                                                       <td>\r
+                                                               <select id="video_preload" name="video_preload" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#media_dlg.preload_none}</option> \r
+                                                                       <option value="metadata">{#media_dlg.preload_metadata}</option>\r
+                                                                       <option value="auto">{#media_dlg.preload_auto}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="video_autoplay" name="video_autoplay" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_autoplay">{#media_dlg.play}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_muted">{#media_dlg.mute}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                                       <tr>\r
+                                                                                                       <td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>\r
+                                                                                                       <td><label for="video_loop">{#media_dlg.loop}</label></td>\r
+                                                                                       </tr>\r
+                                                                       </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_controls">{#media_dlg.controls}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="embeddedaudio_options">\r
+                                       <legend>{#media_dlg.embedded_audio_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="embeddedaudio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_autoplay">{#media_dlg.play}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="embeddedaudio_loop" name="audio_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_loop">{#media_dlg.loop}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="embeddedaudio_controls" name="audio_controls" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_controls">{#media_dlg.controls}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="audio_options">\r
+                                       <legend>{#media_dlg.html5_audio_options}</legend>\r
+\r
+                                       <table role="presentation">\r
+                                               <tr>\r
+                                                       <td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="audio_altsource1_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="audio_altsource2_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="audio_preload">{#media_dlg.preload}</label></td>\r
+                                                       <td>\r
+                                                               <select id="audio_preload" name="audio_preload" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#media_dlg.preload_none}</option>\r
+                                                                       <option value="metadata">{#media_dlg.preload_metadata}</option>\r
+                                                                       <option value="auto">{#media_dlg.preload_auto}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_autoplay">{#media_dlg.play}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_loop">{#media_dlg.loop}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_controls">{#media_dlg.controls}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="flash_options">\r
+                                       <legend>{#media_dlg.flash_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td><label for="flash_quality">{#media_dlg.quality}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_quality" name="flash_quality" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="high">high</option>\r
+                                                                       <option value="low">low</option>\r
+                                                                       <option value="autolow">autolow</option>\r
+                                                                       <option value="autohigh">autohigh</option>\r
+                                                                       <option value="best">best</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="flash_scale">{#media_dlg.scale}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_scale" name="flash_scale" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="showall">showall</option>\r
+                                                                       <option value="noborder">noborder</option>\r
+                                                                       <option value="exactfit">exactfit</option>\r
+                                                                       <option value="noscale">noscale</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="flash_wmode">{#media_dlg.wmode}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_wmode" name="flash_wmode" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="window">window</option>\r
+                                                                       <option value="opaque">opaque</option>\r
+                                                                       <option value="transparent">transparent</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="flash_salign">{#media_dlg.salign}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_salign" name="flash_salign" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="l">{#media_dlg.align_left}</option>\r
+                                                                       <option value="t">{#media_dlg.align_top}</option>\r
+                                                                       <option value="r">{#media_dlg.align_right}</option>\r
+                                                                       <option value="b">{#media_dlg.align_bottom}</option>\r
+                                                                       <option value="tl">{#media_dlg.align_top_left}</option>\r
+                                                                       <option value="tr">{#media_dlg.align_top_right}</option>\r
+                                                                       <option value="bl">{#media_dlg.align_bottom_left}</option>\r
+                                                                       <option value="br">{#media_dlg.align_bottom_right}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_play">{#media_dlg.play}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_loop">{#media_dlg.loop}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_menu">{#media_dlg.menu}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+\r
+                                       <table role="presentation">\r
+                                               <tr>\r
+                                                       <td><label for="flash_base">{#media_dlg.base}</label></td>\r
+                                                       <td><input type="text" id="flash_base" name="flash_base" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>\r
+                                                       <td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="quicktime_options">\r
+                                       <legend>{#media_dlg.qt_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_loop" name="quicktime_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_loop">{#media_dlg.loop}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_autoplay" name="quicktime_autoplay" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_autoplay">{#media_dlg.play}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_cache" name="quicktime_cache" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_cache">{#media_dlg.cache}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_controller" name="quicktime_controller" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_controller">{#media_dlg.controller}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_correction" name="quicktime_correction" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_correction">{#media_dlg.correction}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_enablejavascript" name="quicktime_enablejavascript" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_enablejavascript">{#media_dlg.enablejavascript}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_kioskmode" name="quicktime_kioskmode" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_kioskmode">{#media_dlg.kioskmode}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_autohref" name="quicktime_autohref" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_autohref">{#media_dlg.autohref}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_playeveryframe" name="quicktime_playeveryframe" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_playeveryframe">{#media_dlg.playeveryframe}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_targetcache" name="quicktime_targetcache" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_targetcache">{#media_dlg.targetcache}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="quicktime_scale">{#media_dlg.scale}</label></td>\r
+                                                       <td><select id="quicktime_scale" name="quicktime_scale" class="mceEditableSelect" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="tofit">tofit</option>\r
+                                                                       <option value="aspect">aspect</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">&nbsp;</td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="quicktime_starttime">{#media_dlg.starttime}</label></td>\r
+                                                       <td><input type="text" id="quicktime_starttime" name="quicktime_starttime" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="quicktime_endtime">{#media_dlg.endtime}</label></td>\r
+                                                       <td><input type="text" id="quicktime_endtime" name="quicktime_endtime" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="quicktime_target">{#media_dlg.target}</label></td>\r
+                                                       <td><input type="text" id="quicktime_target" name="quicktime_target" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="quicktime_href">{#media_dlg.href}</label></td>\r
+                                                       <td><input type="text" id="quicktime_href" name="quicktime_href" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="quicktime_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>\r
+                                                       <td><input type="text" id="quicktime_qtsrcchokespeed" name="quicktime_qtsrcchokespeed" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="quicktime_volume">{#media_dlg.volume}</label></td>\r
+                                                       <td><input type="text" id="quicktime_volume" name="quicktime_volume" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="quicktime_qtsrc">{#media_dlg.qtsrc}</label></td>\r
+                                                       <td colspan="4">\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="quicktime_qtsrc" name="quicktime_qtsrc" onchange="Media.formToData();" /></td>\r
+                                                                               <td id="qtsrcfilebrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="windowsmedia_options">\r
+                                       <legend>{#media_dlg.wmp_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_autostart" name="windowsmedia_autostart" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_autostart">{#media_dlg.autostart}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_enabled" name="windowsmedia_enabled" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_enabled">{#media_dlg.enabled}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_enablecontextmenu" name="windowsmedia_enablecontextmenu" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_enablecontextmenu">{#media_dlg.menu}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_fullscreen" name="windowsmedia_fullscreen" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_fullscreen">{#media_dlg.fullscreen}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_invokeurls" name="windowsmedia_invokeurls" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_invokeurls">{#media_dlg.invokeurls}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_mute" name="windowsmedia_mute" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_mute">{#media_dlg.mute}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_stretchtofit" name="windowsmedia_stretchtofit" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_stretchtofit">{#media_dlg.stretchtofit}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_windowlessvideo" name="windowsmedia_windowlessvideo" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="windowsmedia_balance">{#media_dlg.balance}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_balance" name="windowsmedia_balance" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="windowsmedia_baseurl">{#media_dlg.baseurl}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_baseurl" name="windowsmedia_baseurl" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="windowsmedia_captioningid">{#media_dlg.captioningid}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_captioningid" name="windowsmedia_captioningid" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="windowsmedia_currentmarker">{#media_dlg.currentmarker}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_currentmarker" name="windowsmedia_currentmarker" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="windowsmedia_currentposition">{#media_dlg.currentposition}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_currentposition" name="windowsmedia_currentposition" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="windowsmedia_defaultframe">{#media_dlg.defaultframe}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_defaultframe" name="windowsmedia_defaultframe" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="windowsmedia_playcount">{#media_dlg.playcount}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_playcount" name="windowsmedia_playcount" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="windowsmedia_rate">{#media_dlg.rate}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_rate" name="windowsmedia_rate" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="windowsmedia_uimode">{#media_dlg.uimode}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_uimode" name="windowsmedia_uimode" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="windowsmedia_volume">{#media_dlg.volume}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_volume" name="windowsmedia_volume" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="realmedia_options">\r
+                                       <legend>{#media_dlg.rmp_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_autostart" name="realmedia_autostart" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_autostart">{#media_dlg.autostart}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_loop" name="realmedia_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_loop">{#media_dlg.loop}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_autogotourl" name="realmedia_autogotourl" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_autogotourl">{#media_dlg.autogotourl}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_center" name="realmedia_center" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_center">{#media_dlg.center}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_imagestatus" name="realmedia_imagestatus" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_imagestatus">{#media_dlg.imagestatus}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_maintainaspect" name="realmedia_maintainaspect" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_maintainaspect">{#media_dlg.maintainaspect}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_nojava" name="realmedia_nojava" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_nojava">{#media_dlg.nojava}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_prefetch" name="realmedia_prefetch" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_prefetch">{#media_dlg.prefetch}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_shuffle" name="realmedia_shuffle" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_shuffle">{#media_dlg.shuffle}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               &nbsp;\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="realmedia_console">{#media_dlg.console}</label></td>\r
+                                                       <td><input type="text" id="realmedia_console" name="realmedia_console" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="realmedia_controls">{#media_dlg.controls}</label></td>\r
+                                                       <td><input type="text" id="realmedia_controls" name="realmedia_controls" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="realmedia_numloop">{#media_dlg.numloop}</label></td>\r
+                                                       <td><input type="text" id="realmedia_numloop" name="realmedia_numloop" onchange="Media.formToData();" /></td>\r
+\r
+                                                       <td><label for="realmedia_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>\r
+                                                       <td><input type="text" id="realmedia_scriptcallbacks" name="realmedia_scriptcallbacks" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="shockwave_options">\r
+                                       <legend>{#media_dlg.shockwave_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>\r
+                                                       <td>\r
+                                                               <select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#not_set}</option>\r
+                                                                       <option value="meet">Meet</option>\r
+                                                                       <option value="fill">Fill</option>\r
+                                                                       <option value="stage">Stage</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>\r
+                                                       <td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>\r
+                                                       <td>\r
+                                                               <select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#not_set}</option>\r
+                                                                       <option value="left">{#media_dlg.align_left}</option>\r
+                                                                       <option value="center">{#media_dlg.align_center}</option>\r
+                                                                       <option value="right">{#media_dlg.align_right}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>\r
+                                                       <td>\r
+                                                               <select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#not_set}</option>\r
+                                                                       <option value="meet">Meet</option>\r
+                                                                       <option value="fill">Fill</option>\r
+                                                                       <option value="stage">Stage</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="Media.formToData();" checked="checked" /></td>\r
+                                                                               <td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="Media.formToData();" checked="checked" /></td>\r
+                                                                               <td><label for="shockwave_sound">{#media_dlg.sound}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+\r
+                                               <tr>\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td colspan="2">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="Media.formToData();" checked="checked" /></td>\r
+                                                                               <td><label for="shockwave_progress">{#media_dlg.progress}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="source_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#media_dlg.source}</legend>\r
+                                       <textarea id="source" style="width: 99%; height: 390px"></textarea>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/media/moxieplayer.swf b/3.x/src/resources/javascript/TinyMCE/plugins/media/moxieplayer.swf
new file mode 100644 (file)
index 0000000..585d772
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/media/moxieplayer.swf differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/nonbreaking/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/nonbreaking/editor_plugin.js
new file mode 100644 (file)
index 0000000..687f548
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>':"&nbsp;")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(f.keyCode==9){f.preventDefault();d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking")}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/nonbreaking/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/nonbreaking/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..d492fbe
--- /dev/null
@@ -0,0 +1,54 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.Nonbreaking', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceNonBreaking', function() {\r
+                               ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;');\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});\r
+\r
+                       if (ed.getParam('nonbreaking_force_tab')) {\r
+                               ed.onKeyDown.add(function(ed, e) {\r
+                                       if (e.keyCode == 9) {\r
+                                               e.preventDefault();\r
+       \r
+                                               ed.execCommand('mceNonBreaking');\r
+                                               ed.execCommand('mceNonBreaking');\r
+                                               ed.execCommand('mceNonBreaking');\r
+                                       }\r
+                               });\r
+                       }\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Nonbreaking space',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+\r
+               // Private methods\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/noneditable/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/noneditable/editor_plugin.js
new file mode 100644 (file)
index 0000000..da411eb
--- /dev/null
@@ -0,0 +1 @@
+(function(){var c=tinymce.dom.TreeWalker;var a="contenteditable",d="data-mce-"+a;var e=tinymce.VK;function b(n){var j=n.dom,p=n.selection,r,o="mce_noneditablecaret",r="\uFEFF";function m(t){var s;if(t.nodeType===1){s=t.getAttribute(d);if(s&&s!=="inherit"){return s}s=t.contentEditable;if(s!=="inherit"){return s}}return null}function g(s){var t;while(s){t=m(s);if(t){return t==="false"?s:null}s=s.parentNode}}function l(s){while(s){if(s.id===o){return s}s=s.parentNode}}function k(s){var t;if(s){t=new c(s,s);for(s=t.current();s;s=t.next()){if(s.nodeType===3){return s}}}}function f(v,u){var s,t;if(m(v)==="false"){if(j.isBlock(v)){p.select(v);return}}t=j.createRng();if(m(v)==="true"){if(!v.firstChild){v.appendChild(n.getDoc().createTextNode("\u00a0"))}v=v.firstChild;u=true}s=j.create("span",{id:o,"data-mce-bogus":true},r);if(u){v.parentNode.insertBefore(s,v)}else{j.insertAfter(s,v)}t.setStart(s.firstChild,1);t.collapse(true);p.setRng(t);return s}function i(s){var v,t,u;if(s){rng=p.getRng(true);rng.setStartBefore(s);rng.setEndBefore(s);v=k(s);if(v&&v.nodeValue.charAt(0)==r){v=v.deleteData(0,1)}j.remove(s,true);p.setRng(rng)}else{t=l(p.getStart());while((s=j.get(o))&&s!==u){if(t!==s){v=k(s);if(v&&v.nodeValue.charAt(0)==r){v=v.deleteData(0,1)}j.remove(s,true)}u=s}}}function q(){var s,w,u,t,v;function x(B,D){var A,F,E,C,z;A=t.startContainer;F=t.startOffset;if(A.nodeType==3){z=A.nodeValue.length;if((F>0&&F<z)||(D?F==z:F==0)){return}}else{if(F<A.childNodes.length){var G=!D&&F>0?F-1:F;A=A.childNodes[G];if(A.hasChildNodes()){A=A.firstChild}}else{return !D?B:null}}E=new c(A,B);while(C=E[D?"prev":"next"]()){if(C.nodeType===3&&C.nodeValue.length>0){return}else{if(m(C)==="true"){return C}}}return B}i();u=p.isCollapsed();s=g(p.getStart());w=g(p.getEnd());if(s||w){t=p.getRng(true);if(u){s=s||w;var y=p.getStart();if(v=x(s,true)){f(v,true)}else{if(v=x(s,false)){f(v,false)}else{p.select(s)}}}else{t=p.getRng(true);if(s){t.setStartBefore(s)}if(w){t.setEndAfter(w)}p.setRng(t)}}}function h(z,B){var F=B.keyCode,x,C,D,v;function u(H,G){while(H=H[G?"previousSibling":"nextSibling"]){if(H.nodeType!==3||H.nodeValue.length>0){return H}}}function y(G,H){p.select(G);p.collapse(H)}function t(K){var J,I,M,H;function G(O){var N=I;while(N){if(N===O){return}N=N.parentNode}j.remove(O);q()}function L(){var O,P,N=z.schema.getNonEmptyElements();P=new tinymce.dom.TreeWalker(I,z.getBody());while(O=(K?P.prev():P.next())){if(N[O.nodeName.toLowerCase()]){break}if(O.nodeType===3&&tinymce.trim(O.nodeValue).length>0){break}if(m(O)==="false"){G(O);return true}}if(g(O)){return true}return false}if(p.isCollapsed()){J=p.getRng(true);I=J.startContainer;M=J.startOffset;I=l(I)||I;if(H=g(I)){G(H);return false}if(I.nodeType==3&&(K?M>0:M<I.nodeValue.length)){return true}if(I.nodeType==1){I=I.childNodes[M]||I}if(L()){return false}}return true}D=p.getStart();v=p.getEnd();x=g(D)||g(v);if(x&&(F<112||F>124)&&F!=e.DELETE&&F!=e.BACKSPACE){if((tinymce.isMac?B.metaKey:B.ctrlKey)&&(F==67||F==88||F==86)){return}B.preventDefault();if(F==e.LEFT||F==e.RIGHT){var w=F==e.LEFT;if(z.dom.isBlock(x)){var A=w?x.previousSibling:x.nextSibling;var s=new c(A,A);var E=w?s.prev():s.next();y(E,!w)}else{y(x,w)}}}else{if(F==e.LEFT||F==e.RIGHT||F==e.BACKSPACE||F==e.DELETE){C=l(D);if(C){if(F==e.LEFT||F==e.BACKSPACE){x=u(C,true);if(x&&m(x)==="false"){B.preventDefault();if(F==e.LEFT){y(x,true)}else{j.remove(x);return}}else{i(C)}}if(F==e.RIGHT||F==e.DELETE){x=u(C);if(x&&m(x)==="false"){B.preventDefault();if(F==e.RIGHT){y(x,false)}else{j.remove(x);return}}else{i(C)}}}if((F==e.BACKSPACE||F==e.DELETE)&&!t(F==e.BACKSPACE)){B.preventDefault();return false}}}}n.onMouseDown.addToTop(function(s,u){var t=s.selection.getNode();if(m(t)==="false"&&t==u.target){q()}});n.onMouseUp.addToTop(q);n.onKeyDown.addToTop(h);n.onKeyUp.addToTop(q)}tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(i,k){var h,g,j;function f(m,n){var o=j.length,p=n.content,l=tinymce.trim(g);if(n.format=="raw"){return}while(o--){p=p.replace(j[o],function(s){var r=arguments,q=r[r.length-2];if(q>0&&p.charAt(q-1)=='"'){return s}return'<span class="'+l+'" data-mce-content="'+m.dom.encode(r[0])+'">'+m.dom.encode(typeof(r[1])==="string"?r[1]:r[0])+"</span>"})}n.content=p}h=" "+tinymce.trim(i.getParam("noneditable_editable_class","mceEditable"))+" ";g=" "+tinymce.trim(i.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";j=i.getParam("noneditable_regexp");if(j&&!j.length){j=[j]}i.onPreInit.add(function(){b(i);if(j){i.selection.onBeforeSetContent.add(f);i.onBeforeSetContent.add(f)}i.parser.addAttributeFilter("class",function(l){var m=l.length,n,o;while(m--){o=l[m];n=" "+o.attr("class")+" ";if(n.indexOf(h)!==-1){o.attr(d,"true")}else{if(n.indexOf(g)!==-1){o.attr(d,"false")}}}});i.serializer.addAttributeFilter(d,function(l,m){var n=l.length,o;while(n--){o=l[n];if(j&&o.attr("data-mce-content")){o.name="#text";o.type=3;o.raw=true;o.value=o.attr("data-mce-content")}else{o.attr(a,null);o.attr(d,null)}}});i.parser.addAttributeFilter(a,function(l,m){var n=l.length,o;while(n--){o=l[n];o.attr(d,o.attr(a));o.attr(a,null)}})})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/noneditable/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/noneditable/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..a18bcd7
--- /dev/null
@@ -0,0 +1,537 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var TreeWalker = tinymce.dom.TreeWalker;\r
+       var externalName = 'contenteditable', internalName = 'data-mce-' + externalName;\r
+       var VK = tinymce.VK;\r
+\r
+       function handleContentEditableSelection(ed) {\r
+               var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF';\r
+\r
+               // Returns the content editable state of a node "true/false" or null\r
+               function getContentEditable(node) {\r
+                       var contentEditable;\r
+\r
+                       // Ignore non elements\r
+                       if (node.nodeType === 1) {\r
+                               // Check for fake content editable\r
+                               contentEditable = node.getAttribute(internalName);\r
+                               if (contentEditable && contentEditable !== "inherit") {\r
+                                       return contentEditable;\r
+                               }\r
+\r
+                               // Check for real content editable\r
+                               contentEditable = node.contentEditable;\r
+                               if (contentEditable !== "inherit") {\r
+                                       return contentEditable;\r
+                               }\r
+                       }\r
+\r
+                       return null;\r
+               };\r
+\r
+               // Returns the noneditable parent or null if there is a editable before it or if it wasn't found\r
+               function getNonEditableParent(node) {\r
+                       var state;\r
+\r
+                       while (node) {\r
+                               state = getContentEditable(node);\r
+                               if (state) {\r
+                                       return state  === "false" ? node : null;\r
+                               }\r
+\r
+                               node = node.parentNode;\r
+                       }\r
+               };\r
+\r
+               // Get caret container parent for the specified node\r
+               function getParentCaretContainer(node) {\r
+                       while (node) {\r
+                               if (node.id === caretContainerId) {\r
+                                       return node;\r
+                               }\r
+\r
+                               node = node.parentNode;\r
+                       }\r
+               };\r
+\r
+               // Finds the first text node in the specified node\r
+               function findFirstTextNode(node) {\r
+                       var walker;\r
+\r
+                       if (node) {\r
+                               walker = new TreeWalker(node, node);\r
+\r
+                               for (node = walker.current(); node; node = walker.next()) {\r
+                                       if (node.nodeType === 3) {\r
+                                               return node;\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               // Insert caret container before/after target or expand selection to include block\r
+               function insertCaretContainerOrExpandToBlock(target, before) {\r
+                       var caretContainer, rng;\r
+\r
+                       // Select block\r
+                       if (getContentEditable(target) === "false") {\r
+                               if (dom.isBlock(target)) {\r
+                                       selection.select(target);\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       rng = dom.createRng();\r
+\r
+                       if (getContentEditable(target) === "true") {\r
+                               if (!target.firstChild) {\r
+                                       target.appendChild(ed.getDoc().createTextNode('\u00a0'));\r
+                               }\r
+\r
+                               target = target.firstChild;\r
+                               before = true;\r
+                       }\r
+\r
+                       //caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style:'border: 1px solid red'}, invisibleChar);\r
+                       caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar);\r
+\r
+                       if (before) {\r
+                               target.parentNode.insertBefore(caretContainer, target);\r
+                       } else {\r
+                               dom.insertAfter(caretContainer, target);\r
+                       }\r
+\r
+                       rng.setStart(caretContainer.firstChild, 1);\r
+                       rng.collapse(true);\r
+                       selection.setRng(rng);\r
+\r
+                       return caretContainer;\r
+               };\r
+\r
+               // Removes any caret container except the one we might be in\r
+               function removeCaretContainer(caretContainer) {\r
+                       var child, currentCaretContainer, lastContainer;\r
+\r
+                       if (caretContainer) {\r
+                                       rng = selection.getRng(true);\r
+                                       rng.setStartBefore(caretContainer);\r
+                                       rng.setEndBefore(caretContainer);\r
+\r
+                                       child = findFirstTextNode(caretContainer);\r
+                                       if (child && child.nodeValue.charAt(0) == invisibleChar) {\r
+                                               child = child.deleteData(0, 1);\r
+                                       }\r
+\r
+                                       dom.remove(caretContainer, true);\r
+\r
+                                       selection.setRng(rng);\r
+                       } else {\r
+                               currentCaretContainer = getParentCaretContainer(selection.getStart());\r
+                               while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {\r
+                                       if (currentCaretContainer !== caretContainer) {\r
+                                               child = findFirstTextNode(caretContainer);\r
+                                               if (child && child.nodeValue.charAt(0) == invisibleChar) {\r
+                                                       child = child.deleteData(0, 1);\r
+                                               }\r
+\r
+                                               dom.remove(caretContainer, true);\r
+                                       }\r
+\r
+                                       lastContainer = caretContainer;\r
+                               }\r
+                       }\r
+               };\r
+\r
+               // Modifies the selection to include contentEditable false elements or insert caret containers\r
+               function moveSelection() {\r
+                       var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;\r
+\r
+                       // Checks if there is any contents to the left/right side of caret returns the noneditable element or any editable element if it finds one inside\r
+                       function hasSideContent(element, left) {\r
+                               var container, offset, walker, node, len;\r
+\r
+                               container = rng.startContainer;\r
+                               offset = rng.startOffset;\r
+\r
+                               // If endpoint is in middle of text node then expand to beginning/end of element\r
+                               if (container.nodeType == 3) {\r
+                                       len = container.nodeValue.length;\r
+                                       if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) {\r
+                                               return;\r
+                                       }\r
+                               } else {\r
+                                       // Can we resolve the node by index\r
+                                       if (offset < container.childNodes.length) {\r
+                                               // Browser represents caret position as the offset at the start of an element. When moving right\r
+                                               // this is the element we are moving into so we consider our container to be child node at offset-1\r
+                                               var pos = !left && offset > 0 ? offset-1 : offset;\r
+                                               container = container.childNodes[pos];\r
+                                               if (container.hasChildNodes()) {\r
+                                                       container = container.firstChild;\r
+                                               }\r
+                                       } else {\r
+                                               // If not then the caret is at the last position in it's container and the caret container should be inserted after the noneditable element\r
+                                               return !left ? element : null;\r
+                                       }\r
+                               }\r
+\r
+                               // Walk left/right to look for contents\r
+                               walker = new TreeWalker(container, element);\r
+                               while (node = walker[left ? 'prev' : 'next']()) {\r
+                                       if (node.nodeType === 3 && node.nodeValue.length > 0) {\r
+                                               return;\r
+                                       } else if (getContentEditable(node) === "true") {\r
+                                               // Found contentEditable=true element return this one to we can move the caret inside it\r
+                                               return node;\r
+                                       }\r
+                               }\r
+\r
+                               return element;\r
+                       };\r
+\r
+                       // Remove any existing caret containers\r
+                       removeCaretContainer();\r
+\r
+                       // Get noneditable start/end elements\r
+                       isCollapsed = selection.isCollapsed();\r
+                       nonEditableStart = getNonEditableParent(selection.getStart());\r
+                       nonEditableEnd = getNonEditableParent(selection.getEnd());\r
+\r
+                       // Is any fo the range endpoints noneditable\r
+                       if (nonEditableStart || nonEditableEnd) {\r
+                               rng = selection.getRng(true);\r
+\r
+                               // If it's a caret selection then look left/right to see if we need to move the caret out side or expand\r
+                               if (isCollapsed) {\r
+                                       nonEditableStart = nonEditableStart || nonEditableEnd;\r
+                                       var start = selection.getStart();\r
+                                       if (element = hasSideContent(nonEditableStart, true)) {\r
+                                               // We have no contents to the left of the caret then insert a caret container before the noneditable element\r
+                                               insertCaretContainerOrExpandToBlock(element, true);\r
+                                       } else if (element = hasSideContent(nonEditableStart, false)) {\r
+                                               // We have no contents to the right of the caret then insert a caret container after the noneditable element\r
+                                               insertCaretContainerOrExpandToBlock(element, false);\r
+                                       } else {\r
+                                               // We are in the middle of a noneditable so expand to select it\r
+                                               selection.select(nonEditableStart);\r
+                                       }\r
+                               } else {\r
+                                       rng = selection.getRng(true);\r
+\r
+                                       // Expand selection to include start non editable element\r
+                                       if (nonEditableStart) {\r
+                                               rng.setStartBefore(nonEditableStart);\r
+                                       }\r
+\r
+                                       // Expand selection to include end non editable element\r
+                                       if (nonEditableEnd) {\r
+                                               rng.setEndAfter(nonEditableEnd);\r
+                                       }\r
+\r
+                                       selection.setRng(rng);\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function handleKey(ed, e) {\r
+                       var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;\r
+\r
+                       function getNonEmptyTextNodeSibling(node, prev) {\r
+                               while (node = node[prev ? 'previousSibling' : 'nextSibling']) {\r
+                                       if (node.nodeType !== 3 || node.nodeValue.length > 0) {\r
+                                               return node;\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       function positionCaretOnElement(element, start) {\r
+                               selection.select(element);\r
+                               selection.collapse(start);\r
+                       }\r
+\r
+                       function canDelete(backspace) {\r
+                               var rng, container, offset, nonEditableParent;\r
+\r
+                               function removeNodeIfNotParent(node) {\r
+                                       var parent = container;\r
+\r
+                                       while (parent) {\r
+                                               if (parent === node) {\r
+                                                       return;\r
+                                               }\r
+\r
+                                               parent = parent.parentNode;\r
+                                       }\r
+\r
+                                       dom.remove(node);\r
+                                       moveSelection();\r
+                               }\r
+\r
+                               function isNextPrevTreeNodeNonEditable() {\r
+                                       var node, walker, nonEmptyElements = ed.schema.getNonEmptyElements();\r
+\r
+                                       walker = new tinymce.dom.TreeWalker(container, ed.getBody());\r
+                                       while (node = (backspace ? walker.prev() : walker.next())) {\r
+                                               // Found IMG/INPUT etc\r
+                                               if (nonEmptyElements[node.nodeName.toLowerCase()]) {\r
+                                                       break;\r
+                                               }\r
+\r
+                                               // Found text node with contents\r
+                                               if (node.nodeType === 3 && tinymce.trim(node.nodeValue).length > 0) {\r
+                                                       break;\r
+                                               }\r
+\r
+                                               // Found non editable node\r
+                                               if (getContentEditable(node) === "false") {\r
+                                                       removeNodeIfNotParent(node);\r
+                                                       return true;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Check if the content node is within a non editable parent\r
+                                       if (getNonEditableParent(node)) {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       return false;\r
+                               }\r
+\r
+                               if (selection.isCollapsed()) {\r
+                                       rng = selection.getRng(true);\r
+                                       container = rng.startContainer;\r
+                                       offset = rng.startOffset;\r
+                                       container = getParentCaretContainer(container) || container;\r
+\r
+                                       // Is in noneditable parent\r
+                                       if (nonEditableParent = getNonEditableParent(container)) {\r
+                                               removeNodeIfNotParent(nonEditableParent);\r
+                                               return false;\r
+                                       }\r
+\r
+                                       // Check if the caret is in the middle of a text node\r
+                                       if (container.nodeType == 3 && (backspace ? offset > 0 : offset < container.nodeValue.length)) {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       // Resolve container index\r
+                                       if (container.nodeType == 1) {\r
+                                               container = container.childNodes[offset] || container;\r
+                                       }\r
+\r
+                                       // Check if previous or next tree node is non editable then block the event\r
+                                       if (isNextPrevTreeNodeNonEditable()) {\r
+                                               return false;\r
+                                       }\r
+                               }\r
+\r
+                               return true;\r
+                       }\r
+\r
+                       startElement = selection.getStart()\r
+                       endElement = selection.getEnd();\r
+\r
+                       // Disable all key presses in contentEditable=false except delete or backspace\r
+                       nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);\r
+                       if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {\r
+                               // Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior\r
+                               if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {\r
+                                       return;\r
+                               }\r
+\r
+                               e.preventDefault();\r
+\r
+                               // Arrow left/right select the element and collapse left/right\r
+                               if (keyCode == VK.LEFT || keyCode == VK.RIGHT) {\r
+                                       var left = keyCode == VK.LEFT;\r
+                                       // If a block element find previous or next element to position the caret\r
+                                       if (ed.dom.isBlock(nonEditableParent)) {\r
+                                               var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling;\r
+                                               var walker = new TreeWalker(targetElement, targetElement);\r
+                                               var caretElement = left ? walker.prev() : walker.next();\r
+                                               positionCaretOnElement(caretElement, !left);\r
+                                       } else {\r
+                                               positionCaretOnElement(nonEditableParent, left);\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               // Is arrow left/right, backspace or delete\r
+                               if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {\r
+                                       caretContainer = getParentCaretContainer(startElement);\r
+                                       if (caretContainer) {\r
+                                               // Arrow left or backspace\r
+                                               if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {\r
+                                                       nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);\r
+\r
+                                                       if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {\r
+                                                               e.preventDefault();\r
+\r
+                                                               if (keyCode == VK.LEFT) {\r
+                                                                       positionCaretOnElement(nonEditableParent, true);\r
+                                                               } else {\r
+                                                                       dom.remove(nonEditableParent);\r
+                                                                       return;\r
+                                                               }\r
+                                                       } else {\r
+                                                               removeCaretContainer(caretContainer);\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Arrow right or delete\r
+                                               if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {\r
+                                                       nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);\r
+\r
+                                                       if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {\r
+                                                               e.preventDefault();\r
+\r
+                                                               if (keyCode == VK.RIGHT) {\r
+                                                                       positionCaretOnElement(nonEditableParent, false);\r
+                                                               } else {\r
+                                                                       dom.remove(nonEditableParent);\r
+                                                                       return;\r
+                                                               }\r
+                                                       } else {\r
+                                                               removeCaretContainer(caretContainer);\r
+                                                       }\r
+                                               }\r
+                                       }\r
+\r
+                                       if ((keyCode == VK.BACKSPACE || keyCode == VK.DELETE) && !canDelete(keyCode == VK.BACKSPACE)) {\r
+                                               e.preventDefault();\r
+                                               return false;\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               ed.onMouseDown.addToTop(function(ed, e) {\r
+                       var node = ed.selection.getNode();\r
+\r
+                       if (getContentEditable(node) === "false" && node == e.target) {\r
+                               // Expand selection on mouse down we can't block the default event since it's used for drag/drop\r
+                               moveSelection();\r
+                       }\r
+               });\r
+\r
+               ed.onMouseUp.addToTop(moveSelection);\r
+               ed.onKeyDown.addToTop(handleKey);\r
+               ed.onKeyUp.addToTop(moveSelection);\r
+       };\r
+\r
+       tinymce.create('tinymce.plugins.NonEditablePlugin', {\r
+               init : function(ed, url) {\r
+                       var editClass, nonEditClass, nonEditableRegExps;\r
+\r
+                       // Converts configured regexps to noneditable span items\r
+                       function convertRegExpsToNonEditable(ed, args) {\r
+                               var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass);\r
+\r
+                               // Don't replace the variables when raw is used for example on undo/redo\r
+                               if (args.format == "raw") {\r
+                                       return;\r
+                               }\r
+\r
+                               while (i--) {\r
+                                       content = content.replace(nonEditableRegExps[i], function(match) {\r
+                                               var args = arguments, index = args[args.length - 2];\r
+\r
+                                               // Is value inside an attribute then don't replace\r
+                                               if (index > 0 && content.charAt(index - 1) == '"') {\r
+                                                       return match;\r
+                                               }\r
+\r
+                                               return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>';\r
+                                       });\r
+                               }\r
+\r
+                               args.content = content;\r
+                       };\r
+                       \r
+                       editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";\r
+                       nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";\r
+\r
+                       // Setup noneditable regexps array\r
+                       nonEditableRegExps = ed.getParam("noneditable_regexp");\r
+                       if (nonEditableRegExps && !nonEditableRegExps.length) {\r
+                               nonEditableRegExps = [nonEditableRegExps];\r
+                       }\r
+\r
+                       ed.onPreInit.add(function() {\r
+                               handleContentEditableSelection(ed);\r
+\r
+                               if (nonEditableRegExps) {\r
+                                       ed.selection.onBeforeSetContent.add(convertRegExpsToNonEditable);\r
+                                       ed.onBeforeSetContent.add(convertRegExpsToNonEditable);\r
+                               }\r
+\r
+                               // Apply contentEditable true/false on elements with the noneditable/editable classes\r
+                               ed.parser.addAttributeFilter('class', function(nodes) {\r
+                                       var i = nodes.length, className, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               className = " " + node.attr("class") + " ";\r
+\r
+                                               if (className.indexOf(editClass) !== -1) {\r
+                                                       node.attr(internalName, "true");\r
+                                               } else if (className.indexOf(nonEditClass) !== -1) {\r
+                                                       node.attr(internalName, "false");\r
+                                               }\r
+                                       }\r
+                               });\r
+\r
+                               // Remove internal name\r
+                               ed.serializer.addAttributeFilter(internalName, function(nodes, name) {\r
+                                       var i = nodes.length, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+\r
+                                               if (nonEditableRegExps && node.attr('data-mce-content')) {\r
+                                                       node.name = "#text";\r
+                                                       node.type = 3;\r
+                                                       node.raw = true;\r
+                                                       node.value = node.attr('data-mce-content');\r
+                                               } else {\r
+                                                       node.attr(externalName, null);\r
+                                                       node.attr(internalName, null);\r
+                                               }\r
+                                       }\r
+                               });\r
+\r
+                               // Convert external name into internal name\r
+                               ed.parser.addAttributeFilter(externalName, function(nodes, name) {\r
+                                       var i = nodes.length, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               node.attr(internalName, node.attr(externalName));\r
+                                               node.attr(externalName, null);\r
+                                       }\r
+                               });\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Non editable elements',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/pagebreak/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/pagebreak/editor_plugin.js
new file mode 100644 (file)
index 0000000..35085e8
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+b.theme.url+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/pagebreak/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/pagebreak/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..a094c19
--- /dev/null
@@ -0,0 +1,74 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.PageBreakPlugin', {\r
+               init : function(ed, url) {\r
+                       var pb = '<img src="' + ed.theme.url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;\r
+\r
+                       pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mcePageBreak', function() {\r
+                               ed.execCommand('mceInsertContent', 0, pb);\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});\r
+\r
+                       ed.onInit.add(function() {\r
+                               if (ed.theme.onResolveName) {\r
+                                       ed.theme.onResolveName.add(function(th, o) {\r
+                                               if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))\r
+                                                       o.name = 'pagebreak';\r
+                                       });\r
+                               }\r
+                       });\r
+\r
+                       ed.onClick.add(function(ed, e) {\r
+                               e = e.target;\r
+\r
+                               if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))\r
+                                       ed.selection.select(e);\r
+                       });\r
+\r
+                       ed.onNodeChange.add(function(ed, cm, n) {\r
+                               cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));\r
+                       });\r
+\r
+                       ed.onBeforeSetContent.add(function(ed, o) {\r
+                               o.content = o.content.replace(pbRE, pb);\r
+                       });\r
+\r
+                       ed.onPostProcess.add(function(ed, o) {\r
+                               if (o.get)\r
+                                       o.content = o.content.replace(/<img[^>]+>/g, function(im) {\r
+                                               if (im.indexOf('class="mcePageBreak') !== -1)\r
+                                                       im = sep;\r
+\r
+                                               return im;\r
+                                       });\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'PageBreak',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/paste/editor_plugin.js
new file mode 100644 (file)
index 0000000..be7eee8
--- /dev/null
@@ -0,0 +1 @@
+(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"combined",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(l,j){var k=d.dom,i;f.onPreProcess.dispatch(f,l);l.node=k.create("div",0,l.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){if(l.node.childNodes.length===1&&/^(p|h[1-6]|pre)$/i.test(l.node.firstChild.nodeName)&&l.content.indexOf("__MCE_ITEM__")===-1){k.remove(l.node.firstChild,true)}}}f.onPostProcess.dispatch(f,l);l.content=d.serializer.serialize(l.node,{getInner:1,forced_root_block:""});if((!j)&&(d.pasteAsPlainText)){f._insertPlainText(l.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(l.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:o.encode(r).replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort(d.getWin()).y}o.setStyles(l,{position:"absolute",left:tinymce.isGecko?-40:0,top:i-25,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<p>"+o.encode(r).replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br />")+"</p>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9&&/<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(e.content)){d([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g,"$1"]]);d([[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/&quot;/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(g){var d=this.editor,e=b(d,"paste_text_linebreaktype"),i=b(d,"paste_text_replacements"),f=tinymce.is;function h(j){c(j,function(k){if(k.constructor==RegExp){g=g.replace(k,"")}else{g=g.replace(k[0],k[1])}})}if((typeof(g)==="string")&&(g.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(g)){h([/[\n\r]+/g])}else{h([/\r+/g])}h([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"]]);g=d.dom.decode(tinymce.html.Entities.encodeRaw(g));if(f(i,"array")){h(i)}else{if(f(i,"string")){h(new RegExp(i,"gi"))}}if(e=="none"){h([[/\n+/g," "]])}else{if(e=="br"){h([[/\n/g,"<br />"]])}else{if(e=="p"){h([[/\n+/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"]])}else{h([[/\n\n/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"],[/\n/g,"<br />"]])}}}d.execCommand("mceInsertContent",false,g)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/paste/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..9f1c354
--- /dev/null
@@ -0,0 +1,871 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var each = tinymce.each,\r
+               defs = {\r
+                       paste_auto_cleanup_on_paste : true,\r
+                       paste_enable_default_filters : true,\r
+                       paste_block_drop : false,\r
+                       paste_retain_style_properties : "none",\r
+                       paste_strip_class_attributes : "mso",\r
+                       paste_remove_spans : false,\r
+                       paste_remove_styles : false,\r
+                       paste_remove_styles_if_webkit : true,\r
+                       paste_convert_middot_lists : true,\r
+                       paste_convert_headers_to_strong : false,\r
+                       paste_dialog_width : "450",\r
+                       paste_dialog_height : "400",\r
+                       paste_text_use_dialog : false,\r
+                       paste_text_sticky : false,\r
+                       paste_text_sticky_default : false,\r
+                       paste_text_notifyalways : false,\r
+                       paste_text_linebreaktype : "combined",\r
+                       paste_text_replacements : [\r
+                               [/\u2026/g, "..."],\r
+                               [/[\x93\x94\u201c\u201d]/g, '"'],\r
+                               [/[\x60\x91\x92\u2018\u2019]/g, "'"]\r
+                       ]\r
+               };\r
+\r
+       function getParam(ed, name) {\r
+               return ed.getParam(name, defs[name]);\r
+       }\r
+\r
+       tinymce.create('tinymce.plugins.PastePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+                       t.url = url;\r
+\r
+                       // Setup plugin events\r
+                       t.onPreProcess = new tinymce.util.Dispatcher(t);\r
+                       t.onPostProcess = new tinymce.util.Dispatcher(t);\r
+\r
+                       // Register default handlers\r
+                       t.onPreProcess.add(t._preProcess);\r
+                       t.onPostProcess.add(t._postProcess);\r
+\r
+                       // Register optional preprocess handler\r
+                       t.onPreProcess.add(function(pl, o) {\r
+                               ed.execCallback('paste_preprocess', pl, o);\r
+                       });\r
+\r
+                       // Register optional postprocess\r
+                       t.onPostProcess.add(function(pl, o) {\r
+                               ed.execCallback('paste_postprocess', pl, o);\r
+                       });\r
+\r
+                       ed.onKeyDown.addToTop(function(ed, e) {\r
+                               // Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that\r
+                               if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))\r
+                                       return false; // Stop other listeners\r
+                       });\r
+\r
+                       // Initialize plain text flag\r
+                       ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');\r
+\r
+                       // This function executes the process handlers and inserts the contents\r
+                       // force_rich overrides plain text mode set by user, important for pasting with execCommand\r
+                       function process(o, force_rich) {\r
+                               var dom = ed.dom, rng;\r
+\r
+                               // Execute pre process handlers\r
+                               t.onPreProcess.dispatch(t, o);\r
+\r
+                               // Create DOM structure\r
+                               o.node = dom.create('div', 0, o.content);\r
+\r
+                               // If pasting inside the same element and the contents is only one block\r
+                               // remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element\r
+                               if (tinymce.isGecko) {\r
+                                       rng = ed.selection.getRng(true);\r
+                                       if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {\r
+                                               // Is only one block node and it doesn't contain word stuff\r
+                                               if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)\r
+                                                       dom.remove(o.node.firstChild, true);\r
+                                       }\r
+                               }\r
+\r
+                               // Execute post process handlers\r
+                               t.onPostProcess.dispatch(t, o);\r
+\r
+                               // Serialize content\r
+                               o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});\r
+\r
+                               // Plain text option active?\r
+                               if ((!force_rich) && (ed.pasteAsPlainText)) {\r
+                                       t._insertPlainText(o.content);\r
+\r
+                                       if (!getParam(ed, "paste_text_sticky")) {\r
+                                               ed.pasteAsPlainText = false;\r
+                                               ed.controlManager.setActive("pastetext", false);\r
+                                       }\r
+                               } else {\r
+                                       t._insert(o.content);\r
+                               }\r
+                       }\r
+\r
+                       // Add command for external usage\r
+                       ed.addCommand('mceInsertClipboardContent', function(u, o) {\r
+                               process(o, true);\r
+                       });\r
+\r
+                       if (!getParam(ed, "paste_text_use_dialog")) {\r
+                               ed.addCommand('mcePasteText', function(u, v) {\r
+                                       var cookie = tinymce.util.Cookie;\r
+\r
+                                       ed.pasteAsPlainText = !ed.pasteAsPlainText;\r
+                                       ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);\r
+\r
+                                       if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {\r
+                                               if (getParam(ed, "paste_text_sticky")) {\r
+                                                       ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));\r
+                                               } else {\r
+                                                       ed.windowManager.alert(ed.translate('paste.plaintext_mode'));\r
+                                               }\r
+\r
+                                               if (!getParam(ed, "paste_text_notifyalways")) {\r
+                                                       cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))\r
+                                               }\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});\r
+                       ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});\r
+\r
+                       // This function grabs the contents from the clipboard by adding a\r
+                       // hidden div and placing the caret inside it and after the browser paste\r
+                       // is done it grabs that contents and processes that\r
+                       function grabContent(e) {\r
+                               var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;\r
+\r
+                               // Check if browser supports direct plaintext access\r
+                               if (e.clipboardData || dom.doc.dataTransfer) {\r
+                                       textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');\r
+\r
+                                       if (ed.pasteAsPlainText) {\r
+                                               e.preventDefault();\r
+                                               process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});\r
+                                               return;\r
+                                       }\r
+                               }\r
+\r
+                               if (dom.get('_mcePaste'))\r
+                                       return;\r
+\r
+                               // Create container to paste into\r
+                               n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');\r
+\r
+                               // If contentEditable mode we need to find out the position of the closest element\r
+                               if (body != ed.getDoc().body)\r
+                                       posY = dom.getPos(ed.selection.getStart(), body).y;\r
+                               else\r
+                                       posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;\r
+\r
+                               // Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles\r
+                               // If also needs to be in view on IE or the paste would fail\r
+                               dom.setStyles(n, {\r
+                                       position : 'absolute',\r
+                                       left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div\r
+                                       top : posY - 25,\r
+                                       width : 1,\r
+                                       height : 1,\r
+                                       overflow : 'hidden'\r
+                               });\r
+\r
+                               if (tinymce.isIE) {\r
+                                       // Store away the old range\r
+                                       oldRng = sel.getRng();\r
+\r
+                                       // Select the container\r
+                                       rng = dom.doc.body.createTextRange();\r
+                                       rng.moveToElementText(n);\r
+                                       rng.execCommand('Paste');\r
+\r
+                                       // Remove container\r
+                                       dom.remove(n);\r
+\r
+                                       // Check if the contents was changed, if it wasn't then clipboard extraction failed probably due\r
+                                       // to IE security settings so we pass the junk though better than nothing right\r
+                                       if (n.innerHTML === '\uFEFF\uFEFF') {\r
+                                               ed.execCommand('mcePasteWord');\r
+                                               e.preventDefault();\r
+                                               return;\r
+                                       }\r
+\r
+                                       // Restore the old range and clear the contents before pasting\r
+                                       sel.setRng(oldRng);\r
+                                       sel.setContent('');\r
+\r
+                                       // For some odd reason we need to detach the the mceInsertContent call from the paste event\r
+                                       // It's like IE has a reference to the parent element that you paste in and the selection gets messed up\r
+                                       // when it tries to restore the selection\r
+                                       setTimeout(function() {\r
+                                               // Process contents\r
+                                               process({content : n.innerHTML});\r
+                                       }, 0);\r
+\r
+                                       // Block the real paste event\r
+                                       return tinymce.dom.Event.cancel(e);\r
+                               } else {\r
+                                       function block(e) {\r
+                                               e.preventDefault();\r
+                                       };\r
+\r
+                                       // Block mousedown and click to prevent selection change\r
+                                       dom.bind(ed.getDoc(), 'mousedown', block);\r
+                                       dom.bind(ed.getDoc(), 'keydown', block);\r
+\r
+                                       or = ed.selection.getRng();\r
+\r
+                                       // Move select contents inside DIV\r
+                                       n = n.firstChild;\r
+                                       rng = ed.getDoc().createRange();\r
+                                       rng.setStart(n, 0);\r
+                                       rng.setEnd(n, 2);\r
+                                       sel.setRng(rng);\r
+\r
+                                       // Wait a while and grab the pasted contents\r
+                                       window.setTimeout(function() {\r
+                                               var h = '', nl;\r
+\r
+                                               // Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit\r
+                                               if (!dom.select('div.mcePaste > div.mcePaste').length) {\r
+                                                       nl = dom.select('div.mcePaste');\r
+\r
+                                                       // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string\r
+                                                       each(nl, function(n) {\r
+                                                               var child = n.firstChild;\r
+\r
+                                                               // WebKit inserts a DIV container with lots of odd styles\r
+                                                               if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {\r
+                                                                       dom.remove(child, 1);\r
+                                                               }\r
+\r
+                                                               // Remove apply style spans\r
+                                                               each(dom.select('span.Apple-style-span', n), function(n) {\r
+                                                                       dom.remove(n, 1);\r
+                                                               });\r
+\r
+                                                               // Remove bogus br elements\r
+                                                               each(dom.select('br[data-mce-bogus]', n), function(n) {\r
+                                                                       dom.remove(n);\r
+                                                               });\r
+\r
+                                                               // WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV\r
+                                                               if (n.parentNode.className != 'mcePaste')\r
+                                                                       h += n.innerHTML;\r
+                                                       });\r
+                                               } else {\r
+                                                       // Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc\r
+                                                       // So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same\r
+                                                       h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';\r
+                                               }\r
+\r
+                                               // Remove the nodes\r
+                                               each(dom.select('div.mcePaste'), function(n) {\r
+                                                       dom.remove(n);\r
+                                               });\r
+\r
+                                               // Restore the old selection\r
+                                               if (or)\r
+                                                       sel.setRng(or);\r
+\r
+                                               process({content : h});\r
+\r
+                                               // Unblock events ones we got the contents\r
+                                               dom.unbind(ed.getDoc(), 'mousedown', block);\r
+                                               dom.unbind(ed.getDoc(), 'keydown', block);\r
+                                       }, 0);\r
+                               }\r
+                       }\r
+\r
+                       // Check if we should use the new auto process method                   \r
+                       if (getParam(ed, "paste_auto_cleanup_on_paste")) {\r
+                               // Is it's Opera or older FF use key handler\r
+                               if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {\r
+                                       ed.onKeyDown.addToTop(function(ed, e) {\r
+                                               if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))\r
+                                                       grabContent(e);\r
+                                       });\r
+                               } else {\r
+                                       // Grab contents on paste event on Gecko and WebKit\r
+                                       ed.onPaste.addToTop(function(ed, e) {\r
+                                               return grabContent(e);\r
+                                       });\r
+                               }\r
+                       }\r
+\r
+                       ed.onInit.add(function() {\r
+                               ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);\r
+\r
+                               // Block all drag/drop events\r
+                               if (getParam(ed, "paste_block_drop")) {\r
+                                       ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {\r
+                                               e.preventDefault();\r
+                                               e.stopPropagation();\r
+\r
+                                               return false;\r
+                                       });\r
+                               }\r
+                       });\r
+\r
+                       // Add legacy support\r
+                       t._legacySupport();\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Paste text/word',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               _preProcess : function(pl, o) {\r
+                       var ed = this.editor,\r
+                               h = o.content,\r
+                               grep = tinymce.grep,\r
+                               explode = tinymce.explode,\r
+                               trim = tinymce.trim,\r
+                               len, stripClass;\r
+\r
+                       //console.log('Before preprocess:' + o.content);\r
+\r
+                       function process(items) {\r
+                               each(items, function(v) {\r
+                                       // Remove or replace\r
+                                       if (v.constructor == RegExp)\r
+                                               h = h.replace(v, '');\r
+                                       else\r
+                                               h = h.replace(v[0], v[1]);\r
+                               });\r
+                       }\r
+                       \r
+                       if (ed.settings.paste_enable_default_filters == false) {\r
+                               return;\r
+                       }\r
+\r
+                       // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser\r
+                       if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) {\r
+                               // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser\r
+                               process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);\r
+\r
+                               // IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break\r
+                               process([\r
+                                       [/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact\r
+                                       [/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s\r
+                                       [/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR\r
+                               ]);\r
+                       }\r
+\r
+                       // Detect Word content and process it more aggressive\r
+                       if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {\r
+                               o.wordContent = true;                   // Mark the pasted contents as word specific content\r
+                               //console.log('Word contents detected.');\r
+\r
+                               // Process away some basic content\r
+                               process([\r
+                                       /^\s*(&nbsp;)+/gi,                              // &nbsp; entities at the start of contents\r
+                                       /(&nbsp;|<br[^>]*>)+\s*$/gi             // &nbsp; entities at the end of contents\r
+                               ]);\r
+\r
+                               if (getParam(ed, "paste_convert_headers_to_strong")) {\r
+                                       h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");\r
+                               }\r
+\r
+                               if (getParam(ed, "paste_convert_middot_lists")) {\r
+                                       process([\r
+                                               [/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'],                                    // Convert supportLists to a list item marker\r
+                                               [/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'],             // Convert mso-list and symbol spans to item markers\r
+                                               [/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__']                             // Convert mso-list and symbol paragraphs to item markers (FF)\r
+                                       ]);\r
+                               }\r
+\r
+                               process([\r
+                                       // Word comments like conditional comments etc\r
+                                       /<!--[\s\S]+?-->/gi,\r
+\r
+                                       // Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags\r
+                                       /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,\r
+\r
+                                       // Convert <s> into <strike> for line-though\r
+                                       [/<(\/?)s>/gi, "<$1strike>"],\r
+\r
+                                       // Replace nsbp entites to char since it's easier to handle\r
+                                       [/&nbsp;/gi, "\u00a0"]\r
+                               ]);\r
+\r
+                               // Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.\r
+                               // If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.\r
+                               do {\r
+                                       len = h.length;\r
+                                       h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");\r
+                               } while (len != h.length);\r
+\r
+                               // Remove all spans if no styles is to be retained\r
+                               if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {\r
+                                       h = h.replace(/<\/?span[^>]*>/gi, "");\r
+                               } else {\r
+                                       // We're keeping styles, so at least clean them up.\r
+                                       // CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx\r
+\r
+                                       process([\r
+                                               // Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length\r
+                                               [/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,\r
+                                                       function(str, spaces) {\r
+                                                               return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";\r
+                                                       }\r
+                                               ],\r
+\r
+                                               // Examine all styles: delete junk, transform some, and keep the rest\r
+                                               [/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,\r
+                                                       function(str, tag, style) {\r
+                                                               var n = [],\r
+                                                                       i = 0,\r
+                                                                       s = explode(trim(style).replace(/&quot;/gi, "'"), ";");\r
+\r
+                                                               // Examine each style definition within the tag's style attribute\r
+                                                               each(s, function(v) {\r
+                                                                       var name, value,\r
+                                                                               parts = explode(v, ":");\r
+\r
+                                                                       function ensureUnits(v) {\r
+                                                                               return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";\r
+                                                                       }\r
+\r
+                                                                       if (parts.length == 2) {\r
+                                                                               name = parts[0].toLowerCase();\r
+                                                                               value = parts[1].toLowerCase();\r
+\r
+                                                                               // Translate certain MS Office styles into their CSS equivalents\r
+                                                                               switch (name) {\r
+                                                                                       case "mso-padding-alt":\r
+                                                                                       case "mso-padding-top-alt":\r
+                                                                                       case "mso-padding-right-alt":\r
+                                                                                       case "mso-padding-bottom-alt":\r
+                                                                                       case "mso-padding-left-alt":\r
+                                                                                       case "mso-margin-alt":\r
+                                                                                       case "mso-margin-top-alt":\r
+                                                                                       case "mso-margin-right-alt":\r
+                                                                                       case "mso-margin-bottom-alt":\r
+                                                                                       case "mso-margin-left-alt":\r
+                                                                                       case "mso-table-layout-alt":\r
+                                                                                       case "mso-height":\r
+                                                                                       case "mso-width":\r
+                                                                                       case "mso-vertical-align-alt":\r
+                                                                                               n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);\r
+                                                                                               return;\r
+\r
+                                                                                       case "horiz-align":\r
+                                                                                               n[i++] = "text-align:" + value;\r
+                                                                                               return;\r
+\r
+                                                                                       case "vert-align":\r
+                                                                                               n[i++] = "vertical-align:" + value;\r
+                                                                                               return;\r
+\r
+                                                                                       case "font-color":\r
+                                                                                       case "mso-foreground":\r
+                                                                                               n[i++] = "color:" + value;\r
+                                                                                               return;\r
+\r
+                                                                                       case "mso-background":\r
+                                                                                       case "mso-highlight":\r
+                                                                                               n[i++] = "background:" + value;\r
+                                                                                               return;\r
+\r
+                                                                                       case "mso-default-height":\r
+                                                                                               n[i++] = "min-height:" + ensureUnits(value);\r
+                                                                                               return;\r
+\r
+                                                                                       case "mso-default-width":\r
+                                                                                               n[i++] = "min-width:" + ensureUnits(value);\r
+                                                                                               return;\r
+\r
+                                                                                       case "mso-padding-between-alt":\r
+                                                                                               n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);\r
+                                                                                               return;\r
+\r
+                                                                                       case "text-line-through":\r
+                                                                                               if ((value == "single") || (value == "double")) {\r
+                                                                                                       n[i++] = "text-decoration:line-through";\r
+                                                                                               }\r
+                                                                                               return;\r
+\r
+                                                                                       case "mso-zero-height":\r
+                                                                                               if (value == "yes") {\r
+                                                                                                       n[i++] = "display:none";\r
+                                                                                               }\r
+                                                                                               return;\r
+                                                                               }\r
+\r
+                                                                               // Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name\r
+                                                                               if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {\r
+                                                                                       return;\r
+                                                                               }\r
+\r
+                                                                               // If it reached this point, it must be a valid CSS style\r
+                                                                               n[i++] = name + ":" + parts[1];         // Lower-case name, but keep value case\r
+                                                                       }\r
+                                                               });\r
+\r
+                                                               // If style attribute contained any valid styles the re-write it; otherwise delete style attribute.\r
+                                                               if (i > 0) {\r
+                                                                       return tag + ' style="' + n.join(';') + '"';\r
+                                                               } else {\r
+                                                                       return tag;\r
+                                                               }\r
+                                                       }\r
+                                               ]\r
+                                       ]);\r
+                               }\r
+                       }\r
+\r
+                       // Replace headers with <strong>\r
+                       if (getParam(ed, "paste_convert_headers_to_strong")) {\r
+                               process([\r
+                                       [/<h[1-6][^>]*>/gi, "<p><strong>"],\r
+                                       [/<\/h[1-6][^>]*>/gi, "</strong></p>"]\r
+                               ]);\r
+                       }\r
+\r
+                       process([\r
+                               // Copy paste from Java like Open Office will produce this junk on FF\r
+                               [/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']\r
+                       ]);\r
+\r
+                       // Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").\r
+                       // Note:-  paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.\r
+                       stripClass = getParam(ed, "paste_strip_class_attributes");\r
+\r
+                       if (stripClass !== "none") {\r
+                               function removeClasses(match, g1) {\r
+                                               if (stripClass === "all")\r
+                                                       return '';\r
+\r
+                                               var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),\r
+                                                       function(v) {\r
+                                                               return (/^(?!mso)/i.test(v));\r
+                                                       }\r
+                                               );\r
+\r
+                                               return cls.length ? ' class="' + cls.join(" ") + '"' : '';\r
+                               };\r
+\r
+                               h = h.replace(/ class="([^"]+)"/gi, removeClasses);\r
+                               h = h.replace(/ class=([\-\w]+)/gi, removeClasses);\r
+                       }\r
+\r
+                       // Remove spans option\r
+                       if (getParam(ed, "paste_remove_spans")) {\r
+                               h = h.replace(/<\/?span[^>]*>/gi, "");\r
+                       }\r
+\r
+                       //console.log('After preprocess:' + h);\r
+\r
+                       o.content = h;\r
+               },\r
+\r
+               /**\r
+                * Various post process items.\r
+                */\r
+               _postProcess : function(pl, o) {\r
+                       var t = this, ed = t.editor, dom = ed.dom, styleProps;\r
+\r
+                       if (ed.settings.paste_enable_default_filters == false) {\r
+                               return;\r
+                       }\r
+                       \r
+                       if (o.wordContent) {\r
+                               // Remove named anchors or TOC links\r
+                               each(dom.select('a', o.node), function(a) {\r
+                                       if (!a.href || a.href.indexOf('#_Toc') != -1)\r
+                                               dom.remove(a, 1);\r
+                               });\r
+\r
+                               if (getParam(ed, "paste_convert_middot_lists")) {\r
+                                       t._convertLists(pl, o);\r
+                               }\r
+\r
+                               // Process styles\r
+                               styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties\r
+\r
+                               // Process only if a string was specified and not equal to "all" or "*"\r
+                               if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {\r
+                                       styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));\r
+\r
+                                       // Retains some style properties\r
+                                       each(dom.select('*', o.node), function(el) {\r
+                                               var newStyle = {}, npc = 0, i, sp, sv;\r
+\r
+                                               // Store a subset of the existing styles\r
+                                               if (styleProps) {\r
+                                                       for (i = 0; i < styleProps.length; i++) {\r
+                                                               sp = styleProps[i];\r
+                                                               sv = dom.getStyle(el, sp);\r
+\r
+                                                               if (sv) {\r
+                                                                       newStyle[sp] = sv;\r
+                                                                       npc++;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Remove all of the existing styles\r
+                                               dom.setAttrib(el, 'style', '');\r
+\r
+                                               if (styleProps && npc > 0)\r
+                                                       dom.setStyles(el, newStyle); // Add back the stored subset of styles\r
+                                               else // Remove empty span tags that do not have class attributes\r
+                                                       if (el.nodeName == 'SPAN' && !el.className)\r
+                                                               dom.remove(el, true);\r
+                                       });\r
+                               }\r
+                       }\r
+\r
+                       // Remove all style information or only specifically on WebKit to avoid the style bug on that browser\r
+                       if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {\r
+                               each(dom.select('*[style]', o.node), function(el) {\r
+                                       el.removeAttribute('style');\r
+                                       el.removeAttribute('data-mce-style');\r
+                               });\r
+                       } else {\r
+                               if (tinymce.isWebKit) {\r
+                                       // We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />\r
+                                       // Removing the mce_style that contains the real value will force the Serializer engine to compress the styles\r
+                                       each(dom.select('*', o.node), function(el) {\r
+                                               el.removeAttribute('data-mce-style');\r
+                                       });\r
+                               }\r
+                       }\r
+               },\r
+\r
+               /**\r
+                * Converts the most common bullet and number formats in Office into a real semantic UL/LI list.\r
+                */\r
+               _convertLists : function(pl, o) {\r
+                       var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;\r
+\r
+                       // Convert middot lists into real semantic lists\r
+                       each(dom.select('p', o.node), function(p) {\r
+                               var sib, val = '', type, html, idx, parents;\r
+\r
+                               // Get text node value at beginning of paragraph\r
+                               for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)\r
+                                       val += sib.nodeValue;\r
+\r
+                               val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/&nbsp;/g, '\u00a0');\r
+\r
+                               // Detect unordered lists look for bullets\r
+                               if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))\r
+                                       type = 'ul';\r
+\r
+                               // Detect ordered lists 1., a. or ixv.\r
+                               if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))\r
+                                       type = 'ol';\r
+\r
+                               // Check if node value matches the list pattern: o&nbsp;&nbsp;\r
+                               if (type) {\r
+                                       margin = parseFloat(p.style.marginLeft || 0);\r
+\r
+                                       if (margin > lastMargin)\r
+                                               levels.push(margin);\r
+\r
+                                       if (!listElm || type != lastType) {\r
+                                               listElm = dom.create(type);\r
+                                               dom.insertAfter(listElm, p);\r
+                                       } else {\r
+                                               // Nested list element\r
+                                               if (margin > lastMargin) {\r
+                                                       listElm = li.appendChild(dom.create(type));\r
+                                               } else if (margin < lastMargin) {\r
+                                                       // Find parent level based on margin value\r
+                                                       idx = tinymce.inArray(levels, margin);\r
+                                                       parents = dom.getParents(listElm.parentNode, type);\r
+                                                       listElm = parents[parents.length - 1 - idx] || listElm;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Remove middot or number spans if they exists\r
+                                       each(dom.select('span', p), function(span) {\r
+                                               var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');\r
+\r
+                                               // Remove span with the middot or the number\r
+                                               if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))\r
+                                                       dom.remove(span);\r
+                                               else if (/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))\r
+                                                       dom.remove(span);\r
+                                       });\r
+\r
+                                       html = p.innerHTML;\r
+\r
+                                       // Remove middot/list items\r
+                                       if (type == 'ul')\r
+                                               html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');\r
+                                       else\r
+                                               html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, '');\r
+\r
+                                       // Create li and add paragraph data into the new li\r
+                                       li = listElm.appendChild(dom.create('li', 0, html));\r
+                                       dom.remove(p);\r
+\r
+                                       lastMargin = margin;\r
+                                       lastType = type;\r
+                               } else\r
+                                       listElm = lastMargin = 0; // End list element\r
+                       });\r
+\r
+                       // Remove any left over makers\r
+                       html = o.node.innerHTML;\r
+                       if (html.indexOf('__MCE_ITEM__') != -1)\r
+                               o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');\r
+               },\r
+\r
+               /**\r
+                * Inserts the specified contents at the caret position.\r
+                */\r
+               _insert : function(h, skip_undo) {\r
+                       var ed = this.editor, r = ed.selection.getRng();\r
+\r
+                       // First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.\r
+                       if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)\r
+                               ed.getDoc().execCommand('Delete', false, null);\r
+\r
+                       ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});\r
+               },\r
+\r
+               /**\r
+                * Instead of the old plain text method which tried to re-create a paste operation, the\r
+                * new approach adds a plain text mode toggle switch that changes the behavior of paste.\r
+                * This function is passed the same input that the regular paste plugin produces.\r
+                * It performs additional scrubbing and produces (and inserts) the plain text.\r
+                * This approach leverages all of the great existing functionality in the paste\r
+                * plugin, and requires minimal changes to add the new functionality.\r
+                * Speednet - June 2009\r
+                */\r
+               _insertPlainText : function(content) {\r
+                       var ed = this.editor,\r
+                               linebr = getParam(ed, "paste_text_linebreaktype"),\r
+                               rl = getParam(ed, "paste_text_replacements"),\r
+                               is = tinymce.is;\r
+\r
+                       function process(items) {\r
+                               each(items, function(v) {\r
+                                       if (v.constructor == RegExp)\r
+                                               content = content.replace(v, "");\r
+                                       else\r
+                                               content = content.replace(v[0], v[1]);\r
+                               });\r
+                       };\r
+\r
+                       if ((typeof(content) === "string") && (content.length > 0)) {\r
+                               // If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line\r
+                               if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {\r
+                                       process([\r
+                                               /[\n\r]+/g\r
+                                       ]);\r
+                               } else {\r
+                                       // Otherwise just get rid of carriage returns (only need linefeeds)\r
+                                       process([\r
+                                               /\r+/g\r
+                                       ]);\r
+                               }\r
+\r
+                               process([\r
+                                       [/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"],               // Block tags get a blank line after them\r
+                                       [/<br[^>]*>|<\/tr>/gi, "\n"],                           // Single linebreak for <br /> tags and table rows\r
+                                       [/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"],           // Table cells get tabs betweem them\r
+                                       /<[a-z!\/?][^>]*>/gi,                                           // Delete all remaining tags\r
+                                       [/&nbsp;/gi, " "],                                                      // Convert non-break spaces to regular spaces (remember, *plain text*)\r
+                                       [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],// Cool little RegExp deletes whitespace around linebreak chars.\r
+                                       [/\n{3,}/g, "\n\n"]                                                     // Max. 2 consecutive linebreaks\r
+                               ]);\r
+\r
+                               content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));\r
+\r
+                               // Perform default or custom replacements\r
+                               if (is(rl, "array")) {\r
+                                       process(rl);\r
+                               } else if (is(rl, "string")) {\r
+                                       process(new RegExp(rl, "gi"));\r
+                               }\r
+\r
+                               // Treat paragraphs as specified in the config\r
+                               if (linebr == "none") {\r
+                                       // Convert all line breaks to space\r
+                                       process([\r
+                                               [/\n+/g, " "]\r
+                                       ]);\r
+                               } else if (linebr == "br") {\r
+                                       // Convert all line breaks to <br />\r
+                                       process([\r
+                                               [/\n/g, "<br />"]\r
+                                       ]);\r
+                               } else if (linebr == "p") {\r
+                                       // Convert all line breaks to <p>...</p>\r
+                                       process([\r
+                                               [/\n+/g, "</p><p>"],\r
+                                               [/^(.*<\/p>)(<p>)$/, '<p>$1']\r
+                                       ]);\r
+                               } else {\r
+                                       // defaults to "combined"\r
+                                       // Convert single line breaks to <br /> and double line breaks to <p>...</p>\r
+                                       process([\r
+                                               [/\n\n/g, "</p><p>"],\r
+                                               [/^(.*<\/p>)(<p>)$/, '<p>$1'],\r
+                                               [/\n/g, "<br />"]\r
+                                       ]);\r
+                               }\r
+\r
+                               ed.execCommand('mceInsertContent', false, content);\r
+                       }\r
+               },\r
+\r
+               /**\r
+                * This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.\r
+                */\r
+               _legacySupport : function() {\r
+                       var t = this, ed = t.editor;\r
+\r
+                       // Register command(s) for backwards compatibility\r
+                       ed.addCommand("mcePasteWord", function() {\r
+                               ed.windowManager.open({\r
+                                       file: t.url + "/pasteword.htm",\r
+                                       width: parseInt(getParam(ed, "paste_dialog_width")),\r
+                                       height: parseInt(getParam(ed, "paste_dialog_height")),\r
+                                       inline: 1\r
+                               });\r
+                       });\r
+\r
+                       if (getParam(ed, "paste_text_use_dialog")) {\r
+                               ed.addCommand("mcePasteText", function() {\r
+                                       ed.windowManager.open({\r
+                                               file : t.url + "/pastetext.htm",\r
+                                               width: parseInt(getParam(ed, "paste_dialog_width")),\r
+                                               height: parseInt(getParam(ed, "paste_dialog_height")),\r
+                                               inline : 1\r
+                                       });\r
+                               });\r
+                       }\r
+\r
+                       // Register button for backwards compatibility\r
+                       ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/js/pastetext.js b/3.x/src/resources/javascript/TinyMCE/plugins/paste/js/pastetext.js
new file mode 100644 (file)
index 0000000..c524f9e
--- /dev/null
@@ -0,0 +1,36 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var PasteTextDialog = {\r
+       init : function() {\r
+               this.resize();\r
+       },\r
+\r
+       insert : function() {\r
+               var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;\r
+\r
+               // Convert linebreaks into paragraphs\r
+               if (document.getElementById('linebreaks').checked) {\r
+                       lines = h.split(/\r?\n/);\r
+                       if (lines.length > 1) {\r
+                               h = '';\r
+                               tinymce.each(lines, function(row) {\r
+                                       h += '<p>' + row + '</p>';\r
+                               });\r
+                       }\r
+               }\r
+\r
+               tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});\r
+               tinyMCEPopup.close();\r
+       },\r
+\r
+       resize : function() {\r
+               var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
+\r
+               el = document.getElementById('content');\r
+\r
+               el.style.width  = (vp.w - 20) + 'px';\r
+               el.style.height = (vp.h - 90) + 'px';\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/js/pasteword.js b/3.x/src/resources/javascript/TinyMCE/plugins/paste/js/pasteword.js
new file mode 100644 (file)
index 0000000..a52731c
--- /dev/null
@@ -0,0 +1,51 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var PasteWordDialog = {\r
+       init : function() {\r
+               var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';\r
+\r
+               // Create iframe\r
+               el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';\r
+               ifr = document.getElementById('iframe');\r
+               doc = ifr.contentWindow.document;\r
+\r
+               // Force absolute CSS urls\r
+               css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];\r
+               css = css.concat(tinymce.explode(ed.settings.content_css) || []);\r
+               tinymce.each(css, function(u) {\r
+                       cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';\r
+               });\r
+\r
+               // Write content into iframe\r
+               doc.open();\r
+               doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');\r
+               doc.close();\r
+\r
+               doc.designMode = 'on';\r
+               this.resize();\r
+\r
+               window.setTimeout(function() {\r
+                       ifr.contentWindow.focus();\r
+               }, 10);\r
+       },\r
+\r
+       insert : function() {\r
+               var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;\r
+\r
+               tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});\r
+               tinyMCEPopup.close();\r
+       },\r
+\r
+       resize : function() {\r
+               var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
+\r
+               el = document.getElementById('iframe');\r
+\r
+               if (el) {\r
+                       el.style.width  = (vp.w - 20) + 'px';\r
+                       el.style.height = (vp.h - 90) + 'px';\r
+               }\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/paste/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..bc74daf
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.paste_dlg',{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/pastetext.htm b/3.x/src/resources/javascript/TinyMCE/plugins/paste/pastetext.htm
new file mode 100644 (file)
index 0000000..b655945
--- /dev/null
@@ -0,0 +1,27 @@
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#paste.paste_text_desc}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/pastetext.js"></script>\r
+</head>\r
+<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;">\r
+       <form name="source" onsubmit="return PasteTextDialog.insert();" action="#">\r
+               <div style="float: left" class="title">{#paste.paste_text_desc}</div>\r
+\r
+               <div style="float: right">\r
+                       <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>\r
+               </div>\r
+\r
+               <br style="clear: both" />\r
+\r
+               <div>{#paste_dlg.text_title}</div>\r
+\r
+               <textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" name="insert" value="{#insert}" id="insert" />\r
+                       <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />\r
+               </div>\r
+       </form>\r
+</body> \r
+</html>
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/paste/pasteword.htm b/3.x/src/resources/javascript/TinyMCE/plugins/paste/pasteword.htm
new file mode 100644 (file)
index 0000000..0f6bb41
--- /dev/null
@@ -0,0 +1,21 @@
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#paste.paste_word_desc}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/pasteword.js"></script>\r
+</head>\r
+<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;">\r
+       <form name="source" onsubmit="return PasteWordDialog.insert();" action="#">\r
+               <div class="title">{#paste.paste_word_desc}</div>\r
+\r
+               <div>{#paste_dlg.word_title}</div>\r
+\r
+               <div id="iframecontainer"></div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/preview/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/preview/editor_plugin.js
new file mode 100644 (file)
index 0000000..507909c
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.Preview",{init:function(a,b){var d=this,c=tinymce.explode(a.settings.content_css);d.editor=a;tinymce.each(c,function(f,e){c[e]=a.documentBaseURI.toAbsolute(f)});a.addCommand("mcePreview",function(){a.windowManager.open({file:a.getParam("plugin_preview_pageurl",b+"/preview.html"),width:parseInt(a.getParam("plugin_preview_width","550")),height:parseInt(a.getParam("plugin_preview_height","600")),resizable:"yes",scrollbars:"yes",popup_css:c?c.join(","):a.baseURI.toAbsolute("themes/"+a.settings.theme+"/skins/"+a.settings.skin+"/content.css"),inline:a.getParam("plugin_preview_inline",1)},{base:a.documentBaseURI.getURI()})});a.addButton("preview",{title:"preview.preview_desc",cmd:"mcePreview"})},getInfo:function(){return{longname:"Preview",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("preview",tinymce.plugins.Preview)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/preview/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/preview/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..80f00f0
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       tinymce.create('tinymce.plugins.Preview', {
+               init : function(ed, url) {
+                       var t = this, css = tinymce.explode(ed.settings.content_css);
+
+                       t.editor = ed;
+
+                       // Force absolute CSS urls      
+                       tinymce.each(css, function(u, k) {
+                               css[k] = ed.documentBaseURI.toAbsolute(u);
+                       });
+
+                       ed.addCommand('mcePreview', function() {
+                               ed.windowManager.open({
+                                       file : ed.getParam("plugin_preview_pageurl", url + "/preview.html"),
+                                       width : parseInt(ed.getParam("plugin_preview_width", "550")),
+                                       height : parseInt(ed.getParam("plugin_preview_height", "600")),
+                                       resizable : "yes",
+                                       scrollbars : "yes",
+                                       popup_css : css ? css.join(',') : ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css"),
+                                       inline : ed.getParam("plugin_preview_inline", 1)
+                               }, {
+                                       base : ed.documentBaseURI.getURI()
+                               });
+                       });
+
+                       ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'});
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'Preview',
+                               author : 'Moxiecode Systems AB',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
+                       };
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('preview', tinymce.plugins.Preview);
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/preview/example.html b/3.x/src/resources/javascript/TinyMCE/plugins/preview/example.html
new file mode 100644 (file)
index 0000000..b2c3d90
--- /dev/null
@@ -0,0 +1,28 @@
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<script language="javascript" src="../../tiny_mce_popup.js"></script>\r
+<script type="text/javascript" src="jscripts/embed.js"></script>\r
+<script type="text/javascript">\r
+tinyMCEPopup.onInit.add(function(ed) {\r
+       var dom = tinyMCEPopup.dom;\r
+\r
+       // Load editor content_css\r
+       tinymce.each(ed.settings.content_css.split(','), function(u) {\r
+               dom.loadCSS(ed.documentBaseURI.toAbsolute(u));\r
+       });\r
+\r
+       // Place contents inside div container\r
+       dom.setHTML('content', ed.getContent());\r
+});\r
+</script>\r
+<title>Example of a custom preview page</title>\r
+</head>\r
+<body>\r
+\r
+Editor contents: <br />\r
+<div id="content">\r
+<!-- Gets filled with editor contents -->\r
+</div>\r
+\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/preview/jscripts/embed.js b/3.x/src/resources/javascript/TinyMCE/plugins/preview/jscripts/embed.js
new file mode 100644 (file)
index 0000000..f8dc810
--- /dev/null
@@ -0,0 +1,73 @@
+/**\r
+ * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.\r
+ */\r
+\r
+function writeFlash(p) {\r
+       writeEmbed(\r
+               'D27CDB6E-AE6D-11cf-96B8-444553540000',\r
+               'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',\r
+               'application/x-shockwave-flash',\r
+               p\r
+       );\r
+}\r
+\r
+function writeShockWave(p) {\r
+       writeEmbed(\r
+       '166B1BCA-3F9C-11CF-8075-444553540000',\r
+       'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',\r
+       'application/x-director',\r
+               p\r
+       );\r
+}\r
+\r
+function writeQuickTime(p) {\r
+       writeEmbed(\r
+               '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',\r
+               'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',\r
+               'video/quicktime',\r
+               p\r
+       );\r
+}\r
+\r
+function writeRealMedia(p) {\r
+       writeEmbed(\r
+               'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',\r
+               'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',\r
+               'audio/x-pn-realaudio-plugin',\r
+               p\r
+       );\r
+}\r
+\r
+function writeWindowsMedia(p) {\r
+       p.url = p.src;\r
+       writeEmbed(\r
+               '6BF52A52-394A-11D3-B153-00C04F79FAA6',\r
+               'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',\r
+               'application/x-mplayer2',\r
+               p\r
+       );\r
+}\r
+\r
+function writeEmbed(cls, cb, mt, p) {\r
+       var h = '', n;\r
+\r
+       h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';\r
+       h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';\r
+       h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';\r
+       h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';\r
+       h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';\r
+       h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';\r
+       h += '>';\r
+\r
+       for (n in p)\r
+               h += '<param name="' + n + '" value="' + p[n] + '">';\r
+\r
+       h += '<embed type="' + mt + '"';\r
+\r
+       for (n in p)\r
+               h += n + '="' + p[n] + '" ';\r
+\r
+       h += '></embed></object>';\r
+\r
+       document.write(h);\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/preview/preview.html b/3.x/src/resources/javascript/TinyMCE/plugins/preview/preview.html
new file mode 100644 (file)
index 0000000..67e7b14
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+<script type="text/javascript" src="jscripts/embed.js"></script>\r
+<script type="text/javascript"><!--\r
+document.write('<base href="' + tinyMCEPopup.getWindowArg("base") + '">');\r
+// -->\r
+</script>\r
+<title>{#preview.preview_desc}</title>\r
+</head>\r
+<body id="content">\r
+<script type="text/javascript">\r
+       document.write(tinyMCEPopup.editor.getContent());\r
+</script>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/print/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/print/editor_plugin.js
new file mode 100644 (file)
index 0000000..b5b3a55
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.Print",{init:function(a,b){a.addCommand("mcePrint",function(){a.getWin().print()});a.addButton("print",{title:"print.print_desc",cmd:"mcePrint"})},getInfo:function(){return{longname:"Print",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("print",tinymce.plugins.Print)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/print/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/print/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..3933fe6
--- /dev/null
@@ -0,0 +1,34 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.Print', {\r
+               init : function(ed, url) {\r
+                       ed.addCommand('mcePrint', function() {\r
+                               ed.getWin().print();\r
+                       });\r
+\r
+                       ed.addButton('print', {title : 'print.print_desc', cmd : 'mcePrint'});\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Print',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('print', tinymce.plugins.Print);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/save/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/save/editor_plugin.js
new file mode 100644 (file)
index 0000000..8e93996
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.Save",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceSave",c._save,c);a.addCommand("mceCancel",c._cancel,c);a.addButton("save",{title:"save.save_desc",cmd:"mceSave"});a.addButton("cancel",{title:"save.cancel_desc",cmd:"mceCancel"});a.onNodeChange.add(c._nodeChange,c);a.addShortcut("ctrl+s",a.getLang("save.save_desc"),"mceSave")},getInfo:function(){return{longname:"Save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,c){var b=this.editor;if(b.getParam("save_enablewhendirty")){a.setDisabled("save",!b.isDirty());a.setDisabled("cancel",!b.isDirty())}},_save:function(){var c=this.editor,a,e,d,b;a=tinymce.DOM.get(c.id).form||tinymce.DOM.getParent(c.id,"form");if(c.getParam("save_enablewhendirty")&&!c.isDirty()){return}tinyMCE.triggerSave();if(e=c.getParam("save_onsavecallback")){if(c.execCallback("save_onsavecallback",c)){c.startContent=tinymce.trim(c.getContent({format:"raw"}));c.nodeChanged()}return}if(a){c.isNotDirty=true;if(a.onsubmit==null||a.onsubmit()!=false){a.submit()}c.nodeChanged()}else{c.windowManager.alert("Error: No form element found.")}},_cancel:function(){var a=this.editor,c,b=tinymce.trim(a.startContent);if(c=a.getParam("save_oncancelcallback")){a.execCallback("save_oncancelcallback",a);return}a.setContent(b);a.undoManager.clear();a.nodeChanged()}});tinymce.PluginManager.add("save",tinymce.plugins.Save)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/save/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/save/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..f5a3de8
--- /dev/null
@@ -0,0 +1,101 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.Save', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceSave', t._save, t);\r
+                       ed.addCommand('mceCancel', t._cancel, t);\r
+\r
+                       // Register buttons\r
+                       ed.addButton('save', {title : 'save.save_desc', cmd : 'mceSave'});\r
+                       ed.addButton('cancel', {title : 'save.cancel_desc', cmd : 'mceCancel'});\r
+\r
+                       ed.onNodeChange.add(t._nodeChange, t);\r
+                       ed.addShortcut('ctrl+s', ed.getLang('save.save_desc'), 'mceSave');\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Save',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _nodeChange : function(ed, cm, n) {\r
+                       var ed = this.editor;\r
+\r
+                       if (ed.getParam('save_enablewhendirty')) {\r
+                               cm.setDisabled('save', !ed.isDirty());\r
+                               cm.setDisabled('cancel', !ed.isDirty());\r
+                       }\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _save : function() {\r
+                       var ed = this.editor, formObj, os, i, elementId;\r
+\r
+                       formObj = tinymce.DOM.get(ed.id).form || tinymce.DOM.getParent(ed.id, 'form');\r
+\r
+                       if (ed.getParam("save_enablewhendirty") && !ed.isDirty())\r
+                               return;\r
+\r
+                       tinyMCE.triggerSave();\r
+\r
+                       // Use callback instead\r
+                       if (os = ed.getParam("save_onsavecallback")) {\r
+                               if (ed.execCallback('save_onsavecallback', ed)) {\r
+                                       ed.startContent = tinymce.trim(ed.getContent({format : 'raw'}));\r
+                                       ed.nodeChanged();\r
+                               }\r
+\r
+                               return;\r
+                       }\r
+\r
+                       if (formObj) {\r
+                               ed.isNotDirty = true;\r
+\r
+                               if (formObj.onsubmit == null || formObj.onsubmit() != false)\r
+                                       formObj.submit();\r
+\r
+                               ed.nodeChanged();\r
+                       } else\r
+                               ed.windowManager.alert("Error: No form element found.");\r
+               },\r
+\r
+               _cancel : function() {\r
+                       var ed = this.editor, os, h = tinymce.trim(ed.startContent);\r
+\r
+                       // Use callback instead\r
+                       if (os = ed.getParam("save_oncancelcallback")) {\r
+                               ed.execCallback('save_oncancelcallback', ed);\r
+                               return;\r
+                       }\r
+\r
+                       ed.setContent(h);\r
+                       ed.undoManager.clear();\r
+                       ed.nodeChanged();\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('save', tinymce.plugins.Save);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/css/searchreplace.css b/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/css/searchreplace.css
new file mode 100644 (file)
index 0000000..ecdf58c
--- /dev/null
@@ -0,0 +1,6 @@
+.panel_wrapper {height:85px;}\r
+.panel_wrapper div.current {height:85px;}\r
+\r
+/* IE */\r
+* html .panel_wrapper {height:100px;}\r
+* html .panel_wrapper div.current {height:100px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/editor_plugin.js
new file mode 100644 (file)
index 0000000..165bc12
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){window.focus();a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:170+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..4c87e8f
--- /dev/null
@@ -0,0 +1,61 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.SearchReplacePlugin', {\r
+               init : function(ed, url) {\r
+                       function open(m) {\r
+                               // Keep IE from writing out the f/r character to the editor\r
+                               // instance while initializing a new dialog. See: #3131190\r
+                               window.focus();\r
+\r
+                               ed.windowManager.open({\r
+                                       file : url + '/searchreplace.htm',\r
+                                       width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),\r
+                                       height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)),\r
+                                       inline : 1,\r
+                                       auto_focus : 0\r
+                               }, {\r
+                                       mode : m,\r
+                                       search_string : ed.selection.getContent({format : 'text'}),\r
+                                       plugin_url : url\r
+                               });\r
+                       };\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceSearch', function() {\r
+                               open('search');\r
+                       });\r
+\r
+                       ed.addCommand('mceReplace', function() {\r
+                               open('replace');\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});\r
+                       ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});\r
+\r
+                       ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Search/Replace',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/js/searchreplace.js b/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/js/searchreplace.js
new file mode 100644 (file)
index 0000000..80284b9
--- /dev/null
@@ -0,0 +1,142 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var SearchReplaceDialog = {\r
+       init : function(ed) {\r
+               var t = this, f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");\r
+\r
+               t.switchMode(m);\r
+\r
+               f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");\r
+\r
+               // Focus input field\r
+               f[m + '_panel_searchstring'].focus();\r
+               \r
+               mcTabs.onChange.add(function(tab_id, panel_id) {\r
+                       t.switchMode(tab_id.substring(0, tab_id.indexOf('_')));\r
+               });\r
+       },\r
+\r
+       switchMode : function(m) {\r
+               var f, lm = this.lastMode;\r
+\r
+               if (lm != m) {\r
+                       f = document.forms[0];\r
+\r
+                       if (lm) {\r
+                               f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value;\r
+                               f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked;\r
+                               f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked;\r
+                               f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked;\r
+                       }\r
+\r
+                       mcTabs.displayTab(m + '_tab',  m + '_panel');\r
+                       document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none";\r
+                       document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none";\r
+                       this.lastMode = m;\r
+               }\r
+       },\r
+\r
+       searchNext : function(a) {\r
+               var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;\r
+\r
+               // Get input\r
+               f = document.forms[0];\r
+               s = f[m + '_panel_searchstring'].value;\r
+               b = f[m + '_panel_backwardsu'].checked;\r
+               ca = f[m + '_panel_casesensitivebox'].checked;\r
+               rs = f['replace_panel_replacestring'].value;\r
+\r
+               if (tinymce.isIE) {\r
+                       r = ed.getDoc().selection.createRange();\r
+               }\r
+\r
+               if (s == '')\r
+                       return;\r
+\r
+               function fix() {\r
+                       // Correct Firefox graphics glitches\r
+                       // TODO: Verify if this is actually needed any more, maybe it was for very old FF versions? \r
+                       r = se.getRng().cloneRange();\r
+                       ed.getDoc().execCommand('SelectAll', false, null);\r
+                       se.setRng(r);\r
+               };\r
+\r
+               function replace() {\r
+                       ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE\r
+               };\r
+\r
+               // IE flags\r
+               if (ca)\r
+                       fl = fl | 4;\r
+\r
+               switch (a) {\r
+                       case 'all':\r
+                               // Move caret to beginning of text\r
+                               ed.execCommand('SelectAll');\r
+                               ed.selection.collapse(true);\r
+\r
+                               if (tinymce.isIE) {\r
+                                       ed.focus();\r
+                                       r = ed.getDoc().selection.createRange();\r
+\r
+                                       while (r.findText(s, b ? -1 : 1, fl)) {\r
+                                               r.scrollIntoView();\r
+                                               r.select();\r
+                                               replace();\r
+                                               fo = 1;\r
+\r
+                                               if (b) {\r
+                                                       r.moveEnd("character", -(rs.length)); // Otherwise will loop forever\r
+                                               }\r
+                                       }\r
+\r
+                                       tinyMCEPopup.storeSelection();\r
+                               } else {\r
+                                       while (w.find(s, ca, b, false, false, false, false)) {\r
+                                               replace();\r
+                                               fo = 1;\r
+                                       }\r
+                               }\r
+\r
+                               if (fo)\r
+                                       tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced'));\r
+                               else\r
+                                       tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));\r
+\r
+                               return;\r
+\r
+                       case 'current':\r
+                               if (!ed.selection.isCollapsed())\r
+                                       replace();\r
+\r
+                               break;\r
+               }\r
+\r
+               se.collapse(b);\r
+               r = se.getRng();\r
+\r
+               // Whats the point\r
+               if (!s)\r
+                       return;\r
+\r
+               if (tinymce.isIE) {\r
+                       ed.focus();\r
+                       r = ed.getDoc().selection.createRange();\r
+\r
+                       if (r.findText(s, b ? -1 : 1, fl)) {\r
+                               r.scrollIntoView();\r
+                               r.select();\r
+                       } else\r
+                               tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));\r
+\r
+                       tinyMCEPopup.storeSelection();\r
+               } else {\r
+                       if (!w.find(s, ca, b, false, false, false, false))\r
+                               tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));\r
+                       else\r
+                               fix();\r
+               }\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..8a65900
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.searchreplace_dlg',{findwhat:"Find What",replacewith:"Replace with",direction:"Direction",up:"Up",down:"Down",mcase:"Match Case",findnext:"Find Next",allreplaced:"All occurrences of the search string were replaced.","searchnext_desc":"Find Again",notfound:"The search has been completed. The search string could not be found.","search_title":"Find","replace_title":"Find/Replace",replaceall:"Replace All",replace:"Replace"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/searchreplace.htm b/3.x/src/resources/javascript/TinyMCE/plugins/searchreplace/searchreplace.htm
new file mode 100644 (file)
index 0000000..2443a91
--- /dev/null
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#searchreplace_dlg.replace_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="js/searchreplace.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/searchreplace.css" />\r
+</head>\r
+<body style="display:none;" role="application" aria-labelledby="app_title">\r
+<span id="app_title" style="display:none">{#searchreplace_dlg.replace_title}</span>\r
+<form onsubmit="SearchReplaceDialog.searchNext('none');return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="search_tab" aria-controls="search_panel"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li>\r
+                       <li id="replace_tab" aria-controls="replace_panel"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.replace}</a></span></li>\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="search_panel" class="panel">\r
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="2">\r
+                               <tr>\r
+                                       <td><label for="search_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>\r
+                                       <td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" aria-required="true" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td colspan="2">\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0" class="direction">\r
+                                                       <tr role="group" aria-labelledby="search_panel_backwards_label">\r
+                                                               <td><label id="search_panel_backwards_label">{#searchreplace_dlg.direction}</label></td>\r
+                                                               <td><input id="search_panel_backwardsu" name="search_panel_backwards" class="radio" type="radio" /></td>\r
+                                                               <td><label for="search_panel_backwardsu">{#searchreplace_dlg.up}</label></td>\r
+                                                               <td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" checked="checked" /></td>\r
+                                                               <td><label for="search_panel_backwardsd">{#searchreplace_dlg.down}</label></td>\r
+                                                       </tr>\r
+                                               </table>\r
+                                       </td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td colspan="2">\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                       <tr>\r
+                                                               <td><input id="search_panel_casesensitivebox" name="search_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>\r
+                                                               <td><label for="search_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>\r
+                                                       </tr>\r
+                                               </table>\r
+                                       </td>\r
+                               </tr>\r
+                       </table>\r
+               </div>\r
+\r
+               <div id="replace_panel" class="panel">\r
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="2">\r
+                               <tr>\r
+                                       <td><label for="replace_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>\r
+                                       <td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" aria-required="true" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="replace_panel_replacestring">{#searchreplace_dlg.replacewith}</label></td>\r
+                                       <td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" aria-required="true" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td colspan="2">\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0" class="direction">\r
+                                                       <tr role="group" aria-labelledby="replace_panel_dir_label">\r
+                                                               <td><label id="replace_panel_dir_label">{#searchreplace_dlg.direction}</label></td>\r
+                                                               <td><input id="replace_panel_backwardsu" name="replace_panel_backwards" class="radio" type="radio" /></td>\r
+                                                               <td><label for="replace_panel_backwardsu">{#searchreplace_dlg.up}</label></td>\r
+                                                               <td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" checked="checked" /></td>\r
+                                                               <td><label for="replace_panel_backwardsd">{#searchreplace_dlg.down}</label></td>\r
+                                                       </tr>\r
+                                               </table>\r
+                                       </td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td colspan="2">\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                       <tr>\r
+                                                               <td><input id="replace_panel_casesensitivebox" name="replace_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>\r
+                                                               <td><label for="replace_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>\r
+                                                       </tr>\r
+                                               </table>\r
+                                       </td>\r
+                               </tr>\r
+                       </table>\r
+               </div>\r
+\r
+       </div>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />\r
+               <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />\r
+               <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />\r
+               <input type="button" id="cancel" name="close" value="{#close}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/css/content.css b/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/css/content.css
new file mode 100644 (file)
index 0000000..24efa02
--- /dev/null
@@ -0,0 +1 @@
+.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/editor_plugin.js
new file mode 100644 (file)
index 0000000..48549c9
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url","{backend}");if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});if(e.settings.content_css!==false){e.contentCSS.push(f+"/css/content.css")}e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){if(n==f.selectedLang){return}l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={},h=[];this._walk(e.getBody(),function(i){if(i.nodeType==3){d+=i.nodeValue+" "}});if(e.getParam("spellchecker_word_pattern")){h=d.match("("+e.getParam("spellchecker_word_pattern")+")","gi")}else{d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));h=d.split(" ")}c(h,function(i){if(!f[i]){g.push(i);f[i]=1}});return g},_removeWords:function(d){var e=this.editor,h=e.dom,g=e.selection,f=g.getRng(true);c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!d||h.decode(i.innerHTML)==d){h.remove(i,1)}}});g.setRng(f)},_markWords:function(l){var h=this.editor,g=h.dom,j=h.getDoc(),i=h.selection,d=i.getRng(true),e=[],k=l.join("|"),m=this._getSeparators(),f=new RegExp("(^|["+m+"])("+k+")(?=["+m+"]|$)","g");this._walk(h.getBody(),function(o){if(o.nodeType==3){e.push(o)}});c(e,function(t){var r,q,o,s,p=t.nodeValue;if(f.test(p)){p=g.encode(p);q=g.create("span",{"class":"mceItemHidden"});if(tinymce.isIE){p=p.replace(f,"$1<mcespell>$2</mcespell>");while((s=p.indexOf("<mcespell>"))!=-1){o=p.substring(0,s);if(o.length){r=j.createTextNode(g.decode(o));q.appendChild(r)}p=p.substring(s+10);s=p.indexOf("</mcespell>");o=p.substring(0,s);p=p.substring(s+11);q.appendChild(g.create("span",{"class":"mceItemHiddenSpellWord"},o))}if(p.length){r=j.createTextNode(g.decode(p));q.appendChild(r)}}else{q.innerHTML=p.replace(f,'$1<span class="mceItemHiddenSpellWord">$2</span>')}g.replace(q,t)}});i.setRng(d)},_showMenu:function(h,j){var i=this,h=i.editor,d=i._menu,l,k=h.dom,g=k.getViewPort(h.getWin()),f=j.target;j=0;if(!d){d=h.controlManager.createDropMenu("spellcheckermenu",{"class":"mceNoIcons"});i._menu=d}if(k.hasClass(f,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);i._sendRPC("getSuggestions",[i.selectedLang,k.decode(f.innerHTML)],function(m){var e;d.removeAll();if(m.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(m,function(n){d.add({title:n,onclick:function(){k.replace(h.getDoc().createTextNode(n),f);i._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}if(h.getParam("show_ignore_words",true)){e=i.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var n=f.innerHTML;i._removeWords(k.decode(n));i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWords",[i.selectedLang,n],function(o){h.setProgressState(0)})}}})}if(i.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();h.setProgressState(1);i._sendRPC("learnWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}})}d.update()});l=b.getPos(h.getContentAreaContainer());d.settings.offset_x=l.x;d.settings.offset_y=l.y;h.selection.select(f);l=k.getPos(f);d.showMenu(l.x,l.y+f.offsetHeight-g.y);return tinymce.dom.Event.cancel(j)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..86fdfce
--- /dev/null
@@ -0,0 +1,436 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;\r
+\r
+       tinymce.create('tinymce.plugins.SpellcheckerPlugin', {\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Spellchecker',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               init : function(ed, url) {\r
+                       var t = this, cm;\r
+\r
+                       t.url = url;\r
+                       t.editor = ed;\r
+                       t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}");\r
+\r
+                       if (t.rpcUrl == '{backend}') {\r
+                               // Sniff if the browser supports native spellchecking (Don't know of a better way)\r
+                               if (tinymce.isIE)\r
+                                       return;\r
+\r
+                               t.hasSupport = true;\r
+\r
+                               // Disable the context menu when spellchecking is active\r
+                               ed.onContextMenu.addToTop(function(ed, e) {\r
+                                       if (t.active)\r
+                                               return false;\r
+                               });\r
+                       }\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceSpellCheck', function() {\r
+                               if (t.rpcUrl == '{backend}') {\r
+                                       // Enable/disable native spellchecker\r
+                                       t.editor.getBody().spellcheck = t.active = !t.active;\r
+                                       return;\r
+                               }\r
+\r
+                               if (!t.active) {\r
+                                       ed.setProgressState(1);\r
+                                       t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {\r
+                                               if (r.length > 0) {\r
+                                                       t.active = 1;\r
+                                                       t._markWords(r);\r
+                                                       ed.setProgressState(0);\r
+                                                       ed.nodeChanged();\r
+                                               } else {\r
+                                                       ed.setProgressState(0);\r
+\r
+                                                       if (ed.getParam('spellchecker_report_no_misspellings', true))\r
+                                                               ed.windowManager.alert('spellchecker.no_mpell');\r
+                                               }\r
+                                       });\r
+                               } else\r
+                                       t._done();\r
+                       });\r
+\r
+                       if (ed.settings.content_css !== false)\r
+                               ed.contentCSS.push(url + '/css/content.css');\r
+\r
+                       ed.onClick.add(t._showMenu, t);\r
+                       ed.onContextMenu.add(t._showMenu, t);\r
+                       ed.onBeforeGetContent.add(function() {\r
+                               if (t.active)\r
+                                       t._removeWords();\r
+                       });\r
+\r
+                       ed.onNodeChange.add(function(ed, cm) {\r
+                               cm.setActive('spellchecker', t.active);\r
+                       });\r
+\r
+                       ed.onSetContent.add(function() {\r
+                               t._done();\r
+                       });\r
+\r
+                       ed.onBeforeGetContent.add(function() {\r
+                               t._done();\r
+                       });\r
+\r
+                       ed.onBeforeExecCommand.add(function(ed, cmd) {\r
+                               if (cmd == 'mceFullScreen')\r
+                                       t._done();\r
+                       });\r
+\r
+                       // Find selected language\r
+                       t.languages = {};\r
+                       each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {\r
+                               if (k.indexOf('+') === 0) {\r
+                                       k = k.substring(1);\r
+                                       t.selectedLang = v;\r
+                               }\r
+\r
+                               t.languages[k] = v;\r
+                       });\r
+               },\r
+\r
+               createControl : function(n, cm) {\r
+                       var t = this, c, ed = t.editor;\r
+\r
+                       if (n == 'spellchecker') {\r
+                               // Use basic button if we use the native spellchecker\r
+                               if (t.rpcUrl == '{backend}') {\r
+                                       // Create simple toggle button if we have native support\r
+                                       if (t.hasSupport)\r
+                                               c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});\r
+\r
+                                       return c;\r
+                               }\r
+\r
+                               c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});\r
+\r
+                               c.onRenderMenu.add(function(c, m) {\r
+                                       m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
+                                       each(t.languages, function(v, k) {\r
+                                               var o = {icon : 1}, mi;\r
+\r
+                                               o.onclick = function() {\r
+                                                       if (v == t.selectedLang) {\r
+                                                               return;\r
+                                                       }\r
+                                                       mi.setSelected(1);\r
+                                                       t.selectedItem.setSelected(0);\r
+                                                       t.selectedItem = mi;\r
+                                                       t.selectedLang = v;\r
+                                               };\r
+\r
+                                               o.title = k;\r
+                                               mi = m.add(o);\r
+                                               mi.setSelected(v == t.selectedLang);\r
+\r
+                                               if (v == t.selectedLang)\r
+                                                       t.selectedItem = mi;\r
+                                       })\r
+                               });\r
+\r
+                               return c;\r
+                       }\r
+               },\r
+\r
+               // Internal functions\r
+\r
+               _walk : function(n, f) {\r
+                       var d = this.editor.getDoc(), w;\r
+\r
+                       if (d.createTreeWalker) {\r
+                               w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);\r
+\r
+                               while ((n = w.nextNode()) != null)\r
+                                       f.call(this, n);\r
+                       } else\r
+                               tinymce.walk(n, f, 'childNodes');\r
+               },\r
+\r
+               _getSeparators : function() {\r
+                       var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');\r
+\r
+                       // Build word separator regexp\r
+                       for (i=0; i<str.length; i++)\r
+                               re += '\\' + str.charAt(i);\r
+\r
+                       return re;\r
+               },\r
+\r
+               _getWords : function() {\r
+                       var ed = this.editor, wl = [], tx = '', lo = {}, rawWords = [];\r
+\r
+                       // Get area text\r
+                       this._walk(ed.getBody(), function(n) {\r
+                               if (n.nodeType == 3)\r
+                                       tx += n.nodeValue + ' ';\r
+                       });\r
+\r
+                       // split the text up into individual words\r
+                       if (ed.getParam('spellchecker_word_pattern')) {\r
+                               // look for words that match the pattern\r
+                               rawWords = tx.match('(' + ed.getParam('spellchecker_word_pattern') + ')', 'gi');\r
+                       } else {\r
+                               // Split words by separator\r
+                               tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');\r
+                               tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));\r
+                               rawWords = tx.split(' ');\r
+                       }\r
+\r
+                       // Build word array and remove duplicates\r
+                       each(rawWords, function(v) {\r
+                               if (!lo[v]) {\r
+                                       wl.push(v);\r
+                                       lo[v] = 1;\r
+                               }\r
+                       });\r
+\r
+                       return wl;\r
+               },\r
+\r
+               _removeWords : function(w) {\r
+                       var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);\r
+\r
+                       each(dom.select('span').reverse(), function(n) {\r
+                               if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {\r
+                                       if (!w || dom.decode(n.innerHTML) == w)\r
+                                               dom.remove(n, 1);\r
+                               }\r
+                       });\r
+\r
+                       se.setRng(r);\r
+               },\r
+\r
+               _markWords : function(wl) {\r
+                       var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],\r
+                               w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');\r
+\r
+                       // Collect all text nodes\r
+                       this._walk(ed.getBody(), function(n) {\r
+                               if (n.nodeType == 3) {\r
+                                       nl.push(n);\r
+                               }\r
+                       });\r
+\r
+                       // Wrap incorrect words in spans\r
+                       each(nl, function(n) {\r
+                               var node, elem, txt, pos, v = n.nodeValue;\r
+\r
+                               if (rx.test(v)) {\r
+                                       // Encode the content\r
+                                       v = dom.encode(v);\r
+                                       // Create container element\r
+                                       elem = dom.create('span', {'class' : 'mceItemHidden'});\r
+\r
+                                       // Following code fixes IE issues by creating text nodes\r
+                                       // using DOM methods instead of innerHTML.\r
+                                       // Bug #3124: <PRE> elements content is broken after spellchecking.\r
+                                       // Bug #1408: Preceding whitespace characters are removed\r
+                                       // @TODO: I'm not sure that both are still issues on IE9.\r
+                                       if (tinymce.isIE) {\r
+                                               // Enclose mispelled words with temporal tag\r
+                                               v = v.replace(rx, '$1<mcespell>$2</mcespell>');\r
+                                               // Loop over the content finding mispelled words\r
+                                               while ((pos = v.indexOf('<mcespell>')) != -1) {\r
+                                                       // Add text node for the content before the word\r
+                                                       txt = v.substring(0, pos);\r
+                                                       if (txt.length) {\r
+                                                               node = doc.createTextNode(dom.decode(txt));\r
+                                                               elem.appendChild(node);\r
+                                                       }\r
+                                                       v = v.substring(pos+10);\r
+                                                       pos = v.indexOf('</mcespell>');\r
+                                                       txt = v.substring(0, pos);\r
+                                                       v = v.substring(pos+11);\r
+                                                       // Add span element for the word\r
+                                                       elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt));\r
+                                               }\r
+                                               // Add text node for the rest of the content\r
+                                               if (v.length) {\r
+                                                       node = doc.createTextNode(dom.decode(v));\r
+                                                       elem.appendChild(node);\r
+                                               }\r
+                                       } else {\r
+                                               // Other browsers preserve whitespace characters on innerHTML usage\r
+                                               elem.innerHTML = v.replace(rx, '$1<span class="mceItemHiddenSpellWord">$2</span>');\r
+                                       }\r
+\r
+                                       // Finally, replace the node with the container\r
+                                       dom.replace(elem, n);\r
+                               }\r
+                       });\r
+\r
+                       se.setRng(r);\r
+               },\r
+\r
+               _showMenu : function(ed, e) {\r
+                       var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()), wordSpan = e.target;\r
+\r
+                       e = 0; // Fixes IE memory leak\r
+\r
+                       if (!m) {\r
+                               m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'});\r
+                               t._menu = m;\r
+                       }\r
+\r
+                       if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) {\r
+                               m.removeAll();\r
+                               m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
+\r
+                               t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) {\r
+                                       var ignoreRpc;\r
+\r
+                                       m.removeAll();\r
+\r
+                                       if (r.length > 0) {\r
+                                               m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
+                                               each(r, function(v) {\r
+                                                       m.add({title : v, onclick : function() {\r
+                                                               dom.replace(ed.getDoc().createTextNode(v), wordSpan);\r
+                                                               t._checkDone();\r
+                                                       }});\r
+                                               });\r
+\r
+                                               m.addSeparator();\r
+                                       } else\r
+                                               m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
+\r
+                                       if (ed.getParam('show_ignore_words', true)) {\r
+                                               ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');\r
+                                               m.add({\r
+                                                       title : 'spellchecker.ignore_word',\r
+                                                       onclick : function() {\r
+                                                               var word = wordSpan.innerHTML;\r
+\r
+                                                               dom.remove(wordSpan, 1);\r
+                                                               t._checkDone();\r
+\r
+                                                               // tell the server if we need to\r
+                                                               if (ignoreRpc) {\r
+                                                                       ed.setProgressState(1);\r
+                                                                       t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {\r
+                                                                               ed.setProgressState(0);\r
+                                                                       });\r
+                                                               }\r
+                                                       }\r
+                                               });\r
+\r
+                                               m.add({\r
+                                                       title : 'spellchecker.ignore_words',\r
+                                                       onclick : function() {\r
+                                                               var word = wordSpan.innerHTML;\r
+\r
+                                                               t._removeWords(dom.decode(word));\r
+                                                               t._checkDone();\r
+\r
+                                                               // tell the server if we need to\r
+                                                               if (ignoreRpc) {\r
+                                                                       ed.setProgressState(1);\r
+                                                                       t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {\r
+                                                                               ed.setProgressState(0);\r
+                                                                       });\r
+                                                               }\r
+                                                       }\r
+                                               });\r
+                                       }\r
+\r
+                                       if (t.editor.getParam("spellchecker_enable_learn_rpc")) {\r
+                                               m.add({\r
+                                                       title : 'spellchecker.learn_word',\r
+                                                       onclick : function() {\r
+                                                               var word = wordSpan.innerHTML;\r
+\r
+                                                               dom.remove(wordSpan, 1);\r
+                                                               t._checkDone();\r
+\r
+                                                               ed.setProgressState(1);\r
+                                                               t._sendRPC('learnWord', [t.selectedLang, word], function(r) {\r
+                                                                       ed.setProgressState(0);\r
+                                                               });\r
+                                                       }\r
+                                               });\r
+                                       }\r
+\r
+                                       m.update();\r
+                               });\r
+\r
+                               p1 = DOM.getPos(ed.getContentAreaContainer());\r
+                               m.settings.offset_x = p1.x;\r
+                               m.settings.offset_y = p1.y;\r
+\r
+                               ed.selection.select(wordSpan);\r
+                               p1 = dom.getPos(wordSpan);\r
+                               m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y);\r
+\r
+                               return tinymce.dom.Event.cancel(e);\r
+                       } else\r
+                               m.hideMenu();\r
+               },\r
+\r
+               _checkDone : function() {\r
+                       var t = this, ed = t.editor, dom = ed.dom, o;\r
+\r
+                       each(dom.select('span'), function(n) {\r
+                               if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {\r
+                                       o = true;\r
+                                       return false;\r
+                               }\r
+                       });\r
+\r
+                       if (!o)\r
+                               t._done();\r
+               },\r
+\r
+               _done : function() {\r
+                       var t = this, la = t.active;\r
+\r
+                       if (t.active) {\r
+                               t.active = 0;\r
+                               t._removeWords();\r
+\r
+                               if (t._menu)\r
+                                       t._menu.hideMenu();\r
+\r
+                               if (la)\r
+                                       t.editor.nodeChanged();\r
+                       }\r
+               },\r
+\r
+               _sendRPC : function(m, p, cb) {\r
+                       var t = this;\r
+\r
+                       JSONRequest.sendRPC({\r
+                               url : t.rpcUrl,\r
+                               method : m,\r
+                               params : p,\r
+                               success : cb,\r
+                               error : function(e, x) {\r
+                                       t.editor.setProgressState(0);\r
+                                       t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));\r
+                               }\r
+                       });\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/img/wline.gif b/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/img/wline.gif
new file mode 100644 (file)
index 0000000..7d0a4db
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/plugins/spellchecker/img/wline.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/css/props.css b/3.x/src/resources/javascript/TinyMCE/plugins/style/css/props.css
new file mode 100644 (file)
index 0000000..3b8f0ee
--- /dev/null
@@ -0,0 +1,14 @@
+#text_font {width:250px;}\r
+#text_size {width:70px;}\r
+.mceAddSelectValue {background:#DDD;}\r
+select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padding_right, #box_padding_bottom, #box_padding_left {width:70px;}\r
+#box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;}\r
+#positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;}\r
+#positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;}\r
+.panel_toggle_insert_span {padding-top:10px;}\r
+.panel_wrapper div.current {padding-top:10px;height:230px;}\r
+.delim {border-left:1px solid gray;}\r
+.tdelim {border-bottom:1px solid gray;}\r
+#block_display {width:145px;}\r
+#list_type {width:115px;}\r
+.disabled {background:#EEE;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/style/editor_plugin.js
new file mode 100644 (file)
index 0000000..dda9f92
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){var c=false;var f=a.selection.getSelectedBlocks();var d=[];if(f.length===1){d.push(a.selection.getNode().style.cssText)}else{tinymce.each(f,function(g){d.push(a.dom.getAttrib(g,"style"))});c=true}a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:340+parseInt(a.getLang("style.delta_height",0)),inline:1},{applyStyleToBlocks:c,plugin_url:b,styles:d})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/style/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..eaa7c77
--- /dev/null
@@ -0,0 +1,71 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.StylePlugin', {\r
+               init : function(ed, url) {\r
+                       // Register commands\r
+                       ed.addCommand('mceStyleProps', function() {\r
+\r
+                               var applyStyleToBlocks = false;\r
+                               var blocks = ed.selection.getSelectedBlocks();\r
+                               var styles = [];\r
+\r
+                               if (blocks.length === 1) {\r
+                                       styles.push(ed.selection.getNode().style.cssText);\r
+                               }\r
+                               else {\r
+                                       tinymce.each(blocks, function(block) {\r
+                                               styles.push(ed.dom.getAttrib(block, 'style'));\r
+                                       });\r
+                                       applyStyleToBlocks = true;\r
+                               }\r
+\r
+                               ed.windowManager.open({\r
+                                       file : url + '/props.htm',\r
+                                       width : 480 + parseInt(ed.getLang('style.delta_width', 0)),\r
+                                       height : 340 + parseInt(ed.getLang('style.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       applyStyleToBlocks : applyStyleToBlocks,\r
+                                       plugin_url : url,\r
+                                       styles : styles\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceSetElementStyle', function(ui, v) {\r
+                               if (e = ed.selection.getNode()) {\r
+                                       ed.dom.setAttrib(e, 'style', v);\r
+                                       ed.execCommand('mceRepaint');\r
+                               }\r
+                       });\r
+\r
+                       ed.onNodeChange.add(function(ed, cm, n) {\r
+                               cm.setDisabled('styleprops', n.nodeName === 'BODY');\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Style',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/js/props.js b/3.x/src/resources/javascript/TinyMCE/plugins/style/js/props.js
new file mode 100644 (file)
index 0000000..0a8a8ec
--- /dev/null
@@ -0,0 +1,709 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var defaultFonts = "" + \r
+       "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + \r
+       "Times New Roman, Times, serif=Times New Roman, Times, serif;" + \r
+       "Courier New, Courier, mono=Courier New, Courier, mono;" + \r
+       "Times New Roman, Times, serif=Times New Roman, Times, serif;" + \r
+       "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + \r
+       "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + \r
+       "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif";\r
+\r
+var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger";\r
+var defaultMeasurement = "+pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%";\r
+var defaultSpacingMeasurement = "pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;+ems=em;exs=ex;%";\r
+var defaultIndentMeasurement = "pixels=px;+points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%";\r
+var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900";\r
+var defaultTextStyle = "normal;italic;oblique";\r
+var defaultVariant = "normal;small-caps";\r
+var defaultLineHeight = "normal";\r
+var defaultAttachment = "fixed;scroll";\r
+var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y";\r
+var defaultPosH = "left;center;right";\r
+var defaultPosV = "top;center;bottom";\r
+var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom";\r
+var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none";\r
+var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset";\r
+var defaultBorderWidth = "thin;medium;thick";\r
+var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";\r
+\r
+function aggregateStyles(allStyles) {\r
+       var mergedStyles = {};\r
+\r
+       tinymce.each(allStyles, function(style) {\r
+               if (style !== '') {\r
+                       var parsedStyles = tinyMCEPopup.editor.dom.parseStyle(style);\r
+                       for (var name in parsedStyles) {\r
+                               if (parsedStyles.hasOwnProperty(name)) {\r
+                                       if (mergedStyles[name] === undefined) {\r
+                                               mergedStyles[name] = parsedStyles[name];\r
+                                       }\r
+                                       else if (name === 'text-decoration') {\r
+                                               if (mergedStyles[name].indexOf(parsedStyles[name]) === -1) {\r
+                                                       mergedStyles[name] = mergedStyles[name] +' '+ parsedStyles[name];\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       });\r
+\r
+  return mergedStyles;\r
+}\r
+\r
+var applyActionIsInsert;\r
+var existingStyles;\r
+\r
+function init(ed) {\r
+       var ce = document.getElementById('container'), h;\r
+\r
+       existingStyles = aggregateStyles(tinyMCEPopup.getWindowArg('styles'));\r
+       ce.style.cssText = tinyMCEPopup.editor.dom.serializeStyle(existingStyles);\r
+\r
+       applyActionIsInsert = ed.getParam("edit_css_style_insert_span", false);\r
+       document.getElementById('toggle_insert_span').checked = applyActionIsInsert;\r
+\r
+       h = getBrowserHTML('background_image_browser','background_image','image','advimage');\r
+       document.getElementById("background_image_browser").innerHTML = h;\r
+\r
+       document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color');\r
+       document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color');\r
+       document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top');\r
+       document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right');\r
+       document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom');\r
+       document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left');\r
+\r
+       fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true);\r
+       fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true);\r
+       fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true);\r
+       fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true);\r
+       fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true);\r
+       fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true);\r
+       fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true);\r
+       fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true);\r
+\r
+       fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true);\r
+       fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true);\r
+\r
+       fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true);\r
+\r
+       fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true);\r
+       fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true);\r
+\r
+       fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true);\r
+       fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true);\r
+       fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true);\r
+       fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true);\r
+       fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true);\r
+       fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true);\r
+       fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true);\r
+       fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true);\r
+       fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true);\r
+\r
+       fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true);\r
+       fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true);\r
+       fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true);\r
+\r
+       fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true);\r
+       fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true);\r
+       fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true);\r
+       fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true);\r
+\r
+       fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true);\r
+       fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true);\r
+       fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true);\r
+       fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true);\r
+\r
+       fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true);\r
+\r
+       fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true);\r
+       fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true);\r
+\r
+       fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true);\r
+       fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true);\r
+\r
+       fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true);\r
+\r
+       fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true);\r
+\r
+       fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true);\r
+       fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true);\r
+\r
+       TinyMCE_EditableSelects.init();\r
+       setupFormData();\r
+       showDisabledControls();\r
+}\r
+\r
+function setupFormData() {\r
+       var ce = document.getElementById('container'), f = document.forms[0], s, b, i;\r
+\r
+       // Setup text fields\r
+\r
+       selectByValue(f, 'text_font', ce.style.fontFamily, true, true);\r
+       selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true);\r
+       selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize));\r
+       selectByValue(f, 'text_weight', ce.style.fontWeight, true, true);\r
+       selectByValue(f, 'text_style', ce.style.fontStyle, true, true);\r
+       selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true);\r
+       selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight));\r
+       selectByValue(f, 'text_case', ce.style.textTransform, true, true);\r
+       selectByValue(f, 'text_variant', ce.style.fontVariant, true, true);\r
+       f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color);\r
+       updateColor('text_color_pick', 'text_color');\r
+       f.text_underline.checked = inStr(ce.style.textDecoration, 'underline');\r
+       f.text_overline.checked = inStr(ce.style.textDecoration, 'overline');\r
+       f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through');\r
+       f.text_blink.checked = inStr(ce.style.textDecoration, 'blink');\r
+       f.text_none.checked = inStr(ce.style.textDecoration, 'none');\r
+       updateTextDecorations();\r
+\r
+       // Setup background fields\r
+\r
+       f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor);\r
+       updateColor('background_color_pick', 'background_color');\r
+       f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");\r
+       selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true);\r
+       selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true);\r
+       selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true);\r
+       selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0)));\r
+       selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true);\r
+       selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1)));\r
+\r
+       // Setup block fields\r
+\r
+       selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true);\r
+       selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing));\r
+       selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true);\r
+       selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing));\r
+       selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true);\r
+       selectByValue(f, 'block_text_align', ce.style.textAlign, true, true);\r
+       f.block_text_indent.value = getNum(ce.style.textIndent);\r
+       selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent));\r
+       selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true);\r
+       selectByValue(f, 'block_display', ce.style.display, true, true);\r
+\r
+       // Setup box fields\r
+\r
+       f.box_width.value = getNum(ce.style.width);\r
+       selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width));\r
+\r
+       f.box_height.value = getNum(ce.style.height);\r
+       selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height));\r
+       selectByValue(f, 'box_float', ce.style.cssFloat || ce.style.styleFloat, true, true);\r
+\r
+       selectByValue(f, 'box_clear', ce.style.clear, true, true);\r
+\r
+       setupBox(f, ce, 'box_padding', 'padding', '');\r
+       setupBox(f, ce, 'box_margin', 'margin', '');\r
+\r
+       // Setup border fields\r
+\r
+       setupBox(f, ce, 'border_style', 'border', 'Style');\r
+       setupBox(f, ce, 'border_width', 'border', 'Width');\r
+       setupBox(f, ce, 'border_color', 'border', 'Color');\r
+\r
+       updateColor('border_color_top_pick', 'border_color_top');\r
+       updateColor('border_color_right_pick', 'border_color_right');\r
+       updateColor('border_color_bottom_pick', 'border_color_bottom');\r
+       updateColor('border_color_left_pick', 'border_color_left');\r
+\r
+       f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value);\r
+       f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value);\r
+       f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value);\r
+       f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value);\r
+\r
+       // Setup list fields\r
+\r
+       selectByValue(f, 'list_type', ce.style.listStyleType, true, true);\r
+       selectByValue(f, 'list_position', ce.style.listStylePosition, true, true);\r
+       f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");\r
+\r
+       // Setup box fields\r
+\r
+       selectByValue(f, 'positioning_type', ce.style.position, true, true);\r
+       selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true);\r
+       selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true);\r
+       f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : "";\r
+\r
+       f.positioning_width.value = getNum(ce.style.width);\r
+       selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width));\r
+\r
+       f.positioning_height.value = getNum(ce.style.height);\r
+       selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height));\r
+\r
+       setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']);\r
+\r
+       s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1");\r
+       s = s.replace(/,/g, ' ');\r
+\r
+       if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) {\r
+               f.positioning_clip_top.value = getNum(getVal(s, 0));\r
+               selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));\r
+               f.positioning_clip_right.value = getNum(getVal(s, 1));\r
+               selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1)));\r
+               f.positioning_clip_bottom.value = getNum(getVal(s, 2));\r
+               selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2)));\r
+               f.positioning_clip_left.value = getNum(getVal(s, 3));\r
+               selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3)));\r
+       } else {\r
+               f.positioning_clip_top.value = getNum(getVal(s, 0));\r
+               selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));\r
+               f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value;\r
+       }\r
+\r
+//     setupBox(f, ce, '', 'border', 'Color');\r
+}\r
+\r
+function getMeasurement(s) {\r
+       return s.replace(/^([0-9.]+)(.*)$/, "$2");\r
+}\r
+\r
+function getNum(s) {\r
+       if (new RegExp('^(?:[0-9.]+)(?:[a-z%]+)$', 'gi').test(s))\r
+               return s.replace(/[^0-9.]/g, '');\r
+\r
+       return s;\r
+}\r
+\r
+function inStr(s, n) {\r
+       return new RegExp(n, 'gi').test(s);\r
+}\r
+\r
+function getVal(s, i) {\r
+       var a = s.split(' ');\r
+\r
+       if (a.length > 1)\r
+               return a[i];\r
+\r
+       return "";\r
+}\r
+\r
+function setValue(f, n, v) {\r
+       if (f.elements[n].type == "text")\r
+               f.elements[n].value = v;\r
+       else\r
+               selectByValue(f, n, v, true, true);\r
+}\r
+\r
+function setupBox(f, ce, fp, pr, sf, b) {\r
+       if (typeof(b) == "undefined")\r
+               b = ['Top', 'Right', 'Bottom', 'Left'];\r
+\r
+       if (isSame(ce, pr, sf, b)) {\r
+               f.elements[fp + "_same"].checked = true;\r
+\r
+               setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));\r
+               f.elements[fp + "_top"].disabled = false;\r
+\r
+               f.elements[fp + "_right"].value = "";\r
+               f.elements[fp + "_right"].disabled = true;\r
+               f.elements[fp + "_bottom"].value = "";\r
+               f.elements[fp + "_bottom"].disabled = true;\r
+               f.elements[fp + "_left"].value = "";\r
+               f.elements[fp + "_left"].disabled = true;\r
+\r
+               if (f.elements[fp + "_top_measurement"]) {\r
+                       selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));\r
+                       f.elements[fp + "_left_measurement"].disabled = true;\r
+                       f.elements[fp + "_bottom_measurement"].disabled = true;\r
+                       f.elements[fp + "_right_measurement"].disabled = true;\r
+               }\r
+       } else {\r
+               f.elements[fp + "_same"].checked = false;\r
+\r
+               setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));\r
+               f.elements[fp + "_top"].disabled = false;\r
+\r
+               setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf]));\r
+               f.elements[fp + "_right"].disabled = false;\r
+\r
+               setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf]));\r
+               f.elements[fp + "_bottom"].disabled = false;\r
+\r
+               setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf]));\r
+               f.elements[fp + "_left"].disabled = false;\r
+\r
+               if (f.elements[fp + "_top_measurement"]) {\r
+                       selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));\r
+                       selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf]));\r
+                       selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf]));\r
+                       selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf]));\r
+                       f.elements[fp + "_left_measurement"].disabled = false;\r
+                       f.elements[fp + "_bottom_measurement"].disabled = false;\r
+                       f.elements[fp + "_right_measurement"].disabled = false;\r
+               }\r
+       }\r
+}\r
+\r
+function isSame(e, pr, sf, b) {\r
+       var a = [], i, x;\r
+\r
+       if (typeof(b) == "undefined")\r
+               b = ['Top', 'Right', 'Bottom', 'Left'];\r
+\r
+       if (typeof(sf) == "undefined" || sf == null)\r
+               sf = "";\r
+\r
+       a[0] = e.style[pr + b[0] + sf];\r
+       a[1] = e.style[pr + b[1] + sf];\r
+       a[2] = e.style[pr + b[2] + sf];\r
+       a[3] = e.style[pr + b[3] + sf];\r
+\r
+       for (i=0; i<a.length; i++) {\r
+               if (a[i] == null)\r
+                       return false;\r
+\r
+               for (x=0; x<a.length; x++) {\r
+                       if (a[x] != a[i])\r
+                               return false;\r
+               }\r
+       }\r
+\r
+       return true;\r
+};\r
+\r
+function hasEqualValues(a) {\r
+       var i, x;\r
+\r
+       for (i=0; i<a.length; i++) {\r
+               if (a[i] == null)\r
+                       return false;\r
+\r
+               for (x=0; x<a.length; x++) {\r
+                       if (a[x] != a[i])\r
+                               return false;\r
+               }\r
+       }\r
+\r
+       return true;\r
+}\r
+\r
+function toggleApplyAction() {\r
+       applyActionIsInsert = ! applyActionIsInsert;\r
+}\r
+\r
+function applyAction() {\r
+       var ce = document.getElementById('container'), ed = tinyMCEPopup.editor;\r
+\r
+       generateCSS();\r
+\r
+       tinyMCEPopup.restoreSelection();\r
+\r
+       var newStyles = tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText);\r
+\r
+       if (applyActionIsInsert) {\r
+               ed.formatter.register('plugin_style', {\r
+                       inline: 'span', styles: existingStyles\r
+               });\r
+               ed.formatter.remove('plugin_style');\r
+\r
+               ed.formatter.register('plugin_style', {\r
+                       inline: 'span', styles: newStyles\r
+               });\r
+               ed.formatter.apply('plugin_style');\r
+       } else {\r
+               var nodes;\r
+\r
+               if (tinyMCEPopup.getWindowArg('applyStyleToBlocks')) {\r
+                       nodes = ed.selection.getSelectedBlocks();\r
+               }\r
+               else {\r
+                       nodes = ed.selection.getNode();\r
+               }\r
+\r
+               ed.dom.setAttrib(nodes, 'style', tinyMCEPopup.editor.dom.serializeStyle(newStyles));\r
+       }\r
+}\r
+\r
+function updateAction() {\r
+       applyAction();\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function generateCSS() {\r
+       var ce = document.getElementById('container'), f = document.forms[0], num = new RegExp('[0-9]+', 'g'), s, t;\r
+\r
+       ce.style.cssText = "";\r
+\r
+       // Build text styles\r
+       ce.style.fontFamily = f.text_font.value;\r
+       ce.style.fontSize = f.text_size.value + (isNum(f.text_size.value) ? (f.text_size_measurement.value || 'px') : "");\r
+       ce.style.fontStyle = f.text_style.value;\r
+       ce.style.lineHeight = f.text_lineheight.value + (isNum(f.text_lineheight.value) ? f.text_lineheight_measurement.value : "");\r
+       ce.style.textTransform = f.text_case.value;\r
+       ce.style.fontWeight = f.text_weight.value;\r
+       ce.style.fontVariant = f.text_variant.value;\r
+       ce.style.color = f.text_color.value;\r
+\r
+       s = "";\r
+       s += f.text_underline.checked ? " underline" : "";\r
+       s += f.text_overline.checked ? " overline" : "";\r
+       s += f.text_linethrough.checked ? " line-through" : "";\r
+       s += f.text_blink.checked ? " blink" : "";\r
+       s = s.length > 0 ? s.substring(1) : s;\r
+\r
+       if (f.text_none.checked)\r
+               s = "none";\r
+\r
+       ce.style.textDecoration = s;\r
+\r
+       // Build background styles\r
+\r
+       ce.style.backgroundColor = f.background_color.value;\r
+       ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : "";\r
+       ce.style.backgroundRepeat = f.background_repeat.value;\r
+       ce.style.backgroundAttachment = f.background_attachment.value;\r
+\r
+       if (f.background_hpos.value != "") {\r
+               s = "";\r
+               s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " ";\r
+               s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : "");\r
+               ce.style.backgroundPosition = s;\r
+       }\r
+\r
+       // Build block styles\r
+\r
+       ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : "");\r
+       ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : "");\r
+       ce.style.verticalAlign = f.block_vertical_alignment.value;\r
+       ce.style.textAlign = f.block_text_align.value;\r
+       ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : "");\r
+       ce.style.whiteSpace = f.block_whitespace.value;\r
+       ce.style.display = f.block_display.value;\r
+\r
+       // Build box styles\r
+\r
+       ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : "");\r
+       ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : "");\r
+       ce.style.styleFloat = f.box_float.value;\r
+       ce.style.cssFloat = f.box_float.value;\r
+\r
+       ce.style.clear = f.box_clear.value;\r
+\r
+       if (!f.box_padding_same.checked) {\r
+               ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");\r
+               ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : "");\r
+               ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : "");\r
+               ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : "");\r
+       } else\r
+               ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");               \r
+\r
+       if (!f.box_margin_same.checked) {\r
+               ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");\r
+               ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : "");\r
+               ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : "");\r
+               ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : "");\r
+       } else\r
+               ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");           \r
+\r
+       // Build border styles\r
+\r
+       if (!f.border_style_same.checked) {\r
+               ce.style.borderTopStyle = f.border_style_top.value;\r
+               ce.style.borderRightStyle = f.border_style_right.value;\r
+               ce.style.borderBottomStyle = f.border_style_bottom.value;\r
+               ce.style.borderLeftStyle = f.border_style_left.value;\r
+       } else\r
+               ce.style.borderStyle = f.border_style_top.value;\r
+\r
+       if (!f.border_width_same.checked) {\r
+               ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : "");\r
+               ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : "");\r
+               ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : "");\r
+               ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : "");\r
+       } else\r
+               ce.style.borderWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : "");\r
+\r
+       if (!f.border_color_same.checked) {\r
+               ce.style.borderTopColor = f.border_color_top.value;\r
+               ce.style.borderRightColor = f.border_color_right.value;\r
+               ce.style.borderBottomColor = f.border_color_bottom.value;\r
+               ce.style.borderLeftColor = f.border_color_left.value;\r
+       } else\r
+               ce.style.borderColor = f.border_color_top.value;\r
+\r
+       // Build list styles\r
+\r
+       ce.style.listStyleType = f.list_type.value;\r
+       ce.style.listStylePosition = f.list_position.value;\r
+       ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : "";\r
+\r
+       // Build positioning styles\r
+\r
+       ce.style.position = f.positioning_type.value;\r
+       ce.style.visibility = f.positioning_visibility.value;\r
+\r
+       if (ce.style.width == "")\r
+               ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : "");\r
+\r
+       if (ce.style.height == "")\r
+               ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : "");\r
+\r
+       ce.style.zIndex = f.positioning_zindex.value;\r
+       ce.style.overflow = f.positioning_overflow.value;\r
+\r
+       if (!f.positioning_placement_same.checked) {\r
+               ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");\r
+               ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : "");\r
+               ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : "");\r
+               ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : "");\r
+       } else {\r
+               s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");\r
+               ce.style.top = s;\r
+               ce.style.right = s;\r
+               ce.style.bottom = s;\r
+               ce.style.left = s;\r
+       }\r
+\r
+       if (!f.positioning_clip_same.checked) {\r
+               s = "rect(";\r
+               s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " ";\r
+               s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " ";\r
+               s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " ";\r
+               s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto");\r
+               s += ")";\r
+\r
+               if (s != "rect(auto auto auto auto)")\r
+                       ce.style.clip = s;\r
+       } else {\r
+               s = "rect(";\r
+               t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto";\r
+               s += t + " ";\r
+               s += t + " ";\r
+               s += t + " ";\r
+               s += t + ")";\r
+\r
+               if (s != "rect(auto auto auto auto)")\r
+                       ce.style.clip = s;\r
+       }\r
+\r
+       ce.style.cssText = ce.style.cssText;\r
+}\r
+\r
+function isNum(s) {\r
+       return new RegExp('[0-9]+', 'g').test(s);\r
+}\r
+\r
+function showDisabledControls() {\r
+       var f = document.forms, i, a;\r
+\r
+       for (i=0; i<f.length; i++) {\r
+               for (a=0; a<f[i].elements.length; a++) {\r
+                       if (f[i].elements[a].disabled)\r
+                               tinyMCEPopup.editor.dom.addClass(f[i].elements[a], "disabled");\r
+                       else\r
+                               tinyMCEPopup.editor.dom.removeClass(f[i].elements[a], "disabled");\r
+               }\r
+       }\r
+}\r
+\r
+function fillSelect(f, s, param, dval, sep, em) {\r
+       var i, ar, p, se;\r
+\r
+       f = document.forms[f];\r
+       sep = typeof(sep) == "undefined" ? ";" : sep;\r
+\r
+       if (em)\r
+               addSelectValue(f, s, "", "");\r
+\r
+       ar = tinyMCEPopup.getParam(param, dval).split(sep);\r
+       for (i=0; i<ar.length; i++) {\r
+               se = false;\r
+\r
+               if (ar[i].charAt(0) == '+') {\r
+                       ar[i] = ar[i].substring(1);\r
+                       se = true;\r
+               }\r
+\r
+               p = ar[i].split('=');\r
+\r
+               if (p.length > 1) {\r
+                       addSelectValue(f, s, p[0], p[1]);\r
+\r
+                       if (se)\r
+                               selectByValue(f, s, p[1]);\r
+               } else {\r
+                       addSelectValue(f, s, p[0], p[0]);\r
+\r
+                       if (se)\r
+                               selectByValue(f, s, p[0]);\r
+               }\r
+       }\r
+}\r
+\r
+function toggleSame(ce, pre) {\r
+       var el = document.forms[0].elements, i;\r
+\r
+       if (ce.checked) {\r
+               el[pre + "_top"].disabled = false;\r
+               el[pre + "_right"].disabled = true;\r
+               el[pre + "_bottom"].disabled = true;\r
+               el[pre + "_left"].disabled = true;\r
+\r
+               if (el[pre + "_top_measurement"]) {\r
+                       el[pre + "_top_measurement"].disabled = false;\r
+                       el[pre + "_right_measurement"].disabled = true;\r
+                       el[pre + "_bottom_measurement"].disabled = true;\r
+                       el[pre + "_left_measurement"].disabled = true;\r
+               }\r
+       } else {\r
+               el[pre + "_top"].disabled = false;\r
+               el[pre + "_right"].disabled = false;\r
+               el[pre + "_bottom"].disabled = false;\r
+               el[pre + "_left"].disabled = false;\r
+\r
+               if (el[pre + "_top_measurement"]) {\r
+                       el[pre + "_top_measurement"].disabled = false;\r
+                       el[pre + "_right_measurement"].disabled = false;\r
+                       el[pre + "_bottom_measurement"].disabled = false;\r
+                       el[pre + "_left_measurement"].disabled = false;\r
+               }\r
+       }\r
+\r
+       showDisabledControls();\r
+}\r
+\r
+function synch(fr, to) {\r
+       var f = document.forms[0];\r
+\r
+       f.elements[to].value = f.elements[fr].value;\r
+\r
+       if (f.elements[fr + "_measurement"])\r
+               selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value);\r
+}\r
+\r
+function updateTextDecorations(){\r
+       var el = document.forms[0].elements;\r
+\r
+       var textDecorations = ["text_underline", "text_overline", "text_linethrough", "text_blink"];\r
+       var noneChecked = el["text_none"].checked;\r
+       tinymce.each(textDecorations, function(id) {\r
+               el[id].disabled = noneChecked;\r
+               if (noneChecked) {\r
+                       el[id].checked = false;\r
+               }\r
+       });\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/style/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..35881b3
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",toggle_insert_span:"Insert span at selection",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"});
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/props.htm b/3.x/src/resources/javascript/TinyMCE/plugins/style/props.htm
new file mode 100644 (file)
index 0000000..7dc087a
--- /dev/null
@@ -0,0 +1,845 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+       <title>{#style_dlg.title}</title>
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>
+       <script type="text/javascript" src="js/props.js"></script>
+       <link href="css/props.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body id="styleprops" style="display: none" role="application" aria-labelledby="app_title">
+<span id="app_title" style="display:none">{#style_dlg.title}</span>
+<form onsubmit="updateAction();return false;" action="#">
+<div class="tabs">
+       <ul>
+               <li id="text_tab" class="current" aria-controls="text_panel"><span><a href="javascript:mcTabs.displayTab('text_tab','text_panel');" onMouseDown="return false;">{#style_dlg.text_tab}</a></span></li>
+               <li id="background_tab" aria-controls="background_panel"><span><a href="javascript:mcTabs.displayTab('background_tab','background_panel');" onMouseDown="return false;">{#style_dlg.background_tab}</a></span></li>
+               <li id="block_tab" aria-controls="block_panel"><span><a href="javascript:mcTabs.displayTab('block_tab','block_panel');" onMouseDown="return false;">{#style_dlg.block_tab}</a></span></li>
+               <li id="box_tab" aria-controls="box_panel"><span><a href="javascript:mcTabs.displayTab('box_tab','box_panel');" onMouseDown="return false;">{#style_dlg.box_tab}</a></span></li>
+               <li id="border_tab" aria-controls="border_panel"><span><a href="javascript:mcTabs.displayTab('border_tab','border_panel');" onMouseDown="return false;">{#style_dlg.border_tab}</a></span></li>
+               <li id="list_tab" aria-controls="list_panel"><span><a href="javascript:mcTabs.displayTab('list_tab','list_panel');" onMouseDown="return false;">{#style_dlg.list_tab}</a></span></li>
+               <li id="positioning_tab" aria-controls="positioning_panel"><span><a href="javascript:mcTabs.displayTab('positioning_tab','positioning_panel');" onMouseDown="return false;">{#style_dlg.positioning_tab}</a></span></li>
+       </ul>
+</div>
+
+<div class="panel_wrapper">
+<div id="text_panel" class="panel current">
+       <fieldset>
+               <legend>{#style_dlg.text}</legend>
+               <table role="presentation" border="0" width="100%">
+                       <tr>
+                               <td><label for="text_font">{#style_dlg.text_font}</label></td>
+                               <td colspan="3">
+                                       <select id="text_font" name="text_font" class="mceEditableSelect mceFocus"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_size">{#style_dlg.text_size}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="text_size" name="text_size" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="text_size_measurement_label" for="text_size_measurement" style="display: none; visibility: hidden;">Text Size Measurement Unit</label>
+                                                               <select id="text_size_measurement" name="text_size_measurement" aria-labelledby="text_size_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td><label for="text_weight">{#style_dlg.text_weight}</label></td>
+                               <td>
+                                       <select id="text_weight" name="text_weight"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_style">{#style_dlg.text_style}</label></td>
+                               <td>
+                                       <select id="text_style" name="text_style" class="mceEditableSelect"></select>
+                               </td>
+                               <td><label for="text_variant">{#style_dlg.text_variant}</label></td>
+                               <td>
+                                       <select id="text_variant" name="text_variant"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_lineheight">{#style_dlg.text_lineheight}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td>
+                                                               <select id="text_lineheight" name="text_lineheight" class="mceEditableSelect"></select>
+                                                       </td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="text_lineheight_measurement_label" for="text_lineheight_measurement" style="display: none; visibility: hidden;">Line Height Measurement Unit</label>
+                                                               <select id="text_lineheight_measurement" name="text_lineheight_measurement" aria-labelledby="text_lineheight_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td><label for="text_case">{#style_dlg.text_case}</label></td>
+                               <td>
+                                       <select id="text_case" name="text_case"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_color">{#style_dlg.text_color}</label></td>
+                               <td colspan="2">
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                               <tr>
+                                                       <td><input id="text_color" name="text_color" type="text" value="" size="9" onChange="updateColor('text_color_pick','text_color');" /></td>
+                                                       <td id="text_color_pickcontainer">&nbsp;</td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top" style="vertical-align: top; padding-top: 3px;">{#style_dlg.text_decoration}</td>
+                               <td colspan="2">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input id="text_underline" name="text_underline" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_underline">{#style_dlg.text_underline}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_overline" name="text_overline" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_overline">{#style_dlg.text_overline}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_linethrough" name="text_linethrough" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_linethrough">{#style_dlg.text_striketrough}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_blink" name="text_blink" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_blink">{#style_dlg.text_blink}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_none" name="text_none" class="checkbox" type="checkbox" onclick="updateTextDecorations();"/></td>
+                                                       <td><label for="text_none">{#style_dlg.text_none}</label></td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+
+<div id="background_panel" class="panel">
+       <fieldset>
+               <legend>{#style_dlg.background}</legend>
+               <table role="presentation" border="0">
+                       <tr>
+                               <td><label for="background_color">{#style_dlg.background_color}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                               <tr>
+                                                       <td><input id="background_color" name="background_color" type="text" value="" size="9" onChange="updateColor('background_color_pick','background_color');" /></td>
+                                                       <td id="background_color_pickcontainer">&nbsp;</td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="background_image">{#style_dlg.background_image}</label></td>
+                               <td><table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr> 
+                                               <td><input id="background_image" name="background_image" type="text" /></td> 
+                                               <td id="background_image_browser">&nbsp;</td>
+                                       </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="background_repeat">{#style_dlg.background_repeat}</label></td>
+                               <td><select id="background_repeat" name="background_repeat" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="background_attachment">{#style_dlg.background_attachment}</label></td>
+                               <td><select id="background_attachment" name="background_attachment" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="background_hpos">{#style_dlg.background_hpos}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="background_hpos" name="background_hpos" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="background_hpos_measurement_label" for="background_hpos_measurement" style="display: none; visibility: hidden;">Horizontal position measurement unit</label>
+                                                               <select id="background_hpos_measurement" name="background_hpos_measurement" aria-labelledby="background_hpos_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="background_vpos">{#style_dlg.background_vpos}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="background_vpos" name="background_vpos" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+
+                                                               <label id="background_vpos_measurement_label" for="background_vpos_measurement" style="display: none; visibility: hidden;">Vertical position measurement unit</label>
+                                                               <select id="background_vpos_measurement" name="background_vpos_measurement" aria-labelledby="background_vpos_measurement_label">></select></td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+
+<div id="block_panel" class="panel">
+       <fieldset>
+               <legend>{#style_dlg.block}</legend>
+               <table role="presentation" border="0">
+                       <tr>
+                               <td><label for="block_wordspacing">{#style_dlg.block_wordspacing}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="block_wordspacing" name="block_wordspacing" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="block_wordspacing_measurement_label" for="block_wordspacing_measurement" style="display: none; visibility: hidden;">Word spacing measurement unit</label>
+                                                               <select id="block_wordspacing_measurement" name="block_wordspacing_measurement" aria-labelledby="block_wordspacing_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_letterspacing">{#style_dlg.block_letterspacing}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="block_letterspacing" name="block_letterspacing" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="block_letterspacing_measurement_label" for="block_letterspacing_measurement" style="display: none; visibility: hidden;">Letter spacing measurement unit</label>
+                                                               <select id="block_letterspacing_measurement" name="block_letterspacing_measurement" aria-labelledby="block_letterspacing_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_vertical_alignment">{#style_dlg.block_vertical_alignment}</label></td>
+                               <td><select id="block_vertical_alignment" name="block_vertical_alignment" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_text_align">{#style_dlg.block_text_align}</label></td>
+                               <td><select id="block_text_align" name="block_text_align" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_text_indent">{#style_dlg.block_text_indent}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="block_text_indent" name="block_text_indent" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="block_text_indent_measurement_label" for="block_text_indent_measurement" style="display: none; visibility: hidden;">Text Indent Measurement Unit</label>
+
+                                                               <select id="block_text_indent_measurement" name="block_text_indent_measurement" aria-labelledby="block_text_indent_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_whitespace">{#style_dlg.block_whitespace}</label></td>
+                               <td><select id="block_whitespace" name="block_whitespace" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_display">{#style_dlg.block_display}</label></td>
+                               <td><select id="block_display" name="block_display" class="mceEditableSelect"></select></td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+
+<div id="box_panel" class="panel">
+       <fieldset>
+               <legend>{#style_dlg.box}</legend>
+               <table role="presentation" border="0">
+                       <tr>
+                               <td><label for="box_width">{#style_dlg.box_width}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_width" name="box_width" class="mceEditableSelect" onChange="synch('box_width','positioning_width');" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_width_measurement_label" for="box_width_measurement" style="display: none; visibility: hidden;">Box Width Measurement Unit</label>
+                                                               <select id="box_width_measurement" name="box_width_measurement" aria-labelledby="box_width_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td>&nbsp;&nbsp;&nbsp;<label for="box_float">{#style_dlg.box_float}</label></td>
+                               <td><select id="box_float" name="box_float" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="box_height">{#style_dlg.box_height}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_height" name="box_height" class="mceEditableSelect" onChange="synch('box_height','positioning_height');" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_height_measurement_label" for="box_height_measurement" style="display: none; visibility: hidden;">Box Height Measurement Unit</label>
+                                                               <select id="box_height_measurement" name="box_height_measurement" aria-labelledby="box_height_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td>&nbsp;&nbsp;&nbsp;<label for="box_clear">{#style_dlg.box_clear}</label></td>
+                               <td><select id="box_clear" name="box_clear" class="mceEditableSelect"></select></td>
+                       </tr>
+               </table>
+       </fieldset>
+
+<div style="float: left; width: 49%">
+       <fieldset>
+               <legend>{#style_dlg.padding}</legend>
+
+               <table role="presentation" border="0">
+                       <tr>
+                               <td>&nbsp;</td>
+                               <td><input type="checkbox" id="box_padding_same" name="box_padding_same" class="checkbox" checked="checked" onClick="toggleSame(this,'box_padding');" /> <label for="box_padding_same">{#style_dlg.same}</label></td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_padding_top">{#style_dlg.top}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_padding_top" name="box_padding_top" class="mceEditableSelect" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_padding_top_measurement_label" for="box_padding_top_measurement" style="display: none; visibility: hidden;">Padding Top Measurement Unit</label>
+                                                               <select id="box_padding_top_measurement" name="box_padding_top_measurement" aria-labelledby="box_padding_top_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_padding_right">{#style_dlg.right}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_padding_right" name="box_padding_right" class="mceEditableSelect" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_padding_right_measurement_label" for="box_padding_right_measurement" style="display: none; visibility: hidden;">Padding Right Measurement Unit</label>
+                                                               <select id="box_padding_right_measurement" name="box_padding_right_measurement" disabled="disabled" aria-labelledby="box_padding_right_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_padding_bottom">{#style_dlg.bottom}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_padding_bottom" name="box_padding_bottom" class="mceEditableSelect" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_padding_bottom_measurement_label" for="box_padding_bottom_measurement" style="display: none; visibility: hidden;">Padding Bottom Measurement Unit</label>
+                                                               <select id="box_padding_bottom_measurement" name="box_padding_bottom_measurement" disabled="disabled" aria-labelledby="box_padding_bottom_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_padding_left">{#style_dlg.left}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_padding_left" name="box_padding_left" class="mceEditableSelect" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_padding_left_measurement_label" for="box_padding_left_measurement" style="display: none; visibility: hidden;">Padding Left Measurement Unit</label>
+                                                               <select id="box_padding_left_measurement" name="box_padding_left_measurement" disabled="disabled" aria-labelledby="box_padding_left_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+
+<div style="float: right; width: 49%">
+       <fieldset>
+               <legend>{#style_dlg.margin}</legend>
+
+               <table role="presentation" border="0">
+                       <tr>
+                               <td>&nbsp;</td>
+                               <td><input type="checkbox" id="box_margin_same" name="box_margin_same" class="checkbox" checked="checked" onClick="toggleSame(this,'box_margin');" /> <label for="box_margin_same">{#style_dlg.same}</label></td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_margin_top">{#style_dlg.top}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_margin_top" name="box_margin_top" class="mceEditableSelect" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_margin_top_measurement_label" for="box_margin_top_measurement" style="display: none; visibility: hidden;">Margin Top Measurement Unit</label>
+                                                               <select id="box_margin_top_measurement" name="box_margin_top_measurement" aria-labelledby="box_margin_top_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_margin_right">{#style_dlg.right}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_margin_right" name="box_margin_right" class="mceEditableSelect" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_margin_right_measurement_label" for="box_margin_right_measurement" style="display: none; visibility: hidden;">Margin Right Measurement Unit</label>
+                                                               <select id="box_margin_right_measurement" name="box_margin_right_measurement" disabled="disabled" aria-labelledby="box_margin_right_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_margin_bottom">{#style_dlg.bottom}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_margin_bottom" name="box_margin_bottom" class="mceEditableSelect" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_margin_bottom_measurement_label" for="box_margin_bottom_measurement" style="display: none; visibility: hidden;">Margin Bottom Measurement Unit</label>
+                                                               <select id="box_margin_bottom_measurement" name="box_margin_bottom_measurement" disabled="disabled" aria-labelledby="box_margin_bottom_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="box_margin_left">{#style_dlg.left}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_margin_left" name="box_margin_left" class="mceEditableSelect" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_margin_left_measurement_label" for="box_margin_left_measurement" style="display: none; visibility: hidden;">Margin Left Measurement Unit</label>
+                                                               <select id="box_margin_left_measurement" name="box_margin_left_measurement" disabled="disabled" aria-labelledby="box_margin_left_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+<br style="clear: both" />
+</div>
+
+<div id="border_panel" class="panel">
+       <fieldset>
+               <legend>{#style_dlg.border}</legend>    
+               <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="100%">
+               <tr>
+                       <td class="tdelim">&nbsp;</td>
+                       <td class="tdelim delim">&nbsp;</td>
+                       <td class="tdelim">{#style_dlg.style}</td>
+                       <td class="tdelim delim">&nbsp;</td>
+                       <td class="tdelim">{#style_dlg.width}</td>
+                       <td class="tdelim delim">&nbsp;</td>
+                       <td class="tdelim">{#style_dlg.color}</td>
+               </tr>
+
+               <tr>
+                       <td>&nbsp;</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><input type="checkbox" id="border_style_same" name="border_style_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_style');" /> <label for="border_style_same">{#style_dlg.same}</label></td>
+                       <td class="delim">&nbsp;</td>
+                       <td><input type="checkbox" id="border_width_same" name="border_width_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_width');" /> <label for="border_width_same">{#style_dlg.same}</label></td>
+                       <td class="delim">&nbsp;</td>
+                       <td><input type="checkbox" id="border_color_same" name="border_color_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_color');" /> <label for="border_color_same">{#style_dlg.same}</label></td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.top}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_top" name="border_style_top" class="mceEditableSelect"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_top" name="border_width_top" class="mceEditableSelect"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_top_measurement_label" for="border_width_top_measurement" style="display: none; visibility: hidden;">Width top Measurement Unit</label>
+                                                       <select id="border_width_top_measurement" name="border_width_top_measurement" aria-labelledby="border_width_top_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_top" name="border_color_top" type="text" value="" size="9" onChange="updateColor('border_color_top_pick','border_color_top');" /></td>
+                                               <td id="border_color_top_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.right}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_right" name="border_style_right" class="mceEditableSelect" disabled="disabled"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_right" name="border_width_right" class="mceEditableSelect" disabled="disabled"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_right_measurement_label" for="border_width_right_measurement" style="display: none; visibility: hidden;">Width Right Measurement Unit</label>
+                                                       <select id="border_width_right_measurement" name="border_width_right_measurement" disabled="disabled" aria-labelledby="border_width_right_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_right" name="border_color_right" type="text" value="" size="9" onChange="updateColor('border_color_right_pick','border_color_right');" disabled="disabled" /></td>
+                                               <td id="border_color_right_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.bottom}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_bottom" name="border_style_bottom" class="mceEditableSelect" disabled="disabled"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_bottom" name="border_width_bottom" class="mceEditableSelect" disabled="disabled"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_bottom_measurement_label" for="border_width_bottom_measurement" style="display: none; visibility: hidden;">Width Bottom Measurement Unit</label>
+                                                       <select id="border_width_bottom_measurement" name="border_width_bottom_measurement" disabled="disabled" aria-labelledby="border_width_bottom_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_bottom" name="border_color_bottom" type="text" value="" size="9" onChange="updateColor('border_color_bottom_pick','border_color_bottom');" disabled="disabled" /></td>
+                                               <td id="border_color_bottom_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.left}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_left" name="border_style_left" class="mceEditableSelect" disabled="disabled"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_left" name="border_width_left" class="mceEditableSelect" disabled="disabled"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_left_measurement_label" for="border_width_left_measurement" style="display: none; visibility: hidden;">Width Left Measurement Unit</label>
+                                                       <select id="border_width_left_measurement" name="border_width_left_measurement" disabled="disabled" aria-labelledby="border_width_left_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_left" name="border_color_left" type="text" value="" size="9" onChange="updateColor('border_color_left_pick','border_color_left');" disabled="disabled" /></td>
+                                               <td id="border_color_left_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+               </table>
+       </fieldset>
+</div>
+
+<div id="list_panel" class="panel">
+<fieldset>
+       <legend>{#style_dlg.list}</legend>
+       <table role="presentation" border="0">
+               <tr>
+                       <td><label for="list_type">{#style_dlg.list_type}</label></td>
+                       <td><select id="list_type" name="list_type" class="mceEditableSelect"></select></td>
+               </tr>
+
+               <tr>
+                       <td><label for="list_bullet_image">{#style_dlg.bullet_image}</label></td>
+                       <td><input id="list_bullet_image" name="list_bullet_image" type="text" /></td>
+               </tr>
+
+               <tr>
+                       <td><label for="list_position">{#style_dlg.position}</label></td>
+                       <td><select id="list_position" name="list_position" class="mceEditableSelect"></select></td>
+               </tr>
+       </table>
+</fieldset>
+</div>
+
+<div id="positioning_panel" class="panel">
+<fieldset>
+       <legend>{#style_dlg.position}</legend>
+<table role="presentation" border="0">
+       <tr>
+               <td><label for="positioning_type">{#style_dlg.positioning_type}</label></td>
+               <td><select id="positioning_type" name="positioning_type" class="mceEditableSelect"></select></td>
+               <td>&nbsp;&nbsp;&nbsp;<label for="positioning_visibility">{#style_dlg.visibility}</label></td>
+               <td><select id="positioning_visibility" name="positioning_visibility" class="mceEditableSelect"></select></td>
+       </tr>
+
+       <tr>
+               <td><label for="positioning_width">{#style_dlg.width}</label></td>
+               <td>
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                               <tr>
+                                       <td><input type="text" id="positioning_width" name="positioning_width" onChange="synch('positioning_width','box_width');" /></td>
+                                       <td>&nbsp;</td>
+                                       <td>
+                                               <label id="positioning_width_measurement_label" for="positioning_width_measurement" style="display: none; visibility: hidden;">Positioning width Measurement Unit</label>
+                                               <select id="positioning_width_measurement" name="positioning_width_measurement" aria-labelledby="positioning_width_measurement_label"></select>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td>&nbsp;&nbsp;&nbsp;<label for="positioning_zindex">{#style_dlg.zindex}</label></td>
+               <td><input type="text" id="positioning_zindex" name="positioning_zindex" /></td>
+       </tr>
+
+       <tr>
+               <td><label for="positioning_height">{#style_dlg.height}</label></td>
+               <td>
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                               <tr>
+                                       <td><input type="text" id="positioning_height" name="positioning_height" onChange="synch('positioning_height','box_height');" /></td>
+                                       <td>&nbsp;</td>
+                                       <td>
+                                               <label id="positioning_height_measurement_label" for="positioning_height_measurement" style="display: none; visibility: hidden;">Positioning Height Measurement Unit</label>
+                                               <select id="positioning_height_measurement" name="positioning_height_measurement" aria-labelledby="positioning_height_measurement_label"></select>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td>&nbsp;&nbsp;&nbsp;<label for="positioning_overflow">{#style_dlg.overflow}</label></td>
+               <td><select id="positioning_overflow" name="positioning_overflow" class="mceEditableSelect"></select></td>
+       </tr>
+</table>
+</fieldset>
+
+<div style="float: left; width: 49%">
+       <fieldset>
+               <legend>{#style_dlg.placement}</legend>
+
+               <table role="presentation" border="0">
+                       <tr>
+                               <td>&nbsp;</td>
+                               <td><input type="checkbox" id="positioning_placement_same" name="positioning_placement_same" class="checkbox" checked="checked" onClick="toggleSame(this,'positioning_placement');" /> <label for="positioning_placement_same">{#style_dlg.same}</label></td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.top}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_placement_top" name="positioning_placement_top" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_placement_top_measurement_label" for="positioning_placement_top_measurement" style="display: none; visibility: hidden;">Placement Top Measurement Unit</label>
+                                                               <select id="positioning_placement_top_measurement" name="positioning_placement_top_measurement" aria-labelledby="positioning_placement_top_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.right}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_placement_right" name="positioning_placement_right" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_placement_right_measurement_label" for="positioning_placement_right_measurement" style="display: none; visibility: hidden;">Placement Right Measurement Unit</label>
+                                                               <select id="positioning_placement_right_measurement" name="positioning_placement_right_measurement" disabled="disabled" aria-labelledby="positioning_placement_right_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.bottom}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_placement_bottom" name="positioning_placement_bottom" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_placement_bottom_measurement_label" for="positioning_placement_bottom_measurement" style="display: none; visibility: hidden;">Placement Bottom Measurement Unit</label>
+                                                               <select id="positioning_placement_bottom_measurement" name="positioning_placement_bottom_measurement" disabled="disabled" aria-labelledby="positioning_placement_bottom_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.left}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_placement_left" name="positioning_placement_left" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_placement_left_measurement_label" for="positioning_placement_left_measurement" style="display: none; visibility: hidden;">Placement Left Measurement Unit</label>
+                                                               <select id="positioning_placement_left_measurement" name="positioning_placement_left_measurement" disabled="disabled" aria-labelledby="positioning_placement_left_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+
+<div style="float: right; width: 49%">
+       <fieldset>
+               <legend>{#style_dlg.clip}</legend>
+
+               <table role="presentation" border="0">
+                       <tr>
+                               <td>&nbsp;</td>
+                               <td><input type="checkbox" id="positioning_clip_same" name="positioning_clip_same" class="checkbox" checked="checked" onClick="toggleSame(this,'positioning_clip');" /> <label for="positioning_clip_same">{#style_dlg.same}</label></td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.top}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_clip_top" name="positioning_clip_top" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_clip_top_measurement_label" for="positioning_clip_top_measurement" style="display: none; visibility: hidden;">Clip Top Measurement Unit</label>
+                                                               <select id="positioning_clip_top_measurement" name="positioning_clip_top_measurement" aria-labelledby="positioning_clip_top_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.right}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_clip_right" name="positioning_clip_right" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_clip_right_measurement_label" for="positioning_clip_right_measurement" style="display: none; visibility: hidden;">Clip Right Measurement Unit</label>
+                                                               <select id="positioning_clip_right_measurement" name="positioning_clip_right_measurement" disabled="disabled" aria-labelledby="positioning_clip_right_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.bottom}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_clip_bottom" name="positioning_clip_bottom" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_clip_bottom_measurement_label" for="positioning_clip_bottom_measurement" style="display: none; visibility: hidden;">Clip Bottom Measurement Unit</label>
+                                                               <select id="positioning_clip_bottom_measurement" name="positioning_clip_bottom_measurement" disabled="disabled" aria-labelledby="positioning_clip_bottom_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>{#style_dlg.left}</td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="positioning_clip_left" name="positioning_clip_left" disabled="disabled" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="positioning_clip_left_measurement_label" for="positioning_clip_left_measurement" style="display: none; visibility: hidden;">Clip Left Measurement Unit</label>
+                                                               <select id="positioning_clip_left_measurement" name="positioning_clip_left_measurement" disabled="disabled" aria-labelledby="positioning_clip_left_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
+</div>
+<br style="clear: both" />
+</div>
+</div>
+
+<div class="panel_toggle_insert_span">
+       <input type="checkbox" class="checkbox" id="toggle_insert_span" name="toggle_insert_span" onClick="toggleApplyAction();" />
+       <label for="toggle_insert_span">{#style_dlg.toggle_insert_span}</label>
+</div>
+
+<div class="mceActionPanel">
+       <input type="submit" id="insert" name="insert" value="{#update}" />
+       <input type="button" class="button" id="apply" name="apply" value="{#style_dlg.apply}" onClick="applyAction();" />
+       <input type="button" id="cancel" name="cancel" value="{#cancel}" onClick="tinyMCEPopup.close();" />
+</div>
+</form>
+
+<div style="display: none">
+       <div id="container"></div>
+</div>
+
+</body>
+</html>
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/style/readme.txt b/3.x/src/resources/javascript/TinyMCE/plugins/style/readme.txt
new file mode 100644 (file)
index 0000000..5bac302
--- /dev/null
@@ -0,0 +1,19 @@
+Edit CSS Style plug-in notes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Unlike WYSIWYG editor functionality that operates only on the selected text,
+typically by inserting new HTML elements with the specified styles.
+This plug-in operates on the HTML blocks surrounding the selected text.
+No new HTML elements are created.
+
+This plug-in only operates on the surrounding blocks and not the nearest
+parent node.  This means that if a block encapsulates a node,
+e.g <p><span>text</span></p>, then only the styles in the block are
+recognized, not those in the span.
+
+When selecting text that includes multiple blocks at the same level (peers),
+this plug-in accumulates the specified styles in all of the surrounding blocks
+and populates the dialogue checkboxes accordingly.  There is no differentiation
+between styles set in all the blocks versus styles set in some of the blocks.
+
+When the [Update] or [Apply] buttons are pressed, the styles selected in the
+checkboxes are applied to all blocks that surround the selected text.
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/tabfocus/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/tabfocus/editor_plugin.js
new file mode 100644 (file)
index 0000000..2c51291
--- /dev/null
@@ -0,0 +1 @@
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]:not(iframe)");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/tabfocus/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/tabfocus/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..94f4532
--- /dev/null
@@ -0,0 +1,122 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
+
+       tinymce.create('tinymce.plugins.TabFocusPlugin', {
+               init : function(ed, url) {
+                       function tabCancel(ed, e) {
+                               if (e.keyCode === 9)
+                                       return Event.cancel(e);
+                       }
+
+                       function tabHandler(ed, e) {
+                               var x, i, f, el, v;
+
+                               function find(d) {
+                                       el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
+
+                                       function canSelectRecursive(e) {
+                                               return e.nodeName==="BODY" || (e.type != 'hidden' &&
+                                                       !(e.style.display == "none") &&
+                                                       !(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
+                                       }
+                                       function canSelectInOldIe(el) {
+                                               return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
+                                       }
+                                       function isOldIe() {
+                                               return tinymce.isIE6 || tinymce.isIE7;
+                                       }
+                                       function canSelect(el) {
+                                               return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
+                                       }
+
+                                       each(el, function(e, i) {
+                                               if (e.id == ed.id) {
+                                                       x = i;
+                                                       return false;
+                                               }
+                                       });
+                                       if (d > 0) {
+                                               for (i = x + 1; i < el.length; i++) {
+                                                       if (canSelect(el[i]))
+                                                               return el[i];
+                                               }
+                                       } else {
+                                               for (i = x - 1; i >= 0; i--) {
+                                                       if (canSelect(el[i]))
+                                                               return el[i];
+                                               }
+                                       }
+
+                                       return null;
+                               }
+
+                               if (e.keyCode === 9) {
+                                       v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
+
+                                       if (v.length == 1) {
+                                               v[1] = v[0];
+                                               v[0] = ':prev';
+                                       }
+
+                                       // Find element to focus
+                                       if (e.shiftKey) {
+                                               if (v[0] == ':prev')
+                                                       el = find(-1);
+                                               else
+                                                       el = DOM.get(v[0]);
+                                       } else {
+                                               if (v[1] == ':next')
+                                                       el = find(1);
+                                               else
+                                                       el = DOM.get(v[1]);
+                                       }
+
+                                       if (el) {
+                                               if (el.id && (ed = tinymce.get(el.id || el.name)))
+                                                       ed.focus();
+                                               else
+                                                       window.setTimeout(function() {
+                                                               if (!tinymce.isWebKit)
+                                                                       window.focus();
+                                                               el.focus();
+                                                       }, 10);
+
+                                               return Event.cancel(e);
+                                       }
+                               }
+                       }
+
+                       ed.onKeyUp.add(tabCancel);
+
+                       if (tinymce.isGecko) {
+                               ed.onKeyPress.add(tabHandler);
+                               ed.onKeyDown.add(tabCancel);
+                       } else
+                               ed.onKeyDown.add(tabHandler);
+
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'Tabfocus',
+                               author : 'Moxiecode Systems AB',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
+                       };
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
+})();
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/cell.htm b/3.x/src/resources/javascript/TinyMCE/plugins/table/cell.htm
new file mode 100644 (file)
index 0000000..a72a8d6
--- /dev/null
@@ -0,0 +1,180 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#table_dlg.cell_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/cell.js"></script>\r
+       <link href="css/cell.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body id="tablecell" style="display: none" role="application">\r
+       <form onsubmit="updateAction();return false;" action="#">\r
+               <div class="tabs">\r
+                       <ul>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="general_panel" class="panel current">\r
+                               <fieldset>\r
+                                       <legend>{#table_dlg.general_props}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td><label for="align">{#table_dlg.align}</label></td>\r
+                                                       <td>\r
+                                                               <select id="align" name="align" class="mceFocus">\r
+                                                                       <option value="">{#not_set}</option>\r
+                                                                       <option value="center">{#table_dlg.align_middle}</option>\r
+                                                                       <option value="left">{#table_dlg.align_left}</option>\r
+                                                                       <option value="right">{#table_dlg.align_right}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+               \r
+                                                       <td><label for="celltype">{#table_dlg.cell_type}</label></td>\r
+                                                       <td>\r
+                                                               <select id="celltype" name="celltype">\r
+                                                                       <option value="td">{#table_dlg.td}</option>\r
+                                                                       <option value="th">{#table_dlg.th}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="valign">{#table_dlg.valign}</label></td>\r
+                                                       <td>\r
+                                                               <select id="valign" name="valign">\r
+                                                                       <option value="">{#not_set}</option>\r
+                                                                       <option value="top">{#table_dlg.align_top}</option>\r
+                                                                       <option value="middle">{#table_dlg.align_middle}</option>\r
+                                                                       <option value="bottom">{#table_dlg.align_bottom}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="scope">{#table_dlg.scope}</label></td>\r
+                                                       <td>\r
+                                                               <select id="scope" name="scope">\r
+                                                                       <option value="">{#not_set}</option>\r
+                                                                       <option value="col">{#table.col}</option>\r
+                                                                       <option value="row">{#table.row}</option>\r
+                                                                       <option value="rowgroup">{#table_dlg.rowgroup}</option>\r
+                                                                       <option value="colgroup">{#table_dlg.colgroup}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="width">{#table_dlg.width}</label></td>\r
+                                                       <td><input id="width" name="width" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+\r
+                                                       <td><label for="height">{#table_dlg.height}</label></td>\r
+                                                       <td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr id="styleSelectRow">\r
+                                                       <td><label for="class">{#class_name}</label></td>\r
+                                                       <td colspan="3">\r
+                                                               <select id="class" name="class" class="mceEditableSelect">\r
+                                                                       <option value="" selected="selected">{#not_set}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="advanced_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#table_dlg.advanced_props}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="id">{#table_dlg.id}</label></td> \r
+                                                       <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="style">{#table_dlg.style}</label></td>\r
+                                                       <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> \r
+                                                       <td>\r
+                                                               <select id="dir" name="dir" style="width: 200px"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="ltr">{#table_dlg.ltr}</option> \r
+                                                                               <option value="rtl">{#table_dlg.rtl}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td> \r
+                                                       <td>\r
+                                                               <input id="lang" name="lang" type="text" value="" style="width: 200px" />\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>\r
+                                                                               <td id="backgroundimagebrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr role="group" aria-labelledby="bordercolor_label">\r
+                                                       <td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>\r
+                                                                               <td id="bordercolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr role="group" aria-labelledby="bgcolor_label">\r
+                                                       <td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>\r
+                                                                               <td id="bgcolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <div>\r
+                               <select id="action" name="action">\r
+                                       <option value="cell">{#table_dlg.cell_cell}</option>\r
+                                       <option value="row">{#table_dlg.cell_row}</option>\r
+                                       <option value="col">{#table_dlg.cell_col}</option>\r
+                                       <option value="all">{#table_dlg.cell_all}</option>\r
+                               </select>\r
+                       </div>\r
+\r
+                       <input type="submit" id="insert" name="insert" value="{#update}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/css/cell.css b/3.x/src/resources/javascript/TinyMCE/plugins/table/css/cell.css
new file mode 100644 (file)
index 0000000..a067ecd
--- /dev/null
@@ -0,0 +1,17 @@
+/* CSS file for cell dialog in the table plugin */\r
+\r
+.panel_wrapper div.current {\r
+       height: 200px;\r
+}\r
+\r
+.advfield {\r
+       width: 200px;\r
+}\r
+\r
+#action {\r
+       margin-bottom: 3px;\r
+}\r
+\r
+#class {\r
+       width: 150px;\r
+}
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/css/row.css b/3.x/src/resources/javascript/TinyMCE/plugins/table/css/row.css
new file mode 100644 (file)
index 0000000..1f7755d
--- /dev/null
@@ -0,0 +1,25 @@
+/* CSS file for row dialog in the table plugin */\r
+\r
+.panel_wrapper div.current {\r
+       height: 200px;\r
+}\r
+\r
+.advfield {\r
+       width: 200px;\r
+}\r
+\r
+#action {\r
+       margin-bottom: 3px;\r
+}\r
+\r
+#rowtype,#align,#valign,#class,#height {\r
+       width: 150px;\r
+}\r
+\r
+#height {\r
+       width: 50px;    \r
+}\r
+\r
+.col2 {\r
+       padding-left: 20px;\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/css/table.css b/3.x/src/resources/javascript/TinyMCE/plugins/table/css/table.css
new file mode 100644 (file)
index 0000000..d11c3f6
--- /dev/null
@@ -0,0 +1,13 @@
+/* CSS file for table dialog in the table plugin */\r
+\r
+.panel_wrapper div.current {\r
+       height: 245px;\r
+}\r
+\r
+.advfield {\r
+       width: 200px;\r
+}\r
+\r
+#class {\r
+       width: 150px;\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/editor_plugin.js
new file mode 100644 (file)
index 0000000..23c1a83
--- /dev/null
@@ -0,0 +1 @@
+(function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T<Q+U;T++){if(!g[T]){g[T]=[]}for(S=R;S<R+V;S++){g[T][S]={part:N,real:T==Q&&S==R,elm:W,rowspan:U,colspan:V}}}})});M+=O.length})}function z(M,O){var N;N=g[O];if(N){return N[M]}}function s(O,M,N){if(O){N=parseInt(N);if(N===1){O.removeAttribute(M,1)}else{O.setAttribute(M,N,1)}}}function j(M){return M&&(G.hasClass(M.elm,"mceSelected")||M==o)}function k(){var M=[];e(H.rows,function(N){e(N.cells,function(O){if(G.hasClass(O,"mceSelected")||O==o.elm){M.push(N);return false}})});return M}function r(){var M=G.createRng();M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H)}function f(M){var N;d.walk(M,function(P){var O;if(P.nodeType==3){e(G.getParents(P.parentNode,null,M).reverse(),function(Q){Q=A(Q,false);if(!N){N=O=Q}else{if(O){O.appendChild(Q)}}O=Q});if(O){O.innerHTML=d.isIE?"&nbsp;":'<br data-mce-bogus="1" />'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(f(P),P)}u(O,N,R-1,S)}}})})}function p(V,S,Y){var P,O,X,W,U,R,T,M,V,N,Q;if(V){pos=F(V);P=pos.x;O=pos.y;X=P+(S-1);W=O+(Y-1)}else{L=D=null;e(g,function(Z,aa){e(Z,function(ac,ab){if(j(ac)){if(!L){L={x:ab,y:aa}}D={x:ab,y:aa}}})});P=L.x;O=L.y;X=D.x;W=D.y}T=z(P,O);M=z(X,W);if(T&&M&&T.part==M.part){C();t();T=z(P,O).elm;s(T,"colSpan",(X-P)+1);s(T,"rowSpan",(W-O)+1);for(R=O;R<=W;R++){for(U=P;U<=X;U++){if(!g[R]||!g[R][U]){continue}V=g[R][U].elm;if(V!=T){N=d.grep(V.childNodes);e(N,function(Z){T.appendChild(Z)});if(N.length){N=d.grep(T.childNodes);Q=0;e(N,function(Z){if(Z.nodeName=="BR"&&G.getAttrib(Z,"data-mce-bogus")&&Q++<N.length-1){T.removeChild(Z)}})}G.remove(V)}}}q()}}function l(Q){var M,S,P,R,T,U,N,V,O;e(g,function(W,X){e(W,function(Z,Y){if(j(Z)){Z=Z.elm;T=Z.parentNode;U=A(T,false);M=X;if(Q){return false}}});if(Q){return !M}});for(R=0;R<g[0].length;R++){if(!g[M][R]){continue}S=g[M][R].elm;if(S!=P){if(!Q){O=a(S,"rowspan");if(O>1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;i<S;i++){R=T.cells[i];s(R,"colSpan",1);s(R,"rowSpan",1)}for(i=S;i<Q;i++){T.appendChild(f(T.cells[S-1]))}for(i=Q;i<S;i++){G.remove(T.cells[i])}if(N){M.parentNode.insertBefore(T,M)}else{G.insertAfter(T,M)}});G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected")}function F(M){var N;e(g,function(O,P){e(O,function(R,Q){if(R.elm==M){N={x:Q,y:P};return false}});return !N});return N}function w(M){L=F(M)}function I(){var O,N,M;N=M=0;e(g,function(P,Q){e(P,function(S,R){var U,T;if(j(S)){S=g[Q][R];if(R>N){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=g[O][x];if(!S.real){if(O-(S.rowspan-1)<O){O-=S.rowspan-1}}}for(y=O;y<=T;y++){for(x=P;x<=U;x++){S=g[y][x];if(S.real){Q=S.colspan-1;R=S.rowspan-1;if(Q){if(x+Q>N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD,TH");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(C,N){var L=d.VK;var Q=N.keyCode;function O(Y,U,S){var T=Y?"previousSibling":"nextSibling";var Z=C.dom.getParent(U,"tr");var X=Z[T];if(X){z(C,U,X,Y);d.dom.Event.cancel(S);return true}else{var aa=C.dom.getParent(Z,"table");var W=Z.parentNode;var R=W.nodeName.toLowerCase();if(R==="tbody"||R===(Y?"tfoot":"thead")){var V=w(Y,aa,W,"tbody");if(V!==null){return K(Y,V,U,S)}}return M(Y,Z,T,aa,S)}}function w(V,T,U,X){var S=C.dom.select(">"+X,T);var R=S.indexOf(U);if(V&&R===0||!V&&R===S.length-1){return B(V,T)}else{if(R===-1){var W=U.tagName.toLowerCase()==="thead"?0:S.length-1;return S[W]}else{return S[R+(V?-1:1)]}}}function B(U,T){var S=U?"thead":"tfoot";var R=C.dom.select(">"+S,T);return R.length!==0?R[0]:null}function K(V,T,S,U){var R=J(T,V);R&&z(C,S,R,V);d.dom.Event.cancel(U);return true}function M(Y,U,R,X,W){var S=X[R];if(S){F(S);return true}else{var V=C.dom.getParent(X,"td,th");if(V){return O(Y,V,W)}else{var T=J(U,!Y);F(T);return d.dom.Event.cancel(W)}}}function J(S,R){var T=S&&S[R?"lastChild":"firstChild"];return T&&T.nodeName==="BR"?C.dom.getParent(T,"td,th"):T}function F(R){C.selection.setCursorLocation(R,0)}function A(){return Q==L.UP||Q==L.DOWN}function D(R){var T=R.selection.getNode();var S=R.dom.getParent(T,"tr");return S!==null}function P(S){var R=0;var T=S;while(T.previousSibling){T=T.previousSibling;R=R+a(T,"colspan")}return R}function E(T,R){var U=0;var S=0;e(T.children,function(V,W){U=U+a(V,"colspan");S=W;if(U>R){return false}});return S}function z(T,W,Y,V){var X=P(T.dom.getParent(W,"td,th"));var S=E(Y,X);var R=Y.childNodes[S];var U=J(R,V);F(U||R)}function H(R){var T=C.selection.getNode();var U=C.dom.getParent(T,"td,th");var S=C.dom.getParent(R,"td,th");return U&&U!==S&&I(U,S)}function I(S,R){return C.dom.getParent(S,"TABLE")===C.dom.getParent(R,"TABLE")}if(A()&&D(C)){var G=C.selection.getNode();setTimeout(function(){if(H(G)){O(!N.shiftKey&&Q===L.UP,G,N)}},0)}}r.onKeyDown.add(v)}function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){if(r.settings.forced_root_block){r.dom.add(r.getBody(),r.settings.forced_root_block,null,d.isIE?"&nbsp;":'<br data-mce-bogus="1" />')}else{r.dom.add(r.getBody(),"br",{"data-mce-bogus":"1"})}}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&(z.nodeName=="BR"||(z.childNodes.length==1&&(z.firstChild.nodeName=="BR"||z.firstChild.nodeValue=="\u00a0")))&&z.previousSibling&&z.previousSibling.nodeName=="TABLE"){w.dom.remove(z)}});if(d.isGecko){r.onKeyDown.add(function(z,B){if(B.keyCode===d.VK.ENTER&&B.shiftKey){var A=z.selection.getRng().startContainer;var C=q.getParent(A,"td,th");if(C){var w=z.getDoc().createTextNode("\uFEFF");q.insertAfter(w,A)}}})}s();r.startContent=r.getContent({format:"raw"})});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce);
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..54bab56
--- /dev/null
@@ -0,0 +1,1449 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function(tinymce) {
+       var each = tinymce.each;
+
+       // Checks if the selection/caret is at the start of the specified block element
+       function isAtStart(rng, par) {
+               var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
+
+               rng2.setStartBefore(par);
+               rng2.setEnd(rng.endContainer, rng.endOffset);
+
+               elm = doc.createElement('body');
+               elm.appendChild(rng2.cloneContents());
+
+               // Check for text characters of other elements that should be treated as content
+               return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
+       };
+
+       function getSpanVal(td, name) {
+               return parseInt(td.getAttribute(name) || 1);
+       }
+
+       /**
+        * Table Grid class.
+        */
+       function TableGrid(table, dom, selection) {
+               var grid, startPos, endPos, selectedCell;
+
+               buildGrid();
+               selectedCell = dom.getParent(selection.getStart(), 'th,td');
+               if (selectedCell) {
+                       startPos = getPos(selectedCell);
+                       endPos = findEndPos();
+                       selectedCell = getCell(startPos.x, startPos.y);
+               }
+
+               function cloneNode(node, children) {
+                       node = node.cloneNode(children);
+                       node.removeAttribute('id');
+
+                       return node;
+               }
+
+               function buildGrid() {
+                       var startY = 0;
+
+                       grid = [];
+
+                       each(['thead', 'tbody', 'tfoot'], function(part) {
+                               var rows = dom.select('> ' + part + ' tr', table);
+
+                               each(rows, function(tr, y) {
+                                       y += startY;
+
+                                       each(dom.select('> td, > th', tr), function(td, x) {
+                                               var x2, y2, rowspan, colspan;
+
+                                               // Skip over existing cells produced by rowspan
+                                               if (grid[y]) {
+                                                       while (grid[y][x])
+                                                               x++;
+                                               }
+
+                                               // Get col/rowspan from cell
+                                               rowspan = getSpanVal(td, 'rowspan');
+                                               colspan = getSpanVal(td, 'colspan');
+
+                                               // Fill out rowspan/colspan right and down
+                                               for (y2 = y; y2 < y + rowspan; y2++) {
+                                                       if (!grid[y2])
+                                                               grid[y2] = [];
+
+                                                       for (x2 = x; x2 < x + colspan; x2++) {
+                                                               grid[y2][x2] = {
+                                                                       part : part,
+                                                                       real : y2 == y && x2 == x,
+                                                                       elm : td,
+                                                                       rowspan : rowspan,
+                                                                       colspan : colspan
+                                                               };
+                                                       }
+                                               }
+                                       });
+                               });
+
+                               startY += rows.length;
+                       });
+               };
+
+               function getCell(x, y) {
+                       var row;
+
+                       row = grid[y];
+                       if (row)
+                               return row[x];
+               };
+
+               function setSpanVal(td, name, val) {
+                       if (td) {
+                               val = parseInt(val);
+
+                               if (val === 1)
+                                       td.removeAttribute(name, 1);
+                               else
+                                       td.setAttribute(name, val, 1);
+                       }
+               }
+
+               function isCellSelected(cell) {
+                       return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
+               };
+
+               function getSelectedRows() {
+                       var rows = [];
+
+                       each(table.rows, function(row) {
+                               each(row.cells, function(cell) {
+                                       if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
+                                               rows.push(row);
+                                               return false;
+                                       }
+                               });
+                       });
+
+                       return rows;
+               };
+
+               function deleteTable() {
+                       var rng = dom.createRng();
+
+                       rng.setStartAfter(table);
+                       rng.setEndAfter(table);
+
+                       selection.setRng(rng);
+
+                       dom.remove(table);
+               };
+
+               function cloneCell(cell) {
+                       var formatNode;
+
+                       // Clone formats
+                       tinymce.walk(cell, function(node) {
+                               var curNode;
+
+                               if (node.nodeType == 3) {
+                                       each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
+                                               node = cloneNode(node, false);
+
+                                               if (!formatNode)
+                                                       formatNode = curNode = node;
+                                               else if (curNode)
+                                                       curNode.appendChild(node);
+
+                                               curNode = node;
+                                       });
+
+                                       // Add something to the inner node
+                                       if (curNode)
+                                               curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />';
+
+                                       return false;
+                               }
+                       }, 'childNodes');
+
+                       cell = cloneNode(cell, false);
+                       setSpanVal(cell, 'rowSpan', 1);
+                       setSpanVal(cell, 'colSpan', 1);
+
+                       if (formatNode) {
+                               cell.appendChild(formatNode);
+                       } else {
+                               if (!tinymce.isIE)
+                                       cell.innerHTML = '<br data-mce-bogus="1" />';
+                       }
+
+                       return cell;
+               };
+
+               function cleanup() {
+                       var rng = dom.createRng();
+
+                       // Empty rows
+                       each(dom.select('tr', table), function(tr) {
+                               if (tr.cells.length == 0)
+                                       dom.remove(tr);
+                       });
+
+                       // Empty table
+                       if (dom.select('tr', table).length == 0) {
+                               rng.setStartAfter(table);
+                               rng.setEndAfter(table);
+                               selection.setRng(rng);
+                               dom.remove(table);
+                               return;
+                       }
+
+                       // Empty header/body/footer
+                       each(dom.select('thead,tbody,tfoot', table), function(part) {
+                               if (part.rows.length == 0)
+                                       dom.remove(part);
+                       });
+
+                       // Restore selection to start position if it still exists
+                       buildGrid();
+
+                       // Restore the selection to the closest table position
+                       row = grid[Math.min(grid.length - 1, startPos.y)];
+                       if (row) {
+                               selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
+                               selection.collapse(true);
+                       }
+               };
+
+               function fillLeftDown(x, y, rows, cols) {
+                       var tr, x2, r, c, cell;
+
+                       tr = grid[y][x].elm.parentNode;
+                       for (r = 1; r <= rows; r++) {
+                               tr = dom.getNext(tr, 'tr');
+
+                               if (tr) {
+                                       // Loop left to find real cell
+                                       for (x2 = x; x2 >= 0; x2--) {
+                                               cell = grid[y + r][x2].elm;
+
+                                               if (cell.parentNode == tr) {
+                                                       // Append clones after
+                                                       for (c = 1; c <= cols; c++)
+                                                               dom.insertAfter(cloneCell(cell), cell);
+
+                                                       break;
+                                               }
+                                       }
+
+                                       if (x2 == -1) {
+                                               // Insert nodes before first cell
+                                               for (c = 1; c <= cols; c++)
+                                                       tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
+                                       }
+                               }
+                       }
+               };
+
+               function split() {
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       var colSpan, rowSpan, newCell, i;
+
+                                       if (isCellSelected(cell)) {
+                                               cell = cell.elm;
+                                               colSpan = getSpanVal(cell, 'colspan');
+                                               rowSpan = getSpanVal(cell, 'rowspan');
+
+                                               if (colSpan > 1 || rowSpan > 1) {
+                                                       setSpanVal(cell, 'rowSpan', 1);
+                                                       setSpanVal(cell, 'colSpan', 1);
+
+                                                       // Insert cells right
+                                                       for (i = 0; i < colSpan - 1; i++)
+                                                               dom.insertAfter(cloneCell(cell), cell);
+
+                                                       fillLeftDown(x, y, rowSpan - 1, colSpan);
+                                               }
+                                       }
+                               });
+                       });
+               };
+
+               function merge(cell, cols, rows) {
+                       var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
+
+                       // Use specified cell and cols/rows
+                       if (cell) {
+                               pos = getPos(cell);
+                               startX = pos.x;
+                               startY = pos.y;
+                               endX = startX + (cols - 1);
+                               endY = startY + (rows - 1);
+                       } else {
+                               startPos = endPos = null;
+
+                               // Calculate start/end pos by checking for selected cells in grid works better with context menu
+                               each(grid, function(row, y) {
+                                       each(row, function(cell, x) {
+                                               if (isCellSelected(cell)) {
+                                                       if (!startPos) {
+                                                               startPos = {x: x, y: y};
+                                                       }
+
+                                                       endPos = {x: x, y: y};
+                                               }
+                                       });
+                               });
+
+                               // Use selection
+                               startX = startPos.x;
+                               startY = startPos.y;
+                               endX = endPos.x;
+                               endY = endPos.y;
+                       }
+
+                       // Find start/end cells
+                       startCell = getCell(startX, startY);
+                       endCell = getCell(endX, endY);
+
+                       // Check if the cells exists and if they are of the same part for example tbody = tbody
+                       if (startCell && endCell && startCell.part == endCell.part) {
+                               // Split and rebuild grid
+                               split();
+                               buildGrid();
+
+                               // Set row/col span to start cell
+                               startCell = getCell(startX, startY).elm;
+                               setSpanVal(startCell, 'colSpan', (endX - startX) + 1);
+                               setSpanVal(startCell, 'rowSpan', (endY - startY) + 1);
+
+                               // Remove other cells and add it's contents to the start cell
+                               for (y = startY; y <= endY; y++) {
+                                       for (x = startX; x <= endX; x++) {
+                                               if (!grid[y] || !grid[y][x])
+                                                       continue;
+
+                                               cell = grid[y][x].elm;
+
+                                               if (cell != startCell) {
+                                                       // Move children to startCell
+                                                       children = tinymce.grep(cell.childNodes);
+                                                       each(children, function(node) {
+                                                               startCell.appendChild(node);
+                                                       });
+
+                                                       // Remove bogus nodes if there is children in the target cell
+                                                       if (children.length) {
+                                                               children = tinymce.grep(startCell.childNodes);
+                                                               count = 0;
+                                                               each(children, function(node) {
+                                                                       if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
+                                                                               startCell.removeChild(node);
+                                                               });
+                                                       }
+                                                       
+                                                       // Remove cell
+                                                       dom.remove(cell);
+                                               }
+                                       }
+                               }
+
+                               // Remove empty rows etc and restore caret location
+                               cleanup();
+                       }
+               };
+
+               function insertRow(before) {
+                       var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
+
+                       // Find first/last row
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (isCellSelected(cell)) {
+                                               cell = cell.elm;
+                                               rowElm = cell.parentNode;
+                                               newRow = cloneNode(rowElm, false);
+                                               posY = y;
+
+                                               if (before)
+                                                       return false;
+                                       }
+                               });
+
+                               if (before)
+                                       return !posY;
+                       });
+
+                       for (x = 0; x < grid[0].length; x++) {
+                               // Cell not found could be because of an invalid table structure
+                               if (!grid[posY][x])
+                                       continue;
+
+                               cell = grid[posY][x].elm;
+
+                               if (cell != lastCell) {
+                                       if (!before) {
+                                               rowSpan = getSpanVal(cell, 'rowspan');
+                                               if (rowSpan > 1) {
+                                                       setSpanVal(cell, 'rowSpan', rowSpan + 1);
+                                                       continue;
+                                               }
+                                       } else {
+                                               // Check if cell above can be expanded
+                                               if (posY > 0 && grid[posY - 1][x]) {
+                                                       otherCell = grid[posY - 1][x].elm;
+                                                       rowSpan = getSpanVal(otherCell, 'rowSpan');
+                                                       if (rowSpan > 1) {
+                                                               setSpanVal(otherCell, 'rowSpan', rowSpan + 1);
+                                                               continue;
+                                                       }
+                                               }
+                                       }
+
+                                       // Insert new cell into new row
+                                       newCell = cloneCell(cell);
+                                       setSpanVal(newCell, 'colSpan', cell.colSpan);
+
+                                       newRow.appendChild(newCell);
+
+                                       lastCell = cell;
+                               }
+                       }
+
+                       if (newRow.hasChildNodes()) {
+                               if (!before)
+                                       dom.insertAfter(newRow, rowElm);
+                               else
+                                       rowElm.parentNode.insertBefore(newRow, rowElm);
+                       }
+               };
+
+               function insertCol(before) {
+                       var posX, lastCell;
+
+                       // Find first/last column
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (isCellSelected(cell)) {
+                                               posX = x;
+
+                                               if (before)
+                                                       return false;
+                                       }
+                               });
+
+                               if (before)
+                                       return !posX;
+                       });
+
+                       each(grid, function(row, y) {
+                               var cell, rowSpan, colSpan;
+
+                               if (!row[posX])
+                                       return;
+
+                               cell = row[posX].elm;
+                               if (cell != lastCell) {
+                                       colSpan = getSpanVal(cell, 'colspan');
+                                       rowSpan = getSpanVal(cell, 'rowspan');
+
+                                       if (colSpan == 1) {
+                                               if (!before) {
+                                                       dom.insertAfter(cloneCell(cell), cell);
+                                                       fillLeftDown(posX, y, rowSpan - 1, colSpan);
+                                               } else {
+                                                       cell.parentNode.insertBefore(cloneCell(cell), cell);
+                                                       fillLeftDown(posX, y, rowSpan - 1, colSpan);
+                                               }
+                                       } else
+                                               setSpanVal(cell, 'colSpan', cell.colSpan + 1);
+
+                                       lastCell = cell;
+                               }
+                       });
+               };
+
+               function deleteCols() {
+                       var cols = [];
+
+                       // Get selected column indexes
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
+                                               each(grid, function(row) {
+                                                       var cell = row[x].elm, colSpan;
+
+                                                       colSpan = getSpanVal(cell, 'colSpan');
+
+                                                       if (colSpan > 1)
+                                                               setSpanVal(cell, 'colSpan', colSpan - 1);
+                                                       else
+                                                               dom.remove(cell);
+                                               });
+
+                                               cols.push(x);
+                                       }
+                               });
+                       });
+
+                       cleanup();
+               };
+
+               function deleteRows() {
+                       var rows;
+
+                       function deleteRow(tr) {
+                               var nextTr, pos, lastCell;
+
+                               nextTr = dom.getNext(tr, 'tr');
+
+                               // Move down row spanned cells
+                               each(tr.cells, function(cell) {
+                                       var rowSpan = getSpanVal(cell, 'rowSpan');
+
+                                       if (rowSpan > 1) {
+                                               setSpanVal(cell, 'rowSpan', rowSpan - 1);
+                                               pos = getPos(cell);
+                                               fillLeftDown(pos.x, pos.y, 1, 1);
+                                       }
+                               });
+
+                               // Delete cells
+                               pos = getPos(tr.cells[0]);
+                               each(grid[pos.y], function(cell) {
+                                       var rowSpan;
+
+                                       cell = cell.elm;
+
+                                       if (cell != lastCell) {
+                                               rowSpan = getSpanVal(cell, 'rowSpan');
+
+                                               if (rowSpan <= 1)
+                                                       dom.remove(cell);
+                                               else
+                                                       setSpanVal(cell, 'rowSpan', rowSpan - 1);
+
+                                               lastCell = cell;
+                                       }
+                               });
+                       };
+
+                       // Get selected rows and move selection out of scope
+                       rows = getSelectedRows();
+
+                       // Delete all selected rows
+                       each(rows.reverse(), function(tr) {
+                               deleteRow(tr);
+                       });
+
+                       cleanup();
+               };
+
+               function cutRows() {
+                       var rows = getSelectedRows();
+
+                       dom.remove(rows);
+                       cleanup();
+
+                       return rows;
+               };
+
+               function copyRows() {
+                       var rows = getSelectedRows();
+
+                       each(rows, function(row, i) {
+                               rows[i] = cloneNode(row, true);
+                       });
+
+                       return rows;
+               };
+
+               function pasteRows(rows, before) {
+                       var selectedRows = getSelectedRows(),
+                               targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
+                               targetCellCount = targetRow.cells.length;
+
+                       // Calc target cell count
+                       each(grid, function(row) {
+                               var match;
+
+                               targetCellCount = 0;
+                               each(row, function(cell, x) {
+                                       if (cell.real)
+                                               targetCellCount += cell.colspan;
+
+                                       if (cell.elm.parentNode == targetRow)
+                                               match = 1;
+                               });
+
+                               if (match)
+                                       return false;
+                       });
+
+                       if (!before)
+                               rows.reverse();
+
+                       each(rows, function(row) {
+                               var cellCount = row.cells.length, cell;
+
+                               // Remove col/rowspans
+                               for (i = 0; i < cellCount; i++) {
+                                       cell = row.cells[i];
+                                       setSpanVal(cell, 'colSpan', 1);
+                                       setSpanVal(cell, 'rowSpan', 1);
+                               }
+
+                               // Needs more cells
+                               for (i = cellCount; i < targetCellCount; i++)
+                                       row.appendChild(cloneCell(row.cells[cellCount - 1]));
+
+                               // Needs less cells
+                               for (i = targetCellCount; i < cellCount; i++)
+                                       dom.remove(row.cells[i]);
+
+                               // Add before/after
+                               if (before)
+                                       targetRow.parentNode.insertBefore(row, targetRow);
+                               else
+                                       dom.insertAfter(row, targetRow);
+                       });
+
+                       // Remove current selection
+                       dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+               };
+
+               function getPos(target) {
+                       var pos;
+
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (cell.elm == target) {
+                                               pos = {x : x, y : y};
+                                               return false;
+                                       }
+                               });
+
+                               return !pos;
+                       });
+
+                       return pos;
+               };
+
+               function setStartCell(cell) {
+                       startPos = getPos(cell);
+               };
+
+               function findEndPos() {
+                       var pos, maxX, maxY;
+
+                       maxX = maxY = 0;
+
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       var colSpan, rowSpan;
+
+                                       if (isCellSelected(cell)) {
+                                               cell = grid[y][x];
+
+                                               if (x > maxX)
+                                                       maxX = x;
+
+                                               if (y > maxY)
+                                                       maxY = y;
+
+                                               if (cell.real) {
+                                                       colSpan = cell.colspan - 1;
+                                                       rowSpan = cell.rowspan - 1;
+
+                                                       if (colSpan) {
+                                                               if (x + colSpan > maxX)
+                                                                       maxX = x + colSpan;
+                                                       }
+
+                                                       if (rowSpan) {
+                                                               if (y + rowSpan > maxY)
+                                                                       maxY = y + rowSpan;
+                                                       }
+                                               }
+                                       }
+                               });
+                       });
+
+                       return {x : maxX, y : maxY};
+               };
+
+               function setEndCell(cell) {
+                       var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
+
+                       endPos = getPos(cell);
+
+                       if (startPos && endPos) {
+                               // Get start/end positions
+                               startX = Math.min(startPos.x, endPos.x);
+                               startY = Math.min(startPos.y, endPos.y);
+                               endX = Math.max(startPos.x, endPos.x);
+                               endY = Math.max(startPos.y, endPos.y);
+
+                               // Expand end positon to include spans
+                               maxX = endX;
+                               maxY = endY;
+
+                               // Expand startX
+                               for (y = startY; y <= maxY; y++) {
+                                       cell = grid[y][startX];
+
+                                       if (!cell.real) {
+                                               if (startX - (cell.colspan - 1) < startX)
+                                                       startX -= cell.colspan - 1;
+                                       }
+                               }
+
+                               // Expand startY
+                               for (x = startX; x <= maxX; x++) {
+                                       cell = grid[startY][x];
+
+                                       if (!cell.real) {
+                                               if (startY - (cell.rowspan - 1) < startY)
+                                                       startY -= cell.rowspan - 1;
+                                       }
+                               }
+
+                               // Find max X, Y
+                               for (y = startY; y <= endY; y++) {
+                                       for (x = startX; x <= endX; x++) {
+                                               cell = grid[y][x];
+
+                                               if (cell.real) {
+                                                       colSpan = cell.colspan - 1;
+                                                       rowSpan = cell.rowspan - 1;
+
+                                                       if (colSpan) {
+                                                               if (x + colSpan > maxX)
+                                                                       maxX = x + colSpan;
+                                                       }
+
+                                                       if (rowSpan) {
+                                                               if (y + rowSpan > maxY)
+                                                                       maxY = y + rowSpan;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               // Remove current selection
+                               dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+
+                               // Add new selection
+                               for (y = startY; y <= maxY; y++) {
+                                       for (x = startX; x <= maxX; x++) {
+                                               if (grid[y][x])
+                                                       dom.addClass(grid[y][x].elm, 'mceSelected');
+                                       }
+                               }
+                       }
+               };
+
+               // Expose to public
+               tinymce.extend(this, {
+                       deleteTable : deleteTable,
+                       split : split,
+                       merge : merge,
+                       insertRow : insertRow,
+                       insertCol : insertCol,
+                       deleteCols : deleteCols,
+                       deleteRows : deleteRows,
+                       cutRows : cutRows,
+                       copyRows : copyRows,
+                       pasteRows : pasteRows,
+                       getPos : getPos,
+                       setStartCell : setStartCell,
+                       setEndCell : setEndCell
+               });
+       };
+
+       tinymce.create('tinymce.plugins.TablePlugin', {
+               init : function(ed, url) {
+                       var winMan, clipboardRows, hasCellSelection = true; // Might be selected cells on reload
+
+                       function createTableGrid(node) {
+                               var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
+
+                               if (tblElm)
+                                       return new TableGrid(tblElm, ed.dom, selection);
+                       };
+
+                       function cleanup() {
+                               // Restore selection possibilities
+                               ed.getBody().style.webkitUserSelect = '';
+
+                               if (hasCellSelection) {
+                                       ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+                                       hasCellSelection = false;
+                               }
+                       };
+
+                       // Register buttons
+                       each([
+                               ['table', 'table.desc', 'mceInsertTable', true],
+                               ['delete_table', 'table.del', 'mceTableDelete'],
+                               ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
+                               ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
+                               ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
+                               ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
+                               ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
+                               ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
+                               ['row_props', 'table.row_desc', 'mceTableRowProps', true],
+                               ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
+                               ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
+                               ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
+                       ], function(c) {
+                               ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
+                       });
+
+                       // Select whole table is a table border is clicked
+                       if (!tinymce.isIE) {
+                               ed.onClick.add(function(ed, e) {
+                                       e = e.target;
+
+                                       if (e.nodeName === 'TABLE') {
+                                               ed.selection.select(e);
+                                               ed.nodeChanged();
+                                       }
+                               });
+                       }
+
+                       ed.onPreProcess.add(function(ed, args) {
+                               var nodes, i, node, dom = ed.dom, value;
+
+                               nodes = dom.select('table', args.node);
+                               i = nodes.length;
+                               while (i--) {
+                                       node = nodes[i];
+                                       dom.setAttrib(node, 'data-mce-style', '');
+
+                                       if ((value = dom.getAttrib(node, 'width'))) {
+                                               dom.setStyle(node, 'width', value);
+                                               dom.setAttrib(node, 'width', '');
+                                       }
+
+                                       if ((value = dom.getAttrib(node, 'height'))) {
+                                               dom.setStyle(node, 'height', value);
+                                               dom.setAttrib(node, 'height', '');
+                                       }
+                               }
+                       });
+
+                       // Handle node change updates
+                       ed.onNodeChange.add(function(ed, cm, n) {
+                               var p;
+
+                               n = ed.selection.getStart();
+                               p = ed.dom.getParent(n, 'td,th,caption');
+                               cm.setActive('table', n.nodeName === 'TABLE' || !!p);
+
+                               // Disable table tools if we are in caption
+                               if (p && p.nodeName === 'CAPTION')
+                                       p = 0;
+
+                               cm.setDisabled('delete_table', !p);
+                               cm.setDisabled('delete_col', !p);
+                               cm.setDisabled('delete_table', !p);
+                               cm.setDisabled('delete_row', !p);
+                               cm.setDisabled('col_after', !p);
+                               cm.setDisabled('col_before', !p);
+                               cm.setDisabled('row_after', !p);
+                               cm.setDisabled('row_before', !p);
+                               cm.setDisabled('row_props', !p);
+                               cm.setDisabled('cell_props', !p);
+                               cm.setDisabled('split_cells', !p);
+                               cm.setDisabled('merge_cells', !p);
+                       });
+
+                       ed.onInit.add(function(ed) {
+                               var startTable, startCell, dom = ed.dom, tableGrid;
+
+                               winMan = ed.windowManager;
+
+                               // Add cell selection logic
+                               ed.onMouseDown.add(function(ed, e) {
+                                       if (e.button != 2) {
+                                               cleanup();
+
+                                               startCell = dom.getParent(e.target, 'td,th');
+                                               startTable = dom.getParent(startCell, 'table');
+                                       }
+                               });
+
+                               dom.bind(ed.getDoc(), 'mouseover', function(e) {
+                                       var sel, table, target = e.target;
+
+                                       if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
+                                               table = dom.getParent(target, 'table');
+                                               if (table == startTable) {
+                                                       if (!tableGrid) {
+                                                               tableGrid = createTableGrid(table);
+                                                               tableGrid.setStartCell(startCell);
+
+                                                               ed.getBody().style.webkitUserSelect = 'none';
+                                                       }
+
+                                                       tableGrid.setEndCell(target);
+                                                       hasCellSelection = true;
+                                               }
+
+                                               // Remove current selection
+                                               sel = ed.selection.getSel();
+
+                                               try {
+                                                       if (sel.removeAllRanges)
+                                                               sel.removeAllRanges();
+                                                       else
+                                                               sel.empty();
+                                               } catch (ex) {
+                                                       // IE9 might throw errors here
+                                               }
+
+                                               e.preventDefault();
+                                       }
+                               });
+
+                               ed.onMouseUp.add(function(ed, e) {
+                                       var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
+
+                                       // Move selection to startCell
+                                       if (startCell) {
+                                               if (tableGrid)
+                                                       ed.getBody().style.webkitUserSelect = '';
+
+                                               function setPoint(node, start) {
+                                                       var walker = new tinymce.dom.TreeWalker(node, node);
+
+                                                       do {
+                                                               // Text node
+                                                               if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
+                                                                       if (start)
+                                                                               rng.setStart(node, 0);
+                                                                       else
+                                                                               rng.setEnd(node, node.nodeValue.length);
+
+                                                                       return;
+                                                               }
+
+                                                               // BR element
+                                                               if (node.nodeName == 'BR') {
+                                                                       if (start)
+                                                                               rng.setStartBefore(node);
+                                                                       else
+                                                                               rng.setEndBefore(node);
+
+                                                                       return;
+                                                               }
+                                                       } while (node = (start ? walker.next() : walker.prev()));
+                                               }
+
+                                               // Try to expand text selection as much as we can only Gecko supports cell selection
+                                               selectedCells = dom.select('td.mceSelected,th.mceSelected');
+                                               if (selectedCells.length > 0) {
+                                                       rng = dom.createRng();
+                                                       node = selectedCells[0];
+                                                       endNode = selectedCells[selectedCells.length - 1];
+                                                       rng.setStartBefore(node);
+                                                       rng.setEndAfter(node);
+
+                                                       setPoint(node, 1);
+                                                       walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
+
+                                                       do {
+                                                               if (node.nodeName == 'TD' || node.nodeName == 'TH') {
+                                                                       if (!dom.hasClass(node, 'mceSelected'))
+                                                                               break;
+
+                                                                       lastNode = node;
+                                                               }
+                                                       } while (node = walker.next());
+
+                                                       setPoint(lastNode);
+
+                                                       sel.setRng(rng);
+                                               }
+
+                                               ed.nodeChanged();
+                                               startCell = tableGrid = startTable = null;
+                                       }
+                               });
+
+                               ed.onKeyUp.add(function(ed, e) {
+                                       cleanup();
+                               });
+
+                               ed.onKeyDown.add(function (ed, e) {
+                                       fixTableCellSelection(ed);
+                               });
+
+                               ed.onMouseDown.add(function (ed, e) {
+                                       if (e.button != 2) {
+                                               fixTableCellSelection(ed);
+                                       }
+                               });
+                               function tableCellSelected(ed, rng, n, currentCell) {
+                                       // The decision of when a table cell is selected is somewhat involved.  The fact that this code is
+                                       // required is actually a pointer to the root cause of this bug. A cell is selected when the start 
+                                       // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
+                                       // or the parent of the table (in the case of the selection containing the last cell of a table).
+                                       var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'), 
+                                       tableParent, allOfCellSelected, tableCellSelection;
+                                       if (table) 
+                                       tableParent = table.parentNode;
+                                       allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE && 
+                                               rng.startOffset == 0 && 
+                                               rng.endOffset == 0 && 
+                                               currentCell && 
+                                               (n.nodeName=="TR" || n==tableParent);
+                                       tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell;          
+                                       return  allOfCellSelected || tableCellSelection;
+                                       // return false;
+                               }
+                               
+                               // this nasty hack is here to work around some WebKit selection bugs.
+                               function fixTableCellSelection(ed) {
+                                       if (!tinymce.isWebKit)
+                                               return;
+
+                                       var rng = ed.selection.getRng();
+                                       var n = ed.selection.getNode();
+                                       var currentCell = ed.dom.getParent(rng.startContainer, 'TD,TH');
+                               
+                                       if (!tableCellSelected(ed, rng, n, currentCell))
+                                               return;
+                                               if (!currentCell) {
+                                                       currentCell=n;
+                                               }
+                                       
+                                       // Get the very last node inside the table cell
+                                       var end = currentCell.lastChild;
+                                       while (end.lastChild)
+                                               end = end.lastChild;
+                                       
+                                       // Select the entire table cell. Nothing outside of the table cell should be selected.
+                                       rng.setEnd(end, end.nodeValue.length);
+                                       ed.selection.setRng(rng);
+                               }
+                               ed.plugins.table.fixTableCellSelection=fixTableCellSelection;
+
+                               // Add context menu
+                               if (ed && ed.plugins.contextmenu) {
+                                       ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+                                               var sm, se = ed.selection, el = se.getNode() || ed.getBody();
+
+                                               if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
+                                                       m.removeAll();
+
+                                                       if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
+                                                               m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+                                                               m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+                                                               m.addSeparator();
+                                                       }
+
+                                                       if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
+                                                               m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+                                                               m.addSeparator();
+                                                       }
+
+                                                       m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
+                                                       m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
+                                                       m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
+                                                       m.addSeparator();
+
+                                                       // Cell menu
+                                                       sm = m.addMenu({title : 'table.cell'});
+                                                       sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
+                                                       sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
+                                                       sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
+
+                                                       // Row menu
+                                                       sm = m.addMenu({title : 'table.row'});
+                                                       sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
+                                                       sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
+                                                       sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
+                                                       sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
+                                                       sm.addSeparator();
+                                                       sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
+                                                       sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
+                                                       sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
+                                                       sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
+
+                                                       // Column menu
+                                                       sm = m.addMenu({title : 'table.col'});
+                                                       sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
+                                                       sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
+                                                       sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
+                                               } else
+                                                       m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
+                                       });
+                               }
+
+                               // Fix to allow navigating up and down in a table in WebKit browsers.
+                               if (tinymce.isWebKit) {
+                                       function moveSelection(ed, e) {
+                                               var VK = tinymce.VK;
+                                               var key = e.keyCode;
+
+                                               function handle(upBool, sourceNode, event) {
+                                                       var siblingDirection = upBool ? 'previousSibling' : 'nextSibling';
+                                                       var currentRow = ed.dom.getParent(sourceNode, 'tr');
+                                                       var siblingRow = currentRow[siblingDirection];
+
+                                                       if (siblingRow) {
+                                                               moveCursorToRow(ed, sourceNode, siblingRow, upBool);
+                                                               tinymce.dom.Event.cancel(event);
+                                                               return true;
+                                                       } else {
+                                                               var tableNode = ed.dom.getParent(currentRow, 'table');
+                                                               var middleNode = currentRow.parentNode;
+                                                               var parentNodeName = middleNode.nodeName.toLowerCase();
+                                                               if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) {
+                                                                       var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody');
+                                                                       if (targetParent !== null) {
+                                                                               return moveToRowInTarget(upBool, targetParent, sourceNode, event);
+                                                                       }
+                                                               }
+                                                               return escapeTable(upBool, currentRow, siblingDirection, tableNode, event);
+                                                       }
+                                               }
+
+                                               function getTargetParent(upBool, topNode, secondNode, nodeName) {
+                                                       var tbodies = ed.dom.select('>' + nodeName, topNode);
+                                                       var position = tbodies.indexOf(secondNode);
+                                                       if (upBool && position === 0 || !upBool && position === tbodies.length - 1) {
+                                                               return getFirstHeadOrFoot(upBool, topNode);
+                                                       } else if (position === -1) {
+                                                               var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1;
+                                                               return tbodies[topOrBottom];
+                                                       } else {
+                                                               return tbodies[position + (upBool ? -1 : 1)];
+                                                       }
+                                               }
+
+                                               function getFirstHeadOrFoot(upBool, parent) {
+                                                       var tagName = upBool ? 'thead' : 'tfoot';
+                                                       var headOrFoot = ed.dom.select('>' + tagName, parent);
+                                                       return headOrFoot.length !== 0 ? headOrFoot[0] : null;
+                                               }
+
+                                               function moveToRowInTarget(upBool, targetParent, sourceNode, event) {
+                                                       var targetRow = getChildForDirection(targetParent, upBool);
+                                                       targetRow && moveCursorToRow(ed, sourceNode, targetRow, upBool);
+                                                       tinymce.dom.Event.cancel(event);
+                                                       return true;
+                                               }
+
+                                               function escapeTable(upBool, currentRow, siblingDirection, table, event) {
+                                                       var tableSibling = table[siblingDirection];
+                                                       if (tableSibling) {
+                                                               moveCursorToStartOfElement(tableSibling);
+                                                               return true;
+                                                       } else {
+                                                               var parentCell = ed.dom.getParent(table, 'td,th');
+                                                               if (parentCell) {
+                                                                       return handle(upBool, parentCell, event);
+                                                               } else {
+                                                                       var backUpSibling = getChildForDirection(currentRow, !upBool);
+                                                                       moveCursorToStartOfElement(backUpSibling);
+                                                                       return tinymce.dom.Event.cancel(event);
+                                                               }
+                                                       }
+                                               }
+
+                                               function getChildForDirection(parent, up) {
+                                                       var child =  parent && parent[up ? 'lastChild' : 'firstChild'];
+                                                       // BR is not a valid table child to return in this case we return the table cell
+                                                       return child && child.nodeName === 'BR' ? ed.dom.getParent(child, 'td,th') : child;
+                                               }
+
+                                               function moveCursorToStartOfElement(n) {
+                                                       ed.selection.setCursorLocation(n, 0);
+                                               }
+
+                                               function isVerticalMovement() {
+                                                       return key == VK.UP || key == VK.DOWN;
+                                               }
+
+                                               function isInTable(ed) {
+                                                       var node = ed.selection.getNode();
+                                                       var currentRow = ed.dom.getParent(node, 'tr');
+                                                       return currentRow !== null;
+                                               }
+
+                                               function columnIndex(column) {
+                                                       var colIndex = 0;
+                                                       var c = column;
+                                                       while (c.previousSibling) {
+                                                               c = c.previousSibling;
+                                                               colIndex = colIndex + getSpanVal(c, "colspan");
+                                                       }
+                                                       return colIndex;
+                                               }
+
+                                               function findColumn(rowElement, columnIndex) {
+                                                       var c = 0;
+                                                       var r = 0;
+                                                       each(rowElement.children, function(cell, i) {
+                                                               c = c + getSpanVal(cell, "colspan");
+                                                               r = i;
+                                                               if (c > columnIndex)
+                                                                       return false;
+                                                       });
+                                                       return r;
+                                               }
+
+                                               function moveCursorToRow(ed, node, row, upBool) {
+                                                       var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th'));
+                                                       var tgtColumnIndex = findColumn(row, srcColumnIndex);
+                                                       var tgtNode = row.childNodes[tgtColumnIndex];
+                                                       var rowCellTarget = getChildForDirection(tgtNode, upBool);
+                                                       moveCursorToStartOfElement(rowCellTarget || tgtNode);
+                                               }
+
+                                               function shouldFixCaret(preBrowserNode) {
+                                                       var newNode = ed.selection.getNode();
+                                                       var newParent = ed.dom.getParent(newNode, 'td,th');
+                                                       var oldParent = ed.dom.getParent(preBrowserNode, 'td,th');
+                                                       return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent)
+                                               }
+
+                                               function checkSameParentTable(nodeOne, NodeTwo) {
+                                                       return ed.dom.getParent(nodeOne, 'TABLE') === ed.dom.getParent(NodeTwo, 'TABLE');
+                                               }
+
+                                               if (isVerticalMovement() && isInTable(ed)) {
+                                                       var preBrowserNode = ed.selection.getNode();
+                                                       setTimeout(function() {
+                                                               if (shouldFixCaret(preBrowserNode)) {
+                                                                       handle(!e.shiftKey && key === VK.UP, preBrowserNode, e);
+                                                               }
+                                                       }, 0);
+                                               }
+                                       }
+
+                                       ed.onKeyDown.add(moveSelection);
+                               }
+
+                               // Fixes an issue on Gecko where it's impossible to place the caret behind a table
+                               // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
+                               function fixTableCaretPos() {
+                                       var last;
+
+                                       // Skip empty text nodes form the end
+                                       for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
+
+                                       if (last && last.nodeName == 'TABLE') {
+                                               if (ed.settings.forced_root_block)
+                                                       ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />');
+                                               else
+                                                       ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'});
+                                       }
+                               };
+
+                               // Fixes an bug where it's impossible to place the caret before a table in Gecko
+                               // this fix solves it by detecting when the caret is at the beginning of such a table
+                               // and then manually moves the caret infront of the table
+                               if (tinymce.isGecko) {
+                                       ed.onKeyDown.add(function(ed, e) {
+                                               var rng, table, dom = ed.dom;
+
+                                               // On gecko it's not possible to place the caret before a table
+                                               if (e.keyCode == 37 || e.keyCode == 38) {
+                                                       rng = ed.selection.getRng();
+                                                       table = dom.getParent(rng.startContainer, 'table');
+
+                                                       if (table && ed.getBody().firstChild == table) {
+                                                               if (isAtStart(rng, table)) {
+                                                                       rng = dom.createRng();
+
+                                                                       rng.setStartBefore(table);
+                                                                       rng.setEndBefore(table);
+
+                                                                       ed.selection.setRng(rng);
+
+                                                                       e.preventDefault();
+                                                               }
+                                                       }
+                                               }
+                                       });
+                               }
+
+                               ed.onKeyUp.add(fixTableCaretPos);
+                               ed.onSetContent.add(fixTableCaretPos);
+                               ed.onVisualAid.add(fixTableCaretPos);
+
+                               ed.onPreProcess.add(function(ed, o) {
+                                       var last = o.node.lastChild;
+
+                                       if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && last.previousSibling && last.previousSibling.nodeName == "TABLE") {
+                                               ed.dom.remove(last);
+                                       }
+                               });
+
+
+                               /**
+                                * Fixes bug in Gecko where shift-enter in table cell does not place caret on new line
+                                */
+                               if (tinymce.isGecko) {
+                                       ed.onKeyDown.add(function(ed, e) {
+                                               if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) {
+                                                       var node = ed.selection.getRng().startContainer;
+                                                       var tableCell = dom.getParent(node, 'td,th');
+                                                       if (tableCell) {
+                                                               var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF");
+                                                               dom.insertAfter(zeroSizedNbsp, node);
+                                                       }
+                                               }
+                                       });
+                               }
+
+
+                               fixTableCaretPos();
+                               ed.startContent = ed.getContent({format : 'raw'});
+                       });
+
+                       // Register action commands
+                       each({
+                               mceTableSplitCells : function(grid) {
+                                       grid.split();
+                               },
+
+                               mceTableMergeCells : function(grid) {
+                                       var rowSpan, colSpan, cell;
+
+                                       cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
+                                       if (cell) {
+                                               rowSpan = cell.rowSpan;
+                                               colSpan = cell.colSpan;
+                                       }
+
+                                       if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
+                                               winMan.open({
+                                                       url : url + '/merge_cells.htm',
+                                                       width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
+                                                       height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
+                                                       inline : 1
+                                               }, {
+                                                       rows : rowSpan,
+                                                       cols : colSpan,
+                                                       onaction : function(data) {
+                                                               grid.merge(cell, data.cols, data.rows);
+                                                       },
+                                                       plugin_url : url
+                                               });
+                                       } else
+                                               grid.merge();
+                               },
+
+                               mceTableInsertRowBefore : function(grid) {
+                                       grid.insertRow(true);
+                               },
+
+                               mceTableInsertRowAfter : function(grid) {
+                                       grid.insertRow();
+                               },
+
+                               mceTableInsertColBefore : function(grid) {
+                                       grid.insertCol(true);
+                               },
+
+                               mceTableInsertColAfter : function(grid) {
+                                       grid.insertCol();
+                               },
+
+                               mceTableDeleteCol : function(grid) {
+                                       grid.deleteCols();
+                               },
+
+                               mceTableDeleteRow : function(grid) {
+                                       grid.deleteRows();
+                               },
+
+                               mceTableCutRow : function(grid) {
+                                       clipboardRows = grid.cutRows();
+                               },
+
+                               mceTableCopyRow : function(grid) {
+                                       clipboardRows = grid.copyRows();
+                               },
+
+                               mceTablePasteRowBefore : function(grid) {
+                                       grid.pasteRows(clipboardRows, true);
+                               },
+
+                               mceTablePasteRowAfter : function(grid) {
+                                       grid.pasteRows(clipboardRows);
+                               },
+
+                               mceTableDelete : function(grid) {
+                                       grid.deleteTable();
+                               }
+                       }, function(func, name) {
+                               ed.addCommand(name, function() {
+                                       var grid = createTableGrid();
+
+                                       if (grid) {
+                                               func(grid);
+                                               ed.execCommand('mceRepaint');
+                                               cleanup();
+                                       }
+                               });
+                       });
+
+                       // Register dialog commands
+                       each({
+                               mceInsertTable : function(val) {
+                                       winMan.open({
+                                               url : url + '/table.htm',
+                                               width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
+                                               height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
+                                               inline : 1
+                                       }, {
+                                               plugin_url : url,
+                                               action : val ? val.action : 0
+                                       });
+                               },
+
+                               mceTableRowProps : function() {
+                                       winMan.open({
+                                               url : url + '/row.htm',
+                                               width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
+                                               height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
+                                               inline : 1
+                                       }, {
+                                               plugin_url : url
+                                       });
+                               },
+
+                               mceTableCellProps : function() {
+                                       winMan.open({
+                                               url : url + '/cell.htm',
+                                               width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
+                                               height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
+                                               inline : 1
+                                       }, {
+                                               plugin_url : url
+                                       });
+                               }
+                       }, function(func, name) {
+                               ed.addCommand(name, function(ui, val) {
+                                       func(val);
+                               });
+                       });
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
+})(tinymce);
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/js/cell.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/js/cell.js
new file mode 100644 (file)
index 0000000..02ecf22
--- /dev/null
@@ -0,0 +1,319 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var ed;\r
+\r
+function init() {\r
+       ed = tinyMCEPopup.editor;\r
+       tinyMCEPopup.resizeToInnerSize();\r
+\r
+       document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');\r
+       document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');\r
+       document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')\r
+\r
+       var inst = ed;\r
+       var tdElm = ed.dom.getParent(ed.selection.getStart(), "td,th");\r
+       var formObj = document.forms[0];\r
+       var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));\r
+\r
+       // Get table cell data\r
+       var celltype = tdElm.nodeName.toLowerCase();\r
+       var align = ed.dom.getAttrib(tdElm, 'align');\r
+       var valign = ed.dom.getAttrib(tdElm, 'valign');\r
+       var width = trimSize(getStyle(tdElm, 'width', 'width'));\r
+       var height = trimSize(getStyle(tdElm, 'height', 'height'));\r
+       var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));\r
+       var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));\r
+       var className = ed.dom.getAttrib(tdElm, 'class');\r
+       var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");\r
+       var id = ed.dom.getAttrib(tdElm, 'id');\r
+       var lang = ed.dom.getAttrib(tdElm, 'lang');\r
+       var dir = ed.dom.getAttrib(tdElm, 'dir');\r
+       var scope = ed.dom.getAttrib(tdElm, 'scope');\r
+\r
+       // Setup form\r
+       addClassesToList('class', 'table_cell_styles');\r
+       TinyMCE_EditableSelects.init();\r
+\r
+       if (!ed.dom.hasClass(tdElm, 'mceSelected')) {\r
+               formObj.bordercolor.value = bordercolor;\r
+               formObj.bgcolor.value = bgcolor;\r
+               formObj.backgroundimage.value = backgroundimage;\r
+               formObj.width.value = width;\r
+               formObj.height.value = height;\r
+               formObj.id.value = id;\r
+               formObj.lang.value = lang;\r
+               formObj.style.value = ed.dom.serializeStyle(st);\r
+               selectByValue(formObj, 'align', align);\r
+               selectByValue(formObj, 'valign', valign);\r
+               selectByValue(formObj, 'class', className, true, true);\r
+               selectByValue(formObj, 'celltype', celltype);\r
+               selectByValue(formObj, 'dir', dir);\r
+               selectByValue(formObj, 'scope', scope);\r
+\r
+               // Resize some elements\r
+               if (isVisible('backgroundimagebrowser'))\r
+                       document.getElementById('backgroundimage').style.width = '180px';\r
+\r
+               updateColor('bordercolor_pick', 'bordercolor');\r
+               updateColor('bgcolor_pick', 'bgcolor');\r
+       } else\r
+               tinyMCEPopup.dom.hide('action');\r
+}\r
+\r
+function updateAction() {\r
+       var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];\r
+\r
+       if (!AutoValidator.validate(formObj)) {\r
+               tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');\r
+               return false;\r
+       }\r
+\r
+       tinyMCEPopup.restoreSelection();\r
+       el = ed.selection.getStart();\r
+       tdElm = ed.dom.getParent(el, "td,th");\r
+       trElm = ed.dom.getParent(el, "tr");\r
+       tableElm = ed.dom.getParent(el, "table");\r
+\r
+       // Cell is selected\r
+       if (ed.dom.hasClass(tdElm, 'mceSelected')) {\r
+               // Update all selected sells\r
+               tinymce.each(ed.dom.select('td.mceSelected,th.mceSelected'), function(td) {\r
+                       updateCell(td);\r
+               });\r
+\r
+               ed.addVisual();\r
+               ed.nodeChanged();\r
+               inst.execCommand('mceEndUndoLevel');\r
+               tinyMCEPopup.close();\r
+               return;\r
+       }\r
+\r
+       switch (getSelectValue(formObj, 'action')) {\r
+               case "cell":\r
+                       var celltype = getSelectValue(formObj, 'celltype');\r
+                       var scope = getSelectValue(formObj, 'scope');\r
+\r
+                       function doUpdate(s) {\r
+                               if (s) {\r
+                                       updateCell(tdElm);\r
+\r
+                                       ed.addVisual();\r
+                                       ed.nodeChanged();\r
+                                       inst.execCommand('mceEndUndoLevel');\r
+                                       tinyMCEPopup.close();\r
+                               }\r
+                       };\r
+\r
+                       if (ed.getParam("accessibility_warnings", 1)) {\r
+                               if (celltype == "th" && scope == "")\r
+                                       tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);\r
+                               else\r
+                                       doUpdate(1);\r
+\r
+                               return;\r
+                       }\r
+\r
+                       updateCell(tdElm);\r
+                       break;\r
+\r
+               case "row":\r
+                       var cell = trElm.firstChild;\r
+\r
+                       if (cell.nodeName != "TD" && cell.nodeName != "TH")\r
+                               cell = nextCell(cell);\r
+\r
+                       do {\r
+                               cell = updateCell(cell, true);\r
+                       } while ((cell = nextCell(cell)) != null);\r
+\r
+                       break;\r
+\r
+               case "col":\r
+                       var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");\r
+\r
+                       if (cell.nodeName != "TD" && cell.nodeName != "TH")\r
+                               cell = nextCell(cell);\r
+\r
+                       do {\r
+                               if (cell == tdElm)\r
+                                       break;\r
+                               col += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;\r
+                       } while ((cell = nextCell(cell)) != null);\r
+\r
+                       for (var i=0; i<rows.length; i++) {\r
+                               cell = rows[i].firstChild;\r
+\r
+                               if (cell.nodeName != "TD" && cell.nodeName != "TH")\r
+                                       cell = nextCell(cell);\r
+\r
+                               curr = 0;\r
+                               do {\r
+                                       if (curr == col) {\r
+                                               cell = updateCell(cell, true);\r
+                                               break;\r
+                                       }\r
+                                       curr += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;\r
+                               } while ((cell = nextCell(cell)) != null);\r
+                       }\r
+\r
+                       break;\r
+\r
+               case "all":\r
+                       var rows = tableElm.getElementsByTagName("tr");\r
+\r
+                       for (var i=0; i<rows.length; i++) {\r
+                               var cell = rows[i].firstChild;\r
+\r
+                               if (cell.nodeName != "TD" && cell.nodeName != "TH")\r
+                                       cell = nextCell(cell);\r
+\r
+                               do {\r
+                                       cell = updateCell(cell, true);\r
+                               } while ((cell = nextCell(cell)) != null);\r
+                       }\r
+\r
+                       break;\r
+       }\r
+\r
+       ed.addVisual();\r
+       ed.nodeChanged();\r
+       inst.execCommand('mceEndUndoLevel');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function nextCell(elm) {\r
+       while ((elm = elm.nextSibling) != null) {\r
+               if (elm.nodeName == "TD" || elm.nodeName == "TH")\r
+                       return elm;\r
+       }\r
+\r
+       return null;\r
+}\r
+\r
+function updateCell(td, skip_id) {\r
+       var inst = ed;\r
+       var formObj = document.forms[0];\r
+       var curCellType = td.nodeName.toLowerCase();\r
+       var celltype = getSelectValue(formObj, 'celltype');\r
+       var doc = inst.getDoc();\r
+       var dom = ed.dom;\r
+\r
+       if (!skip_id)\r
+               dom.setAttrib(td, 'id', formObj.id.value);\r
+\r
+       dom.setAttrib(td, 'align', formObj.align.value);\r
+       dom.setAttrib(td, 'vAlign', formObj.valign.value);\r
+       dom.setAttrib(td, 'lang', formObj.lang.value);\r
+       dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));\r
+       dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));\r
+       dom.setAttrib(td, 'scope', formObj.scope.value);\r
+       dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));\r
+\r
+       // Clear deprecated attributes\r
+       ed.dom.setAttrib(td, 'width', '');\r
+       ed.dom.setAttrib(td, 'height', '');\r
+       ed.dom.setAttrib(td, 'bgColor', '');\r
+       ed.dom.setAttrib(td, 'borderColor', '');\r
+       ed.dom.setAttrib(td, 'background', '');\r
+\r
+       // Set styles\r
+       td.style.width = getCSSSize(formObj.width.value);\r
+       td.style.height = getCSSSize(formObj.height.value);\r
+       if (formObj.bordercolor.value != "") {\r
+               td.style.borderColor = formObj.bordercolor.value;\r
+               td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;\r
+               td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;\r
+       } else\r
+               td.style.borderColor = '';\r
+\r
+       td.style.backgroundColor = formObj.bgcolor.value;\r
+\r
+       if (formObj.backgroundimage.value != "")\r
+               td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";\r
+       else\r
+               td.style.backgroundImage = '';\r
+\r
+       if (curCellType != celltype) {\r
+               // changing to a different node type\r
+               var newCell = doc.createElement(celltype);\r
+\r
+               for (var c=0; c<td.childNodes.length; c++)\r
+                       newCell.appendChild(td.childNodes[c].cloneNode(1));\r
+\r
+               for (var a=0; a<td.attributes.length; a++)\r
+                       ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));\r
+\r
+               td.parentNode.replaceChild(newCell, td);\r
+               td = newCell;\r
+       }\r
+\r
+       dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));\r
+\r
+       return td;\r
+}\r
+\r
+function changedBackgroundImage() {\r
+       var formObj = document.forms[0];\r
+       var st = ed.dom.parseStyle(formObj.style.value);\r
+\r
+       st['background-image'] = "url('" + formObj.backgroundimage.value + "')";\r
+\r
+       formObj.style.value = ed.dom.serializeStyle(st);\r
+}\r
+\r
+function changedSize() {\r
+       var formObj = document.forms[0];\r
+       var st = ed.dom.parseStyle(formObj.style.value);\r
+\r
+       var width = formObj.width.value;\r
+       if (width != "")\r
+               st['width'] = getCSSSize(width);\r
+       else\r
+               st['width'] = "";\r
+\r
+       var height = formObj.height.value;\r
+       if (height != "")\r
+               st['height'] = getCSSSize(height);\r
+       else\r
+               st['height'] = "";\r
+\r
+       formObj.style.value = ed.dom.serializeStyle(st);\r
+}\r
+\r
+function changedColor() {\r
+       var formObj = document.forms[0];\r
+       var st = ed.dom.parseStyle(formObj.style.value);\r
+\r
+       st['background-color'] = formObj.bgcolor.value;\r
+       st['border-color'] = formObj.bordercolor.value;\r
+\r
+       formObj.style.value = ed.dom.serializeStyle(st);\r
+}\r
+\r
+function changedStyle() {\r
+       var formObj = document.forms[0];\r
+       var st = ed.dom.parseStyle(formObj.style.value);\r
+\r
+       if (st['background-image'])\r
+               formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");\r
+       else\r
+               formObj.backgroundimage.value = '';\r
+\r
+       if (st['width'])\r
+               formObj.width.value = trimSize(st['width']);\r
+\r
+       if (st['height'])\r
+               formObj.height.value = trimSize(st['height']);\r
+\r
+       if (st['background-color']) {\r
+               formObj.bgcolor.value = st['background-color'];\r
+               updateColor('bgcolor_pick','bgcolor');\r
+       }\r
+\r
+       if (st['border-color']) {\r
+               formObj.bordercolor.value = st['border-color'];\r
+               updateColor('bordercolor_pick','bordercolor');\r
+       }\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/js/merge_cells.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/js/merge_cells.js
new file mode 100644 (file)
index 0000000..7ee4bf0
--- /dev/null
@@ -0,0 +1,27 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var MergeCellsDialog = {\r
+       init : function() {\r
+               var f = document.forms[0];\r
+\r
+               f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1);\r
+               f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1);\r
+       },\r
+\r
+       merge : function() {\r
+               var func, f = document.forms[0];\r
+\r
+               tinyMCEPopup.restoreSelection();\r
+\r
+               func = tinyMCEPopup.getWindowArg('onaction');\r
+\r
+               func({\r
+                       cols : f.numcols.value,\r
+                       rows : f.numrows.value\r
+               });\r
+\r
+               tinyMCEPopup.close();\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/js/row.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/js/row.js
new file mode 100644 (file)
index 0000000..a13d695
--- /dev/null
@@ -0,0 +1,237 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+function init() {\r
+       tinyMCEPopup.resizeToInnerSize();\r
+\r
+       document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');\r
+       document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
+\r
+       var inst = tinyMCEPopup.editor;\r
+       var dom = inst.dom;\r
+       var trElm = dom.getParent(inst.selection.getStart(), "tr");\r
+       var formObj = document.forms[0];\r
+       var st = dom.parseStyle(dom.getAttrib(trElm, "style"));\r
+\r
+       // Get table row data\r
+       var rowtype = trElm.parentNode.nodeName.toLowerCase();\r
+       var align = dom.getAttrib(trElm, 'align');\r
+       var valign = dom.getAttrib(trElm, 'valign');\r
+       var height = trimSize(getStyle(trElm, 'height', 'height'));\r
+       var className = dom.getAttrib(trElm, 'class');\r
+       var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));\r
+       var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");\r
+       var id = dom.getAttrib(trElm, 'id');\r
+       var lang = dom.getAttrib(trElm, 'lang');\r
+       var dir = dom.getAttrib(trElm, 'dir');\r
+\r
+       selectByValue(formObj, 'rowtype', rowtype);\r
+\r
+       // Any cells selected\r
+       if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) {\r
+               // Setup form\r
+               addClassesToList('class', 'table_row_styles');\r
+               TinyMCE_EditableSelects.init();\r
+\r
+               formObj.bgcolor.value = bgcolor;\r
+               formObj.backgroundimage.value = backgroundimage;\r
+               formObj.height.value = height;\r
+               formObj.id.value = id;\r
+               formObj.lang.value = lang;\r
+               formObj.style.value = dom.serializeStyle(st);\r
+               selectByValue(formObj, 'align', align);\r
+               selectByValue(formObj, 'valign', valign);\r
+               selectByValue(formObj, 'class', className, true, true);\r
+               selectByValue(formObj, 'dir', dir);\r
+\r
+               // Resize some elements\r
+               if (isVisible('backgroundimagebrowser'))\r
+                       document.getElementById('backgroundimage').style.width = '180px';\r
+\r
+               updateColor('bgcolor_pick', 'bgcolor');\r
+       } else\r
+               tinyMCEPopup.dom.hide('action');\r
+}\r
+\r
+function updateAction() {\r
+       var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];\r
+       var action = getSelectValue(formObj, 'action');\r
+\r
+       if (!AutoValidator.validate(formObj)) {\r
+               tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');\r
+               return false;\r
+       }\r
+\r
+       tinyMCEPopup.restoreSelection();\r
+       trElm = dom.getParent(inst.selection.getStart(), "tr");\r
+       tableElm = dom.getParent(inst.selection.getStart(), "table");\r
+\r
+       // Update all selected rows\r
+       if (dom.select('td.mceSelected,th.mceSelected', trElm).length > 0) {\r
+               tinymce.each(tableElm.rows, function(tr) {\r
+                       var i;\r
+\r
+                       for (i = 0; i < tr.cells.length; i++) {\r
+                               if (dom.hasClass(tr.cells[i], 'mceSelected')) {\r
+                                       updateRow(tr, true);\r
+                                       return;\r
+                               }\r
+                       }\r
+               });\r
+\r
+               inst.addVisual();\r
+               inst.nodeChanged();\r
+               inst.execCommand('mceEndUndoLevel');\r
+               tinyMCEPopup.close();\r
+               return;\r
+       }\r
+\r
+       switch (action) {\r
+               case "row":\r
+                       updateRow(trElm);\r
+                       break;\r
+\r
+               case "all":\r
+                       var rows = tableElm.getElementsByTagName("tr");\r
+\r
+                       for (var i=0; i<rows.length; i++)\r
+                               updateRow(rows[i], true);\r
+\r
+                       break;\r
+\r
+               case "odd":\r
+               case "even":\r
+                       var rows = tableElm.getElementsByTagName("tr");\r
+\r
+                       for (var i=0; i<rows.length; i++) {\r
+                               if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even"))\r
+                                       updateRow(rows[i], true, true);\r
+                       }\r
+\r
+                       break;\r
+       }\r
+\r
+       inst.addVisual();\r
+       inst.nodeChanged();\r
+       inst.execCommand('mceEndUndoLevel');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function updateRow(tr_elm, skip_id, skip_parent) {\r
+       var inst = tinyMCEPopup.editor;\r
+       var formObj = document.forms[0];\r
+       var dom = inst.dom;\r
+       var curRowType = tr_elm.parentNode.nodeName.toLowerCase();\r
+       var rowtype = getSelectValue(formObj, 'rowtype');\r
+       var doc = inst.getDoc();\r
+\r
+       // Update row element\r
+       if (!skip_id)\r
+               dom.setAttrib(tr_elm, 'id', formObj.id.value);\r
+\r
+       dom.setAttrib(tr_elm, 'align', getSelectValue(formObj, 'align'));\r
+       dom.setAttrib(tr_elm, 'vAlign', getSelectValue(formObj, 'valign'));\r
+       dom.setAttrib(tr_elm, 'lang', formObj.lang.value);\r
+       dom.setAttrib(tr_elm, 'dir', getSelectValue(formObj, 'dir'));\r
+       dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));\r
+       dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));\r
+\r
+       // Clear deprecated attributes\r
+       dom.setAttrib(tr_elm, 'background', '');\r
+       dom.setAttrib(tr_elm, 'bgColor', '');\r
+       dom.setAttrib(tr_elm, 'height', '');\r
+\r
+       // Set styles\r
+       tr_elm.style.height = getCSSSize(formObj.height.value);\r
+       tr_elm.style.backgroundColor = formObj.bgcolor.value;\r
+\r
+       if (formObj.backgroundimage.value != "")\r
+               tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";\r
+       else\r
+               tr_elm.style.backgroundImage = '';\r
+\r
+       // Setup new rowtype\r
+       if (curRowType != rowtype && !skip_parent) {\r
+               // first, clone the node we are working on\r
+               var newRow = tr_elm.cloneNode(1);\r
+\r
+               // next, find the parent of its new destination (creating it if necessary)\r
+               var theTable = dom.getParent(tr_elm, "table");\r
+               var dest = rowtype;\r
+               var newParent = null;\r
+               for (var i = 0; i < theTable.childNodes.length; i++) {\r
+                       if (theTable.childNodes[i].nodeName.toLowerCase() == dest)\r
+                               newParent = theTable.childNodes[i];\r
+               }\r
+\r
+               if (newParent == null) {\r
+                       newParent = doc.createElement(dest);\r
+\r
+                       if (theTable.firstChild.nodeName == 'CAPTION')\r
+                               inst.dom.insertAfter(newParent, theTable.firstChild);\r
+                       else\r
+                               theTable.insertBefore(newParent, theTable.firstChild);\r
+               }\r
+\r
+               // append the row to the new parent\r
+               newParent.appendChild(newRow);\r
+\r
+               // remove the original\r
+               tr_elm.parentNode.removeChild(tr_elm);\r
+\r
+               // set tr_elm to the new node\r
+               tr_elm = newRow;\r
+       }\r
+\r
+       dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));\r
+}\r
+\r
+function changedBackgroundImage() {\r
+       var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       st['background-image'] = "url('" + formObj.backgroundimage.value + "')";\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+function changedStyle() {\r
+       var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       if (st['background-image'])\r
+               formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");\r
+       else\r
+               formObj.backgroundimage.value = '';\r
+\r
+       if (st['height'])\r
+               formObj.height.value = trimSize(st['height']);\r
+\r
+       if (st['background-color']) {\r
+               formObj.bgcolor.value = st['background-color'];\r
+               updateColor('bgcolor_pick','bgcolor');\r
+       }\r
+}\r
+\r
+function changedSize() {\r
+       var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       var height = formObj.height.value;\r
+       if (height != "")\r
+               st['height'] = getCSSSize(height);\r
+       else\r
+               st['height'] = "";\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+function changedColor() {\r
+       var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       st['background-color'] = formObj.bgcolor.value;\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/js/table.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/js/table.js
new file mode 100644 (file)
index 0000000..1db243b
--- /dev/null
@@ -0,0 +1,501 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom;\r
+\r
+function insertTable() {\r
+       var formObj = document.forms[0];\r
+       var inst = tinyMCEPopup.editor, dom = inst.dom;\r
+       var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;\r
+       var html = '', capEl, elm;\r
+       var cellLimit, rowLimit, colLimit;\r
+\r
+       tinyMCEPopup.restoreSelection();\r
+\r
+       if (!AutoValidator.validate(formObj)) {\r
+               tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');\r
+               return false;\r
+       }\r
+\r
+       elm = dom.getParent(inst.selection.getNode(), 'table');\r
+\r
+       // Get form data\r
+       cols = formObj.elements['cols'].value;\r
+       rows = formObj.elements['rows'].value;\r
+       border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;\r
+       cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";\r
+       cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";\r
+       align = getSelectValue(formObj, "align");\r
+       frame = getSelectValue(formObj, "tframe");\r
+       rules = getSelectValue(formObj, "rules");\r
+       width = formObj.elements['width'].value;\r
+       height = formObj.elements['height'].value;\r
+       bordercolor = formObj.elements['bordercolor'].value;\r
+       bgcolor = formObj.elements['bgcolor'].value;\r
+       className = getSelectValue(formObj, "class");\r
+       id = formObj.elements['id'].value;\r
+       summary = formObj.elements['summary'].value;\r
+       style = formObj.elements['style'].value;\r
+       dir = formObj.elements['dir'].value;\r
+       lang = formObj.elements['lang'].value;\r
+       background = formObj.elements['backgroundimage'].value;\r
+       caption = formObj.elements['caption'].checked;\r
+\r
+       cellLimit = tinyMCEPopup.getParam('table_cell_limit', false);\r
+       rowLimit = tinyMCEPopup.getParam('table_row_limit', false);\r
+       colLimit = tinyMCEPopup.getParam('table_col_limit', false);\r
+\r
+       // Validate table size\r
+       if (colLimit && cols > colLimit) {\r
+               tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));\r
+               return false;\r
+       } else if (rowLimit && rows > rowLimit) {\r
+               tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));\r
+               return false;\r
+       } else if (cellLimit && cols * rows > cellLimit) {\r
+               tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));\r
+               return false;\r
+       }\r
+\r
+       // Update table\r
+       if (action == "update") {\r
+               dom.setAttrib(elm, 'cellPadding', cellpadding, true);\r
+               dom.setAttrib(elm, 'cellSpacing', cellspacing, true);\r
+\r
+               if (!isCssSize(border)) {\r
+                       dom.setAttrib(elm, 'border', border);\r
+               } else {\r
+                       dom.setAttrib(elm, 'border', '');\r
+               }\r
+\r
+               if (border == '') {\r
+                       dom.setStyle(elm, 'border-width', '');\r
+                       dom.setStyle(elm, 'border', '');\r
+                       dom.setAttrib(elm, 'border', '');\r
+               }\r
+\r
+               dom.setAttrib(elm, 'align', align);\r
+               dom.setAttrib(elm, 'frame', frame);\r
+               dom.setAttrib(elm, 'rules', rules);\r
+               dom.setAttrib(elm, 'class', className);\r
+               dom.setAttrib(elm, 'style', style);\r
+               dom.setAttrib(elm, 'id', id);\r
+               dom.setAttrib(elm, 'summary', summary);\r
+               dom.setAttrib(elm, 'dir', dir);\r
+               dom.setAttrib(elm, 'lang', lang);\r
+\r
+               capEl = inst.dom.select('caption', elm)[0];\r
+\r
+               if (capEl && !caption)\r
+                       capEl.parentNode.removeChild(capEl);\r
+\r
+               if (!capEl && caption) {\r
+                       capEl = elm.ownerDocument.createElement('caption');\r
+\r
+                       if (!tinymce.isIE)\r
+                               capEl.innerHTML = '<br data-mce-bogus="1"/>';\r
+\r
+                       elm.insertBefore(capEl, elm.firstChild);\r
+               }\r
+\r
+               if (width && inst.settings.inline_styles) {\r
+                       dom.setStyle(elm, 'width', width);\r
+                       dom.setAttrib(elm, 'width', '');\r
+               } else {\r
+                       dom.setAttrib(elm, 'width', width, true);\r
+                       dom.setStyle(elm, 'width', '');\r
+               }\r
+\r
+               // Remove these since they are not valid XHTML\r
+               dom.setAttrib(elm, 'borderColor', '');\r
+               dom.setAttrib(elm, 'bgColor', '');\r
+               dom.setAttrib(elm, 'background', '');\r
+\r
+               if (height && inst.settings.inline_styles) {\r
+                       dom.setStyle(elm, 'height', height);\r
+                       dom.setAttrib(elm, 'height', '');\r
+               } else {\r
+                       dom.setAttrib(elm, 'height', height, true);\r
+                       dom.setStyle(elm, 'height', '');\r
+               }\r
+\r
+               if (background != '')\r
+                       elm.style.backgroundImage = "url('" + background + "')";\r
+               else\r
+                       elm.style.backgroundImage = '';\r
+\r
+/*             if (tinyMCEPopup.getParam("inline_styles")) {\r
+                       if (width != '')\r
+                               elm.style.width = getCSSSize(width);\r
+               }*/\r
+\r
+               if (bordercolor != "") {\r
+                       elm.style.borderColor = bordercolor;\r
+                       elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;\r
+                       elm.style.borderWidth = cssSize(border);\r
+               } else\r
+                       elm.style.borderColor = '';\r
+\r
+               elm.style.backgroundColor = bgcolor;\r
+               elm.style.height = getCSSSize(height);\r
+\r
+               inst.addVisual();\r
+\r
+               // Fix for stange MSIE align bug\r
+               //elm.outerHTML = elm.outerHTML;\r
+\r
+               inst.nodeChanged();\r
+               inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});\r
+\r
+               // Repaint if dimensions changed\r
+               if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)\r
+                       inst.execCommand('mceRepaint');\r
+\r
+               tinyMCEPopup.close();\r
+               return true;\r
+       }\r
+\r
+       // Create new table\r
+       html += '<table';\r
+\r
+       html += makeAttrib('id', id);\r
+       if (!isCssSize(border)) {\r
+               html += makeAttrib('border', border);\r
+       }\r
+\r
+       html += makeAttrib('cellpadding', cellpadding);\r
+       html += makeAttrib('cellspacing', cellspacing);\r
+       html += makeAttrib('data-mce-new', '1');\r
+\r
+       if (width && inst.settings.inline_styles) {\r
+               if (style)\r
+                       style += '; ';\r
+\r
+               // Force px\r
+               if (/^[0-9\.]+$/.test(width))\r
+                       width += 'px';\r
+\r
+               style += 'width: ' + width;\r
+       } else\r
+               html += makeAttrib('width', width);\r
+\r
+/*     if (height) {\r
+               if (style)\r
+                       style += '; ';\r
+\r
+               style += 'height: ' + height;\r
+       }*/\r
+\r
+       //html += makeAttrib('height', height);\r
+       //html += makeAttrib('bordercolor', bordercolor);\r
+       //html += makeAttrib('bgcolor', bgcolor);\r
+       html += makeAttrib('align', align);\r
+       html += makeAttrib('frame', frame);\r
+       html += makeAttrib('rules', rules);\r
+       html += makeAttrib('class', className);\r
+       html += makeAttrib('style', style);\r
+       html += makeAttrib('summary', summary);\r
+       html += makeAttrib('dir', dir);\r
+       html += makeAttrib('lang', lang);\r
+       html += '>';\r
+\r
+       if (caption) {\r
+               if (!tinymce.isIE)\r
+                       html += '<caption><br data-mce-bogus="1"/></caption>';\r
+               else\r
+                       html += '<caption></caption>';\r
+       }\r
+\r
+       for (var y=0; y<rows; y++) {\r
+               html += "<tr>";\r
+\r
+               for (var x=0; x<cols; x++) {\r
+                       if (!tinymce.isIE)\r
+                               html += '<td><br data-mce-bogus="1"/></td>';\r
+                       else\r
+                               html += '<td></td>';\r
+               }\r
+\r
+               html += "</tr>";\r
+       }\r
+\r
+       html += "</table>";\r
+\r
+       // Move table\r
+       if (inst.settings.fix_table_elements) {\r
+               var patt = '';\r
+\r
+               inst.focus();\r
+               inst.selection.setContent('<br class="_mce_marker" />');\r
+\r
+               tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) {\r
+                       if (patt)\r
+                               patt += ',';\r
+\r
+                       patt += n + ' ._mce_marker';\r
+               });\r
+\r
+               tinymce.each(inst.dom.select(patt), function(n) {\r
+                       inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n);\r
+               });\r
+\r
+               dom.setOuterHTML(dom.select('br._mce_marker')[0], html);\r
+       } else\r
+               inst.execCommand('mceInsertContent', false, html);\r
+\r
+       tinymce.each(dom.select('table[data-mce-new]'), function(node) {
+               var tdorth = dom.select('td,th', node);\r
+
+               // Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document\r
+               if (tinymce.isIE && node.nextSibling == null) {\r
+                       if (inst.settings.forced_root_block)\r
+                               dom.insertAfter(dom.create(inst.settings.forced_root_block), node);\r
+                       else\r
+                               dom.insertAfter(dom.create('br', {'data-mce-bogus': '1'}), node);\r
+               }
+\r
+               try {\r
+                       // IE9 might fail to do this selection \r
+                       inst.selection.setCursorLocation(tdorth[0], 0);\r
+               } catch (ex) {\r
+                       // Ignore\r
+               }\r
+\r
+               dom.setAttrib(node, 'data-mce-new', '');\r
+       });\r
+\r
+       inst.addVisual();\r
+       inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});\r
+\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function makeAttrib(attrib, value) {\r
+       var formObj = document.forms[0];\r
+       var valueElm = formObj.elements[attrib];\r
+\r
+       if (typeof(value) == "undefined" || value == null) {\r
+               value = "";\r
+\r
+               if (valueElm)\r
+                       value = valueElm.value;\r
+       }\r
+\r
+       if (value == "")\r
+               return "";\r
+\r
+       // XML encode it\r
+       value = value.replace(/&/g, '&amp;');\r
+       value = value.replace(/\"/g, '&quot;');\r
+       value = value.replace(/</g, '&lt;');\r
+       value = value.replace(/>/g, '&gt;');\r
+\r
+       return ' ' + attrib + '="' + value + '"';\r
+}\r
+\r
+function init() {\r
+       tinyMCEPopup.resizeToInnerSize();\r
+\r
+       document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');\r
+       document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');\r
+       document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');\r
+       document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
+\r
+       var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');\r
+       var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";\r
+       var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules = "", frame = "";\r
+       var inst = tinyMCEPopup.editor, dom = inst.dom;\r
+       var formObj = document.forms[0];\r
+       var elm = dom.getParent(inst.selection.getNode(), "table");\r
+\r
+       // Hide advanced fields that isn't available in the schema\r
+       tinymce.each("summary id rules dir style frame".split(" "), function(name) {\r
+               var tr = tinyMCEPopup.dom.getParent(name, "tr") || tinyMCEPopup.dom.getParent("t" + name, "tr");\r
+\r
+               if (tr && !tinyMCEPopup.editor.schema.isValid("table", name)) {\r
+                       tr.style.display = 'none';\r
+               }\r
+       });\r
+\r
+       action = tinyMCEPopup.getWindowArg('action');\r
+\r
+       if (!action)\r
+               action = elm ? "update" : "insert";\r
+\r
+       if (elm && action != "insert") {\r
+               var rowsAr = elm.rows;\r
+               var cols = 0;\r
+               for (var i=0; i<rowsAr.length; i++)\r
+                       if (rowsAr[i].cells.length > cols)\r
+                               cols = rowsAr[i].cells.length;\r
+\r
+               cols = cols;\r
+               rows = rowsAr.length;\r
+\r
+               st = dom.parseStyle(dom.getAttrib(elm, "style"));\r
+               border = trimSize(getStyle(elm, 'border', 'borderWidth'));\r
+               cellpadding = dom.getAttrib(elm, 'cellpadding', "");\r
+               cellspacing = dom.getAttrib(elm, 'cellspacing', "");\r
+               width = trimSize(getStyle(elm, 'width', 'width'));\r
+               height = trimSize(getStyle(elm, 'height', 'height'));\r
+               bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));\r
+               bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));\r
+               align = dom.getAttrib(elm, 'align', align);\r
+               frame = dom.getAttrib(elm, 'frame');\r
+               rules = dom.getAttrib(elm, 'rules');\r
+               className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, ''));\r
+               id = dom.getAttrib(elm, 'id');\r
+               summary = dom.getAttrib(elm, 'summary');\r
+               style = dom.serializeStyle(st);\r
+               dir = dom.getAttrib(elm, 'dir');\r
+               lang = dom.getAttrib(elm, 'lang');\r
+               background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");\r
+               formObj.caption.checked = elm.getElementsByTagName('caption').length > 0;\r
+\r
+               orgTableWidth = width;\r
+               orgTableHeight = height;\r
+\r
+               action = "update";\r
+               formObj.insert.value = inst.getLang('update');\r
+       }\r
+\r
+       addClassesToList('class', "table_styles");\r
+       TinyMCE_EditableSelects.init();\r
+\r
+       // Update form\r
+       selectByValue(formObj, 'align', align);\r
+       selectByValue(formObj, 'tframe', frame);\r
+       selectByValue(formObj, 'rules', rules);\r
+       selectByValue(formObj, 'class', className, true, true);\r
+       formObj.cols.value = cols;\r
+       formObj.rows.value = rows;\r
+       formObj.border.value = border;\r
+       formObj.cellpadding.value = cellpadding;\r
+       formObj.cellspacing.value = cellspacing;\r
+       formObj.width.value = width;\r
+       formObj.height.value = height;\r
+       formObj.bordercolor.value = bordercolor;\r
+       formObj.bgcolor.value = bgcolor;\r
+       formObj.id.value = id;\r
+       formObj.summary.value = summary;\r
+       formObj.style.value = style;\r
+       formObj.dir.value = dir;\r
+       formObj.lang.value = lang;\r
+       formObj.backgroundimage.value = background;\r
+\r
+       updateColor('bordercolor_pick', 'bordercolor');\r
+       updateColor('bgcolor_pick', 'bgcolor');\r
+\r
+       // Resize some elements\r
+       if (isVisible('backgroundimagebrowser'))\r
+               document.getElementById('backgroundimage').style.width = '180px';\r
+\r
+       // Disable some fields in update mode\r
+       if (action == "update") {\r
+               formObj.cols.disabled = true;\r
+               formObj.rows.disabled = true;\r
+       }\r
+}\r
+\r
+function changedSize() {\r
+       var formObj = document.forms[0];\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+/*     var width = formObj.width.value;\r
+       if (width != "")\r
+               st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : "";\r
+       else\r
+               st['width'] = "";*/\r
+\r
+       var height = formObj.height.value;\r
+       if (height != "")\r
+               st['height'] = getCSSSize(height);\r
+       else\r
+               st['height'] = "";\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+function isCssSize(value) {\r
+       return /^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)$/.test(value);\r
+}\r
+\r
+function cssSize(value, def) {\r
+       value = tinymce.trim(value || def);\r
+\r
+       if (!isCssSize(value)) {\r
+               return parseInt(value, 10) + 'px';\r
+       }\r
+\r
+       return value;\r
+}\r
+\r
+function changedBackgroundImage() {\r
+       var formObj = document.forms[0];\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       st['background-image'] = "url('" + formObj.backgroundimage.value + "')";\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+function changedBorder() {\r
+       var formObj = document.forms[0];\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       // Update border width if the element has a color\r
+       if (formObj.border.value != "" && (isCssSize(formObj.border.value) || formObj.bordercolor.value != ""))\r
+               st['border-width'] = cssSize(formObj.border.value);\r
+       else {\r
+               if (!formObj.border.value) {\r
+                       st['border'] = '';\r
+                       st['border-width'] = '';\r
+               }\r
+       }\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+function changedColor() {\r
+       var formObj = document.forms[0];\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       st['background-color'] = formObj.bgcolor.value;\r
+\r
+       if (formObj.bordercolor.value != "") {\r
+               st['border-color'] = formObj.bordercolor.value;\r
+\r
+               // Add border-width if it's missing\r
+               if (!st['border-width'])\r
+                       st['border-width'] = cssSize(formObj.border.value, 1);\r
+       }\r
+\r
+       formObj.style.value = dom.serializeStyle(st);\r
+}\r
+\r
+function changedStyle() {\r
+       var formObj = document.forms[0];\r
+       var st = dom.parseStyle(formObj.style.value);\r
+\r
+       if (st['background-image'])\r
+               formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");\r
+       else\r
+               formObj.backgroundimage.value = '';\r
+\r
+       if (st['width'])\r
+               formObj.width.value = trimSize(st['width']);\r
+\r
+       if (st['height'])\r
+               formObj.height.value = trimSize(st['height']);\r
+\r
+       if (st['background-color']) {\r
+               formObj.bgcolor.value = st['background-color'];\r
+               updateColor('bgcolor_pick','bgcolor');\r
+       }\r
+\r
+       if (st['border-color']) {\r
+               formObj.bordercolor.value = st['border-color'];\r
+               updateColor('bordercolor_pick','bordercolor');\r
+       }\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/table/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..463e09e
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table Caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Footer",tbody:"Body",thead:"Header","row_all":"Update All Rows in Table","row_even":"Update Even Rows in Table","row_odd":"Update Odd Rows in Table","row_row":"Update Current Row","cell_all":"Update All Cells in Table","cell_row":"Update All Cells in Row","cell_cell":"Update Current Cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background Image",rtl:"Right to Left",ltr:"Left to Right",mime:"Target MIME Type",langcode:"Language Code",langdir:"Language Direction",style:"Style",id:"ID","merge_cells_title":"Merge Table Cells",bgcolor:"Background Color",bordercolor:"Border Color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical Alignment","cell_type":"Cell Type","cell_title":"Table Cell Properties","row_title":"Table Row Properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cell Padding",cellspacing:"Cell Spacing",rows:"Rows",cols:"Columns",height:"Height",width:"Width",title:"Insert/Edit Table",rowtype:"Row Type","advanced_props":"Advanced Properties","general_props":"General Properties","advanced_tab":"Advanced","general_tab":"General","cell_col":"Update all cells in column"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/merge_cells.htm b/3.x/src/resources/javascript/TinyMCE/plugins/table/merge_cells.htm
new file mode 100644 (file)
index 0000000..d231090
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#table_dlg.merge_cells_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="js/merge_cells.js"></script>\r
+</head>\r
+<body style="margin: 8px" role="application">\r
+<form onsubmit="MergeCellsDialog.merge();return false;" action="#">\r
+       <fieldset>\r
+               <legend>{#table_dlg.merge_cells_title}</legend>\r
+               <table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%">\r
+                       <tr>\r
+                               <td><label for="numcols">{#table_dlg.cols}</label>:</td>\r
+                               <td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td>\r
+                       </tr>\r
+                       <tr>\r
+                               <td><label for="numrows">{#table_dlg.rows}</label>:</td>\r
+                               <td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td>\r
+                       </tr>\r
+               </table>\r
+       </fieldset>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/row.htm b/3.x/src/resources/javascript/TinyMCE/plugins/table/row.htm
new file mode 100644 (file)
index 0000000..1885401
--- /dev/null
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#table_dlg.row_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/row.js"></script>\r
+       <link href="css/row.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body id="tablerow" style="display: none" role="application">\r
+       <form onsubmit="updateAction();return false;" action="#">\r
+               <div class="tabs">\r
+                       <ul>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="general_panel" class="panel current">\r
+                               <fieldset>\r
+                                       <legend>{#table_dlg.general_props}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td><label for="rowtype">{#table_dlg.rowtype}</label></td>\r
+                                                       <td class="col2">\r
+                                                               <select id="rowtype" name="rowtype" class="mceFocus">\r
+                                                                       <option value="thead">{#table_dlg.thead}</option>\r
+                                                                       <option value="tbody">{#table_dlg.tbody}</option>\r
+                                                                       <option value="tfoot">{#table_dlg.tfoot}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="align">{#table_dlg.align}</label></td>\r
+                                                       <td class="col2">\r
+                                                               <select id="align" name="align">\r
+                                                                       <option value="">{#not_set}</option>\r
+                                                                       <option value="center">{#table_dlg.align_middle}</option>\r
+                                                                       <option value="left">{#table_dlg.align_left}</option>\r
+                                                                       <option value="right">{#table_dlg.align_right}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="valign">{#table_dlg.valign}</label></td>\r
+                                                       <td class="col2">\r
+                                                               <select id="valign" name="valign">\r
+                                                                       <option value="">{#not_set}</option>\r
+                                                                       <option value="top">{#table_dlg.align_top}</option>\r
+                                                                       <option value="middle">{#table_dlg.align_middle}</option>\r
+                                                                       <option value="bottom">{#table_dlg.align_bottom}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr id="styleSelectRow">\r
+                                                       <td><label for="class">{#class_name}</label></td>\r
+                                                       <td class="col2">\r
+                                                               <select id="class" name="class" class="mceEditableSelect">\r
+                                                                       <option value="" selected="selected">{#not_set}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="height">{#table_dlg.height}</label></td>\r
+                                                       <td class="col2"><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="advanced_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#table_dlg.advanced_props}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="id">{#table_dlg.id}</label></td> \r
+                                                       <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="style">{#table_dlg.style}</label></td>\r
+                                                       <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> \r
+                                                       <td>\r
+                                                               <select id="dir" name="dir" style="width: 200px"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="ltr">{#table_dlg.ltr}</option> \r
+                                                                               <option value="rtl">{#table_dlg.rtl}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td> \r
+                                                       <td>\r
+                                                               <input id="lang" name="lang" type="text" value="" style="width: 200px" />\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>\r
+                                                                               <td id="backgroundimagebrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td> \r
+                                                       <td>\r
+                                                               <span role="group" aria-labelledby="bgcolor_label">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>\r
+                                                                               <td id="bgcolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                               </span>\r
+                                                       </td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <div>\r
+                               <select id="action" name="action">\r
+                                       <option value="row">{#table_dlg.row_row}</option>\r
+                                       <option value="odd">{#table_dlg.row_odd}</option>\r
+                                       <option value="even">{#table_dlg.row_even}</option>\r
+                                       <option value="all">{#table_dlg.row_all}</option>\r
+                               </select>\r
+                       </div>\r
+\r
+                       <input type="submit" id="insert" name="insert" value="{#update}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/table/table.htm b/3.x/src/resources/javascript/TinyMCE/plugins/table/table.htm
new file mode 100644 (file)
index 0000000..b92fa74
--- /dev/null
@@ -0,0 +1,188 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#table_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/table.js"></script>\r
+       <link href="css/table.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body id="table" style="display: none" role="application" aria-labelledby="app_title">\r
+       <span style="display:none;" id="app_title">{#table_dlg.title}</span>\r
+       <form onsubmit="insertTable();return false;" action="#">\r
+               <div class="tabs">\r
+                       <ul>\r
+                               <li id="general_tab" aria-controls="general_panel" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="general_panel" class="panel current">\r
+                               <fieldset>\r
+                                       <legend>{#table_dlg.general_props}</legend>\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">\r
+                                               <tr>\r
+                                                       <td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>\r
+                                                       <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" aria-required="true" /></td>\r
+                                                       <td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>\r
+                                                       <td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" aria-required="true" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>\r
+                                                       <td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>\r
+                                                       <td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>\r
+                                                       <td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>\r
+                                                       <td><select id="align" name="align">\r
+                                                               <option value="">{#not_set}</option>\r
+                                                               <option value="center">{#table_dlg.align_middle}</option>\r
+                                                               <option value="left">{#table_dlg.align_left}</option>\r
+                                                               <option value="right">{#table_dlg.align_right}</option>\r
+                                                       </select></td>\r
+                                                       <td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>\r
+                                                       <td><input id="border" name="border" type="text" value="" size="3" maxlength="5" onchange="changedBorder();" class="size" /></td>\r
+                                               </tr>\r
+                                               <tr id="width_row">\r
+                                                       <td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>\r
+                                                       <td><input name="width" type="text" id="width" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+                                                       <td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>\r
+                                                       <td><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+                                               </tr>\r
+                                               <tr id="styleSelectRow" >\r
+                                                       <td><label id="classlabel" for="class">{#class_name}</label></td>\r
+                                                       <td colspan="3" >\r
+                                                        <select id="class" name="class" class="mceEditableSelect">\r
+                                                               <option value="" selected="selected">{#not_set}</option>\r
+                                                        </select></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="column1" ><label for="caption">{#table_dlg.caption}</label></td> \r
+                                                       <td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+\r
+                       <div id="advanced_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#table_dlg.advanced_props}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="id">{#table_dlg.id}</label></td> \r
+                                                       <td><input id="id" name="id" type="text" value="" class="advfield" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="summary">{#table_dlg.summary}</label></td> \r
+                                                       <td><input id="summary" name="summary" type="text" value="" class="advfield" /></td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="style">{#table_dlg.style}</label></td>\r
+                                                       <td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td> \r
+                                                       <td>\r
+                                                               <input id="lang" name="lang" type="text" value="" class="advfield" />\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" aria-labelledby="backgroundimage_label" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>\r
+                                                                               <td id="backgroundimagebrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="tframe">{#table_dlg.frame}</label></td> \r
+                                                       <td>\r
+                                                               <select id="tframe" name="tframe" class="advfield"> \r
+                                                                               <option value="">{#not_set}</option>\r
+                                                                               <option value="void">{#table_dlg.rules_void}</option>\r
+                                                                               <option value="above">{#table_dlg.rules_above}</option> \r
+                                                                               <option value="below">{#table_dlg.rules_below}</option> \r
+                                                                               <option value="hsides">{#table_dlg.rules_hsides}</option> \r
+                                                                               <option value="lhs">{#table_dlg.rules_lhs}</option> \r
+                                                                               <option value="rhs">{#table_dlg.rules_rhs}</option> \r
+                                                                               <option value="vsides">{#table_dlg.rules_vsides}</option> \r
+                                                                               <option value="box">{#table_dlg.rules_box}</option> \r
+                                                                               <option value="border">{#table_dlg.rules_border}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="rules">{#table_dlg.rules}</label></td> \r
+                                                       <td>\r
+                                                               <select id="rules" name="rules" class="advfield"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="none">{#table_dlg.frame_none}</option>\r
+                                                                               <option value="groups">{#table_dlg.frame_groups}</option>\r
+                                                                               <option value="rows">{#table_dlg.frame_rows}</option>\r
+                                                                               <option value="cols">{#table_dlg.frame_cols}</option>\r
+                                                                               <option value="all">{#table_dlg.frame_all}</option>\r
+                                                                       </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> \r
+                                                       <td>\r
+                                                               <select id="dir" name="dir" class="advfield"> \r
+                                                                               <option value="">{#not_set}</option> \r
+                                                                               <option value="ltr">{#table_dlg.ltr}</option> \r
+                                                                               <option value="rtl">{#table_dlg.rtl}</option> \r
+                                                               </select>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr role="group" aria-labelledby="bordercolor_label">\r
+                                                       <td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>\r
+                                                                               <td id="bordercolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+\r
+                                               <tr role="group" aria-labelledby="bgcolor_label">\r
+                                                       <td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>\r
+                                                                               <td id="bgcolor_pickcontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td> \r
+                                               </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/blank.htm b/3.x/src/resources/javascript/TinyMCE/plugins/template/blank.htm
new file mode 100644 (file)
index 0000000..ecde53f
--- /dev/null
@@ -0,0 +1,12 @@
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>blank_page</title>\r
+       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
+       <script type="text/javascript">\r
+               parent.TemplateDialog.loadCSSFiles(document);\r
+       </script>\r
+</head>\r
+<body id="mceTemplatePreview" class="mceContentBody">\r
+\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/css/template.css b/3.x/src/resources/javascript/TinyMCE/plugins/template/css/template.css
new file mode 100644 (file)
index 0000000..2d23a49
--- /dev/null
@@ -0,0 +1,23 @@
+#frmbody {\r
+       padding: 10px;\r
+       background-color: #FFF;\r
+       border: 1px solid #CCC;\r
+}\r
+\r
+.frmRow {\r
+       margin-bottom: 10px;\r
+}\r
+\r
+#templatesrc {\r
+       border: none;\r
+       width: 320px;\r
+       height: 240px;\r
+}\r
+\r
+.title {\r
+       padding-bottom: 5px;\r
+}\r
+\r
+.mceActionPanel {\r
+       padding-top: 5px;\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/template/editor_plugin.js
new file mode 100644 (file)
index 0000000..ebe3c27
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TemplatePlugin",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceTemplate",function(e){b.windowManager.open({file:c+"/template.htm",width:b.getParam("template_popup_width",750),height:b.getParam("template_popup_height",600),inline:1},{plugin_url:c})});b.addCommand("mceInsertTemplate",d._insertTemplate,d);b.addButton("template",{title:"template.desc",cmd:"mceTemplate"});b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("div",g.node),function(h){if(f.hasClass(h,"mceTmpl")){a(f.select("*",h),function(i){if(f.hasClass(i,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){i.innerHTML=d._getDateTime(new Date(),e.getParam("template_mdate_format",e.getLang("template.mdate_format")))}});d._replaceVals(h)}})})},getInfo:function(){return{longname:"Template plugin",author:"Moxiecode Systems AB",authorurl:"http://www.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_insertTemplate:function(i,j){var k=this,g=k.editor,f,c,d=g.dom,b=g.selection.getContent();f=j.content;a(k.editor.getParam("template_replace_values"),function(l,h){if(typeof(l)!="function"){f=f.replace(new RegExp("\\{\\$"+h+"\\}","g"),l)}});c=d.create("div",null,f);n=d.select(".mceTmpl",c);if(n&&n.length>0){c=d.create("div",null);c.appendChild(n[0].cloneNode(true))}function e(l,h){return new RegExp("\\b"+h+"\\b","g").test(l.className)}a(d.select("*",c),function(h){if(e(h,g.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_cdate_format",g.getLang("template.cdate_format")))}if(e(h,g.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_mdate_format",g.getLang("template.mdate_format")))}if(e(h,g.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))){h.innerHTML=b}});k._replaceVals(c);g.execCommand("mceInsertContent",false,c.innerHTML);g.addVisual()},_replaceVals:function(c){var d=this.editor.dom,b=this.editor.getParam("template_replace_values");a(d.select("*",c),function(f){a(b,function(g,e){if(d.hasClass(f,e)){if(typeof(b[e])=="function"){b[e](f)}}})})},_getDateTime:function(e,b){if(!b){return""}function c(g,d){var f;g=""+g;if(g.length<d){for(f=0;f<(d-g.length);f++){g="0"+g}}return g}b=b.replace("%D","%m/%d/%y");b=b.replace("%r","%I:%M:%S %p");b=b.replace("%Y",""+e.getFullYear());b=b.replace("%y",""+e.getYear());b=b.replace("%m",c(e.getMonth()+1,2));b=b.replace("%d",c(e.getDate(),2));b=b.replace("%H",""+c(e.getHours(),2));b=b.replace("%M",""+c(e.getMinutes(),2));b=b.replace("%S",""+c(e.getSeconds(),2));b=b.replace("%I",""+((e.getHours()+11)%12+1));b=b.replace("%p",""+(e.getHours()<12?"AM":"PM"));b=b.replace("%B",""+this.editor.getLang("template_months_long").split(",")[e.getMonth()]);b=b.replace("%b",""+this.editor.getLang("template_months_short").split(",")[e.getMonth()]);b=b.replace("%A",""+this.editor.getLang("template_day_long").split(",")[e.getDay()]);b=b.replace("%a",""+this.editor.getLang("template_day_short").split(",")[e.getDay()]);b=b.replace("%%","%");return b}});tinymce.PluginManager.add("template",tinymce.plugins.TemplatePlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/template/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..9cac269
--- /dev/null
@@ -0,0 +1,159 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.plugins.TemplatePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceTemplate', function(ui) {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/template.htm',\r
+                                       width : ed.getParam('template_popup_width', 750),\r
+                                       height : ed.getParam('template_popup_height', 600),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceInsertTemplate', t._insertTemplate, t);\r
+\r
+                       // Register buttons\r
+                       ed.addButton('template', {title : 'template.desc', cmd : 'mceTemplate'});\r
+\r
+                       ed.onPreProcess.add(function(ed, o) {\r
+                               var dom = ed.dom;\r
+\r
+                               each(dom.select('div', o.node), function(e) {\r
+                                       if (dom.hasClass(e, 'mceTmpl')) {\r
+                                               each(dom.select('*', e), function(e) {\r
+                                                       if (dom.hasClass(e, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|')))\r
+                                                               e.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format")));\r
+                                               });\r
+\r
+                                               t._replaceVals(e);\r
+                                       }\r
+                               });\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Template plugin',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://www.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               _insertTemplate : function(ui, v) {\r
+                       var t = this, ed = t.editor, h, el, dom = ed.dom, sel = ed.selection.getContent();\r
+\r
+                       h = v.content;\r
+\r
+                       each(t.editor.getParam('template_replace_values'), function(v, k) {\r
+                               if (typeof(v) != 'function')\r
+                                       h = h.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v);\r
+                       });\r
+\r
+                       el = dom.create('div', null, h);\r
+\r
+                       // Find template element within div\r
+                       n = dom.select('.mceTmpl', el);\r
+                       if (n && n.length > 0) {\r
+                               el = dom.create('div', null);\r
+                               el.appendChild(n[0].cloneNode(true));\r
+                       }\r
+\r
+                       function hasClass(n, c) {\r
+                               return new RegExp('\\b' + c + '\\b', 'g').test(n.className);\r
+                       };\r
+\r
+                       each(dom.select('*', el), function(n) {\r
+                               // Replace cdate\r
+                               if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|')))\r
+                                       n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format")));\r
+\r
+                               // Replace mdate\r
+                               if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|')))\r
+                                       n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format")));\r
+\r
+                               // Replace selection\r
+                               if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|')))\r
+                                       n.innerHTML = sel;\r
+                       });\r
+\r
+                       t._replaceVals(el);\r
+\r
+                       ed.execCommand('mceInsertContent', false, el.innerHTML);\r
+                       ed.addVisual();\r
+               },\r
+\r
+               _replaceVals : function(e) {\r
+                       var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values');\r
+\r
+                       each(dom.select('*', e), function(e) {\r
+                               each(vl, function(v, k) {\r
+                                       if (dom.hasClass(e, k)) {\r
+                                               if (typeof(vl[k]) == 'function')\r
+                                                       vl[k](e);\r
+                                       }\r
+                               });\r
+                       });\r
+               },\r
+\r
+               _getDateTime : function(d, fmt) {\r
+                               if (!fmt)\r
+                                       return "";\r
+\r
+                               function addZeros(value, len) {\r
+                                       var i;\r
+\r
+                                       value = "" + value;\r
+\r
+                                       if (value.length < len) {\r
+                                               for (i=0; i<(len-value.length); i++)\r
+                                                       value = "0" + value;\r
+                                       }\r
+\r
+                                       return value;\r
+                               }\r
+\r
+                               fmt = fmt.replace("%D", "%m/%d/%y");\r
+                               fmt = fmt.replace("%r", "%I:%M:%S %p");\r
+                               fmt = fmt.replace("%Y", "" + d.getFullYear());\r
+                               fmt = fmt.replace("%y", "" + d.getYear());\r
+                               fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));\r
+                               fmt = fmt.replace("%d", addZeros(d.getDate(), 2));\r
+                               fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));\r
+                               fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));\r
+                               fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));\r
+                               fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));\r
+                               fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));\r
+                               fmt = fmt.replace("%B", "" + this.editor.getLang("template_months_long").split(',')[d.getMonth()]);\r
+                               fmt = fmt.replace("%b", "" + this.editor.getLang("template_months_short").split(',')[d.getMonth()]);\r
+                               fmt = fmt.replace("%A", "" + this.editor.getLang("template_day_long").split(',')[d.getDay()]);\r
+                               fmt = fmt.replace("%a", "" + this.editor.getLang("template_day_short").split(',')[d.getDay()]);\r
+                               fmt = fmt.replace("%%", "%");\r
+\r
+                               return fmt;\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/js/template.js b/3.x/src/resources/javascript/TinyMCE/plugins/template/js/template.js
new file mode 100644 (file)
index 0000000..bc3045d
--- /dev/null
@@ -0,0 +1,106 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var TemplateDialog = {\r
+       preInit : function() {\r
+               var url = tinyMCEPopup.getParam("template_external_list_url");\r
+\r
+               if (url != null)\r
+                       document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></sc'+'ript>');\r
+       },\r
+\r
+       init : function() {\r
+               var ed = tinyMCEPopup.editor, tsrc, sel, x, u;\r
+\r
+               tsrc = ed.getParam("template_templates", false);\r
+               sel = document.getElementById('tpath');\r
+\r
+               // Setup external template list\r
+               if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') {\r
+                       for (x=0, tsrc = []; x<tinyMCETemplateList.length; x++)\r
+                               tsrc.push({title : tinyMCETemplateList[x][0], src : tinyMCETemplateList[x][1], description : tinyMCETemplateList[x][2]});\r
+               }\r
+\r
+               for (x=0; x<tsrc.length; x++)\r
+                       sel.options[sel.options.length] = new Option(tsrc[x].title, tinyMCEPopup.editor.documentBaseURI.toAbsolute(tsrc[x].src));\r
+\r
+               this.resize();\r
+               this.tsrc = tsrc;\r
+       },\r
+\r
+       resize : function() {\r
+               var w, h, e;\r
+\r
+               if (!self.innerWidth) {\r
+                       w = document.body.clientWidth - 50;\r
+                       h = document.body.clientHeight - 160;\r
+               } else {\r
+                       w = self.innerWidth - 50;\r
+                       h = self.innerHeight - 170;\r
+               }\r
+\r
+               e = document.getElementById('templatesrc');\r
+\r
+               if (e) {\r
+                       e.style.height = Math.abs(h) + 'px';\r
+                       e.style.width = Math.abs(w - 5) + 'px';\r
+               }\r
+       },\r
+\r
+       loadCSSFiles : function(d) {\r
+               var ed = tinyMCEPopup.editor;\r
+\r
+               tinymce.each(ed.getParam("content_css", '').split(','), function(u) {\r
+                       d.write('<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />');\r
+               });\r
+       },\r
+\r
+       selectTemplate : function(u, ti) {\r
+               var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc;\r
+\r
+               if (!u)\r
+                       return;\r
+\r
+               d.body.innerHTML = this.templateHTML = this.getFileContents(u);\r
+\r
+               for (x=0; x<tsrc.length; x++) {\r
+                       if (tsrc[x].title == ti)\r
+                               document.getElementById('tmpldesc').innerHTML = tsrc[x].description || '';\r
+               }\r
+       },\r
+\r
+       insert : function() {\r
+               tinyMCEPopup.execCommand('mceInsertTemplate', false, {\r
+                       content : this.templateHTML,\r
+                       selection : tinyMCEPopup.editor.selection.getContent()\r
+               });\r
+\r
+               tinyMCEPopup.close();\r
+       },\r
+\r
+       getFileContents : function(u) {\r
+               var x, d, t = 'text/plain';\r
+\r
+               function g(s) {\r
+                       x = 0;\r
+\r
+                       try {\r
+                               x = new ActiveXObject(s);\r
+                       } catch (s) {\r
+                       }\r
+\r
+                       return x;\r
+               };\r
+\r
+               x = window.ActiveXObject ? g('Msxml2.XMLHTTP') || g('Microsoft.XMLHTTP') : new XMLHttpRequest();\r
+\r
+               // Synchronous AJAX load file\r
+               x.overrideMimeType && x.overrideMimeType(t);\r
+               x.open("GET", u, false);\r
+               x.send(null);\r
+\r
+               return x.responseText;\r
+       }\r
+};\r
+\r
+TemplateDialog.preInit();\r
+tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/template/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..83e599d
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.template_dlg',{title:"Templates",label:"Template","desc_label":"Description",desc:"Insert Predefined Template Content",select:"Select a Template",preview:"Preview",warning:"Warning: Updating a template with a different one may cause data loss.","mdate_format":"%Y-%m-%d %H:%M:%S","cdate_format":"%Y-%m-%d %H:%M:%S","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/template/template.htm b/3.x/src/resources/javascript/TinyMCE/plugins/template/template.htm
new file mode 100644 (file)
index 0000000..b2182e6
--- /dev/null
@@ -0,0 +1,31 @@
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#template_dlg.title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/template.js"></script>\r
+       <link href="css/template.css" rel="stylesheet" type="text/css" />\r
+</head>\r
+<body onresize="TemplateDialog.resize();"> \r
+       <form onsubmit="TemplateDialog.insert();return false;">\r
+               <div id="frmbody">\r
+                       <div class="title">{#template_dlg.desc}</div>\r
+                       <div class="frmRow"><label for="tpath" title="{#template_dlg.select}">{#template_dlg.label}:</label>\r
+                       <select id="tpath" name="tpath" onchange="TemplateDialog.selectTemplate(this.options[this.selectedIndex].value, this.options[this.selectedIndex].text);" class="mceFocus">\r
+                               <option value="">{#template_dlg.select}...</option>\r
+                       </select>\r
+                       <span id="warning"></span></div>\r
+                       <div class="frmRow"><label for="tdesc">{#template_dlg.desc_label}:</label>\r
+                       <span id="tmpldesc"></span></div>\r
+                       <fieldset>\r
+                               <legend>{#template_dlg.preview}</legend>\r
+                               <iframe id="templatesrc" name="templatesrc" src="blank.htm" width="690" height="400" frameborder="0"></iframe>\r
+                       </fieldset>\r
+               </div>\r
+               \r
+               <div class="mceActionPanel">\r
+                       <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+                       <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+       </form>\r
+</body> \r
+</html> \r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/css/visualblocks.css b/3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/css/visualblocks.css
new file mode 100644 (file)
index 0000000..76bc92b
--- /dev/null
@@ -0,0 +1,21 @@
+p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, blockquote, address, pre, figure {display: block; padding-top: 10px; border: 1px dashed #BBB; background: transparent no-repeat}\r
+p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, address, pre, figure {margin-left: 3px}\r
+section, article, address, hgroup, aside, figure {margin: 0 0 1em 3px}\r
+\r
+p {background-image: url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7)}\r
+h1 {background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==)}\r
+h2 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==)}\r
+h3 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7)}\r
+h4 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==)}\r
+h5 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==)}\r
+h6 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==)}\r
+div {background-image: url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7)}\r
+section {background-image: url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=)}\r
+article {background-image: url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7)}\r
+blockquote {background-image: url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7)}\r
+address {background-image: url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=)}\r
+pre {background-image: url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==)}\r
+hgroup {background-image: url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7)}\r
+aside {background-image: url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=)}\r
+figure {background-image: url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7)}\r
+figcaption {border: 1px dashed #BBB}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/editor_plugin.js
new file mode 100644 (file)
index 0000000..c65eaf2
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.VisualBlocks",{init:function(a,b){var c;if(!window.NodeList){return}a.addCommand("mceVisualBlocks",function(){var e=a.dom,d;if(!c){c=e.uniqueId();d=e.create("link",{id:c,rel:"stylesheet",href:b+"/css/visualblocks.css"});a.getDoc().getElementsByTagName("head")[0].appendChild(d)}else{d=e.get(c);d.disabled=!d.disabled}a.controlManager.setActive("visualblocks",!d.disabled)});a.addButton("visualblocks",{title:"visualblocks.desc",cmd:"mceVisualBlocks"});a.onInit.add(function(){if(a.settings.visualblocks_default_state){a.execCommand("mceVisualBlocks",false,null,{skip_focus:true})}})},getInfo:function(){return{longname:"Visual blocks",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("visualblocks",tinymce.plugins.VisualBlocks)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/visualblocks/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..b9d2ab2
--- /dev/null
@@ -0,0 +1,63 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2012, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.VisualBlocks', {\r
+               init : function(ed, url) {\r
+                       var cssId;\r
+\r
+                       // We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects\r
+                       if (!window.NodeList) {\r
+                               return;\r
+                       }\r
+\r
+                       ed.addCommand('mceVisualBlocks', function() {\r
+                               var dom = ed.dom, linkElm;\r
+\r
+                               if (!cssId) {\r
+                                       cssId = dom.uniqueId();\r
+                                       linkElm = dom.create('link', {\r
+                                               id: cssId,\r
+                                               rel : 'stylesheet',\r
+                                               href : url + '/css/visualblocks.css'\r
+                                       });\r
+\r
+                                       ed.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);\r
+                               } else {\r
+                                       linkElm = dom.get(cssId);\r
+                                       linkElm.disabled = !linkElm.disabled;\r
+                               }\r
+\r
+                               ed.controlManager.setActive('visualblocks', !linkElm.disabled);\r
+                       });\r
+\r
+                       ed.addButton('visualblocks', {title : 'visualblocks.desc', cmd : 'mceVisualBlocks'});\r
+\r
+                       ed.onInit.add(function() {\r
+                               if (ed.settings.visualblocks_default_state) {\r
+                                       ed.execCommand('mceVisualBlocks', false, null, {skip_focus : true});\r
+                               }\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Visual blocks',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('visualblocks', tinymce.plugins.VisualBlocks);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/visualchars/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/visualchars/editor_plugin.js
new file mode 100644 (file)
index 0000000..1a148e8
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.VisualChars",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceVisualChars",c._toggleVisualChars,c);a.addButton("visualchars",{title:"visualchars.desc",cmd:"mceVisualChars"});a.onBeforeGetContent.add(function(d,e){if(c.state&&e.format!="raw"&&!e.draft){c.state=true;c._toggleVisualChars(false)}})},getInfo:function(){return{longname:"Visual characters",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_toggleVisualChars:function(m){var p=this,k=p.editor,a,g,j,n=k.getDoc(),o=k.getBody(),l,q=k.selection,e,c,f;p.state=!p.state;k.controlManager.setActive("visualchars",p.state);if(m){f=q.getBookmark()}if(p.state){a=[];tinymce.walk(o,function(b){if(b.nodeType==3&&b.nodeValue&&b.nodeValue.indexOf("\u00a0")!=-1){a.push(b)}},"childNodes");for(g=0;g<a.length;g++){l=a[g].nodeValue;l=l.replace(/(\u00a0)/g,'<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');c=k.dom.create("div",null,l);while(node=c.lastChild){k.dom.insertAfter(node,a[g])}k.dom.remove(a[g])}}else{a=k.dom.select("span.mceItemNbsp",o);for(g=a.length-1;g>=0;g--){k.dom.remove(a[g],1)}}q.moveToBookmark(f)}});tinymce.PluginManager.add("visualchars",tinymce.plugins.VisualChars)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/visualchars/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/visualchars/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..df98590
--- /dev/null
@@ -0,0 +1,83 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.VisualChars', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceVisualChars', t._toggleVisualChars, t);\r
+\r
+                       // Register buttons\r
+                       ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'});\r
+\r
+                       ed.onBeforeGetContent.add(function(ed, o) {\r
+                               if (t.state && o.format != 'raw' && !o.draft) {\r
+                                       t.state = true;\r
+                                       t._toggleVisualChars(false);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Visual characters',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _toggleVisualChars : function(bookmark) {\r
+                       var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo, div, bm;\r
+\r
+                       t.state = !t.state;\r
+                       ed.controlManager.setActive('visualchars', t.state);\r
+\r
+                       if (bookmark)\r
+                               bm = s.getBookmark();\r
+\r
+                       if (t.state) {\r
+                               nl = [];\r
+                               tinymce.walk(b, function(n) {\r
+                                       if (n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1)\r
+                                               nl.push(n);\r
+                               }, 'childNodes');\r
+\r
+                               for (i = 0; i < nl.length; i++) {\r
+                                       nv = nl[i].nodeValue;\r
+                                       nv = nv.replace(/(\u00a0)/g, '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');\r
+\r
+                                       div = ed.dom.create('div', null, nv);\r
+                                       while (node = div.lastChild)\r
+                                               ed.dom.insertAfter(node, nl[i]);\r
+\r
+                                       ed.dom.remove(nl[i]);\r
+                               }\r
+                       } else {\r
+                               nl = ed.dom.select('span.mceItemNbsp', b);\r
+\r
+                               for (i = nl.length - 1; i >= 0; i--)\r
+                                       ed.dom.remove(nl[i], 1);\r
+                       }\r
+\r
+                       s.moveToBookmark(bm);\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('visualchars', tinymce.plugins.VisualChars);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/wordcount/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/wordcount/editor_plugin.js
new file mode 100644 (file)
index 0000000..42ece20
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/wordcount/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/wordcount/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..34b2655
--- /dev/null
@@ -0,0 +1,122 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.WordCount', {\r
+               block : 0,\r
+               id : null,\r
+               countre : null,\r
+               cleanre : null,\r
+\r
+               init : function(ed, url) {\r
+                       var t = this, last = 0, VK = tinymce.VK;\r
+\r
+                       t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == &rsquo;\r
+                       t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);\r
+                       t.update_rate = ed.getParam('wordcount_update_rate', 2000);\r
+                       t.update_on_delete = ed.getParam('wordcount_update_on_delete', false);\r
+                       t.id = ed.id + '-word-count';\r
+\r
+                       ed.onPostRender.add(function(ed, cm) {\r
+                               var row, id;\r
+\r
+                               // Add it to the specified id or the theme advanced path\r
+                               id = ed.getParam('wordcount_target_id');\r
+                               if (!id) {\r
+                                       row = tinymce.DOM.get(ed.id + '_path_row');\r
+\r
+                                       if (row)\r
+                                               tinymce.DOM.add(row.parentNode, 'div', {'style': 'float: right'}, ed.getLang('wordcount.words', 'Words: ') + '<span id="' + t.id + '">0</span>');\r
+                               } else {\r
+                                       tinymce.DOM.add(id, 'span', {}, '<span id="' + t.id + '">0</span>');\r
+                               }\r
+                       });\r
+\r
+                       ed.onInit.add(function(ed) {\r
+                               ed.selection.onSetContent.add(function() {\r
+                                       t._count(ed);\r
+                               });\r
+\r
+                               t._count(ed);\r
+                       });\r
+\r
+                       ed.onSetContent.add(function(ed) {\r
+                               t._count(ed);\r
+                       });\r
+\r
+                       function checkKeys(key) {\r
+                               return key !== last && (key === VK.ENTER || last === VK.SPACEBAR || checkDelOrBksp(last));\r
+                       }\r
+\r
+                       function checkDelOrBksp(key) {\r
+                               return key === VK.DELETE || key === VK.BACKSPACE;\r
+                       }\r
+\r
+                       ed.onKeyUp.add(function(ed, e) {\r
+                               if (checkKeys(e.keyCode) || t.update_on_delete && checkDelOrBksp(e.keyCode)) {\r
+                                       t._count(ed);\r
+                               }\r
+\r
+                               last = e.keyCode;\r
+                       });\r
+               },\r
+\r
+               _getCount : function(ed) {\r
+                       var tc = 0;\r
+                       var tx = ed.getContent({ format: 'raw' });\r
+\r
+                       if (tx) {\r
+                                       tx = tx.replace(/\.\.\./g, ' '); // convert ellipses to spaces\r
+                                       tx = tx.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' '); // remove html tags and space chars\r
+\r
+                                       // deal with html entities\r
+                                       tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, ' ');\r
+                                       tx = tx.replace(this.cleanre, ''); // remove numbers and punctuation\r
+\r
+                                       var wordArray = tx.match(this.countre);\r
+                                       if (wordArray) {\r
+                                                       tc = wordArray.length;\r
+                                       }\r
+                       }\r
+\r
+                       return tc;\r
+               },\r
+\r
+               _count : function(ed) {\r
+                       var t = this;\r
+\r
+                       // Keep multiple calls from happening at the same time\r
+                       if (t.block)\r
+                               return;\r
+\r
+                       t.block = 1;\r
+\r
+                       setTimeout(function() {\r
+                               if (!ed.destroyed) {\r
+                                       var tc = t._getCount(ed);\r
+                                       tinymce.DOM.setHTML(t.id, tc.toString());\r
+                                       setTimeout(function() {t.block = 0;}, t.update_rate);\r
+                               }\r
+                       }, 1);\r
+               },\r
+\r
+               getInfo: function() {\r
+                       return {\r
+                               longname : 'Word Count plugin',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       tinymce.PluginManager.add('wordcount', tinymce.plugins.WordCount);\r
+})();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/abbr.htm b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/abbr.htm
new file mode 100644 (file)
index 0000000..30a894f
--- /dev/null
@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#xhtmlxtras_dlg.title_abbr_element}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/element_common.js"></script>\r
+       <script type="text/javascript" src="js/abbr.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
+</head>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_abbr_element}</span>\r
+<form onsubmit="insertAbbr();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> \r
+                                               <td><input id="id" name="id" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="class" name="class" class="field mceEditableSelect">\r
+                                                               <option value="">{#not_set}</option> \r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="dir" name="dir" class="field"> \r
+                                                               <option value="">{#not_set}</option> \r
+                                                               <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> \r
+                                                               <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> \r
+                                                       </select>\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> \r
+                                               <td>\r
+                                                       <input id="lang" name="lang" type="text" value="" class="field" />\r
+                                               </td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+               <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
+\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label for="onfocus">onfocus</label>:</td> \r
+                                               <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onblur">onblur</label>:</td> \r
+                                               <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onclick">onclick</label>:</td> \r
+                                               <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="ondblclick">ondblclick</label>:</td> \r
+                                               <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousedown">onmousedown</label>:</td> \r
+                                               <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseup">onmouseup</label>:</td> \r
+                                               <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseover">onmouseover</label>:</td> \r
+                                               <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousemove">onmousemove</label>:</td> \r
+                                               <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseout">onmouseout</label>:</td> \r
+                                               <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeypress">onkeypress</label>:</td> \r
+                                               <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeydown">onkeydown</label>:</td> \r
+                                               <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeyup">onkeyup</label>:</td> \r
+                                               <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAbbr();" style="display: none;" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/acronym.htm b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/acronym.htm
new file mode 100644 (file)
index 0000000..c109345
--- /dev/null
@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#xhtmlxtras_dlg.title_acronym_element}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/element_common.js"></script>\r
+       <script type="text/javascript" src="js/acronym.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
+</head>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_acronym_element}</span>\r
+<form onsubmit="insertAcronym();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> \r
+                                               <td><input id="id" name="id" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="class" name="class" class="field mceEditableSelect">\r
+                                                               <option value="">{#not_set}</option> \r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="dir" name="dir" class="field"> \r
+                                                               <option value="">{#not_set}</option> \r
+                                                               <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> \r
+                                                               <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> \r
+                                                       </select>\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> \r
+                                               <td>\r
+                                                       <input id="lang" name="lang" type="text" value="" class="field" />\r
+                                               </td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+               <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
+\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label for="onfocus">onfocus</label>:</td> \r
+                                               <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onblur">onblur</label>:</td> \r
+                                               <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onclick">onclick</label>:</td> \r
+                                               <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="ondblclick">ondblclick</label>:</td> \r
+                                               <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousedown">onmousedown</label>:</td> \r
+                                               <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseup">onmouseup</label>:</td> \r
+                                               <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseover">onmouseover</label>:</td> \r
+                                               <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousemove">onmousemove</label>:</td> \r
+                                               <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseout">onmouseout</label>:</td> \r
+                                               <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeypress">onkeypress</label>:</td> \r
+                                               <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeydown">onkeydown</label>:</td> \r
+                                               <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeyup">onkeyup</label>:</td> \r
+                                               <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAcronym();" style="display: none;" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/attributes.htm b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/attributes.htm
new file mode 100644 (file)
index 0000000..e8d606a
--- /dev/null
@@ -0,0 +1,149 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#xhtmlxtras_dlg.attribs_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="js/attributes.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/attributes.css" />\r
+</head>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.attribs_title}</span>\r
+<form onsubmit="insertAction();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_attrib_tab}</a></span></li>\r
+                       <li id="events_tab" aria-controls="events_panel"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_events_tab}</a></span></li>\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.attribute_attrib_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td><input id="title" name="title" type="text" value="" class="mceFocus" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> \r
+                                               <td><input id="id" name="id" type="text" value="" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td><label id="classlabel" for="classlist">{#class_name}</label></td>\r
+                                               <td>\r
+                                                       <select id="classlist" name="classlist" class="mceEditableSelect">\r
+                                                               <option value="" selected="selected">{#not_set}</option>\r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td><input id="style" name="style" type="text" value="" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="dir" name="dir"> \r
+                                                               <option value="">{#not_set}</option> \r
+                                                               <option value="ltr">{#xhtmlxtras_dlg.option_ltr}</option> \r
+                                                               <option value="rtl">{#xhtmlxtras_dlg.option_rtl}</option> \r
+                                                       </select>\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> \r
+                                               <td>\r
+                                                       <input id="lang" name="lang" type="text" value="" />\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                                       <td><label id="tabindexlabel" for="tabindex">{#xhtmlxtras_dlg.attribute_label_tabindex}</label></td>\r
+                                                       <td><input type="text" id="tabindex" name="tabindex" value="" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label id="accesskeylabel" for="accesskey">{#xhtmlxtras_dlg.attribute_label_accesskey}</label></td>\r
+                                                       <td><input type="text" id="accesskey" name="accesskey" value="" /></td>\r
+                                               </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+               <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.attribute_events_tab}</legend>\r
+\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label for="onfocus">onfocus</label>:</td> \r
+                                               <td><input id="onfocus" name="onfocus" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onblur">onblur</label>:</td> \r
+                                               <td><input id="onblur" name="onblur" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onclick">onclick</label>:</td> \r
+                                               <td><input id="onclick" name="onclick" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="ondblclick">ondblclick</label>:</td> \r
+                                               <td><input id="ondblclick" name="ondblclick" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousedown">onmousedown</label>:</td> \r
+                                               <td><input id="onmousedown" name="onmousedown" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseup">onmouseup</label>:</td> \r
+                                               <td><input id="onmouseup" name="onmouseup" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseover">onmouseover</label>:</td> \r
+                                               <td><input id="onmouseover" name="onmouseover" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousemove">onmousemove</label>:</td> \r
+                                               <td><input id="onmousemove" name="onmousemove" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseout">onmouseout</label>:</td> \r
+                                               <td><input id="onmouseout" name="onmouseout" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeypress">onkeypress</label>:</td> \r
+                                               <td><input id="onkeypress" name="onkeypress" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeydown">onkeydown</label>:</td> \r
+                                               <td><input id="onkeydown" name="onkeydown" type="text" value="" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeyup">onkeyup</label>:</td> \r
+                                               <td><input id="onkeyup" name="onkeyup" type="text" value="" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/cite.htm b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/cite.htm
new file mode 100644 (file)
index 0000000..0ac6bdb
--- /dev/null
@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#xhtmlxtras_dlg.title_cite_element}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/element_common.js"></script>\r
+       <script type="text/javascript" src="js/cite.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
+</head>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_cite_element}</span>\r
+<form onsubmit="insertCite();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> \r
+                                               <td><input id="id" name="id" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="class" name="class" class="field mceEditableSelect">\r
+                                                               <option value="">{#not_set}</option> \r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="dir" name="dir" class="field"> \r
+                                                               <option value="">{#not_set}</option> \r
+                                                               <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> \r
+                                                               <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> \r
+                                                       </select>\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> \r
+                                               <td>\r
+                                                       <input id="lang" name="lang" type="text" value="" class="field" />\r
+                                               </td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+               <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
+\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label for="onfocus">onfocus</label>:</td> \r
+                                               <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onblur">onblur</label>:</td> \r
+                                               <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onclick">onclick</label>:</td> \r
+                                               <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="ondblclick">ondblclick</label>:</td> \r
+                                               <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousedown">onmousedown</label>:</td> \r
+                                               <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseup">onmouseup</label>:</td> \r
+                                               <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseover">onmouseover</label>:</td> \r
+                                               <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousemove">onmousemove</label>:</td> \r
+                                               <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseout">onmouseout</label>:</td> \r
+                                               <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeypress">onkeypress</label>:</td> \r
+                                               <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeydown">onkeydown</label>:</td> \r
+                                               <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeyup">onkeyup</label>:</td> \r
+                                               <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeCite();" style="display: none;" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/css/attributes.css b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/css/attributes.css
new file mode 100644 (file)
index 0000000..9a6a235
--- /dev/null
@@ -0,0 +1,11 @@
+.panel_wrapper div.current {\r
+       height: 290px;\r
+}\r
+\r
+#id, #style, #title, #dir, #hreflang, #lang, #classlist, #tabindex, #accesskey {\r
+       width: 200px;\r
+}\r
+\r
+#events_panel input {\r
+       width: 200px;\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/css/popup.css b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/css/popup.css
new file mode 100644 (file)
index 0000000..e67114d
--- /dev/null
@@ -0,0 +1,9 @@
+input.field, select.field {width:200px;}\r
+input.picker {width:179px; margin-left: 5px;}\r
+input.disabled {border-color:#F2F2F2;}\r
+img.picker {vertical-align:text-bottom; cursor:pointer;}\r
+h1 {padding: 0 0 5px 0;}\r
+.panel_wrapper div.current {height:160px;}\r
+#xhtmlxtrasdel .panel_wrapper div.current, #xhtmlxtrasins .panel_wrapper div.current {height: 230px;}\r
+a.browse span {display:block; width:20px; height:20px; background:url('../../../themes/advanced/img/icons.gif') -140px -20px;}\r
+#datetime {width:180px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/del.htm b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/del.htm
new file mode 100644 (file)
index 0000000..5f66751
--- /dev/null
@@ -0,0 +1,162 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#xhtmlxtras_dlg.title_del_element}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/element_common.js"></script>\r
+       <script type="text/javascript" src="js/del.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
+</head>\r
+<body id="xhtmlxtrasins" style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_del_element}</span>\r
+<form onsubmit="insertDel();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td>\r
+                                               <td>\r
+                                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                               <tr> \r
+                                                                       <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td> \r
+                                                                       <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse" role="button" aria-labelledby="datetimelabel"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>\r
+                                                               </tr>\r
+                                                       </table>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td>\r
+                                               <td><input id="cite" name="cite" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td><input id="title" name="title" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> \r
+                                               <td><input id="id" name="id" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="class" name="class" class="field mceEditableSelect">\r
+                                                               <option value="">{#not_set}</option> \r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="dir" name="dir" class="field"> \r
+                                                               <option value="">{#not_set}</option> \r
+                                                               <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> \r
+                                                               <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> \r
+                                                       </select>\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> \r
+                                               <td>\r
+                                                       <input id="lang" name="lang" type="text" value="" class="field" />\r
+                                               </td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+               <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
+\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label for="onfocus">onfocus</label>:</td> \r
+                                               <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onblur">onblur</label>:</td> \r
+                                               <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onclick">onclick</label>:</td> \r
+                                               <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="ondblclick">ondblclick</label>:</td> \r
+                                               <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousedown">onmousedown</label>:</td> \r
+                                               <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseup">onmouseup</label>:</td> \r
+                                               <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseover">onmouseover</label>:</td> \r
+                                               <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousemove">onmousemove</label>:</td> \r
+                                               <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseout">onmouseout</label>:</td> \r
+                                               <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeypress">onkeypress</label>:</td> \r
+                                               <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeydown">onkeydown</label>:</td> \r
+                                               <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeyup">onkeyup</label>:</td> \r
+                                               <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeDel();" style="display: none;" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/editor_plugin.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/editor_plugin.js
new file mode 100644 (file)
index 0000000..9b98a51
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(a,b){a.addCommand("mceCite",function(){a.windowManager.open({file:b+"/cite.htm",width:350+parseInt(a.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAcronym",function(){a.windowManager.open({file:b+"/acronym.htm",width:350+parseInt(a.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.acronym_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAbbr",function(){a.windowManager.open({file:b+"/abbr.htm",width:350+parseInt(a.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.abbr_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceDel",function(){a.windowManager.open({file:b+"/del.htm",width:340+parseInt(a.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(a.getLang("xhtmlxtras.del_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceIns",function(){a.windowManager.open({file:b+"/ins.htm",width:340+parseInt(a.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(a.getLang("xhtmlxtras.ins_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAttributes",function(){a.windowManager.open({file:b+"/attributes.htm",width:380+parseInt(a.getLang("xhtmlxtras.attr_delta_width",0)),height:370+parseInt(a.getLang("xhtmlxtras.attr_delta_height",0)),inline:1},{plugin_url:b})});a.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});a.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});a.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});a.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});a.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});a.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});a.onNodeChange.add(function(d,c,f,e){f=d.dom.getParent(f,"CITE,ACRONYM,ABBR,DEL,INS");c.setDisabled("cite",e);c.setDisabled("acronym",e);c.setDisabled("abbr",e);c.setDisabled("del",e);c.setDisabled("ins",e);c.setDisabled("attribs",f&&f.nodeName=="BODY");c.setActive("cite",0);c.setActive("acronym",0);c.setActive("abbr",0);c.setActive("del",0);c.setActive("ins",0);if(f){do{c.setDisabled(f.nodeName.toLowerCase(),0);c.setActive(f.nodeName.toLowerCase(),1)}while(f=f.parentNode)}});a.onPreInit.add(function(){a.dom.create("abbr")})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/editor_plugin_src.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..f240572
--- /dev/null
@@ -0,0 +1,132 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {\r
+               init : function(ed, url) {\r
+                       // Register commands\r
+                       ed.addCommand('mceCite', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/cite.htm',\r
+                                       width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),\r
+                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceAcronym', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/acronym.htm',\r
+                                       width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),\r
+                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceAbbr', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/abbr.htm',\r
+                                       width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),\r
+                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceDel', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/del.htm',\r
+                                       width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),\r
+                                       height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceIns', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/ins.htm',\r
+                                       width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),\r
+                                       height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       ed.addCommand('mceAttributes', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/attributes.htm',\r
+                                       width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),\r
+                                       height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});\r
+                       ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});\r
+                       ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});\r
+                       ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});\r
+                       ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});\r
+                       ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});\r
+\r
+                       ed.onNodeChange.add(function(ed, cm, n, co) {\r
+                               n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');\r
+\r
+                               cm.setDisabled('cite', co);\r
+                               cm.setDisabled('acronym', co);\r
+                               cm.setDisabled('abbr', co);\r
+                               cm.setDisabled('del', co);\r
+                               cm.setDisabled('ins', co);\r
+                               cm.setDisabled('attribs', n && n.nodeName == 'BODY');\r
+                               cm.setActive('cite', 0);\r
+                               cm.setActive('acronym', 0);\r
+                               cm.setActive('abbr', 0);\r
+                               cm.setActive('del', 0);\r
+                               cm.setActive('ins', 0);\r
+\r
+                               // Activate all\r
+                               if (n) {\r
+                                       do {\r
+                                               cm.setDisabled(n.nodeName.toLowerCase(), 0);\r
+                                               cm.setActive(n.nodeName.toLowerCase(), 1);\r
+                                       } while (n = n.parentNode);\r
+                               }\r
+                       });\r
+\r
+                       ed.onPreInit.add(function() {\r
+                               // Fixed IE issue where it can't handle these elements correctly\r
+                               ed.dom.create('abbr');\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'XHTML Xtras Plugin',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/ins.htm b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/ins.htm
new file mode 100644 (file)
index 0000000..d001ac7
--- /dev/null
@@ -0,0 +1,162 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#xhtmlxtras_dlg.title_ins_element}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
+       <script type="text/javascript" src="js/element_common.js"></script>\r
+       <script type="text/javascript" src="js/ins.js"></script>\r
+       <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
+</head>\r
+<body id="xhtmlxtrasins" style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_ins_element}</span>\r
+<form onsubmit="insertIns();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td> \r
+                                               <td>\r
+                                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                               <tr> \r
+                                                                       <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td> \r
+                                                                       <td ><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse" role="button" aria-labelledby="datetimelabel"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>\r
+                                                               </tr>\r
+                                                       </table>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr >\r
+                                               <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td> \r
+                                               <td><input id="cite" name="cite" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td  class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td><input id="title" name="title" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td> \r
+                                               <td><input id="id" name="id" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="class" name="class" class="field mceEditableSelect">\r
+                                                               <option value="">{#not_set}</option> \r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td> \r
+                                               <td>\r
+                                                       <select id="dir" name="dir" class="field"> \r
+                                                               <option value="">{#not_set}</option> \r
+                                                               <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option> \r
+                                                               <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option> \r
+                                                       </select>\r
+                                               </td> \r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td> \r
+                                               <td>\r
+                                                       <input id="lang" name="lang" type="text" value="" class="field" />\r
+                                               </td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+               <div id="events_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
+\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
+                                       <tr>\r
+                                               <td class="label"><label for="onfocus">onfocus</label>:</td> \r
+                                               <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onblur">onblur</label>:</td> \r
+                                               <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onclick">onclick</label>:</td> \r
+                                               <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="ondblclick">ondblclick</label>:</td> \r
+                                               <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousedown">onmousedown</label>:</td> \r
+                                               <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseup">onmouseup</label>:</td> \r
+                                               <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseover">onmouseover</label>:</td> \r
+                                               <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmousemove">onmousemove</label>:</td> \r
+                                               <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onmouseout">onmouseout</label>:</td> \r
+                                               <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeypress">onkeypress</label>:</td> \r
+                                               <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeydown">onkeydown</label>:</td> \r
+                                               <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+\r
+                                       <tr>\r
+                                               <td class="label"><label for="onkeyup">onkeyup</label>:</td> \r
+                                               <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td> \r
+                                       </tr>\r
+                               </table>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeIns();" style="display: none;" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/abbr.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/abbr.js
new file mode 100644 (file)
index 0000000..4b51a25
--- /dev/null
@@ -0,0 +1,28 @@
+/**\r
+ * abbr.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function init() {\r
+       SXE.initElementDialog('abbr');\r
+       if (SXE.currentAction == "update") {\r
+               SXE.showRemoveButton();\r
+       }\r
+}\r
+\r
+function insertAbbr() {\r
+       SXE.insertElement('abbr');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function removeAbbr() {\r
+       SXE.removeElement('abbr');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/acronym.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/acronym.js
new file mode 100644 (file)
index 0000000..6ec2f88
--- /dev/null
@@ -0,0 +1,28 @@
+/**\r
+ * acronym.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function init() {\r
+       SXE.initElementDialog('acronym');\r
+       if (SXE.currentAction == "update") {\r
+               SXE.showRemoveButton();\r
+       }\r
+}\r
+\r
+function insertAcronym() {\r
+       SXE.insertElement('acronym');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function removeAcronym() {\r
+       SXE.removeElement('acronym');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/attributes.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/attributes.js
new file mode 100644 (file)
index 0000000..9c99995
--- /dev/null
@@ -0,0 +1,111 @@
+/**\r
+ * attributes.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function init() {\r
+       tinyMCEPopup.resizeToInnerSize();\r
+       var inst = tinyMCEPopup.editor;\r
+       var dom = inst.dom;\r
+       var elm = inst.selection.getNode();\r
+       var f = document.forms[0];\r
+       var onclick = dom.getAttrib(elm, 'onclick');\r
+\r
+       setFormValue('title', dom.getAttrib(elm, 'title'));\r
+       setFormValue('id', dom.getAttrib(elm, 'id'));\r
+       setFormValue('style', dom.getAttrib(elm, "style"));\r
+       setFormValue('dir', dom.getAttrib(elm, 'dir'));\r
+       setFormValue('lang', dom.getAttrib(elm, 'lang'));\r
+       setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));\r
+       setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));\r
+       setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));\r
+       setFormValue('onblur', dom.getAttrib(elm, 'onblur'));\r
+       setFormValue('onclick', onclick);\r
+       setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));\r
+       setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));\r
+       setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));\r
+       setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));\r
+       setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));\r
+       setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));\r
+       setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));\r
+       setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));\r
+       setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));\r
+       className = dom.getAttrib(elm, 'class');\r
+\r
+       addClassesToList('classlist', 'advlink_styles');\r
+       selectByValue(f, 'classlist', className, true);\r
+\r
+       TinyMCE_EditableSelects.init();\r
+}\r
+\r
+function setFormValue(name, value) {\r
+       if(value && document.forms[0].elements[name]){\r
+               document.forms[0].elements[name].value = value;\r
+       }\r
+}\r
+\r
+function insertAction() {\r
+       var inst = tinyMCEPopup.editor;\r
+       var elm = inst.selection.getNode();\r
+\r
+       setAllAttribs(elm);\r
+       tinyMCEPopup.execCommand("mceEndUndoLevel");\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function setAttrib(elm, attrib, value) {\r
+       var formObj = document.forms[0];\r
+       var valueElm = formObj.elements[attrib.toLowerCase()];\r
+       var inst = tinyMCEPopup.editor;\r
+       var dom = inst.dom;\r
+\r
+       if (typeof(value) == "undefined" || value == null) {\r
+               value = "";\r
+\r
+               if (valueElm)\r
+                       value = valueElm.value;\r
+       }\r
+\r
+       dom.setAttrib(elm, attrib.toLowerCase(), value);\r
+}\r
+\r
+function setAllAttribs(elm) {\r
+       var f = document.forms[0];\r
+\r
+       setAttrib(elm, 'title');\r
+       setAttrib(elm, 'id');\r
+       setAttrib(elm, 'style');\r
+       setAttrib(elm, 'class', getSelectValue(f, 'classlist'));\r
+       setAttrib(elm, 'dir');\r
+       setAttrib(elm, 'lang');\r
+       setAttrib(elm, 'tabindex');\r
+       setAttrib(elm, 'accesskey');\r
+       setAttrib(elm, 'onfocus');\r
+       setAttrib(elm, 'onblur');\r
+       setAttrib(elm, 'onclick');\r
+       setAttrib(elm, 'ondblclick');\r
+       setAttrib(elm, 'onmousedown');\r
+       setAttrib(elm, 'onmouseup');\r
+       setAttrib(elm, 'onmouseover');\r
+       setAttrib(elm, 'onmousemove');\r
+       setAttrib(elm, 'onmouseout');\r
+       setAttrib(elm, 'onkeypress');\r
+       setAttrib(elm, 'onkeydown');\r
+       setAttrib(elm, 'onkeyup');\r
+\r
+       // Refresh in old MSIE\r
+//     if (tinyMCE.isMSIE5)\r
+//             elm.outerHTML = elm.outerHTML;\r
+}\r
+\r
+function insertAttribute() {\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
+tinyMCEPopup.requireLangPack();\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/cite.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/cite.js
new file mode 100644 (file)
index 0000000..009b715
--- /dev/null
@@ -0,0 +1,28 @@
+/**\r
+ * cite.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function init() {\r
+       SXE.initElementDialog('cite');\r
+       if (SXE.currentAction == "update") {\r
+               SXE.showRemoveButton();\r
+       }\r
+}\r
+\r
+function insertCite() {\r
+       SXE.insertElement('cite');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function removeCite() {\r
+       SXE.removeElement('cite');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/del.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/del.js
new file mode 100644 (file)
index 0000000..1f957dc
--- /dev/null
@@ -0,0 +1,53 @@
+/**\r
+ * del.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function init() {\r
+       SXE.initElementDialog('del');\r
+       if (SXE.currentAction == "update") {\r
+               setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));\r
+               setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));\r
+               SXE.showRemoveButton();\r
+       }\r
+}\r
+\r
+function setElementAttribs(elm) {\r
+       setAllCommonAttribs(elm);\r
+       setAttrib(elm, 'datetime');\r
+       setAttrib(elm, 'cite');\r
+       elm.removeAttribute('data-mce-new');\r
+}\r
+\r
+function insertDel() {\r
+       var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');\r
+\r
+       if (elm == null) {\r
+               var s = SXE.inst.selection.getContent();\r
+               if(s.length > 0) {\r
+                       insertInlineElement('del');\r
+                       var elementArray = SXE.inst.dom.select('del[data-mce-new]');\r
+                       for (var i=0; i<elementArray.length; i++) {\r
+                               var elm = elementArray[i];\r
+                               setElementAttribs(elm);\r
+                       }\r
+               }\r
+       } else {\r
+               setElementAttribs(elm);\r
+       }\r
+       tinyMCEPopup.editor.nodeChanged();\r
+       tinyMCEPopup.execCommand('mceEndUndoLevel');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function removeDel() {\r
+       SXE.removeElement('del');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/element_common.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/element_common.js
new file mode 100644 (file)
index 0000000..4e5d9c3
--- /dev/null
@@ -0,0 +1,229 @@
+/**\r
+ * element_common.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+tinyMCEPopup.requireLangPack();\r
+\r
+function initCommonAttributes(elm) {\r
+       var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;\r
+\r
+       // Setup form data for common element attributes\r
+       setFormValue('title', dom.getAttrib(elm, 'title'));\r
+       setFormValue('id', dom.getAttrib(elm, 'id'));\r
+       selectByValue(formObj, 'class', dom.getAttrib(elm, 'class'), true);\r
+       setFormValue('style', dom.getAttrib(elm, 'style'));\r
+       selectByValue(formObj, 'dir', dom.getAttrib(elm, 'dir'));\r
+       setFormValue('lang', dom.getAttrib(elm, 'lang'));\r
+       setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));\r
+       setFormValue('onblur', dom.getAttrib(elm, 'onblur'));\r
+       setFormValue('onclick', dom.getAttrib(elm, 'onclick'));\r
+       setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));\r
+       setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));\r
+       setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));\r
+       setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));\r
+       setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));\r
+       setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));\r
+       setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));\r
+       setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));\r
+       setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));\r
+}\r
+\r
+function setFormValue(name, value) {\r
+       if(document.forms[0].elements[name]) document.forms[0].elements[name].value = value;\r
+}\r
+\r
+function insertDateTime(id) {\r
+       document.getElementById(id).value = getDateTime(new Date(), "%Y-%m-%dT%H:%M:%S");\r
+}\r
+\r
+function getDateTime(d, fmt) {\r
+       fmt = fmt.replace("%D", "%m/%d/%y");\r
+       fmt = fmt.replace("%r", "%I:%M:%S %p");\r
+       fmt = fmt.replace("%Y", "" + d.getFullYear());\r
+       fmt = fmt.replace("%y", "" + d.getYear());\r
+       fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));\r
+       fmt = fmt.replace("%d", addZeros(d.getDate(), 2));\r
+       fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));\r
+       fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));\r
+       fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));\r
+       fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));\r
+       fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));\r
+       fmt = fmt.replace("%%", "%");\r
+\r
+       return fmt;\r
+}\r
+\r
+function addZeros(value, len) {\r
+       var i;\r
+\r
+       value = "" + value;\r
+\r
+       if (value.length < len) {\r
+               for (i=0; i<(len-value.length); i++)\r
+                       value = "0" + value;\r
+       }\r
+\r
+       return value;\r
+}\r
+\r
+function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {\r
+       if (!form_obj || !form_obj.elements[field_name])\r
+               return;\r
+\r
+       var sel = form_obj.elements[field_name];\r
+\r
+       var found = false;\r
+       for (var i=0; i<sel.options.length; i++) {\r
+               var option = sel.options[i];\r
+\r
+               if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {\r
+                       option.selected = true;\r
+                       found = true;\r
+               } else\r
+                       option.selected = false;\r
+       }\r
+\r
+       if (!found && add_custom && value != '') {\r
+               var option = new Option('Value: ' + value, value);\r
+               option.selected = true;\r
+               sel.options[sel.options.length] = option;\r
+       }\r
+\r
+       return found;\r
+}\r
+\r
+function setAttrib(elm, attrib, value) {\r
+       var formObj = document.forms[0];\r
+       var valueElm = formObj.elements[attrib.toLowerCase()];\r
+       tinyMCEPopup.editor.dom.setAttrib(elm, attrib, value || valueElm.value);\r
+}\r
+\r
+function setAllCommonAttribs(elm) {\r
+       setAttrib(elm, 'title');\r
+       setAttrib(elm, 'id');\r
+       setAttrib(elm, 'class');\r
+       setAttrib(elm, 'style');\r
+       setAttrib(elm, 'dir');\r
+       setAttrib(elm, 'lang');\r
+       /*setAttrib(elm, 'onfocus');\r
+       setAttrib(elm, 'onblur');\r
+       setAttrib(elm, 'onclick');\r
+       setAttrib(elm, 'ondblclick');\r
+       setAttrib(elm, 'onmousedown');\r
+       setAttrib(elm, 'onmouseup');\r
+       setAttrib(elm, 'onmouseover');\r
+       setAttrib(elm, 'onmousemove');\r
+       setAttrib(elm, 'onmouseout');\r
+       setAttrib(elm, 'onkeypress');\r
+       setAttrib(elm, 'onkeydown');\r
+       setAttrib(elm, 'onkeyup');*/\r
+}\r
+\r
+SXE = {\r
+       currentAction : "insert",\r
+       inst : tinyMCEPopup.editor,\r
+       updateElement : null\r
+}\r
+\r
+SXE.focusElement = SXE.inst.selection.getNode();\r
+\r
+SXE.initElementDialog = function(element_name) {\r
+       addClassesToList('class', 'xhtmlxtras_styles');\r
+       TinyMCE_EditableSelects.init();\r
+\r
+       element_name = element_name.toLowerCase();\r
+       var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());\r
+       if (elm != null && elm.nodeName.toUpperCase() == element_name.toUpperCase()) {\r
+               SXE.currentAction = "update";\r
+       }\r
+\r
+       if (SXE.currentAction == "update") {\r
+               initCommonAttributes(elm);\r
+               SXE.updateElement = elm;\r
+       }\r
+\r
+       document.forms[0].insert.value = tinyMCEPopup.getLang(SXE.currentAction, 'Insert', true); \r
+}\r
+\r
+SXE.insertElement = function(element_name) {\r
+       var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()), h, tagName;\r
+\r
+       if (elm == null) {\r
+               var s = SXE.inst.selection.getContent();\r
+               if(s.length > 0) {\r
+                       tagName = element_name;\r
+\r
+                       insertInlineElement(element_name);\r
+                       var elementArray = tinymce.grep(SXE.inst.dom.select(element_name));\r
+                       for (var i=0; i<elementArray.length; i++) {\r
+                               var elm = elementArray[i];\r
+\r
+                               if (SXE.inst.dom.getAttrib(elm, 'data-mce-new')) {\r
+                                       elm.id = '';\r
+                                       elm.setAttribute('id', '');\r
+                                       elm.removeAttribute('id');\r
+                                       elm.removeAttribute('data-mce-new');\r
+\r
+                                       setAllCommonAttribs(elm);\r
+                               }\r
+                       }\r
+               }\r
+       } else {\r
+               setAllCommonAttribs(elm);\r
+       }\r
+       SXE.inst.nodeChanged();\r
+       tinyMCEPopup.execCommand('mceEndUndoLevel');\r
+}\r
+\r
+SXE.removeElement = function(element_name){\r
+       element_name = element_name.toLowerCase();\r
+       elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());\r
+       if(elm && elm.nodeName.toUpperCase() == element_name.toUpperCase()){\r
+               tinyMCE.execCommand('mceRemoveNode', false, elm);\r
+               SXE.inst.nodeChanged();\r
+               tinyMCEPopup.execCommand('mceEndUndoLevel');\r
+       }\r
+}\r
+\r
+SXE.showRemoveButton = function() {\r
+               document.getElementById("remove").style.display = '';\r
+}\r
+\r
+SXE.containsClass = function(elm,cl) {\r
+       return (elm.className.indexOf(cl) > -1) ? true : false;\r
+}\r
+\r
+SXE.removeClass = function(elm,cl) {\r
+       if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) {\r
+               return true;\r
+       }\r
+       var classNames = elm.className.split(" ");\r
+       var newClassNames = "";\r
+       for (var x = 0, cnl = classNames.length; x < cnl; x++) {\r
+               if (classNames[x] != cl) {\r
+                       newClassNames += (classNames[x] + " ");\r
+               }\r
+       }\r
+       elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end\r
+}\r
+\r
+SXE.addClass = function(elm,cl) {\r
+       if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl;\r
+       return true;\r
+}\r
+\r
+function insertInlineElement(en) {\r
+       var ed = tinyMCEPopup.editor, dom = ed.dom;\r
+\r
+       ed.getDoc().execCommand('FontName', false, 'mceinline');\r
+       tinymce.each(dom.select('span,font'), function(n) {\r
+               if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')\r
+                       dom.replace(dom.create(en, {'data-mce-new' : 1}), n, 1);\r
+       });\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/ins.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/js/ins.js
new file mode 100644 (file)
index 0000000..c4addfb
--- /dev/null
@@ -0,0 +1,53 @@
+/**\r
+ * ins.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function init() {\r
+       SXE.initElementDialog('ins');\r
+       if (SXE.currentAction == "update") {\r
+               setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));\r
+               setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));\r
+               SXE.showRemoveButton();\r
+       }\r
+}\r
+\r
+function setElementAttribs(elm) {\r
+       setAllCommonAttribs(elm);\r
+       setAttrib(elm, 'datetime');\r
+       setAttrib(elm, 'cite');\r
+       elm.removeAttribute('data-mce-new');\r
+}\r
+\r
+function insertIns() {\r
+       var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS');\r
+\r
+       if (elm == null) {\r
+               var s = SXE.inst.selection.getContent();\r
+               if(s.length > 0) {\r
+                       insertInlineElement('ins');\r
+                       var elementArray = SXE.inst.dom.select('ins[data-mce-new]');\r
+                       for (var i=0; i<elementArray.length; i++) {\r
+                               var elm = elementArray[i];\r
+                               setElementAttribs(elm);\r
+                       }\r
+               }\r
+       } else {\r
+               setElementAttribs(elm);\r
+       }\r
+       tinyMCEPopup.editor.nodeChanged();\r
+       tinyMCEPopup.execCommand('mceEndUndoLevel');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function removeIns() {\r
+       SXE.removeElement('ins');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/plugins/xhtmlxtras/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..c4569f8
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.xhtmlxtras_dlg',{"attribs_title":"Insert/Edit Attributes","option_rtl":"Right to Left","option_ltr":"Left to Right","insert_date":"Insert Current Date/Time",remove:"Remove","title_cite_element":"Citation Element","title_abbr_element":"Abbreviation Element","title_acronym_element":"Acronym Element","title_del_element":"Deletion Element","title_ins_element":"Insertion Element","fieldset_events_tab":"Element Events","fieldset_attrib_tab":"Element Attributes","fieldset_general_tab":"General Settings","events_tab":"Events","attrib_tab":"Attributes","general_tab":"General","attribute_attrib_tab":"Attributes","attribute_events_tab":"Events","attribute_label_accesskey":"AccessKey","attribute_label_tabindex":"TabIndex","attribute_label_langcode":"Language","attribute_option_rtl":"Right to Left","attribute_option_ltr":"Left to Right","attribute_label_langdir":"Text Direction","attribute_label_datetime":"Date/Time","attribute_label_cite":"Cite","attribute_label_style":"Style","attribute_label_class":"Class","attribute_label_id":"ID","attribute_label_title":"Title"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/about.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/about.htm
new file mode 100644 (file)
index 0000000..7a97cb7
--- /dev/null
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> \r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.about_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="js/about.js"></script>\r
+</head>\r
+<body id="about" style="display: none">\r
+               <div class="tabs">\r
+                       <ul>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>\r
+                               <li id="help_tab" style="display:none" aria-hidden="true" aria-controls="help_panel"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>\r
+                               <li id="plugins_tab" aria-controls="plugins_panel"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>\r
+                       </ul>\r
+               </div>\r
+\r
+               <div class="panel_wrapper">\r
+                       <div id="general_panel" class="panel current">\r
+                               <h3>{#advanced_dlg.about_title}</h3>\r
+                               <p>Version: <span id="version"></span> (<span id="date"></span>)</p>\r
+                               <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>\r
+                               by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>\r
+                               <p>Copyright &copy; 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>\r
+                               <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>\r
+\r
+                               <div id="buttoncontainer">\r
+                                       <a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>\r
+                               </div>\r
+                       </div>\r
+\r
+                       <div id="plugins_panel" class="panel">\r
+                               <div id="pluginscontainer">\r
+                                       <h3>{#advanced_dlg.about_loaded}</h3>\r
+\r
+                                       <div id="plugintablecontainer">\r
+                                       </div>\r
+\r
+                                       <p>&nbsp;</p>\r
+                               </div>\r
+                       </div>\r
+\r
+                       <div id="help_panel" class="panel noscroll" style="overflow: visible;">\r
+                               <div id="iframecontainer"></div>\r
+                       </div>\r
+               </div>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />\r
+               </div>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/anchor.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/anchor.htm
new file mode 100644 (file)
index 0000000..75c93b7
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.anchor_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/anchor.js"></script>\r
+</head>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<form onsubmit="AnchorDialog.update();return false;" action="#">\r
+       <table border="0" cellpadding="4" cellspacing="0" role="presentation">\r
+               <tr>\r
+                       <td colspan="2" class="title" id="app_title">{#advanced_dlg.anchor_title}</td>\r
+               </tr>\r
+               <tr>\r
+                       <td class="nowrap"><label for="anchorName">{#advanced_dlg.anchor_name}:</label></td>\r
+                       <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" aria-required="true" /></td>\r
+               </tr>\r
+       </table>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#update}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/charmap.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/charmap.htm
new file mode 100644 (file)
index 0000000..d4b6bdf
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.charmap_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/charmap.js"></script>\r
+</head>\r
+<body id="charmap" style="display:none" role="application">\r
+<table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">\r
+       <tr>\r
+               <td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>\r
+       </tr>\r
+       <tr>\r
+               <td id="charmapView" rowspan="2" align="left" valign="top">\r
+                       <!-- Chars will be rendered here -->\r
+               </td>\r
+               <td width="100" align="center" valign="top">\r
+                       <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px" role="presentation">\r
+                               <tr>\r
+                                       <td id="codeV">&nbsp;</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td id="codeN">&nbsp;</td>\r
+                               </tr>\r
+                       </table>\r
+               </td>\r
+       </tr>\r
+       <tr>\r
+               <td valign="bottom" style="padding-bottom: 3px;">\r
+                       <table width="100" align="center" border="0" cellpadding="2" cellspacing="0" role="presentation">\r
+                               <tr>\r
+                                       <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeA">HTML-Code</label></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td style="font-size: 1px;">&nbsp;</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeB">NUM-Code</label></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>\r
+                               </tr>\r
+                       </table>\r
+               </td>\r
+       </tr>\r
+       <tr>\r
+               <td colspan="2" id="charmap_usage">{#advanced_dlg.charmap_usage}</td>\r
+       </tr>\r
+       \r
+</table>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/color_picker.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/color_picker.htm
new file mode 100644 (file)
index 0000000..b625531
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.colorpicker_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="js/color_picker.js"></script>\r
+</head>\r
+<body id="colorpicker" style="display: none" role="application" aria-labelledby="app_label">\r
+       <span class="mceVoiceLabel" id="app_label" style="display:none;">{#advanced_dlg.colorpicker_title}</span>\r
+<form onsubmit="insertAction();return false" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="picker_tab" aria-controls="picker_panel" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>\r
+                       <li id="rgb_tab" aria-controls="rgb_panel"><span><a href="javascript:;" onclick="mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>\r
+                       <li id="named_tab" aria-controls="named_panel"><span><a  href="javascript:;" onclick="javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="picker_panel" class="panel current">\r
+                       <fieldset>\r
+                               <legend>{#advanced_dlg.colorpicker_picker_title}</legend>\r
+                               <div id="picker">\r
+                                       <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />\r
+\r
+                                       <div id="light">\r
+                                               <!-- Will be filled with divs -->\r
+                                       </div>\r
+\r
+                                       <br style="clear: both" />\r
+                               </div>\r
+                       </fieldset>\r
+               </div>\r
+\r
+               <div id="rgb_panel" class="panel">\r
+                       <fieldset>\r
+                               <legend id="webcolors_title">{#advanced_dlg.colorpicker_palette_title}</legend>\r
+                               <div id="webcolors">\r
+                                       <!-- Gets filled with web safe colors-->\r
+                               </div>\r
+\r
+                               <br style="clear: both" />\r
+                       </fieldset>\r
+               </div>\r
+\r
+               <div id="named_panel" class="panel">\r
+                       <fieldset id="named_picker_label">\r
+                               <legend id="named_title">{#advanced_dlg.colorpicker_named_title}</legend>\r
+                               <div id="namedcolors" role="listbox" tabindex="0" aria-labelledby="named_picker_label">\r
+                                       <!-- Gets filled with named colors-->\r
+                               </div>\r
+\r
+                               <br style="clear: both" />\r
+\r
+                               <div id="colornamecontainer">\r
+                                       {#advanced_dlg.colorpicker_name} <span id="colorname"></span>\r
+                               </div>\r
+                       </fieldset>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#apply}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();"/>\r
+               <div id="preview_wrapper"><div id="previewblock"><label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" /></div><span id="preview"></span></div>\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/editor_template.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/editor_template.js
new file mode 100644 (file)
index 0000000..9ab712c
--- /dev/null
@@ -0,0 +1 @@
+(function(h){var i=h.DOM,g=h.dom.Event,c=h.extend,f=h.each,a=h.util.Cookie,e,d=h.explode;function b(p,m){var k,l,o=p.dom,j="",n,r;previewStyles=p.settings.preview_styles;if(previewStyles===false){return""}if(!previewStyles){previewStyles="font-family font-size font-weight text-decoration text-transform color background-color"}function q(s){return s.replace(/%(\w+)/g,"")}k=m.block||m.inline||"span";l=o.create(k);f(m.styles,function(t,s){t=q(t);if(t){o.setStyle(l,s,t)}});f(m.attributes,function(t,s){t=q(t);if(t){o.setAttrib(l,s,t)}});f(m.classes,function(s){s=q(s);if(!o.hasClass(l,s)){o.addClass(l,s)}});o.setStyles(l,{position:"absolute",left:-65535});p.getBody().appendChild(l);n=o.getStyle(p.getBody(),"fontSize",true);n=/px$/.test(n)?parseInt(n,10):0;f(previewStyles.split(" "),function(s){var t=o.getStyle(l,s,true);if(s=="background-color"&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)){t=o.getStyle(p.getBody(),s,true);if(o.toHex(t).toLowerCase()=="#ffffff"){return}}if(s=="font-size"){if(/em|%$/.test(t)){if(n===0){return}t=parseFloat(t,10)/(/%$/.test(t)?100:1);t=(t*n)+"px"}}j+=s+":"+t+";"});o.remove(l);return j}h.ThemeManager.requireLangPack("advanced");h.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(k,l){var m=this,n,j,p;m.editor=k;m.url=l;m.onResolveName=new h.util.Dispatcher(this);n=k.settings;k.forcedHighContrastMode=k.settings.detect_highcontrast&&m._isHighContrast();k.settings.skin=k.forcedHighContrastMode?"highcontrast":k.settings.skin;if(!n.theme_advanced_buttons1){n=c({theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap"},n)}m.settings=n=c({theme_advanced_path:true,theme_advanced_toolbar_location:"top",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,readonly:k.settings.readonly},n);if(!n.font_size_style_values){n.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(h.is(n.theme_advanced_font_sizes,"string")){n.font_size_style_values=h.explode(n.font_size_style_values);n.font_size_classes=h.explode(n.font_size_classes||"");p={};k.settings.theme_advanced_font_sizes=n.theme_advanced_font_sizes;f(k.getParam("theme_advanced_font_sizes","","hash"),function(r,q){var o;if(q==r&&r>=1&&r<=7){q=r+" ("+m.sizes[r-1]+"pt)";o=n.font_size_classes[r-1];r=n.font_size_style_values[r-1]||(m.sizes[r-1]+"pt")}if(/^\s*\./.test(r)){o=r.replace(/\./g,"")}p[q]=o?{"class":o}:{fontSize:r}});n.theme_advanced_font_sizes=p}if((j=n.theme_advanced_path_location)&&j!="none"){n.theme_advanced_statusbar_location=n.theme_advanced_path_location}if(n.theme_advanced_statusbar_location=="none"){n.theme_advanced_statusbar_location=0}if(k.settings.content_css!==false){k.contentCSS.push(k.baseURI.toAbsolute(l+"/skins/"+k.settings.skin+"/content.css"))}k.onInit.add(function(){if(!k.settings.readonly){k.onNodeChange.add(m._nodeChanged,m);k.onKeyUp.add(m._updateUndoStatus,m);k.onMouseUp.add(m._updateUndoStatus,m);k.dom.bind(k.dom.getRoot(),"dragend",function(){m._updateUndoStatus(k)})}});k.onSetProgressState.add(function(r,o,s){var t,u=r.id,q;if(o){m.progressTimer=setTimeout(function(){t=r.getContainer();t=t.insertBefore(i.create("DIV",{style:"position:relative"}),t.firstChild);q=i.get(r.id+"_tbl");i.add(t,"div",{id:u+"_blocker","class":"mceBlocker",style:{width:q.clientWidth+2,height:q.clientHeight+2}});i.add(t,"div",{id:u+"_progress","class":"mceProgress",style:{left:q.clientWidth/2,top:q.clientHeight/2}})},s||0)}else{i.remove(u+"_blocker");i.remove(u+"_progress");clearTimeout(m.progressTimer)}});i.loadCSS(n.editor_css?k.documentBaseURI.toAbsolute(n.editor_css):l+"/skins/"+k.settings.skin+"/ui.css");if(n.skin_variant){i.loadCSS(l+"/skins/"+k.settings.skin+"/ui_"+n.skin_variant+".css")}},_isHighContrast:function(){var j,k=i.add(i.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});j=(i.getStyle(k,"background-color",true)+"").toLowerCase().replace(/ /g,"");i.remove(k);return j!="rgb(171,239,86)"&&j!="#abef56"},createControl:function(m,j){var k,l;if(l=j.createControl(m)){return l}switch(m){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((k=this.controls[m])){return j.createButton(m,{title:"advanced."+k[0],cmd:k[1],ui:k[2],value:k[3]})}},execCommand:function(l,k,m){var j=this["_"+l];if(j){j.call(this,k,m);return true}return false},_importClasses:function(l){var j=this.editor,k=j.controlManager.get("styleselect");if(k.getLength()==0){f(j.dom.getClasses(),function(q,m){var p="style_"+m,n;n={inline:"span",attributes:{"class":q["class"]},selector:"*"};j.formatter.register(p,n);k.add(q["class"],p,{style:function(){return b(j,n)}})})}},_createStyleSelect:function(o){var l=this,j=l.editor,k=j.controlManager,m;m=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(q){var r,n=[],p;f(m.items,function(s){n.push(s.value)});j.focus();j.undoManager.add();r=j.formatter.matchAll(n);h.each(r,function(s){if(!q||s==q){if(s){j.formatter.remove(s)}p=true}});if(!p){j.formatter.apply(q)}j.undoManager.add();j.nodeChanged();return false}});j.onPreInit.add(function(){var p=0,n=j.getParam("style_formats");if(n){f(n,function(q){var r,s=0;f(q,function(){s++});if(s>1){r=q.name=q.name||"style_"+(p++);j.formatter.register(r,q);m.add(q.title,r,{style:function(){return b(j,q)}})}else{m.add(q.title)}})}else{f(j.getParam("theme_advanced_styles","","hash"),function(t,s){var r,q;if(t){r="style_"+(p++);q={inline:"span",classes:t,selector:"*"};j.formatter.register(r,q);m.add(l.editor.translate(s),r,{style:function(){return b(j,q)}})}})}});if(m.getLength()==0){m.onPostRender.add(function(p,q){if(!m.NativeListBox){g.add(q.id+"_text","focus",l._importClasses,l);g.add(q.id+"_text","mousedown",l._importClasses,l);g.add(q.id+"_open","focus",l._importClasses,l);g.add(q.id+"_open","mousedown",l._importClasses,l)}else{g.add(q.id,"focus",l._importClasses,l)}})}return m},_createFontSelect:function(){var l,k=this,j=k.editor;l=j.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(m){var n=l.items[l.selectedIndex];if(!m&&n){j.execCommand("FontName",false,n.value);return}j.execCommand("FontName",false,m);l.select(function(o){return m==o});if(n&&n.value==m){l.select(null)}return false}});if(l){f(j.getParam("theme_advanced_fonts",k.settings.theme_advanced_fonts,"hash"),function(n,m){l.add(j.translate(m),n,{style:n.indexOf("dings")==-1?"font-family:"+n:""})})}return l},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(o){var p=n.items[n.selectedIndex];if(!o&&p){p=p.value;if(p["class"]){k.formatter.toggle("fontsize_class",{value:p["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,p.fontSize)}return}if(o["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}n.select(function(q){return o==q});if(p&&(p.value.fontSize==o.fontSize||p.value["class"]&&p.value["class"]==o["class"])){n.select(null)}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(p,o){var q=p.fontSize;if(q>=1&&q<=7){q=m.sizes[parseInt(q)-1]+"pt"}n.add(o,p,{style:"font-size:"+q,"class":"mceFontSize"+(l++)+(" "+(p["class"]||""))})})}return n},_createBlockFormats:function(){var l,j={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},k=this;l=k.editor.controlManager.createListBox("formatselect",{title:"advanced.block",onselect:function(m){k.editor.execCommand("FormatBlock",false,m);return false}});if(l){f(k.editor.getParam("theme_advanced_blockformats",k.settings.theme_advanced_blockformats,"hash"),function(n,m){l.add(k.editor.translate(m!=n?m:j[n]),n,{"class":"mce_formatPreview mce_"+n,style:function(){return b(k.editor,{block:n})}})})}return l},_createForeColorMenu:function(){var n,k=this,l=k.settings,m={},j;if(l.theme_advanced_more_colors){m.more_colors_func=function(){k._mceColorPicker(0,{color:n.value,func:function(o){n.setColor(o)}})}}if(j=l.theme_advanced_text_colors){m.colors=j}if(l.theme_advanced_default_foreground_color){m.default_color=l.theme_advanced_default_foreground_color}m.title="advanced.forecolor_desc";m.cmd="ForeColor";m.scope=this;n=k.editor.controlManager.createColorSplitButton("forecolor",m);return n},_createBackColorMenu:function(){var n,k=this,l=k.settings,m={},j;if(l.theme_advanced_more_colors){m.more_colors_func=function(){k._mceColorPicker(0,{color:n.value,func:function(o){n.setColor(o)}})}}if(j=l.theme_advanced_background_colors){m.colors=j}if(l.theme_advanced_default_background_color){m.default_color=l.theme_advanced_default_background_color}m.title="advanced.backcolor_desc";m.cmd="HiliteColor";m.scope=this;n=k.editor.controlManager.createColorSplitButton("backcolor",m);return n},renderUI:function(l){var q,m,r,w=this,u=w.editor,x=w.settings,v,k,j;if(u.settings){u.settings.aria_label=x.aria_label+u.getLang("advanced.help_shortcut")}q=k=i.create("span",{role:"application","aria-labelledby":u.id+"_voice",id:u.id+"_parent","class":"mceEditor "+u.settings.skin+"Skin"+(x.skin_variant?" "+u.settings.skin+"Skin"+w._ufirst(x.skin_variant):"")+(u.settings.directionality=="rtl"?" mceRtl":"")});i.add(q,"span",{"class":"mceVoiceLabel",style:"display:none;",id:u.id+"_voice"},x.aria_label);if(!i.boxModel){q=i.add(q,"div",{"class":"mceOldBoxModel"})}q=v=i.add(q,"table",{role:"presentation",id:u.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});q=r=i.add(q,"tbody");switch((x.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":m=w._rowLayout(x,r,l);break;case"customlayout":m=u.execCallback("theme_advanced_custom_layout",x,r,l,k);break;default:m=w._simpleLayout(x,r,l,k)}q=l.targetNode;j=v.rows;i.addClass(j[0],"mceFirst");i.addClass(j[j.length-1],"mceLast");f(i.select("tr",r),function(o){i.addClass(o.firstChild,"mceFirst");i.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(i.get(x.theme_advanced_toolbar_container)){i.get(x.theme_advanced_toolbar_container).appendChild(k)}else{i.insertAfter(k,q)}g.add(u.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){w._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return false}});if(!u.getParam("accessibility_focus")){g.add(i.add(k,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(u.id).focus()})}if(x.theme_advanced_toolbar_location=="external"){l.deltaHeight=0}w.deltaHeight=l.deltaHeight;l.targetNode=null;u.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){if(h.isWebKit){window.focus()}w.toolbarGroup.focus();return g.cancel(n)}else{if(n.keyCode===o){i.get(p.id+"_path_row").focus();return g.cancel(n)}}}});u.addShortcut("alt+0","","mceShortcuts",w);return{iframeContainer:m,editorContainer:u.id+"_parent",sizeContainer:v,deltaHeight:l.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:h.majorVersion+"."+h.minorVersion}},resizeBy:function(j,k){var l=i.get(this.editor.id+"_ifr");this.resizeTo(l.clientWidth+j,l.clientHeight+k)},resizeTo:function(j,n,l){var k=this.editor,m=this.settings,o=i.get(k.id+"_tbl"),p=i.get(k.id+"_ifr");j=Math.max(m.theme_advanced_resizing_min_width||100,j);n=Math.max(m.theme_advanced_resizing_min_height||100,n);j=Math.min(m.theme_advanced_resizing_max_width||65535,j);n=Math.min(m.theme_advanced_resizing_max_height||65535,n);i.setStyle(o,"height","");i.setStyle(p,"height",n);if(m.theme_advanced_resize_horizontal){i.setStyle(o,"width","");i.setStyle(p,"width",j);if(j<o.clientWidth){j=o.clientWidth;i.setStyle(p,"width",o.clientWidth)}}if(l&&m.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+k.id+"_size",{cw:j,ch:n})}},destroy:function(){var j=this.editor.id;g.clear(j+"_resize");g.clear(j+"_path_row");g.clear(j+"_external_close")},_simpleLayout:function(z,u,l,j){var y=this,v=y.editor,w=z.theme_advanced_toolbar_location,q=z.theme_advanced_statusbar_location,m,k,r,x;if(z.readonly){m=i.add(u,"tr");m=k=i.add(m,"td",{"class":"mceIframeContainer"});return k}if(w=="top"){y._addToolbars(u,l)}if(w=="external"){m=x=i.create("div",{style:"position:relative"});m=i.add(m,"div",{id:v.id+"_external","class":"mceExternalToolbar"});i.add(m,"a",{id:v.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});m=i.add(m,"table",{id:v.id+"_tblext",cellSpacing:0,cellPadding:0});r=i.add(m,"tbody");if(j.firstChild.className=="mceOldBoxModel"){j.firstChild.appendChild(x)}else{j.insertBefore(x,j.firstChild)}y._addToolbars(r,l);v.onMouseUp.add(function(){var o=i.get(v.id+"_external");i.show(o);i.hide(e);var n=g.add(v.id+"_external_close","click",function(){i.hide(v.id+"_external");g.remove(v.id+"_external_close","click",n);return false});i.show(o);i.setStyle(o,"top",0-i.getRect(v.id+"_tblext").h-1);i.hide(o);i.show(o);o.style.filter="";e=v.id+"_external";o=null})}if(q=="top"){y._addStatusBar(u,l)}if(!z.theme_advanced_toolbar_container){m=i.add(u,"tr");m=k=i.add(m,"td",{"class":"mceIframeContainer"})}if(w=="bottom"){y._addToolbars(u,l)}if(q=="bottom"){y._addStatusBar(u,l)}return k},_rowLayout:function(x,p,l){var w=this,q=w.editor,v,y,j=q.controlManager,m,k,u,r;v=x.theme_advanced_containers_default_class||"";y=x.theme_advanced_containers_default_align||"center";f(d(x.theme_advanced_containers||""),function(s,o){var n=x["theme_advanced_container_"+s]||"";switch(s.toLowerCase()){case"mceeditor":m=i.add(p,"tr");m=k=i.add(m,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":w._addStatusBar(p,l);break;default:r=(x["theme_advanced_container_"+s+"_align"]||y).toLowerCase();r="mce"+w._ufirst(r);m=i.add(i.add(p,"tr"),"td",{"class":"mceToolbar "+(x["theme_advanced_container_"+s+"_class"]||v)+" "+r||y});u=j.createToolbar("toolbar"+o);w._addControls(n,u);i.setHTML(m,u.renderHTML());l.deltaHeight-=x.theme_advanced_row_height}});return k},_addControls:function(k,j){var l=this,m=l.settings,n,o=l.editor.controlManager;if(m.theme_advanced_disable&&!l._disabled){n={};f(d(m.theme_advanced_disable),function(p){n[p]=1});l._disabled=n}else{n=l._disabled}f(d(k),function(q){var p;if(n&&n[q]){return}if(q=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(r){r=l.createControl(r,o);if(r){j.add(r)}});return}p=l.createControl(q,o);if(p){j.add(p)}})},_addToolbars:function(y,k){var B=this,q,p,u=B.editor,C=B.settings,A,j=u.controlManager,w,l,r=[],z,x,m=false;x=j.createToolbarGroup("toolbargroup",{name:u.getLang("advanced.toolbar"),tab_focus_toolbar:u.getParam("theme_advanced_tab_focus_toolbar")});B.toolbarGroup=x;z=C.theme_advanced_toolbar_align.toLowerCase();z="mce"+B._ufirst(z);l=i.add(i.add(y,"tr",{role:"presentation"}),"td",{"class":"mceToolbar "+z,role:"presentation"});for(q=1;(A=C["theme_advanced_buttons"+q]);q++){m=true;p=j.createToolbar("toolbar"+q,{"class":"mceToolbarRow"+q});if(C["theme_advanced_buttons"+q+"_add"]){A+=","+C["theme_advanced_buttons"+q+"_add"]}if(C["theme_advanced_buttons"+q+"_add_before"]){A=C["theme_advanced_buttons"+q+"_add_before"]+","+A}B._addControls(A,p);x.add(p);k.deltaHeight-=C.theme_advanced_row_height}if(!m){k.deltaHeight-=C.theme_advanced_row_height}r.push(x.renderHTML());r.push(i.createHTML("a",{href:"#",accesskey:"z",title:u.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+u.id+"').focus();"},"<!-- IE -->"));i.setHTML(l,r.join(""))},_addStatusBar:function(p,k){var l,w=this,q=w.editor,x=w.settings,j,u,v,m;l=i.add(p,"tr");l=m=i.add(l,"td",{"class":"mceStatusbar"});l=i.add(l,"div",{id:q.id+"_path_row",role:"group","aria-labelledby":q.id+"_path_voice"});if(x.theme_advanced_path){i.add(l,"span",{id:q.id+"_path_voice"},q.translate("advanced.path"));i.add(l,"span",{},": ")}else{i.add(l,"span",{},"&#160;")}if(x.theme_advanced_resizing){i.add(m,"a",{id:q.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize",tabIndex:"-1"});if(x.theme_advanced_resizing_use_cookie){q.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+q.id+"_size"),r=i.get(q.id+"_tbl");if(!n){return}w.resizeTo(n.cw,n.ch)})}q.onPostRender.add(function(){g.add(q.id+"_resize","click",function(n){n.preventDefault()});g.add(q.id+"_resize","mousedown",function(E){var t,r,s,o,D,A,B,G,n,F,y;function z(H){H.preventDefault();n=B+(H.screenX-D);F=G+(H.screenY-A);w.resizeTo(n,F)}function C(H){g.remove(i.doc,"mousemove",t);g.remove(q.getDoc(),"mousemove",r);g.remove(i.doc,"mouseup",s);g.remove(q.getDoc(),"mouseup",o);n=B+(H.screenX-D);F=G+(H.screenY-A);w.resizeTo(n,F,true);q.nodeChanged()}E.preventDefault();D=E.screenX;A=E.screenY;y=i.get(w.editor.id+"_ifr");B=n=y.clientWidth;G=F=y.clientHeight;t=g.add(i.doc,"mousemove",z);r=g.add(q.getDoc(),"mousemove",z);s=g.add(i.doc,"mouseup",C);o=g.add(q.getDoc(),"mouseup",C)})})}k.deltaHeight-=21;l=p=null},_updateUndoStatus:function(k){var j=k.controlManager,l=k.undoManager;j.setDisabled("undo",!l.hasUndo()&&!l.typing);j.setDisabled("redo",!l.hasRedo())},_nodeChanged:function(o,u,E,r,F){var z=this,D,G=0,y,H,A=z.settings,x,l,w,C,m,k,j;h.each(z.stateControls,function(n){u.setActive(n,o.queryCommandState(z.controls[n][1]))});function q(p){var s,n=F.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s<n.length;s++){if(t(n[s])){return n[s]}}}u.setActive("visualaid",o.hasVisual);z._updateUndoStatus(o);u.setDisabled("outdent",!o.queryCommandState("Outdent"));D=q("A");if(H=u.get("link")){H.setDisabled((!D&&r)||(D&&!D.href));H.setActive(!!D&&(!D.name&&!D.id))}if(H=u.get("unlink")){H.setDisabled(!D&&r);H.setActive(!!D&&!D.name&&!D.id)}if(H=u.get("anchor")){H.setActive(!r&&!!D&&(D.name||(D.id&&!D.href)))}D=q("IMG");if(H=u.get("image")){H.setActive(!r&&!!D&&E.className.indexOf("mceItem")==-1)}if(H=u.get("styleselect")){z._importClasses();k=[];f(H.items,function(n){k.push(n.value)});j=o.formatter.matchAll(k);H.select(j[0]);h.each(j,function(p,n){if(n>0){H.mark(p)}})}if(H=u.get("formatselect")){D=q(o.dom.isBlock);if(D){H.select(D.nodeName.toLowerCase())}}q(function(p){if(p.nodeName==="SPAN"){if(!x&&p.className){x=p.className}}if(o.dom.is(p,A.theme_advanced_font_selector)){if(!l&&p.style.fontSize){l=p.style.fontSize}if(!w&&p.style.fontFamily){w=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}if(!C&&p.style.color){C=p.style.color}if(!m&&p.style.backgroundColor){m=p.style.backgroundColor}}return false});if(H=u.get("fontselect")){H.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==w})}if(H=u.get("fontsizeselect")){if(A.theme_advanced_runtime_fontsize&&!l&&!x){l=o.dom.getStyle(E,"fontSize",true)}H.select(function(n){if(n.fontSize&&n.fontSize===l){return true}if(n["class"]&&n["class"]===x){return true}})}if(A.theme_advanced_show_current_color){function B(p,n){if(H=u.get(p)){if(!n){n=H.settings.default_color}if(n!==H.value){H.displayColor(n)}}}B("forecolor",C);B("backcolor",m)}if(A.theme_advanced_show_current_color){function B(p,n){if(H=u.get(p)){if(!n){n=H.settings.default_color}if(n!==H.value){H.displayColor(n)}}}B("forecolor",C);B("backcolor",m)}if(A.theme_advanced_path&&A.theme_advanced_statusbar_location){D=i.get(o.id+"_path")||i.add(o.id+"_path_row","span",{id:o.id+"_path"});if(z.statusKeyboardNavigation){z.statusKeyboardNavigation.destroy();z.statusKeyboardNavigation=null}i.setHTML(D,"");q(function(I){var p=I.nodeName.toLowerCase(),s,v,t="";if(I.nodeType!=1||p==="br"||I.getAttribute("data-mce-bogus")||i.hasClass(I,"mceItemHidden")||i.hasClass(I,"mceItemRemoved")){return}if(h.isIE&&I.scopeName!=="HTML"&&I.scopeName){p=I.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(y=i.getAttrib(I,"src")){t+="src: "+y+" "}break;case"a":if(y=i.getAttrib(I,"name")){t+="name: "+y+" ";p+="#"+y}if(y=i.getAttrib(I,"href")){t+="href: "+y+" "}break;case"font":if(y=i.getAttrib(I,"face")){t+="font: "+y+" "}if(y=i.getAttrib(I,"size")){t+="size: "+y+" "}if(y=i.getAttrib(I,"color")){t+="color: "+y+" "}break;case"span":if(y=i.getAttrib(I,"style")){t+="style: "+y+" "}break}if(y=i.getAttrib(I,"id")){t+="id: "+y+" "}if(y=I.className){y=y.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(y){t+="class: "+y+" ";if(o.dom.isBlock(I)||p=="img"||p=="span"){p+="."+y}}}p=p.replace(/(html:)/g,"");p={name:p,node:I,title:t};z.onResolveName.dispatch(z,p);t=p.title;p=p.name;v=i.create("a",{href:"javascript:;",role:"button",onmousedown:"return false;",title:t,"class":"mcePath_"+(G++)},p);if(D.hasChildNodes()){D.insertBefore(i.create("span",{"aria-hidden":"true"},"\u00a0\u00bb "),D.firstChild);D.insertBefore(v,D.firstChild)}else{D.appendChild(v)}},o.getBody());if(i.select("a",D).length>0){z.statusKeyboardNavigation=new h.ui.KeyboardNavigation({root:o.id+"_path_row",items:i.select("a",D),excludeFromTabOrder:true,onCancel:function(){o.focus()}},i)}}},_sel:function(j){this.editor.execCommand("mceSelectNodeDepth",false,j)},_mceInsertAnchor:function(l,k){var j=this.editor;j.windowManager.open({url:this.url+"/anchor.htm",width:320+parseInt(j.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(j.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var j=this.editor;j.windowManager.open({url:this.url+"/charmap.htm",width:550+parseInt(j.getLang("advanced.charmap_delta_width",0)),height:265+parseInt(j.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var j=this.editor;j.windowManager.open({url:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var j=this.editor;j.windowManager.open({url:this.url+"/shortcuts.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(l,k){var j=this.editor;k=k||{};j.windowManager.open({url:this.url+"/color_picker.htm",width:375+parseInt(j.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(j.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:k.color,func:k.func,theme_url:this.url})},_mceCodeEditor:function(k,l){var j=this.editor;j.windowManager.open({url:this.url+"/source_editor.htm",width:parseInt(j.getParam("theme_advanced_source_editor_width",720)),height:parseInt(j.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(k,l){var j=this.editor;if(j.dom.getAttrib(j.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}j.windowManager.open({url:this.url+"/image.htm",width:355+parseInt(j.getLang("advanced.image_delta_width",0)),height:275+parseInt(j.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(k,l){var j=this.editor;j.windowManager.open({url:this.url+"/link.htm",width:310+parseInt(j.getLang("advanced.link_delta_width",0)),height:200+parseInt(j.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var j=this.editor;j.windowManager.confirm("advanced.newdocument",function(k){if(k){j.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var j=this;this._mceColorPicker(0,{color:j.fgColor,func:function(k){j.fgColor=k;j.editor.execCommand("ForeColor",false,k)}})},_mceBackColor:function(){var j=this;this._mceColorPicker(0,{color:j.bgColor,func:function(k){j.bgColor=k;j.editor.execCommand("HiliteColor",false,k)}})},_ufirst:function(j){return j.substring(0,1).toUpperCase()+j.substring(1)}});h.ThemeManager.add("advanced",h.themes.AdvancedTheme)}(tinymce));
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/editor_template_src.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/editor_template_src.js
new file mode 100644 (file)
index 0000000..afd722d
--- /dev/null
@@ -0,0 +1,1490 @@
+/**\r
+ * editor_template_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;\r
+\r
+       // Generates a preview for a format\r
+       function getPreviewCss(ed, fmt) {\r
+               var name, previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;\r
+\r
+               previewStyles = ed.settings.preview_styles;\r
+\r
+               // No preview forced\r
+               if (previewStyles === false)\r
+                       return '';\r
+\r
+               // Default preview\r
+               if (!previewStyles)\r
+                       previewStyles = 'font-family font-size font-weight text-decoration text-transform color background-color';\r
+\r
+               // Removes any variables since these can't be previewed\r
+               function removeVars(val) {\r
+                       return val.replace(/%(\w+)/g, '');\r
+               };\r
+\r
+               // Create block/inline element to use for preview\r
+               name = fmt.block || fmt.inline || 'span';\r
+               previewElm = dom.create(name);\r
+\r
+               // Add format styles to preview element\r
+               each(fmt.styles, function(value, name) {\r
+                       value = removeVars(value);\r
+\r
+                       if (value)\r
+                               dom.setStyle(previewElm, name, value);\r
+               });\r
+\r
+               // Add attributes to preview element\r
+               each(fmt.attributes, function(value, name) {\r
+                       value = removeVars(value);\r
+\r
+                       if (value)\r
+                               dom.setAttrib(previewElm, name, value);\r
+               });\r
+\r
+               // Add classes to preview element\r
+               each(fmt.classes, function(value) {\r
+                       value = removeVars(value);\r
+\r
+                       if (!dom.hasClass(previewElm, value))\r
+                               dom.addClass(previewElm, value);\r
+               });\r
+\r
+               // Add the previewElm outside the visual area\r
+               dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF});\r
+               ed.getBody().appendChild(previewElm);\r
+\r
+               // Get parent container font size so we can compute px values out of em/% for older IE:s\r
+               parentFontSize = dom.getStyle(ed.getBody(), 'fontSize', true);\r
+               parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;\r
+\r
+               each(previewStyles.split(' '), function(name) {\r
+                       var value = dom.getStyle(previewElm, name, true);\r
+\r
+                       // If background is transparent then check if the body has a background color we can use\r
+                       if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) {\r
+                               value = dom.getStyle(ed.getBody(), name, true);\r
+\r
+                               // Ignore white since it's the default color, not the nicest fix\r
+                               if (dom.toHex(value).toLowerCase() == '#ffffff') {\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       // Old IE won't calculate the font size so we need to do that manually\r
+                       if (name == 'font-size') {\r
+                               if (/em|%$/.test(value)) {\r
+                                       if (parentFontSize === 0) {\r
+                                               return;\r
+                                       }\r
+\r
+                                       // Convert font size from em/% to px\r
+                                       value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1);\r
+                                       value = (value * parentFontSize) + 'px';\r
+                               }\r
+                       }\r
+\r
+                       previewCss += name + ':' + value + ';';\r
+               });\r
+\r
+               dom.remove(previewElm);\r
+\r
+               return previewCss;\r
+       };\r
+\r
+       // Tell it to load theme specific language pack(s)\r
+       tinymce.ThemeManager.requireLangPack('advanced');\r
+\r
+       tinymce.create('tinymce.themes.AdvancedTheme', {\r
+               sizes : [8, 10, 12, 14, 18, 24, 36],\r
+\r
+               // Control name lookup, format: title, command\r
+               controls : {\r
+                       bold : ['bold_desc', 'Bold'],\r
+                       italic : ['italic_desc', 'Italic'],\r
+                       underline : ['underline_desc', 'Underline'],\r
+                       strikethrough : ['striketrough_desc', 'Strikethrough'],\r
+                       justifyleft : ['justifyleft_desc', 'JustifyLeft'],\r
+                       justifycenter : ['justifycenter_desc', 'JustifyCenter'],\r
+                       justifyright : ['justifyright_desc', 'JustifyRight'],\r
+                       justifyfull : ['justifyfull_desc', 'JustifyFull'],\r
+                       bullist : ['bullist_desc', 'InsertUnorderedList'],\r
+                       numlist : ['numlist_desc', 'InsertOrderedList'],\r
+                       outdent : ['outdent_desc', 'Outdent'],\r
+                       indent : ['indent_desc', 'Indent'],\r
+                       cut : ['cut_desc', 'Cut'],\r
+                       copy : ['copy_desc', 'Copy'],\r
+                       paste : ['paste_desc', 'Paste'],\r
+                       undo : ['undo_desc', 'Undo'],\r
+                       redo : ['redo_desc', 'Redo'],\r
+                       link : ['link_desc', 'mceLink'],\r
+                       unlink : ['unlink_desc', 'unlink'],\r
+                       image : ['image_desc', 'mceImage'],\r
+                       cleanup : ['cleanup_desc', 'mceCleanup'],\r
+                       help : ['help_desc', 'mceHelp'],\r
+                       code : ['code_desc', 'mceCodeEditor'],\r
+                       hr : ['hr_desc', 'InsertHorizontalRule'],\r
+                       removeformat : ['removeformat_desc', 'RemoveFormat'],\r
+                       sub : ['sub_desc', 'subscript'],\r
+                       sup : ['sup_desc', 'superscript'],\r
+                       forecolor : ['forecolor_desc', 'ForeColor'],\r
+                       forecolorpicker : ['forecolor_desc', 'mceForeColor'],\r
+                       backcolor : ['backcolor_desc', 'HiliteColor'],\r
+                       backcolorpicker : ['backcolor_desc', 'mceBackColor'],\r
+                       charmap : ['charmap_desc', 'mceCharMap'],\r
+                       visualaid : ['visualaid_desc', 'mceToggleVisualAid'],\r
+                       anchor : ['anchor_desc', 'mceInsertAnchor'],\r
+                       newdocument : ['newdocument_desc', 'mceNewDocument'],\r
+                       blockquote : ['blockquote_desc', 'mceBlockQuote']\r
+               },\r
+\r
+               stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],\r
+\r
+               init : function(ed, url) {\r
+                       var t = this, s, v, o;\r
+       \r
+                       t.editor = ed;\r
+                       t.url = url;\r
+                       t.onResolveName = new tinymce.util.Dispatcher(this);\r
+                       s = ed.settings;\r
+\r
+                       ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();\r
+                       ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;\r
+\r
+                       // Setup default buttons\r
+                       if (!s.theme_advanced_buttons1) {\r
+                               s = extend({\r
+                                       theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",\r
+                                       theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",\r
+                                       theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap"\r
+                               }, s);\r
+                       }\r
+       \r
+                       // Default settings\r
+                       t.settings = s = extend({\r
+                               theme_advanced_path : true,\r
+                               theme_advanced_toolbar_location : 'top',\r
+                               theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",\r
+                               theme_advanced_toolbar_align : "left",\r
+                               theme_advanced_statusbar_location : "bottom",\r
+                               theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",\r
+                               theme_advanced_more_colors : 1,\r
+                               theme_advanced_row_height : 23,\r
+                               theme_advanced_resize_horizontal : 1,\r
+                               theme_advanced_resizing_use_cookie : 1,\r
+                               theme_advanced_font_sizes : "1,2,3,4,5,6,7",\r
+                               theme_advanced_font_selector : "span",\r
+                               theme_advanced_show_current_color: 0,\r
+                               readonly : ed.settings.readonly\r
+                       }, s);\r
+\r
+                       // Setup default font_size_style_values\r
+                       if (!s.font_size_style_values)\r
+                               s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";\r
+\r
+                       if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {\r
+                               s.font_size_style_values = tinymce.explode(s.font_size_style_values);\r
+                               s.font_size_classes = tinymce.explode(s.font_size_classes || '');\r
+\r
+                               // Parse string value\r
+                               o = {};\r
+                               ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;\r
+                               each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {\r
+                                       var cl;\r
+\r
+                                       if (k == v && v >= 1 && v <= 7) {\r
+                                               k = v + ' (' + t.sizes[v - 1] + 'pt)';\r
+                                               cl = s.font_size_classes[v - 1];\r
+                                               v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');\r
+                                       }\r
+\r
+                                       if (/^\s*\./.test(v))\r
+                                               cl = v.replace(/\./g, '');\r
+\r
+                                       o[k] = cl ? {'class' : cl} : {fontSize : v};\r
+                               });\r
+\r
+                               s.theme_advanced_font_sizes = o;\r
+                       }\r
+\r
+                       if ((v = s.theme_advanced_path_location) && v != 'none')\r
+                               s.theme_advanced_statusbar_location = s.theme_advanced_path_location;\r
+\r
+                       if (s.theme_advanced_statusbar_location == 'none')\r
+                               s.theme_advanced_statusbar_location = 0;\r
+\r
+                       if (ed.settings.content_css !== false)\r
+                               ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));\r
+\r
+                       // Init editor\r
+                       ed.onInit.add(function() {\r
+                               if (!ed.settings.readonly) {\r
+                                       ed.onNodeChange.add(t._nodeChanged, t);\r
+                                       ed.onKeyUp.add(t._updateUndoStatus, t);\r
+                                       ed.onMouseUp.add(t._updateUndoStatus, t);\r
+                                       ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {\r
+                                               t._updateUndoStatus(ed);\r
+                                       });\r
+                               }\r
+                       });\r
+\r
+                       ed.onSetProgressState.add(function(ed, b, ti) {\r
+                               var co, id = ed.id, tb;\r
+\r
+                               if (b) {\r
+                                       t.progressTimer = setTimeout(function() {\r
+                                               co = ed.getContainer();\r
+                                               co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);\r
+                                               tb = DOM.get(ed.id + '_tbl');\r
+\r
+                                               DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});\r
+                                               DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});\r
+                                       }, ti || 0);\r
+                               } else {\r
+                                       DOM.remove(id + '_blocker');\r
+                                       DOM.remove(id + '_progress');\r
+                                       clearTimeout(t.progressTimer);\r
+                               }\r
+                       });\r
+\r
+                       DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");\r
+\r
+                       if (s.skin_variant)\r
+                               DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");\r
+               },\r
+\r
+               _isHighContrast : function() {\r
+                       var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});\r
+\r
+                       actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');\r
+                       DOM.remove(div);\r
+\r
+                       return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';\r
+               },\r
+\r
+               createControl : function(n, cf) {\r
+                       var cd, c;\r
+\r
+                       if (c = cf.createControl(n))\r
+                               return c;\r
+\r
+                       switch (n) {\r
+                               case "styleselect":\r
+                                       return this._createStyleSelect();\r
+\r
+                               case "formatselect":\r
+                                       return this._createBlockFormats();\r
+\r
+                               case "fontselect":\r
+                                       return this._createFontSelect();\r
+\r
+                               case "fontsizeselect":\r
+                                       return this._createFontSizeSelect();\r
+\r
+                               case "forecolor":\r
+                                       return this._createForeColorMenu();\r
+\r
+                               case "backcolor":\r
+                                       return this._createBackColorMenu();\r
+                       }\r
+\r
+                       if ((cd = this.controls[n]))\r
+                               return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});\r
+               },\r
+\r
+               execCommand : function(cmd, ui, val) {\r
+                       var f = this['_' + cmd];\r
+\r
+                       if (f) {\r
+                               f.call(this, ui, val);\r
+                               return true;\r
+                       }\r
+\r
+                       return false;\r
+               },\r
+\r
+               _importClasses : function(e) {\r
+                       var ed = this.editor, ctrl = ed.controlManager.get('styleselect');\r
+\r
+                       if (ctrl.getLength() == 0) {\r
+                               each(ed.dom.getClasses(), function(o, idx) {\r
+                                       var name = 'style_' + idx, fmt;\r
+\r
+                                       fmt = {\r
+                                               inline : 'span',\r
+                                               attributes : {'class' : o['class']},\r
+                                               selector : '*'\r
+                                       };\r
+\r
+                                       ed.formatter.register(name, fmt);\r
+\r
+                                       ctrl.add(o['class'], name, {\r
+                                               style: function() {\r
+                                                       return getPreviewCss(ed, fmt);\r
+                                               }\r
+                                       });\r
+                               });\r
+                       }\r
+               },\r
+\r
+               _createStyleSelect : function(n) {\r
+                       var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;\r
+\r
+                       // Setup style select box\r
+                       ctrl = ctrlMan.createListBox('styleselect', {\r
+                               title : 'advanced.style_select',\r
+                               onselect : function(name) {\r
+                                       var matches, formatNames = [], removedFormat;\r
+\r
+                                       each(ctrl.items, function(item) {\r
+                                               formatNames.push(item.value);\r
+                                       });\r
+\r
+                                       ed.focus();\r
+                                       ed.undoManager.add();\r
+\r
+                                       // Toggle off the current format(s)\r
+                                       matches = ed.formatter.matchAll(formatNames);\r
+                                       tinymce.each(matches, function(match) {\r
+                                               if (!name || match == name) {\r
+                                                       if (match)\r
+                                                               ed.formatter.remove(match);\r
+\r
+                                                       removedFormat = true;\r
+                                               }\r
+                                       });\r
+\r
+                                       if (!removedFormat)\r
+                                               ed.formatter.apply(name);\r
+\r
+                                       ed.undoManager.add();\r
+                                       ed.nodeChanged();\r
+\r
+                                       return false; // No auto select\r
+                               }\r
+                       });\r
+\r
+                       // Handle specified format\r
+                       ed.onPreInit.add(function() {\r
+                               var counter = 0, formats = ed.getParam('style_formats');\r
+\r
+                               if (formats) {\r
+                                       each(formats, function(fmt) {\r
+                                               var name, keys = 0;\r
+\r
+                                               each(fmt, function() {keys++;});\r
+\r
+                                               if (keys > 1) {\r
+                                                       name = fmt.name = fmt.name || 'style_' + (counter++);\r
+                                                       ed.formatter.register(name, fmt);\r
+                                                       ctrl.add(fmt.title, name, {\r
+                                                               style: function() {\r
+                                                                       return getPreviewCss(ed, fmt);\r
+                                                               }\r
+                                                       });\r
+                                               } else\r
+                                                       ctrl.add(fmt.title);\r
+                                       });\r
+                               } else {\r
+                                       each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {\r
+                                               var name, fmt;\r
+\r
+                                               if (val) {\r
+                                                       name = 'style_' + (counter++);\r
+                                                       fmt = {\r
+                                                               inline : 'span',\r
+                                                               classes : val,\r
+                                                               selector : '*'\r
+                                                       };\r
+\r
+                                                       ed.formatter.register(name, fmt);\r
+                                                       ctrl.add(t.editor.translate(key), name, {\r
+                                                               style: function() {\r
+                                                                       return getPreviewCss(ed, fmt);\r
+                                                               }\r
+                                                       });\r
+                                               }\r
+                                       });\r
+                               }\r
+                       });\r
+\r
+                       // Auto import classes if the ctrl box is empty\r
+                       if (ctrl.getLength() == 0) {\r
+                               ctrl.onPostRender.add(function(ed, n) {\r
+                                       if (!ctrl.NativeListBox) {\r
+                                               Event.add(n.id + '_text', 'focus', t._importClasses, t);\r
+                                               Event.add(n.id + '_text', 'mousedown', t._importClasses, t);\r
+                                               Event.add(n.id + '_open', 'focus', t._importClasses, t);\r
+                                               Event.add(n.id + '_open', 'mousedown', t._importClasses, t);\r
+                                       } else\r
+                                               Event.add(n.id, 'focus', t._importClasses, t);\r
+                               });\r
+                       }\r
+\r
+                       return ctrl;\r
+               },\r
+\r
+               _createFontSelect : function() {\r
+                       var c, t = this, ed = t.editor;\r
+\r
+                       c = ed.controlManager.createListBox('fontselect', {\r
+                               title : 'advanced.fontdefault',\r
+                               onselect : function(v) {\r
+                                       var cur = c.items[c.selectedIndex];\r
+\r
+                                       if (!v && cur) {\r
+                                               ed.execCommand('FontName', false, cur.value);\r
+                                               return;\r
+                                       }\r
+\r
+                                       ed.execCommand('FontName', false, v);\r
+\r
+                                       // Fake selection, execCommand will fire a nodeChange and update the selection\r
+                                       c.select(function(sv) {\r
+                                               return v == sv;\r
+                                       });\r
+\r
+                                       if (cur && cur.value == v) {\r
+                                               c.select(null);\r
+                                       }\r
+\r
+                                       return false; // No auto select\r
+                               }\r
+                       });\r
+\r
+                       if (c) {\r
+                               each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {\r
+                                       c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});\r
+                               });\r
+                       }\r
+\r
+                       return c;\r
+               },\r
+\r
+               _createFontSizeSelect : function() {\r
+                       var t = this, ed = t.editor, c, i = 0, cl = [];\r
+\r
+                       c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {\r
+                               var cur = c.items[c.selectedIndex];\r
+\r
+                               if (!v && cur) {\r
+                                       cur = cur.value;\r
+\r
+                                       if (cur['class']) {\r
+                                               ed.formatter.toggle('fontsize_class', {value : cur['class']});\r
+                                               ed.undoManager.add();\r
+                                               ed.nodeChanged();\r
+                                       } else {\r
+                                               ed.execCommand('FontSize', false, cur.fontSize);\r
+                                       }\r
+\r
+                                       return;\r
+                               }\r
+\r
+                               if (v['class']) {\r
+                                       ed.focus();\r
+                                       ed.undoManager.add();\r
+                                       ed.formatter.toggle('fontsize_class', {value : v['class']});\r
+                                       ed.undoManager.add();\r
+                                       ed.nodeChanged();\r
+                               } else\r
+                                       ed.execCommand('FontSize', false, v.fontSize);\r
+\r
+                               // Fake selection, execCommand will fire a nodeChange and update the selection\r
+                               c.select(function(sv) {\r
+                                       return v == sv;\r
+                               });\r
+\r
+                               if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] && cur.value['class'] == v['class'])) {\r
+                                       c.select(null);\r
+                               }\r
+\r
+                               return false; // No auto select\r
+                       }});\r
+\r
+                       if (c) {\r
+                               each(t.settings.theme_advanced_font_sizes, function(v, k) {\r
+                                       var fz = v.fontSize;\r
+\r
+                                       if (fz >= 1 && fz <= 7)\r
+                                               fz = t.sizes[parseInt(fz) - 1] + 'pt';\r
+\r
+                                       c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});\r
+                               });\r
+                       }\r
+\r
+                       return c;\r
+               },\r
+\r
+               _createBlockFormats : function() {\r
+                       var c, fmts = {\r
+                               p : 'advanced.paragraph',\r
+                               address : 'advanced.address',\r
+                               pre : 'advanced.pre',\r
+                               h1 : 'advanced.h1',\r
+                               h2 : 'advanced.h2',\r
+                               h3 : 'advanced.h3',\r
+                               h4 : 'advanced.h4',\r
+                               h5 : 'advanced.h5',\r
+                               h6 : 'advanced.h6',\r
+                               div : 'advanced.div',\r
+                               blockquote : 'advanced.blockquote',\r
+                               code : 'advanced.code',\r
+                               dt : 'advanced.dt',\r
+                               dd : 'advanced.dd',\r
+                               samp : 'advanced.samp'\r
+                       }, t = this;\r
+\r
+                       c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', onselect : function(v) {\r
+                               t.editor.execCommand('FormatBlock', false, v);\r
+                               return false;\r
+                       }});\r
+\r
+                       if (c) {\r
+                               each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {\r
+                                       c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v, style: function() {\r
+                                               return getPreviewCss(t.editor, {block: v});\r
+                                       }});\r
+                               });\r
+                       }\r
+\r
+                       return c;\r
+               },\r
+\r
+               _createForeColorMenu : function() {\r
+                       var c, t = this, s = t.settings, o = {}, v;\r
+\r
+                       if (s.theme_advanced_more_colors) {\r
+                               o.more_colors_func = function() {\r
+                                       t._mceColorPicker(0, {\r
+                                               color : c.value,\r
+                                               func : function(co) {\r
+                                                       c.setColor(co);\r
+                                               }\r
+                                       });\r
+                               };\r
+                       }\r
+\r
+                       if (v = s.theme_advanced_text_colors)\r
+                               o.colors = v;\r
+\r
+                       if (s.theme_advanced_default_foreground_color)\r
+                               o.default_color = s.theme_advanced_default_foreground_color;\r
+\r
+                       o.title = 'advanced.forecolor_desc';\r
+                       o.cmd = 'ForeColor';\r
+                       o.scope = this;\r
+\r
+                       c = t.editor.controlManager.createColorSplitButton('forecolor', o);\r
+\r
+                       return c;\r
+               },\r
+\r
+               _createBackColorMenu : function() {\r
+                       var c, t = this, s = t.settings, o = {}, v;\r
+\r
+                       if (s.theme_advanced_more_colors) {\r
+                               o.more_colors_func = function() {\r
+                                       t._mceColorPicker(0, {\r
+                                               color : c.value,\r
+                                               func : function(co) {\r
+                                                       c.setColor(co);\r
+                                               }\r
+                                       });\r
+                               };\r
+                       }\r
+\r
+                       if (v = s.theme_advanced_background_colors)\r
+                               o.colors = v;\r
+\r
+                       if (s.theme_advanced_default_background_color)\r
+                               o.default_color = s.theme_advanced_default_background_color;\r
+\r
+                       o.title = 'advanced.backcolor_desc';\r
+                       o.cmd = 'HiliteColor';\r
+                       o.scope = this;\r
+\r
+                       c = t.editor.controlManager.createColorSplitButton('backcolor', o);\r
+\r
+                       return c;\r
+               },\r
+\r
+               renderUI : function(o) {\r
+                       var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;\r
+\r
+                       if (ed.settings) {\r
+                               ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');\r
+                       }\r
+\r
+                       // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.\r
+                       // Maybe actually inherit it from the original textara?\r
+                       n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '') + (ed.settings.directionality == "rtl" ? ' mceRtl' : '')});\r
+                       DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);\r
+\r
+                       if (!DOM.boxModel)\r
+                               n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});\r
+\r
+                       n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});\r
+                       n = tb = DOM.add(n, 'tbody');\r
+\r
+                       switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {\r
+                               case "rowlayout":\r
+                                       ic = t._rowLayout(s, tb, o);\r
+                                       break;\r
+\r
+                               case "customlayout":\r
+                                       ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);\r
+                                       break;\r
+\r
+                               default:\r
+                                       ic = t._simpleLayout(s, tb, o, p);\r
+                       }\r
+\r
+                       n = o.targetNode;\r
+\r
+                       // Add classes to first and last TRs\r
+                       nl = sc.rows;\r
+                       DOM.addClass(nl[0], 'mceFirst');\r
+                       DOM.addClass(nl[nl.length - 1], 'mceLast');\r
+\r
+                       // Add classes to first and last TDs\r
+                       each(DOM.select('tr', tb), function(n) {\r
+                               DOM.addClass(n.firstChild, 'mceFirst');\r
+                               DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast');\r
+                       });\r
+\r
+                       if (DOM.get(s.theme_advanced_toolbar_container))\r
+                               DOM.get(s.theme_advanced_toolbar_container).appendChild(p);\r
+                       else\r
+                               DOM.insertAfter(p, n);\r
+\r
+                       Event.add(ed.id + '_path_row', 'click', function(e) {\r
+                               e = e.target;\r
+\r
+                               if (e.nodeName == 'A') {\r
+                                       t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));\r
+                                       return false;\r
+                               }\r
+                       });\r
+/*\r
+                       if (DOM.get(ed.id + '_path_row')) {\r
+                               Event.add(ed.id + '_tbl', 'mouseover', function(e) {\r
+                                       var re;\r
+       \r
+                                       e = e.target;\r
+\r
+                                       if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {\r
+                                               re = DOM.get(ed.id + '_path_row');\r
+                                               t.lastPath = re.innerHTML;\r
+                                               DOM.setHTML(re, e.parentNode.title);\r
+                                       }\r
+                               });\r
+\r
+                               Event.add(ed.id + '_tbl', 'mouseout', function(e) {\r
+                                       if (t.lastPath) {\r
+                                               DOM.setHTML(ed.id + '_path_row', t.lastPath);\r
+                                               t.lastPath = 0;\r
+                                       }\r
+                               });\r
+                       }\r
+*/\r
+\r
+                       if (!ed.getParam('accessibility_focus'))\r
+                               Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});\r
+\r
+                       if (s.theme_advanced_toolbar_location == 'external')\r
+                               o.deltaHeight = 0;\r
+\r
+                       t.deltaHeight = o.deltaHeight;\r
+                       o.targetNode = null;\r
+\r
+                       ed.onKeyDown.add(function(ed, evt) {\r
+                               var DOM_VK_F10 = 121, DOM_VK_F11 = 122;\r
+\r
+                               if (evt.altKey) {\r
+                                       if (evt.keyCode === DOM_VK_F10) {\r
+                                               // Make sure focus is given to toolbar in Safari.\r
+                                               // We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame\r
+                                               if (tinymce.isWebKit) {\r
+                                                       window.focus();\r
+                                               }\r
+                                               t.toolbarGroup.focus();\r
+                                               return Event.cancel(evt);\r
+                                       } else if (evt.keyCode === DOM_VK_F11) {\r
+                                               DOM.get(ed.id + '_path_row').focus();\r
+                                               return Event.cancel(evt);\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       // alt+0 is the UK recommended shortcut for accessing the list of access controls.\r
+                       ed.addShortcut('alt+0', '', 'mceShortcuts', t);\r
+\r
+                       return {\r
+                               iframeContainer : ic,\r
+                               editorContainer : ed.id + '_parent',\r
+                               sizeContainer : sc,\r
+                               deltaHeight : o.deltaHeight\r
+                       };\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Advanced theme',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       }\r
+               },\r
+\r
+               resizeBy : function(dw, dh) {\r
+                       var e = DOM.get(this.editor.id + '_ifr');\r
+\r
+                       this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);\r
+               },\r
+\r
+               resizeTo : function(w, h, store) {\r
+                       var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');\r
+\r
+                       // Boundery fix box\r
+                       w = Math.max(s.theme_advanced_resizing_min_width || 100, w);\r
+                       h = Math.max(s.theme_advanced_resizing_min_height || 100, h);\r
+                       w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);\r
+                       h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);\r
+\r
+                       // Resize iframe and container\r
+                       DOM.setStyle(e, 'height', '');\r
+                       DOM.setStyle(ifr, 'height', h);\r
+\r
+                       if (s.theme_advanced_resize_horizontal) {\r
+                               DOM.setStyle(e, 'width', '');\r
+                               DOM.setStyle(ifr, 'width', w);\r
+\r
+                               // Make sure that the size is never smaller than the over all ui\r
+                               if (w < e.clientWidth) {\r
+                                       w = e.clientWidth;\r
+                                       DOM.setStyle(ifr, 'width', e.clientWidth);\r
+                               }\r
+                       }\r
+\r
+                       // Store away the size\r
+                       if (store && s.theme_advanced_resizing_use_cookie) {\r
+                               Cookie.setHash("TinyMCE_" + ed.id + "_size", {\r
+                                       cw : w,\r
+                                       ch : h\r
+                               });\r
+                       }\r
+               },\r
+\r
+               destroy : function() {\r
+                       var id = this.editor.id;\r
+\r
+                       Event.clear(id + '_resize');\r
+                       Event.clear(id + '_path_row');\r
+                       Event.clear(id + '_external_close');\r
+               },\r
+\r
+               // Internal functions\r
+\r
+               _simpleLayout : function(s, tb, o, p) {\r
+                       var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;\r
+\r
+                       if (s.readonly) {\r
+                               n = DOM.add(tb, 'tr');\r
+                               n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});\r
+                               return ic;\r
+                       }\r
+\r
+                       // Create toolbar container at top\r
+                       if (lo == 'top')\r
+                               t._addToolbars(tb, o);\r
+\r
+                       // Create external toolbar\r
+                       if (lo == 'external') {\r
+                               n = c = DOM.create('div', {style : 'position:relative'});\r
+                               n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});\r
+                               DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});\r
+                               n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});\r
+                               etb = DOM.add(n, 'tbody');\r
+\r
+                               if (p.firstChild.className == 'mceOldBoxModel')\r
+                                       p.firstChild.appendChild(c);\r
+                               else\r
+                                       p.insertBefore(c, p.firstChild);\r
+\r
+                               t._addToolbars(etb, o);\r
+\r
+                               ed.onMouseUp.add(function() {\r
+                                       var e = DOM.get(ed.id + '_external');\r
+                                       DOM.show(e);\r
+\r
+                                       DOM.hide(lastExtID);\r
+\r
+                                       var f = Event.add(ed.id + '_external_close', 'click', function() {\r
+                                               DOM.hide(ed.id + '_external');\r
+                                               Event.remove(ed.id + '_external_close', 'click', f);\r
+                                               return false;\r
+                                       });\r
+\r
+                                       DOM.show(e);\r
+                                       DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);\r
+\r
+                                       // Fixes IE rendering bug\r
+                                       DOM.hide(e);\r
+                                       DOM.show(e);\r
+                                       e.style.filter = '';\r
+\r
+                                       lastExtID = ed.id + '_external';\r
+\r
+                                       e = null;\r
+                               });\r
+                       }\r
+\r
+                       if (sl == 'top')\r
+                               t._addStatusBar(tb, o);\r
+\r
+                       // Create iframe container\r
+                       if (!s.theme_advanced_toolbar_container) {\r
+                               n = DOM.add(tb, 'tr');\r
+                               n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});\r
+                       }\r
+\r
+                       // Create toolbar container at bottom\r
+                       if (lo == 'bottom')\r
+                               t._addToolbars(tb, o);\r
+\r
+                       if (sl == 'bottom')\r
+                               t._addStatusBar(tb, o);\r
+\r
+                       return ic;\r
+               },\r
+\r
+               _rowLayout : function(s, tb, o) {\r
+                       var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;\r
+\r
+                       dc = s.theme_advanced_containers_default_class || '';\r
+                       da = s.theme_advanced_containers_default_align || 'center';\r
+\r
+                       each(explode(s.theme_advanced_containers || ''), function(c, i) {\r
+                               var v = s['theme_advanced_container_' + c] || '';\r
+\r
+                               switch (c.toLowerCase()) {\r
+                                       case 'mceeditor':\r
+                                               n = DOM.add(tb, 'tr');\r
+                                               n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});\r
+                                               break;\r
+\r
+                                       case 'mceelementpath':\r
+                                               t._addStatusBar(tb, o);\r
+                                               break;\r
+\r
+                                       default:\r
+                                               a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();\r
+                                               a = 'mce' + t._ufirst(a);\r
+\r
+                                               n = DOM.add(DOM.add(tb, 'tr'), 'td', {\r
+                                                       'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da\r
+                                               });\r
+\r
+                                               to = cf.createToolbar("toolbar" + i);\r
+                                               t._addControls(v, to);\r
+                                               DOM.setHTML(n, to.renderHTML());\r
+                                               o.deltaHeight -= s.theme_advanced_row_height;\r
+                               }\r
+                       });\r
+\r
+                       return ic;\r
+               },\r
+\r
+               _addControls : function(v, tb) {\r
+                       var t = this, s = t.settings, di, cf = t.editor.controlManager;\r
+\r
+                       if (s.theme_advanced_disable && !t._disabled) {\r
+                               di = {};\r
+\r
+                               each(explode(s.theme_advanced_disable), function(v) {\r
+                                       di[v] = 1;\r
+                               });\r
+\r
+                               t._disabled = di;\r
+                       } else\r
+                               di = t._disabled;\r
+\r
+                       each(explode(v), function(n) {\r
+                               var c;\r
+\r
+                               if (di && di[n])\r
+                                       return;\r
+\r
+                               // Compatiblity with 2.x\r
+                               if (n == 'tablecontrols') {\r
+                                       each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {\r
+                                               n = t.createControl(n, cf);\r
+\r
+                                               if (n)\r
+                                                       tb.add(n);\r
+                                       });\r
+\r
+                                       return;\r
+                               }\r
+\r
+                               c = t.createControl(n, cf);\r
+\r
+                               if (c)\r
+                                       tb.add(c);\r
+                       });\r
+               },\r
+\r
+               _addToolbars : function(c, o) {\r
+                       var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup, toolbarsExist = false;\r
+\r
+                       toolbarGroup = cf.createToolbarGroup('toolbargroup', {\r
+                               'name': ed.getLang('advanced.toolbar'),\r
+                               'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')\r
+                       });\r
+\r
+                       t.toolbarGroup = toolbarGroup;\r
+\r
+                       a = s.theme_advanced_toolbar_align.toLowerCase();\r
+                       a = 'mce' + t._ufirst(a);\r
+\r
+                       n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});\r
+\r
+                       // Create toolbar and add the controls\r
+                       for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {\r
+                               toolbarsExist = true;\r
+                               tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});\r
+\r
+                               if (s['theme_advanced_buttons' + i + '_add'])\r
+                                       v += ',' + s['theme_advanced_buttons' + i + '_add'];\r
+\r
+                               if (s['theme_advanced_buttons' + i + '_add_before'])\r
+                                       v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;\r
+\r
+                               t._addControls(v, tb);\r
+                               toolbarGroup.add(tb);\r
+\r
+                               o.deltaHeight -= s.theme_advanced_row_height;\r
+                       }\r
+                       // Handle case when there are no toolbar buttons and ensure editor height is adjusted accordingly\r
+                       if (!toolbarsExist)\r
+                               o.deltaHeight -= s.theme_advanced_row_height;\r
+                       h.push(toolbarGroup.renderHTML());\r
+                       h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));\r
+                       DOM.setHTML(n, h.join(''));\r
+               },\r
+\r
+               _addStatusBar : function(tb, o) {\r
+                       var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;\r
+\r
+                       n = DOM.add(tb, 'tr');\r
+                       n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); \r
+                       n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});\r
+                       if (s.theme_advanced_path) {\r
+                               DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));\r
+                               DOM.add(n, 'span', {}, ': ');\r
+                       } else {\r
+                               DOM.add(n, 'span', {}, '&#160;');\r
+                       }\r
+                       \r
+\r
+                       if (s.theme_advanced_resizing) {\r
+                               DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});\r
+\r
+                               if (s.theme_advanced_resizing_use_cookie) {\r
+                                       ed.onPostRender.add(function() {\r
+                                               var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');\r
+\r
+                                               if (!o)\r
+                                                       return;\r
+\r
+                                               t.resizeTo(o.cw, o.ch);\r
+                                       });\r
+                               }\r
+\r
+                               ed.onPostRender.add(function() {\r
+                                       Event.add(ed.id + '_resize', 'click', function(e) {\r
+                                               e.preventDefault();\r
+                                       });\r
+\r
+                                       Event.add(ed.id + '_resize', 'mousedown', function(e) {\r
+                                               var mouseMoveHandler1, mouseMoveHandler2,\r
+                                                       mouseUpHandler1, mouseUpHandler2,\r
+                                                       startX, startY, startWidth, startHeight, width, height, ifrElm;\r
+\r
+                                               function resizeOnMove(e) {\r
+                                                       e.preventDefault();\r
+\r
+                                                       width = startWidth + (e.screenX - startX);\r
+                                                       height = startHeight + (e.screenY - startY);\r
+\r
+                                                       t.resizeTo(width, height);\r
+                                               };\r
+\r
+                                               function endResize(e) {\r
+                                                       // Stop listening\r
+                                                       Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);\r
+                                                       Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);\r
+                                                       Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);\r
+                                                       Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);\r
+\r
+                                                       width = startWidth + (e.screenX - startX);\r
+                                                       height = startHeight + (e.screenY - startY);\r
+                                                       t.resizeTo(width, height, true);\r
+\r
+                                                       ed.nodeChanged();\r
+                                               };\r
+\r
+                                               e.preventDefault();\r
+\r
+                                               // Get the current rect size\r
+                                               startX = e.screenX;\r
+                                               startY = e.screenY;\r
+                                               ifrElm = DOM.get(t.editor.id + '_ifr');\r
+                                               startWidth = width = ifrElm.clientWidth;\r
+                                               startHeight = height = ifrElm.clientHeight;\r
+\r
+                                               // Register envent handlers\r
+                                               mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);\r
+                                               mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);\r
+                                               mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);\r
+                                               mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);\r
+                                       });\r
+                               });\r
+                       }\r
+\r
+                       o.deltaHeight -= 21;\r
+                       n = tb = null;\r
+               },\r
+\r
+               _updateUndoStatus : function(ed) {\r
+                       var cm = ed.controlManager, um = ed.undoManager;\r
+\r
+                       cm.setDisabled('undo', !um.hasUndo() && !um.typing);\r
+                       cm.setDisabled('redo', !um.hasRedo());\r
+               },\r
+\r
+               _nodeChanged : function(ed, cm, n, co, ob) {\r
+                       var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches;\r
+\r
+                       tinymce.each(t.stateControls, function(c) {\r
+                               cm.setActive(c, ed.queryCommandState(t.controls[c][1]));\r
+                       });\r
+\r
+                       function getParent(name) {\r
+                               var i, parents = ob.parents, func = name;\r
+\r
+                               if (typeof(name) == 'string') {\r
+                                       func = function(node) {\r
+                                               return node.nodeName == name;\r
+                                       };\r
+                               }\r
+\r
+                               for (i = 0; i < parents.length; i++) {\r
+                                       if (func(parents[i]))\r
+                                               return parents[i];\r
+                               }\r
+                       };\r
+\r
+                       cm.setActive('visualaid', ed.hasVisual);\r
+                       t._updateUndoStatus(ed);\r
+                       cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));\r
+\r
+                       p = getParent('A');\r
+                       if (c = cm.get('link')) {\r
+                               c.setDisabled((!p && co) || (p && !p.href));\r
+                               c.setActive(!!p && (!p.name && !p.id));\r
+                       }\r
+\r
+                       if (c = cm.get('unlink')) {\r
+                               c.setDisabled(!p && co);\r
+                               c.setActive(!!p && !p.name && !p.id);\r
+                       }\r
+\r
+                       if (c = cm.get('anchor')) {\r
+                               c.setActive(!co && !!p && (p.name || (p.id && !p.href)));\r
+                       }\r
+\r
+                       p = getParent('IMG');\r
+                       if (c = cm.get('image'))\r
+                               c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);\r
+\r
+                       if (c = cm.get('styleselect')) {\r
+                               t._importClasses();\r
+\r
+                               formatNames = [];\r
+                               each(c.items, function(item) {\r
+                                       formatNames.push(item.value);\r
+                               });\r
+\r
+                               matches = ed.formatter.matchAll(formatNames);\r
+                               c.select(matches[0]);\r
+                               tinymce.each(matches, function(match, index) {\r
+                                       if (index > 0) {\r
+                                               c.mark(match);\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       if (c = cm.get('formatselect')) {\r
+                               p = getParent(ed.dom.isBlock);\r
+\r
+                               if (p)\r
+                                       c.select(p.nodeName.toLowerCase());\r
+                       }\r
+\r
+                       // Find out current fontSize, fontFamily and fontClass\r
+                       getParent(function(n) {\r
+                               if (n.nodeName === 'SPAN') {\r
+                                       if (!cl && n.className)\r
+                                               cl = n.className;\r
+                               }\r
+\r
+                               if (ed.dom.is(n, s.theme_advanced_font_selector)) {\r
+                                       if (!fz && n.style.fontSize)\r
+                                               fz = n.style.fontSize;\r
+\r
+                                       if (!fn && n.style.fontFamily)\r
+                                               fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();\r
+                                       \r
+                                       if (!fc && n.style.color)\r
+                                               fc = n.style.color;\r
+\r
+                                       if (!bc && n.style.backgroundColor)\r
+                                               bc = n.style.backgroundColor;\r
+                               }\r
+\r
+                               return false;\r
+                       });\r
+\r
+                       if (c = cm.get('fontselect')) {\r
+                               c.select(function(v) {\r
+                                       return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;\r
+                               });\r
+                       }\r
+\r
+                       // Select font size\r
+                       if (c = cm.get('fontsizeselect')) {\r
+                               // Use computed style\r
+                               if (s.theme_advanced_runtime_fontsize && !fz && !cl)\r
+                                       fz = ed.dom.getStyle(n, 'fontSize', true);\r
+\r
+                               c.select(function(v) {\r
+                                       if (v.fontSize && v.fontSize === fz)\r
+                                               return true;\r
+\r
+                                       if (v['class'] && v['class'] === cl)\r
+                                               return true;\r
+                               });\r
+                       }\r
+                       \r
+                       if (s.theme_advanced_show_current_color) {\r
+                               function updateColor(controlId, color) {\r
+                                       if (c = cm.get(controlId)) {\r
+                                               if (!color)\r
+                                                       color = c.settings.default_color;\r
+                                               if (color !== c.value) {\r
+                                                       c.displayColor(color);\r
+                                               }\r
+                                       }\r
+                               }\r
+                               updateColor('forecolor', fc);\r
+                               updateColor('backcolor', bc);\r
+                       }\r
+\r
+                       if (s.theme_advanced_show_current_color) {\r
+                               function updateColor(controlId, color) {\r
+                                       if (c = cm.get(controlId)) {\r
+                                               if (!color)\r
+                                                       color = c.settings.default_color;\r
+                                               if (color !== c.value) {\r
+                                                       c.displayColor(color);\r
+                                               }\r
+                                       }\r
+                               };\r
+\r
+                               updateColor('forecolor', fc);\r
+                               updateColor('backcolor', bc);\r
+                       }\r
+\r
+                       if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {\r
+                               p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});\r
+\r
+                               if (t.statusKeyboardNavigation) {\r
+                                       t.statusKeyboardNavigation.destroy();\r
+                                       t.statusKeyboardNavigation = null;\r
+                               }\r
+\r
+                               DOM.setHTML(p, '');\r
+\r
+                               getParent(function(n) {\r
+                                       var na = n.nodeName.toLowerCase(), u, pi, ti = '';\r
+\r
+                                       // Ignore non element and bogus/hidden elements\r
+                                       if (n.nodeType != 1 || na === 'br' || n.getAttribute('data-mce-bogus') || DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))\r
+                                               return;\r
+\r
+                                       // Handle prefix\r
+                                       if (tinymce.isIE && n.scopeName !== 'HTML' && n.scopeName)\r
+                                               na = n.scopeName + ':' + na;\r
+\r
+                                       // Remove internal prefix\r
+                                       na = na.replace(/mce\:/g, '');\r
+\r
+                                       // Handle node name\r
+                                       switch (na) {\r
+                                               case 'b':\r
+                                                       na = 'strong';\r
+                                                       break;\r
+\r
+                                               case 'i':\r
+                                                       na = 'em';\r
+                                                       break;\r
+\r
+                                               case 'img':\r
+                                                       if (v = DOM.getAttrib(n, 'src'))\r
+                                                               ti += 'src: ' + v + ' ';\r
+\r
+                                                       break;\r
+\r
+                                               case 'a':\r
+                                                       if (v = DOM.getAttrib(n, 'name')) {\r
+                                                               ti += 'name: ' + v + ' ';\r
+                                                               na += '#' + v;\r
+                                                       }\r
+\r
+                                                       if (v = DOM.getAttrib(n, 'href'))\r
+                                                               ti += 'href: ' + v + ' ';\r
+\r
+                                                       break;\r
+\r
+                                               case 'font':\r
+                                                       if (v = DOM.getAttrib(n, 'face'))\r
+                                                               ti += 'font: ' + v + ' ';\r
+\r
+                                                       if (v = DOM.getAttrib(n, 'size'))\r
+                                                               ti += 'size: ' + v + ' ';\r
+\r
+                                                       if (v = DOM.getAttrib(n, 'color'))\r
+                                                               ti += 'color: ' + v + ' ';\r
+\r
+                                                       break;\r
+\r
+                                               case 'span':\r
+                                                       if (v = DOM.getAttrib(n, 'style'))\r
+                                                               ti += 'style: ' + v + ' ';\r
+\r
+                                                       break;\r
+                                       }\r
+\r
+                                       if (v = DOM.getAttrib(n, 'id'))\r
+                                               ti += 'id: ' + v + ' ';\r
+\r
+                                       if (v = n.className) {\r
+                                               v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '');\r
+\r
+                                               if (v) {\r
+                                                       ti += 'class: ' + v + ' ';\r
+\r
+                                                       if (ed.dom.isBlock(n) || na == 'img' || na == 'span')\r
+                                                               na += '.' + v;\r
+                                               }\r
+                                       }\r
+\r
+                                       na = na.replace(/(html:)/g, '');\r
+                                       na = {name : na, node : n, title : ti};\r
+                                       t.onResolveName.dispatch(t, na);\r
+                                       ti = na.title;\r
+                                       na = na.name;\r
+\r
+                                       //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";\r
+                                       pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);\r
+\r
+                                       if (p.hasChildNodes()) {\r
+                                               p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);\r
+                                               p.insertBefore(pi, p.firstChild);\r
+                                       } else\r
+                                               p.appendChild(pi);\r
+                               }, ed.getBody());\r
+\r
+                               if (DOM.select('a', p).length > 0) {\r
+                                       t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({\r
+                                               root: ed.id + "_path_row",\r
+                                               items: DOM.select('a', p),\r
+                                               excludeFromTabOrder: true,\r
+                                               onCancel: function() {\r
+                                                       ed.focus();\r
+                                               }\r
+                                       }, DOM);\r
+                               }\r
+                       }\r
+               },\r
+\r
+               // Commands gets called by execCommand\r
+\r
+               _sel : function(v) {\r
+                       this.editor.execCommand('mceSelectNodeDepth', false, v);\r
+               },\r
+\r
+               _mceInsertAnchor : function(ui, v) {\r
+                       var ed = this.editor;\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/anchor.htm',\r
+                               width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),\r
+                               height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),\r
+                               inline : true\r
+                       }, {\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceCharMap : function() {\r
+                       var ed = this.editor;\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/charmap.htm',\r
+                               width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),\r
+                               height : 265 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),\r
+                               inline : true\r
+                       }, {\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceHelp : function() {\r
+                       var ed = this.editor;\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/about.htm',\r
+                               width : 480,\r
+                               height : 380,\r
+                               inline : true\r
+                       }, {\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceShortcuts : function() {\r
+                       var ed = this.editor;\r
+                       ed.windowManager.open({\r
+                               url: this.url + '/shortcuts.htm',\r
+                               width: 480,\r
+                               height: 380,\r
+                               inline: true\r
+                       }, {\r
+                               theme_url: this.url\r
+                       });\r
+               },\r
+\r
+               _mceColorPicker : function(u, v) {\r
+                       var ed = this.editor;\r
+\r
+                       v = v || {};\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/color_picker.htm',\r
+                               width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),\r
+                               height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),\r
+                               close_previous : false,\r
+                               inline : true\r
+                       }, {\r
+                               input_color : v.color,\r
+                               func : v.func,\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceCodeEditor : function(ui, val) {\r
+                       var ed = this.editor;\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/source_editor.htm',\r
+                               width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),\r
+                               height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),\r
+                               inline : true,\r
+                               resizable : true,\r
+                               maximizable : true\r
+                       }, {\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceImage : function(ui, val) {\r
+                       var ed = this.editor;\r
+\r
+                       // Internal image object like a flash placeholder\r
+                       if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)\r
+                               return;\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/image.htm',\r
+                               width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),\r
+                               height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),\r
+                               inline : true\r
+                       }, {\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceLink : function(ui, val) {\r
+                       var ed = this.editor;\r
+\r
+                       ed.windowManager.open({\r
+                               url : this.url + '/link.htm',\r
+                               width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),\r
+                               height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),\r
+                               inline : true\r
+                       }, {\r
+                               theme_url : this.url\r
+                       });\r
+               },\r
+\r
+               _mceNewDocument : function() {\r
+                       var ed = this.editor;\r
+\r
+                       ed.windowManager.confirm('advanced.newdocument', function(s) {\r
+                               if (s)\r
+                                       ed.execCommand('mceSetContent', false, '');\r
+                       });\r
+               },\r
+\r
+               _mceForeColor : function() {\r
+                       var t = this;\r
+\r
+                       this._mceColorPicker(0, {\r
+                               color: t.fgColor,\r
+                               func : function(co) {\r
+                                       t.fgColor = co;\r
+                                       t.editor.execCommand('ForeColor', false, co);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               _mceBackColor : function() {\r
+                       var t = this;\r
+\r
+                       this._mceColorPicker(0, {\r
+                               color: t.bgColor,\r
+                               func : function(co) {\r
+                                       t.bgColor = co;\r
+                                       t.editor.execCommand('HiliteColor', false, co);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               _ufirst : function(s) {\r
+                       return s.substring(0, 1).toUpperCase() + s.substring(1);\r
+               }\r
+       });\r
+\r
+       tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);\r
+}(tinymce));\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/image.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/image.htm
new file mode 100644 (file)
index 0000000..b8ba729
--- /dev/null
@@ -0,0 +1,80 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.image_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="js/image.js"></script>\r
+</head>\r
+<body id="image" style="display: none">\r
+<form onsubmit="ImageDialog.update();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li>\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <table border="0" cellpadding="4" cellspacing="0">\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>\r
+                                       <td><table border="0" cellspacing="0" cellpadding="0">\r
+                                               <tr>\r
+                                                       <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>\r
+                                                       <td id="srcbrowsercontainer">&nbsp;</td>\r
+                                               </tr>\r
+                                       </table></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="image_list">{#advanced_dlg.image_list}</label></td>\r
+                                       <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>\r
+                                       <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>\r
+                                       <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">\r
+                                               <option value="">{#not_set}</option>\r
+                                               <option value="baseline">{#advanced_dlg.image_align_baseline}</option>\r
+                                               <option value="top">{#advanced_dlg.image_align_top}</option>\r
+                                               <option value="middle">{#advanced_dlg.image_align_middle}</option>\r
+                                               <option value="bottom">{#advanced_dlg.image_align_bottom}</option>\r
+                                               <option value="text-top">{#advanced_dlg.image_align_texttop}</option>\r
+                                               <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>\r
+                                               <option value="left">{#advanced_dlg.image_align_left}</option>\r
+                                               <option value="right">{#advanced_dlg.image_align_right}</option>\r
+                                       </select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>\r
+                                       <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />\r
+                                        x \r
+                                       <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                               <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>\r
+                               <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>\r
+                                       <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>\r
+                                       <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
+                               </tr>\r
+                       </table>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/colorpicker.jpg b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/colorpicker.jpg
new file mode 100644 (file)
index 0000000..b1a377a
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/colorpicker.jpg differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/flash.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/flash.gif
new file mode 100644 (file)
index 0000000..dec3f7c
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/flash.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/icons.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/icons.gif
new file mode 100644 (file)
index 0000000..ca22249
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/icons.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/iframe.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/iframe.gif
new file mode 100644 (file)
index 0000000..410c7ad
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/iframe.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/pagebreak.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/pagebreak.gif
new file mode 100644 (file)
index 0000000..acdf408
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/pagebreak.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/quicktime.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/quicktime.gif
new file mode 100644 (file)
index 0000000..8f10e7a
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/quicktime.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/realmedia.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/realmedia.gif
new file mode 100644 (file)
index 0000000..fdfe0b9
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/realmedia.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/shockwave.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/shockwave.gif
new file mode 100644 (file)
index 0000000..9314d04
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/shockwave.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/trans.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/trans.gif
new file mode 100644 (file)
index 0000000..3884865
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/trans.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/video.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/video.gif
new file mode 100644 (file)
index 0000000..3570104
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/video.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/windowsmedia.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/windowsmedia.gif
new file mode 100644 (file)
index 0000000..ab50f2d
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/img/windowsmedia.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/about.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/about.js
new file mode 100644 (file)
index 0000000..5b35845
--- /dev/null
@@ -0,0 +1,73 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+function init() {\r
+       var ed, tcont;\r
+\r
+       tinyMCEPopup.resizeToInnerSize();\r
+       ed = tinyMCEPopup.editor;\r
+\r
+       // Give FF some time\r
+       window.setTimeout(insertHelpIFrame, 10);\r
+\r
+       tcont = document.getElementById('plugintablecontainer');\r
+       document.getElementById('plugins_tab').style.display = 'none';\r
+\r
+       var html = "";\r
+       html += '<table id="plugintable">';\r
+       html += '<thead>';\r
+       html += '<tr>';\r
+       html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>';\r
+       html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>';\r
+       html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>';\r
+       html += '</tr>';\r
+       html += '</thead>';\r
+       html += '<tbody>';\r
+\r
+       tinymce.each(ed.plugins, function(p, n) {\r
+               var info;\r
+\r
+               if (!p.getInfo)\r
+                       return;\r
+\r
+               html += '<tr>';\r
+\r
+               info = p.getInfo();\r
+\r
+               if (info.infourl != null && info.infourl != '')\r
+                       html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';\r
+               else\r
+                       html += '<td width="50%" title="' + n + '">' + info.longname + '</td>';\r
+\r
+               if (info.authorurl != null && info.authorurl != '')\r
+                       html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';\r
+               else\r
+                       html += '<td width="35%">' + info.author + '</td>';\r
+\r
+               html += '<td width="15%">' + info.version + '</td>';\r
+               html += '</tr>';\r
+\r
+               document.getElementById('plugins_tab').style.display = '';\r
+\r
+       });\r
+\r
+       html += '</tbody>';\r
+       html += '</table>';\r
+\r
+       tcont.innerHTML = html;\r
+\r
+       tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;\r
+       tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate;\r
+}\r
+\r
+function insertHelpIFrame() {\r
+       var html;\r
+\r
+       if (tinyMCEPopup.getParam('docs_url')) {\r
+               html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';\r
+               document.getElementById('iframecontainer').innerHTML = html;\r
+               document.getElementById('help_tab').style.display = 'block';\r
+               document.getElementById('help_tab').setAttribute("aria-hidden", "false");\r
+       }\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/anchor.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/anchor.js
new file mode 100644 (file)
index 0000000..2909a3a
--- /dev/null
@@ -0,0 +1,56 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var AnchorDialog = {\r
+       init : function(ed) {\r
+               var action, elm, f = document.forms[0];\r
+\r
+               this.editor = ed;\r
+               elm = ed.dom.getParent(ed.selection.getNode(), 'A');\r
+               v = ed.dom.getAttrib(elm, 'name') || ed.dom.getAttrib(elm, 'id');\r
+\r
+               if (v) {\r
+                       this.action = 'update';\r
+                       f.anchorName.value = v;\r
+               }\r
+\r
+               f.insert.value = ed.getLang(elm ? 'update' : 'insert');\r
+       },\r
+\r
+       update : function() {\r
+               var ed = this.editor, elm, name = document.forms[0].anchorName.value, attribName;\r
+\r
+               if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {\r
+                       tinyMCEPopup.alert('advanced_dlg.anchor_invalid');\r
+                       return;\r
+               }\r
+\r
+               tinyMCEPopup.restoreSelection();\r
+\r
+               if (this.action != 'update')\r
+                       ed.selection.collapse(1);\r
+\r
+               var aRule = ed.schema.getElementRule('a');\r
+               if (!aRule || aRule.attributes.name) {\r
+                       attribName = 'name';\r
+               } else {\r
+                       attribName = 'id';\r
+               }\r
+\r
+               elm = ed.dom.getParent(ed.selection.getNode(), 'A');\r
+               if (elm) {\r
+                       elm.setAttribute(attribName, name);\r
+                       elm[attribName] = name;\r
+                       ed.undoManager.add();\r
+               } else {\r
+                       // create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it\r
+                       var attrs =  {'class' : 'mceItemAnchor'};\r
+                       attrs[attribName] = name;\r
+                       ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', attrs, '\uFEFF'));\r
+                       ed.nodeChanged();\r
+               }\r
+\r
+               tinyMCEPopup.close();\r
+       }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/charmap.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/charmap.js
new file mode 100644 (file)
index 0000000..bb18695
--- /dev/null
@@ -0,0 +1,363 @@
+/**\r
+ * charmap.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+tinyMCEPopup.requireLangPack();\r
+\r
+var charmap = [\r
+       ['&nbsp;',    '&#160;',  true, 'no-break space'],\r
+       ['&amp;',     '&#38;',   true, 'ampersand'],\r
+       ['&quot;',    '&#34;',   true, 'quotation mark'],\r
+// finance\r
+       ['&cent;',    '&#162;',  true, 'cent sign'],\r
+       ['&euro;',    '&#8364;', true, 'euro sign'],\r
+       ['&pound;',   '&#163;',  true, 'pound sign'],\r
+       ['&yen;',     '&#165;',  true, 'yen sign'],\r
+// signs\r
+       ['&copy;',    '&#169;',  true, 'copyright sign'],\r
+       ['&reg;',     '&#174;',  true, 'registered sign'],\r
+       ['&trade;',   '&#8482;', true, 'trade mark sign'],\r
+       ['&permil;',  '&#8240;', true, 'per mille sign'],\r
+       ['&micro;',   '&#181;',  true, 'micro sign'],\r
+       ['&middot;',  '&#183;',  true, 'middle dot'],\r
+       ['&bull;',    '&#8226;', true, 'bullet'],\r
+       ['&hellip;',  '&#8230;', true, 'three dot leader'],\r
+       ['&prime;',   '&#8242;', true, 'minutes / feet'],\r
+       ['&Prime;',   '&#8243;', true, 'seconds / inches'],\r
+       ['&sect;',    '&#167;',  true, 'section sign'],\r
+       ['&para;',    '&#182;',  true, 'paragraph sign'],\r
+       ['&szlig;',   '&#223;',  true, 'sharp s / ess-zed'],\r
+// quotations\r
+       ['&lsaquo;',  '&#8249;', true, 'single left-pointing angle quotation mark'],\r
+       ['&rsaquo;',  '&#8250;', true, 'single right-pointing angle quotation mark'],\r
+       ['&laquo;',   '&#171;',  true, 'left pointing guillemet'],\r
+       ['&raquo;',   '&#187;',  true, 'right pointing guillemet'],\r
+       ['&lsquo;',   '&#8216;', true, 'left single quotation mark'],\r
+       ['&rsquo;',   '&#8217;', true, 'right single quotation mark'],\r
+       ['&ldquo;',   '&#8220;', true, 'left double quotation mark'],\r
+       ['&rdquo;',   '&#8221;', true, 'right double quotation mark'],\r
+       ['&sbquo;',   '&#8218;', true, 'single low-9 quotation mark'],\r
+       ['&bdquo;',   '&#8222;', true, 'double low-9 quotation mark'],\r
+       ['&lt;',      '&#60;',   true, 'less-than sign'],\r
+       ['&gt;',      '&#62;',   true, 'greater-than sign'],\r
+       ['&le;',      '&#8804;', true, 'less-than or equal to'],\r
+       ['&ge;',      '&#8805;', true, 'greater-than or equal to'],\r
+       ['&ndash;',   '&#8211;', true, 'en dash'],\r
+       ['&mdash;',   '&#8212;', true, 'em dash'],\r
+       ['&macr;',    '&#175;',  true, 'macron'],\r
+       ['&oline;',   '&#8254;', true, 'overline'],\r
+       ['&curren;',  '&#164;',  true, 'currency sign'],\r
+       ['&brvbar;',  '&#166;',  true, 'broken bar'],\r
+       ['&uml;',     '&#168;',  true, 'diaeresis'],\r
+       ['&iexcl;',   '&#161;',  true, 'inverted exclamation mark'],\r
+       ['&iquest;',  '&#191;',  true, 'turned question mark'],\r
+       ['&circ;',    '&#710;',  true, 'circumflex accent'],\r
+       ['&tilde;',   '&#732;',  true, 'small tilde'],\r
+       ['&deg;',     '&#176;',  true, 'degree sign'],\r
+       ['&minus;',   '&#8722;', true, 'minus sign'],\r
+       ['&plusmn;',  '&#177;',  true, 'plus-minus sign'],\r
+       ['&divide;',  '&#247;',  true, 'division sign'],\r
+       ['&frasl;',   '&#8260;', true, 'fraction slash'],\r
+       ['&times;',   '&#215;',  true, 'multiplication sign'],\r
+       ['&sup1;',    '&#185;',  true, 'superscript one'],\r
+       ['&sup2;',    '&#178;',  true, 'superscript two'],\r
+       ['&sup3;',    '&#179;',  true, 'superscript three'],\r
+       ['&frac14;',  '&#188;',  true, 'fraction one quarter'],\r
+       ['&frac12;',  '&#189;',  true, 'fraction one half'],\r
+       ['&frac34;',  '&#190;',  true, 'fraction three quarters'],\r
+// math / logical\r
+       ['&fnof;',    '&#402;',  true, 'function / florin'],\r
+       ['&int;',     '&#8747;', true, 'integral'],\r
+       ['&sum;',     '&#8721;', true, 'n-ary sumation'],\r
+       ['&infin;',   '&#8734;', true, 'infinity'],\r
+       ['&radic;',   '&#8730;', true, 'square root'],\r
+       ['&sim;',     '&#8764;', false,'similar to'],\r
+       ['&cong;',    '&#8773;', false,'approximately equal to'],\r
+       ['&asymp;',   '&#8776;', true, 'almost equal to'],\r
+       ['&ne;',      '&#8800;', true, 'not equal to'],\r
+       ['&equiv;',   '&#8801;', true, 'identical to'],\r
+       ['&isin;',    '&#8712;', false,'element of'],\r
+       ['&notin;',   '&#8713;', false,'not an element of'],\r
+       ['&ni;',      '&#8715;', false,'contains as member'],\r
+       ['&prod;',    '&#8719;', true, 'n-ary product'],\r
+       ['&and;',     '&#8743;', false,'logical and'],\r
+       ['&or;',      '&#8744;', false,'logical or'],\r
+       ['&not;',     '&#172;',  true, 'not sign'],\r
+       ['&cap;',     '&#8745;', true, 'intersection'],\r
+       ['&cup;',     '&#8746;', false,'union'],\r
+       ['&part;',    '&#8706;', true, 'partial differential'],\r
+       ['&forall;',  '&#8704;', false,'for all'],\r
+       ['&exist;',   '&#8707;', false,'there exists'],\r
+       ['&empty;',   '&#8709;', false,'diameter'],\r
+       ['&nabla;',   '&#8711;', false,'backward difference'],\r
+       ['&lowast;',  '&#8727;', false,'asterisk operator'],\r
+       ['&prop;',    '&#8733;', false,'proportional to'],\r
+       ['&ang;',     '&#8736;', false,'angle'],\r
+// undefined\r
+       ['&acute;',   '&#180;',  true, 'acute accent'],\r
+       ['&cedil;',   '&#184;',  true, 'cedilla'],\r
+       ['&ordf;',    '&#170;',  true, 'feminine ordinal indicator'],\r
+       ['&ordm;',    '&#186;',  true, 'masculine ordinal indicator'],\r
+       ['&dagger;',  '&#8224;', true, 'dagger'],\r
+       ['&Dagger;',  '&#8225;', true, 'double dagger'],\r
+// alphabetical special chars\r
+       ['&Agrave;',  '&#192;',  true, 'A - grave'],\r
+       ['&Aacute;',  '&#193;',  true, 'A - acute'],\r
+       ['&Acirc;',   '&#194;',  true, 'A - circumflex'],\r
+       ['&Atilde;',  '&#195;',  true, 'A - tilde'],\r
+       ['&Auml;',    '&#196;',  true, 'A - diaeresis'],\r
+       ['&Aring;',   '&#197;',  true, 'A - ring above'],\r
+       ['&AElig;',   '&#198;',  true, 'ligature AE'],\r
+       ['&Ccedil;',  '&#199;',  true, 'C - cedilla'],\r
+       ['&Egrave;',  '&#200;',  true, 'E - grave'],\r
+       ['&Eacute;',  '&#201;',  true, 'E - acute'],\r
+       ['&Ecirc;',   '&#202;',  true, 'E - circumflex'],\r
+       ['&Euml;',    '&#203;',  true, 'E - diaeresis'],\r
+       ['&Igrave;',  '&#204;',  true, 'I - grave'],\r
+       ['&Iacute;',  '&#205;',  true, 'I - acute'],\r
+       ['&Icirc;',   '&#206;',  true, 'I - circumflex'],\r
+       ['&Iuml;',    '&#207;',  true, 'I - diaeresis'],\r
+       ['&ETH;',     '&#208;',  true, 'ETH'],\r
+       ['&Ntilde;',  '&#209;',  true, 'N - tilde'],\r
+       ['&Ograve;',  '&#210;',  true, 'O - grave'],\r
+       ['&Oacute;',  '&#211;',  true, 'O - acute'],\r
+       ['&Ocirc;',   '&#212;',  true, 'O - circumflex'],\r
+       ['&Otilde;',  '&#213;',  true, 'O - tilde'],\r
+       ['&Ouml;',    '&#214;',  true, 'O - diaeresis'],\r
+       ['&Oslash;',  '&#216;',  true, 'O - slash'],\r
+       ['&OElig;',   '&#338;',  true, 'ligature OE'],\r
+       ['&Scaron;',  '&#352;',  true, 'S - caron'],\r
+       ['&Ugrave;',  '&#217;',  true, 'U - grave'],\r
+       ['&Uacute;',  '&#218;',  true, 'U - acute'],\r
+       ['&Ucirc;',   '&#219;',  true, 'U - circumflex'],\r
+       ['&Uuml;',    '&#220;',  true, 'U - diaeresis'],\r
+       ['&Yacute;',  '&#221;',  true, 'Y - acute'],\r
+       ['&Yuml;',    '&#376;',  true, 'Y - diaeresis'],\r
+       ['&THORN;',   '&#222;',  true, 'THORN'],\r
+       ['&agrave;',  '&#224;',  true, 'a - grave'],\r
+       ['&aacute;',  '&#225;',  true, 'a - acute'],\r
+       ['&acirc;',   '&#226;',  true, 'a - circumflex'],\r
+       ['&atilde;',  '&#227;',  true, 'a - tilde'],\r
+       ['&auml;',    '&#228;',  true, 'a - diaeresis'],\r
+       ['&aring;',   '&#229;',  true, 'a - ring above'],\r
+       ['&aelig;',   '&#230;',  true, 'ligature ae'],\r
+       ['&ccedil;',  '&#231;',  true, 'c - cedilla'],\r
+       ['&egrave;',  '&#232;',  true, 'e - grave'],\r
+       ['&eacute;',  '&#233;',  true, 'e - acute'],\r
+       ['&ecirc;',   '&#234;',  true, 'e - circumflex'],\r
+       ['&euml;',    '&#235;',  true, 'e - diaeresis'],\r
+       ['&igrave;',  '&#236;',  true, 'i - grave'],\r
+       ['&iacute;',  '&#237;',  true, 'i - acute'],\r
+       ['&icirc;',   '&#238;',  true, 'i - circumflex'],\r
+       ['&iuml;',    '&#239;',  true, 'i - diaeresis'],\r
+       ['&eth;',     '&#240;',  true, 'eth'],\r
+       ['&ntilde;',  '&#241;',  true, 'n - tilde'],\r
+       ['&ograve;',  '&#242;',  true, 'o - grave'],\r
+       ['&oacute;',  '&#243;',  true, 'o - acute'],\r
+       ['&ocirc;',   '&#244;',  true, 'o - circumflex'],\r
+       ['&otilde;',  '&#245;',  true, 'o - tilde'],\r
+       ['&ouml;',    '&#246;',  true, 'o - diaeresis'],\r
+       ['&oslash;',  '&#248;',  true, 'o slash'],\r
+       ['&oelig;',   '&#339;',  true, 'ligature oe'],\r
+       ['&scaron;',  '&#353;',  true, 's - caron'],\r
+       ['&ugrave;',  '&#249;',  true, 'u - grave'],\r
+       ['&uacute;',  '&#250;',  true, 'u - acute'],\r
+       ['&ucirc;',   '&#251;',  true, 'u - circumflex'],\r
+       ['&uuml;',    '&#252;',  true, 'u - diaeresis'],\r
+       ['&yacute;',  '&#253;',  true, 'y - acute'],\r
+       ['&thorn;',   '&#254;',  true, 'thorn'],\r
+       ['&yuml;',    '&#255;',  true, 'y - diaeresis'],\r
+       ['&Alpha;',   '&#913;',  true, 'Alpha'],\r
+       ['&Beta;',    '&#914;',  true, 'Beta'],\r
+       ['&Gamma;',   '&#915;',  true, 'Gamma'],\r
+       ['&Delta;',   '&#916;',  true, 'Delta'],\r
+       ['&Epsilon;', '&#917;',  true, 'Epsilon'],\r
+       ['&Zeta;',    '&#918;',  true, 'Zeta'],\r
+       ['&Eta;',     '&#919;',  true, 'Eta'],\r
+       ['&Theta;',   '&#920;',  true, 'Theta'],\r
+       ['&Iota;',    '&#921;',  true, 'Iota'],\r
+       ['&Kappa;',   '&#922;',  true, 'Kappa'],\r
+       ['&Lambda;',  '&#923;',  true, 'Lambda'],\r
+       ['&Mu;',      '&#924;',  true, 'Mu'],\r
+       ['&Nu;',      '&#925;',  true, 'Nu'],\r
+       ['&Xi;',      '&#926;',  true, 'Xi'],\r
+       ['&Omicron;', '&#927;',  true, 'Omicron'],\r
+       ['&Pi;',      '&#928;',  true, 'Pi'],\r
+       ['&Rho;',     '&#929;',  true, 'Rho'],\r
+       ['&Sigma;',   '&#931;',  true, 'Sigma'],\r
+       ['&Tau;',     '&#932;',  true, 'Tau'],\r
+       ['&Upsilon;', '&#933;',  true, 'Upsilon'],\r
+       ['&Phi;',     '&#934;',  true, 'Phi'],\r
+       ['&Chi;',     '&#935;',  true, 'Chi'],\r
+       ['&Psi;',     '&#936;',  true, 'Psi'],\r
+       ['&Omega;',   '&#937;',  true, 'Omega'],\r
+       ['&alpha;',   '&#945;',  true, 'alpha'],\r
+       ['&beta;',    '&#946;',  true, 'beta'],\r
+       ['&gamma;',   '&#947;',  true, 'gamma'],\r
+       ['&delta;',   '&#948;',  true, 'delta'],\r
+       ['&epsilon;', '&#949;',  true, 'epsilon'],\r
+       ['&zeta;',    '&#950;',  true, 'zeta'],\r
+       ['&eta;',     '&#951;',  true, 'eta'],\r
+       ['&theta;',   '&#952;',  true, 'theta'],\r
+       ['&iota;',    '&#953;',  true, 'iota'],\r
+       ['&kappa;',   '&#954;',  true, 'kappa'],\r
+       ['&lambda;',  '&#955;',  true, 'lambda'],\r
+       ['&mu;',      '&#956;',  true, 'mu'],\r
+       ['&nu;',      '&#957;',  true, 'nu'],\r
+       ['&xi;',      '&#958;',  true, 'xi'],\r
+       ['&omicron;', '&#959;',  true, 'omicron'],\r
+       ['&pi;',      '&#960;',  true, 'pi'],\r
+       ['&rho;',     '&#961;',  true, 'rho'],\r
+       ['&sigmaf;',  '&#962;',  true, 'final sigma'],\r
+       ['&sigma;',   '&#963;',  true, 'sigma'],\r
+       ['&tau;',     '&#964;',  true, 'tau'],\r
+       ['&upsilon;', '&#965;',  true, 'upsilon'],\r
+       ['&phi;',     '&#966;',  true, 'phi'],\r
+       ['&chi;',     '&#967;',  true, 'chi'],\r
+       ['&psi;',     '&#968;',  true, 'psi'],\r
+       ['&omega;',   '&#969;',  true, 'omega'],\r
+// symbols\r
+       ['&alefsym;', '&#8501;', false,'alef symbol'],\r
+       ['&piv;',     '&#982;',  false,'pi symbol'],\r
+       ['&real;',    '&#8476;', false,'real part symbol'],\r
+       ['&thetasym;','&#977;',  false,'theta symbol'],\r
+       ['&upsih;',   '&#978;',  false,'upsilon - hook symbol'],\r
+       ['&weierp;',  '&#8472;', false,'Weierstrass p'],\r
+       ['&image;',   '&#8465;', false,'imaginary part'],\r
+// arrows\r
+       ['&larr;',    '&#8592;', true, 'leftwards arrow'],\r
+       ['&uarr;',    '&#8593;', true, 'upwards arrow'],\r
+       ['&rarr;',    '&#8594;', true, 'rightwards arrow'],\r
+       ['&darr;',    '&#8595;', true, 'downwards arrow'],\r
+       ['&harr;',    '&#8596;', true, 'left right arrow'],\r
+       ['&crarr;',   '&#8629;', false,'carriage return'],\r
+       ['&lArr;',    '&#8656;', false,'leftwards double arrow'],\r
+       ['&uArr;',    '&#8657;', false,'upwards double arrow'],\r
+       ['&rArr;',    '&#8658;', false,'rightwards double arrow'],\r
+       ['&dArr;',    '&#8659;', false,'downwards double arrow'],\r
+       ['&hArr;',    '&#8660;', false,'left right double arrow'],\r
+       ['&there4;',  '&#8756;', false,'therefore'],\r
+       ['&sub;',     '&#8834;', false,'subset of'],\r
+       ['&sup;',     '&#8835;', false,'superset of'],\r
+       ['&nsub;',    '&#8836;', false,'not a subset of'],\r
+       ['&sube;',    '&#8838;', false,'subset of or equal to'],\r
+       ['&supe;',    '&#8839;', false,'superset of or equal to'],\r
+       ['&oplus;',   '&#8853;', false,'circled plus'],\r
+       ['&otimes;',  '&#8855;', false,'circled times'],\r
+       ['&perp;',    '&#8869;', false,'perpendicular'],\r
+       ['&sdot;',    '&#8901;', false,'dot operator'],\r
+       ['&lceil;',   '&#8968;', false,'left ceiling'],\r
+       ['&rceil;',   '&#8969;', false,'right ceiling'],\r
+       ['&lfloor;',  '&#8970;', false,'left floor'],\r
+       ['&rfloor;',  '&#8971;', false,'right floor'],\r
+       ['&lang;',    '&#9001;', false,'left-pointing angle bracket'],\r
+       ['&rang;',    '&#9002;', false,'right-pointing angle bracket'],\r
+       ['&loz;',     '&#9674;', true, 'lozenge'],\r
+       ['&spades;',  '&#9824;', true, 'black spade suit'],\r
+       ['&clubs;',   '&#9827;', true, 'black club suit'],\r
+       ['&hearts;',  '&#9829;', true, 'black heart suit'],\r
+       ['&diams;',   '&#9830;', true, 'black diamond suit'],\r
+       ['&ensp;',    '&#8194;', false,'en space'],\r
+       ['&emsp;',    '&#8195;', false,'em space'],\r
+       ['&thinsp;',  '&#8201;', false,'thin space'],\r
+       ['&zwnj;',    '&#8204;', false,'zero width non-joiner'],\r
+       ['&zwj;',     '&#8205;', false,'zero width joiner'],\r
+       ['&lrm;',     '&#8206;', false,'left-to-right mark'],\r
+       ['&rlm;',     '&#8207;', false,'right-to-left mark'],\r
+       ['&shy;',     '&#173;',  false,'soft hyphen']\r
+];\r
+\r
+tinyMCEPopup.onInit.add(function() {\r
+       tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());\r
+       addKeyboardNavigation();\r
+});\r
+\r
+function addKeyboardNavigation(){\r
+       var tableElm, cells, settings;\r
+\r
+       cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup");\r
+\r
+       settings ={\r
+               root: "charmapgroup",\r
+               items: cells\r
+       };\r
+       cells[0].tabindex=0;\r
+       tinyMCEPopup.dom.addClass(cells[0], "mceFocus");\r
+       if (tinymce.isGecko) {\r
+               cells[0].focus();               \r
+       } else {\r
+               setTimeout(function(){\r
+                       cells[0].focus();\r
+               }, 100);\r
+       }\r
+       tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);\r
+}\r
+\r
+function renderCharMapHTML() {\r
+       var charsPerRow = 20, tdWidth=20, tdHeight=20, i;\r
+       var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+\r
+       '<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + \r
+       '"><tr height="' + tdHeight + '">';\r
+       var cols=-1;\r
+\r
+       for (i=0; i<charmap.length; i++) {\r
+               var previewCharFn;\r
+\r
+               if (charmap[i][2]==true) {\r
+                       cols++;\r
+                       previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';\r
+                       html += ''\r
+                               + '<td class="charmap">'\r
+                               + '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + ' '+ tinyMCEPopup.editor.translate("advanced_dlg.charmap_usage")+'">'\r
+                               + charmap[i][1]\r
+                               + '</a></td>';\r
+                       if ((cols+1) % charsPerRow == 0)\r
+                               html += '</tr><tr height="' + tdHeight + '">';\r
+               }\r
+        }\r
+\r
+       if (cols % charsPerRow > 0) {\r
+               var padd = charsPerRow - (cols % charsPerRow);\r
+               for (var i=0; i<padd-1; i++)\r
+                       html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';\r
+       }\r
+\r
+       html += '</tr></table></div>';\r
+       html = html.replace(/<tr height="20"><\/tr>/g, '');\r
+\r
+       return html;\r
+}\r
+\r
+function insertChar(chr) {\r
+       tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');\r
+\r
+       // Refocus in window\r
+       if (tinyMCEPopup.isWindow)\r
+               window.focus();\r
+\r
+       tinyMCEPopup.editor.focus();\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function previewChar(codeA, codeB, codeN) {\r
+       var elmA = document.getElementById('codeA');\r
+       var elmB = document.getElementById('codeB');\r
+       var elmV = document.getElementById('codeV');\r
+       var elmN = document.getElementById('codeN');\r
+\r
+       if (codeA=='#160;') {\r
+               elmV.innerHTML = '__';\r
+       } else {\r
+               elmV.innerHTML = '&' + codeA;\r
+       }\r
+\r
+       elmB.innerHTML = '&amp;' + codeA;\r
+       elmA.innerHTML = '&amp;' + codeB;\r
+       elmN.innerHTML = codeN;\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/color_picker.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/color_picker.js
new file mode 100644 (file)
index 0000000..cc891c1
--- /dev/null
@@ -0,0 +1,345 @@
+tinyMCEPopup.requireLangPack();
+
+var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
+
+var colors = [
+       "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
+       "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
+       "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
+       "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
+       "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
+       "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
+       "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
+       "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
+       "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
+       "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
+       "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
+       "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
+       "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
+       "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
+       "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
+       "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
+       "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
+       "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
+       "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
+       "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
+       "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
+       "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
+       "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
+       "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
+       "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
+       "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
+       "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
+];
+
+var named = {
+       '#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
+       '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
+       '#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
+       '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
+       '#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
+       '#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
+       '#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
+       '#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
+       '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
+       '#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
+       '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
+       '#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
+       '#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
+       '#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
+       '#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
+       '#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
+       '#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
+       '#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
+       '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
+       '#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
+       '#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
+       '#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
+       '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
+};
+
+var namedLookup = {};
+
+function init() {
+       var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
+
+       tinyMCEPopup.resizeToInnerSize();
+
+       generatePicker();
+       generateWebColors();
+       generateNamedColors();
+
+       if (inputColor) {
+               changeFinalColor(inputColor);
+
+               col = convertHexToRGB(inputColor);
+
+               if (col)
+                       updateLight(col.r, col.g, col.b);
+       }
+
+       for (key in named) {
+               value = named[key];
+               namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
+       }
+}
+
+function toHexColor(color) {
+       var matches, red, green, blue, toInt = parseInt;
+
+       function hex(value) {
+               value = parseInt(value).toString(16);
+
+               return value.length > 1 ? value : '0' + value; // Padd with leading zero
+       };
+
+       color = tinymce.trim(color);
+       color = color.replace(/^[#]/, '').toLowerCase();  // remove leading '#'
+       color = namedLookup[color] || color;
+
+       matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/.exec(color);
+
+       if (matches) {
+               red   = toInt(matches[1]);
+               green = toInt(matches[2]);
+               blue  = toInt(matches[3]);
+       } else {
+               matches = /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(color);
+
+               if (matches) {
+                       red   = toInt(matches[1], 16);
+                       green = toInt(matches[2], 16);
+                       blue  = toInt(matches[3], 16);
+               } else {
+                       matches = /^([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(color);
+
+                       if (matches) {
+                               red   = toInt(matches[1] + matches[1], 16);
+                               green = toInt(matches[2] + matches[2], 16);
+                               blue  = toInt(matches[3] + matches[3], 16);
+                       } else {
+                               return '';
+                       }
+               }
+       }
+
+       return '#' + hex(red) + hex(green) + hex(blue);
+}
+
+function insertAction() {
+       var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
+
+       var hexColor = toHexColor(color);
+
+       if (hexColor === '') {
+               var text = tinyMCEPopup.editor.getLang('advanced_dlg.invalid_color_value');
+               tinyMCEPopup.alert(text + ': ' + color);
+       }
+       else {
+               tinyMCEPopup.restoreSelection();
+
+               if (f)
+                       f(hexColor);
+
+               tinyMCEPopup.close();
+       }
+}
+
+function showColor(color, name) {
+       if (name)
+               document.getElementById("colorname").innerHTML = name;
+
+       document.getElementById("preview").style.backgroundColor = color;
+       document.getElementById("color").value = color.toUpperCase();
+}
+
+function convertRGBToHex(col) {
+       var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+       if (!col)
+               return col;
+
+       var rgb = col.replace(re, "$1,$2,$3").split(',');
+       if (rgb.length == 3) {
+               r = parseInt(rgb[0]).toString(16);
+               g = parseInt(rgb[1]).toString(16);
+               b = parseInt(rgb[2]).toString(16);
+
+               r = r.length == 1 ? '0' + r : r;
+               g = g.length == 1 ? '0' + g : g;
+               b = b.length == 1 ? '0' + b : b;
+
+               return "#" + r + g + b;
+       }
+
+       return col;
+}
+
+function convertHexToRGB(col) {
+       if (col.indexOf('#') != -1) {
+               col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
+
+               r = parseInt(col.substring(0, 2), 16);
+               g = parseInt(col.substring(2, 4), 16);
+               b = parseInt(col.substring(4, 6), 16);
+
+               return {r : r, g : g, b : b};
+       }
+
+       return null;
+}
+
+function generatePicker() {
+       var el = document.getElementById('light'), h = '', i;
+
+       for (i = 0; i < detail; i++){
+               h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
+               + ' onclick="changeFinalColor(this.style.backgroundColor)"'
+               + ' onmousedown="isMouseDown = true; return false;"'
+               + ' onmouseup="isMouseDown = false;"'
+               + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
+               + ' onmouseover="isMouseOver = true;"'
+               + ' onmouseout="isMouseOver = false;"'
+               + '></div>';
+       }
+
+       el.innerHTML = h;
+}
+
+function generateWebColors() {
+       var el = document.getElementById('webcolors'), h = '', i;
+
+       if (el.className == 'generated')
+               return;
+
+       // TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
+       h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" border="0" cellspacing="1" cellpadding="0">'
+               + '<tr>';
+
+       for (i=0; i<colors.length; i++) {
+               h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+                       + '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
+               if (tinyMCEPopup.editor.forcedHighContrastMode) {
+                       h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
+               }
+               h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
+               h += '</a></td>';
+               if ((i+1) % 18 == 0)
+                       h += '</tr><tr>';
+       }
+
+       h += '</table></div>';
+
+       el.innerHTML = h;
+       el.className = 'generated';
+
+       paintCanvas(el);
+       enableKeyboardNavigation(el.firstChild);
+}
+
+function paintCanvas(el) {
+       tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
+               var context;
+               if (canvas.getContext && (context = canvas.getContext("2d"))) {
+                       context.fillStyle = canvas.getAttribute('data-color');
+                       context.fillRect(0, 0, 10, 10);
+               }
+       });
+}
+function generateNamedColors() {
+       var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
+
+       if (el.className == 'generated')
+               return;
+
+       for (n in named) {
+               v = named[n];
+               h += '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
+               if (tinyMCEPopup.editor.forcedHighContrastMode) {
+                       h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
+               }
+               h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
+               h += '</a>';
+               i++;
+       }
+
+       el.innerHTML = h;
+       el.className = 'generated';
+
+       paintCanvas(el);
+       enableKeyboardNavigation(el);
+}
+
+function enableKeyboardNavigation(el) {
+       tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
+               root: el,
+               items: tinyMCEPopup.dom.select('a', el)
+       }, tinyMCEPopup.dom);
+}
+
+function dechex(n) {
+       return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
+}
+
+function computeColor(e) {
+       var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB, pos = tinyMCEPopup.dom.getPos(e.target);
+
+       x = e.offsetX ? e.offsetX : (e.target ? e.clientX - pos.x : 0);
+       y = e.offsetY ? e.offsetY : (e.target ? e.clientY - pos.y : 0);
+
+       partWidth = document.getElementById('colors').width / 6;
+       partDetail = detail / 2;
+       imHeight = document.getElementById('colors').height;
+
+       r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
+       g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255     + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
+       b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
+
+       coef = (imHeight - y) / imHeight;
+       r = 128 + (r - 128) * coef;
+       g = 128 + (g - 128) * coef;
+       b = 128 + (b - 128) * coef;
+
+       changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
+       updateLight(r, g, b);
+}
+
+function updateLight(r, g, b) {
+       var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
+
+       for (i=0; i<detail; i++) {
+               if ((i>=0) && (i<partDetail)) {
+                       finalCoef = i / partDetail;
+                       finalR = dechex(255 - (255 - r) * finalCoef);
+                       finalG = dechex(255 - (255 - g) * finalCoef);
+                       finalB = dechex(255 - (255 - b) * finalCoef);
+               } else {
+                       finalCoef = 2 - i / partDetail;
+                       finalR = dechex(r * finalCoef);
+                       finalG = dechex(g * finalCoef);
+                       finalB = dechex(b * finalCoef);
+               }
+
+               color = finalR + finalG + finalB;
+
+               setCol('gs' + i, '#'+color);
+       }
+}
+
+function changeFinalColor(color) {
+       if (color.indexOf('#') == -1)
+               color = convertRGBToHex(color);
+
+       setCol('preview', color);
+       document.getElementById('color').value = color;
+}
+
+function setCol(e, c) {
+       try {
+               document.getElementById(e).style.backgroundColor = c;
+       } catch (ex) {
+               // Ignore IE warning
+       }
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/image.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/image.js
new file mode 100644 (file)
index 0000000..bb09e75
--- /dev/null
@@ -0,0 +1,253 @@
+var ImageDialog = {\r
+       preInit : function() {\r
+               var url;\r
+\r
+               tinyMCEPopup.requireLangPack();\r
+\r
+               if (url = tinyMCEPopup.getParam("external_image_list_url"))\r
+                       document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
+       },\r
+\r
+       init : function() {\r
+               var f = document.forms[0], ed = tinyMCEPopup.editor;\r
+\r
+               // Setup browse button\r
+               document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');\r
+               if (isVisible('srcbrowser'))\r
+                       document.getElementById('src').style.width = '180px';\r
+\r
+               e = ed.selection.getNode();\r
+\r
+               this.fillFileList('image_list', tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList'));\r
+\r
+               if (e.nodeName == 'IMG') {\r
+                       f.src.value = ed.dom.getAttrib(e, 'src');\r
+                       f.alt.value = ed.dom.getAttrib(e, 'alt');\r
+                       f.border.value = this.getAttrib(e, 'border');\r
+                       f.vspace.value = this.getAttrib(e, 'vspace');\r
+                       f.hspace.value = this.getAttrib(e, 'hspace');\r
+                       f.width.value = ed.dom.getAttrib(e, 'width');\r
+                       f.height.value = ed.dom.getAttrib(e, 'height');\r
+                       f.insert.value = ed.getLang('update');\r
+                       this.styleVal = ed.dom.getAttrib(e, 'style');\r
+                       selectByValue(f, 'image_list', f.src.value);\r
+                       selectByValue(f, 'align', this.getAttrib(e, 'align'));\r
+                       this.updateStyle();\r
+               }\r
+       },\r
+\r
+       fillFileList : function(id, l) {\r
+               var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
+\r
+               l = typeof(l) === 'function' ? l() : window[l];\r
+\r
+               if (l && l.length > 0) {\r
+                       lst.options[lst.options.length] = new Option('', '');\r
+\r
+                       tinymce.each(l, function(o) {\r
+                               lst.options[lst.options.length] = new Option(o[0], o[1]);\r
+                       });\r
+               } else\r
+                       dom.remove(dom.getParent(id, 'tr'));\r
+       },\r
+\r
+       update : function() {\r
+               var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;\r
+\r
+               tinyMCEPopup.restoreSelection();\r
+\r
+               if (f.src.value === '') {\r
+                       if (ed.selection.getNode().nodeName == 'IMG') {\r
+                               ed.dom.remove(ed.selection.getNode());\r
+                               ed.execCommand('mceRepaint');\r
+                       }\r
+\r
+                       tinyMCEPopup.close();\r
+                       return;\r
+               }\r
+\r
+               if (!ed.settings.inline_styles) {\r
+                       args = tinymce.extend(args, {\r
+                               vspace : nl.vspace.value,\r
+                               hspace : nl.hspace.value,\r
+                               border : nl.border.value,\r
+                               align : getSelectValue(f, 'align')\r
+                       });\r
+               } else\r
+                       args.style = this.styleVal;\r
+\r
+               tinymce.extend(args, {\r
+                       src : f.src.value.replace(/ /g, '%20'),\r
+                       alt : f.alt.value,\r
+                       width : f.width.value,\r
+                       height : f.height.value\r
+               });\r
+\r
+               el = ed.selection.getNode();\r
+\r
+               if (el && el.nodeName == 'IMG') {\r
+                       ed.dom.setAttribs(el, args);\r
+                       tinyMCEPopup.editor.execCommand('mceRepaint');\r
+                       tinyMCEPopup.editor.focus();\r
+               } else {\r
+                       tinymce.each(args, function(value, name) {\r
+                               if (value === "") {\r
+                                       delete args[name];\r
+                               }\r
+                       });\r
+\r
+                       ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});\r
+                       ed.undoManager.add();\r
+               }\r
+\r
+               tinyMCEPopup.close();\r
+       },\r
+\r
+       updateStyle : function() {\r
+               var dom = tinyMCEPopup.dom, st = {}, v, f = document.forms[0];\r
+\r
+               if (tinyMCEPopup.editor.settings.inline_styles) {\r
+                       tinymce.each(tinyMCEPopup.dom.parseStyle(this.styleVal), function(value, key) {\r
+                               st[key] = value;\r
+                       });\r
+\r
+                       // Handle align\r
+                       v = getSelectValue(f, 'align');\r
+                       if (v) {\r
+                               if (v == 'left' || v == 'right') {\r
+                                       st['float'] = v;\r
+                                       delete st['vertical-align'];\r
+                               } else {\r
+                                       st['vertical-align'] = v;\r
+                                       delete st['float'];\r
+                               }\r
+                       } else {\r
+                               delete st['float'];\r
+                               delete st['vertical-align'];\r
+                       }\r
+\r
+                       // Handle border\r
+                       v = f.border.value;\r
+                       if (v || v == '0') {\r
+                               if (v == '0')\r
+                                       st['border'] = '0';\r
+                               else\r
+                                       st['border'] = v + 'px solid black';\r
+                       } else\r
+                               delete st['border'];\r
+\r
+                       // Handle hspace\r
+                       v = f.hspace.value;\r
+                       if (v) {\r
+                               delete st['margin'];\r
+                               st['margin-left'] = v + 'px';\r
+                               st['margin-right'] = v + 'px';\r
+                       } else {\r
+                               delete st['margin-left'];\r
+                               delete st['margin-right'];\r
+                       }\r
+\r
+                       // Handle vspace\r
+                       v = f.vspace.value;\r
+                       if (v) {\r
+                               delete st['margin'];\r
+                               st['margin-top'] = v + 'px';\r
+                               st['margin-bottom'] = v + 'px';\r
+                       } else {\r
+                               delete st['margin-top'];\r
+                               delete st['margin-bottom'];\r
+                       }\r
+\r
+                       // Merge\r
+                       st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');\r
+                       this.styleVal = dom.serializeStyle(st, 'img');\r
+               }\r
+       },\r
+\r
+       getAttrib : function(e, at) {\r
+               var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;\r
+\r
+               if (ed.settings.inline_styles) {\r
+                       switch (at) {\r
+                               case 'align':\r
+                                       if (v = dom.getStyle(e, 'float'))\r
+                                               return v;\r
+\r
+                                       if (v = dom.getStyle(e, 'vertical-align'))\r
+                                               return v;\r
+\r
+                                       break;\r
+\r
+                               case 'hspace':\r
+                                       v = dom.getStyle(e, 'margin-left')\r
+                                       v2 = dom.getStyle(e, 'margin-right');\r
+                                       if (v && v == v2)\r
+                                               return parseInt(v.replace(/[^0-9]/g, ''));\r
+\r
+                                       break;\r
+\r
+                               case 'vspace':\r
+                                       v = dom.getStyle(e, 'margin-top')\r
+                                       v2 = dom.getStyle(e, 'margin-bottom');\r
+                                       if (v && v == v2)\r
+                                               return parseInt(v.replace(/[^0-9]/g, ''));\r
+\r
+                                       break;\r
+\r
+                               case 'border':\r
+                                       v = 0;\r
+\r
+                                       tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {\r
+                                               sv = dom.getStyle(e, 'border-' + sv + '-width');\r
+\r
+                                               // False or not the same as prev\r
+                                               if (!sv || (sv != v && v !== 0)) {\r
+                                                       v = 0;\r
+                                                       return false;\r
+                                               }\r
+\r
+                                               if (sv)\r
+                                                       v = sv;\r
+                                       });\r
+\r
+                                       if (v)\r
+                                               return parseInt(v.replace(/[^0-9]/g, ''));\r
+\r
+                                       break;\r
+                       }\r
+               }\r
+\r
+               if (v = dom.getAttrib(e, at))\r
+                       return v;\r
+\r
+               return '';\r
+       },\r
+\r
+       resetImageData : function() {\r
+               var f = document.forms[0];\r
+\r
+               f.width.value = f.height.value = "";    \r
+       },\r
+\r
+       updateImageData : function() {\r
+               var f = document.forms[0], t = ImageDialog;\r
+\r
+               if (f.width.value == "")\r
+                       f.width.value = t.preloadImg.width;\r
+\r
+               if (f.height.value == "")\r
+                       f.height.value = t.preloadImg.height;\r
+       },\r
+\r
+       getImageData : function() {\r
+               var f = document.forms[0];\r
+\r
+               this.preloadImg = new Image();\r
+               this.preloadImg.onload = this.updateImageData;\r
+               this.preloadImg.onerror = this.resetImageData;\r
+               this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);\r
+       }\r
+};\r
+\r
+ImageDialog.preInit();\r
+tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/link.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/link.js
new file mode 100644 (file)
index 0000000..8c1d73c
--- /dev/null
@@ -0,0 +1,159 @@
+tinyMCEPopup.requireLangPack();\r
+\r
+var LinkDialog = {\r
+       preInit : function() {\r
+               var url;\r
+\r
+               if (url = tinyMCEPopup.getParam("external_link_list_url"))\r
+                       document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
+       },\r
+\r
+       init : function() {\r
+               var f = document.forms[0], ed = tinyMCEPopup.editor;\r
+\r
+               // Setup browse button\r
+               document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');\r
+               if (isVisible('hrefbrowser'))\r
+                       document.getElementById('href').style.width = '180px';\r
+\r
+               this.fillClassList('class_list');\r
+               this.fillFileList('link_list', 'tinyMCELinkList');\r
+               this.fillTargetList('target_list');\r
+\r
+               if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {\r
+                       f.href.value = ed.dom.getAttrib(e, 'href');\r
+                       f.linktitle.value = ed.dom.getAttrib(e, 'title');\r
+                       f.insert.value = ed.getLang('update');\r
+                       selectByValue(f, 'link_list', f.href.value);\r
+                       selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));\r
+                       selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));\r
+               }\r
+       },\r
+\r
+       update : function() {\r
+               var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20');\r
+\r
+               tinyMCEPopup.restoreSelection();\r
+               e = ed.dom.getParent(ed.selection.getNode(), 'A');\r
+\r
+               // Remove element if there is no href\r
+               if (!f.href.value) {\r
+                       if (e) {\r
+                               b = ed.selection.getBookmark();\r
+                               ed.dom.remove(e, 1);\r
+                               ed.selection.moveToBookmark(b);\r
+                               tinyMCEPopup.execCommand("mceEndUndoLevel");\r
+                               tinyMCEPopup.close();\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               // Create new anchor elements\r
+               if (e == null) {\r
+                       ed.getDoc().execCommand("unlink", false, null);\r
+                       tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});\r
+\r
+                       tinymce.each(ed.dom.select("a"), function(n) {\r
+                               if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {\r
+                                       e = n;\r
+\r
+                                       ed.dom.setAttribs(e, {\r
+                                               href : href,\r
+                                               title : f.linktitle.value,\r
+                                               target : f.target_list ? getSelectValue(f, "target_list") : null,\r
+                                               'class' : f.class_list ? getSelectValue(f, "class_list") : null\r
+                                       });\r
+                               }\r
+                       });\r
+               } else {\r
+                       ed.dom.setAttribs(e, {\r
+                               href : href,\r
+                               title : f.linktitle.value\r
+                       });\r
+       \r
+                       if (f.target_list) {\r
+                               ed.dom.setAttrib(e, 'target', getSelectValue(f, "target_list"));\r
+                       }\r
+\r
+                       if (f.class_list) {\r
+                               ed.dom.setAttrib(e, 'class', getSelectValue(f, "class_list"));\r
+                       }\r
+               }\r
+\r
+               // Don't move caret if selection was image\r
+               if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {\r
+                       ed.focus();\r
+                       ed.selection.select(e);\r
+                       ed.selection.collapse(0);\r
+                       tinyMCEPopup.storeSelection();\r
+               }\r
+\r
+               tinyMCEPopup.execCommand("mceEndUndoLevel");\r
+               tinyMCEPopup.close();\r
+       },\r
+\r
+       checkPrefix : function(n) {\r
+               if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))\r
+                       n.value = 'mailto:' + n.value;\r
+\r
+               if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))\r
+                       n.value = 'http://' + n.value;\r
+       },\r
+\r
+       fillFileList : function(id, l) {\r
+               var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
+\r
+               l = window[l];\r
+\r
+               if (l && l.length > 0) {\r
+                       lst.options[lst.options.length] = new Option('', '');\r
+\r
+                       tinymce.each(l, function(o) {\r
+                               lst.options[lst.options.length] = new Option(o[0], o[1]);\r
+                       });\r
+               } else\r
+                       dom.remove(dom.getParent(id, 'tr'));\r
+       },\r
+\r
+       fillClassList : function(id) {\r
+               var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
+\r
+               if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {\r
+                       cl = [];\r
+\r
+                       tinymce.each(v.split(';'), function(v) {\r
+                               var p = v.split('=');\r
+\r
+                               cl.push({'title' : p[0], 'class' : p[1]});\r
+                       });\r
+               } else\r
+                       cl = tinyMCEPopup.editor.dom.getClasses();\r
+\r
+               if (cl.length > 0) {\r
+                       lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');\r
+\r
+                       tinymce.each(cl, function(o) {\r
+                               lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);\r
+                       });\r
+               } else\r
+                       dom.remove(dom.getParent(id, 'tr'));\r
+       },\r
+\r
+       fillTargetList : function(id) {\r
+               var dom = tinyMCEPopup.dom, lst = dom.get(id), v;\r
+\r
+               lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');\r
+               lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');\r
+               lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');\r
+\r
+               if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {\r
+                       tinymce.each(v.split(','), function(v) {\r
+                               v = v.split('=');\r
+                               lst.options[lst.options.length] = new Option(v[0], v[1]);\r
+                       });\r
+               }\r
+       }\r
+};\r
+\r
+LinkDialog.preInit();\r
+tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/source_editor.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/js/source_editor.js
new file mode 100644 (file)
index 0000000..dd5e366
--- /dev/null
@@ -0,0 +1,78 @@
+tinyMCEPopup.requireLangPack();\r
+tinyMCEPopup.onInit.add(onLoadInit);\r
+\r
+function saveContent() {\r
+       tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function onLoadInit() {\r
+       tinyMCEPopup.resizeToInnerSize();\r
+\r
+       // Remove Gecko spellchecking\r
+       if (tinymce.isGecko)\r
+               document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");\r
+\r
+       document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});\r
+\r
+       if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {\r
+               turnWrapOn();\r
+               document.getElementById('wraped').checked = true;\r
+       }\r
+\r
+       resizeInputs();\r
+}\r
+\r
+function setWrap(val) {\r
+       var v, n, s = document.getElementById('htmlSource');\r
+\r
+       s.wrap = val;\r
+\r
+       if (!tinymce.isIE) {\r
+               v = s.value;\r
+               n = s.cloneNode(false);\r
+               n.setAttribute("wrap", val);\r
+               s.parentNode.replaceChild(n, s);\r
+               n.value = v;\r
+       }\r
+}\r
+\r
+function setWhiteSpaceCss(value) {\r
+       var el = document.getElementById('htmlSource');\r
+       tinymce.DOM.setStyle(el, 'white-space', value);\r
+}\r
+\r
+function turnWrapOff() {\r
+       if (tinymce.isWebKit) {\r
+               setWhiteSpaceCss('pre');\r
+       } else {\r
+               setWrap('off');\r
+       }\r
+}\r
+\r
+function turnWrapOn() {\r
+       if (tinymce.isWebKit) {\r
+               setWhiteSpaceCss('pre-wrap');\r
+       } else {\r
+               setWrap('soft');\r
+       }\r
+}\r
+\r
+function toggleWordWrap(elm) {\r
+       if (elm.checked) {\r
+               turnWrapOn();\r
+       } else {\r
+               turnWrapOff();\r
+       }\r
+}\r
+\r
+function resizeInputs() {\r
+       var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
+\r
+       el = document.getElementById('htmlSource');\r
+\r
+       if (el) {\r
+               el.style.width = (vp.w - 20) + 'px';\r
+               el.style.height = (vp.h - 65) + 'px';\r
+       }\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/langs/en.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/langs/en.js
new file mode 100644 (file)
index 0000000..6e58481
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.advanced',{"underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)",dd:"Definition Description",dt:"Definition Term ",samp:"Code Sample",code:"Code",blockquote:"Block Quote",h6:"Heading 6",h5:"Heading 5",h4:"Heading 4",h3:"Heading 3",h2:"Heading 2",h1:"Heading 1",pre:"Preformatted",address:"Address",div:"DIV",paragraph:"Paragraph",block:"Format",fontdefault:"Font Family","font_size":"Font Size","style_select":"Styles","anchor_delta_height":"","anchor_delta_width":"","charmap_delta_height":"","charmap_delta_width":"","colorpicker_delta_height":"","colorpicker_delta_width":"","link_delta_height":"","link_delta_width":"","image_delta_height":"","image_delta_width":"","more_colors":"More Colors...","toolbar_focus":"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",newdocument:"Are you sure you want clear all contents?",path:"Path","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","blockquote_desc":"Block Quote","help_desc":"Help","newdocument_desc":"New Document","image_props_desc":"Image Properties","paste_desc":"Paste (Ctrl+V)","copy_desc":"Copy (Ctrl+C)","cut_desc":"Cut (Ctrl+X)","anchor_desc":"Insert/Edit Anchor","visualaid_desc":"show/Hide Guidelines/Invisible Elements","charmap_desc":"Insert Special Character","backcolor_desc":"Select Background Color","forecolor_desc":"Select Text Color","custom1_desc":"Your Custom Description Here","removeformat_desc":"Remove Formatting","hr_desc":"Insert Horizontal Line","sup_desc":"Superscript","sub_desc":"Subscript","code_desc":"Edit HTML Source","cleanup_desc":"Cleanup Messy Code","image_desc":"Insert/Edit Image","unlink_desc":"Unlink","link_desc":"Insert/Edit Link","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","indent_desc":"Increase Indent","outdent_desc":"Decrease Indent","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","justifyfull_desc":"Align Full","justifyright_desc":"Align Right","justifycenter_desc":"Align Center","justifyleft_desc":"Align Left","striketrough_desc":"Strikethrough","help_shortcut":"Press ALT-F10 for toolbar. Press ALT-0 for help","rich_text_area":"Rich Text Area","shortcuts_desc":"Accessability Help",toolbar:"Toolbar"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/langs/en_dlg.js b/3.x/src/resources/javascript/TinyMCE/themes/advanced/langs/en_dlg.js
new file mode 100644 (file)
index 0000000..50cd87e
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","invalid_color_value":"Invalid color value","":""});
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/link.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/link.htm
new file mode 100644 (file)
index 0000000..5d9dea9
--- /dev/null
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.link_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
+       <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
+       <script type="text/javascript" src="js/link.js"></script>\r
+</head>\r
+<body id="link" style="display: none">\r
+<form onsubmit="LinkDialog.update();return false;" action="#">\r
+       <div class="tabs">\r
+               <ul>\r
+                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.link_title}</a></span></li>\r
+               </ul>\r
+       </div>\r
+\r
+       <div class="panel_wrapper">\r
+               <div id="general_panel" class="panel current">\r
+                       <table border="0" cellpadding="4" cellspacing="0">\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>\r
+                                       <td><table border="0" cellspacing="0" cellpadding="0"> \r
+                                               <tr> \r
+                                                       <td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> \r
+                                                       <td id="hrefbrowsercontainer">&nbsp;</td>\r
+                                               </tr> \r
+                                       </table></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="link_list">{#advanced_dlg.link_list}</label></td>\r
+                                       <td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>\r
+                                       <td><select id="target_list" name="target_list"></select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>\r
+                                       <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="class_list">{#class_name}</label></td>\r
+                                       <td><select id="class_list" name="class_list"></select></td>\r
+                               </tr>\r
+                       </table>\r
+               </div>\r
+       </div>\r
+\r
+       <div class="mceActionPanel">\r
+               <input type="submit" id="insert" name="insert" value="{#insert}" />\r
+               <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
+       </div>\r
+</form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/shortcuts.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/shortcuts.htm
new file mode 100644 (file)
index 0000000..20ec2f5
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+       <head>\r
+               <title>{#advanced_dlg.accessibility_help}</title>\r
+               <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+               <script type="text/javascript">tinyMCEPopup.requireLangPack();</script>\r
+       </head>\r
+       <body id="content">\r
+               <h1>{#advanced_dlg.accessibility_usage_title}</h1>\r
+               <h2>Toolbars</h2>\r
+               <p>Press ALT-F10 to move focus to the toolbars. Navigate through the buttons using the arrow keys.\r
+               Press enter to activate a button and return focus to the editor.\r
+               Press escape to return focus to the editor without performing any actions.</p>\r
+               \r
+               <h2>Status Bar</h2>\r
+               <p>To access the editor status bar, press ALT-F11. Use the left and right arrow keys to navigate between elements in the path.\r
+               Press enter or space to select an element. Press escape to return focus to the editor without changing the selection.</p>\r
+               \r
+               <h2>Context Menu</h2>\r
+               <p>Press shift-F10 to activate the context menu. Use the up and down arrow keys to move between menu items. To open sub-menus press the right arrow key.\r
+               To close submenus press the left arrow key.  Press escape to close the context menu.</p>\r
+               \r
+               <h1>Keyboard Shortcuts</h1>\r
+               <table>\r
+                       <thead>\r
+                               <tr>\r
+                                       <th>Keystroke</th>\r
+                                       <th>Function</th>\r
+                               </tr>\r
+                       </thead>\r
+                       <tbody>\r
+                               <tr>\r
+                                       <td>Control-B</td><td>Bold</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td>Control-I</td><td>Italic</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td>Control-Z</td><td>Undo</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td>Control-Y</td><td>Redo</td>\r
+                               </tr>\r
+                       </tbody>\r
+               </table>\r
+       </body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/content.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/content.css
new file mode 100644 (file)
index 0000000..2fd94a1
--- /dev/null
@@ -0,0 +1,50 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}\r
+body {background:#FFF;}\r
+body.mceForceColors {background:#FFF; color:#000;}\r
+body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;}\r
+h1 {font-size: 2em}\r
+h2 {font-size: 1.5em}\r
+h3 {font-size: 1.17em}\r
+h4 {font-size: 1em}\r
+h5 {font-size: .83em}\r
+h6 {font-size: .75em}\r
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}\r
+a.mceItemAnchor {display:inline-block; -webkit-user-select:all; -webkit-user-modify:read-only; -moz-user-select:all; -moz-user-modify:read-only; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat center center}\r
+span.mceItemNbsp {background: #DDD}\r
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}\r
+img {border:0;}\r
+table, img, hr, .mceItemAnchor {cursor:default}\r
+table td, table th {cursor:text}\r
+ins {border-bottom:1px solid green; text-decoration: none; color:green}\r
+del {color:red; text-decoration:line-through}\r
+cite {border-bottom:1px dashed blue}\r
+acronym {border-bottom:1px dotted #CCC; cursor:help}\r
+abbr {border-bottom:1px dashed #CCC; cursor:help}\r
+\r
+/* IE */\r
+* html body {\r
+scrollbar-3dlight-color:#F0F0EE;\r
+scrollbar-arrow-color:#676662;\r
+scrollbar-base-color:#F0F0EE;\r
+scrollbar-darkshadow-color:#DDD;\r
+scrollbar-face-color:#E0E0DD;\r
+scrollbar-highlight-color:#F0F0EE;\r
+scrollbar-shadow-color:#F0F0EE;\r
+scrollbar-track-color:#F5F5F5;\r
+}\r
+\r
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}\r
+font[face=mceinline] {font-family:inherit !important}\r
+*[contentEditable]:focus {outline:0}\r
+\r
+.mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc}\r
+.mceItemShockWave {background-image:url(../../img/shockwave.gif)}\r
+.mceItemFlash {background-image:url(../../img/flash.gif)}\r
+.mceItemQuickTime {background-image:url(../../img/quicktime.gif)}\r
+.mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)}\r
+.mceItemRealMedia {background-image:url(../../img/realmedia.gif)}\r
+.mceItemVideo {background-image:url(../../img/video.gif)}\r
+.mceItemAudio {background-image:url(../../img/video.gif)}\r
+.mceItemEmbeddedAudio {background-image:url(../../img/video.gif)}\r
+.mceItemIframe {background-image:url(../../img/iframe.gif)}\r
+.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/dialog.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/dialog.css
new file mode 100644 (file)
index 0000000..879786f
--- /dev/null
@@ -0,0 +1,118 @@
+/* Generic */\r
+body {\r
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;\r
+scrollbar-3dlight-color:#F0F0EE;\r
+scrollbar-arrow-color:#676662;\r
+scrollbar-base-color:#F0F0EE;\r
+scrollbar-darkshadow-color:#DDDDDD;\r
+scrollbar-face-color:#E0E0DD;\r
+scrollbar-highlight-color:#F0F0EE;\r
+scrollbar-shadow-color:#F0F0EE;\r
+scrollbar-track-color:#F5F5F5;\r
+background:#F0F0EE;\r
+padding:0;\r
+margin:8px 8px 0 8px;\r
+}\r
+\r
+html {background:#F0F0EE;}\r
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+textarea {resize:none;outline:none;}\r
+a:link, a:visited {color:black;}\r
+a:hover {color:#2B6FB6;}\r
+.nowrap {white-space: nowrap}\r
+\r
+/* Forms */\r
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}\r
+legend {color:#2B6FB6; font-weight:bold;}\r
+label.msg {display:none;}\r
+label.invalid {color:#EE0000; display:inline;}\r
+input.invalid {border:1px solid #EE0000;}\r
+input {background:#FFF; border:1px solid #CCC;}\r
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+input, select, textarea {border:1px solid #808080;}\r
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+.input_noborder {border:0;}\r
+\r
+/* Buttons */\r
+#insert, #cancel, input.button, .updateButton {\r
+border:0; margin:0; padding:0;\r
+font-weight:bold;\r
+width:94px; height:26px;\r
+background:url(img/buttons.png) 0 -26px;\r
+cursor:pointer;\r
+padding-bottom:2px;\r
+float:left;\r
+}\r
+\r
+#insert {background:url(img/buttons.png) 0 -52px}\r
+#cancel {background:url(img/buttons.png) 0 0; float:right}\r
+\r
+/* Browse */\r
+a.pickcolor, a.browse {text-decoration:none}\r
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}\r
+.mceOldBoxModel a.browse span {width:22px; height:20px;}\r
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}\r
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}\r
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}\r
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}\r
+a.pickcolor:hover span {background-color:#B2BBD0;}\r
+a.pickcolor:hover span.disabled {}\r
+\r
+/* Charmap */\r
+table.charmap {border:1px solid #AAA; text-align:center}\r
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}\r
+#charmap a {display:block; color:#000; text-decoration:none; border:0}\r
+#charmap a:hover {background:#CCC;color:#2B6FB6}\r
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}\r
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}\r
+\r
+/* Source */\r
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}\r
+.mceActionPanel {margin-top:5px;}\r
+\r
+/* Tabs classes */\r
+.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}\r
+.tabs ul {margin:0; padding:0; list-style:none;}\r
+.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}\r
+.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}\r
+.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}\r
+.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}\r
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}\r
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}\r
+\r
+/* Panels */\r
+.panel_wrapper div.panel {display:none;}\r
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}\r
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}\r
+\r
+/* Columns */\r
+.column {float:left;}\r
+.properties {width:100%;}\r
+.properties .column1 {}\r
+.properties .column2 {text-align:left;}\r
+\r
+/* Titles */\r
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}\r
+h3 {font-size:14px;}\r
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}\r
+\r
+/* Dialog specific */\r
+#link .panel_wrapper, #link div.current {height:125px;}\r
+#image .panel_wrapper, #image div.current {height:200px;}\r
+#plugintable thead {font-weight:bold; background:#DDD;}\r
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}\r
+#plugintable {width:96%; margin-top:10px;}\r
+#pluginscontainer {height:290px; overflow:auto;}\r
+#colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}\r
+#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}\r
+#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}\r
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}\r
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}\r
+#colorpicker #light div {overflow:hidden;}\r
+#colorpicker .panel_wrapper div.current {height:175px;}\r
+#colorpicker #namedcolors {width:150px;}\r
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}\r
+#colorpicker #colornamecontainer {margin-top:5px;}\r
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/buttons.png b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/buttons.png
new file mode 100644 (file)
index 0000000..1e53560
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/buttons.png differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/items.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/items.gif
new file mode 100644 (file)
index 0000000..d2f9367
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/items.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_arrow.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_arrow.gif
new file mode 100644 (file)
index 0000000..85e31df
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_arrow.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_check.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_check.gif
new file mode 100644 (file)
index 0000000..adfdddc
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/menu_check.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/progress.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/progress.gif
new file mode 100644 (file)
index 0000000..5bb90fd
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/progress.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/tabs.gif b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/tabs.gif
new file mode 100644 (file)
index 0000000..06812cb
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/img/tabs.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/ui.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/default/ui.css
new file mode 100644 (file)
index 0000000..77083f3
--- /dev/null
@@ -0,0 +1,219 @@
+/* Reset */\r
+.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}\r
+.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}\r
+.defaultSkin table td {vertical-align:middle}\r
+\r
+/* Containers */\r
+.defaultSkin table {direction:ltr;background:transparent}\r
+.defaultSkin iframe {display:block;}\r
+.defaultSkin .mceToolbar {height:26px}\r
+.defaultSkin .mceLeft {text-align:left}\r
+.defaultSkin .mceRight {text-align:right}\r
+\r
+/* External */\r
+.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;}\r
+.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}\r
+.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}\r
+\r
+/* Layout */\r
+.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC}\r
+.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC}\r
+.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC}\r
+.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;}\r
+.defaultSkin td.mceToolbar {background:#F0F0EE; padding-top:1px; vertical-align:top}\r
+.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}\r
+.defaultSkin .mceStatusbar {background:#F0F0EE; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}\r
+.defaultSkin .mceStatusbar div {float:left; margin:2px}\r
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}\r
+.defaultSkin .mceStatusbar a:hover {text-decoration:underline}\r
+.defaultSkin table.mceToolbar {margin-left:3px}\r
+.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}\r
+.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}\r
+.defaultSkin td.mceCenter {text-align:center;}\r
+.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;}\r
+.defaultSkin td.mceRight table {margin:0 0 0 auto;}\r
+\r
+/* Button */\r
+.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}\r
+.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}\r
+.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}\r
+.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+.defaultSkin .mceButtonLabeled {width:auto}\r
+.defaultSkin .mceButtonLabeled span.mceIcon {float:left}\r
+.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}\r
+.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888}\r
+\r
+/* Separator */\r
+.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}\r
+\r
+/* ListBox */\r
+.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}\r
+.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}\r
+.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}\r
+.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}\r
+.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}\r
+.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}\r
+.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}\r
+.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px}\r
+.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;}\r
+.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}\r
+\r
+/* SplitButton */\r
+.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}\r
+.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}\r
+.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}\r
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}\r
+.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}\r
+.defaultSkin .mceSplitButton span.mceOpen {display:none}\r
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}\r
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}\r
+.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}\r
+.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}\r
+\r
+/* ColorSplitButton */\r
+.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}\r
+.defaultSkin .mceColorSplitMenu td {padding:2px}\r
+.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}\r
+.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}\r
+.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}\r
+.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}\r
+.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}\r
+.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}\r
+.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}\r
+\r
+/* Menu */\r
+.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8; direction:ltr}\r
+.defaultSkin .mceNoIcons span.mceIcon {width:0;}\r
+.defaultSkin .mceNoIcons a .mceText {padding-left:10px}\r
+.defaultSkin .mceMenu table {background:#FFF}\r
+.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block}\r
+.defaultSkin .mceMenu td {height:20px}\r
+.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0}\r
+.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}\r
+.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px}\r
+.defaultSkin .mceMenu pre.mceText {font-family:Monospace}\r
+.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}\r
+.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3}\r
+.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px}\r
+.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD}\r
+.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}\r
+.defaultSkin .mceMenuItemDisabled .mceText {color:#888}\r
+.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)}\r
+.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center}\r
+.defaultSkin .mceMenu span.mceMenuLine {display:none}\r
+.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}\r
+.defaultSkin .mceMenuItem td, .defaultSkin .mceMenuItem th {line-height: normal}\r
+\r
+/* Progress,Resize */\r
+.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}\r
+.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}\r
+\r
+/* Rtl */\r
+.mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}\r
+.mceRtl .mceMenuItem .mceText {text-align: right}\r
+\r
+/* Formats */\r
+.defaultSkin .mce_formatPreview a {font-size:10px}\r
+.defaultSkin .mce_p span.mceText {}\r
+.defaultSkin .mce_address span.mceText {font-style:italic}\r
+.defaultSkin .mce_pre span.mceText {font-family:monospace}\r
+.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}\r
+.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}\r
+.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}\r
+.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}\r
+.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}\r
+.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}\r
+\r
+/* Theme */\r
+.defaultSkin span.mce_bold {background-position:0 0}\r
+.defaultSkin span.mce_italic {background-position:-60px 0}\r
+.defaultSkin span.mce_underline {background-position:-140px 0}\r
+.defaultSkin span.mce_strikethrough {background-position:-120px 0}\r
+.defaultSkin span.mce_undo {background-position:-160px 0}\r
+.defaultSkin span.mce_redo {background-position:-100px 0}\r
+.defaultSkin span.mce_cleanup {background-position:-40px 0}\r
+.defaultSkin span.mce_bullist {background-position:-20px 0}\r
+.defaultSkin span.mce_numlist {background-position:-80px 0}\r
+.defaultSkin span.mce_justifyleft {background-position:-460px 0}\r
+.defaultSkin span.mce_justifyright {background-position:-480px 0}\r
+.defaultSkin span.mce_justifycenter {background-position:-420px 0}\r
+.defaultSkin span.mce_justifyfull {background-position:-440px 0}\r
+.defaultSkin span.mce_anchor {background-position:-200px 0}\r
+.defaultSkin span.mce_indent {background-position:-400px 0}\r
+.defaultSkin span.mce_outdent {background-position:-540px 0}\r
+.defaultSkin span.mce_link {background-position:-500px 0}\r
+.defaultSkin span.mce_unlink {background-position:-640px 0}\r
+.defaultSkin span.mce_sub {background-position:-600px 0}\r
+.defaultSkin span.mce_sup {background-position:-620px 0}\r
+.defaultSkin span.mce_removeformat {background-position:-580px 0}\r
+.defaultSkin span.mce_newdocument {background-position:-520px 0}\r
+.defaultSkin span.mce_image {background-position:-380px 0}\r
+.defaultSkin span.mce_help {background-position:-340px 0}\r
+.defaultSkin span.mce_code {background-position:-260px 0}\r
+.defaultSkin span.mce_hr {background-position:-360px 0}\r
+.defaultSkin span.mce_visualaid {background-position:-660px 0}\r
+.defaultSkin span.mce_charmap {background-position:-240px 0}\r
+.defaultSkin span.mce_paste {background-position:-560px 0}\r
+.defaultSkin span.mce_copy {background-position:-700px 0}\r
+.defaultSkin span.mce_cut {background-position:-680px 0}\r
+.defaultSkin span.mce_blockquote {background-position:-220px 0}\r
+.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0}\r
+.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0}\r
+.defaultSkin span.mce_forecolorpicker {background-position:-720px 0}\r
+.defaultSkin span.mce_backcolorpicker {background-position:-760px 0}\r
+\r
+/* Plugins */\r
+.defaultSkin span.mce_advhr {background-position:-0px -20px}\r
+.defaultSkin span.mce_ltr {background-position:-20px -20px}\r
+.defaultSkin span.mce_rtl {background-position:-40px -20px}\r
+.defaultSkin span.mce_emotions {background-position:-60px -20px}\r
+.defaultSkin span.mce_fullpage {background-position:-80px -20px}\r
+.defaultSkin span.mce_fullscreen {background-position:-100px -20px}\r
+.defaultSkin span.mce_iespell {background-position:-120px -20px}\r
+.defaultSkin span.mce_insertdate {background-position:-140px -20px}\r
+.defaultSkin span.mce_inserttime {background-position:-160px -20px}\r
+.defaultSkin span.mce_absolute {background-position:-180px -20px}\r
+.defaultSkin span.mce_backward {background-position:-200px -20px}\r
+.defaultSkin span.mce_forward {background-position:-220px -20px}\r
+.defaultSkin span.mce_insert_layer {background-position:-240px -20px}\r
+.defaultSkin span.mce_insertlayer {background-position:-260px -20px}\r
+.defaultSkin span.mce_movebackward {background-position:-280px -20px}\r
+.defaultSkin span.mce_moveforward {background-position:-300px -20px}\r
+.defaultSkin span.mce_media {background-position:-320px -20px}\r
+.defaultSkin span.mce_nonbreaking {background-position:-340px -20px}\r
+.defaultSkin span.mce_pastetext {background-position:-360px -20px}\r
+.defaultSkin span.mce_pasteword {background-position:-380px -20px}\r
+.defaultSkin span.mce_selectall {background-position:-400px -20px}\r
+.defaultSkin span.mce_preview {background-position:-420px -20px}\r
+.defaultSkin span.mce_print {background-position:-440px -20px}\r
+.defaultSkin span.mce_cancel {background-position:-460px -20px}\r
+.defaultSkin span.mce_save {background-position:-480px -20px}\r
+.defaultSkin span.mce_replace {background-position:-500px -20px}\r
+.defaultSkin span.mce_search {background-position:-520px -20px}\r
+.defaultSkin span.mce_styleprops {background-position:-560px -20px}\r
+.defaultSkin span.mce_table {background-position:-580px -20px}\r
+.defaultSkin span.mce_cell_props {background-position:-600px -20px}\r
+.defaultSkin span.mce_delete_table {background-position:-620px -20px}\r
+.defaultSkin span.mce_delete_col {background-position:-640px -20px}\r
+.defaultSkin span.mce_delete_row {background-position:-660px -20px}\r
+.defaultSkin span.mce_col_after {background-position:-680px -20px}\r
+.defaultSkin span.mce_col_before {background-position:-700px -20px}\r
+.defaultSkin span.mce_row_after {background-position:-720px -20px}\r
+.defaultSkin span.mce_row_before {background-position:-740px -20px}\r
+.defaultSkin span.mce_merge_cells {background-position:-760px -20px}\r
+.defaultSkin span.mce_table_props {background-position:-980px -20px}\r
+.defaultSkin span.mce_row_props {background-position:-780px -20px}\r
+.defaultSkin span.mce_split_cells {background-position:-800px -20px}\r
+.defaultSkin span.mce_template {background-position:-820px -20px}\r
+.defaultSkin span.mce_visualchars {background-position:-840px -20px}\r
+.defaultSkin span.mce_abbr {background-position:-860px -20px}\r
+.defaultSkin span.mce_acronym {background-position:-880px -20px}\r
+.defaultSkin span.mce_attribs {background-position:-900px -20px}\r
+.defaultSkin span.mce_cite {background-position:-920px -20px}\r
+.defaultSkin span.mce_del {background-position:-940px -20px}\r
+.defaultSkin span.mce_ins {background-position:-960px -20px}\r
+.defaultSkin span.mce_pagebreak {background-position:0 -40px}\r
+.defaultSkin span.mce_restoredraft {background-position:-20px -40px}\r
+.defaultSkin span.mce_spellchecker {background-position:-540px -20px}\r
+.defaultSkin span.mce_visualblocks {background-position: -40px -40px}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/content.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/content.css
new file mode 100644 (file)
index 0000000..cbce6c6
--- /dev/null
@@ -0,0 +1,24 @@
+body, td, pre { margin:8px;}\r
+body.mceForceColors {background:#FFF; color:#000;}\r
+h1 {font-size: 2em}\r
+h2 {font-size: 1.5em}\r
+h3 {font-size: 1.17em}\r
+h4 {font-size: 1em}\r
+h5 {font-size: .83em}\r
+h6 {font-size: .75em}\r
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}\r
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(../default/img/items.gif) no-repeat 0 0;}\r
+span.mceItemNbsp {background: #DDD}\r
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}\r
+img {border:0;}\r
+table, img, hr, .mceItemAnchor {cursor:default}\r
+table td, table th {cursor:text}\r
+ins {border-bottom:1px solid green; text-decoration: none; color:green}\r
+del {color:red; text-decoration:line-through}\r
+cite {border-bottom:1px dashed blue}\r
+acronym {border-bottom:1px dotted #CCC; cursor:help}\r
+abbr {border-bottom:1px dashed #CCC; cursor:help}\r
+\r
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}\r
+font[face=mceinline] {font-family:inherit !important}\r
+*[contentEditable]:focus {outline:0}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/dialog.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/dialog.css
new file mode 100644 (file)
index 0000000..6d9fc8d
--- /dev/null
@@ -0,0 +1,106 @@
+/* Generic */\r
+body {\r
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;\r
+background:#F0F0EE;\r
+color: black;\r
+padding:0;\r
+margin:8px 8px 0 8px;\r
+}\r
+\r
+html {background:#F0F0EE; color:#000;}\r
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+textarea {resize:none;outline:none;}\r
+a:link, a:visited {color:black;background-color:transparent;}\r
+a:hover {color:#2B6FB6;background-color:transparent;}\r
+.nowrap {white-space: nowrap}\r
+\r
+/* Forms */\r
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}\r
+legend {color:#2B6FB6; font-weight:bold;}\r
+label.msg {display:none;}\r
+label.invalid {color:#EE0000; display:inline;background-color:transparent;}\r
+input.invalid {border:1px solid #EE0000;background-color:transparent;}\r
+input {background:#FFF; border:1px solid #CCC;color:black;}\r
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+input, select, textarea {border:1px solid #808080;}\r
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+.input_noborder {border:0;}\r
+\r
+/* Buttons */\r
+#insert, #cancel, input.button, .updateButton {\r
+font-weight:bold;\r
+width:94px; height:23px;\r
+cursor:pointer;\r
+padding-bottom:2px;\r
+float:left;\r
+}\r
+\r
+#cancel {float:right}\r
+\r
+/* Browse */\r
+a.pickcolor, a.browse {text-decoration:none}\r
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}\r
+.mceOldBoxModel a.browse span {width:22px; height:20px;}\r
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}\r
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}\r
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}\r
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}\r
+a.pickcolor:hover span {background-color:#B2BBD0;}\r
+a.pickcolor:hover span.disabled {}\r
+\r
+/* Charmap */\r
+table.charmap {border:1px solid #AAA; text-align:center}\r
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}\r
+#charmap a {display:block; color:#000; text-decoration:none; border:0}\r
+#charmap a:hover {background:#CCC;color:#2B6FB6}\r
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}\r
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}\r
+\r
+/* Source */\r
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}\r
+.mceActionPanel {margin-top:5px;}\r
+\r
+/* Tabs classes */\r
+.tabs {width:100%; height:18px; line-height:normal;}\r
+.tabs ul {margin:0; padding:0; list-style:none;}\r
+.tabs li {float:left; border: 1px solid black; border-bottom:0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block; cursor:pointer;}\r
+.tabs li.current {font-weight: bold; margin-right:2px;}\r
+.tabs span {float:left; display:block; padding:0px 10px 0 0;}\r
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}\r
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}\r
+\r
+/* Panels */\r
+.panel_wrapper div.panel {display:none;}\r
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}\r
+.panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;}\r
+\r
+/* Columns */\r
+.column {float:left;}\r
+.properties {width:100%;}\r
+.properties .column1 {}\r
+.properties .column2 {text-align:left;}\r
+\r
+/* Titles */\r
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}\r
+h3 {font-size:14px;}\r
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}\r
+\r
+/* Dialog specific */\r
+#link .panel_wrapper, #link div.current {height:125px;}\r
+#image .panel_wrapper, #image div.current {height:200px;}\r
+#plugintable thead {font-weight:bold; background:#DDD;}\r
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}\r
+#plugintable {width:96%; margin-top:10px;}\r
+#pluginscontainer {height:290px; overflow:auto;}\r
+#colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}\r
+#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}\r
+#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}\r
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}\r
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}\r
+#colorpicker #light div {overflow:hidden;}\r
+#colorpicker .panel_wrapper div.current {height:175px;}\r
+#colorpicker #namedcolors {width:150px;}\r
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}\r
+#colorpicker #colornamecontainer {margin-top:5px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/ui.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/highcontrast/ui.css
new file mode 100644 (file)
index 0000000..effbbe1
--- /dev/null
@@ -0,0 +1,106 @@
+/* Reset */\r
+.highcontrastSkin table, .highcontrastSkin tbody, .highcontrastSkin a, .highcontrastSkin img, .highcontrastSkin tr, .highcontrastSkin div, .highcontrastSkin td, .highcontrastSkin iframe, .highcontrastSkin span, .highcontrastSkin *, .highcontrastSkin .mceText {border:0; margin:0; padding:0; vertical-align:baseline; border-collapse:separate;}\r
+.highcontrastSkin a:hover, .highcontrastSkin a:link, .highcontrastSkin a:visited, .highcontrastSkin a:active {text-decoration:none; font-weight:normal; cursor:default;}\r
+.highcontrastSkin table td {vertical-align:middle}\r
+\r
+.highcontrastSkin .mceIconOnly {display: block !important;}\r
+\r
+/* External */\r
+.highcontrastSkin .mceExternalToolbar {position:absolute; border:1px solid; border-bottom:0; display:none; background-color: white;}\r
+.highcontrastSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}\r
+.highcontrastSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px;}\r
+\r
+/* Layout */\r
+.highcontrastSkin table.mceLayout {border: 1px solid;}\r
+.highcontrastSkin .mceIframeContainer {border-top:1px solid; border-bottom:1px solid}\r
+.highcontrastSkin .mceStatusbar a:hover {text-decoration:underline}\r
+.highcontrastSkin .mceStatusbar {display:block; line-height:1.5em; overflow:visible;}\r
+.highcontrastSkin .mceStatusbar div {float:left}\r
+.highcontrastSkin .mceStatusbar a.mceResize {display:block; float:right; width:20px; height:20px; cursor:se-resize; outline:0}\r
+\r
+.highcontrastSkin .mceToolbar td { display: inline-block; float: left;}\r
+.highcontrastSkin .mceToolbar tr { display: block;}\r
+.highcontrastSkin .mceToolbar table { display: block; }\r
+\r
+/* Button */\r
+\r
+.highcontrastSkin .mceButton { display:block; margin: 2px; padding: 5px 10px;border: 1px solid; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -ms-border-radius: 3px; height: 2em;}\r
+.highcontrastSkin .mceButton .mceVoiceLabel { height: 100%; vertical-align: center; line-height: 2em}\r
+.highcontrastSkin .mceButtonDisabled .mceVoiceLabel { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);}\r
+.highcontrastSkin .mceButtonActive, .highcontrastSkin .mceButton:focus, .highcontrastSkin .mceButton:active { border: 5px solid; padding: 1px 6px;-webkit-focus-ring-color:none;outline:none;}\r
+\r
+/* Separator */\r
+.highcontrastSkin .mceSeparator {display:block; width:16px; height:26px;}\r
+\r
+/* ListBox */\r
+.highcontrastSkin .mceListBox { display: block; margin:2px;-webkit-focus-ring-color:none;outline:none;}\r
+.highcontrastSkin .mceListBox .mceText {padding: 5px 6px;  line-height: 2em; width: 15ex; overflow: hidden;}\r
+.highcontrastSkin .mceListBoxDisabled .mceText { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);}\r
+.highcontrastSkin .mceListBox a.mceText { padding: 5px 10px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;}\r
+.highcontrastSkin .mceListBox a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;}\r
+.highcontrastSkin .mceListBox:focus a.mceText, .highcontrastSkin .mceListBox:active a.mceText { border-width: 5px; padding: 1px 10px 1px 6px;}\r
+.highcontrastSkin .mceListBox:focus a.mceOpen, .highcontrastSkin .mceListBox:active a.mceOpen { border-width: 5px; padding: 1px 0px 1px 4px;}\r
+\r
+.highcontrastSkin .mceListBoxMenu {overflow-y:auto}\r
+\r
+/* SplitButton */\r
+.highcontrastSkin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+\r
+.highcontrastSkin .mceSplitButton { border-collapse: collapse; margin: 2px; height: 2em; line-height: 2em;-webkit-focus-ring-color:none;outline:none;}\r
+.highcontrastSkin .mceSplitButton td { display: table-cell; float: none; margin: 0; padding: 0; height: 2em;}\r
+.highcontrastSkin .mceSplitButton tr { display: table-row; }\r
+.highcontrastSkin table.mceSplitButton  { display: table; }\r
+.highcontrastSkin .mceSplitButton a.mceAction { padding: 5px 10px; display: block; height: 2em; line-height: 2em; overflow: hidden; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;}\r
+.highcontrastSkin .mceSplitButton a.mceOpen { padding: 5px 4px;  display: block; height: 2em; line-height: 2em; border: 1px solid; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;}\r
+.highcontrastSkin .mceSplitButton .mceVoiceLabel { height: 2em; vertical-align: center; line-height: 2em; } \r
+.highcontrastSkin .mceSplitButton:focus a.mceAction, .highcontrastSkin .mceSplitButton:active a.mceAction { border-width: 5px; border-right-width: 1px; padding: 1px 10px 1px 6px;-webkit-focus-ring-color:none;outline:none;}\r
+.highcontrastSkin .mceSplitButton:focus a.mceOpen, .highcontrastSkin .mceSplitButton:active a.mceOpen { border-width: 5px; border-left-width: 1px; padding: 1px 0px 1px 4px;-webkit-focus-ring-color:none;outline:none;}\r
+\r
+/* Menu */\r
+.highcontrastSkin .mceNoIcons span.mceIcon {width:0;}\r
+.highcontrastSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid; direction:ltr}\r
+.highcontrastSkin .mceMenu table {background:white; color: black}\r
+.highcontrastSkin .mceNoIcons a .mceText {padding-left:10px}\r
+.highcontrastSkin .mceMenu a, .highcontrastSkin .mceMenu span, .highcontrastSkin .mceMenu {display:block;background:white; color: black}\r
+.highcontrastSkin .mceMenu td {height:2em}\r
+.highcontrastSkin .mceMenu a {position:relative;padding:3px 0 4px 0; display: block;}\r
+.highcontrastSkin .mceMenu .mceText {position:relative; display:block; cursor:default; margin:0; padding:0 25px 0 25px;}\r
+.highcontrastSkin .mceMenu pre.mceText {font-family:Monospace}\r
+.highcontrastSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:26px;}\r
+.highcontrastSkin td.mceMenuItemSeparator {border-top:1px solid; height:1px}\r
+.highcontrastSkin .mceMenuItemTitle a {border:0; border-bottom:1px solid}\r
+.highcontrastSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px}\r
+.highcontrastSkin .mceNoIcons .mceMenuItemSelected span.mceText:before {content: "\2713\A0";}\r
+.highcontrastSkin .mceMenu span.mceMenuLine {display:none}\r
+.highcontrastSkin .mceMenuItemSub a .mceText:after {content: "\A0\25B8"}\r
+.highcontrastSkin .mceMenuItem td, .highcontrastSkin .mceMenuItem th {line-height: normal}\r
+\r
+/* ColorSplitButton */\r
+.highcontrastSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid; color: #000}\r
+.highcontrastSkin .mceColorSplitMenu td {padding:2px}\r
+.highcontrastSkin .mceColorSplitMenu a {display:block; width:16px; height:16px; overflow:hidden; color:#000; margin: 0; padding: 0;}\r
+.highcontrastSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}\r
+.highcontrastSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}\r
+.highcontrastSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid; background-color:#B6BDD2}\r
+.highcontrastSkin a.mceMoreColors:hover {border:1px solid #0A246A; color: #000;}\r
+.highcontrastSkin .mceColorPreview {display:none;}\r
+.highcontrastSkin .mce_forecolor span.mceAction, .highcontrastSkin .mce_backcolor span.mceAction {height:17px;overflow:hidden}\r
+\r
+/* Progress,Resize */\r
+.highcontrastSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}\r
+.highcontrastSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}\r
+\r
+/* Rtl */\r
+.mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}\r
+.mceRtl .mceMenuItem .mceText {text-align: right}\r
+\r
+/* Formats */\r
+.highcontrastSkin .mce_p span.mceText {}\r
+.highcontrastSkin .mce_address span.mceText {font-style:italic}\r
+.highcontrastSkin .mce_pre span.mceText {font-family:monospace}\r
+.highcontrastSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}\r
+.highcontrastSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}\r
+.highcontrastSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}\r
+.highcontrastSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}\r
+.highcontrastSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}\r
+.highcontrastSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/content.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/content.css
new file mode 100644 (file)
index 0000000..a1a8f9b
--- /dev/null
@@ -0,0 +1,48 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}\r
+body {background:#FFF;}\r
+body.mceForceColors {background:#FFF; color:#000;}\r
+h1 {font-size: 2em}\r
+h2 {font-size: 1.5em}\r
+h3 {font-size: 1.17em}\r
+h4 {font-size: 1em}\r
+h5 {font-size: .83em}\r
+h6 {font-size: .75em}\r
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}\r
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(../default/img/items.gif) no-repeat 0 0;}\r
+span.mceItemNbsp {background: #DDD}\r
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}\r
+img {border:0;}\r
+table, img, hr, .mceItemAnchor {cursor:default}\r
+table td, table th {cursor:text}\r
+ins {border-bottom:1px solid green; text-decoration: none; color:green}\r
+del {color:red; text-decoration:line-through}\r
+cite {border-bottom:1px dashed blue}\r
+acronym {border-bottom:1px dotted #CCC; cursor:help}\r
+abbr {border-bottom:1px dashed #CCC; cursor:help}\r
+\r
+/* IE */\r
+* html body {\r
+scrollbar-3dlight-color:#F0F0EE;\r
+scrollbar-arrow-color:#676662;\r
+scrollbar-base-color:#F0F0EE;\r
+scrollbar-darkshadow-color:#DDD;\r
+scrollbar-face-color:#E0E0DD;\r
+scrollbar-highlight-color:#F0F0EE;\r
+scrollbar-shadow-color:#F0F0EE;\r
+scrollbar-track-color:#F5F5F5;\r
+}\r
+\r
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}\r
+font[face=mceinline] {font-family:inherit !important}\r
+*[contentEditable]:focus {outline:0}\r
+\r
+.mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc}\r
+.mceItemShockWave {background-image:url(../../img/shockwave.gif)}\r
+.mceItemFlash {background-image:url(../../img/flash.gif)}\r
+.mceItemQuickTime {background-image:url(../../img/quicktime.gif)}\r
+.mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)}\r
+.mceItemRealMedia {background-image:url(../../img/realmedia.gif)}\r
+.mceItemVideo {background-image:url(../../img/video.gif)}\r
+.mceItemAudio {background-image:url(../../img/video.gif)}\r
+.mceItemIframe {background-image:url(../../img/iframe.gif)}\r
+.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/dialog.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/dialog.css
new file mode 100644 (file)
index 0000000..a54db98
--- /dev/null
@@ -0,0 +1,118 @@
+/* Generic */\r
+body {\r
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;\r
+scrollbar-3dlight-color:#F0F0EE;\r
+scrollbar-arrow-color:#676662;\r
+scrollbar-base-color:#F0F0EE;\r
+scrollbar-darkshadow-color:#DDDDDD;\r
+scrollbar-face-color:#E0E0DD;\r
+scrollbar-highlight-color:#F0F0EE;\r
+scrollbar-shadow-color:#F0F0EE;\r
+scrollbar-track-color:#F5F5F5;\r
+background:#F0F0EE;\r
+padding:0;\r
+margin:8px 8px 0 8px;\r
+}\r
+\r
+html {background:#F0F0EE;}\r
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+textarea {resize:none;outline:none;}\r
+a:link, a:visited {color:black;}\r
+a:hover {color:#2B6FB6;}\r
+.nowrap {white-space: nowrap}\r
+\r
+/* Forms */\r
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}\r
+legend {color:#2B6FB6; font-weight:bold;}\r
+label.msg {display:none;}\r
+label.invalid {color:#EE0000; display:inline;}\r
+input.invalid {border:1px solid #EE0000;}\r
+input {background:#FFF; border:1px solid #CCC;}\r
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+input, select, textarea {border:1px solid #808080;}\r
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+.input_noborder {border:0;}\r
+\r
+/* Buttons */\r
+#insert, #cancel, input.button, .updateButton {\r
+border:0; margin:0; padding:0;\r
+font-weight:bold;\r
+width:94px; height:26px;\r
+background:url(../default/img/buttons.png) 0 -26px;\r
+cursor:pointer;\r
+padding-bottom:2px;\r
+float:left;\r
+}\r
+\r
+#insert {background:url(../default/img/buttons.png) 0 -52px}\r
+#cancel {background:url(../default/img/buttons.png) 0 0; float:right}\r
+\r
+/* Browse */\r
+a.pickcolor, a.browse {text-decoration:none}\r
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}\r
+.mceOldBoxModel a.browse span {width:22px; height:20px;}\r
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}\r
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}\r
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}\r
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}\r
+a.pickcolor:hover span {background-color:#B2BBD0;}\r
+a.pickcolor:hover span.disabled {}\r
+\r
+/* Charmap */\r
+table.charmap {border:1px solid #AAA; text-align:center}\r
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}\r
+#charmap a {display:block; color:#000; text-decoration:none; border:0}\r
+#charmap a:hover {background:#CCC;color:#2B6FB6}\r
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}\r
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}\r
+\r
+/* Source */\r
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}\r
+.mceActionPanel {margin-top:5px;}\r
+\r
+/* Tabs classes */\r
+.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;}\r
+.tabs ul {margin:0; padding:0; list-style:none;}\r
+.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}\r
+.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}\r
+.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}\r
+.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;}\r
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}\r
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}\r
+\r
+/* Panels */\r
+.panel_wrapper div.panel {display:none;}\r
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}\r
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}\r
+\r
+/* Columns */\r
+.column {float:left;}\r
+.properties {width:100%;}\r
+.properties .column1 {}\r
+.properties .column2 {text-align:left;}\r
+\r
+/* Titles */\r
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}\r
+h3 {font-size:14px;}\r
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}\r
+\r
+/* Dialog specific */\r
+#link .panel_wrapper, #link div.current {height:125px;}\r
+#image .panel_wrapper, #image div.current {height:200px;}\r
+#plugintable thead {font-weight:bold; background:#DDD;}\r
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}\r
+#plugintable {width:96%; margin-top:10px;}\r
+#pluginscontainer {height:290px; overflow:auto;}\r
+#colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}\r
+#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}\r
+#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}\r
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}\r
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}\r
+#colorpicker #light div {overflow:hidden;}\r
+#colorpicker .panel_wrapper div.current {height:175px;}\r
+#colorpicker #namedcolors {width:150px;}\r
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}\r
+#colorpicker #colornamecontainer {margin-top:5px;}\r
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg.png b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg.png
new file mode 100644 (file)
index 0000000..13a5cb0
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg.png differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_black.png b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_black.png
new file mode 100644 (file)
index 0000000..7fc57f2
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_black.png differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_silver.png b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_silver.png
new file mode 100644 (file)
index 0000000..c0dcc6c
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/img/button_bg_silver.png differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui.css
new file mode 100644 (file)
index 0000000..a310223
--- /dev/null
@@ -0,0 +1,222 @@
+/* Reset */\r
+.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}\r
+.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}\r
+.o2k7Skin table td {vertical-align:middle}\r
+\r
+/* Containers */\r
+.o2k7Skin table {background:transparent}\r
+.o2k7Skin iframe {display:block;}\r
+.o2k7Skin .mceToolbar {height:26px}\r
+\r
+/* External */\r
+.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none}\r
+.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;}\r
+.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}\r
+\r
+/* Layout */\r
+.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD}\r
+.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD}\r
+.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD}\r
+.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}\r
+.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}\r
+.o2k7Skin td.mceToolbar{background:#E5EFFD}\r
+.o2k7Skin .mceStatusbar {background:#E5EFFD; display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}\r
+.o2k7Skin .mceStatusbar div {float:left; padding:2px}\r
+.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}\r
+.o2k7Skin .mceStatusbar a:hover {text-decoration:underline}\r
+.o2k7Skin table.mceToolbar {margin-left:3px}\r
+.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;}\r
+.o2k7Skin .mceToolbar td.mceFirst span {margin:0}\r
+.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px}\r
+.o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none}\r
+.o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px}\r
+.o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}\r
+.o2k7Skin td.mceCenter {text-align:center;}\r
+.o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;}\r
+.o2k7Skin td.mceRight table {margin:0 0 0 auto;}\r
+\r
+/* Button */\r
+.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px}\r
+.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px}\r
+.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}\r
+.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}\r
+.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px}\r
+.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+.o2k7Skin .mceButtonLabeled {width:auto}\r
+.o2k7Skin .mceButtonLabeled span.mceIcon {float:left}\r
+.o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}\r
+.o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888}\r
+\r
+/* Separator */\r
+.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}\r
+\r
+/* ListBox */\r
+.o2k7Skin .mceListBox  {padding-left: 3px}\r
+.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block}\r
+.o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}\r
+.o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0}\r
+.o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF}\r
+.o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px}\r
+.o2k7Skin .mceListBoxDisabled .mceText {color:gray}\r
+.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden; margin-left:3px}\r
+.o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px}\r
+.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;}\r
+\r
+/* SplitButton */\r
+.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px; direction:ltr}\r
+.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}\r
+.o2k7Skin .mceSplitButton a.mceAction {width:22px}\r
+.o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)}\r
+.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}\r
+.o2k7Skin .mceSplitButton span.mceOpen {display:none}\r
+.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}\r
+.o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px}\r
+.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+.o2k7Skin .mceSplitButtonActive {background-position:0 -44px}\r
+\r
+/* ColorSplitButton */\r
+.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}\r
+.o2k7Skin .mceColorSplitMenu td {padding:2px}\r
+.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}\r
+.o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}\r
+.o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}\r
+.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}\r
+.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A}\r
+.o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden}\r
+.o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden}\r
+\r
+/* Menu */\r
+.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD; direction:ltr}\r
+.o2k7Skin .mceNoIcons span.mceIcon {width:0;}\r
+.o2k7Skin .mceNoIcons a .mceText {padding-left:10px}\r
+.o2k7Skin .mceMenu table {background:#FFF}\r
+.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block}\r
+.o2k7Skin .mceMenu td {height:20px}\r
+.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0}\r
+.o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}\r
+.o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px}\r
+.o2k7Skin .mceMenu pre.mceText {font-family:Monospace}\r
+.o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}\r
+.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3}\r
+.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px}\r
+.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD}\r
+.o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}\r
+.o2k7Skin .mceMenuItemDisabled .mceText {color:#888}\r
+.o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)}\r
+.o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center}\r
+.o2k7Skin .mceMenu span.mceMenuLine {display:none}\r
+.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}\r
+.o2k7Skin .mceMenuItem td, .o2k7Skin .mceMenuItem th {line-height: normal}\r
+\r
+/* Progress,Resize */\r
+.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}\r
+.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}\r
+\r
+/* Rtl */\r
+.mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}\r
+.mceRtl .mceMenuItem .mceText {text-align: right}\r
+\r
+/* Formats */\r
+.o2k7Skin .mce_formatPreview a {font-size:10px}\r
+.o2k7Skin .mce_p span.mceText {}\r
+.o2k7Skin .mce_address span.mceText {font-style:italic}\r
+.o2k7Skin .mce_pre span.mceText {font-family:monospace}\r
+.o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}\r
+.o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}\r
+.o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}\r
+.o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}\r
+.o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}\r
+.o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}\r
+\r
+/* Theme */\r
+.o2k7Skin span.mce_bold {background-position:0 0}\r
+.o2k7Skin span.mce_italic {background-position:-60px 0}\r
+.o2k7Skin span.mce_underline {background-position:-140px 0}\r
+.o2k7Skin span.mce_strikethrough {background-position:-120px 0}\r
+.o2k7Skin span.mce_undo {background-position:-160px 0}\r
+.o2k7Skin span.mce_redo {background-position:-100px 0}\r
+.o2k7Skin span.mce_cleanup {background-position:-40px 0}\r
+.o2k7Skin span.mce_bullist {background-position:-20px 0}\r
+.o2k7Skin span.mce_numlist {background-position:-80px 0}\r
+.o2k7Skin span.mce_justifyleft {background-position:-460px 0}\r
+.o2k7Skin span.mce_justifyright {background-position:-480px 0}\r
+.o2k7Skin span.mce_justifycenter {background-position:-420px 0}\r
+.o2k7Skin span.mce_justifyfull {background-position:-440px 0}\r
+.o2k7Skin span.mce_anchor {background-position:-200px 0}\r
+.o2k7Skin span.mce_indent {background-position:-400px 0}\r
+.o2k7Skin span.mce_outdent {background-position:-540px 0}\r
+.o2k7Skin span.mce_link {background-position:-500px 0}\r
+.o2k7Skin span.mce_unlink {background-position:-640px 0}\r
+.o2k7Skin span.mce_sub {background-position:-600px 0}\r
+.o2k7Skin span.mce_sup {background-position:-620px 0}\r
+.o2k7Skin span.mce_removeformat {background-position:-580px 0}\r
+.o2k7Skin span.mce_newdocument {background-position:-520px 0}\r
+.o2k7Skin span.mce_image {background-position:-380px 0}\r
+.o2k7Skin span.mce_help {background-position:-340px 0}\r
+.o2k7Skin span.mce_code {background-position:-260px 0}\r
+.o2k7Skin span.mce_hr {background-position:-360px 0}\r
+.o2k7Skin span.mce_visualaid {background-position:-660px 0}\r
+.o2k7Skin span.mce_charmap {background-position:-240px 0}\r
+.o2k7Skin span.mce_paste {background-position:-560px 0}\r
+.o2k7Skin span.mce_copy {background-position:-700px 0}\r
+.o2k7Skin span.mce_cut {background-position:-680px 0}\r
+.o2k7Skin span.mce_blockquote {background-position:-220px 0}\r
+.o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0}\r
+.o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0}\r
+.o2k7Skin span.mce_forecolorpicker {background-position:-720px 0}\r
+.o2k7Skin span.mce_backcolorpicker {background-position:-760px 0}\r
+\r
+/* Plugins */\r
+.o2k7Skin span.mce_advhr {background-position:-0px -20px}\r
+.o2k7Skin span.mce_ltr {background-position:-20px -20px}\r
+.o2k7Skin span.mce_rtl {background-position:-40px -20px}\r
+.o2k7Skin span.mce_emotions {background-position:-60px -20px}\r
+.o2k7Skin span.mce_fullpage {background-position:-80px -20px}\r
+.o2k7Skin span.mce_fullscreen {background-position:-100px -20px}\r
+.o2k7Skin span.mce_iespell {background-position:-120px -20px}\r
+.o2k7Skin span.mce_insertdate {background-position:-140px -20px}\r
+.o2k7Skin span.mce_inserttime {background-position:-160px -20px}\r
+.o2k7Skin span.mce_absolute {background-position:-180px -20px}\r
+.o2k7Skin span.mce_backward {background-position:-200px -20px}\r
+.o2k7Skin span.mce_forward {background-position:-220px -20px}\r
+.o2k7Skin span.mce_insert_layer {background-position:-240px -20px}\r
+.o2k7Skin span.mce_insertlayer {background-position:-260px -20px}\r
+.o2k7Skin span.mce_movebackward {background-position:-280px -20px}\r
+.o2k7Skin span.mce_moveforward {background-position:-300px -20px}\r
+.o2k7Skin span.mce_media {background-position:-320px -20px}\r
+.o2k7Skin span.mce_nonbreaking {background-position:-340px -20px}\r
+.o2k7Skin span.mce_pastetext {background-position:-360px -20px}\r
+.o2k7Skin span.mce_pasteword {background-position:-380px -20px}\r
+.o2k7Skin span.mce_selectall {background-position:-400px -20px}\r
+.o2k7Skin span.mce_preview {background-position:-420px -20px}\r
+.o2k7Skin span.mce_print {background-position:-440px -20px}\r
+.o2k7Skin span.mce_cancel {background-position:-460px -20px}\r
+.o2k7Skin span.mce_save {background-position:-480px -20px}\r
+.o2k7Skin span.mce_replace {background-position:-500px -20px}\r
+.o2k7Skin span.mce_search {background-position:-520px -20px}\r
+.o2k7Skin span.mce_styleprops {background-position:-560px -20px}\r
+.o2k7Skin span.mce_table {background-position:-580px -20px}\r
+.o2k7Skin span.mce_cell_props {background-position:-600px -20px}\r
+.o2k7Skin span.mce_delete_table {background-position:-620px -20px}\r
+.o2k7Skin span.mce_delete_col {background-position:-640px -20px}\r
+.o2k7Skin span.mce_delete_row {background-position:-660px -20px}\r
+.o2k7Skin span.mce_col_after {background-position:-680px -20px}\r
+.o2k7Skin span.mce_col_before {background-position:-700px -20px}\r
+.o2k7Skin span.mce_row_after {background-position:-720px -20px}\r
+.o2k7Skin span.mce_row_before {background-position:-740px -20px}\r
+.o2k7Skin span.mce_merge_cells {background-position:-760px -20px}\r
+.o2k7Skin span.mce_table_props {background-position:-980px -20px}\r
+.o2k7Skin span.mce_row_props {background-position:-780px -20px}\r
+.o2k7Skin span.mce_split_cells {background-position:-800px -20px}\r
+.o2k7Skin span.mce_template {background-position:-820px -20px}\r
+.o2k7Skin span.mce_visualchars {background-position:-840px -20px}\r
+.o2k7Skin span.mce_abbr {background-position:-860px -20px}\r
+.o2k7Skin span.mce_acronym {background-position:-880px -20px}\r
+.o2k7Skin span.mce_attribs {background-position:-900px -20px}\r
+.o2k7Skin span.mce_cite {background-position:-920px -20px}\r
+.o2k7Skin span.mce_del {background-position:-940px -20px}\r
+.o2k7Skin span.mce_ins {background-position:-960px -20px}\r
+.o2k7Skin span.mce_pagebreak {background-position:0 -40px}\r
+.o2k7Skin span.mce_restoredraft {background-position:-20px -40px}\r
+.o2k7Skin span.mce_spellchecker {background-position:-540px -20px}\r
+.o2k7Skin span.mce_visualblocks {background-position: -40px -40px}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui_black.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui_black.css
new file mode 100644 (file)
index 0000000..50c9b76
--- /dev/null
@@ -0,0 +1,8 @@
+/* Black */\r
+.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)}\r
+.o2k7SkinBlack td.mceToolbar, .o2k7SkinBlack td.mceStatusbar, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}\r
+.o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}\r
+.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}\r
+.o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;}\r
+.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)}\r
+.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1}
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui_silver.css b/3.x/src/resources/javascript/TinyMCE/themes/advanced/skins/o2k7/ui_silver.css
new file mode 100644 (file)
index 0000000..960a8e4
--- /dev/null
@@ -0,0 +1,5 @@
+/* Silver */\r
+.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)}\r
+.o2k7SkinSilver td.mceToolbar, .o2k7SkinSilver td.mceStatusbar, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}\r
+.o2k7SkinSilver .mceListBox .mceText {background:#FFF}\r
+.o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/advanced/source_editor.htm b/3.x/src/resources/javascript/TinyMCE/themes/advanced/source_editor.htm
new file mode 100644 (file)
index 0000000..dd973fc
--- /dev/null
@@ -0,0 +1,25 @@
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>{#advanced_dlg.code_title}</title>\r
+       <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+       <script type="text/javascript" src="js/source_editor.js"></script>\r
+</head>\r
+<body onresize="resizeInputs();" style="display:none; overflow:hidden;" spellcheck="false">\r
+       <form name="source" onsubmit="saveContent();return false;" action="#">\r
+               <div style="float: left" class="title"><label for="htmlSource">{#advanced_dlg.code_title}</label></div>\r
+\r
+               <div id="wrapline" style="float: right">\r
+                       <input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label>\r
+               </div>\r
+\r
+               <br style="clear: both" />\r
+\r
+               <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>\r
+\r
+               <div class="mceActionPanel">\r
+                       <input type="submit" role="button" name="insert" value="{#update}" id="insert" />\r
+                       <input type="button" role="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />\r
+               </div>\r
+       </form>\r
+</body>\r
+</html>\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/editor_template.js b/3.x/src/resources/javascript/TinyMCE/themes/simple/editor_template.js
new file mode 100644 (file)
index 0000000..4b3209c
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a=tinymce.DOM;tinymce.ThemeManager.requireLangPack("simple");tinymce.create("tinymce.themes.SimpleTheme",{init:function(c,d){var e=this,b=["Bold","Italic","Underline","Strikethrough","InsertUnorderedList","InsertOrderedList"],f=c.settings;e.editor=c;c.contentCSS.push(d+"/skins/"+f.skin+"/content.css");c.onInit.add(function(){c.onNodeChange.add(function(h,g){tinymce.each(b,function(i){g.get(i.toLowerCase()).setActive(h.queryCommandState(i))})})});a.loadCSS((f.editor_css?c.documentBaseURI.toAbsolute(f.editor_css):"")||d+"/skins/"+f.skin+"/ui.css")},renderUI:function(h){var e=this,i=h.targetNode,b,c,d=e.editor,f=d.controlManager,g;i=a.insertAfter(a.create("span",{id:d.id+"_container","class":"mceEditor "+d.settings.skin+"SimpleSkin"}),i);i=g=a.add(i,"table",{cellPadding:0,cellSpacing:0,"class":"mceLayout"});i=c=a.add(i,"tbody");i=a.add(c,"tr");i=b=a.add(a.add(i,"td"),"div",{"class":"mceIframeContainer"});i=a.add(a.add(c,"tr",{"class":"last"}),"td",{"class":"mceToolbar mceLast",align:"center"});c=e.toolbar=f.createToolbar("tools1");c.add(f.createButton("bold",{title:"simple.bold_desc",cmd:"Bold"}));c.add(f.createButton("italic",{title:"simple.italic_desc",cmd:"Italic"}));c.add(f.createButton("underline",{title:"simple.underline_desc",cmd:"Underline"}));c.add(f.createButton("strikethrough",{title:"simple.striketrough_desc",cmd:"Strikethrough"}));c.add(f.createSeparator());c.add(f.createButton("undo",{title:"simple.undo_desc",cmd:"Undo"}));c.add(f.createButton("redo",{title:"simple.redo_desc",cmd:"Redo"}));c.add(f.createSeparator());c.add(f.createButton("cleanup",{title:"simple.cleanup_desc",cmd:"mceCleanup"}));c.add(f.createSeparator());c.add(f.createButton("insertunorderedlist",{title:"simple.bullist_desc",cmd:"InsertUnorderedList"}));c.add(f.createButton("insertorderedlist",{title:"simple.numlist_desc",cmd:"InsertOrderedList"}));c.renderTo(i);return{iframeContainer:b,editorContainer:d.id+"_container",sizeContainer:g,deltaHeight:-20}},getInfo:function(){return{longname:"Simple theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add("simple",tinymce.themes.SimpleTheme)})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/editor_template_src.js b/3.x/src/resources/javascript/TinyMCE/themes/simple/editor_template_src.js
new file mode 100644 (file)
index 0000000..01ce87c
--- /dev/null
@@ -0,0 +1,84 @@
+/**\r
+ * editor_template_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var DOM = tinymce.DOM;\r
+\r
+       // Tell it to load theme specific language pack(s)\r
+       tinymce.ThemeManager.requireLangPack('simple');\r
+\r
+       tinymce.create('tinymce.themes.SimpleTheme', {\r
+               init : function(ed, url) {\r
+                       var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;\r
+\r
+                       t.editor = ed;\r
+                       ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css");\r
+\r
+                       ed.onInit.add(function() {\r
+                               ed.onNodeChange.add(function(ed, cm) {\r
+                                       tinymce.each(states, function(c) {\r
+                                               cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));\r
+                                       });\r
+                               });\r
+                       });\r
+\r
+                       DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");\r
+               },\r
+\r
+               renderUI : function(o) {\r
+                       var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;\r
+\r
+                       n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n);\r
+                       n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'});\r
+                       n = tb = DOM.add(n, 'tbody');\r
+\r
+                       // Create iframe container\r
+                       n = DOM.add(tb, 'tr');\r
+                       n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'});\r
+\r
+                       // Create toolbar container\r
+                       n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'});\r
+\r
+                       // Create toolbar\r
+                       tb = t.toolbar = cf.createToolbar("tools1");\r
+                       tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'}));\r
+                       tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'}));\r
+                       tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'}));\r
+                       tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'}));\r
+                       tb.add(cf.createSeparator());\r
+                       tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'}));\r
+                       tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'}));\r
+                       tb.add(cf.createSeparator());\r
+                       tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'}));\r
+                       tb.add(cf.createSeparator());\r
+                       tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'}));\r
+                       tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'}));\r
+                       tb.renderTo(n);\r
+\r
+                       return {\r
+                               iframeContainer : ic,\r
+                               editorContainer : ed.id + '_container',\r
+                               sizeContainer : sc,\r
+                               deltaHeight : -20\r
+                       };\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Simple theme',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       }\r
+               }\r
+       });\r
+\r
+       tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);\r
+})();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/img/icons.gif b/3.x/src/resources/javascript/TinyMCE/themes/simple/img/icons.gif
new file mode 100644 (file)
index 0000000..6fcbcb5
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/simple/img/icons.gif differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/langs/en.js b/3.x/src/resources/javascript/TinyMCE/themes/simple/langs/en.js
new file mode 100644 (file)
index 0000000..088ed0f
--- /dev/null
@@ -0,0 +1 @@
+tinyMCE.addI18n('en.simple',{"cleanup_desc":"Cleanup Messy Code","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","striketrough_desc":"Strikethrough","underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)"});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/default/content.css b/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/default/content.css
new file mode 100644 (file)
index 0000000..2506c80
--- /dev/null
@@ -0,0 +1,25 @@
+body, td, pre {\r
+       font-family: Verdana, Arial, Helvetica, sans-serif;\r
+       font-size: 10px;\r
+}\r
+\r
+body {\r
+       background-color: #FFFFFF;\r
+}\r
+\r
+.mceVisualAid {\r
+       border: 1px dashed #BBBBBB;\r
+}\r
+\r
+/* MSIE specific */\r
+\r
+* html body {\r
+       scrollbar-3dlight-color: #F0F0EE;\r
+       scrollbar-arrow-color: #676662;\r
+       scrollbar-base-color: #F0F0EE;\r
+       scrollbar-darkshadow-color: #DDDDDD;\r
+       scrollbar-face-color: #E0E0DD;\r
+       scrollbar-highlight-color: #F0F0EE;\r
+       scrollbar-shadow-color: #F0F0EE;\r
+       scrollbar-track-color: #F5F5F5; \r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/default/ui.css b/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/default/ui.css
new file mode 100644 (file)
index 0000000..076fe84
--- /dev/null
@@ -0,0 +1,32 @@
+/* Reset */\r
+.defaultSimpleSkin table, .defaultSimpleSkin tbody, .defaultSimpleSkin a, .defaultSimpleSkin img, .defaultSimpleSkin tr, .defaultSimpleSkin div, .defaultSimpleSkin td, .defaultSimpleSkin iframe, .defaultSimpleSkin span, .defaultSimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000}\r
+\r
+/* Containers */\r
+.defaultSimpleSkin {position:relative}\r
+.defaultSimpleSkin table.mceLayout {background:#F0F0EE; border:1px solid #CCC;}\r
+.defaultSimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #CCC;}\r
+.defaultSimpleSkin .mceToolbar {height:24px;}\r
+\r
+/* Layout */\r
+.defaultSimpleSkin span.mceIcon, .defaultSimpleSkin img.mceIcon {display:block; width:20px; height:20px}\r
+.defaultSimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}\r
+\r
+/* Button */\r
+.defaultSimpleSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px}\r
+.defaultSimpleSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}\r
+.defaultSimpleSkin a.mceButtonActive {border:1px solid #0A246A; background-color:#C2CBE0}\r
+.defaultSimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+\r
+/* Separator */\r
+.defaultSimpleSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:0 2px 0 4px}\r
+\r
+/* Theme */\r
+.defaultSimpleSkin span.mce_bold {background-position:0 0}\r
+.defaultSimpleSkin span.mce_italic {background-position:-60px 0}\r
+.defaultSimpleSkin span.mce_underline {background-position:-140px 0}\r
+.defaultSimpleSkin span.mce_strikethrough {background-position:-120px 0}\r
+.defaultSimpleSkin span.mce_undo {background-position:-160px 0}\r
+.defaultSimpleSkin span.mce_redo {background-position:-100px 0}\r
+.defaultSimpleSkin span.mce_cleanup {background-position:-40px 0}\r
+.defaultSimpleSkin span.mce_insertunorderedlist {background-position:-20px 0}\r
+.defaultSimpleSkin span.mce_insertorderedlist {background-position:-80px 0}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/content.css b/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/content.css
new file mode 100644 (file)
index 0000000..595809f
--- /dev/null
@@ -0,0 +1,17 @@
+body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+\r
+body {background: #FFF;}\r
+.mceVisualAid {border: 1px dashed #BBB;}\r
+\r
+/* IE */\r
+\r
+* html body {\r
+scrollbar-3dlight-color: #F0F0EE;\r
+scrollbar-arrow-color: #676662;\r
+scrollbar-base-color: #F0F0EE;\r
+scrollbar-darkshadow-color: #DDDDDD;\r
+scrollbar-face-color: #E0E0DD;\r
+scrollbar-highlight-color: #F0F0EE;\r
+scrollbar-shadow-color: #F0F0EE;\r
+scrollbar-track-color: #F5F5F5;        \r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/img/button_bg.png b/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/img/button_bg.png
new file mode 100644 (file)
index 0000000..527e349
Binary files /dev/null and b/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/img/button_bg.png differ
diff --git a/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/ui.css b/3.x/src/resources/javascript/TinyMCE/themes/simple/skins/o2k7/ui.css
new file mode 100644 (file)
index 0000000..cf6c35d
--- /dev/null
@@ -0,0 +1,35 @@
+/* Reset */\r
+.o2k7SimpleSkin table, .o2k7SimpleSkin tbody, .o2k7SimpleSkin a, .o2k7SimpleSkin img, .o2k7SimpleSkin tr, .o2k7SimpleSkin div, .o2k7SimpleSkin td, .o2k7SimpleSkin iframe, .o2k7SimpleSkin span, .o2k7SimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000}\r
+\r
+/* Containers */\r
+.o2k7SimpleSkin {position:relative}\r
+.o2k7SimpleSkin table.mceLayout {background:#E5EFFD; border:1px solid #ABC6DD;}\r
+.o2k7SimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #ABC6DD;}\r
+.o2k7SimpleSkin .mceToolbar {height:26px;}\r
+\r
+/* Layout */\r
+.o2k7SimpleSkin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; }\r
+.o2k7SimpleSkin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px}\r
+.o2k7SimpleSkin span.mceIcon, .o2k7SimpleSkin img.mceIcon {display:block; width:20px; height:20px}\r
+.o2k7SimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}\r
+\r
+/* Button */\r
+.o2k7SimpleSkin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px}\r
+.o2k7SimpleSkin a.mceButton span, .o2k7SimpleSkin a.mceButton img {margin:1px 0 0 1px}\r
+.o2k7SimpleSkin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}\r
+.o2k7SimpleSkin a.mceButtonActive {background-position:0 -44px}\r
+.o2k7SimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+\r
+/* Separator */\r
+.o2k7SimpleSkin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}\r
+\r
+/* Theme */\r
+.o2k7SimpleSkin span.mce_bold {background-position:0 0}\r
+.o2k7SimpleSkin span.mce_italic {background-position:-60px 0}\r
+.o2k7SimpleSkin span.mce_underline {background-position:-140px 0}\r
+.o2k7SimpleSkin span.mce_strikethrough {background-position:-120px 0}\r
+.o2k7SimpleSkin span.mce_undo {background-position:-160px 0}\r
+.o2k7SimpleSkin span.mce_redo {background-position:-100px 0}\r
+.o2k7SimpleSkin span.mce_cleanup {background-position:-40px 0}\r
+.o2k7SimpleSkin span.mce_insertunorderedlist {background-position:-20px 0}\r
+.o2k7SimpleSkin span.mce_insertorderedlist {background-position:-80px 0}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/tiny_mce.js b/3.x/src/resources/javascript/TinyMCE/tiny_mce.js
new file mode 100644 (file)
index 0000000..af5a802
--- /dev/null
@@ -0,0 +1 @@
+(function(e){var a=/^\s*|\s*$/g,b,d="B".replace(/A(.)|B/,"$1")==="$1";var c={majorVersion:"3",minorVersion:"5.6",releaseDate:"2012-07-26",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=e.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(e.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m<f.length;m++){r=f[m].href;if(r){if(/^https?:\/\/[^\/]+$/.test(r)){r+="/"}k=r?r.match(/.*\//)[0]:""}}function h(i){if(i.src&&/tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(i.src)){if(/_(src|dev)\.js/g.test(i.src)){s.suffix="_src"}if((j=i.src.indexOf("?"))!=-1){s.query=i.src.substring(j+1)}s.baseURL=i.src.substring(0,i.src.lastIndexOf("/"));if(k&&s.baseURL.indexOf("://")==-1&&s.baseURL.indexOf("/")!==0){s.baseURL=k+s.baseURL}return s.baseURL}return null}f=q.getElementsByTagName("script");for(m=0;m<f.length;m++){if(h(f[m])){return}}l=q.getElementsByTagName("head")[0];if(l){f=l.getElementsByTagName("script");for(m=0;m<f.length;m++){if(h(f[m])){return}}}return},is:function(g,f){if(!f){return g!==b}if(f=="array"&&(g.hasOwnProperty&&g instanceof Array)){return true}return typeof(g)==f},makeMap:function(f,j,h){var g;f=f||[];j=j||",";if(typeof(f)=="string"){f=f.split(j)}h=h||{};g=f.length;while(g--){h[f[g]]={}}return h},each:function(i,f,h){var j,g;if(!i){return 0}h=h||i;if(i.length!==b){for(j=0,g=i.length;j<g;j++){if(f.call(h,i[j],j,i)===false){return 0}}}else{for(j in i){if(i.hasOwnProperty(j)){if(f.call(h,i[j],j,i)===false){return 0}}}}return 1},map:function(g,h){var i=[];c.each(g,function(f){i.push(h(f))});return i},grep:function(g,h){var i=[];c.each(g,function(f){if(!h||h(f)){i.push(f)}});return i},inArray:function(g,h){var j,f;if(g){for(j=0,f=g.length;j<f;j++){if(g[j]===h){return j}}}return -1},extend:function(n,k){var j,f,h,g=arguments,m;for(j=1,f=g.length;j<f;j++){k=g[j];for(h in k){if(k.hasOwnProperty(h)){m=k[h];if(m!==b){n[h]=m}}}}return n},trim:function(f){return(f?""+f:"").replace(a,"")},create:function(o,f,j){var n=this,g,i,k,l,h,m=0;o=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(o);k=o[3].match(/(^|\.)(\w+)$/i)[2];i=n.createNS(o[3].replace(/\.\w+$/,""),j);if(i[k]){return}if(o[2]=="static"){i[k]=f;if(this.onCreate){this.onCreate(o[2],o[3],i[k])}return}if(!f[k]){f[k]=function(){};m=1}i[k]=f[k];n.extend(i[k].prototype,f);if(o[5]){g=n.resolve(o[5]).prototype;l=o[5].match(/\.(\w+)$/i)[1];h=i[k];if(m){i[k]=function(){return g[l].apply(this,arguments)}}else{i[k]=function(){this.parent=g[l];return h.apply(this,arguments)}}i[k].prototype[k]=i[k];n.each(g,function(p,q){i[k].prototype[q]=g[q]});n.each(f,function(p,q){if(g[q]){i[k].prototype[q]=function(){this.parent=g[q];return p.apply(this,arguments)}}else{if(q!=k){i[k].prototype[q]=p}}})}n.each(f["static"],function(p,q){i[k][q]=p});if(this.onCreate){this.onCreate(o[2],o[3],i[k].prototype)}},walk:function(i,h,j,g){g=g||this;if(i){if(j){i=i[j]}c.each(i,function(k,f){if(h.call(g,k,f,j)===false){return false}c.walk(k,h,j,g)})}},createNS:function(j,h){var g,f;h=h||e;j=j.split(".");for(g=0;g<j.length;g++){f=j[g];if(!h[f]){h[f]={}}h=h[f]}return h},resolve:function(j,h){var g,f;h=h||e;j=j.split(".");for(g=0,f=j.length;g<f;g++){h=h[j[g]];if(!h){break}}return h},addUnload:function(j,i){var h=this,g;g=function(){var f=h.unloads,l,m;if(f){for(m in f){l=f[m];if(l&&l.func){l.func.call(l.scope,1)}}if(e.detachEvent){e.detachEvent("onbeforeunload",k);e.detachEvent("onunload",g)}else{if(e.removeEventListener){e.removeEventListener("unload",g,false)}}h.unloads=l=f=w=g=0;if(e.CollectGarbage){CollectGarbage()}}};function k(){var l=document;function f(){l.detachEvent("onstop",f);if(g){g()}l=0}if(l.readyState=="interactive"){if(l){l.attachEvent("onstop",f)}e.setTimeout(function(){if(l){l.detachEvent("onstop",f)}},0)}}j={func:j,scope:i||this};if(!h.unloads){if(e.attachEvent){e.attachEvent("onunload",g);e.attachEvent("onbeforeunload",k)}else{if(e.addEventListener){e.addEventListener("unload",g,false)}}h.unloads=[j]}else{h.unloads.push(j)}return j},removeUnload:function(i){var g=this.unloads,h=null;c.each(g,function(j,f){if(j&&j.func==i){g.splice(f,1);h=i;return false}});return h},explode:function(f,g){if(!f||c.is(f,"array")){return f}return c.map(f.split(g||","),c.trim)},_addVer:function(g){var f;if(!this.query){return g}f=(g.indexOf("?")==-1?"?":"&")+this.query;if(g.indexOf("#")==-1){return g+f}return g.replace("#",f+"#")},_replace:function(h,f,g){if(d){return g.replace(h,function(){var l=f,j=arguments,k;for(k=0;k<j.length-2;k++){if(j[k]===b){l=l.replace(new RegExp("\\$"+k,"g"),"")}else{l=l.replace(new RegExp("\\$"+k,"g"),j[k])}}return l})}return g.replace(h,f)}};c._init();e.tinymce=e.tinyMCE=c})(window);tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,inDispatch:false,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(b,a){this.listeners.push({cb:b,scope:a||this.scope});return b},addToTop:function(d,b){var a=this,c={cb:d,scope:b||a.scope};if(a.inDispatch){a.listeners=[c].concat(a.listeners)}else{a.listeners.unshift(c)}return d},remove:function(c){var b=this.listeners,a=null;tinymce.each(b,function(e,d){if(c==e.cb){a=e;b.splice(d,1);return false}});return a},dispatch:function(){var a=this,e,b=arguments,c,d=a.listeners,f;a.inDispatch=true;for(c=0;c<d.length;c++){f=d[c];e=f.cb.apply(f.scope,b.length>0?b:[f.scope]);if(e===false){break}}a.inDispatch=false;return e}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,i,d,c,h;e=tinymce.trim(e);g=f.settings=g||{};if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^[\w\-]*:?\/\//.test(e)){h=g.base_uri?g.base_uri.path:new tinymce.util.URI(location.href).directory;e=((g.base_uri&&g.base_uri.protocol)||"http")+"://mce_host"+f.toAbsPath(h,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});c=g.base_uri;if(c){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host==="mce_host"){f.port=c.port}if(!f.host||f.host==="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var d=this,f;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:d});if((b.host!="mce_host"&&d.host!=b.host&&b.host)||d.port!=b.port||d.protocol!=b.protocol){return b.getURI()}var c=d.getURI(),e=b.getURI();if(c==e||(c.charAt(c.length-1)=="/"&&c.substr(0,c.length-1)==e)){return c}f=d.toRelPath(d.path,b.path);if(b.query){f+="?"+b.query}if(b.anchor){f+="#"+b.anchor}return f},toAbsolute:function(b,c){b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f===1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length===0||f[c]==="."){continue}if(f[c]===".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!==0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(c,e,d){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,"",b,e,d)}})})();(function(){function serialize(o,quote){var i,v,t,name;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i<o.length;i++){v+=(i>0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(name in o){if(o.hasOwnProperty(name)){v+=typeof o[name]!="function"?(v.length>1?","+quote:quote)+name+quote+":"+serialize(o[name],quote):""}}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(b){return b.shiftKey||b.ctrlKey||b.altKey},metaKeyPressed:function(b){return a.isMac?b.metaKey:b.ctrlKey&&!b.altKey}}})(tinymce);tinymce.util.Quirks=function(d){var m=tinymce.VK,t=m.BACKSPACE,u=m.DELETE,p=d.dom,E=d.selection,s=d.settings;function c(I,H){try{d.getDoc().execCommand(I,false,H)}catch(G){}}function z(){var G=d.getDoc().documentMode;return G?G:6}function j(){function G(J){var H,L,I,K;H=E.getRng();L=p.getParent(H.startContainer,p.isBlock);if(J){L=p.getNext(L,p.isBlock)}if(L){I=L.firstChild;while(I&&I.nodeType==3&&I.nodeValue.length===0){I=I.nextSibling}if(I&&I.nodeName==="SPAN"){K=I.cloneNode(false)}}d.getDoc().execCommand(J?"ForwardDelete":"Delete",false,null);L=p.getParent(H.startContainer,p.isBlock);tinymce.each(p.select("span.Apple-style-span,font.Apple-style-span",L),function(M){var N=E.getBookmark();if(K){p.replace(K.cloneNode(false),M,true)}else{p.remove(M,true)}E.moveToBookmark(N)})}d.onKeyDown.add(function(H,J){var I;I=J.keyCode==u;if(!J.isDefaultPrevented()&&(I||J.keyCode==t)&&!m.modifierPressed(J)){J.preventDefault();G(I)}});d.addCommand("Delete",function(){G()})}function F(){function G(J){var I=p.create("body");var K=J.cloneContents();I.appendChild(K);return E.serializer.serialize(I,{format:"html"})}function H(I){var K=G(I);var L=p.createRng();L.selectNode(d.getBody());var J=G(L);return K===J}d.onKeyDown.add(function(J,L){var K=L.keyCode,I;if(!L.isDefaultPrevented()&&(K==u||K==t)){I=J.selection.isCollapsed();if(I&&!p.isEmpty(J.getBody())){return}if(tinymce.isIE&&!I){return}if(!I&&!H(J.selection.getRng())){return}J.setContent("");J.selection.setCursorLocation(J.getBody(),0);J.nodeChanged()}})}function x(){d.onKeyDown.add(function(G,H){if(H.keyCode==65&&m.metaKeyPressed(H)){H.preventDefault();G.execCommand("SelectAll")}})}function y(){if(!d.settings.content_editable){p.bind(d.getDoc(),"focusin",function(G){E.setRng(E.getRng())});p.bind(d.getDoc(),"mousedown",function(G){if(G.target==d.getDoc().documentElement){d.getWin().focus();E.setRng(E.getRng())}})}}function n(){d.onKeyDown.add(function(G,J){if(!J.isDefaultPrevented()&&J.keyCode===t){if(E.isCollapsed()&&E.getRng(true).startOffset===0){var I=E.getNode();var H=I.previousSibling;if(H&&H.nodeName&&H.nodeName.toLowerCase()==="hr"){p.remove(H);tinymce.dom.Event.cancel(J)}}}})}function b(){if(!Range.prototype.getClientRects){d.onMouseDown.add(function(H,I){if(I.target.nodeName==="HTML"){var G=H.getBody();G.blur();setTimeout(function(){G.focus()},0)}})}}function B(){d.onClick.add(function(G,H){H=H.target;if(/^(IMG|HR)$/.test(H.nodeName)){E.getSel().setBaseAndExtent(H,0,H,1)}if(H.nodeName=="A"&&p.hasClass(H,"mceItemAnchor")){E.select(H)}G.nodeChanged()})}function C(){function H(){var J=p.getAttribs(E.getStart().cloneNode(false));return function(){var K=E.getStart();if(K!==d.getBody()){p.setAttrib(K,"style",null);tinymce.each(J,function(L){K.setAttributeNode(L.cloneNode(true))})}}}function G(){return !E.isCollapsed()&&p.getParent(E.getStart(),p.isBlock)!=p.getParent(E.getEnd(),p.isBlock)}function I(J,K){K.preventDefault();return false}d.onKeyPress.add(function(J,L){var K;if((L.keyCode==8||L.keyCode==46)&&G()){K=H();J.getDoc().execCommand("delete",false,null);K();L.preventDefault();return false}});p.bind(d.getDoc(),"cut",function(K){var J;if(G()){J=H();d.onKeyUp.addToTop(I);setTimeout(function(){J();d.onKeyUp.remove(I)},0)}})}function k(){var H,G;p.bind(d.getDoc(),"selectionchange",function(){if(G){clearTimeout(G);G=0}G=window.setTimeout(function(){var I=E.getRng();if(!H||!tinymce.dom.RangeUtils.compareRanges(I,H)){d.nodeChanged();H=I}},50)})}function D(){document.body.setAttribute("role","application")}function A(){d.onKeyDown.add(function(G,I){if(!I.isDefaultPrevented()&&I.keyCode===t){if(E.isCollapsed()&&E.getRng(true).startOffset===0){var H=E.getNode().previousSibling;if(H&&H.nodeName&&H.nodeName.toLowerCase()==="table"){return tinymce.dom.Event.cancel(I)}}}})}function h(){if(z()>7){return}c("RespectVisibilityInDesign",true);d.contentStyles.push(".mceHideBrInPre pre br {display: none}");p.addClass(d.getBody(),"mceHideBrInPre");d.parser.addNodeFilter("pre",function(G,I){var J=G.length,L,H,M,K;while(J--){L=G[J].getAll("br");H=L.length;while(H--){M=L[H];K=M.prev;if(K&&K.type===3&&K.value.charAt(K.value-1)!="\n"){K.value+="\n"}else{M.parent.insert(new tinymce.html.Node("#text",3),M,true).value="\n"}}}});d.serializer.addNodeFilter("pre",function(G,I){var J=G.length,L,H,M,K;while(J--){L=G[J].getAll("br");H=L.length;while(H--){M=L[H];K=M.prev;if(K&&K.type==3){K.value=K.value.replace(/\r?\n$/,"")}}}})}function f(){p.bind(d.getBody(),"mouseup",function(I){var H,G=E.getNode();if(G.nodeName=="IMG"){if(H=p.getStyle(G,"width")){p.setAttrib(G,"width",H.replace(/[^0-9%]+/g,""));p.setStyle(G,"width","")}if(H=p.getStyle(G,"height")){p.setAttrib(G,"height",H.replace(/[^0-9%]+/g,""));p.setStyle(G,"height","")}}})}function r(){d.onKeyDown.add(function(M,N){var L,G,H,J,K,O,I;L=N.keyCode==u;if(!N.isDefaultPrevented()&&(L||N.keyCode==t)&&!m.modifierPressed(N)){G=E.getRng();H=G.startContainer;J=G.startOffset;I=G.collapsed;if(H.nodeType==3&&H.nodeValue.length>0&&((J===0&&!I)||(I&&J===(L?0:1)))){nonEmptyElements=M.schema.getNonEmptyElements();N.preventDefault();K=p.create("br",{id:"__tmp"});H.parentNode.insertBefore(K,H);M.getDoc().execCommand(L?"ForwardDelete":"Delete",false,null);H=E.getRng().startContainer;O=H.previousSibling;if(O&&O.nodeType==1&&!p.isBlock(O)&&p.isEmpty(O)&&!nonEmptyElements[O.nodeName.toLowerCase()]){p.remove(O)}p.remove("__tmp")}}})}function e(){d.onKeyDown.add(function(K,L){var I,H,M,G,J;if(L.isDefaultPrevented()||L.keyCode!=m.BACKSPACE){return}I=E.getRng();H=I.startContainer;M=I.startOffset;G=p.getRoot();J=H;if(!I.collapsed||M!==0){return}while(J&&J.parentNode&&J.parentNode.firstChild==J&&J.parentNode!=G){J=J.parentNode}if(J.tagName==="BLOCKQUOTE"){K.formatter.toggle("blockquote",null,J);I.setStart(H,0);I.setEnd(H,0);E.setRng(I);E.collapse(false)}})}function l(){function G(){d._refreshContentEditable();c("StyleWithCSS",false);c("enableInlineTableEditing",false);if(!s.object_resizing){c("enableObjectResizing",false)}}if(!s.readonly){d.onBeforeExecCommand.add(G);d.onMouseDown.add(G)}}function o(){function G(H,I){tinymce.each(p.select("a"),function(L){var J=L.parentNode,K=p.getRoot();if(J.lastChild===L){while(J&&!p.isBlock(J)){if(J.parentNode.lastChild!==J||J===K){return}J=J.parentNode}p.add(J,"br",{"data-mce-bogus":1})}})}d.onExecCommand.add(function(H,I){if(I==="CreateLink"){G(H)}});d.onSetContent.add(E.onSetContent.add(G))}function v(){if(s.forced_root_block){d.onInit.add(function(){c("DefaultParagraphSeparator",s.forced_root_block)})}}function a(){function G(I,H){if(!I||!H.initial){d.execCommand("mceRepaint")}}d.onUndo.add(G);d.onRedo.add(G);d.onSetContent.add(G)}function q(){d.onKeyDown.add(function(H,I){var G;if(!I.isDefaultPrevented()&&I.keyCode==t){G=H.getDoc().selection.createRange();if(G&&G.item){I.preventDefault();H.undoManager.beforeChange();p.remove(G.item(0));H.undoManager.add()}}})}function i(){var G;if(z()>=10){G="";tinymce.each("p div h1 h2 h3 h4 h5 h6".split(" "),function(H,I){G+=(I>0?",":"")+H+":empty"});d.contentStyles.push(G+"{padding-right: 1px !important}")}}function g(){var I,H,Y,G,T,W,U,X,J,K,V,R,Q,S=document,O=d.getDoc();if(!s.object_resizing||s.webkit_fake_resize===false){return}c("enableObjectResizing",false);V={n:[0.5,0,0,-1],e:[1,0.5,1,0],s:[0.5,1,0,1],w:[0,0.5,-1,0],nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]};function M(ac){var ab,aa;ab=ac.screenX-W;aa=ac.screenY-U;R=ab*T[2]+X;Q=aa*T[3]+J;R=R<5?5:R;Q=Q<5?5:Q;if(m.modifierPressed(ac)||(Y.nodeName=="IMG"&&T[2]*T[3]!==0)){R=Math.round(Q/K);Q=Math.round(R*K)}p.setStyles(G,{width:R,height:Q});if(T[2]<0&&G.clientWidth<=R){p.setStyle(G,"left",I+(X-R))}if(T[3]<0&&G.clientHeight<=Q){p.setStyle(G,"top",H+(J-Q))}}function Z(){function aa(ab,ac){if(ac){if(Y.style[ab]||!d.schema.isValid(Y.nodeName.toLowerCase(),ab)){p.setStyle(Y,ab,ac)}else{p.setAttrib(Y,ab,ac)}}}aa("width",R);aa("height",Q);p.unbind(O,"mousemove",M);p.unbind(O,"mouseup",Z);if(S!=O){p.unbind(S,"mousemove",M);p.unbind(S,"mouseup",Z)}p.remove(G);L(Y)}function L(ad){var ab,ac,aa;N();ab=p.getPos(ad);I=ab.x;H=ab.y;ac=ad.offsetWidth;aa=ad.offsetHeight;if(Y!=ad){Y=ad;R=Q=0}tinymce.each(V,function(ag,ae){var af;af=p.get("mceResizeHandle"+ae);if(!af){af=p.add(O.documentElement,"div",{id:"mceResizeHandle"+ae,"class":"mceResizeHandle",style:"cursor:"+ae+"-resize; margin:0; padding:0"});p.bind(af,"mousedown",function(ah){ah.preventDefault();Z();W=ah.screenX;U=ah.screenY;X=Y.clientWidth;J=Y.clientHeight;K=J/X;T=ag;G=Y.cloneNode(true);p.addClass(G,"mceClonedResizable");p.setStyles(G,{left:I,top:H,margin:0});O.documentElement.appendChild(G);p.bind(O,"mousemove",M);p.bind(O,"mouseup",Z);if(S!=O){p.bind(S,"mousemove",M);p.bind(S,"mouseup",Z)}})}else{p.show(af)}p.setStyles(af,{left:(ac*ag[0]+I)-(af.offsetWidth/2),top:(aa*ag[1]+H)-(af.offsetHeight/2)})});if(!tinymce.isOpera&&Y.nodeName=="IMG"){Y.setAttribute("data-mce-selected","1")}}function N(){if(Y){Y.removeAttribute("data-mce-selected")}for(var aa in V){p.hide("mceResizeHandle"+aa)}}d.contentStyles.push(".mceResizeHandle {position: absolute;border: 1px solid black;background: #FFF;width: 5px;height: 5px;z-index: 10000}.mceResizeHandle:hover {background: #000}img[data-mce-selected] {outline: 1px solid black}img.mceClonedResizable, table.mceClonedResizable {position: absolute;outline: 1px dashed black;opacity: .5;z-index: 10000}");function P(){var aa=p.getParent(E.getNode(),"table,img");tinymce.each(p.select("img[data-mce-selected]"),function(ab){ab.removeAttribute("data-mce-selected")});if(aa){L(aa)}else{N()}}d.onNodeChange.add(P);p.bind(O,"selectionchange",P);d.serializer.addAttributeFilter("data-mce-selected",function(aa,ab){var ac=aa.length;while(ac--){aa[ac].attr(ab,null)}})}A();e();F();if(tinymce.isWebKit){r();j();y();B();v();if(tinymce.isIDevice){k()}else{g();x()}}if(tinymce.isIE){n();D();h();f();q();i()}if(tinymce.isGecko){n();b();C();l();o();a()}if(tinymce.isOpera){g()}};(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;"};d={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n<m.length;n+=2){o=String.fromCharCode(parseInt(m[n],p));if(!g[o]){l="&"+m[n+1]+";";q[o]=l;q[l]=o}}return q}}a=e("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);j.html=j.html||{};j.html.Entities={encodeRaw:function(m,l){return m.replace(l?k:b,function(n){return g[n]||n})},encodeAllRaw:function(l){return(""+l).replace(f,function(m){return g[m]||m})},encodeNumeric:function(m,l){return m.replace(l?k:b,function(n){if(n.length>1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g<j.length;g++){a[j[g]]="\uFEFF"+g;a["\uFEFF"+g]=j[g]}function c(n,q,p,i){function o(r){r=parseInt(r).toString(16);return r.length>1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(s){var z={},q,n,x,r,v=d.url_converter,y=d.url_converter_scope||this;function p(D,G){var F,C,B,E;F=z[D+"-top"+G];if(!F){return}C=z[D+"-right"+G];if(F!=C){return}B=z[D+"-bottom"+G];if(C!=B){return}E=z[D+"-left"+G];if(B!=E){return}z[D+G]=E;delete z[D+"-top"+G];delete z[D+"-right"+G];delete z[D+"-bottom"+G];delete z[D+"-left"+G]}function u(C){var D=z[C],B;if(!D||D.indexOf(" ")<0){return}D=D.split(" ");B=D.length;while(B--){if(D[B]!==D[0]){return false}}z[C]=D[0];return true}function A(D,C,B,E){if(!u(C)){return}if(!u(B)){return}if(!u(E)){return}z[D]=z[C]+" "+z[B]+" "+z[E];delete z[C];delete z[B];delete z[E]}function t(B){r=true;return a[B]}function i(C,B){if(r){C=C.replace(/\uFEFF[0-9]/g,function(D){return a[D]})}if(!B){C=C.replace(/\\([\'\";:])/g,"$1")}return C}function o(C,B,F,E,G,D){G=G||D;if(G){G=i(G);return"'"+G.replace(/\'/g,"\\'")+"'"}B=i(B||F||E);if(v){B=v.call(y,B,"style")}return"url('"+B.replace(/\'/g,"\\'")+"')"}if(s){s=s.replace(/\\[\"\';:\uFEFF]/g,t).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(B){return B.replace(/[;:]/g,t)});while(q=b.exec(s)){n=q[1].replace(l,"").toLowerCase();x=q[2].replace(l,"");if(n&&x.length>0){if(n==="font-weight"&&x==="700"){x="bold"}else{if(n==="color"||n==="background-color"){x=x.toLowerCase()}}x=x.replace(k,c);x=x.replace(h,o);z[n]=r?i(x,true):x}b.lastIndex=q.index+q[0].length}p("border","");p("border","-width");p("border","-color");p("border","-style");p("padding","");p("margin","");A("border","border-width","border-style","border-color");if(z.border==="medium none"){delete z.border}}return z},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u<s;u++){t=x[u];v=p[t];if(v!==e&&v.length>0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(f){var a={},e=f.makeMap,g=f.each;function d(j,i){return j.split(i||",")}function h(m,l){var j,k={};function i(n){return n.replace(/[A-Z]+/g,function(o){return i(m[o])})}for(j in m){if(m.hasOwnProperty(j)){m[j]=i(m[j])}}i(l).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(q,o,n,p){n=d(n,"|");k[o]={attributes:e(n),attributesOrder:n,children:e(p,"|",{"#comment":{}})}});return k}function b(){var i=a.html5;if(!i){i=a.html5=h({A:"id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"#|a|abbr|area|audio|b|bdo|br|button|canvas|cite|code|command|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|meta|meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video|wbr",C:"#|a|abbr|area|address|article|aside|audio|b|bdo|blockquote|br|button|canvas|cite|code|command|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|menu|meta|meter|nav|noscript|ol|object|output|p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video"},"html[A|manifest][body|head]head[A][base|command|link|meta|noscript|script|style|title]title[A][#]base[A|href|target][]link[A|href|rel|media|type|sizes][]meta[A|http-equiv|name|content|charset][]style[A|type|media|scoped][#]script[A|charset|type|src|defer|async][#]noscript[A][C]body[A][C]section[A][C]nav[A][C]article[A][C]aside[A][C]h1[A][B]h2[A][B]h3[A][B]h4[A][B]h5[A][B]h6[A][B]hgroup[A][h1|h2|h3|h4|h5|h6]header[A][C]footer[A][C]address[A][C]p[A][B]br[A][]pre[A][B]dialog[A][dd|dt]blockquote[A|cite][C]ol[A|start|reversed][li]ul[A][li]li[A|value][C]dl[A][dd|dt]dt[A][B]dd[A][C]a[A|href|target|ping|rel|media|type][B]em[A][B]strong[A][B]small[A][B]cite[A][B]q[A|cite][B]dfn[A][B]abbr[A][B]code[A][B]var[A][B]samp[A][B]kbd[A][B]sub[A][B]sup[A][B]i[A][B]b[A][B]mark[A][B]progress[A|value|max][B]meter[A|value|min|max|low|high|optimum][B]time[A|datetime][B]ruby[A][B|rt|rp]rt[A][B]rp[A][B]bdo[A][B]span[A][B]ins[A|cite|datetime][B]del[A|cite|datetime][B]figure[A][C|legend|figcaption]figcaption[A][C]img[A|alt|src|height|width|usemap|ismap][]iframe[A|name|src|height|width|sandbox|seamless][]embed[A|src|height|width|type][]object[A|data|type|height|width|usemap|name|form|classid][param]param[A|name|value][]details[A|open][C|legend]command[A|type|label|icon|disabled|checked|radiogroup][]menu[A|type|label][C|li]legend[A][C|B]div[A][C]source[A|src|type|media][]audio[A|src|autobuffer|autoplay|loop|controls][source]video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]hr[A][]form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]fieldset[A|disabled|form|name][C|legend]label[A|form|for][B]input[A|type|accept|alt|autocomplete|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]datalist[A][B|option]optgroup[A|disabled|label][option]option[A|disabled|selected|label|value][]textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]keygen[A|autofocus|challenge|disabled|form|keytype|name][]output[A|for|form|name][B]canvas[A|width|height][]map[A|name][B|C]area[A|shape|coords|href|alt|target|media|rel|ping|type][]mathml[A][]svg[A][]table[A|border][caption|colgroup|thead|tfoot|tbody|tr]caption[A][C]colgroup[A|span][col]col[A|span][]thead[A][tr]tfoot[A][tr]tbody[A][tr]tr[A][th|td]th[A|headers|rowspan|colspan|scope][B]td[A|headers|rowspan|colspan][C]wbr[A][]")}return i}function c(){var i=a.html4;if(!i){i=a.html4=h({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]")}return i}f.html.Schema=function(A){var u=this,s={},k={},j=[],D,y;var o,q,z,r,v,n,p={};function m(F,E,H){var G=A[F];if(!G){G=a[F];if(!G){G=e(E," ",e(E.toUpperCase()," "));G=f.extend(G,H);a[F]=G}}else{G=e(G,",",e(G.toUpperCase()," "))}return G}A=A||{};y=A.schema=="html5"?b():c();if(A.verify_html===false){A.valid_elements="*[*]"}if(A.valid_styles){D={};g(A.valid_styles,function(F,E){D[E]=f.explode(F)})}o=m("whitespace_elements","pre script style textarea");q=m("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr");z=m("short_ended_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr");r=m("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls");n=m("non_empty_elements","td th iframe video audio object",z);v=m("block_elements","h1 h2 h3 h4 h5 h6 hr p div address pre form table tbody thead tfoot th tr td li ol ul caption blockquote center dl dt dd dir fieldset noscript menu isindex samp header footer article section hgroup aside nav figure option datalist select optgroup");function i(E){return new RegExp("^"+E.replace(/([?+*])/g,".$1")+"$")}function C(L){var K,G,Z,V,aa,F,I,U,X,Q,Y,ac,O,J,W,E,S,H,ab,ad,P,T,N=/^([#+\-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,R=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,M=/[*?+]/;if(L){L=d(L);if(s["@"]){S=s["@"].attributes;H=s["@"].attributesOrder}for(K=0,G=L.length;K<G;K++){F=N.exec(L[K]);if(F){W=F[1];Q=F[2];E=F[3];X=F[4];O={};J=[];I={attributes:O,attributesOrder:J};if(W==="#"){I.paddEmpty=true}if(W==="-"){I.removeEmpty=true}if(S){for(ad in S){O[ad]=S[ad]}J.push.apply(J,H)}if(X){X=d(X,"|");for(Z=0,V=X.length;Z<V;Z++){F=R.exec(X[Z]);if(F){U={};ac=F[1];Y=F[2].replace(/::/g,":");W=F[3];T=F[4];if(ac==="!"){I.attributesRequired=I.attributesRequired||[];I.attributesRequired.push(Y);U.required=true}if(ac==="-"){delete O[Y];J.splice(f.inArray(J,Y),1);continue}if(W){if(W==="="){I.attributesDefault=I.attributesDefault||[];I.attributesDefault.push({name:Y,value:T});U.defaultValue=T}if(W===":"){I.attributesForced=I.attributesForced||[];I.attributesForced.push({name:Y,value:T});U.forcedValue=T}if(W==="<"){U.validValues=e(T,"?")}}if(M.test(Y)){I.attributePatterns=I.attributePatterns||[];U.pattern=i(Y);I.attributePatterns.push(U)}else{if(!O[Y]){J.push(Y)}O[Y]=U}}}}if(!S&&Q=="@"){S=O;H=J}if(E){I.outputName=Q;s[E]=I}if(M.test(Q)){I.pattern=i(Q);j.push(I)}else{s[Q]=I}}}}}function t(E){s={};j=[];C(E);g(y,function(G,F){k[F]=G.children})}function l(F){var E=/^(~)?(.+)$/;if(F){g(d(F),function(J){var H=E.exec(J),I=H[1]==="~",K=I?"span":"div",G=H[2];k[G]=k[K];p[G]=K;if(!I){v[G]={}}g(k,function(L,M){if(L[K]){L[G]=L[K]}})})}}function x(F){var E=/^([+\-]?)(\w+)\[([^\]]+)\]$/;if(F){g(d(F),function(J){var I=E.exec(J),G,H;if(I){H=I[1];if(H){G=k[I[2]]}else{G=k[I[2]]={"#comment":{}}}G=k[I[2]];g(d(I[3],"|"),function(K){if(H==="-"){delete G[K]}else{G[K]={}}})}})}}function B(E){var G=s[E],F;if(G){return G}F=j.length;while(F--){G=j[F];if(G.pattern.test(E)){return G}}}if(!A.valid_elements){g(y,function(F,E){s[E]={attributes:F.attributes,attributesOrder:F.attributesOrder};k[E]=F.children});if(A.schema!="html5"){g(d("strong/b,em/i"),function(E){E=d(E,"/");s[E[1]].outputName=E[0]})}s.img.attributesDefault=[{name:"alt",value:""}];g(d("ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,em,b,i"),function(E){if(s[E]){s[E].removeEmpty=true}});g(d("p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption"),function(E){s[E].paddEmpty=true})}else{t(A.valid_elements)}l(A.custom_elements);x(A.valid_children);C(A.extended_valid_elements);x("+ol[ul|ol],+ul[ul|ol]");if(A.invalid_elements){f.each(f.explode(A.invalid_elements),function(E){if(s[E]){delete s[E]}})}if(!B("span")){C("span[!data-mce-type|*]")}u.children=k;u.styles=D;u.getBoolAttrs=function(){return r};u.getBlockElements=function(){return v};u.getShortEndedElements=function(){return z};u.getSelfClosingElements=function(){return q};u.getNonEmptyElements=function(){return n};u.getWhiteSpaceElements=function(){return o};u.isValidChild=function(E,G){var F=k[E];return !!(F&&F[G])};u.isValid=function(F,E){var H,G,I=B(F);if(I){if(E){if(I.attributes[E]){return true}H=I.attributePatterns;if(H){G=H.length;while(G--){if(H[G].pattern.test(F)){return true}}}}else{return true}}return false};u.getElementRule=B;u.getCustomElements=function(){return p};u.addValidElements=C;u.setValidElements=t;u.addCustomElements=l;u.addValidChildren=x}})(tinymce);(function(a){a.html.SaxParser=function(c,e){var b=this,d=function(){};c=c||{};b.schema=e=e||new a.html.Schema();if(c.fix_self_closing!==false){c.fix_self_closing=true}a.each("comment cdata text start end pi doctype".split(" "),function(f){if(f){b[f]=c[f]||d}});b.parse=function(E){var n=this,g,G=0,I,B,A=[],N,Q,C,r,z,s,M,H,O,v,m,k,t,R,o,P,F,S,L,f,J,l,D,K,h,x=0,j=a.html.Entities.decode,y,q;function u(T){var V,U;V=A.length;while(V--){if(A[V].name===T){break}}if(V>=0){for(U=A.length-1;U>=V;U--){T=A[U];if(T.valid){n.end(T.name)}}A.length=V}}function p(U,T,Y,X,W){var Z,V;T=T.toLowerCase();Y=T in H?T:j(Y||X||W||"");if(v&&!z&&T.indexOf("data-")!==0){Z=P[T];if(!Z&&F){V=F.length;while(V--){Z=F[V];if(Z.pattern.test(T)){break}}if(V===-1){Z=null}}if(!Z){return}if(Z.validValues&&!(Y in Z.validValues)){return}}N.map[T]=Y;N.push({name:T,value:Y})}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([A-Za-z0-9\\-\\:]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g");D=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;K={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};M=e.getShortEndedElements();J=c.self_closing_elements||e.getSelfClosingElements();H=e.getBoolAttrs();v=c.validate;s=c.remove_internals;y=c.fix_self_closing;q=a.isIE;o=/^:/;while(g=l.exec(E)){if(G<g.index){n.text(j(E.substr(G,g.index-G)))}if(I=g[6]){I=I.toLowerCase();if(q&&o.test(I)){I=I.substr(1)}u(I)}else{if(I=g[7]){I=I.toLowerCase();if(q&&o.test(I)){I=I.substr(1)}O=I in M;if(y&&J[I]&&A.length>0&&A[A.length-1].name===I){u(I)}if(!v||(m=e.getElementRule(I))){k=true;if(v){P=m.attributes;F=m.attributePatterns}if(R=g[8]){z=R.indexOf("data-mce-type")!==-1;if(z&&s){k=false}N=[];N.map={};R.replace(D,p)}else{N=[];N.map={}}if(v&&!z){S=m.attributesRequired;L=m.attributesDefault;f=m.attributesForced;if(f){Q=f.length;while(Q--){t=f[Q];r=t.name;h=t.value;if(h==="{$uid}"){h="mce_"+x++}N.map[r]=h;N.push({name:r,value:h})}}if(L){Q=L.length;while(Q--){t=L[Q];r=t.name;if(!(r in N.map)){h=t.value;if(h==="{$uid}"){h="mce_"+x++}N.map[r]=h;N.push({name:r,value:h})}}}if(S){Q=S.length;while(Q--){if(S[Q] in N.map){break}}if(Q===-1){k=false}}if(N.map["data-mce-bogus"]){k=false}}if(k){n.start(I,N,O)}}else{k=false}if(B=K[I]){B.lastIndex=G=g.index+g[0].length;if(g=B.exec(E)){if(k){C=E.substr(G,g.index-G)}G=g.index+g[0].length}else{C=E.substr(G);G=E.length}if(k&&C.length>0){n.text(C,true)}if(k){n.end(I)}l.lastIndex=G;continue}if(!O){if(!R||R.indexOf("/")!=R.length-1){A.push({name:I,valid:k})}else{if(k){n.end(I)}}}}else{if(I=g[1]){n.comment(I)}else{if(I=g[2]){n.cdata(I)}else{if(I=g[3]){n.doctype(I)}else{if(I=g[4]){n.pi(I,g[5])}}}}}}G=g.index+g[0].length}if(G<E.length){n.text(j(E.substr(G)))}for(Q=A.length-1;Q>=0;Q--){I=A[Q];if(I.valid){n.end(I.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h<f;h++){j=m[h];if(j.name!=="id"){k[k.length]={name:j.name,value:j.value};k.map[j.name]=j.value}}n.attributes=k}n.value=g.value;n.shortEnded=g.shortEnded;return n},wrap:function(g){var f=this;f.parent.insert(g,f);g.append(f);return f},unwrap:function(){var f=this,h,g;for(h=f.firstChild;h;){g=h.next;f.insert(h,f,true);h=g}f.remove()},remove:function(){var f=this,h=f.parent,g=f.next,i=f.prev;if(h){if(h.firstChild===f){h.firstChild=g;if(g){g.prev=null}}else{i.next=g}if(h.lastChild===f){h.lastChild=i;if(i){i.next=null}}else{g.prev=i}f.parent=f.next=f.prev=null}return f},append:function(h){var f=this,g;if(h.parent){h.remove()}g=f.lastChild;if(g){g.next=h;h.prev=g;f.lastChild=h}else{f.lastChild=f.firstChild=h}h.parent=f;return h},insert:function(h,f,i){var g;if(h.parent){h.remove()}g=f.parent||this;if(i){if(f===g.firstChild){g.firstChild=h}else{f.prev.next=h}h.prev=f.prev;h.next=f;f.prev=h}else{if(f===g.lastChild){g.lastChild=h}else{f.next.prev=h}h.next=f.next;h.prev=f;f.next=h}h.parent=g;return h},getAll:function(g){var f=this,h,i=[];for(h=f.firstChild;h;h=a(h,f)){if(h.name===g){i.push(h)}}return i},empty:function(){var g=this,f,h,j;if(g.firstChild){f=[];for(j=g.firstChild;j;j=a(j,g)){f.push(j)}h=f.length;while(h--){j=f[h];j.parent=j.firstChild=j.lastChild=j.next=j.prev=null}}g.firstChild=g.lastChild=null;return g},isEmpty:function(k){var f=this,j=f.firstChild,h,g;if(j){do{if(j.type===1){if(j.attributes.map["data-mce-bogus"]){continue}if(k[j.name]){return false}h=j.attributes.length;while(h--){g=j.attributes[h].name;if(g==="name"||g.indexOf("data-")===0){return false}}}if(j.type===8){return false}if((j.type===3&&!c.test(j.value))){return false}}while(j=a(j,f))}return true},walk:function(f){return a(this,null,f)}});d.extend(b,{create:function(g,f){var i,h;i=new b(g,e[g]||1);if(f){for(h in f){i.attr(h,f[h])}}return i}});d.html.Node=b})(tinymce);(function(b){var a=b.html.Node;b.html.DomParser=function(g,h){var f=this,e={},d=[],i={},c={};g=g||{};g.validate="validate" in g?g.validate:true;g.root_name=g.root_name||"body";f.schema=h=h||new b.html.Schema();function j(m){var o,p,x,v,z,n,q,l,t,u,k,s,y,r;s=b.makeMap("tr,td,th,tbody,thead,tfoot,table");k=h.getNonEmptyElements();for(o=0;o<m.length;o++){p=m[o];if(!p.parent){continue}v=[p];for(x=p.parent;x&&!h.isValidChild(x.name,p.name)&&!s[x.name];x=x.parent){v.push(x)}if(x&&v.length>1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t<v.length-1;t++){if(h.isValidChild(n.name,v[t].name)){q=f.filterNode(v[t].clone());n.append(q)}else{q=n}for(l=v[t].firstChild;l&&l!=v[t+1];){r=l.next;q.append(l);l=r}n=q}if(!z.isEmpty(k)){x.insert(z,v[0],true);x.insert(p,z)}else{x.insert(p,v[0],true)}x=v[0];if(x.isEmpty(k)||x.firstChild===x.lastChild&&x.firstChild.name==="br"){x.empty().remove()}}else{if(p.parent){if(p.name==="li"){y=p.prev;if(y&&(y.name==="ul"||y.name==="ul")){y.append(p);continue}y=p.next;if(y&&(y.name==="ul"||y.name==="ul")){y.insert(p,y.firstChild,true);continue}p.wrap(f.filterNode(new a("ul",1)));continue}if(h.isValidChild(p.parent.name,"div")&&h.isValidChild("div",p.name)){p.wrap(f.filterNode(new a("div",1)))}else{if(p.name==="style"||p.name==="script"){p.empty().remove()}else{p.unwrap()}}}}}}f.filterNode=function(m){var l,k,n;if(k in e){n=i[k];if(n){n.push(m)}else{i[k]=[m]}}l=d.length;while(l--){k=d[l].name;if(k in m.attributes.map){n=c[k];if(n){n.push(m)}else{c[k]=[m]}}}return m};f.addNodeFilter=function(k,l){b.each(b.explode(k),function(m){var n=e[m];if(!n){e[m]=n=[]}n.push(l)})};f.addAttributeFilter=function(k,l){b.each(b.explode(k),function(m){var n;for(n=0;n<d.length;n++){if(d[n].name===m){d[n].callbacks.push(l);return}}d.push({name:m,callbacks:[l]})})};f.parse=function(v,m){var n,J,B,A,D,C,x,r,F,N,z,o,E,M=[],L,t,k,y,s,p,u,q;m=m||{};i={};c={};o=b.extend(b.makeMap("script,style,head,html,body,title,meta,param"),h.getBlockElements());u=h.getNonEmptyElements();p=h.children;z=g.validate;q="forced_root_block" in m?m.forced_root_block:g.forced_root_block;s=h.getWhiteSpaceElements();E=/^[ \t\r\n]+/;t=/[ \t\r\n]+$/;k=/[ \t\r\n]+/g;y=/^[ \t\r\n]+$/;function G(){var O=J.firstChild,l,P;while(O){l=O.next;if(O.type==3||(O.type==1&&O.name!=="p"&&!o[O.name]&&!O.attr("data-mce-type"))){if(!P){P=K(q,1);J.insert(P,O);P.append(O)}else{P.append(O)}}else{P=null}O=l}}function K(l,O){var P=new a(l,O),Q;if(l in e){Q=i[l];if(Q){Q.push(P)}else{i[l]=[P]}}return P}function I(P){var Q,l,O;for(Q=P.prev;Q&&Q.type===3;){l=Q.value.replace(t,"");if(l.length>0){Q.value=l;Q=Q.prev}else{O=Q.prev;Q.remove();Q=O}}}function H(O){var P,l={};for(P in O){if(P!=="li"&&P!="p"){l[P]=O[P]}}return l}n=new b.html.SaxParser({validate:z,self_closing_elements:H(h.getSelfClosingElements()),cdata:function(l){B.append(K("#cdata",4)).value=l},text:function(P,l){var O;if(!L){P=P.replace(k," ");if(B.lastChild&&o[B.lastChild.name]){P=P.replace(E,"")}}if(P.length!==0){O=K("#text",3);O.raw=!!l;B.append(O).value=P}},comment:function(l){B.append(K("#comment",8)).value=l},pi:function(l,O){B.append(K(l,7)).value=O;I(B)},doctype:function(O){var l;l=B.append(K("#doctype",10));l.value=O;I(B)},start:function(l,W,P){var U,R,Q,O,S,X,V,T;Q=z?h.getElementRule(l):{};if(Q){U=K(Q.outputName||l,1);U.attributes=W;U.shortEnded=P;B.append(U);T=p[B.name];if(T&&p[U.name]&&!T[U.name]){M.push(U)}R=d.length;while(R--){S=d[R].name;if(S in W.map){F=c[S];if(F){F.push(U)}else{c[S]=[U]}}}if(o[l]){I(U)}if(!P){B=U}if(!L&&s[l]){L=true}}},end:function(l){var S,P,R,O,Q;P=z?h.getElementRule(l):{};if(P){if(o[l]){if(!L){S=B.firstChild;if(S&&S.type===3){R=S.value.replace(E,"");if(R.length>0){S.value=R;S=S.next}else{O=S.next;S.remove();S=O}while(S&&S.type===3){R=S.value;O=S.next;if(R.length===0||y.test(R)){S.remove();S=O}S=O}}S=B.lastChild;if(S&&S.type===3){R=S.value.replace(t,"");if(R.length>0){S.value=R;S=S.prev}else{O=S.prev;S.remove();S=O}while(S&&S.type===3){R=S.value;O=S.prev;if(R.length===0||y.test(R)){S.remove();S=O}S=O}}}S=B.prev;if(S&&S.type===3){R=S.value.replace(E,"");if(R.length>0){S.value=R}else{S.remove()}}}if(L&&s[l]){L=false}if(P.removeEmpty||P.paddEmpty){if(B.isEmpty(u)){if(P.paddEmpty){B.empty().append(new a("#text","3")).value="\u00a0"}else{if(!B.attributes.map.name&&!B.attributes.map.id){Q=B.parent;B.empty().remove();B=Q;return}}}}B=B.parent}}},h);J=B=new a(m.context||g.root_name,11);n.parse(v);if(z&&M.length){if(!m.context){j(M)}else{m.invalid=true}}if(q&&J.name=="body"){G()}if(!m.invalid){for(N in i){F=e[N];A=i[N];x=A.length;while(x--){if(!A[x].parent){A.splice(x,1)}}for(D=0,C=F.length;D<C;D++){F[D](A,N,m)}}for(D=0,C=d.length;D<C;D++){F=d[D];if(F.name in c){A=c[F.name];x=A.length;while(x--){if(!A[x].parent){A.splice(x,1)}}for(x=0,r=F.callbacks.length;x<r;x++){F.callbacks[x](A,F.name,m)}}}}return J};if(g.remove_trailing_brs){f.addNodeFilter("br",function(n,m){var r,q=n.length,o,v=b.extend({},h.getBlockElements()),k=h.getNonEmptyElements(),t,s,p,u;v.body=1;for(r=0;r<q;r++){o=n[r];t=o.parent;if(v[o.parent.name]&&o===t.lastChild){p=o.prev;while(p){u=p.name;if(u!=="span"||p.attr("data-mce-type")!=="bookmark"){if(u!=="br"){break}if(u==="br"){o=null;break}}p=p.prev}if(o){o.remove();if(t.isEmpty(k)){elementRule=h.getElementRule(t.name);if(elementRule){if(elementRule.removeEmpty){t.remove()}else{if(elementRule.paddEmpty){t.empty().append(new b.html.Node("#text",3)).value="\u00a0"}}}}}}else{s=o;while(t.firstChild===s&&t.lastChild===s){s=t;if(v[t.name]){break}t=t.parent}if(s===t){textNode=new b.html.Node("#text",3);textNode.value="\u00a0";o.replace(textNode)}}}})}if(!g.allow_html_in_named_anchor){f.addAttributeFilter("id,name",function(k,l){var n=k.length,p,m,o,q;while(n--){q=k[n];if(q.name==="a"&&q.firstChild&&!q.attr("href")){o=q.parent;p=q.lastChild;do{m=p.prev;o.insert(p,q);p=m}while(p)}}})}}})(tinymce);tinymce.html.Writer=function(e){var c=[],a,b,d,f,g;e=e||{};a=e.indent;b=tinymce.makeMap(e.indent_before||"");d=tinymce.makeMap(e.indent_after||"");f=tinymce.html.Entities.getEncodeFunc(e.entity_encoding||"raw",e.entities);g=e.element_format=="html";return{start:function(m,k,p){var n,j,h,o;if(a&&b[m]&&c.length>0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n<j;n++){h=k[n];c.push(" ",h.name,'="',f(h.value,true),'"')}}if(!p||g){c[c.length]=">"}else{c[c.length]=" />"}if(p&&a&&d[m]&&c.length>0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("</",h,">");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("<![CDATA[",h,"]]>")},comment:function(h){c.push("<!--",h,"-->")},pi:function(h,i){if(i){c.push("<?",h," ",i,"?>")}else{c.push("<?",h,"?>")}if(a){c.push("\n")}},doctype:function(h){c.push("<!DOCTYPE",h,">",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n<m;n++){r=q.attributesOrder[n];if(r in s.map){p=s.map[r];u.map[r]=p;u.push({name:r,value:p})}}for(n=0,m=s.length;n<m;n++){r=s[n].name;if(!(r in u.map)){p=s.map[r];u.map[r]=p;u.push({name:r,value:p})}}s=u}e.start(k.name,s,o);if(!o){if((k=k.firstChild)){do{f(k)}while(k=k.next)}e.end(j)}}else{t(k)}}if(h.type==1&&!c.inner){f(h)}else{g[11](h)}return e.getContent()}}})(tinymce);tinymce.dom={};(function(b,h){var g=!!document.addEventListener;function c(k,j,l,i){if(k.addEventListener){k.addEventListener(j,l,i||false)}else{if(k.attachEvent){k.attachEvent("on"+j,l)}}}function e(k,j,l,i){if(k.removeEventListener){k.removeEventListener(j,l,i||false)}else{if(k.detachEvent){k.detachEvent("on"+j,l)}}}function a(n,l){var i,k=l||{};function j(){return false}function m(){return true}for(i in n){if(i!=="layerX"&&i!=="layerY"){k[i]=n[i]}}if(!k.target){k.target=k.srcElement||document}k.preventDefault=function(){k.isDefaultPrevented=m;if(n){if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}}};k.stopPropagation=function(){k.isPropagationStopped=m;if(n){if(n.stopPropagation){n.stopPropagation()}else{n.cancelBubble=true}}};k.stopImmediatePropagation=function(){k.isImmediatePropagationStopped=m;k.stopPropagation()};if(!k.isDefaultPrevented){k.isDefaultPrevented=j;k.isPropagationStopped=j;k.isImmediatePropagationStopped=j}return k}function d(m,n,l){var k=m.document,j={type:"ready"};function i(){if(!l.domLoaded){l.domLoaded=true;n(j)}}if(g){c(m,"DOMContentLoaded",i)}else{c(k,"readystatechange",function(){if(k.readyState==="complete"){e(k,"readystatechange",arguments.callee);i()}});if(k.documentElement.doScroll&&m===m.top){(function(){try{k.documentElement.doScroll("left")}catch(o){setTimeout(arguments.callee,0);return}i()})()}}c(m,"load",i)}function f(k){var q=this,p={},i,o,n,m,l;m="onmouseenter" in document.documentElement;n="onfocusin" in document.documentElement;l={mouseenter:"mouseover",mouseleave:"mouseout"};i=1;q.domLoaded=false;q.events=p;function j(t,x){var s,u,r,v;s=p[x][t.type];if(s){for(u=0,r=s.length;u<r;u++){v=s[u];if(v&&v.func.call(v.scope,t)===false){t.preventDefault()}if(t.isImmediatePropagationStopped()){return}}}}q.bind=function(x,A,D,E){var s,t,u,r,B,z,C,v=window;function y(F){j(a(F||v.event),s)}if(!x||x.nodeType===3||x.nodeType===8){return}if(!x[h]){s=i++;x[h]=s;p[s]={}}else{s=x[h];if(!p[s]){p[s]={}}}E=E||x;A=A.split(" ");u=A.length;while(u--){r=A[u];z=y;B=C=false;if(r==="DOMContentLoaded"){r="ready"}if((q.domLoaded||x.readyState=="complete")&&r==="ready"){q.domLoaded=true;D.call(E,a({type:r}));continue}if(!m){B=l[r];if(B){z=function(F){var H,G;H=F.currentTarget;G=F.relatedTarget;if(G&&H.contains){G=H.contains(G)}else{while(G&&G!==H){G=G.parentNode}}if(!G){F=a(F||v.event);F.type=F.type==="mouseout"?"mouseleave":"mouseenter";F.target=H;j(F,s)}}}}if(!n&&(r==="focusin"||r==="focusout")){C=true;B=r==="focusin"?"focus":"blur";z=function(F){F=a(F||v.event);F.type=F.type==="focus"?"focusin":"focusout";j(F,s)}}t=p[s][r];if(!t){p[s][r]=t=[{func:D,scope:E}];t.fakeName=B;t.capture=C;t.nativeHandler=z;if(!g){t.proxyHandler=k(s)}if(r==="ready"){d(x,z,q)}else{c(x,B||r,g?z:t.proxyHandler,C)}}else{t.push({func:D,scope:E})}}x=t=0;return D};q.unbind=function(x,z,A){var s,u,v,B,r,t;if(!x||x.nodeType===3||x.nodeType===8){return q}s=x[h];if(s){t=p[s];if(z){z=z.split(" ");v=z.length;while(v--){r=z[v];u=t[r];if(u){if(A){B=u.length;while(B--){if(u[B].func===A){u.splice(B,1)}}}if(!A||u.length===0){delete t[r];e(x,u.fakeName||r,g?u.nativeHandler:u.proxyHandler,u.capture)}}}}else{for(r in t){u=t[r];e(x,u.fakeName||r,g?u.nativeHandler:u.proxyHandler,u.capture)}t={}}for(r in t){return q}delete p[s];try{delete x[h]}catch(y){x[h]=null}}return q};q.fire=function(u,s,r){var v,t;if(!u||u.nodeType===3||u.nodeType===8){return q}t=a(null,r);t.type=s;do{v=u[h];if(v){j(t,v)}u=u.parentNode||u.ownerDocument||u.defaultView||u.parentWindow}while(u&&!t.isPropagationStopped());return q};q.clean=function(u){var s,r,t=q.unbind;if(!u||u.nodeType===3||u.nodeType===8){return q}if(u[h]){t(u)}if(!u.getElementsByTagName){u=u.document}if(u&&u.getElementsByTagName){t(u);r=u.getElementsByTagName("*");s=r.length;while(s--){u=r[s];if(u[h]){t(u)}}}return q};q.callNativeHandler=function(s,r){if(p){p[s][r.type].nativeHandler(r)}};q.destory=function(){p={}};q.add=function(v,s,u,t){if(typeof(v)==="string"){v=document.getElementById(v)}if(v&&v instanceof Array){var r=v.length;while(r--){q.add(v[r],s,u,t)}return}if(s==="init"){s="ready"}return q.bind(v,s instanceof Array?s.join(" "):s,u,t)};q.remove=function(v,s,u,t){if(!v){return q}if(typeof(v)==="string"){v=document.getElementById(v)}if(v instanceof Array){var r=v.length;while(r--){q.remove(v[r],s,u,t)}return q}return q.unbind(v,s instanceof Array?s.join(" "):s,u)};q.clear=function(r){if(typeof(r)==="string"){r=document.getElementById(r)}return q.clean(r)};q.cancel=function(r){if(r){q.prevent(r);q.stop(r)}return false};q.prevent=function(r){if(!r.preventDefault){r=a(r)}r.preventDefault();return false};q.stop=function(r){if(!r.stopPropagation){r=a(r)}r.stopPropagation();return false}}b.EventUtils=f;b.Event=new f(function(i){return function(j){tinymce.dom.Event.callNativeHandler(i,j)}});b.Event.bind(window,"ready",function(){});b=0})(tinymce.dom,"data-mce-expando");tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(e){var g=e.each,d=e.is,f=e.isWebKit,b=e.isIE,h=e.html.Entities,c=/^([a-z0-9],?)+$/i,a=/^[ \t\r\n]*$/;e.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(o,l){var k=this,i,j,n;k.doc=o;k.win=window;k.files={};k.cssFlicker=false;k.counter=0;k.stdMode=!e.isIE||o.documentMode>=8;k.boxModel=!e.isIE||o.compatMode=="CSS1Compat"||k.stdMode;k.hasOuterHTML="outerHTML" in o.createElement("a");k.settings=l=e.extend({keep_values:false,hex_colors:1},l);k.schema=l.schema;k.styles=new e.html.Styles({url_converter:l.url_converter,url_converter_scope:l.url_converter_scope},l.schema);if(e.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(m){k.cssFlicker=true}}k.fixDoc(o);k.events=l.ownEvents?new e.dom.EventUtils(l.proxy):e.dom.Event;e.addUnload(k.destroy,k);n=l.schema?l.schema.getBlockElements():{};k.isBlock=function(q){var p=q.nodeType;if(p){return !!(p===1&&n[q.nodeName])}return !!n[q]}},fixDoc:function(k){var j=this.settings,i;if(b&&j.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(l){k.createElement(l)});for(i in j.schema.getCustomElements()){k.createElement(i)}}},clone:function(k,i){var j=this,m,l;if(!b||k.nodeType!==1||i){return k.cloneNode(i)}l=j.doc;if(!i){m=l.createElement(k.nodeName);g(j.getAttribs(k),function(n){j.setAttrib(m,n.nodeName,j.getAttrib(k,n.nodeName))});return m}return m.firstChild},getRoot:function(){var i=this,j=i.settings;return(j&&i.get(j.root_element))||i.doc.body},getViewPort:function(j){var k,i;j=!j?this.win:j;k=j.document;i=this.boxModel?k.documentElement:k.body;return{x:j.pageXOffset||i.scrollLeft,y:j.pageYOffset||i.scrollTop,w:j.innerWidth||i.clientWidth,h:j.innerHeight||i.clientHeight}},getRect:function(l){var k,i=this,j;l=i.get(l);k=i.getPos(l);j=i.getSize(l);return{x:k.x,y:k.y,w:j.w,h:j.h}},getSize:function(l){var j=this,i,k;l=j.get(l);i=j.getStyle(l,"width");k=j.getStyle(l,"height");if(i.indexOf("px")===-1){i=0}if(k.indexOf("px")===-1){k=0}return{w:parseInt(i,10)||l.offsetWidth||l.clientWidth,h:parseInt(k,10)||l.offsetHeight||l.clientHeight}},getParent:function(k,j,i){return this.getParents(k,j,i,false)},getParents:function(s,m,k,q){var j=this,i,l=j.settings,p=[];s=j.get(s);q=q===undefined;if(l.strict_root){k=k||j.getRoot()}if(d(m,"string")){i=m;if(m==="*"){m=function(o){return o.nodeType==1}}else{m=function(o){return j.is(o,i)}}}while(s){if(s==k||!s.nodeType||s.nodeType===9){break}if(!m||m(s)){if(q){p.push(s)}else{return s}}s=s.parentNode}return q?p:null},get:function(i){var j;if(i&&this.doc&&typeof(i)=="string"){j=i;i=this.doc.getElementById(i);if(i&&i.id!==j){return this.doc.getElementsByName(j)[1]}}return i},getNext:function(j,i){return this._findSib(j,i,"nextSibling")},getPrev:function(j,i){return this._findSib(j,i,"previousSibling")},select:function(k,j){var i=this;return e.dom.Sizzle(k,i.get(j)||i.get(i.settings.root_element)||i.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(c.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return e.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(l,o,i,k,m){var j=this;return this.run(l,function(r){var q,n;q=d(o,"string")?j.doc.createElement(o):o;j.setAttribs(q,i);if(k){if(k.nodeType){q.appendChild(k)}else{j.setHTML(q,k)}}return !m?r.appendChild(q):q})},create:function(k,i,j){return this.add(this.doc.createElement(k),k,i,j,1)},createHTML:function(q,i,m){var p="",l=this,j;p+="<"+q;for(j in i){if(i.hasOwnProperty(j)){p+=" "+j+'="'+l.encode(i[j])+'"'}}if(typeof(m)!="undefined"){return p+">"+m+"</"+q+">"}return p+" />"},remove:function(i,j){return this.run(i,function(l){var m,k=l.parentNode;if(!k){return null}if(j){while(m=l.firstChild){if(!e.isIE||m.nodeType!==3||m.nodeValue){k.insertBefore(m,l)}else{l.removeChild(m)}}}return k.removeChild(l)})},setStyle:function(l,i,j){var k=this;return k.run(l,function(o){var n,m;n=o.style;i=i.replace(/-(\D)/g,function(q,p){return p.toUpperCase()});if(k.pixelStyles.test(i)&&(e.is(j,"number")||/^[\-0-9\.]+$/.test(j))){j+="px"}switch(i){case"opacity":if(b){n.filter=j===""?"":"alpha(opacity="+(j*100)+")";if(!l.currentStyle||!l.currentStyle.hasLayout){n.display="inline-block"}}n[i]=n["-moz-opacity"]=n["-khtml-opacity"]=j||"";break;case"float":b?n.styleFloat=j:n.cssFloat=j;break;default:n[i]=j||""}if(k.settings.update_styles){k.setAttrib(o,"data-mce-style")}})},getStyle:function(l,i,k){l=this.get(l);if(!l){return}if(this.doc.defaultView&&k){i=i.replace(/[A-Z]/g,function(m){return"-"+m});try{return this.doc.defaultView.getComputedStyle(l,null).getPropertyValue(i)}catch(j){return null}}i=i.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(i=="float"){i=b?"styleFloat":"cssFloat"}if(l.currentStyle&&k){return l.currentStyle[i]}return l.style?l.style[i]:undefined},setStyles:function(l,m){var j=this,k=j.settings,i;i=k.update_styles;k.update_styles=0;g(m,function(o,p){j.setStyle(l,p,o)});k.update_styles=i;if(k.update_styles){j.setAttrib(l,k.cssText)}},removeAllAttribs:function(i){return this.run(i,function(l){var k,j=l.attributes;for(k=j.length-1;k>=0;k--){l.removeAttributeNode(j.item(k))}})},setAttrib:function(k,l,i){var j=this;if(!k||!l){return}if(j.settings.strict){l=l.toLowerCase()}return this.run(k,function(p){var o=j.settings;var m=p.getAttribute(l);if(i!==null){switch(l){case"style":if(!d(i,"string")){g(i,function(q,r){j.setStyle(p,r,q)});return}if(o.keep_values){if(i&&!j._isRes(i)){p.setAttribute("data-mce-style",i,2)}else{p.removeAttribute("data-mce-style",2)}}p.style.cssText=i;break;case"class":p.className=i||"";break;case"src":case"href":if(o.keep_values){if(o.url_converter){i=o.url_converter.call(o.url_converter_scope||j,i,l,p)}j.setAttrib(p,"data-mce-"+l,i,2)}break;case"shape":p.setAttribute("data-mce-style",i);break}}if(d(i)&&i!==null&&i.length!==0){p.setAttribute(l,""+i,2)}else{p.removeAttribute(l,2)}if(tinyMCE.activeEditor&&m!=i){var n=tinyMCE.activeEditor;n.onSetAttrib.dispatch(n,p,l,i)}})},setAttribs:function(j,k){var i=this;return this.run(j,function(l){g(k,function(m,o){i.setAttrib(l,o,m)})})},getAttrib:function(m,o,k){var i,j=this,l;m=j.get(m);if(!m||m.nodeType!==1){return k===l?false:k}if(!d(k)){k=""}if(/^(src|href|style|coords|shape)$/.test(o)){i=m.getAttribute("data-mce-"+o);if(i){return i}}if(b&&j.props[o]){i=m[j.props[o]];i=i&&i.nodeValue?i.nodeValue:i}if(!i){i=m.getAttribute(o,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(o)){if(m[j.props[o]]===true&&i===""){return o}return i?o:""}if(m.nodeName==="FORM"&&m.getAttributeNode(o)){return m.getAttributeNode(o).nodeValue}if(o==="style"){i=i||m.style.cssText;if(i){i=j.serializeStyle(j.parseStyle(i),m.nodeName);if(j.settings.keep_values&&!j._isRes(i)){m.setAttribute("data-mce-style",i)}}}if(f&&o==="class"&&i){i=i.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(o){case"rowspan":case"colspan":if(i===1){i=""}break;case"size":if(i==="+0"||i===20||i===0){i=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(i===0){i=""}break;case"hspace":if(i===-1){i=""}break;case"maxlength":case"tabindex":if(i===32768||i===2147483647||i==="32768"){i=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(i===65535){return o}return k;case"shape":i=i.toLowerCase();break;default:if(o.indexOf("on")===0&&i){i=e._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+i)}}}return(i!==l&&i!==null&&i!=="")?""+i:k},getPos:function(q,l){var j=this,i=0,p=0,m,o=j.doc,k;q=j.get(q);l=l||o.body;if(q){if(q.getBoundingClientRect){q=q.getBoundingClientRect();m=j.boxModel?o.documentElement:o.body;i=q.left+(o.documentElement.scrollLeft||o.body.scrollLeft)-m.clientTop;p=q.top+(o.documentElement.scrollTop||o.body.scrollTop)-m.clientLeft;return{x:i,y:p}}k=q;while(k&&k!=l&&k.nodeType){i+=k.offsetLeft||0;p+=k.offsetTop||0;k=k.offsetParent}k=q.parentNode;while(k&&k!=l&&k.nodeType){i-=k.scrollLeft||0;p-=k.scrollTop||0;k=k.parentNode}}return{x:i,y:p}},parseStyle:function(i){return this.styles.parse(i)},serializeStyle:function(j,i){return this.styles.serialize(j,i)},addStyle:function(j){var k=this.doc,i;styleElm=k.getElementById("mceDefaultStyles");if(!styleElm){styleElm=k.createElement("style"),styleElm.id="mceDefaultStyles";styleElm.type="text/css";i=k.getElementsByTagName("head")[0];if(i.firstChild){i.insertBefore(styleElm,i.firstChild)}else{i.appendChild(styleElm)}}if(styleElm.styleSheet){styleElm.styleSheet.cssText+=j}else{styleElm.appendChild(k.createTextNode(j))}},loadCSS:function(i){var k=this,l=k.doc,j;if(!i){i=""}j=l.getElementsByTagName("head")[0];g(i.split(","),function(m){var n;if(k.files[m]){return}k.files[m]=true;n=k.create("link",{rel:"stylesheet",href:e._addVer(m)});if(b&&l.documentMode&&l.recalc){n.onload=function(){if(l.recalc){l.recalc()}n.onload=null}}j.appendChild(n)})},addClass:function(i,j){return this.run(i,function(k){var l;if(!j){return 0}if(this.hasClass(k,j)){return k.className}l=this.removeClass(k,j);return k.className=(l!=""?(l+" "):"")+j})},removeClass:function(k,l){var i=this,j;return i.run(k,function(n){var m;if(i.hasClass(n,l)){if(!j){j=new RegExp("(^|\\s+)"+l+"(\\s+|$)","g")}m=n.className.replace(j," ");m=e.trim(m!=" "?m:"");n.className=m;if(!m){n.removeAttribute("class");n.removeAttribute("className")}return m}return n.className})},hasClass:function(j,i){j=this.get(j);if(!j||!i){return false}return(" "+j.className+" ").indexOf(" "+i+" ")!==-1},show:function(i){return this.setStyle(i,"display","block")},hide:function(i){return this.setStyle(i,"display","none")},isHidden:function(i){i=this.get(i);return !i||i.style.display=="none"||this.getStyle(i,"display")=="none"},uniqueId:function(i){return(!i?"mce_":i)+(this.counter++)},setHTML:function(k,j){var i=this;return i.run(k,function(m){if(b){while(m.firstChild){m.removeChild(m.firstChild)}try{m.innerHTML="<br />"+j;m.removeChild(m.firstChild)}catch(l){var n=i.create("div");n.innerHTML="<br />"+j;g(e.grep(n.childNodes),function(p,o){if(o&&m.canHaveHTML){m.appendChild(p)}})}}else{m.innerHTML=j}return j})},getOuterHTML:function(k){var j,i=this;k=i.get(k);if(!k){return null}if(k.nodeType===1&&i.hasOuterHTML){return k.outerHTML}j=(k.ownerDocument||i.doc).createElement("body");j.appendChild(k.cloneNode(true));return j.innerHTML},setOuterHTML:function(l,j,m){var i=this;function k(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){i.insertAfter(s.cloneNode(true),p);s=s.previousSibling}i.remove(p)}return this.run(l,function(o){o=i.get(o);if(o.nodeType==1){m=m||o.ownerDocument||i.doc;if(b){try{if(b&&o.nodeType==1){o.outerHTML=j}else{k(o,j,m)}}catch(n){k(o,j,m)}}else{k(o,j,m)}}})},decode:h.decode,encode:h.encodeAllRaw,insertAfter:function(i,j){j=this.get(j);return this.run(i,function(l){var k,m;k=j.parentNode;m=j.nextSibling;if(m){k.insertBefore(l,m)}else{k.appendChild(l)}return l})},replace:function(m,l,i){var j=this;if(d(l,"array")){m=m.cloneNode(true)}return j.run(l,function(k){if(i){g(e.grep(k.childNodes),function(n){m.appendChild(n)})}return k.parentNode.replaceChild(m,k)})},rename:function(l,i){var k=this,j;if(l.nodeName!=i.toUpperCase()){j=k.create(i);g(k.getAttribs(l),function(m){k.setAttrib(j,m.nodeName,k.getAttrib(l,m.nodeName))});k.replace(j,l,1)}return j||l},findCommonAncestor:function(k,i){var l=k,j;while(l){j=i;while(j&&l!=j){j=j.parentNode}if(l==j){break}l=l.parentNode}if(!l&&k.ownerDocument){return k.ownerDocument.documentElement}return l},toHex:function(i){var k=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(i);function j(l){l=parseInt(l,10).toString(16);return l.length>1?l:"0"+l}if(k){i="#"+j(k[1])+j(k[2])+j(k[3]);return i}return i},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(i){g(i.imports,function(s){q(s)});g(i.cssRules||i.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){g(s.selectorText.split(","),function(r){r=r.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(r)||!/\.[\w\-]+$/.test(r)){return}l=r;r=e._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",r);if(p&&!(r=p(r,l))){return}if(!o[r]){j.push({"class":r});o[r]=1}})}break;case 3:q(s.styleSheet);break}})}try{g(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(l,k,j){var i=this,m;if(i.doc&&typeof(l)==="string"){l=i.get(l)}if(!l){return false}j=j||this;if(!l.nodeType&&(l.length||l.length===0)){m=[];g(l,function(o,n){if(o){if(typeof(o)=="string"){o=i.doc.getElementById(o)}m.push(k.call(j,o,n))}});return m}return k.call(j,l)},getAttribs:function(j){var i;j=this.get(j);if(!j){return[]}if(b){i=[];if(j.nodeName=="OBJECT"){return j.attributes}if(j.nodeName==="OPTION"&&this.getAttrib(j,"selected")){i.push({specified:1,nodeName:"selected"})}j.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(k){i.push({specified:1,nodeName:k})});return i}return j.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p=0;m=m.firstChild;if(m){j=new e.dom.TreeWalker(m,m.parentNode);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){if(l==="br"){p++;continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if(q==8){return false}if((q===3&&!a.test(m.nodeValue))){return false}}while(m=j.next())}return p<=1},destroy:function(j){var i=this;i.win=i.doc=i.root=i.events=i.frag=null;if(!j){e.removeUnload(i.destroy)}},createRng:function(){var i=this.doc;return i.createRange?i.createRange():new e.dom.Range(this)},nodeIndex:function(m,n){var i=0,k,l,j;if(m){for(k=m.nodeType,m=m.previousSibling,l=m;m;m=m.previousSibling){j=m.nodeType;if(n&&j==3){if(j==k||!m.nodeValue.length){continue}}i++;k=j}}return i},split:function(m,l,p){var q=this,i=q.createRng(),n,k,o;function j(v){var t,s=v.childNodes,u=v.nodeType;function x(A){var z=A.previousSibling&&A.previousSibling.nodeName=="SPAN";var y=A.nextSibling&&A.nextSibling.nodeName=="SPAN";return z&&y}if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=s.length-1;t>=0;t--){j(s[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){var r=e.trim(v.nodeValue).length;if(!q.isBlock(v.parentNode)||r>0||r===0&&x(v)){return}}else{if(u==1){s=v.childNodes;if(s.length==1&&s[0]&&s[0].nodeType==1&&s[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(s[0],v)}if(s.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}q.remove(v)}return v}if(m&&l){i.setStart(m.parentNode,q.nodeIndex(m));i.setEnd(l.parentNode,q.nodeIndex(l));n=i.extractContents();i=q.createRng();i.setStart(l.parentNode,q.nodeIndex(l)+1);i.setEnd(m.parentNode,q.nodeIndex(m)+1);k=i.extractContents();o=m.parentNode;o.insertBefore(j(n),m);if(p){o.replaceChild(p,l)}else{o.insertBefore(l,m)}o.insertBefore(j(k),m);q.remove(m);return p||l}},bind:function(l,i,k,j){return this.events.add(l,i,k,j||this)},unbind:function(k,i,j){return this.events.remove(k,i,j)},fire:function(k,j,i){return this.events.fire(k,j,i)},getContentEditable:function(j){var i;if(j.nodeType!=1){return null}i=j.getAttribute("data-mce-contenteditable");if(i&&i!=="inherit"){return i}return j.contentEditable!=="inherit"?j.contentEditable:null},_findSib:function(l,i,j){var k=this,m=i;if(l){if(d(m,"string")){m=function(n){return k.is(n,i)}}for(l=l[j];l;l=l[j]){if(m(l)){return l}}}return null},_isRes:function(i){return/^(top|left|bottom|right|width|height)/i.test(i)||/;\s*(top|left|bottom|right|width|height)/i.test(i)}});e.DOM=new e.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var O=this,e=c.doc,U=0,F=1,j=2,E=true,S=false,W="startOffset",h="startContainer",Q="endContainer",A="endOffset",k=tinymce.extend,n=c.nodeIndex;k(O,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:E,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:J,setEndBefore:K,setEndAfter:u,collapse:B,selectNode:y,selectNodeContents:G,compareBoundaryPoints:v,deleteContents:p,extractContents:I,cloneContents:d,insertNode:D,surroundContents:N,cloneRange:L,toStringIE:T});function x(){return e.createDocumentFragment()}function q(X,t){C(E,X,t)}function s(X,t){C(S,X,t)}function g(t){q(t.parentNode,n(t))}function J(t){q(t.parentNode,n(t)+1)}function K(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function B(t){if(t){O[Q]=O[h];O[A]=O[W]}else{O[h]=O[Q];O[W]=O[A]}O.collapsed=E}function y(t){g(t);u(t)}function G(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(aa,t){var ad=O[h],Y=O[W],ac=O[Q],X=O[A],ab=t.startContainer,af=t.startOffset,Z=t.endContainer,ae=t.endOffset;if(aa===0){return H(ad,Y,ab,af)}if(aa===1){return H(ac,X,ab,af)}if(aa===2){return H(ac,X,Z,ae)}if(aa===3){return H(ad,Y,Z,ae)}}function p(){l(j)}function I(){return l(U)}function d(){return l(F)}function D(aa){var X=this[h],t=this[W],Z,Y;if((X.nodeType===3||X.nodeType===4)&&X.nodeValue){if(!t){X.parentNode.insertBefore(aa,X)}else{if(t>=X.nodeValue.length){c.insertAfter(aa,X)}else{Z=X.splitText(t);X.parentNode.insertBefore(aa,Z)}}}else{if(X.childNodes.length>0){Y=X.childNodes[t]}if(Y){X.insertBefore(aa,Y)}else{X.appendChild(aa)}}}function N(X){var t=O.extractContents();O.insertNode(X);X.appendChild(t);O.selectNode(X)}function L(){return k(new b(c),{startContainer:O[h],startOffset:O[W],endContainer:O[Q],endOffset:O[A],collapsed:O.collapsed,commonAncestorContainer:O.commonAncestorContainer})}function P(t,X){var Y;if(t.nodeType==3){return t}if(X<0){return t}Y=t.firstChild;while(Y&&X>0){--X;Y=Y.nextSibling}if(Y){return Y}return t}function m(){return(O[h]==O[Q]&&O[W]==O[A])}function H(Z,ab,X,aa){var ac,Y,t,ad,af,ae;if(Z==X){if(ab==aa){return 0}if(ab<aa){return -1}return 1}ac=X;while(ac&&ac.parentNode!=Z){ac=ac.parentNode}if(ac){Y=0;t=Z.firstChild;while(t!=ac&&Y<ab){Y++;t=t.nextSibling}if(ab<=Y){return -1}return 1}ac=Z;while(ac&&ac.parentNode!=X){ac=ac.parentNode}if(ac){Y=0;t=X.firstChild;while(t!=ac&&Y<aa){Y++;t=t.nextSibling}if(Y<aa){return -1}return 1}ad=c.findCommonAncestor(Z,X);af=Z;while(af&&af.parentNode!=ad){af=af.parentNode}if(!af){af=ad}ae=X;while(ae&&ae.parentNode!=ad){ae=ae.parentNode}if(!ae){ae=ad}if(af==ae){return 0}t=ad.firstChild;while(t){if(t==af){return -1}if(t==ae){return 1}t=t.nextSibling}}function C(X,aa,Z){var t,Y;if(X){O[h]=aa;O[W]=Z}else{O[Q]=aa;O[A]=Z}t=O[Q];while(t.parentNode){t=t.parentNode}Y=O[h];while(Y.parentNode){Y=Y.parentNode}if(Y==t){if(H(O[h],O[W],O[Q],O[A])>0){O.collapse(X)}}else{O.collapse(X)}O.collapsed=m();O.commonAncestorContainer=c.findCommonAncestor(O[h],O[Q])}function l(ad){var ac,Z=0,af=0,X,ab,Y,aa,t,ae;if(O[h]==O[Q]){return f(ad)}for(ac=O[Q],X=ac.parentNode;X;ac=X,X=X.parentNode){if(X==O[h]){return r(ac,ad)}++Z}for(ac=O[h],X=ac.parentNode;X;ac=X,X=X.parentNode){if(X==O[Q]){return V(ac,ad)}++af}ab=af-Z;Y=O[h];while(ab>0){Y=Y.parentNode;ab--}aa=O[Q];while(ab<0){aa=aa.parentNode;ab++}for(t=Y.parentNode,ae=aa.parentNode;t!=ae;t=t.parentNode,ae=ae.parentNode){Y=t;aa=ae}return o(Y,aa,ad)}function f(ac){var ae,af,t,Y,Z,ad,aa,X,ab;if(ac!=j){ae=x()}if(O[W]==O[A]){return ae}if(O[h].nodeType==3){af=O[h].nodeValue;t=af.substring(O[W],O[A]);if(ac!=F){Y=O[h];X=O[W];ab=O[A]-O[W];if(X===0&&ab>=Y.nodeValue.length-1){Y.parentNode.removeChild(Y)}else{Y.deleteData(X,ab)}O.collapse(E)}if(ac==j){return}if(t.length>0){ae.appendChild(e.createTextNode(t))}return ae}Y=P(O[h],O[W]);Z=O[A]-O[W];while(Y&&Z>0){ad=Y.nextSibling;aa=z(Y,ac);if(ae){ae.appendChild(aa)}--Z;Y=ad}if(ac!=F){O.collapse(E)}return ae}function r(ad,aa){var ac,ab,X,t,Z,Y;if(aa!=j){ac=x()}ab=i(ad,aa);if(ac){ac.appendChild(ab)}X=n(ad);t=X-O[W];if(t<=0){if(aa!=F){O.setEndBefore(ad);O.collapse(S)}return ac}ab=ad.previousSibling;while(t>0){Z=ab.previousSibling;Y=z(ab,aa);if(ac){ac.insertBefore(Y,ac.firstChild)}--t;ab=Z}if(aa!=F){O.setEndBefore(ad);O.collapse(S)}return ac}function V(ab,aa){var ad,X,ac,t,Z,Y;if(aa!=j){ad=x()}ac=R(ab,aa);if(ad){ad.appendChild(ac)}X=n(ab);++X;t=O[A]-X;ac=ab.nextSibling;while(ac&&t>0){Z=ac.nextSibling;Y=z(ac,aa);if(ad){ad.appendChild(Y)}--t;ac=Z}if(aa!=F){O.setStartAfter(ab);O.collapse(E)}return ad}function o(ab,t,ae){var Y,ag,aa,ac,ad,X,af,Z;if(ae!=j){ag=x()}Y=R(ab,ae);if(ag){ag.appendChild(Y)}aa=ab.parentNode;ac=n(ab);ad=n(t);++ac;X=ad-ac;af=ab.nextSibling;while(X>0){Z=af.nextSibling;Y=z(af,ae);if(ag){ag.appendChild(Y)}af=Z;--X}Y=i(t,ae);if(ag){ag.appendChild(Y)}if(ae!=F){O.setStartAfter(ab);O.collapse(E)}return ag}function i(ac,ad){var Y=P(O[Q],O[A]-1),ae,ab,aa,t,X,Z=Y!=O[Q];if(Y==ac){return M(Y,Z,S,ad)}ae=Y.parentNode;ab=M(ae,S,S,ad);while(ae){while(Y){aa=Y.previousSibling;t=M(Y,Z,S,ad);if(ad!=j){ab.insertBefore(t,ab.firstChild)}Z=E;Y=aa}if(ae==ac){return ab}Y=ae.previousSibling;ae=ae.parentNode;X=M(ae,S,S,ad);if(ad!=j){X.appendChild(ab)}ab=X}}function R(ac,ad){var Z=P(O[h],O[W]),aa=Z!=O[h],ae,ab,Y,t,X;if(Z==ac){return M(Z,aa,E,ad)}ae=Z.parentNode;ab=M(ae,S,E,ad);while(ae){while(Z){Y=Z.nextSibling;t=M(Z,aa,E,ad);if(ad!=j){ab.appendChild(t)}aa=E;Z=Y}if(ae==ac){return ab}Z=ae.nextSibling;ae=ae.parentNode;X=M(ae,S,E,ad);if(ad!=j){X.appendChild(ab)}ab=X}}function M(t,aa,ad,ae){var Z,Y,ab,X,ac;if(aa){return z(t,ae)}if(t.nodeType==3){Z=t.nodeValue;if(ad){X=O[W];Y=Z.substring(X);ab=Z.substring(0,X)}else{X=O[A];Y=Z.substring(0,X);ab=Z.substring(X)}if(ae!=F){t.nodeValue=ab}if(ae==j){return}ac=c.clone(t,S);ac.nodeValue=Y;return ac}if(ae==j){return}return c.clone(t,S)}function z(X,t){if(t!=j){return t==F?c.clone(X,E):X}X.parentNode.removeChild(X)}function T(){return c.create("body",null,d()).outerText}return O}a.Range=b;b.prototype.toString=function(){return this.toStringIE()}})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}o=0;while(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)!==0){if(k.move("character",1)===0||s!=k.parentElement()){break}o++}}else{k.collapse(true);o=0;while(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)!==0){if(k.move("character",-1)===0||s!=k.parentElement()){break}o++}}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p&&t.nodeType!==9){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,v,q,t,s=d.dom.doc,m=s.body,r,u;function j(C){var y,B,x,A,z;x=h.create("a");y=C?k:v;B=C?p:q;A=n.duplicate();if(y==s||y==s.documentElement){y=m;B=0}if(y.nodeType==3){y.parentNode.insertBefore(x,y);A.moveToElementText(x);A.moveStart("character",B);h.remove(x);n.setEndPoint(C?"StartToStart":"EndToEnd",A)}else{z=y.childNodes;if(z.length){if(B>=z.length){h.insertAfter(x,z[z.length-1])}else{y.insertBefore(x,z[B])}A.moveToElementText(x)}else{if(y.canHaveHTML){y.innerHTML="<span>\uFEFF</span>";x=y.firstChild;A.moveToElementText(x);A.collapse(f)}}n.setEndPoint(C?"StartToStart":"EndToEnd",A);h.remove(x)}}k=i.startContainer;p=i.startOffset;v=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==v&&k.nodeType==1){if(p==q&&!k.hasChildNodes()){if(k.canHaveHTML){t=k.previousSibling;if(t&&!t.hasChildNodes()&&h.isBlock(t)){t.innerHTML="\uFEFF"}else{t=null}k.innerHTML="<span>\uFEFF</span><span>\uFEFF</span>";n.moveToElementText(k.lastChild);n.select();h.doc.selection.clear();k.innerHTML="";if(t){t.innerHTML=""}return}else{p=h.nodeIndex(k);k=k.parentNode}}if(p==q-1){try{u=k.childNodes[p];l=m.createControlRange();l.addElement(u);l.select();r=d.getRng();if(r.item&&u===r.item(0)){return}}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(){var n=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,i="sizcache",o=0,r=Object.prototype.toString,h=false,g=true,q=/\\/g,u=/\r\n/g,x=/\W/;[0,0].sort(function(){g=false;return 0});var d=function(C,e,F,G){F=F||[];e=e||document;var I=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!C||typeof C!=="string"){return F}var z,K,N,y,J,M,L,E,B=true,A=d.isXML(e),D=[],H=C;do{n.exec("");z=n.exec(H);if(z){H=z[3];D.push(z[1]);if(z[2]){y=z[3];break}}}while(z);if(D.length>1&&j.exec(C)){if(D.length===2&&k.relative[D[0]]){K=s(D[0]+D[1],e,G)}else{K=k.relative[D[0]]?[e]:d(D.shift(),e);while(D.length){C=D.shift();if(k.relative[C]){C+=D.shift()}K=s(C,K,G)}}}else{if(!G&&D.length>1&&e.nodeType===9&&!A&&k.match.ID.test(D[0])&&!k.match.ID.test(D[D.length-1])){J=d.find(D.shift(),e,A);e=J.expr?d.filter(J.expr,J.set)[0]:J.set[0]}if(e){J=G?{expr:D.pop(),set:l(G)}:d.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&e.parentNode?e.parentNode:e,A);K=J.expr?d.filter(J.expr,J.set):J.set;if(D.length>0){N=l(K)}else{B=false}while(D.length){M=D.pop();L=M;if(!k.relative[M]){M=""}else{L=D.pop()}if(L==null){L=e}k.relative[M](N,L,A)}}else{N=D=[]}}if(!N){N=K}if(!N){d.error(M||C)}if(r.call(N)==="[object Array]"){if(!B){F.push.apply(F,N)}else{if(e&&e.nodeType===1){for(E=0;N[E]!=null;E++){if(N[E]&&(N[E]===true||N[E].nodeType===1&&d.contains(e,N[E]))){F.push(K[E])}}}else{for(E=0;N[E]!=null;E++){if(N[E]&&N[E].nodeType===1){F.push(K[E])}}}}}else{l(N,F)}if(y){d(y,I,F,G);d.uniqueSort(F)}return F};d.uniqueSort=function(y){if(p){h=g;y.sort(p);if(h){for(var e=1;e<y.length;e++){if(y[e]===y[e-1]){y.splice(e--,1)}}}}return y};d.matches=function(e,y){return d(e,null,null,y)};d.matchesSelector=function(e,y){return d(y,null,null,[e]).length>0};d.find=function(E,e,F){var D,z,B,A,C,y;if(!E){return[]}for(z=0,B=k.order.length;z<B;z++){C=k.order[z];if((A=k.leftMatch[C].exec(E))){y=A[1];A.splice(1,1);if(y.substr(y.length-1)!=="\\"){A[1]=(A[1]||"").replace(q,"");D=k.find[C](A,e,F);if(D!=null){E=E.replace(k.match[C],"");break}}}}if(!D){D=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:D,expr:E}};d.filter=function(I,H,L,B){var D,e,G,N,K,y,A,C,J,z=I,M=[],F=H,E=H&&H[0]&&d.isXML(H[0]);while(I&&H.length){for(G in k.filter){if((D=k.leftMatch[G].exec(I))!=null&&D[2]){y=k.filter[G];A=D[1];e=false;D.splice(1,1);if(A.substr(A.length-1)==="\\"){continue}if(F===M){M=[]}if(k.preFilter[G]){D=k.preFilter[G](D,F,L,M,B,E);if(!D){e=N=true}else{if(D===true){continue}}}if(D){for(C=0;(K=F[C])!=null;C++){if(K){N=y(K,D,C,F);J=B^N;if(L&&N!=null){if(J){e=true}else{F[C]=false}}else{if(J){M.push(K);e=true}}}}}if(N!==undefined){if(!L){F=M}I=I.replace(k.match[G],"");if(!e){return[]}break}}}if(I===z){if(e==null){d.error(I)}else{break}}z=I}return F};d.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var b=d.getText=function(B){var z,A,e=B.nodeType,y="";if(e){if(e===1||e===9||e===11){if(typeof B.textContent==="string"){return B.textContent}else{if(typeof B.innerText==="string"){return B.innerText.replace(u,"")}else{for(B=B.firstChild;B;B=B.nextSibling){y+=b(B)}}}}else{if(e===3||e===4){return B.nodeValue}}}else{for(z=0;(A=B[z]);z++){if(A.nodeType!==8){y+=b(A)}}}return y};var k=d.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(D,y){var A=typeof y==="string",C=A&&!x.test(y),E=A&&!C;if(C){y=y.toLowerCase()}for(var z=0,e=D.length,B;z<e;z++){if((B=D[z])){while((B=B.previousSibling)&&B.nodeType!==1){}D[z]=E||B&&B.nodeName.toLowerCase()===y?B||false:B===y}}if(E){d.filter(y,D,true)}},">":function(D,y){var C,B=typeof y==="string",z=0,e=D.length;if(B&&!x.test(y)){y=y.toLowerCase();for(;z<e;z++){C=D[z];if(C){var A=C.parentNode;D[z]=A.nodeName.toLowerCase()===y?A:false}}}else{for(;z<e;z++){C=D[z];if(C){D[z]=B?C.parentNode:C.parentNode===y}}if(B){d.filter(y,D,true)}}},"":function(A,y,C){var B,z=o++,e=t;if(typeof y==="string"&&!x.test(y)){y=y.toLowerCase();B=y;e=a}e("parentNode",y,z,A,B,C)},"~":function(A,y,C){var B,z=o++,e=t;if(typeof y==="string"&&!x.test(y)){y=y.toLowerCase();B=y;e=a}e("previousSibling",y,z,A,B,C)}},find:{ID:function(y,z,A){if(typeof z.getElementById!=="undefined"&&!A){var e=z.getElementById(y[1]);return e&&e.parentNode?[e]:[]}},NAME:function(z,C){if(typeof C.getElementsByName!=="undefined"){var y=[],B=C.getElementsByName(z[1]);for(var A=0,e=B.length;A<e;A++){if(B[A].getAttribute("name")===z[1]){y.push(B[A])}}return y.length===0?null:y}},TAG:function(e,y){if(typeof y.getElementsByTagName!=="undefined"){return y.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(A,y,z,e,D,E){A=" "+A[1].replace(q,"")+" ";if(E){return A}for(var B=0,C;(C=y[B])!=null;B++){if(C){if(D^(C.className&&(" "+C.className+" ").replace(/[\t\n\r]/g," ").indexOf(A)>=0)){if(!z){e.push(C)}}else{if(z){y[B]=false}}}}return false},ID:function(e){return e[1].replace(q,"")},TAG:function(y,e){return y[1].replace(q,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){d.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var y=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(y[1]+(y[2]||1))-0;e[3]=y[3]-0}else{if(e[2]){d.error(e[0])}}e[0]=o++;return e},ATTR:function(B,y,z,e,C,D){var A=B[1]=B[1].replace(q,"");if(!D&&k.attrMap[A]){B[1]=k.attrMap[A]}B[4]=(B[4]||B[5]||"").replace(q,"");if(B[2]==="~="){B[4]=" "+B[4]+" "}return B},PSEUDO:function(B,y,z,e,C){if(B[1]==="not"){if((n.exec(B[3])||"").length>1||/^\w/.test(B[3])){B[3]=d(B[3],null,null,y)}else{var A=d.filter(B[3],y,z,true^C);if(!z){e.push.apply(e,A)}return false}}else{if(k.match.POS.test(B[0])||k.match.CHILD.test(B[0])){return true}}return B},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(z,y,e){return !!d(e[3],z).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(z){var e=z.getAttribute("type"),y=z.type;return z.nodeName.toLowerCase()==="input"&&"text"===y&&(e===y||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(y){var e=y.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===y.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(y){var e=y.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===y.type},button:function(y){var e=y.nodeName.toLowerCase();return e==="input"&&"button"===y.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(y,e){return e===0},last:function(z,y,e,A){return y===A.length-1},even:function(y,e){return e%2===0},odd:function(y,e){return e%2===1},lt:function(z,y,e){return y<e[3]-0},gt:function(z,y,e){return y>e[3]-0},nth:function(z,y,e){return e[3]-0===y},eq:function(z,y,e){return e[3]-0===y}},filter:{PSEUDO:function(z,E,D,F){var e=E[1],y=k.filters[e];if(y){return y(z,D,E,F)}else{if(e==="contains"){return(z.textContent||z.innerText||b([z])||"").indexOf(E[3])>=0}else{if(e==="not"){var A=E[3];for(var C=0,B=A.length;C<B;C++){if(A[C]===z){return false}}return true}else{d.error(e)}}}},CHILD:function(z,B){var A,H,D,G,e,C,F,E=B[1],y=z;switch(E){case"only":case"first":while((y=y.previousSibling)){if(y.nodeType===1){return false}}if(E==="first"){return true}y=z;case"last":while((y=y.nextSibling)){if(y.nodeType===1){return false}}return true;case"nth":A=B[2];H=B[3];if(A===1&&H===0){return true}D=B[0];G=z.parentNode;if(G&&(G[i]!==D||!z.nodeIndex)){C=0;for(y=G.firstChild;y;y=y.nextSibling){if(y.nodeType===1){y.nodeIndex=++C}}G[i]=D}F=z.nodeIndex-H;if(A===0){return F===0}else{return(F%A===0&&F/A>=0)}}},ID:function(y,e){return y.nodeType===1&&y.getAttribute("id")===e},TAG:function(y,e){return(e==="*"&&y.nodeType===1)||!!y.nodeName&&y.nodeName.toLowerCase()===e},CLASS:function(y,e){return(" "+(y.className||y.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(C,A){var z=A[1],e=d.attr?d.attr(C,z):k.attrHandle[z]?k.attrHandle[z](C):C[z]!=null?C[z]:C.getAttribute(z),D=e+"",B=A[2],y=A[4];return e==null?B==="!=":!B&&d.attr?e!=null:B==="="?D===y:B==="*="?D.indexOf(y)>=0:B==="~="?(" "+D+" ").indexOf(y)>=0:!y?D&&e!==false:B==="!="?D!==y:B==="^="?D.indexOf(y)===0:B==="$="?D.substr(D.length-y.length)===y:B==="|="?D===y||D.substr(0,y.length+1)===y+"-":false},POS:function(B,y,z,C){var e=y[2],A=k.setFilters[e];if(A){return A(B,z,y,C)}}}};var j=k.match.POS,c=function(y,e){return"\\"+(e-0+1)};for(var f in k.match){k.match[f]=new RegExp(k.match[f].source+(/(?![^\[]*\])(?![^\(]*\))/.source));k.leftMatch[f]=new RegExp(/(^(?:.|\r|\n)*?)/.source+k.match[f].source.replace(/\\(\d+)/g,c))}k.match.globalPOS=j;var l=function(y,e){y=Array.prototype.slice.call(y,0);if(e){e.push.apply(e,y);return e}return y};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(v){l=function(B,A){var z=0,y=A||[];if(r.call(B)==="[object Array]"){Array.prototype.push.apply(y,B)}else{if(typeof B.length==="number"){for(var e=B.length;z<e;z++){y.push(B[z])}}else{for(;B[z];z++){y.push(B[z])}}}return y}}var p,m;if(document.documentElement.compareDocumentPosition){p=function(y,e){if(y===e){h=true;return 0}if(!y.compareDocumentPosition||!e.compareDocumentPosition){return y.compareDocumentPosition?-1:1}return y.compareDocumentPosition(e)&4?-1:1}}else{p=function(F,E){if(F===E){h=true;return 0}else{if(F.sourceIndex&&E.sourceIndex){return F.sourceIndex-E.sourceIndex}}var C,y,z=[],e=[],B=F.parentNode,D=E.parentNode,G=B;if(B===D){return m(F,E)}else{if(!B){return -1}else{if(!D){return 1}}}while(G){z.unshift(G);G=G.parentNode}G=D;while(G){e.unshift(G);G=G.parentNode}C=z.length;y=e.length;for(var A=0;A<C&&A<y;A++){if(z[A]!==e[A]){return m(z[A],e[A])}}return A===C?m(F,e[A],-1):m(z[A],E,1)};m=function(y,e,z){if(y===e){return z}var A=y.nextSibling;while(A){if(A===e){return -1}A=A.nextSibling}return 1}}(function(){var y=document.createElement("div"),z="script"+(new Date()).getTime(),e=document.documentElement;y.innerHTML="<a name='"+z+"'/>";e.insertBefore(y,e.firstChild);if(document.getElementById(z)){k.find.ID=function(B,C,D){if(typeof C.getElementById!=="undefined"&&!D){var A=C.getElementById(B[1]);return A?A.id===B[1]||typeof A.getAttributeNode!=="undefined"&&A.getAttributeNode("id").nodeValue===B[1]?[A]:undefined:[]}};k.filter.ID=function(C,A){var B=typeof C.getAttributeNode!=="undefined"&&C.getAttributeNode("id");return C.nodeType===1&&B&&B.nodeValue===A}}e.removeChild(y);e=y=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){k.find.TAG=function(y,C){var B=C.getElementsByTagName(y[1]);if(y[1]==="*"){var A=[];for(var z=0;B[z];z++){if(B[z].nodeType===1){A.push(B[z])}}B=A}return B}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){k.attrHandle.href=function(y){return y.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=d,A=document.createElement("div"),z="__sizzle__";A.innerHTML="<p class='TEST'></p>";if(A.querySelectorAll&&A.querySelectorAll(".TEST").length===0){return}d=function(L,C,G,K){C=C||document;if(!K&&!d.isXML(C)){var J=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(L);if(J&&(C.nodeType===1||C.nodeType===9)){if(J[1]){return l(C.getElementsByTagName(L),G)}else{if(J[2]&&k.find.CLASS&&C.getElementsByClassName){return l(C.getElementsByClassName(J[2]),G)}}}if(C.nodeType===9){if(L==="body"&&C.body){return l([C.body],G)}else{if(J&&J[3]){var F=C.getElementById(J[3]);if(F&&F.parentNode){if(F.id===J[3]){return l([F],G)}}else{return l([],G)}}}try{return l(C.querySelectorAll(L),G)}catch(H){}}else{if(C.nodeType===1&&C.nodeName.toLowerCase()!=="object"){var D=C,E=C.getAttribute("id"),B=E||z,N=C.parentNode,M=/^\s*[+~]/.test(L);if(!E){C.setAttribute("id",B)}else{B=B.replace(/'/g,"\\$&")}if(M&&N){C=C.parentNode}try{if(!M||N){return l(C.querySelectorAll("[id='"+B+"'] "+L),G)}}catch(I){}finally{if(!E){D.removeAttribute("id")}}}}}return e(L,C,G,K)};for(var y in e){d[y]=e[y]}A=null})()}(function(){var e=document.documentElement,z=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(z){var B=!z.call(document.createElement("div"),"div"),y=false;try{z.call(document.documentElement,"[test!='']:sizzle")}catch(A){y=true}d.matchesSelector=function(D,F){F=F.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!d.isXML(D)){try{if(y||!k.match.PSEUDO.test(F)&&!/!=/.test(F)){var C=z.call(D,F);if(C||!B||D.document&&D.document.nodeType!==11){return C}}}catch(E){}}return d(F,null,null,[D]).length>0}}})();(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}k.order.splice(1,0,"CLASS");k.find.CLASS=function(y,z,A){if(typeof z.getElementsByClassName!=="undefined"&&!A){return z.getElementsByClassName(y[1])}};e=null})();function a(y,D,C,G,E,F){for(var A=0,z=G.length;A<z;A++){var e=G[A];if(e){var B=false;e=e[y];while(e){if(e[i]===C){B=G[e.sizset];break}if(e.nodeType===1&&!F){e[i]=C;e.sizset=A}if(e.nodeName.toLowerCase()===D){B=e;break}e=e[y]}G[A]=B}}}function t(y,D,C,G,E,F){for(var A=0,z=G.length;A<z;A++){var e=G[A];if(e){var B=false;e=e[y];while(e){if(e[i]===C){B=G[e.sizset];break}if(e.nodeType===1){if(!F){e[i]=C;e.sizset=A}if(typeof D!=="string"){if(e===D){B=true;break}}else{if(d.filter(D,[e]).length>0){B=e;break}}}e=e[y]}G[A]=B}}}if(document.documentElement.contains){d.contains=function(y,e){return y!==e&&(y.contains?y.contains(e):true)}}else{if(document.documentElement.compareDocumentPosition){d.contains=function(y,e){return !!(y.compareDocumentPosition(e)&16)}}else{d.contains=function(){return false}}}d.isXML=function(e){var y=(e?e.ownerDocument||e:0).documentElement;return y?y.nodeName!=="HTML":false};var s=function(z,e,D){var C,E=[],B="",F=e.nodeType?[e]:e;while((C=k.match.PSEUDO.exec(z))){B+=C[0];z=z.replace(k.match.PSEUDO,"")}z=k.relative[z]?z+"*":z;for(var A=0,y=F.length;A<y;A++){d(z,F[A],E,D)}return d.filter(B,E)};window.tinymce.dom.Sizzle=d})();(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j<arguments.length;j++){h.push(arguments[j])}h=e[g].apply(e,h);b.update(g);return h}});a.extend(b,{on:function(i,h,g){return a.dom.Event.add(b.id,i,h,g)},getXY:function(){return{x:parseInt(b.getStyle("left")),y:parseInt(b.getStyle("top"))}},getSize:function(){var g=e.get(b.id);return{w:parseInt(b.getStyle("width")||g.clientWidth),h:parseInt(b.getStyle("height")||g.clientHeight)}},moveTo:function(g,h){b.setStyles({left:g,top:h})},moveBy:function(g,i){var h=b.getXY();b.moveTo(h.x+g,h.y+i)},resizeTo:function(g,i){b.setStyles({width:g,height:i})},resizeBy:function(g,j){var i=b.getSize();b.resizeTo(i.w+g,i.h+j)},update:function(h){var g;if(a.isIE6&&d.blocker){h=h||"";if(h.indexOf("get")===0||h.indexOf("has")===0||h.indexOf("is")===0){return}if(h=="remove"){e.remove(b.blocker);return}if(!b.blocker){b.blocker=e.uniqueId();g=e.add(d.container||e.getRoot(),"iframe",{id:b.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});e.setStyle(g,"opacity",0)}else{g=e.get(b.blocker)}e.setStyles(g,{left:b.getStyle("left",1),top:b.getStyle("top",1),width:b.getStyle("width",1),height:b.getStyle("height",1),display:b.getStyle("display",1),zIndex:parseInt(b.getStyle("zIndex",1)||0)-1})}}})}})(tinymce);(function(d){function f(g){return g.replace(/[\n\r]+/g,"")}var c=d.is,b=d.isIE,e=d.each,a=d.dom.TreeWalker;d.create("tinymce.dom.Selection",{Selection:function(k,j,i,h){var g=this;g.dom=k;g.win=j;g.serializer=i;g.editor=h;e(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(l){g[l]=new d.util.Dispatcher(g)});if(!g.win.getSelection){g.tridentSel=new d.dom.TridentSelection(g)}if(d.isIE&&k.boxModel){this._fixIESelection()}d.addUnload(g.destroy,g)},setCursorLocation:function(i,j){var g=this;var h=g.dom.createRng();h.setStart(i,j);h.setEnd(i,j);g.setRng(h);g.collapse(false)},getContent:function(h){var g=this,i=g.getRng(),m=g.dom.create("body"),k=g.getSel(),j,l,o;h=h||{};j=l="";h.get=true;h.format=h.format||"html";h.forced_root_block="";g.onBeforeGetContent.dispatch(g,h);if(h.format=="text"){return g.isCollapsed()?"":(i.text||(k.toString?k.toString():""))}if(i.cloneContents){o=i.cloneContents();if(o){m.appendChild(o)}}else{if(c(i.item)||c(i.htmlText)){m.innerHTML="<br>"+(i.item?i.item(0).outerHTML:i.htmlText);m.removeChild(m.firstChild)}else{m.innerHTML=i.toString()}}if(/^\s/.test(m.innerHTML)){j=" "}if(/\s+$/.test(m.innerHTML)){l=" "}h.getInner=true;h.content=g.isCollapsed()?"":j+g.serializer.serialize(m,h)+l;g.onGetContent.dispatch(g,h);return h.content},setContent:function(h,j){var o=this,g=o.getRng(),k,l=o.win.document,n,m;j=j||{format:"html"};j.set=true;h=j.content=h;if(!j.no_events){o.onBeforeSetContent.dispatch(o,j)}h=j.content;if(g.insertNode){h+='<span id="__caret">_</span>';if(g.startContainer==l&&g.endContainer==l){l.body.innerHTML=h}else{g.deleteContents();if(l.body.childNodes.length===0){l.body.innerHTML=h}else{if(g.createContextualFragment){g.insertNode(g.createContextualFragment(h))}else{n=l.createDocumentFragment();m=l.createElement("div");n.appendChild(m);m.outerHTML=h;g.insertNode(n)}}}k=o.dom.get("__caret");g=l.createRange();g.setStartBefore(k);g.setEndBefore(k);o.setRng(g);o.dom.remove("__caret");try{o.setRng(g)}catch(i){}}else{if(g.item){l.execCommand("Delete",false,null);g=o.getRng()}if(/^\s+/.test(h)){g.pasteHTML('<span id="__mce_tmp">_</span>'+h);o.dom.remove("__mce_tmp")}else{g.pasteHTML(h)}}if(!j.no_events){o.onSetContent.dispatch(o,j)}},getStart:function(){var i=this,h=i.getRng(),j,g,l,k;if(h.duplicate||h.item){if(h.item){return h.item(0)}l=h.duplicate();l.collapse(1);j=l.parentElement();if(j.ownerDocument!==i.dom.doc){j=i.dom.getRoot()}g=k=h.parentElement();while(k=k.parentNode){if(k==j){j=g;break}}return j}else{j=h.startContainer;if(j.nodeType==1&&j.hasChildNodes()){j=j.childNodes[Math.min(j.childNodes.length-1,h.startOffset)]}if(j&&j.nodeType==3){return j.parentNode}return j}},getEnd:function(){var h=this,g=h.getRng(),j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);j=g.parentElement();if(j.ownerDocument!==h.dom.doc){j=h.dom.getRoot()}if(j&&j.nodeName=="BODY"){return j.lastChild||j}return j}else{j=g.endContainer;i=g.endOffset;if(j.nodeType==1&&j.hasChildNodes()){j=j.childNodes[i>0?i-1:i]}if(j&&j.nodeType==3){return j.parentNode}return j}},getBookmark:function(s,v){var y=this,n=y.dom,h,k,j,o,i,p,q,m="\uFEFF",x;function g(z,A){var t=0;e(n.select(z),function(C,B){if(C==A){t=B}});return t}function u(t){function z(E){var A,D,C,B=E?"start":"end";A=t[B+"Container"];D=t[B+"Offset"];if(A.nodeType==1&&A.nodeName=="TR"){C=A.childNodes;A=C[Math.min(E?D:D-1,C.length-1)];if(A){D=E?0:A.childNodes.length;t["set"+(E?"Start":"End")](A,D)}}}z(true);z();return t}function l(){var z=y.getRng(true),t=n.getRoot(),A={};function B(E,J){var D=E[J?"startContainer":"endContainer"],I=E[J?"startOffset":"endOffset"],C=[],F,H,G=0;if(D.nodeType==3){if(v){for(F=D.previousSibling;F&&F.nodeType==3;F=F.previousSibling){I+=F.nodeValue.length}}C.push(I)}else{H=D.childNodes;if(I>=H.length&&H.length){G=1;I=Math.max(0,H.length-1)}C.push(y.dom.nodeIndex(H[I],v)+G)}for(;D&&D!=t;D=D.parentNode){C.push(y.dom.nodeIndex(D,v))}return C}A.start=B(z,true);if(!y.isCollapsed()){A.end=B(z)}return A}if(s==2){if(y.tridentSel){return y.tridentSel.getBookmark(s)}return l()}if(s){return{rng:y.getRng()}}h=y.getRng();j=n.uniqueId();o=tinyMCE.activeEditor.selection.isCollapsed();x="overflow:hidden;line-height:0px";if(h.duplicate||h.item){if(!h.item){k=h.duplicate();try{h.collapse();h.pasteHTML('<span data-mce-type="bookmark" id="'+j+'_start" style="'+x+'">'+m+"</span>");if(!o){k.collapse(false);h.moveToElementText(k.parentElement());if(h.compareEndPoints("StartToEnd",k)===0){k.move("character",-1)}k.pasteHTML('<span data-mce-type="bookmark" id="'+j+'_end" style="'+x+'">'+m+"</span>")}}catch(r){return null}}else{p=h.item(0);i=p.nodeName;return{name:i,index:g(i,p)}}}else{p=y.getNode();i=p.nodeName;if(i=="IMG"){return{name:i,index:g(i,p)}}k=u(h.cloneRange());if(!o){k.collapse(false);k.insertNode(n.create("span",{"data-mce-type":"bookmark",id:j+"_end",style:x},m))}h=u(h);h.collapse(true);h.insertNode(n.create("span",{"data-mce-type":"bookmark",id:j+"_start",style:x},m))}y.moveToBookmark({id:j,keep:1});return{id:j}},moveToBookmark:function(o){var s=this,m=s.dom,j,i,g,r,k,u,p,q;function h(A){var t=o[A?"start":"end"],x,y,z,v;if(t){z=t[0];for(y=r,x=t.length-1;x>=1;x--){v=y.childNodes;if(t[x]>v.length-1){return}y=v[t[x]]}if(y.nodeType===3){z=Math.min(t[0],y.nodeValue.length)}if(y.nodeType===1){z=Math.min(t[0],y.childNodes.length)}if(A){g.setStart(y,z)}else{g.setEnd(y,z)}}return true}function l(B){var v=m.get(o.id+"_"+B),A,t,y,z,x=o.keep;if(v){A=v.parentNode;if(B=="start"){if(!x){t=m.nodeIndex(v)}else{A=v.firstChild;t=1}k=u=A;p=q=t}else{if(!x){t=m.nodeIndex(v)}else{A=v.firstChild;t=1}u=A;q=t}if(!x){z=v.previousSibling;y=v.nextSibling;e(d.grep(v.childNodes),function(C){if(C.nodeType==3){C.nodeValue=C.nodeValue.replace(/\uFEFF/g,"")}});while(v=m.get(o.id+"_"+B)){m.remove(v,1)}if(z&&y&&z.nodeType==y.nodeType&&z.nodeType==3&&!d.isOpera){t=z.nodeValue.length;z.appendData(y.nodeValue);m.remove(y);if(B=="start"){k=u=z;p=q=t}else{u=z;q=t}}}}}function n(t){if(m.isBlock(t)&&!t.innerHTML&&!b){t.innerHTML='<br data-mce-bogus="1" />'}return t}if(o){if(o.start){g=m.createRng();r=m.getRoot();if(s.tridentSel){return s.tridentSel.moveToBookmark(o)}if(h(true)&&h()){s.setRng(g)}}else{if(o.id){l("start");l("end");if(k){g=m.createRng();g.setStart(n(k),p);g.setEnd(n(u),q);s.setRng(g)}}else{if(o.name){s.select(m.select(o.name)[o.index])}else{if(o.rng){s.setRng(o.rng)}}}}}},select:function(l,k){var j=this,m=j.dom,h=m.createRng(),g;function i(n,p){var o=new a(n,n);do{if(n.nodeType==3&&d.trim(n.nodeValue).length!==0){if(p){h.setStart(n,0)}else{h.setEnd(n,n.nodeValue.length)}return}if(n.nodeName=="BR"){if(p){h.setStartBefore(n)}else{h.setEndBefore(n)}return}}while(n=(p?o.next():o.prev()))}if(l){g=m.nodeIndex(l);h.setStart(l.parentNode,g);h.setEnd(l.parentNode,g+1);if(k){i(l,1);i(l)}j.setRng(h)}return l},isCollapsed:function(){var g=this,i=g.getRng(),h=g.getSel();if(!i||i.item){return false}if(i.compareEndPoints){return i.compareEndPoints("StartToEnd",i)===0}return !h||i.collapsed},collapse:function(g){var i=this,h=i.getRng(),j;if(h.item){j=h.item(0);h=i.win.document.body.createTextRange();h.moveToElementText(j)}h.collapse(!!g);i.setRng(h)},getSel:function(){var h=this,g=this.win;return g.getSelection?g.getSelection():g.document.selection},getRng:function(m){var h=this,j,g,l,k=h.win.document;if(m&&h.tridentSel){return h.tridentSel.getRangeAt(0)}try{if(j=h.getSel()){g=j.rangeCount>0?j.getRangeAt(0):(j.createRange?j.createRange():k.createRange())}}catch(i){}if(d.isIE&&g&&g.setStart&&k.selection.createRange().item){l=k.selection.createRange().item(0);g=k.createRange();g.setStartBefore(l);g.setEndAfter(l)}if(!g){g=k.createRange?k.createRange():k.body.createTextRange()}if(g.setStart&&g.startContainer.nodeType===9&&g.collapsed){l=h.dom.getRoot();g.setStart(l,0);g.setEnd(l,0)}if(h.selectedRange&&h.explicitRange){if(g.compareBoundaryPoints(g.START_TO_START,h.selectedRange)===0&&g.compareBoundaryPoints(g.END_TO_END,h.selectedRange)===0){g=h.explicitRange}else{h.selectedRange=null;h.explicitRange=null}}return g},setRng:function(k,g){var j,i=this;if(!i.tridentSel){j=i.getSel();if(j){i.explicitRange=k;try{j.removeAllRanges()}catch(h){}j.addRange(k);if(g===false&&j.extend){j.collapse(k.endContainer,k.endOffset);j.extend(k.startContainer,k.startOffset)}i.selectedRange=j.rangeCount>0?j.getRangeAt(0):null}}else{if(k.cloneRange){try{i.tridentSel.addRange(k);return}catch(h){}}try{k.select()}catch(h){}}},setNode:function(h){var g=this;g.setContent(g.dom.getOuterHTML(h));return h},getNode:function(){var i=this,h=i.getRng(),j=i.getSel(),m,l=h.startContainer,g=h.endContainer;function k(q,o){var p=q;while(q&&q.nodeType===3&&q.length===0){q=o?q.nextSibling:q.previousSibling}return q||p}if(!h){return i.dom.getRoot()}if(h.setStart){m=h.commonAncestorContainer;if(!h.collapsed){if(h.startContainer==h.endContainer){if(h.endOffset-h.startOffset<2){if(h.startContainer.hasChildNodes()){m=h.startContainer.childNodes[h.startOffset]}}}if(l.nodeType===3&&g.nodeType===3){if(l.length===h.startOffset){l=k(l.nextSibling,true)}else{l=l.parentNode}if(h.endOffset===0){g=k(g.previousSibling,false)}else{g=g.parentNode}if(l&&l===g){return l}}}if(m&&m.nodeType==3){return m.parentNode}return m}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(p,h){var o=this,k=o.dom,m,l,i,j=[];m=k.getParent(p||o.getStart(),k.isBlock);l=k.getParent(h||o.getEnd(),k.isBlock);if(m){j.push(m)}if(m&&l&&m!=l){i=m;var g=new a(m,k.getRoot());while((i=g.next())&&i!=l){if(k.isBlock(i)){j.push(i)}}}if(l&&m!=l){j.push(l)}return j},isForward:function(){var i=this.dom,g=this.getSel(),j,h;if(!g||g.anchorNode==null||g.focusNode==null){return true}j=i.createRng();j.setStart(g.anchorNode,g.anchorOffset);j.collapse(true);h=i.createRng();h.setStart(g.focusNode,g.focusOffset);h.collapse(true);return j.compareBoundaryPoints(j.START_TO_START,h)<=0},normalize:function(){var h=this,g,m,l,j,i;function k(p){var o,r,n,s=h.dom,u=s.getRoot(),q,t,v;function y(z,A){var B=new a(z,s.getParent(z.parentNode,s.isBlock)||u);while(z=B[A?"prev":"next"]()){if(z.nodeName==="BR"){return true}}}function x(B,z){var C,A;z=z||o;C=new a(z,s.getParent(z.parentNode,s.isBlock)||u);while(q=C[B?"prev":"next"]()){if(q.nodeType===3&&q.nodeValue.length>0){o=q;r=B?q.nodeValue.length:0;m=true;return}if(s.isBlock(q)||t[q.nodeName.toLowerCase()]){return}A=q}if(l&&A){o=A;m=true;r=0}}o=g[(p?"start":"end")+"Container"];r=g[(p?"start":"end")+"Offset"];t=s.schema.getNonEmptyElements();if(o.nodeType===9){o=s.getRoot();r=0}if(o===u){if(p){q=o.childNodes[r>0?r-1:0];if(q){v=q.nodeName.toLowerCase();if(t[q.nodeName]||q.nodeName=="TABLE"){return}}}if(o.hasChildNodes()){o=o.childNodes[Math.min(!p&&r>0?r-1:r,o.childNodes.length-1)];r=0;if(o.hasChildNodes()&&!/TABLE/.test(o.nodeName)){q=o;n=new a(o,u);do{if(q.nodeType===3&&q.nodeValue.length>0){r=p?0:q.nodeValue.length;o=q;m=true;break}if(t[q.nodeName.toLowerCase()]){r=s.nodeIndex(q);o=q.parentNode;if(q.nodeName=="IMG"&&!p){r++}m=true;break}}while(q=(p?n.next():n.prev()))}}}if(l){if(o.nodeType===3&&r===0){x(true)}if(o.nodeType===1){q=o.childNodes[r];if(q&&q.nodeName==="BR"&&!y(q)&&!y(q,true)){x(true,o.childNodes[r])}}}if(p&&!l&&o.nodeType===3&&r===o.nodeValue.length){x(false)}if(m){g["set"+(p?"Start":"End")](o,r)}}if(d.isIE){return}g=h.getRng();l=g.collapsed;k(true);if(!l){k()}if(m){if(l){g.collapse(true)}h.setRng(g,h.isForward())}},selectorChanged:function(g,j){var h=this,i;if(!h.selectorChangedData){h.selectorChangedData={};i={};h.editor.onNodeChange.addToTop(function(l,k,o){var p=h.dom,m=p.getParents(o,null,p.getRoot()),n={};e(h.selectorChangedData,function(r,q){e(m,function(s){if(p.is(s,q)){if(!i[q]){e(r,function(t){t(true,{node:s,selector:q,parents:m})});i[q]=r}n[q]=r;return false}})});e(i,function(r,q){if(!n[q]){delete i[q];e(r,function(s){s(false,{node:o,selector:q,parents:m})})}})})}if(!h.selectorChangedData[g]){h.selectorChangedData[g]=[]}h.selectorChangedData[g].push(j);return h},destroy:function(h){var g=this;g.win=null;if(!h){d.removeUnload(g.destroy)}},_fixIESelection:function(){var h=this.dom,n=h.doc,i=n.body,k,o,g;function j(p,s){var q=i.createTextRange();try{q.moveToPoint(p,s)}catch(r){q=null}return q}function m(q){var p;if(q.button){p=j(q.x,q.y);if(p){if(p.compareEndPoints("StartToStart",o)>0){p.setEndPoint("StartToStart",o)}else{p.setEndPoint("EndToEnd",o)}p.select()}}else{l()}}function l(){var p=n.selection.createRange();if(o&&!p.item&&p.compareEndPoints("StartToEnd",p)===0){o.select()}h.unbind(n,"mouseup",l);h.unbind(n,"mousemove",m);o=k=0}n.documentElement.unselectable=true;h.bind(n,["mousedown","contextmenu"],function(p){if(p.target.nodeName==="HTML"){if(k){l()}g=n.documentElement;if(g.scrollHeight>g.clientHeight){return}k=1;o=j(p.x,p.y);if(o){h.bind(n,"mouseup",l);h.bind(n,"mousemove",m);h.win.focus();o.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";e.remove_trailing_brs="remove_trailing_brs" in e?e.remove_trailing_brs:true;h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/(?:^|\s)mce(Item\w+|Selected)(?!\S)/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addAttributeFilter("data-mce-expando",function(j,l,k){var m=j.length;while(m--){j[m].attr(l,null)}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// <![CDATA[\n"+j(o)+"\n// ]]>"}}else{if(o.length>0){n.firstChild.value="<!--\n"+j(o)+"\n-->"}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(a.trim(m.getInner?o.innerHTML:i.getOuterHTML(o)),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],e={},d=[],g=0,f;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=document.createElement("script");s.id=n;s.type="text/javascript";s.src=a._addVer(m);if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==f){j.push(m);l[m]=c}if(q){if(!e[m]){e[m]=[]}e[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(e[r],function(s){s.func.call(s.scope)});e[r]=f}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,s){var i=d.startContainer,l=d.startOffset,t=d.endContainer,m=d.endOffset,j,g,o,h,r,q,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(u){s([u])});return}function f(u){var v;v=u[0];if(v.nodeType===3&&v===i&&l>=v.nodeValue.length){u.splice(0,1)}v=u[u.length-1];if(m===0&&u.length>0&&v===t&&v.nodeType===3){u.splice(u.length-1,1)}return u}function p(x,v,u){var y=[];for(;x&&x!=u;x=x[v]){y.push(x)}return y}function n(v,u){do{if(v.parentNode==u){return v}v=v.parentNode}while(v)}function k(x,v,y){var u=y?"nextSibling":"previousSibling";for(h=x,r=h.parentNode;h&&h!=v;h=r){r=h.parentNode;q=p(h==x?h:h[u],u);if(q.length){if(!y){q.reverse()}s(f(q))}}}if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[l]}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[Math.min(m-1,t.childNodes.length-1)]}if(i==t){return s(f([i]))}j=c.findCommonAncestor(i,t);for(h=i;h;h=h.parentNode){if(h===t){return k(i,j,true)}if(h===j){break}}for(h=t;h;h=h.parentNode){if(h===i){return k(t,j)}if(h===j){break}}g=n(i,j)||i;o=n(t,j)||t;k(i,g,true);q=p(g==i?g:g.nextSibling,"nextSibling",o==t?o.nextSibling:o);if(q.length){s(f(q))}k(t,o)};this.split=function(e){var h=e.startContainer,d=e.startOffset,i=e.endContainer,g=e.endOffset;function f(j,k){return j.splitText(k)}if(h==i&&h.nodeType==3){if(d>0&&d<h.nodeValue.length){i=f(h,d);h=i.previousSibling;if(g>d){g=g-d;h=i=f(i,g).previousSibling;g=i.nodeValue.length;d=0}else{g=0}}}else{if(h.nodeType==3&&d>0&&d<h.nodeValue.length){h=f(h,d);d=0}if(i.nodeType==3&&g>0&&g<i.nodeValue.length){i=f(i,g).previousSibling;g=i.nodeValue.length}}return{startContainer:h,startOffset:d,endContainer:i,endOffset:g}}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var q=this,n=e.root,m=e.items,o=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,l=e.excludeFromTabOrder,k,h,p,d,g;f=f||b.DOM;k=function(r){g=r.target.id};h=function(r){f.setAttrib(r.target.id,"tabindex","-1")};d=function(r){var s=f.get(g);f.setAttrib(s,"tabindex","0");s.focus()};q.focus=function(){f.get(g).focus()};q.destroy=function(){c(m,function(s){var t=f.get(s.id);f.unbind(t,"focus",k);f.unbind(t,"blur",h)});var r=f.get(n);f.unbind(r,"focus",d);f.unbind(r,"keydown",p);m=f=n=q.focus=k=h=p=d=null;q.destroy=function(){}};q.moveFocus=function(v,s){var r=-1,u=q.controls,t;if(!g){return}c(m,function(y,x){if(y.id===g){r=x;return false}});r+=v;if(r<0){r=m.length-1}else{if(r>=m.length){r=0}}t=m[r];f.setAttrib(g,"tabindex","-1");f.setAttrib(t.id,"tabindex","0");f.get(t.id).focus();if(e.actOnFocus){e.onAction(t.id)}if(s){a.cancel(s)}};p=function(z){var v=37,u=39,y=38,A=40,r=27,t=14,s=13,x=32;switch(z.keyCode){case v:if(i){q.moveFocus(-1)}break;case u:if(i){q.moveFocus(1)}break;case y:if(o){q.moveFocus(-1)}break;case A:if(o){q.moveFocus(1)}break;case r:if(e.onCancel){e.onCancel();a.cancel(z)}break;case t:case s:case x:if(e.onAction){e.onAction(g);a.cancel(z)}break}};c(m,function(t,r){var s,u;if(!t.id){t.id=f.uniqueId("_mce_item_")}u=f.get(t.id);if(l){f.bind(u,"blur",h);s="-1"}else{s=(r===0?"0":"-1")}u.setAttribute("tabindex",s);f.bind(u,"focus",k)});if(m[0]){g=m[0].id}f.setAttrib(n,"tabindex","-1");var j=f.get(n);f.bind(j,"focus",d);f.bind(j,"keydown",p)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.offsetWidth,j.max_width):g.offsetWidth;k=j.max_height?Math.min(g.offsetHeight,j.max_height):g.offsetHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return false}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.get("menu_"+g.id);h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){if(typeof h.settings.style=="function"){h.settings.style=h.settings.style()}c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a role="button" id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" aria-labelledby="'+this.id+'_voice" title="'+a.encode(e.title)+'">';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+='<span class="mceIcon '+e["class"]+'"><img class="mceIcon" src="'+e.image+'" alt="'+a.encode(e.title)+'" /></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")}d+='<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="'+this.id+'_voice">'+e.title+"</span>";d+="</a>";return d},postRender:function(){var d=this,e=d.settings,c;if(b.isIE&&d.editor){b.dom.Event.add(d.id,"mousedown",function(f){var g=d.editor.selection.getNode().nodeName;c=g==="IMG"?d.editor.selection.getBookmark():null})}b.dom.Event.add(d.id,"click",function(f){if(!d.isDisabled()){if(b.isIE&&d.editor&&c!==null){d.editor.selection.moveToBookmark(c)}return e.onclick.call(e.scope,f)}});b.dom.Event.add(d.id,"keyup",function(f){if(!d.isDisabled()&&f.keyCode==b.VK.SPACEBAR){return e.onclick.call(e.scope,f)}})}})})(tinymce);(function(e){var d=e.DOM,b=e.dom.Event,f=e.each,a=e.util.Dispatcher,c;e.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(j,i,g){var h=this;h.parent(j,i,g);h.items=[];h.onChange=new a(h);h.onPostRender=new a(h);h.onAdd=new a(h);h.onRenderMenu=new e.util.Dispatcher(this);h.classPrefix="mceListBox";h.marked={}},select:function(h){var g=this,j,i;g.marked={};if(h==c){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(k){return k==h}}if(h!=g.selectedValue){f(g.items,function(l,k){if(i(l.value)){j=1;g.selectByIndex(k);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(g){var i=this,j,k,h;i.marked={};if(g!=i.selectedIndex){j=d.get(i.id+"_text");h=d.get(i.id+"_voiceDesc");k=i.items[g];if(k){i.selectedValue=k.value;i.selectedIndex=g;d.setHTML(j,d.encode(k.title));d.setHTML(h,i.settings.title+" - "+k.title);d.removeClass(j,"mceTitle");d.setAttrib(i.id,"aria-valuenow",k.title)}else{d.setHTML(j,d.encode(i.settings.title));d.setHTML(h,d.encode(i.settings.title));d.addClass(j,"mceTitle");i.selectedValue=i.selectedIndex=null;d.setAttrib(i.id,"aria-valuenow",i.settings.title)}j=0}},mark:function(g){this.marked[g]=true},add:function(j,g,i){var h=this;i=i||{};i=e.extend(i,{title:j,value:g});h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var j="",g=this,i=g.settings,k=g.classPrefix;j='<span role="listbox" aria-haspopup="true" aria-labelledby="'+g.id+'_voiceDesc" aria-describedby="'+g.id+'_voiceDesc"><table role="presentation" tabindex="0" id="'+g.id+'" cellpadding="0" cellspacing="0" class="'+k+" "+k+"Enabled"+(i["class"]?(" "+i["class"]):"")+'"><tbody><tr>';j+="<td>"+d.createHTML("span",{id:g.id+"_voiceDesc","class":"voiceLabel",style:"display:none;"},g.settings.title);j+=d.createHTML("a",{id:g.id+"_text",tabindex:-1,href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},d.encode(g.settings.title))+"</td>";j+="<td>"+d.createHTML("a",{id:g.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},'<span><span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span></span>')+"</td>";j+="</tr></tbody></table></span>";return j},showMenu:function(){var h=this,j,i=d.get(this.id),g;if(h.isDisabled()||h.items.length===0){return}if(h.menu&&h.menu.isMenuVisible){return h.hideMenu()}if(!h.isMenuRendered){h.renderMenu();h.isMenuRendered=true}j=d.getPos(i);g=h.menu;g.settings.offset_x=j.x;g.settings.offset_y=j.y;g.settings.keyboard_focus=!e.isOpera;f(h.items,function(k){if(g.items[k.id]){g.items[k.id].setSelected(0)}});f(h.items,function(k){if(g.items[k.id]&&h.marked[k.value]){g.items[k.id].setSelected(1)}if(k.value===h.selectedValue){g.items[k.id].setSelected(1)}});g.showMenu(0,i.clientHeight);b.add(d.doc,"mousedown",h.hideMenu,h);d.addClass(h.id,h.classPrefix+"Selected")},hideMenu:function(h){var g=this;if(g.menu&&g.menu.isMenuVisible){d.removeClass(g.id,g.classPrefix+"Selected");if(h&&h.type=="mousedown"&&(h.target.id==g.id+"_text"||h.target.id==g.id+"_open")){return}if(!h||!d.getParent(h.target,".mceMenu")){d.removeClass(g.id,g.classPrefix+"Selected");b.remove(d.doc,"mousedown",g.hideMenu,g);g.menu.hideMenu()}}},renderMenu:function(){var h=this,g;g=h.settings.control_manager.createDropMenu(h.id+"_menu",{menu_line:1,"class":h.classPrefix+"Menu mceNoIcons",max_width:250,max_height:150});g.onHideMenu.add(function(){h.hideMenu();h.focus()});g.add({title:h.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(h.settings.onselect("")!==false){h.select("")}}});f(h.items,function(i){if(i.value===c){g.add({title:i.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(h.settings.onselect("")!==false){h.select("")}}})}else{i.id=d.uniqueId();i.role="option";i.onclick=function(){if(h.settings.onselect(i.value)!==false){h.select(i.value)}};g.add(i)}});h.onRenderMenu.dispatch(h,g);h.menu=g},postRender:function(){var g=this,h=g.classPrefix;b.add(g.id,"click",g.showMenu,g);b.add(g.id,"keydown",function(i){if(i.keyCode==32){g.showMenu(i);b.cancel(i)}});b.add(g.id,"focus",function(){if(!g._focused){g.keyDownHandler=b.add(g.id,"keydown",function(i){if(i.keyCode==40){g.showMenu();b.cancel(i)}});g.keyPressHandler=b.add(g.id,"keypress",function(j){var i;if(j.keyCode==13){i=g.selectedValue;g.selectedValue=null;b.cancel(j);g.settings.onselect(i)}})}g._focused=1});b.add(g.id,"blur",function(){b.remove(g.id,"keydown",g.keyDownHandler);b.remove(g.id,"keypress",g.keyPressHandler);g._focused=0});if(e.isIE6||!d.boxModel){b.add(g.id,"mouseover",function(){if(!d.hasClass(g.id,h+"Disabled")){d.addClass(g.id,h+"Hover")}});b.add(g.id,"mouseout",function(){if(!d.hasClass(g.id,h+"Disabled")){d.removeClass(g.id,h+"Hover")}})}g.onPostRender.dispatch(g,d.get(g.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(e){var d=e.DOM,b=e.dom.Event,f=e.each,a=e.util.Dispatcher,c;e.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(h,g){this.parent(h,g);this.classPrefix="mceNativeListBox"},setDisabled:function(g){d.get(this.id).disabled=g;this.setAriaProperty("disabled",g)},isDisabled:function(){return d.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==c){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(k){return k==h}}if(h!=g.selectedValue){f(g.items,function(l,k){if(i(l.value)){j=1;g.selectByIndex(k);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(g){d.get(this.id).selectedIndex=g+1;this.selectedValue=this.items[g]?this.items[g].value:null},add:function(k,h,g){var j,i=this;g=g||{};g.value=h;if(i.isRendered()){d.add(d.get(this.id),"option",g,k)}j={title:k,value:h,attribs:g};i.items.push(j);i.onAdd.dispatch(i,j)},getLength:function(){return this.items.length},renderHTML:function(){var i,g=this;i=d.createHTML("option",{value:""},"-- "+g.settings.title+" --");f(g.items,function(h){i+=d.createHTML("option",{value:h.value},h.title)});i=d.createHTML("select",{id:g.id,"class":"mceNativeListBox","aria-labelledby":g.id+"_aria"},i);i+=d.createHTML("span",{id:g.id+"_aria",style:"display: none"},g.settings.title);return i},postRender:function(){var h=this,i,j=true;h.rendered=true;function g(l){var k=h.items[l.target.selectedIndex-1];if(k&&(k=k.value)){h.onChange.dispatch(h,k);if(h.settings.onselect){h.settings.onselect(k)}}}b.add(h.id,"change",g);b.add(h.id,"keydown",function(l){var k;b.remove(h.id,"change",i);j=false;k=b.add(h.id,"blur",function(){if(j){return}j=true;b.add(h.id,"change",g);b.remove(h.id,"blur",k)});if(e.isWebKit&&(l.keyCode==37||l.keyCode==39)){return b.prevent(l)}if(l.keyCode==13||l.keyCode==32){g(l);return b.cancel(l)}});h.onPostRender.dispatch(h,d.get(h.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.firstChild.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+="<td >"+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'<span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span>');i+="<td >"+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.firstChild.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.keyboardNav=new d.ui.KeyboardNavigation({root:f.id+"_menu",items:c.select("a",f.id+"_menu"),onCancel:function(){f.hideMenu();f.focus()}});f.keyboardNav.focus();f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch();f.keyboardNav.destroy()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(m){m=m.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");var i={href:"javascript:;",style:{backgroundColor:"#"+m},title:p.editor.getLang("colors."+m,m),"data-mce-color":"#"+m};if(!d.isIE){i.role="option"}g=c.add(g,"a",i);if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+m;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return false});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){var f=this;f.parent();a.clear(f.id+"_menu");a.clear(f.id+"_more");c.remove(f.id+"_menu");if(f.keyboardNav){f.keyboardNav.destroy()}}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('<div id="'+f.id+'" role="group" aria-labelledby="'+f.id+'_voice">');i.push("<span role='application'>");i.push('<span id="'+f.id+'_voice" class="mceVoiceLabel" style="display:none;">'+d.encode(g.name)+"</span>");j(e,function(h){i.push(h.renderHTML())});i.push("</span>");i.push("</div>");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e<l.length;e++){k=l[e];d=l[e-1];g=l[e+1];if(e===0){j="mceToolbarStart";if(k.Button){j+=" mceToolbarStartButton"}else{if(k.SplitButton){j+=" mceToolbarStartSplitButton"}else{if(k.ListBox){j+=" mceToolbarStartListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,"<!-- IE -->"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,"<!-- IE -->"))}}if(c.stdMode){f+='<td style="position: relative">'+k.renderHTML()+"</td>"}else{f+="<td>"+k.renderHTML()+"</td>"}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,"<!-- IE -->"))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,"<!-- IE -->"));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},"<tbody><tr>"+f+"</tr></tbody>")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!==0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(x){var v=this,o,n=j.ScriptLoader,u,l=[],r;function q(t){var s=t.id;if(!s){s=t.name;if(s&&!k.get(s)){s=t.name}else{s=k.uniqueId()}t.setAttribute("id",s)}return s}function m(z,A,t){var y=z[A];if(!y){return}if(j.is(y,"string")){t=y.replace(/\.\w+$/,"");t=t?j.resolve(t):0;y=j.resolve(y)}return y.apply(t||this,Array.prototype.slice.call(arguments,2))}function p(t,s){return s.constructor===RegExp?s.test(t.className):k.hasClass(t,s)}v.settings=x;i.bind(window,"ready",function(){var s,t;m(x,"onpageload");switch(x.mode){case"exact":s=x.elements||"";if(s.length>0){g(e(s),function(y){if(k.get(y)){r=new j.Editor(y,x);l.push(r);r.render(1)}else{g(document.forms,function(z){g(z.elements,function(A){if(A.name===y){y="mce_editor_"+c++;k.setAttrib(A,"id",y);r=new j.Editor(y,x);l.push(r);r.render(1)}})})}})}break;case"textareas":case"specific_textareas":g(k.select("textarea"),function(y){if(x.editor_deselector&&p(y,x.editor_deselector)){return}if(!x.editor_selector||p(y,x.editor_selector)){r=new j.Editor(q(y),x);l.push(r);r.render(1)}});break;default:if(x.types){g(x.types,function(y){g(k.select(y.selector),function(A){var z=new j.Editor(q(A),j.extend({},x,y));l.push(z);z.render(1)})})}else{if(x.selector){g(k.select(x.selector),function(z){var y=new j.Editor(q(z),x);l.push(y);y.render(1)})}}}if(x.oninit){s=t=0;g(l,function(y){t++;if(!y.initialized){y.onInit.add(function(){s++;if(s==t){m(x,"oninit")}})}else{s++}if(s==t){m(x,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l<o.length;l++){if(o[l]==n){o.splice(l,1);break}}if(m.activeEditor==n){m._setActive(o[0])}n.destroy();m.onRemoveEditor.dispatch(m,n);return n},execCommand:function(r,p,o){var q=this,n=q.get(o),l;function m(){n.destroy();l.detachEvent("onunload",m);l=l.tinyMCE=l.tinymce=null}switch(r){case"mceFocus":n.focus();return true;case"mceAddEditor":case"mceAddControl":if(!q.get(o)){new j.Editor(o,q.settings).render()}return true;case"mceAddFrameControl":l=o.window;l.tinyMCE=tinyMCE;l.tinymce=j;j.DOM.doc=l.document;j.DOM.win=l;n=new j.Editor(o.element_id,o);n.render();if(j.isIE){l.attachEvent("onunload",m)}o.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(n){n.remove()}return true;case"mceToggleEditor":if(!n){q.execCommand("mceAddControl",0,o);return true}if(n.isHidden()){n.show()}else{n.hide()}return true}if(q.activeEditor){return q.activeEditor.execCommand(r,p,o)}return false},execInstanceCommand:function(p,o,n,m){var l=this.get(p);if(l){return l.execCommand(o,n,m)}return false},triggerSave:function(){g(this.editors,function(l){l.save()})},addI18n:function(n,q){var l,m=this.i18n;if(!j.is(n,"string")){g(n,function(r,p){g(r,function(t,s){g(t,function(v,u){if(s==="common"){m[p+"."+u]=v}else{m[p+"."+s+"."+u]=v}})})})}else{g(q,function(r,p){m[n+"."+p]=r})}},_setActive:function(l){this.selectedInstance=this.activeEditor=l}})})(tinymce);(function(k){var l=k.DOM,j=k.dom.Event,f=k.extend,i=k.each,a=k.isGecko,b=k.isIE,e=k.isWebKit,d=k.is,h=k.ThemeManager,c=k.PluginManager,g=k.explode;k.create("tinymce.Editor",{Editor:function(p,o){var m=this,n=true;m.settings=o=f({id:p,language:"en",theme:"advanced",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:k.documentBaseURL,add_form_submit_trigger:n,submit_patch:n,add_unload_trigger:n,convert_urls:n,relative_urls:n,remove_script_host:n,table_inline_editing:false,object_resizing:n,accessibility_focus:n,doctype:k.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual:n,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:n,directionality:"ltr",forced_root_block:"p",hidden_input:n,padd_empty_editor:n,render_ui:n,indentation:"30px",fix_table_elements:n,inline_styles:n,convert_fonts_to_spans:n,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:n,entity_encoding:"named",url_converter:m.convertURL,url_converter_scope:m,ie7_compat:n},o);m.id=m.editorId=p;m.isNotDirty=false;m.plugins={};m.documentBaseURI=new k.util.URI(o.document_base_url||k.documentBaseURL,{base_uri:tinyMCE.baseURI});m.baseURI=k.baseURI;m.contentCSS=[];m.contentStyles=[];m.setupEvents();m.execCommands={};m.queryStateCommands={};m.queryValueCommands={};m.execCallback("setup",m)},render:function(o){var p=this,q=p.settings,r=p.id,m=k.ScriptLoader;if(!j.domLoaded){j.add(window,"ready",function(){p.render()});return}tinyMCE.settings=q;if(!p.getElement()){return}if(k.isIDevice&&!k.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(p.getElement().nodeName)&&q.hidden_input&&l.getParent(r,"form")){l.insertAfter(l.create("input",{type:"hidden",name:r}),r)}if(!q.content_editable){p.orgVisibility=p.getElement().style.visibility;p.getElement().style.visibility="hidden"}if(k.WindowManager){p.windowManager=new k.WindowManager(p)}if(q.encoding=="xml"){p.onGetContent.add(function(s,t){if(t.save){t.content=l.encode(t.content)}})}if(q.add_form_submit_trigger){p.onSubmit.addToTop(function(){if(p.initialized){p.save();p.isNotDirty=1}})}if(q.add_unload_trigger){p._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(p.initialized&&!p.destroyed&&!p.isHidden()){p.save({format:"raw",no_events:true})}})}k.addUnload(p.destroy,p);if(q.submit_patch){p.onBeforeRenderUI.add(function(){var s=p.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){p.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){k.triggerSave();p.isNotDirty=1;return p.formElement._mceOldSubmit(p.formElement)}}s=null})}function n(){if(q.language&&q.language_load!==false){m.add(k.baseURL+"/langs/"+q.language+".js")}if(q.theme&&typeof q.theme!="function"&&q.theme.charAt(0)!="-"&&!h.urls[q.theme]){h.load(q.theme,"themes/"+q.theme+"/editor_template"+k.suffix+".js")}i(g(q.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(v){var u={prefix:"plugins/",resource:v,suffix:"/editor_plugin"+k.suffix+".js"};v=c.createUrl(u,v);c.load(v.resource,v)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+k.suffix+".js"})}}});m.loadQueue(function(){if(!p.removed){p.init()}})}n()},init:function(){var q,G=this,H=G.settings,D,y,z,C=G.getElement(),p,m,E,v,B,F,x,r=[];k.add(G);H.aria_label=H.aria_label||l.getAttrib(C,"aria-label",G.getLang("aria.rich_text_area"));if(H.theme){if(typeof H.theme!="function"){H.theme=H.theme.replace(/-/,"");p=h.get(H.theme);G.theme=new p();if(G.theme.init){G.theme.init(G,h.urls[H.theme]||k.documentBaseURL.replace(/\/$/,""))}}else{G.theme=H.theme}}function A(s){var t=c.get(s),o=c.urls[s]||k.documentBaseURL.replace(/\/$/,""),n;if(t&&k.inArray(r,s)===-1){i(c.dependencies(s),function(u){A(u)});n=new t(G,o);G.plugins[s]=n;if(n.init){n.init(G,o);r.push(s)}}}i(g(H.plugins.replace(/\-/g,"")),A);if(H.popup_css!==false){if(H.popup_css){H.popup_css=G.documentBaseURI.toAbsolute(H.popup_css)}else{H.popup_css=G.baseURI.toAbsolute("themes/"+H.theme+"/skins/"+H.skin+"/dialog.css")}}if(H.popup_css_add){H.popup_css+=","+G.documentBaseURI.toAbsolute(H.popup_css_add)}G.controlManager=new k.ControlManager(G);G.onBeforeRenderUI.dispatch(G,G.controlManager);if(H.render_ui&&G.theme){G.orgDisplay=C.style.display;if(typeof H.theme!="function"){D=H.width||C.style.width||C.offsetWidth;y=H.height||C.style.height||C.offsetHeight;z=H.min_height||100;F=/^[0-9\.]+(|px)$/i;if(F.test(""+D)){D=Math.max(parseInt(D,10)+(p.deltaWidth||0),100)}if(F.test(""+y)){y=Math.max(parseInt(y,10)+(p.deltaHeight||0),z)}p=G.theme.renderUI({targetNode:C,width:D,height:y,deltaWidth:H.delta_width,deltaHeight:H.delta_height});l.setStyles(p.sizeContainer||p.editorContainer,{width:D,height:y});y=(p.iframeHeight||y)+(typeof(y)=="number"?(p.deltaHeight||0):"");if(y<z){y=z}}else{p=H.theme(G,C);if(p.editorContainer.nodeType){p.editorContainer=p.editorContainer.id=p.editorContainer.id||G.id+"_parent"}if(p.iframeContainer.nodeType){p.iframeContainer=p.iframeContainer.id=p.iframeContainer.id||G.id+"_iframecontainer"}y=p.iframeHeight||C.offsetHeight;if(b){G.onInit.add(function(n){n.dom.bind(n.getBody(),"beforedeactivate keydown",function(){n.lastIERng=n.selection.getRng()})})}}G.editorContainer=p.editorContainer}if(H.content_css){i(g(H.content_css),function(n){G.contentCSS.push(G.documentBaseURI.toAbsolute(n))})}if(H.content_style){G.contentStyles.push(H.content_style)}if(H.content_editable){C=q=p=null;return G.initContentBody()}if(document.domain&&location.hostname!=document.domain){k.relaxedDomain=document.domain}G.iframeHTML=H.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(H.document_base_url!=k.documentBaseURL){G.iframeHTML+='<base href="'+G.documentBaseURI.getURI()+'" />'}if(H.ie7_compat){G.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" />'}else{G.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=edge" />'}G.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';for(x=0;x<G.contentCSS.length;x++){G.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+G.contentCSS[x]+'" />'}G.contentCSS=[];v=H.body_id||"tinymce";if(v.indexOf("=")!=-1){v=G.getParam("body_id","","hash");v=v[G.id]||v}B=H.body_class||"";if(B.indexOf("=")!=-1){B=G.getParam("body_class","","hash");B=B[G.id]||""}G.iframeHTML+='</head><body id="'+v+'" class="mceContentBody '+B+'" onload="window.parent.tinyMCE.get(\''+G.id+"').onLoad.dispatch();\"><br></body></html>";if(k.relaxedDomain&&(b||(k.isOpera&&parseFloat(opera.version())<11))){E='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+G.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody();})()'}q=l.add(p.iframeContainer,"iframe",{id:G.id+"_ifr",src:E||'javascript:""',frameBorder:"0",allowTransparency:"true",title:H.aria_label,style:{width:"100%",height:y,display:"block"}});G.contentAreaContainer=p.iframeContainer;if(p.editorContainer){l.get(p.editorContainer).style.display=G.orgDisplay}C.style.visibility=G.orgVisibility;l.get(G.id).style.display="none";l.setAttrib(G.id,"aria-hidden",true);if(!k.relaxedDomain||!E){G.initContentBody()}C=q=p=null},initContentBody:function(){var n=this,p=n.settings,q=l.get(n.id),r=n.getDoc(),o,m,s;if((!b||!k.relaxedDomain)&&!p.content_editable){r.open();r.write(n.iframeHTML);r.close();if(k.relaxedDomain){r.domain=k.relaxedDomain}}if(p.content_editable){l.addClass(q,"mceContentBody");n.contentDocument=r=p.content_document||document;n.contentWindow=p.content_window||window;n.bodyElement=q;p.content_document=p.content_window=null}m=n.getBody();m.disabled=true;if(!p.readonly){m.contentEditable=n.getParam("content_editable_state",true)}m.disabled=false;n.schema=new k.html.Schema(p);n.dom=new k.dom.DOMUtils(r,{keep_values:true,url_converter:n.convertURL,url_converter_scope:n,hex_colors:p.force_hex_style_colors,class_filter:p.class_filter,update_styles:true,root_element:p.content_editable?n.id:null,schema:n.schema});n.parser=new k.html.DomParser(p,n.schema);n.parser.addAttributeFilter("src,href,style",function(t,u){var v=t.length,y,A=n.dom,z,x;while(v--){y=t[v];z=y.attr(u);x="data-mce-"+u;if(!y.attributes.map[x]){if(u==="style"){y.attr(x,A.serializeStyle(A.parseStyle(z),y.name))}else{y.attr(x,n.convertURL(z,u,y.name))}}}});n.parser.addNodeFilter("script",function(t,u){var v=t.length,x;while(v--){x=t[v];x.attr("type","mce-"+(x.attr("type")||"text/javascript"))}});n.parser.addNodeFilter("#cdata",function(t,u){var v=t.length,x;while(v--){x=t[v];x.type=8;x.name="#comment";x.value="[CDATA["+x.value+"]]"}});n.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(u,v){var x=u.length,y,t=n.schema.getNonEmptyElements();while(x--){y=u[x];if(y.isEmpty(t)){y.empty().append(new k.html.Node("br",1)).shortEnded=true}}});n.serializer=new k.dom.Serializer(p,n.dom,n.schema);n.selection=new k.dom.Selection(n.dom,n.getWin(),n.serializer,n);n.formatter=new k.Formatter(n);n.undoManager=new k.UndoManager(n);n.forceBlocks=new k.ForceBlocks(n);n.enterKey=new k.EnterKey(n);n.editorCommands=new k.EditorCommands(n);n.onExecCommand.add(function(t,u){if(!/^(FontName|FontSize)$/.test(u)){n.nodeChanged()}});n.serializer.onPreProcess.add(function(t,u){return n.onPreProcess.dispatch(n,u,t)});n.serializer.onPostProcess.add(function(t,u){return n.onPostProcess.dispatch(n,u,t)});n.onPreInit.dispatch(n);if(!p.browser_spellcheck&&!p.gecko_spellcheck){r.body.spellcheck=false}if(!p.readonly){n.bindNativeEvents()}n.controlManager.onPostRender.dispatch(n,n.controlManager);n.onPostRender.dispatch(n);n.quirks=k.util.Quirks(n);if(p.directionality){m.dir=p.directionality}if(p.nowrap){m.style.whiteSpace="nowrap"}if(p.protect){n.onBeforeSetContent.add(function(t,u){i(p.protect,function(v){u.content=u.content.replace(v,function(x){return"<!--mce:protected "+escape(x)+"-->"})})})}n.onSetContent.add(function(){n.addVisual(n.getBody())});if(p.padd_empty_editor){n.onPostProcess.add(function(t,u){u.content=u.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}n.load({initial:true,format:"html"});n.startContent=n.getContent({format:"raw"});n.initialized=true;n.onInit.dispatch(n);n.execCallback("setupcontent_callback",n.id,m,r);n.execCallback("init_instance_callback",n);n.focus(true);n.nodeChanged({initial:true});if(n.contentStyles.length>0){s="";i(n.contentStyles,function(t){s+=t+"\r\n"});n.dom.addStyle(s)}i(n.contentCSS,function(t){n.dom.loadCSS(t)});if(p.auto_focus){setTimeout(function(){var t=k.get(p.auto_focus);t.selection.select(t.getBody(),1);t.selection.collapse(1);t.getBody().focus();t.getWin().focus()},100)}q=r=m=null},focus:function(p){var o,u=this,t=u.selection,q=u.settings.content_editable,n,r,s=u.getDoc(),m;if(!p){if(u.lastIERng){t.setRng(u.lastIERng)}n=t.getRng();if(n.item){r=n.item(0)}u._refreshContentEditable();if(!q){u.getWin().focus()}if(k.isGecko||q){m=u.getBody();if(m.setActive){m.setActive()}else{m.focus()}if(q){t.normalize()}}if(r&&r.ownerDocument==s){n=s.body.createControlRange();n.addElement(r);n.select()}}if(k.activeEditor!=u){if((o=k.activeEditor)!=null){o.onDeactivate.dispatch(o,u)}u.onActivate.dispatch(u,o)}k._setActive(u)},execCallback:function(q){var m=this,p=m.settings[q],o;if(!p){return}if(m.callbackLookup&&(o=m.callbackLookup[q])){p=o.func;o=o.scope}if(d(p,"string")){o=p.replace(/\.\w+$/,"");o=o?k.resolve(o):0;p=k.resolve(p);m.callbackLookup=m.callbackLookup||{};m.callbackLookup[q]={func:p,scope:o}}return p.apply(o||m,Array.prototype.slice.call(arguments,1))},translate:function(m){var o=this.settings.language||"en",n=k.i18n;if(!m){return""}return n[o+"."+m]||m.replace(/\{\#([^\}]+)\}/g,function(q,p){return n[o+"."+p]||"{#"+p+"}"})},getLang:function(o,m){return k.i18n[(this.settings.language||"en")+"."+o]||(d(m)?m:"{#"+o+"}")},getParam:function(t,q,m){var r=k.trim,p=d(this.settings[t])?this.settings[t]:q,s;if(m==="hash"){s={};if(d(p,"string")){i(p.indexOf("=")>0?p.split(/[;,](?![^=;,]*(?:[;,]|$))/):p.split(","),function(n){n=n.split("=");if(n.length>1){s[r(n[0])]=r(n[1])}else{s[r(n[0])]=r(n)}})}else{s=p}return s}return p},nodeChanged:function(q){var m=this,n=m.selection,p;if(m.initialized){q=q||{};p=n.getStart()||m.getBody();p=b&&p.ownerDocument!=m.getDoc()?m.getBody():p;q.parents=[];m.dom.getParent(p,function(o){if(o.nodeName=="BODY"){return true}q.parents.push(o)});m.onNodeChange.dispatch(m,q?q.controlManager||m.controlManager:m.controlManager,p,n.isCollapsed(),q)}},addButton:function(n,o){var m=this;m.buttons=m.buttons||{};m.buttons[n]=o},addCommand:function(m,o,n){this.execCommands[m]={func:o,scope:n||this}},addQueryStateHandler:function(m,o,n){this.queryStateCommands[m]={func:o,scope:n||this}},addQueryValueHandler:function(m,o,n){this.queryValueCommands[m]={func:o,scope:n||this}},addShortcut:function(o,q,m,p){var n=this,r;if(n.settings.custom_shortcuts===false){return false}n.shortcuts=n.shortcuts||{};if(d(m,"string")){r=m;m=function(){n.execCommand(r,false,null)}}if(d(m,"object")){r=m;m=function(){n.execCommand(r[0],r[1],r[2])}}i(g(o),function(s){var t={func:m,scope:p||this,desc:n.translate(q),alt:false,ctrl:false,shift:false};i(g(s,"+"),function(u){switch(u){case"alt":case"ctrl":case"shift":t[u]=true;break;default:t.charCode=u.charCodeAt(0);t.keyCode=u.toUpperCase().charCodeAt(0)}});n.shortcuts[(t.ctrl?"ctrl":"")+","+(t.alt?"alt":"")+","+(t.shift?"shift":"")+","+t.keyCode]=t});return true},execCommand:function(u,r,x,m){var p=this,q=0,v,n;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(u)&&(!m||!m.skip_focus)){p.focus()}m=f({},m);p.onBeforeExecCommand.dispatch(p,u,r,x,m);if(m.terminate){return false}if(p.execCallback("execcommand_callback",p.id,p.selection.getNode(),u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);return true}if(v=p.execCommands[u]){n=v.func.call(v.scope,r,x);if(n!==true){p.onExecCommand.dispatch(p,u,r,x,m);return n}}i(p.plugins,function(o){if(o.execCommand&&o.execCommand(u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);q=1;return false}});if(q){return true}if(p.theme&&p.theme.execCommand&&p.theme.execCommand(u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);return true}if(p.editorCommands.execCommand(u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);return true}p.getDoc().execCommand(u,r,x);p.onExecCommand.dispatch(p,u,r,x,m)},queryCommandState:function(q){var n=this,r,p;if(n._isHidden()){return}if(r=n.queryStateCommands[q]){p=r.func.call(r.scope);if(p!==true){return p}}r=n.editorCommands.queryCommandState(q);if(r!==-1){return r}try{return this.getDoc().queryCommandState(q)}catch(m){}},queryCommandValue:function(r){var n=this,q,p;if(n._isHidden()){return}if(q=n.queryValueCommands[r]){p=q.func.call(q.scope);if(p!==true){return p}}q=n.editorCommands.queryCommandValue(r);if(d(q)){return q}try{return this.getDoc().queryCommandValue(r)}catch(m){}},show:function(){var m=this;l.show(m.getContainer());l.hide(m.id);m.load()},hide:function(){var m=this,n=m.getDoc();if(b&&n){n.execCommand("SelectAll")}m.save();l.hide(m.getContainer());l.setStyle(m.id,"display",m.orgDisplay)},isHidden:function(){return !l.isHidden(this.id)},setProgressState:function(m,n,p){this.onSetProgressState.dispatch(this,m,n,p);return m},load:function(q){var m=this,p=m.getElement(),n;if(p){q=q||{};q.load=true;n=m.setContent(d(p.value)?p.value:p.innerHTML,q);q.element=p;if(!q.no_events){m.onLoadContent.dispatch(m,q)}q.element=p=null;return n}},save:function(r){var m=this,q=m.getElement(),n,p;if(!q||!m.initialized){return}r=r||{};r.save=true;r.element=q;n=r.content=m.getContent(r);if(!r.no_events){m.onSaveContent.dispatch(m,r)}n=r.content;if(!/TEXTAREA|INPUT/i.test(q.nodeName)){q.innerHTML=n;if(p=l.getParent(m.id,"form")){i(p.elements,function(o){if(o.name==m.id){o.value=n;return false}})}}else{q.value=n}r.element=q=null;return n},setContent:function(r,p){var o=this,n,m=o.getBody(),q;p=p||{};p.format=p.format||"html";p.set=true;p.content=r;if(!p.no_events){o.onBeforeSetContent.dispatch(o,p)}r=p.content;if(!k.isIE&&(r.length===0||/^\s+$/.test(r))){q=o.settings.forced_root_block;if(q){r="<"+q+'><br data-mce-bogus="1"></'+q+">"}else{r='<br data-mce-bogus="1">'}m.innerHTML=r;o.selection.select(m,true);o.selection.collapse(true);return}if(p.format!=="raw"){r=new k.html.Serializer({},o.schema).serialize(o.parser.parse(r))}p.content=k.trim(r);o.dom.setHTML(m,p.content);if(!p.no_events){o.onSetContent.dispatch(o,p)}if(!o.settings.content_editable||document.activeElement===o.getBody()){o.selection.normalize()}return p.content},getContent:function(o){var n=this,p,m=n.getBody();o=o||{};o.format=o.format||"html";o.get=true;o.getInner=true;if(!o.no_events){n.onBeforeGetContent.dispatch(n,o)}if(o.format=="raw"){p=m.innerHTML}else{if(o.format=="text"){p=m.innerText||m.textContent}else{p=n.serializer.serialize(m,o)}}if(o.format!="text"){o.content=k.trim(p)}else{o.content=p}if(!o.no_events){n.onGetContent.dispatch(n,o)}return o.content},isDirty:function(){var m=this;return k.trim(m.startContent)!=k.trim(m.getContent({format:"raw",no_events:1}))&&!m.isNotDirty},getContainer:function(){var m=this;if(!m.container){m.container=l.get(m.editorContainer||m.id+"_parent")}return m.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return l.get(this.settings.content_element||this.id)},getWin:function(){var m=this,n;if(!m.contentWindow){n=l.get(m.id+"_ifr");if(n){m.contentWindow=n.contentWindow}}return m.contentWindow},getDoc:function(){var m=this,n;if(!m.contentDocument){n=m.getWin();if(n){m.contentDocument=n.document}}return m.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(o,n,q){var m=this,p=m.settings;if(p.urlconverter_callback){return m.execCallback("urlconverter_callback",o,q,true,n)}if(!p.convert_urls||(q&&q.nodeName=="LINK")||o.indexOf("file:")===0){return o}if(p.relative_urls){return m.documentBaseURI.toRelative(o)}o=m.documentBaseURI.toAbsolute(o,p.remove_script_host);return o},addVisual:function(q){var n=this,o=n.settings,p=n.dom,m;q=q||n.getBody();if(!d(n.hasVisual)){n.hasVisual=o.visual}i(p.select("table,a",q),function(s){var r;switch(s.nodeName){case"TABLE":m=o.visual_table_class||"mceItemTable";r=p.getAttrib(s,"border");if(!r||r=="0"){if(n.hasVisual){p.addClass(s,m)}else{p.removeClass(s,m)}}return;case"A":if(!p.getAttrib(s,"href",false)){r=p.getAttrib(s,"name")||s.id;m="mceItemAnchor";if(r){if(n.hasVisual){p.addClass(s,m)}else{p.removeClass(s,m)}}}return}});n.onVisualAid.dispatch(n,q,n.hasVisual)},remove:function(){var m=this,n=m.getContainer();if(!m.removed){m.removed=1;m.hide();if(!m.settings.content_editable){j.unbind(m.getWin());j.unbind(m.getDoc())}j.unbind(m.getBody());j.clear(n);m.execCallback("remove_instance_callback",m);m.onRemove.dispatch(m);m.onExecCommand.listeners=[];k.remove(m);l.remove(n)}},destroy:function(n){var m=this;if(m.destroyed){return}if(a){j.unbind(m.getDoc());j.unbind(m.getWin());j.unbind(m.getBody())}if(!n){k.removeUnload(m.destroy);tinyMCE.onBeforeUnload.remove(m._beforeUnload);if(m.theme&&m.theme.destroy){m.theme.destroy()}m.controlManager.destroy();m.selection.destroy();m.dom.destroy()}if(m.formElement){m.formElement.submit=m.formElement._mceOldSubmit;m.formElement._mceOldSubmit=null}m.contentAreaContainer=m.formElement=m.container=m.settings.content_element=m.bodyElement=m.contentDocument=m.contentWindow=null;if(m.selection){m.selection=m.selection.win=m.selection.dom=m.selection.dom.doc=null}m.destroyed=1},_refreshContentEditable:function(){var n=this,m,o;if(n._isHidden()){m=n.getBody();o=m.parentNode;o.removeChild(m);o.appendChild(m);m.focus()}},_isHidden:function(){var m;if(!a){return 0}m=this.selection.getSel();return(!m||!m.rangeCount||m.rangeCount===0)}})})(tinymce);(function(a){var b=a.each;a.Editor.prototype.setupEvents=function(){var c=this,d=c.settings;b(["onPreInit","onBeforeRenderUI","onPostRender","onLoad","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState","onSetAttrib"],function(e){c[e]=new a.util.Dispatcher(c)});if(d.cleanup_callback){c.onBeforeSetContent.add(function(e,f){f.content=e.execCallback("cleanup_callback","insert_to_editor",f.content,f)});c.onPreProcess.add(function(e,f){if(f.set){e.execCallback("cleanup_callback","insert_to_editor_dom",f.node,f)}if(f.get){e.execCallback("cleanup_callback","get_from_editor_dom",f.node,f)}});c.onPostProcess.add(function(e,f){if(f.set){f.content=e.execCallback("cleanup_callback","insert_to_editor",f.content,f)}if(f.get){f.content=e.execCallback("cleanup_callback","get_from_editor",f.content,f)}})}if(d.save_callback){c.onGetContent.add(function(e,f){if(f.save){f.content=e.execCallback("save_callback",e.id,f.content,e.getBody())}})}if(d.handle_event_callback){c.onEvent.add(function(f,g,h){if(c.execCallback("handle_event_callback",g,f,h)===false){g.preventDefault();g.stopPropagation()}})}if(d.handle_node_change_callback){c.onNodeChange.add(function(f,e,g){f.execCallback("handle_node_change_callback",f.id,g,-1,-1,true,f.selection.isCollapsed())})}if(d.save_callback){c.onSaveContent.add(function(e,g){var f=e.execCallback("save_callback",e.id,g.content,e.getBody());if(f){g.content=f}})}if(d.onchange_callback){c.onChange.add(function(f,e){f.execCallback("onchange_callback",f,e)})}};a.Editor.prototype.bindNativeEvents=function(){var l=this,f,d=l.settings,e=l.dom,h;h={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function c(i,m){var n=i.type;if(l.removed){return}if(l.onEvent.dispatch(l,i,m)!==false){l[h[i.fakeType||i.type]].dispatch(l,i,m)}}function j(i){l.focus(true)}function k(i,m){if(m.keyCode!=65||!a.VK.metaKeyPressed(m)){l.selection.normalize()}l.nodeChanged()}b(h,function(m,n){var i=d.content_editable?l.getBody():l.getDoc();switch(n){case"contextmenu":e.bind(i,n,c);break;case"paste":e.bind(l.getBody(),n,c);break;case"submit":case"reset":e.bind(l.getElement().form||a.DOM.getParent(l.id,"form"),n,c);break;default:e.bind(i,n,c)}});e.bind(d.content_editable?l.getBody():(a.isGecko?l.getDoc():l.getWin()),"focus",function(i){l.focus(true)});if(d.content_editable&&a.isOpera){e.bind(l.getBody(),"click",j);e.bind(l.getBody(),"keydown",j)}l.onMouseUp.add(k);l.onKeyUp.add(function(i,n){var m=n.keyCode;if((m>=33&&m<=36)||(m>=37&&m<=40)||m==13||m==45||m==46||m==8||(a.isMac&&(m==91||m==93))||n.ctrlKey){k(i,n)}});l.onReset.add(function(){l.setContent(l.startContent,{format:"raw"})});function g(m,i){if(m.altKey||m.ctrlKey||m.metaKey){b(l.shortcuts,function(n){var o=a.isMac?m.metaKey:m.ctrlKey;if(n.ctrl!=o||n.alt!=m.altKey||n.shift!=m.shiftKey){return}if(m.keyCode==n.keyCode||(m.charCode&&m.charCode==n.charCode)){m.preventDefault();if(i){n.func.call(n.scope)}return true}})}}l.onKeyUp.add(function(i,m){g(m)});l.onKeyPress.add(function(i,m){g(m)});l.onKeyDown.add(function(i,m){g(m,true)});if(a.isOpera){l.onClick.add(function(i,m){m.preventDefault()})}}})(tinymce);(function(d){var e=d.each,b,a=true,c=false;d.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return c}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return c}function u(v,x){x=x||"exec";e(v,function(z,y){e(y.toLowerCase().split(","),function(A){j[x][A]=z})})}d.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===b){x=c}if(v===b){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:b)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(d.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(c)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);e("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=d.explode(k.font_size_style_values);v=d.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return c}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new d.html.Serializer({},n.schema);v='<span id="mce_marker" data-mce-type="bookmark">\uFEFF</span>';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=p.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.y<L.y)||(C.x>L.x+L.w||C.x<L.x)){H=d.isIE?n.getDoc().documentElement:n.getBody();H.scrollLeft=C.x;H.scrollTop=C.y-L.h+25}x=m.createRng();A=D.previousSibling;if(A&&A.nodeType==3){x.setStart(A,A.nodeValue.length)}else{x.setStartBefore(D);x.setEndBefore(D)}m.remove(D);p.setRng(x);p.onSetContent.dispatch(p,G);n.addVisual()},mceInsertRawHTML:function(y,x,v){p.setContent("tiny_mce_marker");n.setContent(n.getContent().replace(/tiny_mce_marker/g,function(){return v}))},mceToggleFormat:function(y,x,v){s(v)},mceSetContent:function(y,x,v){n.setContent(v)},"Indent,Outdent":function(z){var x,v,y;x=k.indentation;v=/[a-z%]+$/i.exec(x);x=parseInt(x);if(!l("InsertUnorderedList")&&!l("InsertOrderedList")){if(!k.forced_root_block&&!m.getParent(p.getNode(),m.isBlock)){q.apply("div")}e(p.getSelectedBlocks(),function(A){if(z=="outdent"){y=Math.max(0,parseInt(A.style.paddingLeft||0)-x);m.setStyle(A,"paddingLeft",y?y+v:"")}else{m.setStyle(A,"paddingLeft",(parseInt(A.style.paddingLeft||0)+x)+v)}})}else{f(z)}},mceRepaint:function(){var x;if(d.isGecko){try{i(a);if(p.getSel()){p.getSel().selectAllChildren(n.getBody())}p.collapse(a);g()}catch(v){}}},mceToggleFormat:function(y,x,v){q.toggle(v)},InsertHorizontalRule:function(){n.execCommand("mceInsertContent",false,"<hr />")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();if(p.getRng().setStart){v.setStart(x,0);v.setEnd(x,x.childNodes.length);p.setRng(v)}else{f("SelectAll")}}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(z){var x="align"+z.substring(7);var v=p.isCollapsed()?[m.getParent(p.getNode(),m.isBlock)]:p.getSelectedBlocks();var y=d.map(v,function(A){return !!q.matchNode(A,x)});return d.inArray(y,a)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(x){var v=m.getParent(p.getNode(),"ul,ol");return v&&(x==="insertunorderedlist"&&v.tagName==="UL"||x==="insertorderedlist"&&v.tagName==="OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(h){var l,i=0,e=[],g,k,j,f;function c(){return b.trim(h.getContent({format:"raw",no_events:1}).replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g,""))}function d(){l.typing=false;l.add()}onBeforeAdd=new a(l);k=new a(l);j=new a(l);f=new a(l);k.add(function(m,n){if(m.hasUndo()){return h.onChange.dispatch(h,n,m)}});j.add(function(m,n){return h.onUndo.dispatch(h,n,m)});f.add(function(m,n){return h.onRedo.dispatch(h,n,m)});h.onInit.add(function(){l.add()});h.onBeforeExecCommand.add(function(m,p,o,q,n){if(p!="Undo"&&p!="Redo"&&p!="mceRepaint"&&(!n||!n.skip_undo)){l.beforeChange()}});h.onExecCommand.add(function(m,p,o,q,n){if(p!="Undo"&&p!="Redo"&&p!="mceRepaint"&&(!n||!n.skip_undo)){l.add()}});h.onSaveContent.add(d);h.dom.bind(h.dom.getRoot(),"dragend",d);h.dom.bind(h.getDoc(),b.isGecko?"blur":"focusout",function(m){if(!h.removed&&l.typing){d()}});h.onKeyUp.add(function(m,o){var n=o.keyCode;if((n>=33&&n<=36)||(n>=37&&n<=40)||n==45||n==13||o.ctrlKey){d()}});h.onKeyDown.add(function(m,o){var n=o.keyCode;if((n>=33&&n<=36)||(n>=37&&n<=40)||n==45){if(l.typing){d()}return}if((n<16||n>20)&&n!=224&&n!=91&&!l.typing){l.beforeChange();l.typing=true;l.add()}});h.onMouseDown.add(function(m,n){if(l.typing){d()}});h.addShortcut("ctrl+z","undo_desc","Undo");h.addShortcut("ctrl+y","redo_desc","Redo");l={data:e,typing:false,onBeforeAdd:onBeforeAdd,onAdd:k,onUndo:j,onRedo:f,beforeChange:function(){g=h.selection.getBookmark(2,true)},add:function(p){var m,n=h.settings,o;p=p||{};p.content=c();l.onBeforeAdd.dispatch(l,p);o=e[i];if(o&&o.content==p.content){return null}if(e[i]){e[i].beforeBookmark=g}if(n.custom_undo_redo_levels){if(e.length>n.custom_undo_redo_levels){for(m=0;m<e.length-1;m++){e[m]=e[m+1]}e.length--;i=e.length}}p.bookmark=h.selection.getBookmark(2,true);if(i<e.length-1){e.length=i+1}e.push(p);i=e.length-1;l.onAdd.dispatch(l,p);h.isNotDirty=0;return p},undo:function(){var n,m;if(l.typing){l.add();l.typing=false}if(i>0){n=e[--i];h.setContent(n.content,{format:"raw"});h.selection.moveToBookmark(n.beforeBookmark);l.onUndo.dispatch(l,n)}return n},redo:function(){var m;if(i<e.length-1){m=e[++i];h.setContent(m.content,{format:"raw"});h.selection.moveToBookmark(m.bookmark);l.onRedo.dispatch(l,m)}return m},clear:function(){e=[];i=0;l.typing=false},hasUndo:function(){return i>0||this.typing},hasRedo:function(){return i<e.length-1&&!this.typing}};return l}})(tinymce);tinymce.ForceBlocks=function(c){var b=c.settings,e=c.dom,a=c.selection,d=c.schema.getBlockElements();function f(){var j=a.getStart(),h=c.getBody(),g,k,o,s,q,i,l,m=-16777215,p,r;if(!j||j.nodeType!==1||!b.forced_root_block){return}while(j&&j!=h){if(d[j.nodeName]){return}j=j.parentNode}g=a.getRng();if(g.setStart){k=g.startContainer;o=g.startOffset;s=g.endContainer;q=g.endOffset}else{if(g.item){j=g.item(0);g=c.getDoc().body.createTextRange();g.moveToElementText(j)}r=g.parentElement().ownerDocument===c.getDoc();tmpRng=g.duplicate();tmpRng.collapse(true);o=tmpRng.move("character",m)*-1;if(!tmpRng.collapsed){tmpRng=g.duplicate();tmpRng.collapse(false);q=(tmpRng.move("character",m)*-1)-o}}j=h.firstChild;while(j){if(j.nodeType===3||(j.nodeType==1&&!d[j.nodeName])){if(j.nodeType===3&&j.nodeValue.length==0){l=j;j=j.nextSibling;e.remove(l);continue}if(!i){i=e.create(b.forced_root_block);j.parentNode.insertBefore(i,j);p=true}l=j;j=j.nextSibling;i.appendChild(l)}else{i=null;j=j.nextSibling}}if(p){if(g.setStart){g.setStart(k,o);g.setEnd(s,q);a.setRng(g)}else{if(r){try{g=c.getDoc().body.createTextRange();g.moveToElementText(h);g.collapse(true);g.moveStart("character",o);if(q>0){g.moveEnd("character",q)}g.select()}catch(n){}}}c.nodeChanged()}}if(b.forced_root_block){c.onKeyUp.add(f);c.onNodeChange.add(f)}};(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(j){var o,k,g,h=this,m=h.editor,n,f;if(!h.controlFactories){h.controlFactories=[];d(m.plugins,function(i){if(i.createControl){h.controlFactories.push(i)}})}n=h.controlFactories;for(k=0,g=n.length;k<g;k++){o=n[k].createControl(j,h);if(o){return h.add(o)}}if(j==="|"||j==="separator"){return h.createSeparator()}if(m.buttons&&(o=m.buttons[j])){return h.createButton(j,o)}return h.add(o)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}n["class"]+=i.settings.directionality=="rtl"?" mceRtl":"";f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){if(p.cmd){i.execCommand(p.cmd,p.ui||false,p.value)}}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(f,n,h){var l=this,j=l.editor,i,k,m;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,scope:n.scope,control_manager:l},n);f=l.prefix+f;function g(o){return o.settings.use_accessible_selects&&!c.isGecko}if(j.settings.use_native_selects||g(j)){k=new c.ui.NativeListBox(f,n)}else{m=h||l._cls.listbox||c.ui.ListBox;k=new m(f,n,j)}l.controls[f]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){j.bookmark=j.selection.getBookmark(1)});a.add(o,"focus",function(){j.selection.moveToBookmark(j.bookmark);j.bookmark=null})})}if(k.hideMenu){j.onMouseDown.add(k.hideMenu,k)}return l.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i,g);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i,g)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i,g));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n,j);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h,g.editor);if(g.get(k)){return null}return g.add(i)},createToolbarGroup:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||this._cls.toolbarGroup||c.ui.ToolbarGroup;i=new f(k,h,g.editor);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},resizeBy:function(f,g,h){h.resizeBy(f,g)},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.Formatter=function(aa){var Q={},T=a.each,c=aa.dom,r=aa.selection,t=a.dom.TreeWalker,N=new a.dom.RangeUtils(c),d=aa.schema.isValidChild,H=c.isBlock,m=aa.settings.forced_root_block,s=c.nodeIndex,G="\uFEFF",e=/^(src|href|style)$/,X=false,C=true,P,D,x=c.getContentEditable;function A(ab){return ab instanceof Array}function n(ac,ab){return c.getParents(ac,ab,c.getRoot())}function b(ab){return ab.nodeType===1&&ab.id==="_mce_caret"}function j(){l({alignleft:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"},defaultBlock:"div"},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"},defaultBlock:"div"},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"},defaultBlock:"div"},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"},defaultBlock:"div"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(ab){return true},onformat:function(ad,ab,ac){T(ac,function(af,ae){c.setAttrib(ad,ae,af)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});T("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(ab){l(ab,{block:ab,remove:"all"})});l(aa.settings.formats)}function W(){aa.addShortcut("ctrl+b","bold_desc","Bold");aa.addShortcut("ctrl+i","italic_desc","Italic");aa.addShortcut("ctrl+u","underline_desc","Underline");for(var ab=1;ab<=6;ab++){aa.addShortcut("ctrl+"+ab,"",["FormatBlock",false,"h"+ab])}aa.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);aa.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);aa.addShortcut("ctrl+9","",["FormatBlock",false,"address"])}function V(ab){return ab?Q[ab]:Q}function l(ab,ac){if(ab){if(typeof(ab)!=="string"){T(ab,function(ae,ad){l(ad,ae)})}else{ac=ac.length?ac:[ac];T(ac,function(ad){if(ad.deep===D){ad.deep=!ad.selector}if(ad.split===D){ad.split=!ad.selector||ad.inline}if(ad.remove===D&&ad.selector&&!ad.inline){ad.remove="none"}if(ad.selector&&ad.inline){ad.mixed=true;ad.block_expand=true}if(typeof(ad.classes)==="string"){ad.classes=ad.classes.split(/\s+/)}});Q[ab]=ac}}}var i=function(ac){var ab;aa.dom.getParent(ac,function(ad){ab=aa.dom.getStyle(ad,"text-decoration");return ab&&ab!=="none"});return ab};var L=function(ab){var ac;if(ab.nodeType===1&&ab.parentNode&&ab.parentNode.nodeType===1){ac=i(ab.parentNode);if(aa.dom.getStyle(ab,"color")&&ac){aa.dom.setStyle(ab,"text-decoration",ac)}else{if(aa.dom.getStyle(ab,"textdecoration")===ac){aa.dom.setStyle(ab,"text-decoration",null)}}}};function Y(ae,al,ag){var ah=V(ae),am=ah[0],ak,ac,aj,ai=r.isCollapsed();function ab(aq,ap){ap=ap||am;if(aq){if(ap.onformat){ap.onformat(aq,ap,al,ag)}T(ap.styles,function(at,ar){c.setStyle(aq,ar,q(at,al))});T(ap.attributes,function(at,ar){c.setAttrib(aq,ar,q(at,al))});T(ap.classes,function(ar){ar=q(ar,al);if(!c.hasClass(aq,ar)){c.addClass(aq,ar)}})}}function af(){function ar(ay,aw){var ax=new t(aw);for(ag=ax.current();ag;ag=ax.prev()){if(ag.childNodes.length>1||ag==ay||ag.tagName=="BR"){return ag}}}var aq=aa.selection.getRng();var av=aq.startContainer;var ap=aq.endContainer;if(av!=ap&&aq.endOffset===0){var au=ar(av,ap);var at=au.nodeType==3?au.length:au.childNodes.length;aq.setEnd(au,at)}return aq}function ad(at,ay,aw,av,aq){var ap=[],ar=-1,ax,aA=-1,au=-1,az;T(at.childNodes,function(aC,aB){if(aC.nodeName==="UL"||aC.nodeName==="OL"){ar=aB;ax=aC;return false}});T(at.childNodes,function(aC,aB){if(aC.nodeName==="SPAN"&&c.getAttrib(aC,"data-mce-type")=="bookmark"){if(aC.id==ay.id+"_start"){aA=aB}else{if(aC.id==ay.id+"_end"){au=aB}}}});if(ar<=0||(aA<ar&&au>ar)){T(a.grep(at.childNodes),aq);return 0}else{az=c.clone(aw,X);T(a.grep(at.childNodes),function(aC,aB){if((aA<ar&&aB<ar)||(aA>ar&&aB>ar)){ap.push(aC);aC.parentNode.removeChild(aC)}});if(aA<ar){at.insertBefore(az,ax)}else{if(aA>ar){at.insertBefore(az,ax.nextSibling)}}av.push(az);T(ap,function(aB){az.appendChild(aB)});return az}}function an(aq,at,aw){var ap=[],av,ar,au=true;av=am.inline||am.block;ar=c.create(av);ab(ar);N.walk(aq,function(ax){var ay;function az(aA){var aF,aD,aB,aC,aE;aE=au;aF=aA.nodeName.toLowerCase();aD=aA.parentNode.nodeName.toLowerCase();if(aA.nodeType===1&&x(aA)){aE=au;au=x(aA)==="true";aC=true}if(g(aF,"br")){ay=0;if(am.block){c.remove(aA)}return}if(am.wrapper&&y(aA,ae,al)){ay=0;return}if(au&&!aC&&am.block&&!am.wrapper&&I(aF)){aA=c.rename(aA,av);ab(aA);ap.push(aA);ay=0;return}if(am.selector){T(ah,function(aG){if("collapsed" in aG&&aG.collapsed!==ai){return}if(c.is(aA,aG.selector)&&!b(aA)){ab(aA,aG);aB=true}});if(!am.inline||aB){ay=0;return}}if(au&&!aC&&d(av,aF)&&d(aD,av)&&!(!aw&&aA.nodeType===3&&aA.nodeValue.length===1&&aA.nodeValue.charCodeAt(0)===65279)&&!b(aA)){if(!ay){ay=c.clone(ar,X);aA.parentNode.insertBefore(ay,aA);ap.push(ay)}ay.appendChild(aA)}else{if(aF=="li"&&at){ay=ad(aA,at,ar,ap,az)}else{ay=0;T(a.grep(aA.childNodes),az);if(aC){au=aE}ay=0}}}T(ax,az)});if(am.wrap_links===false){T(ap,function(ax){function ay(aC){var aB,aA,az;if(aC.nodeName==="A"){aA=c.clone(ar,X);ap.push(aA);az=a.grep(aC.childNodes);for(aB=0;aB<az.length;aB++){aA.appendChild(az[aB])}aC.appendChild(aA)}T(a.grep(aC.childNodes),ay)}ay(ax)})}T(ap,function(az){var ax;function aA(aC){var aB=0;T(aC.childNodes,function(aD){if(!f(aD)&&!K(aD)){aB++}});return aB}function ay(aB){var aD,aC;T(aB.childNodes,function(aE){if(aE.nodeType==1&&!K(aE)&&!b(aE)){aD=aE;return X}});if(aD&&h(aD,am)){aC=c.clone(aD,X);ab(aC);c.replace(aC,aB,C);c.remove(aD,1)}return aC||aB}ax=aA(az);if((ap.length>1||!H(az))&&ax===0){c.remove(az,1);return}if(am.inline||am.wrapper){if(!am.exact&&ax===1){az=ay(az)}T(ah,function(aB){T(c.select(aB.inline,az),function(aD){var aC;if(aB.wrap_links===false){aC=aD.parentNode;do{if(aC.nodeName==="A"){return}}while(aC=aC.parentNode)}Z(aB,al,aD,aB.exact?aD:null)})});if(y(az.parentNode,ae,al)){c.remove(az,1);az=0;return C}if(am.merge_with_parents){c.getParent(az.parentNode,function(aB){if(y(aB,ae,al)){c.remove(az,1);az=0;return C}})}if(az&&am.merge_siblings!==false){az=u(E(az),az);az=u(az,E(az,C))}}})}if(am){if(ag){if(ag.nodeType){ac=c.createRng();ac.setStartBefore(ag);ac.setEndAfter(ag);an(p(ac,ah),null,true)}else{an(ag,null,true)}}else{if(!ai||!am.inline||c.select("td.mceSelected,th.mceSelected").length){var ao=aa.selection.getNode();if(!m&&ah[0].defaultBlock&&!c.getParent(ao,c.isBlock)){Y(ah[0].defaultBlock)}aa.selection.setRng(af());ak=r.getBookmark();an(p(r.getRng(C),ah),ak);if(am.styles&&(am.styles.color||am.styles.textDecoration)){a.walk(ao,L,"childNodes");L(ao)}r.moveToBookmark(ak);R(r.getRng(C));aa.nodeChanged()}else{U("apply",ae,al)}}}}function B(ad,am,af){var ag=V(ad),ao=ag[0],ak,aj,ac,al=true;function ae(av){var au,at,ar,aq,ax,aw;if(av.nodeType===1&&x(av)){ax=al;al=x(av)==="true";aw=true}au=a.grep(av.childNodes);if(al&&!aw){for(at=0,ar=ag.length;at<ar;at++){if(Z(ag[at],am,av,av)){break}}}if(ao.deep){if(au.length){for(at=0,ar=au.length;at<ar;at++){ae(au[at])}if(aw){al=ax}}}}function ah(aq){var ar;T(n(aq.parentNode).reverse(),function(at){var au;if(!ar&&at.id!="_start"&&at.id!="_end"){au=y(at,ad,am);if(au&&au.split!==false){ar=at}}});return ar}function ab(au,aq,aw,az){var aA,ay,ax,at,av,ar;if(au){ar=au.parentNode;for(aA=aq.parentNode;aA&&aA!=ar;aA=aA.parentNode){ay=c.clone(aA,X);for(av=0;av<ag.length;av++){if(Z(ag[av],am,ay,ay)){ay=0;break}}if(ay){if(ax){ay.appendChild(ax)}if(!at){at=ay}ax=ay}}if(az&&(!ao.mixed||!H(au))){aq=c.split(au,aq)}if(ax){aw.parentNode.insertBefore(ax,aw);at.appendChild(aw)}}return aq}function an(aq){return ab(ah(aq),aq,aq,true)}function ai(at){var ar=c.get(at?"_start":"_end"),aq=ar[at?"firstChild":"lastChild"];if(K(aq)){aq=aq[at?"firstChild":"lastChild"]}c.remove(ar,true);return aq}function ap(aq){var at,au,ar;aq=p(aq,ag,C);if(ao.split){at=M(aq,C);au=M(aq);if(at!=au){if(/^(TR|TD)$/.test(at.nodeName)&&at.firstChild){at=(at.nodeName=="TD"?at.firstChild:at.firstChild.firstChild)||at}at=S(at,"span",{id:"_start","data-mce-type":"bookmark"});au=S(au,"span",{id:"_end","data-mce-type":"bookmark"});an(at);an(au);at=ai(C);au=ai()}else{at=au=an(at)}aq.startContainer=at.parentNode;aq.startOffset=s(at);aq.endContainer=au.parentNode;aq.endOffset=s(au)+1}N.walk(aq,function(av){T(av,function(aw){ae(aw);if(aw.nodeType===1&&aa.dom.getStyle(aw,"text-decoration")==="underline"&&aw.parentNode&&i(aw.parentNode)==="underline"){Z({deep:false,exact:true,inline:"span",styles:{textDecoration:"underline"}},null,aw)}})})}if(af){if(af.nodeType){ac=c.createRng();ac.setStartBefore(af);ac.setEndAfter(af);ap(ac)}else{ap(af)}return}if(!r.isCollapsed()||!ao.inline||c.select("td.mceSelected,th.mceSelected").length){ak=r.getBookmark();ap(r.getRng(C));r.moveToBookmark(ak);if(ao.inline&&k(ad,am,r.getStart())){R(r.getRng(true))}aa.nodeChanged()}else{U("remove",ad,am)}}function F(ac,ae,ad){var ab=V(ac);if(k(ac,ae,ad)&&(!("toggle" in ab[0])||ab[0].toggle)){B(ac,ae,ad)}else{Y(ac,ae,ad)}}function y(ac,ab,ah,af){var ad=V(ab),ai,ag,ae;function aj(an,ap,aq){var am,ao,ak=ap[aq],al;if(ap.onmatch){return ap.onmatch(an,ap,aq)}if(ak){if(ak.length===D){for(am in ak){if(ak.hasOwnProperty(am)){if(aq==="attributes"){ao=c.getAttrib(an,am)}else{ao=O(an,am)}if(af&&!ao&&!ap.exact){return}if((!af||ap.exact)&&!g(ao,q(ak[am],ah))){return}}}}else{for(al=0;al<ak.length;al++){if(aq==="attributes"?c.getAttrib(an,ak[al]):O(an,ak[al])){return ap}}}}return ap}if(ad&&ac){for(ag=0;ag<ad.length;ag++){ai=ad[ag];if(h(ac,ai)&&aj(ac,ai,"attributes")&&aj(ac,ai,"styles")){if(ae=ai.classes){for(ag=0;ag<ae.length;ag++){if(!c.hasClass(ac,ae[ag])){return}}}return ai}}}}function k(ad,af,ae){var ac;function ab(ag){ag=c.getParent(ag,function(ah){return !!y(ah,ad,af,true)});return y(ag,ad,af)}if(ae){return ab(ae)}ae=r.getNode();if(ab(ae)){return C}ac=r.getStart();if(ac!=ae){if(ab(ac)){return C}}return X}function v(ai,ah){var af,ag=[],ae={},ad,ac,ab;af=r.getStart();c.getParent(af,function(al){var ak,aj;for(ak=0;ak<ai.length;ak++){aj=ai[ak];if(!ae[aj]&&y(al,aj,ah)){ae[aj]=true;ag.push(aj)}}},c.getRoot());return ag}function z(af){var ah=V(af),ae,ad,ag,ac,ab;if(ah){ae=r.getStart();ad=n(ae);for(ac=ah.length-1;ac>=0;ac--){ab=ah[ac].selector;if(!ab){return C}for(ag=ad.length-1;ag>=0;ag--){if(c.is(ad[ag],ab)){return C}}}}return X}function J(ab,ae,ac){var ad;if(!P){P={};ad={};aa.onNodeChange.addToTop(function(ag,af,ai){var ah=n(ai),aj={};T(P,function(ak,al){T(ah,function(am){if(y(am,al,{},ak.similar)){if(!ad[al]){T(ak,function(an){an(true,{node:am,format:al,parents:ah})});ad[al]=ak}aj[al]=ak;return false}})});T(ad,function(ak,al){if(!aj[al]){delete ad[al];T(ak,function(am){am(false,{node:ai,format:al,parents:ah})})}})})}T(ab.split(","),function(af){if(!P[af]){P[af]=[];P[af].similar=ac}P[af].push(ae)});return this}a.extend(this,{get:V,register:l,apply:Y,remove:B,toggle:F,match:k,matchAll:v,matchNode:y,canApply:z,formatChanged:J});j();W();function h(ab,ac){if(g(ab,ac.inline)){return C}if(g(ab,ac.block)){return C}if(ac.selector){return c.is(ab,ac.selector)}}function g(ac,ab){ac=ac||"";ab=ab||"";ac=""+(ac.nodeName||ac);ab=""+(ab.nodeName||ab);return ac.toLowerCase()==ab.toLowerCase()}function O(ac,ab){var ad=c.getStyle(ac,ab);if(ab=="color"||ab=="backgroundColor"){ad=c.toHex(ad)}if(ab=="fontWeight"&&ad==700){ad="bold"}return""+ad}function q(ab,ac){if(typeof(ab)!="string"){ab=ab(ac)}else{if(ac){ab=ab.replace(/%(\w+)/g,function(ae,ad){return ac[ad]||ae})}}return ab}function f(ab){return ab&&ab.nodeType===3&&/^([\t \r\n]+|)$/.test(ab.nodeValue)}function S(ad,ac,ab){var ae=c.create(ac,ab);ad.parentNode.insertBefore(ae,ad);ae.appendChild(ad);return ae}function p(ab,am,ae){var ap,an,ah,al,ad=ab.startContainer,ai=ab.startOffset,ar=ab.endContainer,ak=ab.endOffset;function ao(az){var au,ax,ay,aw,av,at;au=ax=az?ad:ar;av=az?"previousSibling":"nextSibling";at=c.getRoot();if(au.nodeType==3&&!f(au)){if(az?ai>0:ak<au.nodeValue.length){return au}}for(;;){if(!am[0].block_expand&&H(ax)){return ax}for(aw=ax[av];aw;aw=aw[av]){if(!K(aw)&&!f(aw)){return ax}}if(ax.parentNode==at){au=ax;break}ax=ax.parentNode}return au}function ag(at,au){if(au===D){au=at.nodeType===3?at.length:at.childNodes.length}while(at&&at.hasChildNodes()){at=at.childNodes[au];if(at){au=at.nodeType===3?at.length:at.childNodes.length}}return{node:at,offset:au}}if(ad.nodeType==1&&ad.hasChildNodes()){an=ad.childNodes.length-1;ad=ad.childNodes[ai>an?an:ai];if(ad.nodeType==3){ai=0}}if(ar.nodeType==1&&ar.hasChildNodes()){an=ar.childNodes.length-1;ar=ar.childNodes[ak>an?an:ak-1];if(ar.nodeType==3){ak=ar.nodeValue.length}}function aq(au){var at=au;while(at){if(at.nodeType===1&&x(at)){return x(at)==="false"?at:au}at=at.parentNode}return au}function aj(au,ay,aA){var ax,av,az,at;function aw(aC,aE){var aF,aB,aD=aC.nodeValue;if(typeof(aE)=="undefined"){aE=aA?aD.length:0}if(aA){aF=aD.lastIndexOf(" ",aE);aB=aD.lastIndexOf("\u00a0",aE);aF=aF>aB?aF:aB;if(aF!==-1&&!ae){aF++}}else{aF=aD.indexOf(" ",aE);aB=aD.indexOf("\u00a0",aE);aF=aF!==-1&&(aB===-1||aF<aB)?aF:aB}return aF}if(au.nodeType===3){az=aw(au,ay);if(az!==-1){return{container:au,offset:az}}at=au}ax=new t(au,c.getParent(au,H)||aa.getBody());while(av=ax[aA?"prev":"next"]()){if(av.nodeType===3){at=av;az=aw(av);if(az!==-1){return{container:av,offset:az}}}else{if(H(av)){break}}}if(at){if(aA){ay=0}else{ay=at.length}return{container:at,offset:ay}}}function af(au,at){var av,aw,ay,ax;if(au.nodeType==3&&au.nodeValue.length===0&&au[at]){au=au[at]}av=n(au);for(aw=0;aw<av.length;aw++){for(ay=0;ay<am.length;ay++){ax=am[ay];if("collapsed" in ax&&ax.collapsed!==ab.collapsed){continue}if(c.is(av[aw],ax.selector)){return av[aw]}}}return au}function ac(au,at,aw){var av;if(!am[0].wrapper){av=c.getParent(au,am[0].block)}if(!av){av=c.getParent(au.nodeType==3?au.parentNode:au,H)}if(av&&am[0].wrapper){av=n(av,"ul,ol").reverse()[0]||av}if(!av){av=au;while(av[at]&&!H(av[at])){av=av[at];if(g(av,"br")){break}}}return av||au}ad=aq(ad);ar=aq(ar);if(K(ad.parentNode)||K(ad)){ad=K(ad)?ad:ad.parentNode;ad=ad.nextSibling||ad;if(ad.nodeType==3){ai=0}}if(K(ar.parentNode)||K(ar)){ar=K(ar)?ar:ar.parentNode;ar=ar.previousSibling||ar;if(ar.nodeType==3){ak=ar.length}}if(am[0].inline){if(ab.collapsed){al=aj(ad,ai,true);if(al){ad=al.container;ai=al.offset}al=aj(ar,ak);if(al){ar=al.container;ak=al.offset}}ah=ag(ar,ak);if(ah.node){while(ah.node&&ah.offset===0&&ah.node.previousSibling){ah=ag(ah.node.previousSibling)}if(ah.node&&ah.offset>0&&ah.node.nodeType===3&&ah.node.nodeValue.charAt(ah.offset-1)===" "){if(ah.offset>1){ar=ah.node;ar.splitText(ah.offset-1)}}}}if(am[0].inline||am[0].block_expand){if(!am[0].inline||(ad.nodeType!=3||ai===0)){ad=ao(true)}if(!am[0].inline||(ar.nodeType!=3||ak===ar.nodeValue.length)){ar=ao()}}if(am[0].selector&&am[0].expand!==X&&!am[0].inline){ad=af(ad,"previousSibling");ar=af(ar,"nextSibling")}if(am[0].block||am[0].selector){ad=ac(ad,"previousSibling");ar=ac(ar,"nextSibling");if(am[0].block){if(!H(ad)){ad=ao(true)}if(!H(ar)){ar=ao()}}}if(ad.nodeType==1){ai=s(ad);ad=ad.parentNode}if(ar.nodeType==1){ak=s(ar)+1;ar=ar.parentNode}return{startContainer:ad,startOffset:ai,endContainer:ar,endOffset:ak}}function Z(ah,ag,ae,ab){var ad,ac,af;if(!h(ae,ah)){return X}if(ah.remove!="all"){T(ah.styles,function(aj,ai){aj=q(aj,ag);if(typeof(ai)==="number"){ai=aj;ab=0}if(!ab||g(O(ab,ai),aj)){c.setStyle(ae,ai,"")}af=1});if(af&&c.getAttrib(ae,"style")==""){ae.removeAttribute("style");ae.removeAttribute("data-mce-style")}T(ah.attributes,function(ak,ai){var aj;ak=q(ak,ag);if(typeof(ai)==="number"){ai=ak;ab=0}if(!ab||g(c.getAttrib(ab,ai),ak)){if(ai=="class"){ak=c.getAttrib(ae,ai);if(ak){aj="";T(ak.split(/\s+/),function(al){if(/mce\w+/.test(al)){aj+=(aj?" ":"")+al}});if(aj){c.setAttrib(ae,ai,aj);return}}}if(ai=="class"){ae.removeAttribute("className")}if(e.test(ai)){ae.removeAttribute("data-mce-"+ai)}ae.removeAttribute(ai)}});T(ah.classes,function(ai){ai=q(ai,ag);if(!ab||c.hasClass(ab,ai)){c.removeClass(ae,ai)}});ac=c.getAttribs(ae);for(ad=0;ad<ac.length;ad++){if(ac[ad].nodeName.indexOf("_")!==0){return X}}}if(ah.remove!="none"){o(ae,ah);return C}}function o(ad,ae){var ab=ad.parentNode,ac;function af(ah,ag,ai){ah=E(ah,ag,ai);return !ah||(ah.nodeName=="BR"||H(ah))}if(ae.block){if(!m){if(H(ad)&&!H(ab)){if(!af(ad,X)&&!af(ad.firstChild,C,1)){ad.insertBefore(c.create("br"),ad.firstChild)}if(!af(ad,C)&&!af(ad.lastChild,X,1)){ad.appendChild(c.create("br"))}}}else{if(ab==c.getRoot()){if(!ae.list_block||!g(ad,ae.list_block)){T(a.grep(ad.childNodes),function(ag){if(d(m,ag.nodeName.toLowerCase())){if(!ac){ac=S(ag,m)}else{ac.appendChild(ag)}}else{ac=0}})}}}}if(ae.selector&&ae.inline&&!g(ae.inline,ad)){return}c.remove(ad,1)}function E(ac,ab,ad){if(ac){ab=ab?"nextSibling":"previousSibling";for(ac=ad?ac:ac[ab];ac;ac=ac[ab]){if(ac.nodeType==1||!f(ac)){return ac}}}}function K(ab){return ab&&ab.nodeType==1&&ab.getAttribute("data-mce-type")=="bookmark"}function u(af,ae){var ab,ad,ac;function ah(ak,aj){if(ak.nodeName!=aj.nodeName){return X}function ai(am){var an={};T(c.getAttribs(am),function(ao){var ap=ao.nodeName.toLowerCase();if(ap.indexOf("_")!==0&&ap!=="style"){an[ap]=c.getAttrib(am,ap)}});return an}function al(ap,ao){var an,am;for(am in ap){if(ap.hasOwnProperty(am)){an=ao[am];if(an===D){return X}if(ap[am]!=an){return X}delete ao[am]}}for(am in ao){if(ao.hasOwnProperty(am)){return X}}return C}if(!al(ai(ak),ai(aj))){return X}if(!al(c.parseStyle(c.getAttrib(ak,"style")),c.parseStyle(c.getAttrib(aj,"style")))){return X}return C}function ag(aj,ai){for(ad=aj;ad;ad=ad[ai]){if(ad.nodeType==3&&ad.nodeValue.length!==0){return aj}if(ad.nodeType==1&&!K(ad)){return ad}}return aj}if(af&&ae){af=ag(af,"previousSibling");ae=ag(ae,"nextSibling");if(ah(af,ae)){for(ad=af.nextSibling;ad&&ad!=ae;){ac=ad;ad=ad.nextSibling;af.appendChild(ac)}c.remove(ae);T(a.grep(ae.childNodes),function(ai){af.appendChild(ai)});return af}}return ae}function I(ab){return/^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(ab)}function M(ac,ag){var ab,af,ad,ae;ab=ac[ag?"startContainer":"endContainer"];af=ac[ag?"startOffset":"endOffset"];if(ab.nodeType==1){ad=ab.childNodes.length-1;if(!ag&&af){af--}ab=ab.childNodes[af>ad?ad:af]}if(ab.nodeType===3&&ag&&af>=ab.nodeValue.length){ab=new t(ab,aa.getBody()).next()||ab}if(ab.nodeType===3&&!ag&&af===0){ab=new t(ab,aa.getBody()).prev()||ab}return ab}function U(ak,ab,ai){var al="_mce_caret",ac=aa.settings.caret_debug;function ad(ap){var ao=c.create("span",{id:al,"data-mce-bogus":true,style:ac?"color:red":""});if(ap){ao.appendChild(aa.getDoc().createTextNode(G))}return ao}function aj(ap,ao){while(ap){if((ap.nodeType===3&&ap.nodeValue!==G)||ap.childNodes.length>1){return false}if(ao&&ap.nodeType===1){ao.push(ap)}ap=ap.firstChild}return true}function ag(ao){while(ao){if(ao.id===al){return ao}ao=ao.parentNode}}function af(ao){var ap;if(ao){ap=new t(ao,ao);for(ao=ap.current();ao;ao=ap.next()){if(ao.nodeType===3){return ao}}}}function ae(aq,ap){var ar,ao;if(!aq){aq=ag(r.getStart());if(!aq){while(aq=c.get(al)){ae(aq,false)}}}else{ao=r.getRng(true);if(aj(aq)){if(ap!==false){ao.setStartBefore(aq);ao.setEndBefore(aq)}c.remove(aq)}else{ar=af(aq);if(ar.nodeValue.charAt(0)===G){ar=ar.deleteData(0,1)}c.remove(aq,1)}r.setRng(ao)}}function ah(){var aq,ao,av,au,ar,ap,at;aq=r.getRng(true);au=aq.startOffset;ap=aq.startContainer;at=ap.nodeValue;ao=ag(r.getStart());if(ao){av=af(ao)}if(at&&au>0&&au<at.length&&/\w/.test(at.charAt(au))&&/\w/.test(at.charAt(au-1))){ar=r.getBookmark();aq.collapse(true);aq=p(aq,V(ab));aq=N.split(aq);Y(ab,ai,aq);r.moveToBookmark(ar)}else{if(!ao||av.nodeValue!==G){ao=ad(true);av=ao.firstChild;aq.insertNode(ao);au=1;Y(ab,ai,ao)}else{Y(ab,ai,ao)}r.setCursorLocation(av,au)}}function am(){var ao=r.getRng(true),ap,ar,av,au,aq,ay,ax=[],at,aw;ap=ao.startContainer;ar=ao.startOffset;aq=ap;if(ap.nodeType==3){if(ar!=ap.nodeValue.length||ap.nodeValue===G){au=true}aq=aq.parentNode}while(aq){if(y(aq,ab,ai)){ay=aq;break}if(aq.nextSibling){au=true}ax.push(aq);aq=aq.parentNode}if(!ay){return}if(au){av=r.getBookmark();ao.collapse(true);ao=p(ao,V(ab),true);ao=N.split(ao);B(ab,ai,ao);r.moveToBookmark(av)}else{aw=ad();aq=aw;for(at=ax.length-1;at>=0;at--){aq.appendChild(c.clone(ax[at],false));aq=aq.firstChild}aq.appendChild(c.doc.createTextNode(G));aq=aq.firstChild;c.insertAfter(aw,ay);r.setCursorLocation(aq,1)}}function an(){var ap,ao,aq;ao=ag(r.getStart());if(ao&&!c.isEmpty(ao)){a.walk(ao,function(ar){if(ar.nodeType==1&&ar.id!==al&&!c.isEmpty(ar)){c.setAttrib(ar,"data-mce-bogus",null)}},"childNodes")}}if(!self._hasCaretEvents){aa.onBeforeGetContent.addToTop(function(){var ao=[],ap;if(aj(ag(r.getStart()),ao)){ap=ao.length;while(ap--){c.setAttrib(ao[ap],"data-mce-bogus","1")}}});a.each("onMouseUp onKeyUp".split(" "),function(ao){aa[ao].addToTop(function(){ae();an()})});aa.onKeyDown.addToTop(function(ao,aq){var ap=aq.keyCode;if(ap==8||ap==37||ap==39){ae(ag(r.getStart()))}an()});r.onSetContent.add(an);self._hasCaretEvents=true}if(ak=="apply"){ah()}else{am()}}function R(ac){var ab=ac.startContainer,ai=ac.startOffset,ae,ah,ag,ad,af;if(ab.nodeType==3&&ai>=ab.nodeValue.length){ai=s(ab);ab=ab.parentNode;ae=true}if(ab.nodeType==1){ad=ab.childNodes;ab=ad[Math.min(ai,ad.length-1)];ah=new t(ab,c.getParent(ab,c.isBlock));if(ai>ad.length-1||ae){ah.next()}for(ag=ah.current();ag;ag=ah.next()){if(ag.nodeType==3&&!f(ag)){af=c.create("a",null,G);ag.parentNode.insertBefore(af,ag);ac.setStart(ag,0);r.setRng(ac);c.remove(af);return}}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}if(c.inline_styles){h=e.explode(c.font_size_legacy_values);d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size,10)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}});(function(b){var a=b.dom.TreeWalker;b.EnterKey=function(f){var i=f.dom,e=f.selection,d=f.settings,h=f.undoManager,c=f.schema.getNonEmptyElements();function g(A){var v=e.getRng(true),G,j,z,u,p,M,B,o,k,n,t,J,x,C;function E(N){return N&&i.isBlock(N)&&!/^(TD|TH|CAPTION|FORM)$/.test(N.nodeName)&&!/^(fixed|absolute)/i.test(N.style.position)&&i.getContentEditable(N)!=="true"}function F(O){var N;if(b.isIE&&i.isBlock(O)){N=e.getRng();O.appendChild(i.create("span",null,"\u00a0"));e.select(O);O.lastChild.outerHTML="";e.setRng(N)}}function y(P){var O=P,Q=[],N;while(O=O.firstChild){if(i.isBlock(O)){return}if(O.nodeType==1&&!c[O.nodeName.toLowerCase()]){Q.push(O)}}N=Q.length;while(N--){O=Q[N];if(!O.hasChildNodes()||(O.firstChild==O.lastChild&&O.firstChild.nodeValue==="")){i.remove(O)}else{if(O.nodeName=="A"&&(O.innerText||O.textContent)===" "){i.remove(O)}}}}function m(O){var T,R,N,U,S,Q=O,P;N=i.createRng();if(O.hasChildNodes()){T=new a(O,O);while(R=T.current()){if(R.nodeType==3){N.setStart(R,0);N.setEnd(R,0);break}if(c[R.nodeName.toLowerCase()]){N.setStartBefore(R);N.setEndBefore(R);break}Q=R;R=T.next()}if(!R){N.setStart(Q,0);N.setEnd(Q,0)}}else{if(O.nodeName=="BR"){if(O.nextSibling&&i.isBlock(O.nextSibling)){if(!M||M<9){P=i.create("br");O.parentNode.insertBefore(P,O)}N.setStartBefore(O);N.setEndBefore(O)}else{N.setStartAfter(O);N.setEndAfter(O)}}else{N.setStart(O,0);N.setEnd(O,0)}}e.setRng(N);i.remove(P);S=i.getViewPort(f.getWin());U=i.getPos(O).y;if(U<S.y||U+25>S.y+S.h){f.getWin().scrollTo(0,U<S.y?U:U-S.h+25)}}function r(O){var P=z,R,Q,N;R=O||t=="TABLE"?i.create(O||x):p.cloneNode(false);N=R;if(d.keep_styles!==false){do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(P.nodeName)){Q=P.cloneNode(false);i.setAttrib(Q,"id","");if(R.hasChildNodes()){Q.appendChild(R.firstChild);R.appendChild(Q)}else{N=Q;R.appendChild(Q)}}}while(P=P.parentNode)}if(!b.isIE){N.innerHTML="<br>"}return R}function q(Q){var P,O,N;if(z.nodeType==3&&(Q?u>0:u<z.nodeValue.length)){return false}if(z.parentNode==p&&C&&!Q){return true}if(Q&&z.nodeType==1&&z==p.firstChild){return true}if(z.nodeName==="TABLE"||(z.previousSibling&&z.previousSibling.nodeName=="TABLE")){return(C&&!Q)||(!C&&Q)}P=new a(z,p);if(z.nodeType==3){if(Q&&u==0){P.prev()}else{if(!Q&&u==z.nodeValue.length){P.next()}}}while(O=P.current()){if(O.nodeType===1){if(!O.getAttribute("data-mce-bogus")){N=O.nodeName.toLowerCase();if(c[N]&&N!=="br"){return false}}}else{if(O.nodeType===3&&!/^[ \t\r\n]*$/.test(O.nodeValue)){return false}}if(Q){P.prev()}else{P.next()}}return true}function l(N,T){var U,S,P,R,Q,O=x||"P";S=i.getParent(N,i.isBlock);if(!S||!E(S)){S=S||j;if(!S.hasChildNodes()){U=i.create(O);S.appendChild(U);v.setStart(U,0);v.setEnd(U,0);return U}R=N;while(R.parentNode!=S){R=R.parentNode}while(R&&!i.isBlock(R)){P=R;R=R.previousSibling}if(P){U=i.create(O);P.parentNode.insertBefore(U,P);R=P;while(R&&!i.isBlock(R)){Q=R.nextSibling;U.appendChild(R);R=Q}v.setStart(N,T);v.setEnd(N,T)}}return N}function H(){function N(P){var O=n[P?"firstChild":"lastChild"];while(O){if(O.nodeType==1){break}O=O[P?"nextSibling":"previousSibling"]}return O===p}o=x?r(x):i.create("BR");if(N(true)&&N()){i.replace(o,n)}else{if(N(true)){n.parentNode.insertBefore(o,n)}else{if(N()){i.insertAfter(o,n);F(o)}else{G=v.cloneRange();G.setStartAfter(p);G.setEndAfter(n);k=G.extractContents();i.insertAfter(k,n);i.insertAfter(o,n)}}}i.remove(p);m(o);h.add()}function D(){var O=new a(z,p),N;while(N=O.current()){if(N.nodeName=="BR"){return true}N=O.next()}}function L(){var O,N;if(z&&z.nodeType==3&&u>=z.nodeValue.length){if(!b.isIE&&!D()){O=i.create("br");v.insertNode(O);v.setStartAfter(O);v.setEndAfter(O);N=true}}O=i.create("br");v.insertNode(O);if(b.isIE&&t=="PRE"&&(!M||M<8)){O.parentNode.insertBefore(i.doc.createTextNode("\r"),O)}if(!N){v.setStartAfter(O);v.setEndAfter(O)}else{v.setStartBefore(O);v.setEndBefore(O)}e.setRng(v);h.add()}function s(N){do{if(N.nodeType===3){N.nodeValue=N.nodeValue.replace(/^[\r\n]+/,"")}N=N.firstChild}while(N)}function K(P){var N=i.getRoot(),O,Q;O=P;while(O!==N&&i.getContentEditable(O)!=="false"){if(i.getContentEditable(O)==="true"){Q=O}O=O.parentNode}return O!==N?Q:N}function I(O){var N;if(!b.isIE){O.normalize();N=O.lastChild;if(!N||(/^(left|right)$/gi.test(i.getStyle(N,"float",true)))){i.add(O,"br")}}}if(!v.collapsed){f.execCommand("Delete");return}if(A.isDefaultPrevented()){return}z=v.startContainer;u=v.startOffset;x=(d.force_p_newlines?"p":"")||d.forced_root_block;x=x?x.toUpperCase():"";M=i.doc.documentMode;B=A.shiftKey;if(z.nodeType==1&&z.hasChildNodes()){C=u>z.childNodes.length-1;z=z.childNodes[Math.min(u,z.childNodes.length-1)]||z;if(C&&z.nodeType==3){u=z.nodeValue.length}else{u=0}}j=K(z);if(!j){return}h.beforeChange();if(!i.isBlock(j)&&j!=i.getRoot()){if(!x||B){L()}return}if((x&&!B)||(!x&&B)){z=l(z,u)}p=i.getParent(z,i.isBlock);n=p?i.getParent(p.parentNode,i.isBlock):null;t=p?p.nodeName.toUpperCase():"";J=n?n.nodeName.toUpperCase():"";if(t=="LI"){if(!x&&B){L();return}if(i.isEmpty(p)){if(/^(UL|OL|LI)$/.test(n.parentNode.nodeName)){return false}H();return}}if(t=="PRE"&&d.br_in_pre!==false){if(!B){L();return}}else{if((!x&&!B&&t!="LI")||(x&&B)){L();return}}x=x||"P";if(q()){if(/^(H[1-6]|PRE)$/.test(t)&&J!="HGROUP"){o=r(x)}else{o=r()}if(d.end_container_on_empty_block&&E(n)&&i.isEmpty(p)){o=i.split(n,p)}else{i.insertAfter(o,p)}m(o)}else{if(q(true)){o=p.parentNode.insertBefore(r(),p);F(o)}else{G=v.cloneRange();G.setEndAfter(p);k=G.extractContents();s(k);o=k.firstChild;i.insertAfter(k,p);y(o);I(p);m(o)}}i.setAttrib(o,"id","");h.add()}f.onKeyDown.add(function(k,j){if(j.keyCode==13){if(g(j)!==false){j.preventDefault()}}})}})(tinymce);
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/tiny_mce_popup.js b/3.x/src/resources/javascript/TinyMCE/tiny_mce_popup.js
new file mode 100644 (file)
index 0000000..bb8e58c
--- /dev/null
@@ -0,0 +1,5 @@
+
+// Uncomment and change this document.domain value if you are loading the script cross subdomains
+// document.domain = 'moxiecode.com';
+
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){var b=a.target||a.srcElement;if(b.onchange){b.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init();
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/tiny_mce_src.js b/3.x/src/resources/javascript/TinyMCE/tiny_mce_src.js
new file mode 100644 (file)
index 0000000..e38fb7e
--- /dev/null
@@ -0,0 +1,18859 @@
+// FILE IS GENERATED BY COMBINING THE SOURCES IN THE "classes" DIRECTORY SO DON'T MODIFY THIS FILE DIRECTLY\r
+(function(win) {\r
+       var whiteSpaceRe = /^\s*|\s*$/g,\r
+               undef, isRegExpBroken = 'B'.replace(/A(.)|B/, '$1') === '$1';\r
+\r
+       var tinymce = {\r
+               majorVersion : '3',\r
+\r
+               minorVersion : '5.6',\r
+\r
+               releaseDate : '2012-07-26',\r
+\r
+               _init : function() {\r
+                       var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;\r
+\r
+                       t.isOpera = win.opera && opera.buildNumber;\r
+\r
+                       t.isWebKit = /WebKit/.test(ua);\r
+\r
+                       t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);\r
+\r
+                       t.isIE6 = t.isIE && /MSIE [56]/.test(ua);\r
+\r
+                       t.isIE7 = t.isIE && /MSIE [7]/.test(ua);\r
+\r
+                       t.isIE8 = t.isIE && /MSIE [8]/.test(ua);\r
+\r
+                       t.isIE9 = t.isIE && /MSIE [9]/.test(ua);\r
+\r
+                       t.isGecko = !t.isWebKit && /Gecko/.test(ua);\r
+\r
+                       t.isMac = ua.indexOf('Mac') != -1;\r
+\r
+                       t.isAir = /adobeair/i.test(ua);\r
+\r
+                       t.isIDevice = /(iPad|iPhone)/.test(ua);\r
+                       \r
+                       t.isIOS5 = t.isIDevice && ua.match(/AppleWebKit\/(\d*)/)[1]>=534;\r
+\r
+                       // TinyMCE .NET webcontrol might be setting the values for TinyMCE\r
+                       if (win.tinyMCEPreInit) {\r
+                               t.suffix = tinyMCEPreInit.suffix;\r
+                               t.baseURL = tinyMCEPreInit.base;\r
+                               t.query = tinyMCEPreInit.query;\r
+                               return;\r
+                       }\r
+\r
+                       // Get suffix and base\r
+                       t.suffix = '';\r
+\r
+                       // If base element found, add that infront of baseURL\r
+                       nl = d.getElementsByTagName('base');\r
+                       for (i=0; i<nl.length; i++) {\r
+                               v = nl[i].href;\r
+                               if (v) {\r
+                                       // Host only value like http://site.com or http://site.com:8008\r
+                                       if (/^https?:\/\/[^\/]+$/.test(v))\r
+                                               v += '/';\r
+\r
+                                       base = v ? v.match(/.*\//)[0] : ''; // Get only directory\r
+                               }\r
+                       }\r
+\r
+                       function getBase(n) {\r
+                               if (n.src && /tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(n.src)) {\r
+                                       if (/_(src|dev)\.js/g.test(n.src))\r
+                                               t.suffix = '_src';\r
+\r
+                                       if ((p = n.src.indexOf('?')) != -1)\r
+                                               t.query = n.src.substring(p + 1);\r
+\r
+                                       t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));\r
+\r
+                                       // If path to script is relative and a base href was found add that one infront\r
+                                       // the src property will always be an absolute one on non IE browsers and IE 8\r
+                                       // so this logic will basically only be executed on older IE versions\r
+                                       if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0)\r
+                                               t.baseURL = base + t.baseURL;\r
+\r
+                                       return t.baseURL;\r
+                               }\r
+\r
+                               return null;\r
+                       };\r
+\r
+                       // Check document\r
+                       nl = d.getElementsByTagName('script');\r
+                       for (i=0; i<nl.length; i++) {\r
+                               if (getBase(nl[i]))\r
+                                       return;\r
+                       }\r
+\r
+                       // Check head\r
+                       n = d.getElementsByTagName('head')[0];\r
+                       if (n) {\r
+                               nl = n.getElementsByTagName('script');\r
+                               for (i=0; i<nl.length; i++) {\r
+                                       if (getBase(nl[i]))\r
+                                               return;\r
+                               }\r
+                       }\r
+\r
+                       return;\r
+               },\r
+\r
+               is : function(o, t) {\r
+                       if (!t)\r
+                               return o !== undef;\r
+\r
+                       if (t == 'array' && (o.hasOwnProperty && o instanceof Array))\r
+                               return true;\r
+\r
+                       return typeof(o) == t;\r
+               },\r
+\r
+               makeMap : function(items, delim, map) {\r
+                       var i;\r
+\r
+                       items = items || [];\r
+                       delim = delim || ',';\r
+\r
+                       if (typeof(items) == "string")\r
+                               items = items.split(delim);\r
+\r
+                       map = map || {};\r
+\r
+                       i = items.length;\r
+                       while (i--)\r
+                               map[items[i]] = {};\r
+\r
+                       return map;\r
+               },\r
+\r
+               each : function(o, cb, s) {\r
+                       var n, l;\r
+\r
+                       if (!o)\r
+                               return 0;\r
+\r
+                       s = s || o;\r
+\r
+                       if (o.length !== undef) {\r
+                               // Indexed arrays, needed for Safari\r
+                               for (n=0, l = o.length; n < l; n++) {\r
+                                       if (cb.call(s, o[n], n, o) === false)\r
+                                               return 0;\r
+                               }\r
+                       } else {\r
+                               // Hashtables\r
+                               for (n in o) {\r
+                                       if (o.hasOwnProperty(n)) {\r
+                                               if (cb.call(s, o[n], n, o) === false)\r
+                                                       return 0;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return 1;\r
+               },\r
+\r
+\r
+               map : function(a, f) {\r
+                       var o = [];\r
+\r
+                       tinymce.each(a, function(v) {\r
+                               o.push(f(v));\r
+                       });\r
+\r
+                       return o;\r
+               },\r
+\r
+               grep : function(a, f) {\r
+                       var o = [];\r
+\r
+                       tinymce.each(a, function(v) {\r
+                               if (!f || f(v))\r
+                                       o.push(v);\r
+                       });\r
+\r
+                       return o;\r
+               },\r
+\r
+               inArray : function(a, v) {\r
+                       var i, l;\r
+\r
+                       if (a) {\r
+                               for (i = 0, l = a.length; i < l; i++) {\r
+                                       if (a[i] === v)\r
+                                               return i;\r
+                               }\r
+                       }\r
+\r
+                       return -1;\r
+               },\r
+\r
+               extend : function(obj, ext) {\r
+                       var i, l, name, args = arguments, value;\r
+\r
+                       for (i = 1, l = args.length; i < l; i++) {\r
+                               ext = args[i];\r
+                               for (name in ext) {\r
+                                       if (ext.hasOwnProperty(name)) {\r
+                                               value = ext[name];\r
+\r
+                                               if (value !== undef) {\r
+                                                       obj[name] = value;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return obj;\r
+               },\r
+\r
+\r
+               trim : function(s) {\r
+                       return (s ? '' + s : '').replace(whiteSpaceRe, '');\r
+               },\r
+\r
+               create : function(s, p, root) {\r
+                       var t = this, sp, ns, cn, scn, c, de = 0;\r
+\r
+                       // Parse : <prefix> <class>:<super class>\r
+                       s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);\r
+                       cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name\r
+\r
+                       // Create namespace for new class\r
+                       ns = t.createNS(s[3].replace(/\.\w+$/, ''), root);\r
+\r
+                       // Class already exists\r
+                       if (ns[cn])\r
+                               return;\r
+\r
+                       // Make pure static class\r
+                       if (s[2] == 'static') {\r
+                               ns[cn] = p;\r
+\r
+                               if (this.onCreate)\r
+                                       this.onCreate(s[2], s[3], ns[cn]);\r
+\r
+                               return;\r
+                       }\r
+\r
+                       // Create default constructor\r
+                       if (!p[cn]) {\r
+                               p[cn] = function() {};\r
+                               de = 1;\r
+                       }\r
+\r
+                       // Add constructor and methods\r
+                       ns[cn] = p[cn];\r
+                       t.extend(ns[cn].prototype, p);\r
+\r
+                       // Extend\r
+                       if (s[5]) {\r
+                               sp = t.resolve(s[5]).prototype;\r
+                               scn = s[5].match(/\.(\w+)$/i)[1]; // Class name\r
+\r
+                               // Extend constructor\r
+                               c = ns[cn];\r
+                               if (de) {\r
+                                       // Add passthrough constructor\r
+                                       ns[cn] = function() {\r
+                                               return sp[scn].apply(this, arguments);\r
+                                       };\r
+                               } else {\r
+                                       // Add inherit constructor\r
+                                       ns[cn] = function() {\r
+                                               this.parent = sp[scn];\r
+                                               return c.apply(this, arguments);\r
+                                       };\r
+                               }\r
+                               ns[cn].prototype[cn] = ns[cn];\r
+\r
+                               // Add super methods\r
+                               t.each(sp, function(f, n) {\r
+                                       ns[cn].prototype[n] = sp[n];\r
+                               });\r
+\r
+                               // Add overridden methods\r
+                               t.each(p, function(f, n) {\r
+                                       // Extend methods if needed\r
+                                       if (sp[n]) {\r
+                                               ns[cn].prototype[n] = function() {\r
+                                                       this.parent = sp[n];\r
+                                                       return f.apply(this, arguments);\r
+                                               };\r
+                                       } else {\r
+                                               if (n != cn)\r
+                                                       ns[cn].prototype[n] = f;\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       // Add static methods\r
+                       t.each(p['static'], function(f, n) {\r
+                               ns[cn][n] = f;\r
+                       });\r
+\r
+                       if (this.onCreate)\r
+                               this.onCreate(s[2], s[3], ns[cn].prototype);\r
+               },\r
+\r
+               walk : function(o, f, n, s) {\r
+                       s = s || this;\r
+\r
+                       if (o) {\r
+                               if (n)\r
+                                       o = o[n];\r
+\r
+                               tinymce.each(o, function(o, i) {\r
+                                       if (f.call(s, o, i, n) === false)\r
+                                               return false;\r
+\r
+                                       tinymce.walk(o, f, n, s);\r
+                               });\r
+                       }\r
+               },\r
+\r
+               createNS : function(n, o) {\r
+                       var i, v;\r
+\r
+                       o = o || win;\r
+\r
+                       n = n.split('.');\r
+                       for (i=0; i<n.length; i++) {\r
+                               v = n[i];\r
+\r
+                               if (!o[v])\r
+                                       o[v] = {};\r
+\r
+                               o = o[v];\r
+                       }\r
+\r
+                       return o;\r
+               },\r
+\r
+               resolve : function(n, o) {\r
+                       var i, l;\r
+\r
+                       o = o || win;\r
+\r
+                       n = n.split('.');\r
+                       for (i = 0, l = n.length; i < l; i++) {\r
+                               o = o[n[i]];\r
+\r
+                               if (!o)\r
+                                       break;\r
+                       }\r
+\r
+                       return o;\r
+               },\r
+\r
+               addUnload : function(f, s) {\r
+                       var t = this, unload;\r
+\r
+                       unload = function() {\r
+                               var li = t.unloads, o, n;\r
+\r
+                               if (li) {\r
+                                       // Call unload handlers\r
+                                       for (n in li) {\r
+                                               o = li[n];\r
+\r
+                                               if (o && o.func)\r
+                                                       o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy\r
+                                       }\r
+\r
+                                       // Detach unload function\r
+                                       if (win.detachEvent) {\r
+                                               win.detachEvent('onbeforeunload', fakeUnload);\r
+                                               win.detachEvent('onunload', unload);\r
+                                       } else if (win.removeEventListener)\r
+                                               win.removeEventListener('unload', unload, false);\r
+\r
+                                       // Destroy references\r
+                                       t.unloads = o = li = w = unload = 0;\r
+\r
+                                       // Run garbarge collector on IE\r
+                                       if (win.CollectGarbage)\r
+                                               CollectGarbage();\r
+                               }\r
+                       };\r
+\r
+                       function fakeUnload() {\r
+                               var d = document;\r
+\r
+                               function stop() {\r
+                                       // Prevent memory leak\r
+                                       d.detachEvent('onstop', stop);\r
+\r
+                                       // Call unload handler\r
+                                       if (unload)\r
+                                               unload();\r
+\r
+                                       d = 0;\r
+                               };\r
+\r
+                               // Is there things still loading, then do some magic\r
+                               if (d.readyState == 'interactive') {\r
+                                       // Fire unload when the currently loading page is stopped\r
+                                       if (d)\r
+                                               d.attachEvent('onstop', stop);\r
+\r
+                                       // Remove onstop listener after a while to prevent the unload function\r
+                                       // to execute if the user presses cancel in an onbeforeunload\r
+                                       // confirm dialog and then presses the browser stop button\r
+                                       win.setTimeout(function() {\r
+                                               if (d)\r
+                                                       d.detachEvent('onstop', stop);\r
+                                       }, 0);\r
+                               }\r
+                       };\r
+\r
+                       f = {func : f, scope : s || this};\r
+\r
+                       if (!t.unloads) {\r
+                               // Attach unload handler\r
+                               if (win.attachEvent) {\r
+                                       win.attachEvent('onunload', unload);\r
+                                       win.attachEvent('onbeforeunload', fakeUnload);\r
+                               } else if (win.addEventListener)\r
+                                       win.addEventListener('unload', unload, false);\r
+\r
+                               // Setup initial unload handler array\r
+                               t.unloads = [f];\r
+                       } else\r
+                               t.unloads.push(f);\r
+\r
+                       return f;\r
+               },\r
+\r
+               removeUnload : function(f) {\r
+                       var u = this.unloads, r = null;\r
+\r
+                       tinymce.each(u, function(o, i) {\r
+                               if (o && o.func == f) {\r
+                                       u.splice(i, 1);\r
+                                       r = f;\r
+                                       return false;\r
+                               }\r
+                       });\r
+\r
+                       return r;\r
+               },\r
+\r
+               explode : function(s, d) {\r
+                       if (!s || tinymce.is(s, 'array')) {\r
+                               return s;\r
+                       }\r
+\r
+                       return tinymce.map(s.split(d || ','), tinymce.trim);\r
+               },\r
+\r
+               _addVer : function(u) {\r
+                       var v;\r
+\r
+                       if (!this.query)\r
+                               return u;\r
+\r
+                       v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;\r
+\r
+                       if (u.indexOf('#') == -1)\r
+                               return u + v;\r
+\r
+                       return u.replace('#', v + '#');\r
+               },\r
+\r
+               // Fix function for IE 9 where regexps isn't working correctly\r
+               // Todo: remove me once MS fixes the bug\r
+               _replace : function(find, replace, str) {\r
+                       // On IE9 we have to fake $x replacement\r
+                       if (isRegExpBroken) {\r
+                               return str.replace(find, function() {\r
+                                       var val = replace, args = arguments, i;\r
+\r
+                                       for (i = 0; i < args.length - 2; i++) {\r
+                                               if (args[i] === undef) {\r
+                                                       val = val.replace(new RegExp('\\$' + i, 'g'), '');\r
+                                               } else {\r
+                                                       val = val.replace(new RegExp('\\$' + i, 'g'), args[i]);\r
+                                               }\r
+                                       }\r
+\r
+                                       return val;\r
+                               });\r
+                       }\r
+\r
+                       return str.replace(find, replace);\r
+               }\r
+\r
+               };\r
+\r
+       // Initialize the API\r
+       tinymce._init();\r
+\r
+       // Expose tinymce namespace to the global namespace (window)\r
+       win.tinymce = win.tinyMCE = tinymce;\r
+\r
+       // Describe the different namespaces\r
+\r
+       })(window);\r
+\r
+\r
+\r
+tinymce.create('tinymce.util.Dispatcher', {\r
+       scope : null,\r
+       listeners : null,\r
+       inDispatch: false,\r
+\r
+       Dispatcher : function(scope) {\r
+               this.scope = scope || this;\r
+               this.listeners = [];\r
+       },\r
+\r
+       add : function(callback, scope) {\r
+               this.listeners.push({cb : callback, scope : scope || this.scope});\r
+\r
+               return callback;\r
+       },\r
+\r
+       addToTop : function(callback, scope) {\r
+               var self = this, listener = {cb : callback, scope : scope || self.scope};\r
+\r
+               // Create new listeners if addToTop is executed in a dispatch loop\r
+               if (self.inDispatch) {\r
+                       self.listeners = [listener].concat(self.listeners);\r
+               } else {\r
+                       self.listeners.unshift(listener);\r
+               }\r
+\r
+               return callback;\r
+       },\r
+\r
+       remove : function(callback) {\r
+               var listeners = this.listeners, output = null;\r
+\r
+               tinymce.each(listeners, function(listener, i) {\r
+                       if (callback == listener.cb) {\r
+                               output = listener;\r
+                               listeners.splice(i, 1);\r
+                               return false;\r
+                       }\r
+               });\r
+\r
+               return output;\r
+       },\r
+\r
+       dispatch : function() {\r
+               var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener;\r
+\r
+               self.inDispatch = true;\r
+               \r
+               // Needs to be a real loop since the listener count might change while looping\r
+               // And this is also more efficient\r
+               for (i = 0; i < listeners.length; i++) {\r
+                       listener = listeners[i];\r
+                       returnValue = listener.cb.apply(listener.scope, args.length > 0 ? args : [listener.scope]);\r
+\r
+                       if (returnValue === false)\r
+                               break;\r
+               }\r
+\r
+               self.inDispatch = false;\r
+\r
+               return returnValue;\r
+       }\r
+\r
+       });\r
+\r
+(function() {\r
+       var each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.util.URI', {\r
+               URI : function(u, s) {\r
+                       var t = this, o, a, b, base_url;\r
+\r
+                       // Trim whitespace\r
+                       u = tinymce.trim(u);\r
+\r
+                       // Default settings\r
+                       s = t.settings = s || {};\r
+\r
+                       // Strange app protocol that isn't http/https or local anchor\r
+                       // For example: mailto,skype,tel etc.\r
+                       if (/^([\w\-]+):([^\/]{2})/i.test(u) || /^\s*#/.test(u)) {\r
+                               t.source = u;\r
+                               return;\r
+                       }\r
+\r
+                       // Absolute path with no host, fake host and protocol\r
+                       if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)\r
+                               u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;\r
+\r
+                       // Relative path http:// or protocol relative //path\r
+                       if (!/^[\w\-]*:?\/\//.test(u)) {\r
+                               base_url = s.base_uri ? s.base_uri.path : new tinymce.util.URI(location.href).directory;\r
+                               u = ((s.base_uri && s.base_uri.protocol) || 'http') + '://mce_host' + t.toAbsPath(base_url, u);\r
+                       }\r
+\r
+                       // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)\r
+                       u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something\r
+                       u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);\r
+                       each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) {\r
+                               var s = u[i];\r
+\r
+                               // Zope 3 workaround, they use @@something\r
+                               if (s)\r
+                                       s = s.replace(/\(mce_at\)/g, '@@');\r
+\r
+                               t[v] = s;\r
+                       });\r
+\r
+                       b = s.base_uri;\r
+                       if (b) {\r
+                               if (!t.protocol)\r
+                                       t.protocol = b.protocol;\r
+\r
+                               if (!t.userInfo)\r
+                                       t.userInfo = b.userInfo;\r
+\r
+                               if (!t.port && t.host === 'mce_host')\r
+                                       t.port = b.port;\r
+\r
+                               if (!t.host || t.host === 'mce_host')\r
+                                       t.host = b.host;\r
+\r
+                               t.source = '';\r
+                       }\r
+\r
+                       //t.path = t.path || '/';\r
+               },\r
+\r
+               setPath : function(p) {\r
+                       var t = this;\r
+\r
+                       p = /^(.*?)\/?(\w+)?$/.exec(p);\r
+\r
+                       // Update path parts\r
+                       t.path = p[0];\r
+                       t.directory = p[1];\r
+                       t.file = p[2];\r
+\r
+                       // Rebuild source\r
+                       t.source = '';\r
+                       t.getURI();\r
+               },\r
+\r
+               toRelative : function(u) {\r
+                       var t = this, o;\r
+\r
+                       if (u === "./")\r
+                               return u;\r
+\r
+                       u = new tinymce.util.URI(u, {base_uri : t});\r
+\r
+                       // Not on same domain/port or protocol\r
+                       if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol)\r
+                               return u.getURI();\r
+\r
+                       var tu = t.getURI(), uu = u.getURI();\r
+                       \r
+                       // Allow usage of the base_uri when relative_urls = true\r
+                       if(tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu))\r
+                               return tu;\r
+\r
+                       o = t.toRelPath(t.path, u.path);\r
+\r
+                       // Add query\r
+                       if (u.query)\r
+                               o += '?' + u.query;\r
+\r
+                       // Add anchor\r
+                       if (u.anchor)\r
+                               o += '#' + u.anchor;\r
+\r
+                       return o;\r
+               },\r
+       \r
+               toAbsolute : function(u, nh) {\r
+                       u = new tinymce.util.URI(u, {base_uri : this});\r
+\r
+                       return u.getURI(this.host == u.host && this.protocol == u.protocol ? nh : 0);\r
+               },\r
+\r
+               toRelPath : function(base, path) {\r
+                       var items, bp = 0, out = '', i, l;\r
+\r
+                       // Split the paths\r
+                       base = base.substring(0, base.lastIndexOf('/'));\r
+                       base = base.split('/');\r
+                       items = path.split('/');\r
+\r
+                       if (base.length >= items.length) {\r
+                               for (i = 0, l = base.length; i < l; i++) {\r
+                                       if (i >= items.length || base[i] != items[i]) {\r
+                                               bp = i + 1;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       if (base.length < items.length) {\r
+                               for (i = 0, l = items.length; i < l; i++) {\r
+                                       if (i >= base.length || base[i] != items[i]) {\r
+                                               bp = i + 1;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       if (bp === 1)\r
+                               return path;\r
+\r
+                       for (i = 0, l = base.length - (bp - 1); i < l; i++)\r
+                               out += "../";\r
+\r
+                       for (i = bp - 1, l = items.length; i < l; i++) {\r
+                               if (i != bp - 1)\r
+                                       out += "/" + items[i];\r
+                               else\r
+                                       out += items[i];\r
+                       }\r
+\r
+                       return out;\r
+               },\r
+\r
+               toAbsPath : function(base, path) {\r
+                       var i, nb = 0, o = [], tr, outPath;\r
+\r
+                       // Split paths\r
+                       tr = /\/$/.test(path) ? '/' : '';\r
+                       base = base.split('/');\r
+                       path = path.split('/');\r
+\r
+                       // Remove empty chunks\r
+                       each(base, function(k) {\r
+                               if (k)\r
+                                       o.push(k);\r
+                       });\r
+\r
+                       base = o;\r
+\r
+                       // Merge relURLParts chunks\r
+                       for (i = path.length - 1, o = []; i >= 0; i--) {\r
+                               // Ignore empty or .\r
+                               if (path[i].length === 0 || path[i] === ".")\r
+                                       continue;\r
+\r
+                               // Is parent\r
+                               if (path[i] === '..') {\r
+                                       nb++;\r
+                                       continue;\r
+                               }\r
+\r
+                               // Move up\r
+                               if (nb > 0) {\r
+                                       nb--;\r
+                                       continue;\r
+                               }\r
+\r
+                               o.push(path[i]);\r
+                       }\r
+\r
+                       i = base.length - nb;\r
+\r
+                       // If /a/b/c or /\r
+                       if (i <= 0)\r
+                               outPath = o.reverse().join('/');\r
+                       else\r
+                               outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');\r
+\r
+                       // Add front / if it's needed\r
+                       if (outPath.indexOf('/') !== 0)\r
+                               outPath = '/' + outPath;\r
+\r
+                       // Add traling / if it's needed\r
+                       if (tr && outPath.lastIndexOf('/') !== outPath.length - 1)\r
+                               outPath += tr;\r
+\r
+                       return outPath;\r
+               },\r
+\r
+               getURI : function(nh) {\r
+                       var s, t = this;\r
+\r
+                       // Rebuild source\r
+                       if (!t.source || nh) {\r
+                               s = '';\r
+\r
+                               if (!nh) {\r
+                                       if (t.protocol)\r
+                                               s += t.protocol + '://';\r
+\r
+                                       if (t.userInfo)\r
+                                               s += t.userInfo + '@';\r
+\r
+                                       if (t.host)\r
+                                               s += t.host;\r
+\r
+                                       if (t.port)\r
+                                               s += ':' + t.port;\r
+                               }\r
+\r
+                               if (t.path)\r
+                                       s += t.path;\r
+\r
+                               if (t.query)\r
+                                       s += '?' + t.query;\r
+\r
+                               if (t.anchor)\r
+                                       s += '#' + t.anchor;\r
+\r
+                               t.source = s;\r
+                       }\r
+\r
+                       return t.source;\r
+               }\r
+       });\r
+})();\r
+\r
+(function() {\r
+       var each = tinymce.each;\r
+\r
+       tinymce.create('static tinymce.util.Cookie', {\r
+               getHash : function(n) {\r
+                       var v = this.get(n), h;\r
+\r
+                       if (v) {\r
+                               each(v.split('&'), function(v) {\r
+                                       v = v.split('=');\r
+                                       h = h || {};\r
+                                       h[unescape(v[0])] = unescape(v[1]);\r
+                               });\r
+                       }\r
+\r
+                       return h;\r
+               },\r
+\r
+               setHash : function(n, v, e, p, d, s) {\r
+                       var o = '';\r
+\r
+                       each(v, function(v, k) {\r
+                               o += (!o ? '' : '&') + escape(k) + '=' + escape(v);\r
+                       });\r
+\r
+                       this.set(n, o, e, p, d, s);\r
+               },\r
+\r
+               get : function(n) {\r
+                       var c = document.cookie, e, p = n + "=", b;\r
+\r
+                       // Strict mode\r
+                       if (!c)\r
+                               return;\r
+\r
+                       b = c.indexOf("; " + p);\r
+\r
+                       if (b == -1) {\r
+                               b = c.indexOf(p);\r
+\r
+                               if (b !== 0)\r
+                                       return null;\r
+                       } else\r
+                               b += 2;\r
+\r
+                       e = c.indexOf(";", b);\r
+\r
+                       if (e == -1)\r
+                               e = c.length;\r
+\r
+                       return unescape(c.substring(b + p.length, e));\r
+               },\r
+\r
+               set : function(n, v, e, p, d, s) {\r
+                       document.cookie = n + "=" + escape(v) +\r
+                               ((e) ? "; expires=" + e.toGMTString() : "") +\r
+                               ((p) ? "; path=" + escape(p) : "") +\r
+                               ((d) ? "; domain=" + d : "") +\r
+                               ((s) ? "; secure" : "");\r
+               },\r
+\r
+               remove : function(name, path, domain) {\r
+                       var date = new Date();\r
+\r
+                       date.setTime(date.getTime() - 1000);\r
+\r
+                       this.set(name, '', date, path, domain);\r
+               }\r
+       });\r
+})();\r
+\r
+(function() {\r
+       function serialize(o, quote) {\r
+               var i, v, t, name;\r
+\r
+               quote = quote || '"';\r
+\r
+               if (o == null)\r
+                       return 'null';\r
+\r
+               t = typeof o;\r
+\r
+               if (t == 'string') {\r
+                       v = '\bb\tt\nn\ff\rr\""\'\'\\\\';\r
+\r
+                       return quote + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g, function(a, b) {\r
+                               // Make sure single quotes never get encoded inside double quotes for JSON compatibility\r
+                               if (quote === '"' && a === "'")\r
+                                       return a;\r
+\r
+                               i = v.indexOf(b);\r
+\r
+                               if (i + 1)\r
+                                       return '\\' + v.charAt(i + 1);\r
+\r
+                               a = b.charCodeAt().toString(16);\r
+\r
+                               return '\\u' + '0000'.substring(a.length) + a;\r
+                       }) + quote;\r
+               }\r
+\r
+               if (t == 'object') {\r
+                       if (o.hasOwnProperty && o instanceof Array) {\r
+                                       for (i=0, v = '['; i<o.length; i++)\r
+                                               v += (i > 0 ? ',' : '') + serialize(o[i], quote);\r
+\r
+                                       return v + ']';\r
+                               }\r
+\r
+                               v = '{';\r
+\r
+                               for (name in o) {\r
+                                       if (o.hasOwnProperty(name)) {\r
+                                               v += typeof o[name] != 'function' ? (v.length > 1 ? ',' + quote : quote) + name + quote +':' + serialize(o[name], quote) : '';\r
+                                       }\r
+                               }\r
+\r
+                               return v + '}';\r
+               }\r
+\r
+               return '' + o;\r
+       };\r
+\r
+       tinymce.util.JSON = {\r
+               serialize: serialize,\r
+\r
+               parse: function(s) {\r
+                       try {\r
+                               return eval('(' + s + ')');\r
+                       } catch (ex) {\r
+                               // Ignore\r
+                       }\r
+               }\r
+\r
+               };\r
+})();\r
+\r
+tinymce.create('static tinymce.util.XHR', {\r
+       send : function(o) {\r
+               var x, t, w = window, c = 0;\r
+\r
+               function ready() {\r
+                       if (!o.async || x.readyState == 4 || c++ > 10000) {\r
+                               if (o.success && c < 10000 && x.status == 200)\r
+                                       o.success.call(o.success_scope, '' + x.responseText, x, o);\r
+                               else if (o.error)\r
+                                       o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, o);\r
+\r
+                               x = null;\r
+                       } else\r
+                               w.setTimeout(ready, 10);\r
+               };\r
+\r
+               // Default settings\r
+               o.scope = o.scope || this;\r
+               o.success_scope = o.success_scope || o.scope;\r
+               o.error_scope = o.error_scope || o.scope;\r
+               o.async = o.async === false ? false : true;\r
+               o.data = o.data || '';\r
+\r
+               function get(s) {\r
+                       x = 0;\r
+\r
+                       try {\r
+                               x = new ActiveXObject(s);\r
+                       } catch (ex) {\r
+                       }\r
+\r
+                       return x;\r
+               };\r
+\r
+               x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP');\r
+\r
+               if (x) {\r
+                       if (x.overrideMimeType)\r
+                               x.overrideMimeType(o.content_type);\r
+\r
+                       x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async);\r
+\r
+                       if (o.content_type)\r
+                               x.setRequestHeader('Content-Type', o.content_type);\r
+\r
+                       x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\r
+\r
+                       x.send(o.data);\r
+\r
+                       // Syncronous request\r
+                       if (!o.async)\r
+                               return ready();\r
+\r
+                       // Wait for response, onReadyStateChange can not be used since it leaks memory in IE\r
+                       t = w.setTimeout(ready, 10);\r
+               }\r
+       }\r
+});\r
+\r
+(function() {\r
+       var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;\r
+\r
+       tinymce.create('tinymce.util.JSONRequest', {\r
+               JSONRequest : function(s) {\r
+                       this.settings = extend({\r
+                       }, s);\r
+                       this.count = 0;\r
+               },\r
+\r
+               send : function(o) {\r
+                       var ecb = o.error, scb = o.success;\r
+\r
+                       o = extend(this.settings, o);\r
+\r
+                       o.success = function(c, x) {\r
+                               c = JSON.parse(c);\r
+\r
+                               if (typeof(c) == 'undefined') {\r
+                                       c = {\r
+                                               error : 'JSON Parse error.'\r
+                                       };\r
+                               }\r
+\r
+                               if (c.error)\r
+                                       ecb.call(o.error_scope || o.scope, c.error, x);\r
+                               else\r
+                                       scb.call(o.success_scope || o.scope, c.result);\r
+                       };\r
+\r
+                       o.error = function(ty, x) {\r
+                               if (ecb)\r
+                                       ecb.call(o.error_scope || o.scope, ty, x);\r
+                       };\r
+\r
+                       o.data = JSON.serialize({\r
+                               id : o.id || 'c' + (this.count++),\r
+                               method : o.method,\r
+                               params : o.params\r
+                       });\r
+\r
+                       // JSON content type for Ruby on rails. Bug: #1883287\r
+                       o.content_type = 'application/json';\r
+\r
+                       XHR.send(o);\r
+               },\r
+\r
+               'static' : {\r
+                       sendRPC : function(o) {\r
+                               return new tinymce.util.JSONRequest().send(o);\r
+                       }\r
+               }\r
+       });\r
+}());\r
+(function(tinymce){\r
+       tinymce.VK = {\r
+               BACKSPACE: 8,\r
+               DELETE: 46,\r
+               DOWN: 40,\r
+               ENTER: 13,\r
+               LEFT: 37,\r
+               RIGHT: 39,\r
+               SPACEBAR: 32,\r
+               TAB: 9,\r
+               UP: 38,\r
+\r
+               modifierPressed: function (e) {\r
+                       return e.shiftKey || e.ctrlKey || e.altKey;\r
+               },\r
+\r
+               metaKeyPressed: function(e) {\r
+                       // Check if ctrl or meta key is pressed also check if alt is false for Polish users\r
+                       return tinymce.isMac ? e.metaKey : e.ctrlKey && !e.altKey;\r
+               }\r
+       };\r
+})(tinymce);\r
+\r
+tinymce.util.Quirks = function(editor) {\r
+       var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, settings = editor.settings;\r
+\r
+       function setEditorCommandState(cmd, state) {\r
+               try {\r
+                       editor.getDoc().execCommand(cmd, false, state);\r
+               } catch (ex) {\r
+                       // Ignore\r
+               }\r
+       }\r
+\r
+       function getDocumentMode() {\r
+               var documentMode = editor.getDoc().documentMode;\r
+\r
+               return documentMode ? documentMode : 6;\r
+       };\r
+\r
+       function cleanupStylesWhenDeleting() {\r
+               function removeMergedFormatSpans(isDelete) {\r
+                       var rng, blockElm, node, clonedSpan;\r
+\r
+                       rng = selection.getRng();\r
+\r
+                       // Find root block\r
+                       blockElm = dom.getParent(rng.startContainer, dom.isBlock);\r
+\r
+                       // On delete clone the root span of the next block element\r
+                       if (isDelete)\r
+                               blockElm = dom.getNext(blockElm, dom.isBlock);\r
+\r
+                       // Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace\r
+                       if (blockElm) {\r
+                               node = blockElm.firstChild;\r
+\r
+                               // Ignore empty text nodes\r
+                               while (node && node.nodeType == 3 && node.nodeValue.length === 0)\r
+                                       node = node.nextSibling;\r
+\r
+                               if (node && node.nodeName === 'SPAN') {\r
+                                       clonedSpan = node.cloneNode(false);\r
+                               }\r
+                       }\r
+\r
+                       // Do the backspace/delete action\r
+                       editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);\r
+\r
+                       // Find all odd apple-style-spans\r
+                       blockElm = dom.getParent(rng.startContainer, dom.isBlock);\r
+                       tinymce.each(dom.select('span.Apple-style-span,font.Apple-style-span', blockElm), function(span) {\r
+                               var bm = selection.getBookmark();\r
+\r
+                               if (clonedSpan) {\r
+                                       dom.replace(clonedSpan.cloneNode(false), span, true);\r
+                               } else {\r
+                                       dom.remove(span, true);\r
+                               }\r
+\r
+                               // Restore the selection\r
+                               selection.moveToBookmark(bm);\r
+                       });\r
+               };\r
+\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       var isDelete;\r
+\r
+                       isDelete = e.keyCode == DELETE;\r
+                       if (!e.isDefaultPrevented() && (isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {\r
+                               e.preventDefault();\r
+                               removeMergedFormatSpans(isDelete);\r
+                       }\r
+               });\r
+\r
+               editor.addCommand('Delete', function() {removeMergedFormatSpans();});\r
+       };\r
+       \r
+       function emptyEditorWhenDeleting() {\r
+               function serializeRng(rng) {\r
+                       var body = dom.create("body");\r
+                       var contents = rng.cloneContents();\r
+                       body.appendChild(contents);\r
+                       return selection.serializer.serialize(body, {format: 'html'});\r
+               }\r
+\r
+               function allContentsSelected(rng) {\r
+                       var selection = serializeRng(rng);\r
+\r
+                       var allRng = dom.createRng();\r
+                       allRng.selectNode(editor.getBody());\r
+\r
+                       var allSelection = serializeRng(allRng);\r
+                       return selection === allSelection;\r
+               }\r
+\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       var keyCode = e.keyCode, isCollapsed;\r
+\r
+                       // Empty the editor if it's needed for example backspace at <p><b>|</b></p>\r
+                       if (!e.isDefaultPrevented() && (keyCode == DELETE || keyCode == BACKSPACE)) {\r
+                               isCollapsed = editor.selection.isCollapsed();\r
+\r
+                               // Selection is collapsed but the editor isn't empty\r
+                               if (isCollapsed && !dom.isEmpty(editor.getBody())) {\r
+                                       return;\r
+                               }\r
+\r
+                               // IE deletes all contents correctly when everything is selected\r
+                               if (tinymce.isIE && !isCollapsed) {\r
+                                       return;\r
+                               }\r
+\r
+                               // Selection isn't collapsed but not all the contents is selected\r
+                               if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {\r
+                                       return;\r
+                               }\r
+\r
+                               // Manually empty the editor\r
+                               editor.setContent('');\r
+                               editor.selection.setCursorLocation(editor.getBody(), 0);\r
+                               editor.nodeChanged();\r
+                       }\r
+               });\r
+       };\r
+\r
+       function selectAll() {\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       if (e.keyCode == 65 && VK.metaKeyPressed(e)) {\r
+                               e.preventDefault();\r
+                               editor.execCommand('SelectAll');\r
+                       }\r
+               });\r
+       };\r
+\r
+       function inputMethodFocus() {\r
+               if (!editor.settings.content_editable) {\r
+                       // Case 1 IME doesn't initialize if you focus the document\r
+                       dom.bind(editor.getDoc(), 'focusin', function(e) {\r
+                               selection.setRng(selection.getRng());\r
+                       });\r
+\r
+                       // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\r
+                       dom.bind(editor.getDoc(), 'mousedown', function(e) {\r
+                               if (e.target == editor.getDoc().documentElement) {\r
+                                       editor.getWin().focus();\r
+                                       selection.setRng(selection.getRng());\r
+                               }\r
+                       });\r
+               }\r
+       };\r
+\r
+       function removeHrOnBackspace() {\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       if (!e.isDefaultPrevented() && e.keyCode === BACKSPACE) {\r
+                               if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {\r
+                                       var node = selection.getNode();\r
+                                       var previousSibling = node.previousSibling;\r
+\r
+                                       if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") {\r
+                                               dom.remove(previousSibling);\r
+                                               tinymce.dom.Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       }\r
+               })\r
+       }\r
+\r
+       function focusBody() {\r
+               // Fix for a focus bug in FF 3.x where the body element\r
+               // wouldn't get proper focus if the user clicked on the HTML element\r
+               if (!Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\r
+                       editor.onMouseDown.add(function(editor, e) {\r
+                               if (e.target.nodeName === "HTML") {\r
+                                       var body = editor.getBody();\r
+\r
+                                       // Blur the body it's focused but not correctly focused\r
+                                       body.blur();\r
+\r
+                                       // Refocus the body after a little while\r
+                                       setTimeout(function() {\r
+                                               body.focus();\r
+                                       }, 0);\r
+                               }\r
+                       });\r
+               }\r
+       };\r
+\r
+       function selectControlElements() {\r
+               editor.onClick.add(function(editor, e) {\r
+                       e = e.target;\r
+\r
+                       // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250\r
+                       // WebKit can't even do simple things like selecting an image\r
+                       // Needs tobe the setBaseAndExtend or it will fail to select floated images\r
+                       if (/^(IMG|HR)$/.test(e.nodeName)) {\r
+                               selection.getSel().setBaseAndExtent(e, 0, e, 1);\r
+                       }\r
+\r
+                       if (e.nodeName == 'A' && dom.hasClass(e, 'mceItemAnchor')) {\r
+                               selection.select(e);\r
+                       }\r
+\r
+                       editor.nodeChanged();\r
+               });\r
+       };\r
+\r
+       function removeStylesWhenDeletingAccrossBlockElements() {\r
+               function getAttributeApplyFunction() {\r
+                       var template = dom.getAttribs(selection.getStart().cloneNode(false));\r
+\r
+                       return function() {\r
+                               var target = selection.getStart();\r
+\r
+                               if (target !== editor.getBody()) {\r
+                                       dom.setAttrib(target, "style", null);\r
+\r
+                                       tinymce.each(template, function(attr) {\r
+                                               target.setAttributeNode(attr.cloneNode(true));\r
+                                       });\r
+                               }\r
+                       };\r
+               }\r
+\r
+               function isSelectionAcrossElements() {\r
+                       return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);\r
+               }\r
+\r
+               function blockEvent(editor, e) {\r
+                       e.preventDefault();\r
+                       return false;\r
+               }\r
+\r
+               editor.onKeyPress.add(function(editor, e) {\r
+                       var applyAttributes;\r
+\r
+                       if ((e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {\r
+                               applyAttributes = getAttributeApplyFunction();\r
+                               editor.getDoc().execCommand('delete', false, null);\r
+                               applyAttributes();\r
+                               e.preventDefault();\r
+                               return false;\r
+                       }\r
+               });\r
+\r
+               dom.bind(editor.getDoc(), 'cut', function(e) {\r
+                       var applyAttributes;\r
+\r
+                       if (isSelectionAcrossElements()) {\r
+                               applyAttributes = getAttributeApplyFunction();\r
+                               editor.onKeyUp.addToTop(blockEvent);\r
+\r
+                               setTimeout(function() {\r
+                                       applyAttributes();\r
+                                       editor.onKeyUp.remove(blockEvent);\r
+                               }, 0);\r
+                       }\r
+               });\r
+       }\r
+\r
+       function selectionChangeNodeChanged() {\r
+               var lastRng, selectionTimer;\r
+\r
+               dom.bind(editor.getDoc(), 'selectionchange', function() {\r
+                       if (selectionTimer) {\r
+                               clearTimeout(selectionTimer);\r
+                               selectionTimer = 0;\r
+                       }\r
+\r
+                       selectionTimer = window.setTimeout(function() {\r
+                               var rng = selection.getRng();\r
+\r
+                               // Compare the ranges to see if it was a real change or not\r
+                               if (!lastRng || !tinymce.dom.RangeUtils.compareRanges(rng, lastRng)) {\r
+                                       editor.nodeChanged();\r
+                                       lastRng = rng;\r
+                               }\r
+                       }, 50);\r
+               });\r
+       }\r
+\r
+       function ensureBodyHasRoleApplication() {\r
+               document.body.setAttribute("role", "application");\r
+       }\r
+\r
+       function disableBackspaceIntoATable() {\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       if (!e.isDefaultPrevented() && e.keyCode === BACKSPACE) {\r
+                               if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {\r
+                                       var previousSibling = selection.getNode().previousSibling;\r
+                                       if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {\r
+                                               return tinymce.dom.Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       }\r
+               })\r
+       }\r
+\r
+       function addNewLinesBeforeBrInPre() {\r
+               // IE8+ rendering mode does the right thing with BR in PRE\r
+               if (getDocumentMode() > 7) {\r
+                       return;\r
+               }\r
+\r
+                // Enable display: none in area and add a specific class that hides all BR elements in PRE to\r
+                // avoid the caret from getting stuck at the BR elements while pressing the right arrow key\r
+               setEditorCommandState('RespectVisibilityInDesign', true);\r
+               editor.contentStyles.push('.mceHideBrInPre pre br {display: none}');\r
+               dom.addClass(editor.getBody(), 'mceHideBrInPre');\r
+\r
+               // Adds a \n before all BR elements in PRE to get them visual\r
+               editor.parser.addNodeFilter('pre', function(nodes, name) {\r
+                       var i = nodes.length, brNodes, j, brElm, sibling;\r
+\r
+                       while (i--) {\r
+                               brNodes = nodes[i].getAll('br');\r
+                               j = brNodes.length;\r
+                               while (j--) {\r
+                                       brElm = brNodes[j];\r
+\r
+                                       // Add \n before BR in PRE elements on older IE:s so the new lines get rendered\r
+                                       sibling = brElm.prev;\r
+                                       if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') {\r
+                                               sibling.value += '\n';\r
+                                       } else {\r
+                                               brElm.parent.insert(new tinymce.html.Node('#text', 3), brElm, true).value = '\n';\r
+                                       }\r
+                               }\r
+                       }\r
+               });\r
+\r
+               // Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible\r
+               editor.serializer.addNodeFilter('pre', function(nodes, name) {\r
+                       var i = nodes.length, brNodes, j, brElm, sibling;\r
+\r
+                       while (i--) {\r
+                               brNodes = nodes[i].getAll('br');\r
+                               j = brNodes.length;\r
+                               while (j--) {\r
+                                       brElm = brNodes[j];\r
+                                       sibling = brElm.prev;\r
+                                       if (sibling && sibling.type == 3) {\r
+                                               sibling.value = sibling.value.replace(/\r?\n$/, '');\r
+                                       }\r
+                               }\r
+                       }\r
+               });\r
+       }\r
+\r
+       function removePreSerializedStylesWhenSelectingControls() {\r
+               dom.bind(editor.getBody(), 'mouseup', function(e) {\r
+                       var value, node = selection.getNode();\r
+\r
+                       // Moved styles to attributes on IMG eements\r
+                       if (node.nodeName == 'IMG') {\r
+                               // Convert style width to width attribute\r
+                               if (value = dom.getStyle(node, 'width')) {\r
+                                       dom.setAttrib(node, 'width', value.replace(/[^0-9%]+/g, ''));\r
+                                       dom.setStyle(node, 'width', '');\r
+                               }\r
+\r
+                               // Convert style height to height attribute\r
+                               if (value = dom.getStyle(node, 'height')) {\r
+                                       dom.setAttrib(node, 'height', value.replace(/[^0-9%]+/g, ''));\r
+                                       dom.setStyle(node, 'height', '');\r
+                               }\r
+                       }\r
+               });\r
+       }\r
+\r
+       function keepInlineElementOnDeleteBackspace() {\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       var isDelete, rng, container, offset, brElm, sibling, collapsed;\r
+\r
+                       isDelete = e.keyCode == DELETE;\r
+                       if (!e.isDefaultPrevented() && (isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {\r
+                               rng = selection.getRng();\r
+                               container = rng.startContainer;\r
+                               offset = rng.startOffset;\r
+                               collapsed = rng.collapsed;\r
+\r
+                               // Override delete if the start container is a text node and is at the beginning of text or\r
+                               // just before/after the last character to be deleted in collapsed mode\r
+                               if (container.nodeType == 3 && container.nodeValue.length > 0 && ((offset === 0 && !collapsed) || (collapsed && offset === (isDelete ? 0 : 1)))) {\r
+                                       nonEmptyElements = editor.schema.getNonEmptyElements();\r
+\r
+                                       // Prevent default logic since it's broken\r
+                                       e.preventDefault();\r
+\r
+                                       // Insert a BR before the text node this will prevent the containing element from being deleted/converted\r
+                                       brElm = dom.create('br', {id: '__tmp'});\r
+                                       container.parentNode.insertBefore(brElm, container);\r
+\r
+                                       // Do the browser delete\r
+                                       editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);\r
+\r
+                                       // Check if the previous sibling is empty after deleting for example: <p><b></b>|</p>\r
+                                       container = selection.getRng().startContainer;\r
+                                       sibling = container.previousSibling;\r
+                                       if (sibling && sibling.nodeType == 1 && !dom.isBlock(sibling) && dom.isEmpty(sibling) && !nonEmptyElements[sibling.nodeName.toLowerCase()]) {\r
+                                               dom.remove(sibling);\r
+                                       }\r
+\r
+                                       // Remove the temp element we inserted\r
+                                       dom.remove('__tmp');\r
+                               }\r
+                       }\r
+               });\r
+       }\r
+\r
+       function removeBlockQuoteOnBackSpace() {\r
+               // Add block quote deletion handler\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       var rng, container, offset, root, parent;\r
+\r
+                       if (e.isDefaultPrevented() || e.keyCode != VK.BACKSPACE) {\r
+                               return;\r
+                       }\r
+\r
+                       rng = selection.getRng();\r
+                       container = rng.startContainer;\r
+                       offset = rng.startOffset;\r
+                       root = dom.getRoot();\r
+                       parent = container;\r
+\r
+                       if (!rng.collapsed || offset !== 0) {\r
+                               return;\r
+                       }\r
+\r
+                       while (parent && parent.parentNode && parent.parentNode.firstChild == parent && parent.parentNode != root) {\r
+                               parent = parent.parentNode;\r
+                       }\r
+\r
+                       // Is the cursor at the beginning of a blockquote?\r
+                       if (parent.tagName === 'BLOCKQUOTE') {\r
+                               // Remove the blockquote\r
+                               editor.formatter.toggle('blockquote', null, parent);\r
+\r
+                               // Move the caret to the beginning of container\r
+                               rng.setStart(container, 0);\r
+                               rng.setEnd(container, 0);\r
+                               selection.setRng(rng);\r
+                               selection.collapse(false);\r
+                       }\r
+               });\r
+       };\r
+\r
+       function setGeckoEditingOptions() {\r
+               function setOpts() {\r
+                       editor._refreshContentEditable();\r
+\r
+                       setEditorCommandState("StyleWithCSS", false);\r
+                       setEditorCommandState("enableInlineTableEditing", false);\r
+\r
+                       if (!settings.object_resizing) {\r
+                               setEditorCommandState("enableObjectResizing", false);\r
+                       }\r
+               };\r
+\r
+               if (!settings.readonly) {\r
+                       editor.onBeforeExecCommand.add(setOpts);\r
+                       editor.onMouseDown.add(setOpts);\r
+               }\r
+       };\r
+\r
+       function addBrAfterLastLinks() {\r
+               function fixLinks(editor, o) {\r
+                       tinymce.each(dom.select('a'), function(node) {\r
+                               var parentNode = node.parentNode, root = dom.getRoot();\r
+\r
+                               if (parentNode.lastChild === node) {\r
+                                       while (parentNode && !dom.isBlock(parentNode)) {\r
+                                               if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {\r
+                                                       return;\r
+                                               }\r
+\r
+                                               parentNode = parentNode.parentNode;\r
+                                       }\r
+\r
+                                       dom.add(parentNode, 'br', {'data-mce-bogus' : 1});\r
+                               }\r
+                       });\r
+               };\r
+\r
+               editor.onExecCommand.add(function(editor, cmd) {\r
+                       if (cmd === 'CreateLink') {\r
+                               fixLinks(editor);\r
+                       }\r
+               });\r
+\r
+               editor.onSetContent.add(selection.onSetContent.add(fixLinks));\r
+       };\r
+\r
+       function setDefaultBlockType() {\r
+               if (settings.forced_root_block) {\r
+                       editor.onInit.add(function() {\r
+                               setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block);\r
+                       });\r
+               }\r
+       }\r
+\r
+       function removeGhostSelection() {\r
+               function repaint(sender, args) {\r
+                       if (!sender || !args.initial) {\r
+                               editor.execCommand('mceRepaint');\r
+                       }\r
+               };\r
+\r
+               editor.onUndo.add(repaint);\r
+               editor.onRedo.add(repaint);\r
+               editor.onSetContent.add(repaint);\r
+       };\r
+\r
+       function deleteControlItemOnBackSpace() {\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       var rng;\r
+\r
+                       if (!e.isDefaultPrevented() && e.keyCode == BACKSPACE) {\r
+                               rng = editor.getDoc().selection.createRange();\r
+                               if (rng && rng.item) {\r
+                                       e.preventDefault();\r
+                                       editor.undoManager.beforeChange();\r
+                                       dom.remove(rng.item(0));\r
+                                       editor.undoManager.add();\r
+                               }\r
+                       }\r
+               });\r
+       };\r
+\r
+       function renderEmptyBlocksFix() {\r
+               var emptyBlocksCSS;\r
+\r
+               // IE10+\r
+               if (getDocumentMode() >= 10) {\r
+                       emptyBlocksCSS = '';\r
+                       tinymce.each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {\r
+                               emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';\r
+                       });\r
+\r
+                       editor.contentStyles.push(emptyBlocksCSS + '{padding-right: 1px !important}');\r
+               }\r
+       };\r
+\r
+       function fakeImageResize() {\r
+               var selectedElmX, selectedElmY, selectedElm, selectedElmGhost, selectedHandle, startX, startY, startW, startH, ratio,\r
+                       resizeHandles, width, height, rootDocument = document, editableDoc = editor.getDoc();\r
+\r
+               if (!settings.object_resizing || settings.webkit_fake_resize === false) {\r
+                       return;\r
+               }\r
+\r
+               // Try disabling object resizing if WebKit implements resizing in the future\r
+               setEditorCommandState("enableObjectResizing", false);\r
+\r
+               // Details about each resize handle how to scale etc\r
+               resizeHandles = {\r
+                       // Name: x multiplier, y multiplier, delta size x, delta size y\r
+                       n: [.5, 0, 0, -1],\r
+                       e: [1, .5, 1, 0],\r
+                       s: [.5, 1, 0, 1],\r
+                       w: [0, .5, -1, 0],\r
+                       nw: [0, 0, -1, -1],\r
+                       ne: [1, 0, 1, -1],\r
+                       se: [1, 1, 1, 1],\r
+                       sw : [0, 1, -1, 1]\r
+               };\r
+\r
+               function resizeElement(e) {\r
+                       var deltaX, deltaY;\r
+\r
+                       // Calc new width/height\r
+                       deltaX = e.screenX - startX;\r
+                       deltaY = e.screenY - startY;\r
+\r
+                       // Calc new size\r
+                       width = deltaX * selectedHandle[2] + startW;\r
+                       height = deltaY * selectedHandle[3] + startH;\r
+\r
+                       // Never scale down lower than 5 pixels\r
+                       width = width < 5 ? 5 : width;\r
+                       height = height < 5 ? 5 : height;\r
+\r
+                       // Constrain proportions when modifier key is pressed or if the nw, ne, sw, se corners are moved on an image\r
+                       if (VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0)) {\r
+                               width = Math.round(height / ratio);\r
+                               height = Math.round(width * ratio);\r
+                       }\r
+\r
+                       // Update ghost size\r
+                       dom.setStyles(selectedElmGhost, {\r
+                               width: width,\r
+                               height: height\r
+                       });\r
+\r
+                       // Update ghost X position if needed\r
+                       if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {\r
+                               dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));\r
+                       }\r
+\r
+                       // Update ghost Y position if needed\r
+                       if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {\r
+                               dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));\r
+                       }\r
+               }\r
+\r
+               function endResize() {\r
+                       function setSizeProp(name, value) {\r
+                               if (value) {\r
+                                       // Resize by using style or attribute\r
+                                       if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {\r
+                                               dom.setStyle(selectedElm, name, value);\r
+                                       } else {\r
+                                               dom.setAttrib(selectedElm, name, value);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       // Set width/height properties\r
+                       setSizeProp('width', width);\r
+                       setSizeProp('height', height);\r
+\r
+                       dom.unbind(editableDoc, 'mousemove', resizeElement);\r
+                       dom.unbind(editableDoc, 'mouseup', endResize);\r
+\r
+                       if (rootDocument != editableDoc) {\r
+                               dom.unbind(rootDocument, 'mousemove', resizeElement);\r
+                               dom.unbind(rootDocument, 'mouseup', endResize);\r
+                       }\r
+\r
+                       // Remove ghost and update resize handle positions\r
+                       dom.remove(selectedElmGhost);\r
+                       showResizeRect(selectedElm);\r
+               }\r
+\r
+               function showResizeRect(targetElm) {\r
+                       var position, targetWidth, targetHeight;\r
+\r
+                       hideResizeRect();\r
+\r
+                       // Get position and size of target\r
+                       position = dom.getPos(targetElm);\r
+                       selectedElmX = position.x;\r
+                       selectedElmY = position.y;\r
+                       targetWidth = targetElm.offsetWidth;\r
+                       targetHeight = targetElm.offsetHeight;\r
+\r
+                       // Reset width/height if user selects a new image/table\r
+                       if (selectedElm != targetElm) {\r
+                               selectedElm = targetElm;\r
+                               width = height = 0;\r
+                       }\r
+\r
+                       tinymce.each(resizeHandles, function(handle, name) {\r
+                               var handleElm;\r
+\r
+                               // Get existing or render resize handle\r
+                               handleElm = dom.get('mceResizeHandle' + name);\r
+                               if (!handleElm) {\r
+                                       handleElm = dom.add(editableDoc.documentElement, 'div', {\r
+                                               id: 'mceResizeHandle' + name,\r
+                                               'class': 'mceResizeHandle',\r
+                                               style: 'cursor:' + name + '-resize; margin:0; padding:0'\r
+                                       });\r
+\r
+                                       dom.bind(handleElm, 'mousedown', function(e) {\r
+                                               e.preventDefault();\r
+\r
+                                               endResize();\r
+\r
+                                               startX = e.screenX;\r
+                                               startY = e.screenY;\r
+                                               startW = selectedElm.clientWidth;\r
+                                               startH = selectedElm.clientHeight;\r
+                                               ratio = startH / startW;\r
+                                               selectedHandle = handle;\r
+\r
+                                               selectedElmGhost = selectedElm.cloneNode(true);\r
+                                               dom.addClass(selectedElmGhost, 'mceClonedResizable');\r
+                                               dom.setStyles(selectedElmGhost, {\r
+                                                       left: selectedElmX,\r
+                                                       top: selectedElmY,\r
+                                                       margin: 0\r
+                                               });\r
+\r
+                                               editableDoc.documentElement.appendChild(selectedElmGhost);\r
+\r
+                                               dom.bind(editableDoc, 'mousemove', resizeElement);\r
+                                               dom.bind(editableDoc, 'mouseup', endResize);\r
+\r
+                                               if (rootDocument != editableDoc) {\r
+                                                       dom.bind(rootDocument, 'mousemove', resizeElement);\r
+                                                       dom.bind(rootDocument, 'mouseup', endResize);\r
+                                               }\r
+                                       });\r
+                               } else {\r
+                                       dom.show(handleElm);\r
+                               }\r
+\r
+                               // Position element\r
+                               dom.setStyles(handleElm, {\r
+                                       left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2),\r
+                                       top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2)\r
+                               });\r
+                       });\r
+\r
+                       // Only add resize rectangle on WebKit and only on images\r
+                       if (!tinymce.isOpera && selectedElm.nodeName == "IMG") {\r
+                               selectedElm.setAttribute('data-mce-selected', '1');\r
+                       }\r
+               }\r
+\r
+               function hideResizeRect() {\r
+                       if (selectedElm) {\r
+                               selectedElm.removeAttribute('data-mce-selected');\r
+                       }\r
+\r
+                       for (var name in resizeHandles) {\r
+                               dom.hide('mceResizeHandle' + name);\r
+                       }\r
+               }\r
+\r
+               // Add CSS for resize handles, cloned element and selected\r
+               editor.contentStyles.push(\r
+                       '.mceResizeHandle {' +\r
+                               'position: absolute;' +\r
+                               'border: 1px solid black;' +\r
+                               'background: #FFF;' +\r
+                               'width: 5px;' +\r
+                               'height: 5px;' +\r
+                               'z-index: 10000' +\r
+                       '}' +\r
+                       '.mceResizeHandle:hover {' +\r
+                               'background: #000' +\r
+                       '}' +\r
+                       'img[data-mce-selected] {' +\r
+                               'outline: 1px solid black' +\r
+                       '}' +\r
+                       'img.mceClonedResizable, table.mceClonedResizable {' +\r
+                               'position: absolute;' +\r
+                               'outline: 1px dashed black;' +\r
+                               'opacity: .5;' +\r
+                               'z-index: 10000' +\r
+                       '}'\r
+               );\r
+\r
+               function updateResizeRect() {\r
+                       var controlElm = dom.getParent(selection.getNode(), 'table,img');\r
+\r
+                       // Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v\r
+                       tinymce.each(dom.select('img[data-mce-selected]'), function(img) {\r
+                               img.removeAttribute('data-mce-selected');\r
+                       });\r
+\r
+                       if (controlElm) {\r
+                               showResizeRect(controlElm);\r
+                       } else {\r
+                               hideResizeRect();\r
+                       }\r
+               }\r
+\r
+               // Show/hide resize rect when image is selected\r
+               editor.onNodeChange.add(updateResizeRect);\r
+\r
+               // Fixes WebKit quirk where it returns IMG on getNode if caret is after last image in container\r
+               dom.bind(editableDoc, 'selectionchange', updateResizeRect);\r
+\r
+               // Remove the internal attribute when serializing the DOM\r
+               editor.serializer.addAttributeFilter('data-mce-selected', function(nodes, name) {\r
+                       var i = nodes.length;\r
+\r
+                       while (i--) {\r
+                               nodes[i].attr(name, null);\r
+                       }\r
+               });\r
+       }\r
+\r
+       // All browsers\r
+       disableBackspaceIntoATable();\r
+       removeBlockQuoteOnBackSpace();\r
+       emptyEditorWhenDeleting();\r
+\r
+       // WebKit\r
+       if (tinymce.isWebKit) {\r
+               keepInlineElementOnDeleteBackspace();\r
+               cleanupStylesWhenDeleting();\r
+               inputMethodFocus();\r
+               selectControlElements();\r
+               setDefaultBlockType();\r
+\r
+               // iOS\r
+               if (tinymce.isIDevice) {\r
+                       selectionChangeNodeChanged();\r
+               } else {\r
+                       fakeImageResize();\r
+                       selectAll();\r
+               }\r
+       }\r
+\r
+       // IE\r
+       if (tinymce.isIE) {\r
+               removeHrOnBackspace();\r
+               ensureBodyHasRoleApplication();\r
+               addNewLinesBeforeBrInPre();\r
+               removePreSerializedStylesWhenSelectingControls();\r
+               deleteControlItemOnBackSpace();\r
+               renderEmptyBlocksFix();\r
+       }\r
+\r
+       // Gecko\r
+       if (tinymce.isGecko) {\r
+               removeHrOnBackspace();\r
+               focusBody();\r
+               removeStylesWhenDeletingAccrossBlockElements();\r
+               setGeckoEditingOptions();\r
+               addBrAfterLastLinks();\r
+               removeGhostSelection();\r
+       }\r
+\r
+       // Opera\r
+       if (tinymce.isOpera) {\r
+               fakeImageResize();\r
+       }\r
+};\r
+(function(tinymce) {\r
+       var namedEntities, baseEntities, reverseEntities,\r
+               attrsCharsRegExp = /[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,\r
+               textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,\r
+               rawCharsRegExp = /[<>&\"\']/g,\r
+               entityRegExp = /&(#x|#)?([\w]+);/g,\r
+               asciiMap = {\r
+                               128 : "\u20AC", 130 : "\u201A", 131 : "\u0192", 132 : "\u201E", 133 : "\u2026", 134 : "\u2020",\r
+                               135 : "\u2021", 136 : "\u02C6", 137 : "\u2030", 138 : "\u0160", 139 : "\u2039", 140 : "\u0152",\r
+                               142 : "\u017D", 145 : "\u2018", 146 : "\u2019", 147 : "\u201C", 148 : "\u201D", 149 : "\u2022",\r
+                               150 : "\u2013", 151 : "\u2014", 152 : "\u02DC", 153 : "\u2122", 154 : "\u0161", 155 : "\u203A",\r
+                               156 : "\u0153", 158 : "\u017E", 159 : "\u0178"\r
+               };\r
+\r
+       // Raw entities\r
+       baseEntities = {\r
+               '\"' : '&quot;', // Needs to be escaped since the YUI compressor would otherwise break the code\r
+               "'" : '&#39;',\r
+               '<' : '&lt;',\r
+               '>' : '&gt;',\r
+               '&' : '&amp;'\r
+       };\r
+\r
+       // Reverse lookup table for raw entities\r
+       reverseEntities = {\r
+               '&lt;' : '<',\r
+               '&gt;' : '>',\r
+               '&amp;' : '&',\r
+               '&quot;' : '"',\r
+               '&apos;' : "'"\r
+       };\r
+\r
+       // Decodes text by using the browser\r
+       function nativeDecode(text) {\r
+               var elm;\r
+\r
+               elm = document.createElement("div");\r
+               elm.innerHTML = text;\r
+\r
+               return elm.textContent || elm.innerText || text;\r
+       };\r
+\r
+       // Build a two way lookup table for the entities\r
+       function buildEntitiesLookup(items, radix) {\r
+               var i, chr, entity, lookup = {};\r
+\r
+               if (items) {\r
+                       items = items.split(',');\r
+                       radix = radix || 10;\r
+\r
+                       // Build entities lookup table\r
+                       for (i = 0; i < items.length; i += 2) {\r
+                               chr = String.fromCharCode(parseInt(items[i], radix));\r
+\r
+                               // Only add non base entities\r
+                               if (!baseEntities[chr]) {\r
+                                       entity = '&' + items[i + 1] + ';';\r
+                                       lookup[chr] = entity;\r
+                                       lookup[entity] = chr;\r
+                               }\r
+                       }\r
+\r
+                       return lookup;\r
+               }\r
+       };\r
+\r
+       // Unpack entities lookup where the numbers are in radix 32 to reduce the size\r
+       namedEntities = buildEntitiesLookup(\r
+               '50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +\r
+               '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +\r
+               '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +\r
+               '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +\r
+               '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +\r
+               '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +\r
+               '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +\r
+               '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +\r
+               '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +\r
+               '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +\r
+               'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +\r
+               'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +\r
+               't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +\r
+               'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +\r
+               'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +\r
+               '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +\r
+               '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +\r
+               '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +\r
+               '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +\r
+               '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +\r
+               'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +\r
+               'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +\r
+               'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +\r
+               '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +\r
+               '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);\r
+\r
+       tinymce.html = tinymce.html || {};\r
+\r
+       tinymce.html.Entities = {\r
+               encodeRaw : function(text, attr) {\r
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || chr;\r
+                       });\r
+               },\r
+\r
+               encodeAllRaw : function(text) {\r
+                       return ('' + text).replace(rawCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || chr;\r
+                       });\r
+               },\r
+\r
+               encodeNumeric : function(text, attr) {\r
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               // Multi byte sequence convert it to a single entity\r
+                               if (chr.length > 1)\r
+                                       return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';\r
+\r
+                               return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';\r
+                       });\r
+               },\r
+\r
+               encodeNamed : function(text, attr, entities) {\r
+                       entities = entities || namedEntities;\r
+\r
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || entities[chr] || chr;\r
+                       });\r
+               },\r
+\r
+               getEncodeFunc : function(name, entities) {\r
+                       var Entities = tinymce.html.Entities;\r
+\r
+                       entities = buildEntitiesLookup(entities) || namedEntities;\r
+\r
+                       function encodeNamedAndNumeric(text, attr) {\r
+                               return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                                       return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr;\r
+                               });\r
+                       };\r
+\r
+                       function encodeCustomNamed(text, attr) {\r
+                               return Entities.encodeNamed(text, attr, entities);\r
+                       };\r
+\r
+                       // Replace + with , to be compatible with previous TinyMCE versions\r
+                       name = tinymce.makeMap(name.replace(/\+/g, ','));\r
+\r
+                       // Named and numeric encoder\r
+                       if (name.named && name.numeric)\r
+                               return encodeNamedAndNumeric;\r
+\r
+                       // Named encoder\r
+                       if (name.named) {\r
+                               // Custom names\r
+                               if (entities)\r
+                                       return encodeCustomNamed;\r
+\r
+                               return Entities.encodeNamed;\r
+                       }\r
+\r
+                       // Numeric\r
+                       if (name.numeric)\r
+                               return Entities.encodeNumeric;\r
+\r
+                       // Raw encoder\r
+                       return Entities.encodeRaw;\r
+               },\r
+\r
+               decode : function(text) {\r
+                       return text.replace(entityRegExp, function(all, numeric, value) {\r
+                               if (numeric) {\r
+                                       value = parseInt(value, numeric.length === 2 ? 16 : 10);\r
+\r
+                                       // Support upper UTF\r
+                                       if (value > 0xFFFF) {\r
+                                               value -= 0x10000;\r
+\r
+                                               return String.fromCharCode(0xD800 + (value >> 10), 0xDC00 + (value & 0x3FF));\r
+                                       } else\r
+                                               return asciiMap[value] || String.fromCharCode(value);\r
+                               }\r
+\r
+                               return reverseEntities[all] || namedEntities[all] || nativeDecode(all);\r
+                       });\r
+               }\r
+       };\r
+})(tinymce);\r
+\r
+tinymce.html.Styles = function(settings, schema) {\r
+       var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,\r
+               urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,\r
+               styleRegExp = /\s*([^:]+):\s*([^;]+);?/g,\r
+               trimRightRegExp = /\s+$/,\r
+               urlColorRegExp = /rgb/,\r
+               undef, i, encodingLookup = {}, encodingItems;\r
+\r
+       settings = settings || {};\r
+\r
+       encodingItems = '\\" \\\' \\; \\: ; : \uFEFF'.split(' ');\r
+       for (i = 0; i < encodingItems.length; i++) {\r
+               encodingLookup[encodingItems[i]] = '\uFEFF' + i;\r
+               encodingLookup['\uFEFF' + i] = encodingItems[i];\r
+       }\r
+\r
+       function toHex(match, r, g, b) {\r
+               function hex(val) {\r
+                       val = parseInt(val).toString(16);\r
+\r
+                       return val.length > 1 ? val : '0' + val; // 0 -> 00\r
+               };\r
+\r
+               return '#' + hex(r) + hex(g) + hex(b);\r
+       };\r
+\r
+       return {\r
+               toHex : function(color) {\r
+                       return color.replace(rgbRegExp, toHex);\r
+               },\r
+\r
+               parse : function(css) {\r
+                       var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope || this;\r
+\r
+                       function compress(prefix, suffix) {\r
+                               var top, right, bottom, left;\r
+\r
+                               // Get values and check it it needs compressing\r
+                               top = styles[prefix + '-top' + suffix];\r
+                               if (!top)\r
+                                       return;\r
+\r
+                               right = styles[prefix + '-right' + suffix];\r
+                               if (top != right)\r
+                                       return;\r
+\r
+                               bottom = styles[prefix + '-bottom' + suffix];\r
+                               if (right != bottom)\r
+                                       return;\r
+\r
+                               left = styles[prefix + '-left' + suffix];\r
+                               if (bottom != left)\r
+                                       return;\r
+\r
+                               // Compress\r
+                               styles[prefix + suffix] = left;\r
+                               delete styles[prefix + '-top' + suffix];\r
+                               delete styles[prefix + '-right' + suffix];\r
+                               delete styles[prefix + '-bottom' + suffix];\r
+                               delete styles[prefix + '-left' + suffix];\r
+                       };\r
+\r
+                       function canCompress(key) {\r
+                               var value = styles[key], i;\r
+\r
+                               if (!value || value.indexOf(' ') < 0)\r
+                                       return;\r
+\r
+                               value = value.split(' ');\r
+                               i = value.length;\r
+                               while (i--) {\r
+                                       if (value[i] !== value[0])\r
+                                               return false;\r
+                               }\r
+\r
+                               styles[key] = value[0];\r
+\r
+                               return true;\r
+                       };\r
+\r
+                       function compress2(target, a, b, c) {\r
+                               if (!canCompress(a))\r
+                                       return;\r
+\r
+                               if (!canCompress(b))\r
+                                       return;\r
+\r
+                               if (!canCompress(c))\r
+                                       return;\r
+\r
+                               // Compress\r
+                               styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];\r
+                               delete styles[a];\r
+                               delete styles[b];\r
+                               delete styles[c];\r
+                       };\r
+\r
+                       // Encodes the specified string by replacing all \" \' ; : with _<num>\r
+                       function encode(str) {\r
+                               isEncoded = true;\r
+\r
+                               return encodingLookup[str];\r
+                       };\r
+\r
+                       // Decodes the specified string by replacing all _<num> with it's original value \" \' etc\r
+                       // It will also decode the \" \' if keep_slashes is set to fale or omitted\r
+                       function decode(str, keep_slashes) {\r
+                               if (isEncoded) {\r
+                                       str = str.replace(/\uFEFF[0-9]/g, function(str) {\r
+                                               return encodingLookup[str];\r
+                                       });\r
+                               }\r
+\r
+                               if (!keep_slashes)\r
+                                       str = str.replace(/\\([\'\";:])/g, "$1");\r
+\r
+                               return str;\r
+                       };\r
+\r
+                       function processUrl(match, url, url2, url3, str, str2) {\r
+                               str = str || str2;\r
+\r
+                               if (str) {\r
+                                       str = decode(str);\r
+\r
+                                       // Force strings into single quote format\r
+                                       return "'" + str.replace(/\'/g, "\\'") + "'";\r
+                               }\r
+\r
+                               url = decode(url || url2 || url3);\r
+\r
+                               // Convert the URL to relative/absolute depending on config\r
+                               if (urlConverter)\r
+                                       url = urlConverter.call(urlConverterScope, url, 'style');\r
+\r
+                               // Output new URL format\r
+                               return "url('" + url.replace(/\'/g, "\\'") + "')";\r
+                       };\r
+\r
+                       if (css) {\r
+                               // Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing\r
+                               css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) {\r
+                                       return str.replace(/[;:]/g, encode);\r
+                               });\r
+\r
+                               // Parse styles\r
+                               while (matches = styleRegExp.exec(css)) {\r
+                                       name = matches[1].replace(trimRightRegExp, '').toLowerCase();\r
+                                       value = matches[2].replace(trimRightRegExp, '');\r
+\r
+                                       if (name && value.length > 0) {\r
+                                               // Opera will produce 700 instead of bold in their style values\r
+                                               if (name === 'font-weight' && value === '700')\r
+                                                       value = 'bold';\r
+                                               else if (name === 'color' || name === 'background-color') // Lowercase colors like RED\r
+                                                       value = value.toLowerCase();            \r
+\r
+                                               // Convert RGB colors to HEX\r
+                                               value = value.replace(rgbRegExp, toHex);\r
+\r
+                                               // Convert URLs and force them into url('value') format\r
+                                               value = value.replace(urlOrStrRegExp, processUrl);\r
+                                               styles[name] = isEncoded ? decode(value, true) : value;\r
+                                       }\r
+\r
+                                       styleRegExp.lastIndex = matches.index + matches[0].length;\r
+                               }\r
+\r
+                               // Compress the styles to reduce it's size for example IE will expand styles\r
+                               compress("border", "");\r
+                               compress("border", "-width");\r
+                               compress("border", "-color");\r
+                               compress("border", "-style");\r
+                               compress("padding", "");\r
+                               compress("margin", "");\r
+                               compress2('border', 'border-width', 'border-style', 'border-color');\r
+\r
+                               // Remove pointless border, IE produces these\r
+                               if (styles.border === 'medium none')\r
+                                       delete styles.border;\r
+                       }\r
+\r
+                       return styles;\r
+               },\r
+\r
+               serialize : function(styles, element_name) {\r
+                       var css = '', name, value;\r
+\r
+                       function serializeStyles(name) {\r
+                               var styleList, i, l, value;\r
+\r
+                               styleList = schema.styles[name];\r
+                               if (styleList) {\r
+                                       for (i = 0, l = styleList.length; i < l; i++) {\r
+                                               name = styleList[i];\r
+                                               value = styles[name];\r
+\r
+                                               if (value !== undef && value.length > 0)\r
+                                                       css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       // Serialize styles according to schema\r
+                       if (element_name && schema && schema.styles) {\r
+                               // Serialize global styles and element specific styles\r
+                               serializeStyles('*');\r
+                               serializeStyles(element_name);\r
+                       } else {\r
+                               // Output the styles in the order they are inside the object\r
+                               for (name in styles) {\r
+                                       value = styles[name];\r
+\r
+                                       if (value !== undef && value.length > 0)\r
+                                               css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\r
+                               }\r
+                       }\r
+\r
+                       return css;\r
+               }\r
+       };\r
+};\r
+\r
+(function(tinymce) {\r
+       var mapCache = {}, makeMap = tinymce.makeMap, each = tinymce.each;\r
+\r
+       function split(str, delim) {\r
+               return str.split(delim || ',');\r
+       };\r
+\r
+       function unpack(lookup, data) {\r
+               var key, elements = {};\r
+\r
+               function replace(value) {\r
+                       return value.replace(/[A-Z]+/g, function(key) {\r
+                               return replace(lookup[key]);\r
+                       });\r
+               };\r
+\r
+               // Unpack lookup\r
+               for (key in lookup) {\r
+                       if (lookup.hasOwnProperty(key))\r
+                               lookup[key] = replace(lookup[key]);\r
+               }\r
+\r
+               // Unpack and parse data into object map\r
+               replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g, function(str, name, attributes, children) {\r
+                       attributes = split(attributes, '|');\r
+\r
+                       elements[name] = {\r
+                               attributes : makeMap(attributes),\r
+                               attributesOrder : attributes,\r
+                               children : makeMap(children, '|', {'#comment' : {}})\r
+                       }\r
+               });\r
+\r
+               return elements;\r
+       };\r
+\r
+       function getHTML5() {\r
+               var html5 = mapCache.html5;\r
+\r
+               if (!html5) {\r
+                       html5 = mapCache.html5 = unpack({\r
+                                       A : 'id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup',\r
+                                       B : '#|a|abbr|area|audio|b|bdo|br|button|canvas|cite|code|command|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|meta|' +\r
+                                               'meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video|wbr',\r
+                                       C : '#|a|abbr|area|address|article|aside|audio|b|bdo|blockquote|br|button|canvas|cite|code|command|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|' +\r
+                                               'figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|menu|meta|meter|nav|noscript|ol|object|output|' +\r
+                                               'p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video'\r
+                               }, 'html[A|manifest][body|head]' +\r
+                                       'head[A][base|command|link|meta|noscript|script|style|title]' +\r
+                                       'title[A][#]' +\r
+                                       'base[A|href|target][]' +\r
+                                       'link[A|href|rel|media|type|sizes][]' +\r
+                                       'meta[A|http-equiv|name|content|charset][]' +\r
+                                       'style[A|type|media|scoped][#]' +\r
+                                       'script[A|charset|type|src|defer|async][#]' +\r
+                                       'noscript[A][C]' +\r
+                                       'body[A][C]' +\r
+                                       'section[A][C]' +\r
+                                       'nav[A][C]' +\r
+                                       'article[A][C]' +\r
+                                       'aside[A][C]' +\r
+                                       'h1[A][B]' +\r
+                                       'h2[A][B]' +\r
+                                       'h3[A][B]' +\r
+                                       'h4[A][B]' +\r
+                                       'h5[A][B]' +\r
+                                       'h6[A][B]' +\r
+                                       'hgroup[A][h1|h2|h3|h4|h5|h6]' +\r
+                                       'header[A][C]' +\r
+                                       'footer[A][C]' +\r
+                                       'address[A][C]' +\r
+                                       'p[A][B]' +\r
+                                       'br[A][]' +\r
+                                       'pre[A][B]' +\r
+                                       'dialog[A][dd|dt]' +\r
+                                       'blockquote[A|cite][C]' +\r
+                                       'ol[A|start|reversed][li]' +\r
+                                       'ul[A][li]' +\r
+                                       'li[A|value][C]' +\r
+                                       'dl[A][dd|dt]' +\r
+                                       'dt[A][B]' +\r
+                                       'dd[A][C]' +\r
+                                       'a[A|href|target|ping|rel|media|type][B]' +\r
+                                       'em[A][B]' +\r
+                                       'strong[A][B]' +\r
+                                       'small[A][B]' +\r
+                                       'cite[A][B]' +\r
+                                       'q[A|cite][B]' +\r
+                                       'dfn[A][B]' +\r
+                                       'abbr[A][B]' +\r
+                                       'code[A][B]' +\r
+                                       'var[A][B]' +\r
+                                       'samp[A][B]' +\r
+                                       'kbd[A][B]' +\r
+                                       'sub[A][B]' +\r
+                                       'sup[A][B]' +\r
+                                       'i[A][B]' +\r
+                                       'b[A][B]' +\r
+                                       'mark[A][B]' +\r
+                                       'progress[A|value|max][B]' +\r
+                                       'meter[A|value|min|max|low|high|optimum][B]' +\r
+                                       'time[A|datetime][B]' +\r
+                                       'ruby[A][B|rt|rp]' +\r
+                                       'rt[A][B]' +\r
+                                       'rp[A][B]' +\r
+                                       'bdo[A][B]' +\r
+                                       'span[A][B]' +\r
+                                       'ins[A|cite|datetime][B]' +\r
+                                       'del[A|cite|datetime][B]' +\r
+                                       'figure[A][C|legend|figcaption]' +\r
+                                       'figcaption[A][C]' +\r
+                                       'img[A|alt|src|height|width|usemap|ismap][]' +\r
+                                       'iframe[A|name|src|height|width|sandbox|seamless][]' +\r
+                                       'embed[A|src|height|width|type][]' +\r
+                                       'object[A|data|type|height|width|usemap|name|form|classid][param]' +\r
+                                       'param[A|name|value][]' +\r
+                                       'details[A|open][C|legend]' +\r
+                                       'command[A|type|label|icon|disabled|checked|radiogroup][]' +\r
+                                       'menu[A|type|label][C|li]' +\r
+                                       'legend[A][C|B]' +\r
+                                       'div[A][C]' +\r
+                                       'source[A|src|type|media][]' +\r
+                                       'audio[A|src|autobuffer|autoplay|loop|controls][source]' +\r
+                                       'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]' +\r
+                                       'hr[A][]' +\r
+                                       'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' +\r
+                                       'fieldset[A|disabled|form|name][C|legend]' +\r
+                                       'label[A|form|for][B]' +\r
+                                       'input[A|type|accept|alt|autocomplete|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|' +\r
+                                               'multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]' +\r
+                                       'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]' +\r
+                                       'select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]' +\r
+                                       'datalist[A][B|option]' +\r
+                                       'optgroup[A|disabled|label][option]' +\r
+                                       'option[A|disabled|selected|label|value][]' +\r
+                                       'textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]' +\r
+                                       'keygen[A|autofocus|challenge|disabled|form|keytype|name][]' +\r
+                                       'output[A|for|form|name][B]' +\r
+                                       'canvas[A|width|height][]' +\r
+                                       'map[A|name][B|C]' +\r
+                                       'area[A|shape|coords|href|alt|target|media|rel|ping|type][]' +\r
+                                       'mathml[A][]' +\r
+                                       'svg[A][]' +\r
+                                       'table[A|border][caption|colgroup|thead|tfoot|tbody|tr]' +\r
+                                       'caption[A][C]' +\r
+                                       'colgroup[A|span][col]' +\r
+                                       'col[A|span][]' +\r
+                                       'thead[A][tr]' +\r
+                                       'tfoot[A][tr]' +\r
+                                       'tbody[A][tr]' +\r
+                                       'tr[A][th|td]' +\r
+                                       'th[A|headers|rowspan|colspan|scope][B]' +\r
+                                       'td[A|headers|rowspan|colspan][C]' +\r
+                                       'wbr[A][]'\r
+                       );\r
+               }\r
+\r
+               return html5;\r
+       };\r
+\r
+       function getHTML4() {\r
+               var html4 = mapCache.html4;\r
+\r
+               if (!html4) {\r
+                       // This is the XHTML 1.0 transitional elements with it's attributes and children packed to reduce it's size\r
+                       html4 = mapCache.html4 = unpack({\r
+                               Z : 'H|K|N|O|P',\r
+                               Y : 'X|form|R|Q',\r
+                               ZG : 'E|span|width|align|char|charoff|valign',\r
+                               X : 'p|T|div|U|W|isindex|fieldset|table',\r
+                               ZF : 'E|align|char|charoff|valign',\r
+                               W : 'pre|hr|blockquote|address|center|noframes',\r
+                               ZE : 'abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height',\r
+                               ZD : '[E][S]',\r
+                               U : 'ul|ol|dl|menu|dir',\r
+                               ZC : 'p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q',\r
+                               T : 'h1|h2|h3|h4|h5|h6',\r
+                               ZB : 'X|S|Q',\r
+                               S : 'R|P',\r
+                               ZA : 'a|G|J|M|O|P',\r
+                               R : 'a|H|K|N|O',\r
+                               Q : 'noscript|P',\r
+                               P : 'ins|del|script',\r
+                               O : 'input|select|textarea|label|button',\r
+                               N : 'M|L',\r
+                               M : 'em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym',\r
+                               L : 'sub|sup',\r
+                               K : 'J|I',\r
+                               J : 'tt|i|b|u|s|strike',\r
+                               I : 'big|small|font|basefont',\r
+                               H : 'G|F',\r
+                               G : 'br|span|bdo',\r
+                               F : 'object|applet|img|map|iframe',\r
+                               E : 'A|B|C',\r
+                               D : 'accesskey|tabindex|onfocus|onblur',\r
+                               C : 'onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup',\r
+                               B : 'lang|xml:lang|dir',\r
+                               A : 'id|class|style|title'\r
+                       }, 'script[id|charset|type|language|src|defer|xml:space][]' + \r
+                               'style[B|id|type|media|title|xml:space][]' + \r
+                               'object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]' + \r
+                               'param[id|name|value|valuetype|type][]' + \r
+                               'p[E|align][#|S]' + \r
+                               'a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]' + \r
+                               'br[A|clear][]' + \r
+                               'span[E][#|S]' + \r
+                               'bdo[A|C|B][#|S]' + \r
+                               'applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]' + \r
+                               'h1[E|align][#|S]' + \r
+                               'img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]' + \r
+                               'map[B|C|A|name][X|form|Q|area]' + \r
+                               'h2[E|align][#|S]' + \r
+                               'iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]' + \r
+                               'h3[E|align][#|S]' + \r
+                               'tt[E][#|S]' + \r
+                               'i[E][#|S]' + \r
+                               'b[E][#|S]' + \r
+                               'u[E][#|S]' + \r
+                               's[E][#|S]' + \r
+                               'strike[E][#|S]' + \r
+                               'big[E][#|S]' + \r
+                               'small[E][#|S]' + \r
+                               'font[A|B|size|color|face][#|S]' + \r
+                               'basefont[id|size|color|face][]' + \r
+                               'em[E][#|S]' + \r
+                               'strong[E][#|S]' + \r
+                               'dfn[E][#|S]' + \r
+                               'code[E][#|S]' + \r
+                               'q[E|cite][#|S]' + \r
+                               'samp[E][#|S]' + \r
+                               'kbd[E][#|S]' + \r
+                               'var[E][#|S]' + \r
+                               'cite[E][#|S]' + \r
+                               'abbr[E][#|S]' + \r
+                               'acronym[E][#|S]' + \r
+                               'sub[E][#|S]' + \r
+                               'sup[E][#|S]' + \r
+                               'input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]' + \r
+                               'select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]' + \r
+                               'optgroup[E|disabled|label][option]' + \r
+                               'option[E|selected|disabled|label|value][]' + \r
+                               'textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]' + \r
+                               'label[E|for|accesskey|onfocus|onblur][#|S]' + \r
+                               'button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]' + \r
+                               'h4[E|align][#|S]' + \r
+                               'ins[E|cite|datetime][#|Y]' + \r
+                               'h5[E|align][#|S]' + \r
+                               'del[E|cite|datetime][#|Y]' + \r
+                               'h6[E|align][#|S]' + \r
+                               'div[E|align][#|Y]' + \r
+                               'ul[E|type|compact][li]' + \r
+                               'li[E|type|value][#|Y]' + \r
+                               'ol[E|type|compact|start][li]' + \r
+                               'dl[E|compact][dt|dd]' + \r
+                               'dt[E][#|S]' + \r
+                               'dd[E][#|Y]' + \r
+                               'menu[E|compact][li]' + \r
+                               'dir[E|compact][li]' + \r
+                               'pre[E|width|xml:space][#|ZA]' + \r
+                               'hr[E|align|noshade|size|width][]' + \r
+                               'blockquote[E|cite][#|Y]' + \r
+                               'address[E][#|S|p]' + \r
+                               'center[E][#|Y]' + \r
+                               'noframes[E][#|Y]' + \r
+                               'isindex[A|B|prompt][]' + \r
+                               'fieldset[E][#|legend|Y]' + \r
+                               'legend[E|accesskey|align][#|S]' + \r
+                               'table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]' + \r
+                               'caption[E|align][#|S]' + \r
+                               'col[ZG][]' + \r
+                               'colgroup[ZG][col]' + \r
+                               'thead[ZF][tr]' + \r
+                               'tr[ZF|bgcolor][th|td]' + \r
+                               'th[E|ZE][#|Y]' + \r
+                               'form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]' + \r
+                               'noscript[E][#|Y]' + \r
+                               'td[E|ZE][#|Y]' + \r
+                               'tfoot[ZF][tr]' + \r
+                               'tbody[ZF][tr]' + \r
+                               'area[E|D|shape|coords|href|nohref|alt|target][]' + \r
+                               'base[id|href|target][]' + \r
+                               'body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]'\r
+                       );\r
+               }\r
+\r
+               return html4;\r
+       };\r
+\r
+       tinymce.html.Schema = function(settings) {\r
+               var self = this, elements = {}, children = {}, patternElements = [], validStyles, schemaItems;\r
+               var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, blockElementsMap, nonEmptyElementsMap, customElementsMap = {};\r
+\r
+               // Creates an lookup table map object for the specified option or the default value\r
+               function createLookupTable(option, default_value, extend) {\r
+                       var value = settings[option];\r
+\r
+                       if (!value) {\r
+                               // Get cached default map or make it if needed\r
+                               value = mapCache[option];\r
+\r
+                               if (!value) {\r
+                                       value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' '));\r
+                                       value = tinymce.extend(value, extend);\r
+\r
+                                       mapCache[option] = value;\r
+                               }\r
+                       } else {\r
+                               // Create custom map\r
+                               value = makeMap(value, ',', makeMap(value.toUpperCase(), ' '));\r
+                       }\r
+\r
+                       return value;\r
+               };\r
+\r
+               settings = settings || {};\r
+               schemaItems = settings.schema == "html5" ? getHTML5() : getHTML4();\r
+\r
+               // Allow all elements and attributes if verify_html is set to false\r
+               if (settings.verify_html === false)\r
+                       settings.valid_elements = '*[*]';\r
+\r
+               // Build styles list\r
+               if (settings.valid_styles) {\r
+                       validStyles = {};\r
+\r
+                       // Convert styles into a rule list\r
+                       each(settings.valid_styles, function(value, key) {\r
+                               validStyles[key] = tinymce.explode(value);\r
+                       });\r
+               }\r
+\r
+               // Setup map objects\r
+               whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script style textarea');\r
+               selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');\r
+               shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr');\r
+               boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls');\r
+               nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap);\r
+               blockElementsMap = createLookupTable('block_elements', 'h1 h2 h3 h4 h5 h6 hr p div address pre form table tbody thead tfoot ' + \r
+                                               'th tr td li ol ul caption blockquote center dl dt dd dir fieldset ' + \r
+                                               'noscript menu isindex samp header footer article section hgroup aside nav figure option datalist select optgroup');\r
+\r
+               // Converts a wildcard expression string to a regexp for example *a will become /.*a/.\r
+               function patternToRegExp(str) {\r
+                       return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');\r
+               };\r
+\r
+               // Parses the specified valid_elements string and adds to the current rules\r
+               // This function is a bit hard to read since it's heavily optimized for speed\r
+               function addValidElements(valid_elements) {\r
+                       var ei, el, ai, al, yl, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder,\r
+                               prefix, outputName, globalAttributes, globalAttributesOrder, transElement, key, childKey, value,\r
+                               elementRuleRegExp = /^([#+\-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,\r
+                               attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,\r
+                               hasPatternsRegExp = /[*?+]/;\r
+\r
+                       if (valid_elements) {\r
+                               // Split valid elements into an array with rules\r
+                               valid_elements = split(valid_elements);\r
+\r
+                               if (elements['@']) {\r
+                                       globalAttributes = elements['@'].attributes;\r
+                                       globalAttributesOrder = elements['@'].attributesOrder;\r
+                               }\r
+\r
+                               // Loop all rules\r
+                               for (ei = 0, el = valid_elements.length; ei < el; ei++) {\r
+                                       // Parse element rule\r
+                                       matches = elementRuleRegExp.exec(valid_elements[ei]);\r
+                                       if (matches) {\r
+                                               // Setup local names for matches\r
+                                               prefix = matches[1];\r
+                                               elementName = matches[2];\r
+                                               outputName = matches[3];\r
+                                               attrData = matches[4];\r
+\r
+                                               // Create new attributes and attributesOrder\r
+                                               attributes = {};\r
+                                               attributesOrder = [];\r
+\r
+                                               // Create the new element\r
+                                               element = {\r
+                                                       attributes : attributes,\r
+                                                       attributesOrder : attributesOrder\r
+                                               };\r
+\r
+                                               // Padd empty elements prefix\r
+                                               if (prefix === '#')\r
+                                                       element.paddEmpty = true;\r
+\r
+                                               // Remove empty elements prefix\r
+                                               if (prefix === '-')\r
+                                                       element.removeEmpty = true;\r
+\r
+                                               // Copy attributes from global rule into current rule\r
+                                               if (globalAttributes) {\r
+                                                       for (key in globalAttributes)\r
+                                                               attributes[key] = globalAttributes[key];\r
+\r
+                                                       attributesOrder.push.apply(attributesOrder, globalAttributesOrder);\r
+                                               }\r
+\r
+                                               // Attributes defined\r
+                                               if (attrData) {\r
+                                                       attrData = split(attrData, '|');\r
+                                                       for (ai = 0, al = attrData.length; ai < al; ai++) {\r
+                                                               matches = attrRuleRegExp.exec(attrData[ai]);\r
+                                                               if (matches) {\r
+                                                                       attr = {};\r
+                                                                       attrType = matches[1];\r
+                                                                       attrName = matches[2].replace(/::/g, ':');\r
+                                                                       prefix = matches[3];\r
+                                                                       value = matches[4];\r
+\r
+                                                                       // Required\r
+                                                                       if (attrType === '!') {\r
+                                                                               element.attributesRequired = element.attributesRequired || [];\r
+                                                                               element.attributesRequired.push(attrName);\r
+                                                                               attr.required = true;\r
+                                                                       }\r
+\r
+                                                                       // Denied from global\r
+                                                                       if (attrType === '-') {\r
+                                                                               delete attributes[attrName];\r
+                                                                               attributesOrder.splice(tinymce.inArray(attributesOrder, attrName), 1);\r
+                                                                               continue;\r
+                                                                       }\r
+\r
+                                                                       // Default value\r
+                                                                       if (prefix) {\r
+                                                                               // Default value\r
+                                                                               if (prefix === '=') {\r
+                                                                                       element.attributesDefault = element.attributesDefault || [];\r
+                                                                                       element.attributesDefault.push({name: attrName, value: value});\r
+                                                                                       attr.defaultValue = value;\r
+                                                                               }\r
+\r
+                                                                               // Forced value\r
+                                                                               if (prefix === ':') {\r
+                                                                                       element.attributesForced = element.attributesForced || [];\r
+                                                                                       element.attributesForced.push({name: attrName, value: value});\r
+                                                                                       attr.forcedValue = value;\r
+                                                                               }\r
+\r
+                                                                               // Required values\r
+                                                                               if (prefix === '<')\r
+                                                                                       attr.validValues = makeMap(value, '?');\r
+                                                                       }\r
+\r
+                                                                       // Check for attribute patterns\r
+                                                                       if (hasPatternsRegExp.test(attrName)) {\r
+                                                                               element.attributePatterns = element.attributePatterns || [];\r
+                                                                               attr.pattern = patternToRegExp(attrName);\r
+                                                                               element.attributePatterns.push(attr);\r
+                                                                       } else {\r
+                                                                               // Add attribute to order list if it doesn't already exist\r
+                                                                               if (!attributes[attrName])\r
+                                                                                       attributesOrder.push(attrName);\r
+\r
+                                                                               attributes[attrName] = attr;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Global rule, store away these for later usage\r
+                                               if (!globalAttributes && elementName == '@') {\r
+                                                       globalAttributes = attributes;\r
+                                                       globalAttributesOrder = attributesOrder;\r
+                                               }\r
+\r
+                                               // Handle substitute elements such as b/strong\r
+                                               if (outputName) {\r
+                                                       element.outputName = elementName;\r
+                                                       elements[outputName] = element;\r
+                                               }\r
+\r
+                                               // Add pattern or exact element\r
+                                               if (hasPatternsRegExp.test(elementName)) {\r
+                                                       element.pattern = patternToRegExp(elementName);\r
+                                                       patternElements.push(element);\r
+                                               } else\r
+                                                       elements[elementName] = element;\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function setValidElements(valid_elements) {\r
+                       elements = {};\r
+                       patternElements = [];\r
+\r
+                       addValidElements(valid_elements);\r
+\r
+                       each(schemaItems, function(element, name) {\r
+                               children[name] = element.children;\r
+                       });\r
+               };\r
+\r
+               // Adds custom non HTML elements to the schema\r
+               function addCustomElements(custom_elements) {\r
+                       var customElementRegExp = /^(~)?(.+)$/;\r
+\r
+                       if (custom_elements) {\r
+                               each(split(custom_elements), function(rule) {\r
+                                       var matches = customElementRegExp.exec(rule),\r
+                                               inline = matches[1] === '~',\r
+                                               cloneName = inline ? 'span' : 'div',\r
+                                               name = matches[2];\r
+\r
+                                       children[name] = children[cloneName];\r
+                                       customElementsMap[name] = cloneName;\r
+\r
+                                       // If it's not marked as inline then add it to valid block elements\r
+                                       if (!inline)\r
+                                               blockElementsMap[name] = {};\r
+\r
+                                       // Add custom elements at span/div positions\r
+                                       each(children, function(element, child) {\r
+                                               if (element[cloneName])\r
+                                                       element[name] = element[cloneName];\r
+                                       });\r
+                               });\r
+                       }\r
+               };\r
+\r
+               // Adds valid children to the schema object\r
+               function addValidChildren(valid_children) {\r
+                       var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;\r
+\r
+                       if (valid_children) {\r
+                               each(split(valid_children), function(rule) {\r
+                                       var matches = childRuleRegExp.exec(rule), parent, prefix;\r
+\r
+                                       if (matches) {\r
+                                               prefix = matches[1];\r
+\r
+                                               // Add/remove items from default\r
+                                               if (prefix)\r
+                                                       parent = children[matches[2]];\r
+                                               else\r
+                                                       parent = children[matches[2]] = {'#comment' : {}};\r
+\r
+                                               parent = children[matches[2]];\r
+\r
+                                               each(split(matches[3], '|'), function(child) {\r
+                                                       if (prefix === '-')\r
+                                                               delete parent[child];\r
+                                                       else\r
+                                                               parent[child] = {};\r
+                                               });\r
+                                       }\r
+                               });\r
+                       }\r
+               };\r
+\r
+               function getElementRule(name) {\r
+                       var element = elements[name], i;\r
+\r
+                       // Exact match found\r
+                       if (element)\r
+                               return element;\r
+\r
+                       // No exact match then try the patterns\r
+                       i = patternElements.length;\r
+                       while (i--) {\r
+                               element = patternElements[i];\r
+\r
+                               if (element.pattern.test(name))\r
+                                       return element;\r
+                       }\r
+               };\r
+\r
+               if (!settings.valid_elements) {\r
+                       // No valid elements defined then clone the elements from the schema spec\r
+                       each(schemaItems, function(element, name) {\r
+                               elements[name] = {\r
+                                       attributes : element.attributes,\r
+                                       attributesOrder : element.attributesOrder\r
+                               };\r
+\r
+                               children[name] = element.children;\r
+                       });\r
+\r
+                       // Switch these on HTML4\r
+                       if (settings.schema != "html5") {\r
+                               each(split('strong/b,em/i'), function(item) {\r
+                                       item = split(item, '/');\r
+                                       elements[item[1]].outputName = item[0];\r
+                               });\r
+                       }\r
+\r
+                       // Add default alt attribute for images\r
+                       elements.img.attributesDefault = [{name: 'alt', value: ''}];\r
+\r
+                       // Remove these if they are empty by default\r
+                       each(split('ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,em,b,i'), function(name) {\r
+                               if (elements[name]) {\r
+                                       elements[name].removeEmpty = true;\r
+                               }\r
+                       });\r
+\r
+                       // Padd these by default\r
+                       each(split('p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption'), function(name) {\r
+                               elements[name].paddEmpty = true;\r
+                       });\r
+               } else\r
+                       setValidElements(settings.valid_elements);\r
+\r
+               addCustomElements(settings.custom_elements);\r
+               addValidChildren(settings.valid_children);\r
+               addValidElements(settings.extended_valid_elements);\r
+\r
+               // Todo: Remove this when we fix list handling to be valid\r
+               addValidChildren('+ol[ul|ol],+ul[ul|ol]');\r
+\r
+               // Delete invalid elements\r
+               if (settings.invalid_elements) {\r
+                       tinymce.each(tinymce.explode(settings.invalid_elements), function(item) {\r
+                               if (elements[item])\r
+                                       delete elements[item];\r
+                       });\r
+               }\r
+\r
+               // If the user didn't allow span only allow internal spans\r
+               if (!getElementRule('span'))\r
+                       addValidElements('span[!data-mce-type|*]');\r
+\r
+               self.children = children;\r
+\r
+               self.styles = validStyles;\r
+\r
+               self.getBoolAttrs = function() {\r
+                       return boolAttrMap;\r
+               };\r
+\r
+               self.getBlockElements = function() {\r
+                       return blockElementsMap;\r
+               };\r
+\r
+               self.getShortEndedElements = function() {\r
+                       return shortEndedElementsMap;\r
+               };\r
+\r
+               self.getSelfClosingElements = function() {\r
+                       return selfClosingElementsMap;\r
+               };\r
+\r
+               self.getNonEmptyElements = function() {\r
+                       return nonEmptyElementsMap;\r
+               };\r
+\r
+               self.getWhiteSpaceElements = function() {\r
+                       return whiteSpaceElementsMap;\r
+               };\r
+\r
+               self.isValidChild = function(name, child) {\r
+                       var parent = children[name];\r
+\r
+                       return !!(parent && parent[child]);\r
+               };\r
+\r
+               self.isValid = function(name, attr) {\r
+                       var attrPatterns, i, rule = getElementRule(name);\r
+\r
+                       // Check if it's a valid element\r
+                       if (rule) {\r
+                               if (attr) {\r
+                                       // Check if attribute name exists\r
+                                       if (rule.attributes[attr]) {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       // Check if attribute matches a regexp pattern\r
+                                       attrPatterns = rule.attributePatterns;\r
+                                       if (attrPatterns) {\r
+                                               i = attrPatterns.length;\r
+                                               while (i--) {\r
+                                                       if (attrPatterns[i].pattern.test(name)) {\r
+                                                               return true;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               } else {\r
+                                       return true;\r
+                               }\r
+                       }\r
+\r
+                       // No match\r
+                       return false;\r
+               };\r
+               \r
+               self.getElementRule = getElementRule;\r
+\r
+               self.getCustomElements = function() {\r
+                       return customElementsMap;\r
+               };\r
+\r
+               self.addValidElements = addValidElements;\r
+\r
+               self.setValidElements = setValidElements;\r
+\r
+               self.addCustomElements = addCustomElements;\r
+\r
+               self.addValidChildren = addValidChildren;\r
+       };\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       tinymce.html.SaxParser = function(settings, schema) {\r
+               var self = this, noop = function() {};\r
+\r
+               settings = settings || {};\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
+\r
+               if (settings.fix_self_closing !== false)\r
+                       settings.fix_self_closing = true;\r
+\r
+               // Add handler functions from settings and setup default handlers\r
+               tinymce.each('comment cdata text start end pi doctype'.split(' '), function(name) {\r
+                       if (name)\r
+                               self[name] = settings[name] || noop;\r
+               });\r
+\r
+               self.parse = function(html) {\r
+                       var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name, isInternalElement, removeInternalElements,\r
+                               shortEndedElements, fillAttrsMap, isShortEnded, validate, elementRule, isValidElement, attr, attribsValue, invalidPrefixRegExp,\r
+                               validAttributesMap, validAttributePatterns, attributesRequired, attributesDefault, attributesForced, selfClosing,\r
+                               tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0, decode = tinymce.html.Entities.decode, fixSelfClosing, isIE;\r
+\r
+                       function processEndTag(name) {\r
+                               var pos, i;\r
+\r
+                               // Find position of parent of the same type\r
+                               pos = stack.length;\r
+                               while (pos--) {\r
+                                       if (stack[pos].name === name)\r
+                                               break;                                          \r
+                               }\r
+\r
+                               // Found parent\r
+                               if (pos >= 0) {\r
+                                       // Close all the open elements\r
+                                       for (i = stack.length - 1; i >= pos; i--) {\r
+                                               name = stack[i];\r
+\r
+                                               if (name.valid)\r
+                                                       self.end(name.name);\r
+                                       }\r
+\r
+                                       // Remove the open elements from the stack\r
+                                       stack.length = pos;\r
+                               }\r
+                       };\r
+\r
+                       function parseAttribute(match, name, value, val2, val3) {\r
+                               var attrRule, i;\r
+\r
+                               name = name.toLowerCase();\r
+                               value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute\r
+\r
+                               // Validate name and value\r
+                               if (validate && !isInternalElement && name.indexOf('data-') !== 0) {\r
+                                       attrRule = validAttributesMap[name];\r
+\r
+                                       // Find rule by pattern matching\r
+                                       if (!attrRule && validAttributePatterns) {\r
+                                               i = validAttributePatterns.length;\r
+                                               while (i--) {\r
+                                                       attrRule = validAttributePatterns[i];\r
+                                                       if (attrRule.pattern.test(name))\r
+                                                               break;\r
+                                               }\r
+\r
+                                               // No rule matched\r
+                                               if (i === -1)\r
+                                                       attrRule = null;\r
+                                       }\r
+\r
+                                       // No attribute rule found\r
+                                       if (!attrRule)\r
+                                               return;\r
+\r
+                                       // Validate value\r
+                                       if (attrRule.validValues && !(value in attrRule.validValues))\r
+                                               return;\r
+                               }\r
+\r
+                               // Add attribute to list and map\r
+                               attrList.map[name] = value;\r
+                               attrList.push({\r
+                                       name: name,\r
+                                       value: value\r
+                               });\r
+                       };\r
+\r
+                       // Precompile RegExps and map objects\r
+                       tokenRegExp = new RegExp('<(?:' +\r
+                               '(?:!--([\\w\\W]*?)-->)|' + // Comment\r
+                               '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA\r
+                               '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE\r
+                               '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI\r
+                               '(?:\\/([^>]+)>)|' + // End element\r
+                               '(?:([A-Za-z0-9\\-\\:]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element\r
+                       ')', 'g');\r
+\r
+                       attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;\r
+                       specialElements = {\r
+                               'script' : /<\/script[^>]*>/gi,\r
+                               'style' : /<\/style[^>]*>/gi,\r
+                               'noscript' : /<\/noscript[^>]*>/gi\r
+                       };\r
+\r
+                       // Setup lookup tables for empty elements and boolean attributes\r
+                       shortEndedElements = schema.getShortEndedElements();\r
+                       selfClosing = settings.self_closing_elements || schema.getSelfClosingElements();\r
+                       fillAttrsMap = schema.getBoolAttrs();\r
+                       validate = settings.validate;\r
+                       removeInternalElements = settings.remove_internals;\r
+                       fixSelfClosing = settings.fix_self_closing;\r
+                       isIE = tinymce.isIE;\r
+                       invalidPrefixRegExp = /^:/;\r
+\r
+                       while (matches = tokenRegExp.exec(html)) {\r
+                               // Text\r
+                               if (index < matches.index)\r
+                                       self.text(decode(html.substr(index, matches.index - index)));\r
+\r
+                               if (value = matches[6]) { // End element\r
+                                       value = value.toLowerCase();\r
+\r
+                                       // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements\r
+                                       if (isIE && invalidPrefixRegExp.test(value))\r
+                                               value = value.substr(1);\r
+\r
+                                       processEndTag(value);\r
+                               } else if (value = matches[7]) { // Start element\r
+                                       value = value.toLowerCase();\r
+\r
+                                       // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements\r
+                                       if (isIE && invalidPrefixRegExp.test(value))\r
+                                               value = value.substr(1);\r
+\r
+                                       isShortEnded = value in shortEndedElements;\r
+\r
+                                       // Is self closing tag for example an <li> after an open <li>\r
+                                       if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value)\r
+                                               processEndTag(value);\r
+\r
+                                       // Validate element\r
+                                       if (!validate || (elementRule = schema.getElementRule(value))) {\r
+                                               isValidElement = true;\r
+\r
+                                               // Grab attributes map and patters when validation is enabled\r
+                                               if (validate) {\r
+                                                       validAttributesMap = elementRule.attributes;\r
+                                                       validAttributePatterns = elementRule.attributePatterns;\r
+                                               }\r
+\r
+                                               // Parse attributes\r
+                                               if (attribsValue = matches[8]) {\r
+                                                       isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element\r
+\r
+                                                       // If the element has internal attributes then remove it if we are told to do so\r
+                                                       if (isInternalElement && removeInternalElements)\r
+                                                               isValidElement = false;\r
+\r
+                                                       attrList = [];\r
+                                                       attrList.map = {};\r
+\r
+                                                       attribsValue.replace(attrRegExp, parseAttribute);\r
+                                               } else {\r
+                                                       attrList = [];\r
+                                                       attrList.map = {};\r
+                                               }\r
+\r
+                                               // Process attributes if validation is enabled\r
+                                               if (validate && !isInternalElement) {\r
+                                                       attributesRequired = elementRule.attributesRequired;\r
+                                                       attributesDefault = elementRule.attributesDefault;\r
+                                                       attributesForced = elementRule.attributesForced;\r
+\r
+                                                       // Handle forced attributes\r
+                                                       if (attributesForced) {\r
+                                                               i = attributesForced.length;\r
+                                                               while (i--) {\r
+                                                                       attr = attributesForced[i];\r
+                                                                       name = attr.name;\r
+                                                                       attrValue = attr.value;\r
+\r
+                                                                       if (attrValue === '{$uid}')\r
+                                                                               attrValue = 'mce_' + idCount++;\r
+\r
+                                                                       attrList.map[name] = attrValue;\r
+                                                                       attrList.push({name: name, value: attrValue});\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       // Handle default attributes\r
+                                                       if (attributesDefault) {\r
+                                                               i = attributesDefault.length;\r
+                                                               while (i--) {\r
+                                                                       attr = attributesDefault[i];\r
+                                                                       name = attr.name;\r
+\r
+                                                                       if (!(name in attrList.map)) {\r
+                                                                               attrValue = attr.value;\r
+\r
+                                                                               if (attrValue === '{$uid}')\r
+                                                                                       attrValue = 'mce_' + idCount++;\r
+\r
+                                                                               attrList.map[name] = attrValue;\r
+                                                                               attrList.push({name: name, value: attrValue});\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       // Handle required attributes\r
+                                                       if (attributesRequired) {\r
+                                                               i = attributesRequired.length;\r
+                                                               while (i--) {\r
+                                                                       if (attributesRequired[i] in attrList.map)\r
+                                                                               break;\r
+                                                               }\r
+\r
+                                                               // None of the required attributes where found\r
+                                                               if (i === -1)\r
+                                                                       isValidElement = false;\r
+                                                       }\r
+\r
+                                                       // Invalidate element if it's marked as bogus\r
+                                                       if (attrList.map['data-mce-bogus'])\r
+                                                               isValidElement = false;\r
+                                               }\r
+\r
+                                               if (isValidElement)\r
+                                                       self.start(value, attrList, isShortEnded);\r
+                                       } else\r
+                                               isValidElement = false;\r
+\r
+                                       // Treat script, noscript and style a bit different since they may include code that looks like elements\r
+                                       if (endRegExp = specialElements[value]) {\r
+                                               endRegExp.lastIndex = index = matches.index + matches[0].length;\r
+\r
+                                               if (matches = endRegExp.exec(html)) {\r
+                                                       if (isValidElement)\r
+                                                               text = html.substr(index, matches.index - index);\r
+\r
+                                                       index = matches.index + matches[0].length;\r
+                                               } else {\r
+                                                       text = html.substr(index);\r
+                                                       index = html.length;\r
+                                               }\r
+\r
+                                               if (isValidElement && text.length > 0)\r
+                                                       self.text(text, true);\r
+\r
+                                               if (isValidElement)\r
+                                                       self.end(value);\r
+\r
+                                               tokenRegExp.lastIndex = index;\r
+                                               continue;\r
+                                       }\r
+\r
+                                       // Push value on to stack\r
+                                       if (!isShortEnded) {\r
+                                               if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1)\r
+                                                       stack.push({name: value, valid: isValidElement});\r
+                                               else if (isValidElement)\r
+                                                       self.end(value);\r
+                                       }\r
+                               } else if (value = matches[1]) { // Comment\r
+                                       self.comment(value);\r
+                               } else if (value = matches[2]) { // CDATA\r
+                                       self.cdata(value);\r
+                               } else if (value = matches[3]) { // DOCTYPE\r
+                                       self.doctype(value);\r
+                               } else if (value = matches[4]) { // PI\r
+                                       self.pi(value, matches[5]);\r
+                               }\r
+\r
+                               index = matches.index + matches[0].length;\r
+                       }\r
+\r
+                       // Text\r
+                       if (index < html.length)\r
+                               self.text(decode(html.substr(index)));\r
+\r
+                       // Close any open elements\r
+                       for (i = stack.length - 1; i >= 0; i--) {\r
+                               value = stack[i];\r
+\r
+                               if (value.valid)\r
+                                       self.end(value.name);\r
+                       }\r
+               };\r
+       }\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = {\r
+               '#text' : 3,\r
+               '#comment' : 8,\r
+               '#cdata' : 4,\r
+               '#pi' : 7,\r
+               '#doctype' : 10,\r
+               '#document-fragment' : 11\r
+       };\r
+\r
+       // Walks the tree left/right\r
+       function walk(node, root_node, prev) {\r
+               var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';\r
+\r
+               // Walk into nodes if it has a start\r
+               if (node[startName])\r
+                       return node[startName];\r
+\r
+               // Return the sibling if it has one\r
+               if (node !== root_node) {\r
+                       sibling = node[siblingName];\r
+\r
+                       if (sibling)\r
+                               return sibling;\r
+\r
+                       // Walk up the parents to look for siblings\r
+                       for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) {\r
+                               sibling = parent[siblingName];\r
+\r
+                               if (sibling)\r
+                                       return sibling;\r
+                       }\r
+               }\r
+       };\r
+\r
+       function Node(name, type) {\r
+               this.name = name;\r
+               this.type = type;\r
+\r
+               if (type === 1) {\r
+                       this.attributes = [];\r
+                       this.attributes.map = {};\r
+               }\r
+       }\r
+\r
+       tinymce.extend(Node.prototype, {\r
+               replace : function(node) {\r
+                       var self = this;\r
+\r
+                       if (node.parent)\r
+                               node.remove();\r
+\r
+                       self.insert(node, self);\r
+                       self.remove();\r
+\r
+                       return self;\r
+               },\r
+\r
+               attr : function(name, value) {\r
+                       var self = this, attrs, i, undef;\r
+\r
+                       if (typeof name !== "string") {\r
+                               for (i in name)\r
+                                       self.attr(i, name[i]);\r
+\r
+                               return self;\r
+                       }\r
+\r
+                       if (attrs = self.attributes) {\r
+                               if (value !== undef) {\r
+                                       // Remove attribute\r
+                                       if (value === null) {\r
+                                               if (name in attrs.map) {\r
+                                                       delete attrs.map[name];\r
+\r
+                                                       i = attrs.length;\r
+                                                       while (i--) {\r
+                                                               if (attrs[i].name === name) {\r
+                                                                       attrs = attrs.splice(i, 1);\r
+                                                                       return self;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+\r
+                                               return self;\r
+                                       }\r
+\r
+                                       // Set attribute\r
+                                       if (name in attrs.map) {\r
+                                               // Set attribute\r
+                                               i = attrs.length;\r
+                                               while (i--) {\r
+                                                       if (attrs[i].name === name) {\r
+                                                               attrs[i].value = value;\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                       } else\r
+                                               attrs.push({name: name, value: value});\r
+\r
+                                       attrs.map[name] = value;\r
+\r
+                                       return self;\r
+                               } else {\r
+                                       return attrs.map[name];\r
+                               }\r
+                       }\r
+               },\r
+\r
+               clone : function() {\r
+                       var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs;\r
+\r
+                       // Clone element attributes\r
+                       if (selfAttrs = self.attributes) {\r
+                               cloneAttrs = [];\r
+                               cloneAttrs.map = {};\r
+\r
+                               for (i = 0, l = selfAttrs.length; i < l; i++) {\r
+                                       selfAttr = selfAttrs[i];\r
+\r
+                                       // Clone everything except id\r
+                                       if (selfAttr.name !== 'id') {\r
+                                               cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value};\r
+                                               cloneAttrs.map[selfAttr.name] = selfAttr.value;\r
+                                       }\r
+                               }\r
+\r
+                               clone.attributes = cloneAttrs;\r
+                       }\r
+\r
+                       clone.value = self.value;\r
+                       clone.shortEnded = self.shortEnded;\r
+\r
+                       return clone;\r
+               },\r
+\r
+               wrap : function(wrapper) {\r
+                       var self = this;\r
+\r
+                       self.parent.insert(wrapper, self);\r
+                       wrapper.append(self);\r
+\r
+                       return self;\r
+               },\r
+\r
+               unwrap : function() {\r
+                       var self = this, node, next;\r
+\r
+                       for (node = self.firstChild; node; ) {\r
+                               next = node.next;\r
+                               self.insert(node, self, true);\r
+                               node = next;\r
+                       }\r
+\r
+                       self.remove();\r
+               },\r
+\r
+               remove : function() {\r
+                       var self = this, parent = self.parent, next = self.next, prev = self.prev;\r
+\r
+                       if (parent) {\r
+                               if (parent.firstChild === self) {\r
+                                       parent.firstChild = next;\r
+\r
+                                       if (next)\r
+                                               next.prev = null;\r
+                               } else {\r
+                                       prev.next = next;\r
+                               }\r
+\r
+                               if (parent.lastChild === self) {\r
+                                       parent.lastChild = prev;\r
+\r
+                                       if (prev)\r
+                                               prev.next = null;\r
+                               } else {\r
+                                       next.prev = prev;\r
+                               }\r
+\r
+                               self.parent = self.next = self.prev = null;\r
+                       }\r
+\r
+                       return self;\r
+               },\r
+\r
+               append : function(node) {\r
+                       var self = this, last;\r
+\r
+                       if (node.parent)\r
+                               node.remove();\r
+\r
+                       last = self.lastChild;\r
+                       if (last) {\r
+                               last.next = node;\r
+                               node.prev = last;\r
+                               self.lastChild = node;\r
+                       } else\r
+                               self.lastChild = self.firstChild = node;\r
+\r
+                       node.parent = self;\r
+\r
+                       return node;\r
+               },\r
+\r
+               insert : function(node, ref_node, before) {\r
+                       var parent;\r
+\r
+                       if (node.parent)\r
+                               node.remove();\r
+\r
+                       parent = ref_node.parent || this;\r
+\r
+                       if (before) {\r
+                               if (ref_node === parent.firstChild)\r
+                                       parent.firstChild = node;\r
+                               else\r
+                                       ref_node.prev.next = node;\r
+\r
+                               node.prev = ref_node.prev;\r
+                               node.next = ref_node;\r
+                               ref_node.prev = node;\r
+                       } else {\r
+                               if (ref_node === parent.lastChild)\r
+                                       parent.lastChild = node;\r
+                               else\r
+                                       ref_node.next.prev = node;\r
+\r
+                               node.next = ref_node.next;\r
+                               node.prev = ref_node;\r
+                               ref_node.next = node;\r
+                       }\r
+\r
+                       node.parent = parent;\r
+\r
+                       return node;\r
+               },\r
+\r
+               getAll : function(name) {\r
+                       var self = this, node, collection = [];\r
+\r
+                       for (node = self.firstChild; node; node = walk(node, self)) {\r
+                               if (node.name === name)\r
+                                       collection.push(node);\r
+                       }\r
+\r
+                       return collection;\r
+               },\r
+\r
+               empty : function() {\r
+                       var self = this, nodes, i, node;\r
+\r
+                       // Remove all children\r
+                       if (self.firstChild) {\r
+                               nodes = [];\r
+\r
+                               // Collect the children\r
+                               for (node = self.firstChild; node; node = walk(node, self))\r
+                                       nodes.push(node);\r
+\r
+                               // Remove the children\r
+                               i = nodes.length;\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;\r
+                               }\r
+                       }\r
+\r
+                       self.firstChild = self.lastChild = null;\r
+\r
+                       return self;\r
+               },\r
+\r
+               isEmpty : function(elements) {\r
+                       var self = this, node = self.firstChild, i, name;\r
+\r
+                       if (node) {\r
+                               do {\r
+                                       if (node.type === 1) {\r
+                                               // Ignore bogus elements\r
+                                               if (node.attributes.map['data-mce-bogus'])\r
+                                                       continue;\r
+\r
+                                               // Keep empty elements like <img />\r
+                                               if (elements[node.name])\r
+                                                       return false;\r
+\r
+                                               // Keep elements with data attributes or name attribute like <a name="1"></a>\r
+                                               i = node.attributes.length;\r
+                                               while (i--) {\r
+                                                       name = node.attributes[i].name;\r
+                                                       if (name === "name" || name.indexOf('data-') === 0)\r
+                                                               return false;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Keep comments\r
+                                       if (node.type === 8)\r
+                                               return false;\r
+                                       \r
+                                       // Keep non whitespace text nodes\r
+                                       if ((node.type === 3 && !whiteSpaceRegExp.test(node.value)))\r
+                                               return false;\r
+                               } while (node = walk(node, self));\r
+                       }\r
+\r
+                       return true;\r
+               },\r
+\r
+               walk : function(prev) {\r
+                       return walk(this, null, prev);\r
+               }\r
+       });\r
+\r
+       tinymce.extend(Node, {\r
+               create : function(name, attrs) {\r
+                       var node, attrName;\r
+\r
+                       // Create node\r
+                       node = new Node(name, typeLookup[name] || 1);\r
+\r
+                       // Add attributes if needed\r
+                       if (attrs) {\r
+                               for (attrName in attrs)\r
+                                       node.attr(attrName, attrs[attrName]);\r
+                       }\r
+\r
+                       return node;\r
+               }\r
+       });\r
+\r
+       tinymce.html.Node = Node;\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Node = tinymce.html.Node;\r
+\r
+       tinymce.html.DomParser = function(settings, schema) {\r
+               var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {};\r
+\r
+               settings = settings || {};\r
+               settings.validate = "validate" in settings ? settings.validate : true;\r
+               settings.root_name = settings.root_name || 'body';\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
+\r
+               function fixInvalidChildren(nodes) {\r
+                       var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i,\r
+                               childClone, nonEmptyElements, nonSplitableElements, sibling, nextNode;\r
+\r
+                       nonSplitableElements = tinymce.makeMap('tr,td,th,tbody,thead,tfoot,table');\r
+                       nonEmptyElements = schema.getNonEmptyElements();\r
+\r
+                       for (ni = 0; ni < nodes.length; ni++) {\r
+                               node = nodes[ni];\r
+\r
+                               // Already removed\r
+                               if (!node.parent)\r
+                                       continue;\r
+\r
+                               // Get list of all parent nodes until we find a valid parent to stick the child into\r
+                               parents = [node];\r
+                               for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent)\r
+                                       parents.push(parent);\r
+\r
+                               // Found a suitable parent\r
+                               if (parent && parents.length > 1) {\r
+                                       // Reverse the array since it makes looping easier\r
+                                       parents.reverse();\r
+\r
+                                       // Clone the related parent and insert that after the moved node\r
+                                       newParent = currentNode = self.filterNode(parents[0].clone());\r
+\r
+                                       // Start cloning and moving children on the left side of the target node\r
+                                       for (i = 0; i < parents.length - 1; i++) {\r
+                                               if (schema.isValidChild(currentNode.name, parents[i].name)) {\r
+                                                       tempNode = self.filterNode(parents[i].clone());\r
+                                                       currentNode.append(tempNode);\r
+                                               } else\r
+                                                       tempNode = currentNode;\r
+\r
+                                               for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1]; ) {\r
+                                                       nextNode = childNode.next;\r
+                                                       tempNode.append(childNode);\r
+                                                       childNode = nextNode;\r
+                                               }\r
+\r
+                                               currentNode = tempNode;\r
+                                       }\r
+\r
+                                       if (!newParent.isEmpty(nonEmptyElements)) {\r
+                                               parent.insert(newParent, parents[0], true);\r
+                                               parent.insert(node, newParent);\r
+                                       } else {\r
+                                               parent.insert(node, parents[0], true);\r
+                                       }\r
+\r
+                                       // Check if the element is empty by looking through it's contents and special treatment for <p><br /></p>\r
+                                       parent = parents[0];\r
+                                       if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') {\r
+                                               parent.empty().remove();\r
+                                       }\r
+                               } else if (node.parent) {\r
+                                       // If it's an LI try to find a UL/OL for it or wrap it\r
+                                       if (node.name === 'li') {\r
+                                               sibling = node.prev;\r
+                                               if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {\r
+                                                       sibling.append(node);\r
+                                                       continue;\r
+                                               }\r
+\r
+                                               sibling = node.next;\r
+                                               if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {\r
+                                                       sibling.insert(node, sibling.firstChild, true);\r
+                                                       continue;\r
+                                               }\r
+\r
+                                               node.wrap(self.filterNode(new Node('ul', 1)));\r
+                                               continue;\r
+                                       }\r
+\r
+                                       // Try wrapping the element in a DIV\r
+                                       if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {\r
+                                               node.wrap(self.filterNode(new Node('div', 1)));\r
+                                       } else {\r
+                                               // We failed wrapping it, then remove or unwrap it\r
+                                               if (node.name === 'style' || node.name === 'script')\r
+                                                       node.empty().remove();\r
+                                               else\r
+                                                       node.unwrap();\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               self.filterNode = function(node) {\r
+                       var i, name, list;\r
+\r
+                       // Run element filters\r
+                       if (name in nodeFilters) {\r
+                               list = matchedNodes[name];\r
+\r
+                               if (list)\r
+                                       list.push(node);\r
+                               else\r
+                                       matchedNodes[name] = [node];\r
+                       }\r
+\r
+                       // Run attribute filters\r
+                       i = attributeFilters.length;\r
+                       while (i--) {\r
+                               name = attributeFilters[i].name;\r
+\r
+                               if (name in node.attributes.map) {\r
+                                       list = matchedAttributes[name];\r
+\r
+                                       if (list)\r
+                                               list.push(node);\r
+                                       else\r
+                                               matchedAttributes[name] = [node];\r
+                               }\r
+                       }\r
+\r
+                       return node;\r
+               };\r
+\r
+               self.addNodeFilter = function(name, callback) {\r
+                       tinymce.each(tinymce.explode(name), function(name) {\r
+                               var list = nodeFilters[name];\r
+\r
+                               if (!list)\r
+                                       nodeFilters[name] = list = [];\r
+\r
+                               list.push(callback);\r
+                       });\r
+               };\r
+\r
+               self.addAttributeFilter = function(name, callback) {\r
+                       tinymce.each(tinymce.explode(name), function(name) {\r
+                               var i;\r
+\r
+                               for (i = 0; i < attributeFilters.length; i++) {\r
+                                       if (attributeFilters[i].name === name) {\r
+                                               attributeFilters[i].callbacks.push(callback);\r
+                                               return;\r
+                                       }\r
+                               }\r
+\r
+                               attributeFilters.push({name: name, callbacks: [callback]});\r
+                       });\r
+               };\r
+\r
+               self.parse = function(html, args) {\r
+                       var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate,\r
+                               blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement,\r
+                               endWhiteSpaceRegExp, allWhiteSpaceRegExp, isAllWhiteSpaceRegExp, whiteSpaceElements, children, nonEmptyElements, rootBlockName;\r
+\r
+                       args = args || {};\r
+                       matchedNodes = {};\r
+                       matchedAttributes = {};\r
+                       blockElements = tinymce.extend(tinymce.makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements());\r
+                       nonEmptyElements = schema.getNonEmptyElements();\r
+                       children = schema.children;\r
+                       validate = settings.validate;\r
+                       rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block;\r
+\r
+                       whiteSpaceElements = schema.getWhiteSpaceElements();\r
+                       startWhiteSpaceRegExp = /^[ \t\r\n]+/;\r
+                       endWhiteSpaceRegExp = /[ \t\r\n]+$/;\r
+                       allWhiteSpaceRegExp = /[ \t\r\n]+/g;\r
+                       isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/;\r
+\r
+                       function addRootBlocks() {\r
+                               var node = rootNode.firstChild, next, rootBlockNode;\r
+\r
+                               while (node) {\r
+                                       next = node.next;\r
+\r
+                                       if (node.type == 3 || (node.type == 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type'))) {\r
+                                               if (!rootBlockNode) {\r
+                                                       // Create a new root block element\r
+                                                       rootBlockNode = createNode(rootBlockName, 1);\r
+                                                       rootNode.insert(rootBlockNode, node);\r
+                                                       rootBlockNode.append(node);\r
+                                               } else\r
+                                                       rootBlockNode.append(node);\r
+                                       } else {\r
+                                               rootBlockNode = null;\r
+                                       }\r
+\r
+                                       node = next;\r
+                               };\r
+                       };\r
+\r
+                       function createNode(name, type) {\r
+                               var node = new Node(name, type), list;\r
+\r
+                               if (name in nodeFilters) {\r
+                                       list = matchedNodes[name];\r
+\r
+                                       if (list)\r
+                                               list.push(node);\r
+                                       else\r
+                                               matchedNodes[name] = [node];\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
+\r
+                       function removeWhitespaceBefore(node) {\r
+                               var textNode, textVal, sibling;\r
+\r
+                               for (textNode = node.prev; textNode && textNode.type === 3; ) {\r
+                                       textVal = textNode.value.replace(endWhiteSpaceRegExp, '');\r
+\r
+                                       if (textVal.length > 0) {\r
+                                               textNode.value = textVal;\r
+                                               textNode = textNode.prev;\r
+                                       } else {\r
+                                               sibling = textNode.prev;\r
+                                               textNode.remove();\r
+                                               textNode = sibling;\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       function cloneAndExcludeBlocks(input) {\r
+                               var name, output = {};\r
+\r
+                               for (name in input) {\r
+                                       if (name !== 'li' && name != 'p') {\r
+                                               output[name] = input[name];\r
+                                       }\r
+                               }\r
+\r
+                               return output;\r
+                       };\r
+\r
+                       parser = new tinymce.html.SaxParser({\r
+                               validate : validate,\r
+\r
+                               // Exclude P and LI from DOM parsing since it's treated better by the DOM parser\r
+                               self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()),\r
+\r
+                               cdata: function(text) {\r
+                                       node.append(createNode('#cdata', 4)).value = text;\r
+                               },\r
+\r
+                               text: function(text, raw) {\r
+                                       var textNode;\r
+\r
+                                       // Trim all redundant whitespace on non white space elements\r
+                                       if (!isInWhiteSpacePreservedElement) {\r
+                                               text = text.replace(allWhiteSpaceRegExp, ' ');\r
+\r
+                                               if (node.lastChild && blockElements[node.lastChild.name])\r
+                                                       text = text.replace(startWhiteSpaceRegExp, '');\r
+                                       }\r
+\r
+                                       // Do we need to create the node\r
+                                       if (text.length !== 0) {\r
+                                               textNode = createNode('#text', 3);\r
+                                               textNode.raw = !!raw;\r
+                                               node.append(textNode).value = text;\r
+                                       }\r
+                               },\r
+\r
+                               comment: function(text) {\r
+                                       node.append(createNode('#comment', 8)).value = text;\r
+                               },\r
+\r
+                               pi: function(name, text) {\r
+                                       node.append(createNode(name, 7)).value = text;\r
+                                       removeWhitespaceBefore(node);\r
+                               },\r
+\r
+                               doctype: function(text) {\r
+                                       var newNode;\r
+               \r
+                                       newNode = node.append(createNode('#doctype', 10));\r
+                                       newNode.value = text;\r
+                                       removeWhitespaceBefore(node);\r
+                               },\r
+\r
+                               start: function(name, attrs, empty) {\r
+                                       var newNode, attrFiltersLen, elementRule, textNode, attrName, text, sibling, parent;\r
+\r
+                                       elementRule = validate ? schema.getElementRule(name) : {};\r
+                                       if (elementRule) {\r
+                                               newNode = createNode(elementRule.outputName || name, 1);\r
+                                               newNode.attributes = attrs;\r
+                                               newNode.shortEnded = empty;\r
+\r
+                                               node.append(newNode);\r
+\r
+                                               // Check if node is valid child of the parent node is the child is\r
+                                               // unknown we don't collect it since it's probably a custom element\r
+                                               parent = children[node.name];\r
+                                               if (parent && children[newNode.name] && !parent[newNode.name])\r
+                                                       invalidChildren.push(newNode);\r
+\r
+                                               attrFiltersLen = attributeFilters.length;\r
+                                               while (attrFiltersLen--) {\r
+                                                       attrName = attributeFilters[attrFiltersLen].name;\r
+\r
+                                                       if (attrName in attrs.map) {\r
+                                                               list = matchedAttributes[attrName];\r
+\r
+                                                               if (list)\r
+                                                                       list.push(newNode);\r
+                                                               else\r
+                                                                       matchedAttributes[attrName] = [newNode];\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Trim whitespace before block\r
+                                               if (blockElements[name])\r
+                                                       removeWhitespaceBefore(newNode);\r
+\r
+                                               // Change current node if the element wasn't empty i.e not <br /> or <img />\r
+                                               if (!empty)\r
+                                                       node = newNode;\r
+\r
+                                               // Check if we are inside a whitespace preserved element\r
+                                               if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\r
+                                                       isInWhiteSpacePreservedElement = true;\r
+                                               }\r
+                                       }\r
+                               },\r
+\r
+                               end: function(name) {\r
+                                       var textNode, elementRule, text, sibling, tempNode;\r
+\r
+                                       elementRule = validate ? schema.getElementRule(name) : {};\r
+                                       if (elementRule) {\r
+                                               if (blockElements[name]) {\r
+                                                       if (!isInWhiteSpacePreservedElement) {\r
+                                                               // Trim whitespace of the first node in a block\r
+                                                               textNode = node.firstChild;\r
+                                                               if (textNode && textNode.type === 3) {\r
+                                                                       text = textNode.value.replace(startWhiteSpaceRegExp, '');\r
+\r
+                                                                       // Any characters left after trim or should we remove it\r
+                                                                       if (text.length > 0) {\r
+                                                                               textNode.value = text;\r
+                                                                               textNode = textNode.next;\r
+                                                                       } else {\r
+                                                                               sibling = textNode.next;\r
+                                                                               textNode.remove();\r
+                                                                               textNode = sibling;\r
+                                                                       }\r
+\r
+                                                                       // Remove any pure whitespace siblings\r
+                                                                       while (textNode && textNode.type === 3) {\r
+                                                                               text = textNode.value;\r
+                                                                               sibling = textNode.next;\r
+\r
+                                                                               if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {\r
+                                                                                       textNode.remove();\r
+                                                                                       textNode = sibling;\r
+                                                                               }\r
+\r
+                                                                               textNode = sibling;\r
+                                                                       }\r
+                                                               }\r
+\r
+                                                               // Trim whitespace of the last node in a block\r
+                                                               textNode = node.lastChild;\r
+                                                               if (textNode && textNode.type === 3) {\r
+                                                                       text = textNode.value.replace(endWhiteSpaceRegExp, '');\r
+\r
+                                                                       // Any characters left after trim or should we remove it\r
+                                                                       if (text.length > 0) {\r
+                                                                               textNode.value = text;\r
+                                                                               textNode = textNode.prev;\r
+                                                                       } else {\r
+                                                                               sibling = textNode.prev;\r
+                                                                               textNode.remove();\r
+                                                                               textNode = sibling;\r
+                                                                       }\r
+\r
+                                                                       // Remove any pure whitespace siblings\r
+                                                                       while (textNode && textNode.type === 3) {\r
+                                                                               text = textNode.value;\r
+                                                                               sibling = textNode.prev;\r
+\r
+                                                                               if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {\r
+                                                                                       textNode.remove();\r
+                                                                                       textNode = sibling;\r
+                                                                               }\r
+\r
+                                                                               textNode = sibling;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       // Trim start white space\r
+                                                       textNode = node.prev;\r
+                                                       if (textNode && textNode.type === 3) {\r
+                                                               text = textNode.value.replace(startWhiteSpaceRegExp, '');\r
+\r
+                                                               if (text.length > 0)\r
+                                                                       textNode.value = text;\r
+                                                               else\r
+                                                                       textNode.remove();\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Check if we exited a whitespace preserved element\r
+                                               if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\r
+                                                       isInWhiteSpacePreservedElement = false;\r
+                                               }\r
+\r
+                                               // Handle empty nodes\r
+                                               if (elementRule.removeEmpty || elementRule.paddEmpty) {\r
+                                                       if (node.isEmpty(nonEmptyElements)) {\r
+                                                               if (elementRule.paddEmpty)\r
+                                                                       node.empty().append(new Node('#text', '3')).value = '\u00a0';\r
+                                                               else {\r
+                                                                       // Leave nodes that have a name like <a name="name">\r
+                                                                       if (!node.attributes.map.name && !node.attributes.map.id) {\r
+                                                                               tempNode = node.parent;\r
+                                                                               node.empty().remove();\r
+                                                                               node = tempNode;\r
+                                                                               return;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+\r
+                                               node = node.parent;\r
+                                       }\r
+                               }\r
+                       }, schema);\r
+\r
+                       rootNode = node = new Node(args.context || settings.root_name, 11);\r
+\r
+                       parser.parse(html);\r
+\r
+                       // Fix invalid children or report invalid children in a contextual parsing\r
+                       if (validate && invalidChildren.length) {\r
+                               if (!args.context)\r
+                                       fixInvalidChildren(invalidChildren);\r
+                               else\r
+                                       args.invalid = true;\r
+                       }\r
+\r
+                       // Wrap nodes in the root into block elements if the root is body\r
+                       if (rootBlockName && rootNode.name == 'body')\r
+                               addRootBlocks();\r
+\r
+                       // Run filters only when the contents is valid\r
+                       if (!args.invalid) {\r
+                               // Run node filters\r
+                               for (name in matchedNodes) {\r
+                                       list = nodeFilters[name];\r
+                                       nodes = matchedNodes[name];\r
+\r
+                                       // Remove already removed children\r
+                                       fi = nodes.length;\r
+                                       while (fi--) {\r
+                                               if (!nodes[fi].parent)\r
+                                                       nodes.splice(fi, 1);\r
+                                       }\r
+\r
+                                       for (i = 0, l = list.length; i < l; i++)\r
+                                               list[i](nodes, name, args);\r
+                               }\r
+\r
+                               // Run attribute filters\r
+                               for (i = 0, l = attributeFilters.length; i < l; i++) {\r
+                                       list = attributeFilters[i];\r
+\r
+                                       if (list.name in matchedAttributes) {\r
+                                               nodes = matchedAttributes[list.name];\r
+\r
+                                               // Remove already removed children\r
+                                               fi = nodes.length;\r
+                                               while (fi--) {\r
+                                                       if (!nodes[fi].parent)\r
+                                                               nodes.splice(fi, 1);\r
+                                               }\r
+\r
+                                               for (fi = 0, fl = list.callbacks.length; fi < fl; fi++)\r
+                                                       list.callbacks[fi](nodes, list.name, args);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return rootNode;\r
+               };\r
+\r
+               // Remove <br> at end of block elements Gecko and WebKit injects BR elements to\r
+               // make it possible to place the caret inside empty blocks. This logic tries to remove\r
+               // these elements and keep br elements that where intended to be there intact\r
+               if (settings.remove_trailing_brs) {\r
+                       self.addNodeFilter('br', function(nodes, name) {\r
+                               var i, l = nodes.length, node, blockElements = tinymce.extend({}, schema.getBlockElements()),\r
+                                       nonEmptyElements = schema.getNonEmptyElements(), parent, lastParent, prev, prevName;\r
+\r
+                               // Remove brs from body element as well\r
+                               blockElements.body = 1;\r
+\r
+                               // Must loop forwards since it will otherwise remove all brs in <p>a<br><br><br></p>\r
+                               for (i = 0; i < l; i++) {\r
+                                       node = nodes[i];\r
+                                       parent = node.parent;\r
+\r
+                                       if (blockElements[node.parent.name] && node === parent.lastChild) {\r
+                                               // Loop all nodes to the left of the current node and check for other BR elements\r
+                                               // excluding bookmarks since they are invisible\r
+                                               prev = node.prev;\r
+                                               while (prev) {\r
+                                                       prevName = prev.name;\r
+\r
+                                                       // Ignore bookmarks\r
+                                                       if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') {\r
+                                                               // Found a non BR element\r
+                                                               if (prevName !== "br")\r
+                                                                       break;\r
+       \r
+                                                               // Found another br it's a <br><br> structure then don't remove anything\r
+                                                               if (prevName === 'br') {\r
+                                                                       node = null;\r
+                                                                       break;\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       prev = prev.prev;\r
+                                               }\r
+\r
+                                               if (node) {\r
+                                                       node.remove();\r
+\r
+                                                       // Is the parent to be considered empty after we removed the BR\r
+                                                       if (parent.isEmpty(nonEmptyElements)) {\r
+                                                               elementRule = schema.getElementRule(parent.name);\r
+\r
+                                                               // Remove or padd the element depending on schema rule\r
+                                                               if (elementRule) {\r
+                                                                       if (elementRule.removeEmpty)\r
+                                                                               parent.remove();\r
+                                                                       else if (elementRule.paddEmpty)\r
+                                                                               parent.empty().append(new tinymce.html.Node('#text', 3)).value = '\u00a0';\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       } else {\r
+                                               // Replaces BR elements inside inline elements like <p><b><i><br></i></b></p> so they become <p><b><i>&nbsp;</i></b></p> \r
+                                               lastParent = node;\r
+                                               while (parent.firstChild === lastParent && parent.lastChild === lastParent) {\r
+                                                       lastParent = parent;\r
+\r
+                                                       if (blockElements[parent.name]) {\r
+                                                               break;\r
+                                                       }\r
+\r
+                                                       parent = parent.parent;\r
+                                               }\r
+\r
+                                               if (lastParent === parent) {\r
+                                                       textNode = new tinymce.html.Node('#text', 3);\r
+                                                       textNode.value = '\u00a0';\r
+                                                       node.replace(textNode);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       });\r
+               }\r
+\r
+               // Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included.\r
+               if (!settings.allow_html_in_named_anchor) {\r
+                       self.addAttributeFilter('id,name', function(nodes, name) {\r
+                               var i = nodes.length, sibling, prevSibling, parent, node;\r
+\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       if (node.name === 'a' && node.firstChild && !node.attr('href')) {\r
+                                               parent = node.parent;\r
+\r
+                                               // Move children after current node\r
+                                               sibling = node.lastChild;\r
+                                               do {\r
+                                                       prevSibling = sibling.prev;\r
+                                                       parent.insert(sibling, node);\r
+                                                       sibling = prevSibling;\r
+                                               } while (sibling);\r
+                                       }\r
+                               }\r
+                       });\r
+               }\r
+       }\r
+})(tinymce);\r
+\r
+tinymce.html.Writer = function(settings) {\r
+       var html = [], indent, indentBefore, indentAfter, encode, htmlOutput;\r
+\r
+       settings = settings || {};\r
+       indent = settings.indent;\r
+       indentBefore = tinymce.makeMap(settings.indent_before || '');\r
+       indentAfter = tinymce.makeMap(settings.indent_after || '');\r
+       encode = tinymce.html.Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);\r
+       htmlOutput = settings.element_format == "html";\r
+\r
+       return {\r
+               start: function(name, attrs, empty) {\r
+                       var i, l, attr, value;\r
+\r
+                       if (indent && indentBefore[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
+\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
+\r
+                       html.push('<', name);\r
+\r
+                       if (attrs) {\r
+                               for (i = 0, l = attrs.length; i < l; i++) {\r
+                                       attr = attrs[i];\r
+                                       html.push(' ', attr.name, '="', encode(attr.value, true), '"');\r
+                               }\r
+                       }\r
+\r
+                       if (!empty || htmlOutput)\r
+                               html[html.length] = '>';\r
+                       else\r
+                               html[html.length] = ' />';\r
+\r
+                       if (empty && indent && indentAfter[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
+\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
+               },\r
+\r
+               end: function(name) {\r
+                       var value;\r
+\r
+                       /*if (indent && indentBefore[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
+\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }*/\r
+\r
+                       html.push('</', name, '>');\r
+\r
+                       if (indent && indentAfter[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
+\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
+               },\r
+\r
+               text: function(text, raw) {\r
+                       if (text.length > 0)\r
+                               html[html.length] = raw ? text : encode(text);\r
+               },\r
+\r
+               cdata: function(text) {\r
+                       html.push('<![CDATA[', text, ']]>');\r
+               },\r
+\r
+               comment: function(text) {\r
+                       html.push('<!--', text, '-->');\r
+               },\r
+\r
+               pi: function(name, text) {\r
+                       if (text)\r
+                               html.push('<?', name, ' ', text, '?>');\r
+                       else\r
+                               html.push('<?', name, '?>');\r
+\r
+                       if (indent)\r
+                               html.push('\n');\r
+               },\r
+\r
+               doctype: function(text) {\r
+                       html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');\r
+               },\r
+\r
+               reset: function() {\r
+                       html.length = 0;\r
+               },\r
+\r
+               getContent: function() {\r
+                       return html.join('').replace(/\n$/, '');\r
+               }\r
+       };\r
+};\r
+\r
+(function(tinymce) {\r
+       tinymce.html.Serializer = function(settings, schema) {\r
+               var self = this, writer = new tinymce.html.Writer(settings);\r
+\r
+               settings = settings || {};\r
+               settings.validate = "validate" in settings ? settings.validate : true;\r
+\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
+               self.writer = writer;\r
+\r
+               self.serialize = function(node) {\r
+                       var handlers, validate;\r
+\r
+                       validate = settings.validate;\r
+\r
+                       handlers = {\r
+                               // #text\r
+                               3: function(node, raw) {\r
+                                       writer.text(node.value, node.raw);\r
+                               },\r
+\r
+                               // #comment\r
+                               8: function(node) {\r
+                                       writer.comment(node.value);\r
+                               },\r
+\r
+                               // Processing instruction\r
+                               7: function(node) {\r
+                                       writer.pi(node.name, node.value);\r
+                               },\r
+\r
+                               // Doctype\r
+                               10: function(node) {\r
+                                       writer.doctype(node.value);\r
+                               },\r
+\r
+                               // CDATA\r
+                               4: function(node) {\r
+                                       writer.cdata(node.value);\r
+                               },\r
+\r
+                               // Document fragment\r
+                               11: function(node) {\r
+                                       if ((node = node.firstChild)) {\r
+                                               do {\r
+                                                       walk(node);\r
+                                               } while (node = node.next);\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       writer.reset();\r
+\r
+                       function walk(node) {\r
+                               var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;\r
+\r
+                               if (!handler) {\r
+                                       name = node.name;\r
+                                       isEmpty = node.shortEnded;\r
+                                       attrs = node.attributes;\r
+\r
+                                       // Sort attributes\r
+                                       if (validate && attrs && attrs.length > 1) {\r
+                                               sortedAttrs = [];\r
+                                               sortedAttrs.map = {};\r
+\r
+                                               elementRule = schema.getElementRule(node.name);\r
+                                               for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {\r
+                                                       attrName = elementRule.attributesOrder[i];\r
+\r
+                                                       if (attrName in attrs.map) {\r
+                                                               attrValue = attrs.map[attrName];\r
+                                                               sortedAttrs.map[attrName] = attrValue;\r
+                                                               sortedAttrs.push({name: attrName, value: attrValue});\r
+                                                       }\r
+                                               }\r
+\r
+                                               for (i = 0, l = attrs.length; i < l; i++) {\r
+                                                       attrName = attrs[i].name;\r
+\r
+                                                       if (!(attrName in sortedAttrs.map)) {\r
+                                                               attrValue = attrs.map[attrName];\r
+                                                               sortedAttrs.map[attrName] = attrValue;\r
+                                                               sortedAttrs.push({name: attrName, value: attrValue});\r
+                                                       }\r
+                                               }\r
+\r
+                                               attrs = sortedAttrs;\r
+                                       }\r
+\r
+                                       writer.start(node.name, attrs, isEmpty);\r
+\r
+                                       if (!isEmpty) {\r
+                                               if ((node = node.firstChild)) {\r
+                                                       do {\r
+                                                               walk(node);\r
+                                                       } while (node = node.next);\r
+                                               }\r
+\r
+                                               writer.end(name);\r
+                                       }\r
+                               } else\r
+                                       handler(node);\r
+                       }\r
+\r
+                       // Serialize element and treat all non elements as fragments\r
+                       if (node.type == 1 && !settings.inner)\r
+                               walk(node);\r
+                       else\r
+                               handlers[11](node);\r
+\r
+                       return writer.getContent();\r
+               };\r
+       }\r
+})(tinymce);\r
+\r
+// JSLint defined globals\r
+/*global tinymce:false, window:false */\r
+\r
+tinymce.dom = {};\r
+\r
+(function(namespace, expando) {\r
+       var w3cEventModel = !!document.addEventListener;\r
+\r
+       function addEvent(target, name, callback, capture) {\r
+               if (target.addEventListener) {\r
+                       target.addEventListener(name, callback, capture || false);\r
+               } else if (target.attachEvent) {\r
+                       target.attachEvent('on' + name, callback);\r
+               }\r
+       }\r
+\r
+       function removeEvent(target, name, callback, capture) {\r
+               if (target.removeEventListener) {\r
+                       target.removeEventListener(name, callback, capture || false);\r
+               } else if (target.detachEvent) {\r
+                       target.detachEvent('on' + name, callback);\r
+               }\r
+       }\r
+\r
+       function fix(original_event, data) {\r
+               var name, event = data || {};\r
+\r
+               // Dummy function that gets replaced on the delegation state functions\r
+               function returnFalse() {\r
+                       return false;\r
+               }\r
+\r
+               // Dummy function that gets replaced on the delegation state functions\r
+               function returnTrue() {\r
+                       return true;\r
+               }\r
+\r
+               // Copy all properties from the original event\r
+               for (name in original_event) {\r
+                       // layerX/layerY is deprecated in Chrome and produces a warning\r
+                       if (name !== "layerX" && name !== "layerY") {\r
+                               event[name] = original_event[name];\r
+                       }\r
+               }\r
+\r
+               // Normalize target IE uses srcElement\r
+               if (!event.target) {\r
+                       event.target = event.srcElement || document;\r
+               }\r
+\r
+               // Add preventDefault method\r
+               event.preventDefault = function() {\r
+                       event.isDefaultPrevented = returnTrue;\r
+\r
+                       // Execute preventDefault on the original event object\r
+                       if (original_event) {\r
+                               if (original_event.preventDefault) {\r
+                                       original_event.preventDefault();\r
+                               } else {\r
+                                       original_event.returnValue = false; // IE\r
+                               }\r
+                       }\r
+               };\r
+\r
+               // Add stopPropagation\r
+               event.stopPropagation = function() {\r
+                       event.isPropagationStopped = returnTrue;\r
+\r
+                       // Execute stopPropagation on the original event object\r
+                       if (original_event) {\r
+                               if (original_event.stopPropagation) {\r
+                                       original_event.stopPropagation();\r
+                               } else {\r
+                                       original_event.cancelBubble = true; // IE\r
+                               }\r
+                        }\r
+               };\r
+\r
+               // Add stopImmediatePropagation\r
+               event.stopImmediatePropagation = function() {\r
+                       event.isImmediatePropagationStopped = returnTrue;\r
+                       event.stopPropagation();\r
+               };\r
+\r
+               // Add event delegation states\r
+               if (!event.isDefaultPrevented) {\r
+                       event.isDefaultPrevented = returnFalse;\r
+                       event.isPropagationStopped = returnFalse;\r
+                       event.isImmediatePropagationStopped = returnFalse;\r
+               }\r
+\r
+               return event;\r
+       }\r
+\r
+       function bindOnReady(win, callback, event_utils) {\r
+               var doc = win.document, event = {type: 'ready'};\r
+\r
+               // Gets called when the DOM is ready\r
+               function readyHandler() {\r
+                       if (!event_utils.domLoaded) {\r
+                               event_utils.domLoaded = true;\r
+                               callback(event);\r
+                       }\r
+               }\r
+\r
+               // Use W3C method\r
+               if (w3cEventModel) {\r
+                       addEvent(win, 'DOMContentLoaded', readyHandler);\r
+               } else {\r
+                       // Use IE method\r
+                       addEvent(doc, "readystatechange", function() {\r
+                               if (doc.readyState === "complete") {\r
+                                       removeEvent(doc, "readystatechange", arguments.callee);\r
+                                       readyHandler();\r
+                               }\r
+                       });\r
+\r
+                       // Wait until we can scroll, when we can the DOM is initialized\r
+                       if (doc.documentElement.doScroll && win === win.top) {\r
+                               (function() {\r
+                                       try {\r
+                                               // If IE is used, use the trick by Diego Perini licensed under MIT by request to the author.\r
+                                               // http://javascript.nwbox.com/IEContentLoaded/\r
+                                               doc.documentElement.doScroll("left");\r
+                                       } catch (ex) {\r
+                                               setTimeout(arguments.callee, 0);\r
+                                               return;\r
+                                       }\r
+\r
+                                       readyHandler();\r
+                               })();\r
+                       }\r
+               }\r
+\r
+               // Fallback if any of the above methods should fail for some odd reason\r
+               addEvent(win, 'load', readyHandler);\r
+       }\r
+\r
+       function EventUtils(proxy) {\r
+               var self = this, events = {}, count, isFocusBlurBound, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave;\r
+\r
+               hasMouseEnterLeave = "onmouseenter" in document.documentElement;\r
+               hasFocusIn = "onfocusin" in document.documentElement;\r
+               mouseEnterLeave = {mouseenter: 'mouseover', mouseleave: 'mouseout'};\r
+               count = 1;\r
+\r
+               // State if the DOMContentLoaded was executed or not\r
+               self.domLoaded = false;\r
+               self.events = events;\r
+\r
+               function executeHandlers(evt, id) {\r
+                       var callbackList, i, l, callback;\r
+\r
+                       callbackList = events[id][evt.type];\r
+                       if (callbackList) {\r
+                               for (i = 0, l = callbackList.length; i < l; i++) {\r
+                                       callback = callbackList[i];\r
+                                       \r
+                                       // Check if callback exists might be removed if a unbind is called inside the callback\r
+                                       if (callback && callback.func.call(callback.scope, evt) === false) {\r
+                                               evt.preventDefault();\r
+                                       }\r
+\r
+                                       // Should we stop propagation to immediate listeners\r
+                                       if (evt.isImmediatePropagationStopped()) {\r
+                                               return;\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+\r
+               self.bind = function(target, names, callback, scope) {\r
+                       var id, callbackList, i, name, fakeName, nativeHandler, capture, win = window;\r
+\r
+                       // Native event handler function patches the event and executes the callbacks for the expando\r
+                       function defaultNativeHandler(evt) {\r
+                               executeHandlers(fix(evt || win.event), id);\r
+                       }\r
+\r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return;\r
+                       }\r
+\r
+                       // Create or get events id for the target\r
+                       if (!target[expando]) {\r
+                               id = count++;\r
+                               target[expando] = id;\r
+                               events[id] = {};\r
+                       } else {\r
+                               id = target[expando];\r
+\r
+                               if (!events[id]) {\r
+                                       events[id] = {};\r
+                               }\r
+                       }\r
+\r
+                       // Setup the specified scope or use the target as a default\r
+                       scope = scope || target;\r
+\r
+                       // Split names and bind each event, enables you to bind multiple events with one call\r
+                       names = names.split(' ');\r
+                       i = names.length;\r
+                       while (i--) {\r
+                               name = names[i];\r
+                               nativeHandler = defaultNativeHandler;\r
+                               fakeName = capture = false;\r
+\r
+                               // Use ready instead of DOMContentLoaded\r
+                               if (name === "DOMContentLoaded") {\r
+                                       name = "ready";\r
+                               }\r
+\r
+                               // DOM is already ready\r
+                               if ((self.domLoaded || target.readyState == 'complete') && name === "ready") {\r
+                                       self.domLoaded = true;\r
+                                       callback.call(scope, fix({type: name}));\r
+                                       continue;\r
+                               }\r
+\r
+                               // Handle mouseenter/mouseleaver\r
+                               if (!hasMouseEnterLeave) {\r
+                                       fakeName = mouseEnterLeave[name];\r
+\r
+                                       if (fakeName) {\r
+                                               nativeHandler = function(evt) {\r
+                                                       var current, related;\r
+\r
+                                                       current = evt.currentTarget;\r
+                                                       related = evt.relatedTarget;\r
+\r
+                                                       // Check if related is inside the current target if it's not then the event should be ignored since it's a mouseover/mouseout inside the element\r
+                                                       if (related && current.contains) {\r
+                                                               // Use contains for performance\r
+                                                               related = current.contains(related);\r
+                                                       } else {\r
+                                                               while (related && related !== current) {\r
+                                                                       related = related.parentNode;\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       // Fire fake event\r
+                                                       if (!related) {\r
+                                                               evt = fix(evt || win.event);\r
+                                                               evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';\r
+                                                               evt.target = current;\r
+                                                               executeHandlers(evt, id);\r
+                                                       }\r
+                                               };\r
+                                       }\r
+                               }\r
+\r
+                               // Fake bubbeling of focusin/focusout\r
+                               if (!hasFocusIn && (name === "focusin" || name === "focusout")) {\r
+                                       capture = true;\r
+                                       fakeName = name === "focusin" ? "focus" : "blur";\r
+                                       nativeHandler = function(evt) {\r
+                                               evt = fix(evt || win.event);\r
+                                               evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';\r
+                                               executeHandlers(evt, id);\r
+                                       };\r
+                               }\r
+\r
+                               // Setup callback list and bind native event\r
+                               callbackList = events[id][name];\r
+                               if (!callbackList) {\r
+                                       events[id][name] = callbackList = [{func: callback, scope: scope}];\r
+                                       callbackList.fakeName = fakeName;\r
+                                       callbackList.capture = capture;\r
+\r
+                                       // Add the nativeHandler to the callback list so that we can later unbind it\r
+                                       callbackList.nativeHandler = nativeHandler;\r
+                                       if (!w3cEventModel) {\r
+                                               callbackList.proxyHandler = proxy(id);\r
+                                       }\r
+\r
+                                       // Check if the target has native events support\r
+                                       if (name === "ready") {\r
+                                               bindOnReady(target, nativeHandler, self);\r
+                                       } else {\r
+                                               addEvent(target, fakeName || name, w3cEventModel ? nativeHandler : callbackList.proxyHandler, capture);\r
+                                       }\r
+                               } else {\r
+                                       // If it already has an native handler then just push the callback\r
+                                       callbackList.push({func: callback, scope: scope});\r
+                               }\r
+                       }\r
+\r
+                       target = callbackList = 0; // Clean memory for IE\r
+\r
+                       return callback;\r
+               };\r
+\r
+               self.unbind = function(target, names, callback) {\r
+                       var id, callbackList, i, ci, name, eventMap;\r
+\r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return self;\r
+                       }\r
+\r
+                       // Unbind event or events if the target has the expando\r
+                       id = target[expando];\r
+                       if (id) {\r
+                               eventMap = events[id];\r
+\r
+                               // Specific callback\r
+                               if (names) {\r
+                                       names = names.split(' ');\r
+                                       i = names.length;\r
+                                       while (i--) {\r
+                                               name = names[i];\r
+                                               callbackList = eventMap[name];\r
+\r
+                                               // Unbind the event if it exists in the map\r
+                                               if (callbackList) {\r
+                                                       // Remove specified callback\r
+                                                       if (callback) {\r
+                                                               ci = callbackList.length;\r
+                                                               while (ci--) {\r
+                                                                       if (callbackList[ci].func === callback) {\r
+                                                                               callbackList.splice(ci, 1);\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       // Remove all callbacks if there isn't a specified callback or there is no callbacks left\r
+                                                       if (!callback || callbackList.length === 0) {\r
+                                                               delete eventMap[name];\r
+                                                               removeEvent(target, callbackList.fakeName || name, w3cEventModel ? callbackList.nativeHandler : callbackList.proxyHandler, callbackList.capture);\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               } else {\r
+                                       // All events for a specific element\r
+                                       for (name in eventMap) {\r
+                                               callbackList = eventMap[name];\r
+                                               removeEvent(target, callbackList.fakeName || name, w3cEventModel ? callbackList.nativeHandler : callbackList.proxyHandler, callbackList.capture);\r
+                                       }\r
+\r
+                                       eventMap = {};\r
+                               }\r
+\r
+                               // Check if object is empty, if it isn't then we won't remove the expando map\r
+                               for (name in eventMap) {\r
+                                       return self;\r
+                               }\r
+\r
+                               // Delete event object\r
+                               delete events[id];\r
+\r
+                               // Remove expando from target\r
+                               try {\r
+                                       // IE will fail here since it can't delete properties from window\r
+                                       delete target[expando];\r
+                               } catch (ex) {\r
+                                       // IE will set it to null\r
+                                       target[expando] = null;\r
+                               }\r
+                       }\r
+\r
+                       return self;\r
+               };\r
+\r
+               self.fire = function(target, name, args) {\r
+                       var id, event;\r
+\r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return self;\r
+                       }\r
+\r
+                       // Build event object by patching the args\r
+                       event = fix(null, args);\r
+                       event.type = name;\r
+\r
+                       do {\r
+                               // Found an expando that means there is listeners to execute\r
+                               id = target[expando];\r
+                               if (id) {\r
+                                       executeHandlers(event, id);\r
+                               }\r
+\r
+                               // Walk up the DOM\r
+                               target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;\r
+                       } while (target && !event.isPropagationStopped());\r
+\r
+                       return self;\r
+               };\r
+\r
+               self.clean = function(target) {\r
+                       var i, children, unbind = self.unbind;\r
+       \r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return self;\r
+                       }\r
+\r
+                       // Unbind any element on the specificed target\r
+                       if (target[expando]) {\r
+                               unbind(target);\r
+                       }\r
+\r
+                       // Target doesn't have getElementsByTagName it's probably a window object then use it's document to find the children\r
+                       if (!target.getElementsByTagName) {\r
+                               target = target.document;\r
+                       }\r
+\r
+                       // Remove events from each child element\r
+                       if (target && target.getElementsByTagName) {\r
+                               unbind(target);\r
+\r
+                               children = target.getElementsByTagName('*');\r
+                               i = children.length;\r
+                               while (i--) {\r
+                                       target = children[i];\r
+\r
+                                       if (target[expando]) {\r
+                                               unbind(target);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return self;\r
+               };\r
+\r
+               self.callNativeHandler = function(id, evt) {\r
+                       if (events) {\r
+                               events[id][evt.type].nativeHandler(evt);\r
+                       }\r
+               };\r
+\r
+               self.destory = function() {\r
+                       events = {};\r
+               };\r
+\r
+               // Legacy function calls\r
+\r
+               self.add = function(target, events, func, scope) {\r
+                       // Old API supported direct ID assignment\r
+                       if (typeof(target) === "string") {\r
+                               target = document.getElementById(target);\r
+                       }\r
+\r
+                       // Old API supported multiple targets\r
+                       if (target && target instanceof Array) {\r
+                               var i = target.length;\r
+\r
+                               while (i--) {\r
+                                       self.add(target[i], events, func, scope);\r
+                               }\r
+\r
+                               return;\r
+                       }\r
+\r
+                       // Old API called ready init\r
+                       if (events === "init") {\r
+                               events = "ready";\r
+                       }\r
+\r
+                       return self.bind(target, events instanceof Array ? events.join(' ') : events, func, scope);\r
+               };\r
+\r
+               self.remove = function(target, events, func, scope) {\r
+                       if (!target) {\r
+                               return self;\r
+                       }\r
+\r
+                       // Old API supported direct ID assignment\r
+                       if (typeof(target) === "string") {\r
+                               target = document.getElementById(target);\r
+                       }\r
+\r
+                       // Old API supported multiple targets\r
+                       if (target instanceof Array) {\r
+                               var i = target.length;\r
+\r
+                               while (i--) {\r
+                                       self.remove(target[i], events, func, scope);\r
+                               }\r
+\r
+                               return self;\r
+                       }\r
+\r
+                       return self.unbind(target, events instanceof Array ? events.join(' ') : events, func);\r
+               };\r
+\r
+               self.clear = function(target) {\r
+                       // Old API supported direct ID assignment\r
+                       if (typeof(target) === "string") {\r
+                               target = document.getElementById(target);\r
+                       }\r
+\r
+                       return self.clean(target);\r
+               };\r
+\r
+               self.cancel = function(e) {\r
+                       if (e) {\r
+                               self.prevent(e);\r
+                               self.stop(e);\r
+                       }\r
+\r
+                       return false;\r
+               };\r
+\r
+               self.prevent = function(e) {\r
+                       if (!e.preventDefault) {\r
+                               e = fix(e);\r
+                       }\r
+\r
+                       e.preventDefault();\r
+\r
+                       return false;\r
+               };\r
+\r
+               self.stop = function(e) {\r
+                       if (!e.stopPropagation) {\r
+                               e = fix(e);\r
+                       }\r
+\r
+                       e.stopPropagation();\r
+\r
+                       return false;\r
+               };\r
+       }\r
+\r
+       namespace.EventUtils = EventUtils;\r
+\r
+       namespace.Event = new EventUtils(function(id) {\r
+               return function(evt) {\r
+                       tinymce.dom.Event.callNativeHandler(id, evt);\r
+               };\r
+       });\r
+\r
+       // Bind ready event when tinymce script is loaded\r
+       namespace.Event.bind(window, 'ready', function() {});\r
+\r
+       namespace = 0;\r
+})(tinymce.dom, 'data-mce-expando'); // Namespace and expando\r
+\r
+tinymce.dom.TreeWalker = function(start_node, root_node) {\r
+       var node = start_node;\r
+\r
+       function findSibling(node, start_name, sibling_name, shallow) {\r
+               var sibling, parent;\r
+\r
+               if (node) {\r
+                       // Walk into nodes if it has a start\r
+                       if (!shallow && node[start_name])\r
+                               return node[start_name];\r
+\r
+                       // Return the sibling if it has one\r
+                       if (node != root_node) {\r
+                               sibling = node[sibling_name];\r
+                               if (sibling)\r
+                                       return sibling;\r
+\r
+                               // Walk up the parents to look for siblings\r
+                               for (parent = node.parentNode; parent && parent != root_node; parent = parent.parentNode) {\r
+                                       sibling = parent[sibling_name];\r
+                                       if (sibling)\r
+                                               return sibling;\r
+                               }\r
+                       }\r
+               }\r
+       };\r
+\r
+       this.current = function() {\r
+               return node;\r
+       };\r
+\r
+       this.next = function(shallow) {\r
+               return (node = findSibling(node, 'firstChild', 'nextSibling', shallow));\r
+       };\r
+\r
+       this.prev = function(shallow) {\r
+               return (node = findSibling(node, 'lastChild', 'previousSibling', shallow));\r
+       };\r
+};\r
+\r
+(function(tinymce) {\r
+       // Shorten names\r
+       var each = tinymce.each,\r
+               is = tinymce.is,\r
+               isWebKit = tinymce.isWebKit,\r
+               isIE = tinymce.isIE,\r
+               Entities = tinymce.html.Entities,\r
+               simpleSelectorRe = /^([a-z0-9],?)+$/i,\r
+               whiteSpaceRegExp = /^[ \t\r\n]*$/;\r
+\r
+       tinymce.create('tinymce.dom.DOMUtils', {\r
+               doc : null,\r
+               root : null,\r
+               files : null,\r
+               pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,\r
+               props : {\r
+                       "for" : "htmlFor",\r
+                       "class" : "className",\r
+                       className : "className",\r
+                       checked : "checked",\r
+                       disabled : "disabled",\r
+                       maxlength : "maxLength",\r
+                       readonly : "readOnly",\r
+                       selected : "selected",\r
+                       value : "value",\r
+                       id : "id",\r
+                       name : "name",\r
+                       type : "type"\r
+               },\r
+\r
+               DOMUtils : function(d, s) {\r
+                       var t = this, globalStyle, name, blockElementsMap;\r
+\r
+                       t.doc = d;\r
+                       t.win = window;\r
+                       t.files = {};\r
+                       t.cssFlicker = false;\r
+                       t.counter = 0;\r
+                       t.stdMode = !tinymce.isIE || d.documentMode >= 8;\r
+                       t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat" || t.stdMode;\r
+                       t.hasOuterHTML = "outerHTML" in d.createElement("a");\r
+\r
+                       t.settings = s = tinymce.extend({\r
+                               keep_values : false,\r
+                               hex_colors : 1\r
+                       }, s);\r
+                       \r
+                       t.schema = s.schema;\r
+                       t.styles = new tinymce.html.Styles({\r
+                               url_converter : s.url_converter,\r
+                               url_converter_scope : s.url_converter_scope\r
+                       }, s.schema);\r
+\r
+                       // Fix IE6SP2 flicker and check it failed for pre SP2\r
+                       if (tinymce.isIE6) {\r
+                               try {\r
+                                       d.execCommand('BackgroundImageCache', false, true);\r
+                               } catch (e) {\r
+                                       t.cssFlicker = true;\r
+                               }\r
+                       }\r
+\r
+                       t.fixDoc(d);\r
+                       t.events = s.ownEvents ? new tinymce.dom.EventUtils(s.proxy) : tinymce.dom.Event;\r
+                       tinymce.addUnload(t.destroy, t);\r
+                       blockElementsMap = s.schema ? s.schema.getBlockElements() : {};\r
+\r
+                       t.isBlock = function(node) {\r
+                               // This function is called in module pattern style since it might be executed with the wrong this scope\r
+                               var type = node.nodeType;\r
+\r
+                               // If it's a node then check the type and use the nodeName\r
+                               if (type)\r
+                                       return !!(type === 1 && blockElementsMap[node.nodeName]);\r
+\r
+                               return !!blockElementsMap[node];\r
+                       };\r
+               },\r
+\r
+               fixDoc: function(doc) {\r
+                       var settings = this.settings, name;\r
+\r
+                       if (isIE && settings.schema) {\r
+                               // Add missing HTML 4/5 elements to IE\r
+                               ('abbr article aside audio canvas ' +\r
+                               'details figcaption figure footer ' +\r
+                               'header hgroup mark menu meter nav ' +\r
+                               'output progress section summary ' +\r
+                               'time video').replace(/\w+/g, function(name) {\r
+                                       doc.createElement(name);\r
+                               });\r
+\r
+                               // Create all custom elements\r
+                               for (name in settings.schema.getCustomElements()) {\r
+                                       doc.createElement(name);\r
+                               }\r
+                       }\r
+               },\r
+\r
+               clone: function(node, deep) {\r
+                       var self = this, clone, doc;\r
+\r
+                       // TODO: Add feature detection here in the future\r
+                       if (!isIE || node.nodeType !== 1 || deep) {\r
+                               return node.cloneNode(deep);\r
+                       }\r
+\r
+                       doc = self.doc;\r
+\r
+                       // Make a HTML5 safe shallow copy\r
+                       if (!deep) {\r
+                               clone = doc.createElement(node.nodeName);\r
+\r
+                               // Copy attribs\r
+                               each(self.getAttribs(node), function(attr) {\r
+                                       self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName));\r
+                               });\r
+\r
+                               return clone;\r
+                       }\r
+/*\r
+                       // Setup HTML5 patched document fragment\r
+                       if (!self.frag) {\r
+                               self.frag = doc.createDocumentFragment();\r
+                               self.fixDoc(self.frag);\r
+                       }\r
+\r
+                       // Make a deep copy by adding it to the document fragment then removing it this removed the :section\r
+                       clone = doc.createElement('div');\r
+                       self.frag.appendChild(clone);\r
+                       clone.innerHTML = node.outerHTML;\r
+                       self.frag.removeChild(clone);\r
+*/\r
+                       return clone.firstChild;\r
+               },\r
+\r
+               getRoot : function() {\r
+                       var t = this, s = t.settings;\r
+\r
+                       return (s && t.get(s.root_element)) || t.doc.body;\r
+               },\r
+\r
+               getViewPort : function(w) {\r
+                       var d, b;\r
+\r
+                       w = !w ? this.win : w;\r
+                       d = w.document;\r
+                       b = this.boxModel ? d.documentElement : d.body;\r
+\r
+                       // Returns viewport size excluding scrollbars\r
+                       return {\r
+                               x : w.pageXOffset || b.scrollLeft,\r
+                               y : w.pageYOffset || b.scrollTop,\r
+                               w : w.innerWidth || b.clientWidth,\r
+                               h : w.innerHeight || b.clientHeight\r
+                       };\r
+               },\r
+\r
+               getRect : function(e) {\r
+                       var p, t = this, sr;\r
+\r
+                       e = t.get(e);\r
+                       p = t.getPos(e);\r
+                       sr = t.getSize(e);\r
+\r
+                       return {\r
+                               x : p.x,\r
+                               y : p.y,\r
+                               w : sr.w,\r
+                               h : sr.h\r
+                       };\r
+               },\r
+\r
+               getSize : function(e) {\r
+                       var t = this, w, h;\r
+\r
+                       e = t.get(e);\r
+                       w = t.getStyle(e, 'width');\r
+                       h = t.getStyle(e, 'height');\r
+\r
+                       // Non pixel value, then force offset/clientWidth\r
+                       if (w.indexOf('px') === -1)\r
+                               w = 0;\r
+\r
+                       // Non pixel value, then force offset/clientWidth\r
+                       if (h.indexOf('px') === -1)\r
+                               h = 0;\r
+\r
+                       return {\r
+                               w : parseInt(w, 10) || e.offsetWidth || e.clientWidth,\r
+                               h : parseInt(h, 10) || e.offsetHeight || e.clientHeight\r
+                       };\r
+               },\r
+\r
+               getParent : function(n, f, r) {\r
+                       return this.getParents(n, f, r, false);\r
+               },\r
+\r
+               getParents : function(n, f, r, c) {\r
+                       var t = this, na, se = t.settings, o = [];\r
+\r
+                       n = t.get(n);\r
+                       c = c === undefined;\r
+\r
+                       if (se.strict_root)\r
+                               r = r || t.getRoot();\r
+\r
+                       // Wrap node name as func\r
+                       if (is(f, 'string')) {\r
+                               na = f;\r
+\r
+                               if (f === '*') {\r
+                                       f = function(n) {return n.nodeType == 1;};\r
+                               } else {\r
+                                       f = function(n) {\r
+                                               return t.is(n, na);\r
+                                       };\r
+                               }\r
+                       }\r
+\r
+                       while (n) {\r
+                               if (n == r || !n.nodeType || n.nodeType === 9)\r
+                                       break;\r
+\r
+                               if (!f || f(n)) {\r
+                                       if (c)\r
+                                               o.push(n);\r
+                                       else\r
+                                               return n;\r
+                               }\r
+\r
+                               n = n.parentNode;\r
+                       }\r
+\r
+                       return c ? o : null;\r
+               },\r
+\r
+               get : function(e) {\r
+                       var n;\r
+\r
+                       if (e && this.doc && typeof(e) == 'string') {\r
+                               n = e;\r
+                               e = this.doc.getElementById(e);\r
+\r
+                               // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick\r
+                               if (e && e.id !== n)\r
+                                       return this.doc.getElementsByName(n)[1];\r
+                       }\r
+\r
+                       return e;\r
+               },\r
+\r
+               getNext : function(node, selector) {\r
+                       return this._findSib(node, selector, 'nextSibling');\r
+               },\r
+\r
+               getPrev : function(node, selector) {\r
+                       return this._findSib(node, selector, 'previousSibling');\r
+               },\r
+\r
+\r
+               select : function(pa, s) {\r
+                       var t = this;\r
+\r
+                       return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);\r
+               },\r
+\r
+               is : function(n, selector) {\r
+                       var i;\r
+\r
+                       // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance\r
+                       if (n.length === undefined) {\r
+                               // Simple all selector\r
+                               if (selector === '*')\r
+                                       return n.nodeType == 1;\r
+\r
+                               // Simple selector just elements\r
+                               if (simpleSelectorRe.test(selector)) {\r
+                                       selector = selector.toLowerCase().split(/,/);\r
+                                       n = n.nodeName.toLowerCase();\r
+\r
+                                       for (i = selector.length - 1; i >= 0; i--) {\r
+                                               if (selector[i] == n)\r
+                                                       return true;\r
+                                       }\r
+\r
+                                       return false;\r
+                               }\r
+                       }\r
+\r
+                       return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;\r
+               },\r
+\r
+\r
+               add : function(p, n, a, h, c) {\r
+                       var t = this;\r
+\r
+                       return this.run(p, function(p) {\r
+                               var e, k;\r
+\r
+                               e = is(n, 'string') ? t.doc.createElement(n) : n;\r
+                               t.setAttribs(e, a);\r
+\r
+                               if (h) {\r
+                                       if (h.nodeType)\r
+                                               e.appendChild(h);\r
+                                       else\r
+                                               t.setHTML(e, h);\r
+                               }\r
+\r
+                               return !c ? p.appendChild(e) : e;\r
+                       });\r
+               },\r
+\r
+               create : function(n, a, h) {\r
+                       return this.add(this.doc.createElement(n), n, a, h, 1);\r
+               },\r
+\r
+               createHTML : function(n, a, h) {\r
+                       var o = '', t = this, k;\r
+\r
+                       o += '<' + n;\r
+\r
+                       for (k in a) {\r
+                               if (a.hasOwnProperty(k))\r
+                                       o += ' ' + k + '="' + t.encode(a[k]) + '"';\r
+                       }\r
+\r
+                       // A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime\r
+                       if (typeof(h) != "undefined")\r
+                               return o + '>' + h + '</' + n + '>';\r
+\r
+                       return o + ' />';\r
+               },\r
+\r
+               remove : function(node, keep_children) {\r
+                       return this.run(node, function(node) {\r
+                               var child, parent = node.parentNode;\r
+\r
+                               if (!parent)\r
+                                       return null;\r
+\r
+                               if (keep_children) {\r
+                                       while (child = node.firstChild) {\r
+                                               // IE 8 will crash if you don't remove completely empty text nodes\r
+                                               if (!tinymce.isIE || child.nodeType !== 3 || child.nodeValue)\r
+                                                       parent.insertBefore(child, node);\r
+                                               else\r
+                                                       node.removeChild(child);\r
+                                       }\r
+                               }\r
+\r
+                               return parent.removeChild(node);\r
+                       });\r
+               },\r
+\r
+               setStyle : function(n, na, v) {\r
+                       var t = this;\r
+\r
+                       return t.run(n, function(e) {\r
+                               var s, i;\r
+\r
+                               s = e.style;\r
+\r
+                               // Camelcase it, if needed\r
+                               na = na.replace(/-(\D)/g, function(a, b){\r
+                                       return b.toUpperCase();\r
+                               });\r
+\r
+                               // Default px suffix on these\r
+                               if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))\r
+                                       v += 'px';\r
+\r
+                               switch (na) {\r
+                                       case 'opacity':\r
+                                               // IE specific opacity\r
+                                               if (isIE) {\r
+                                                       s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";\r
+\r
+                                                       if (!n.currentStyle || !n.currentStyle.hasLayout)\r
+                                                               s.display = 'inline-block';\r
+                                               }\r
+\r
+                                               // Fix for older browsers\r
+                                               s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';\r
+                                               break;\r
+\r
+                                       case 'float':\r
+                                               isIE ? s.styleFloat = v : s.cssFloat = v;\r
+                                               break;\r
+                                       \r
+                                       default:\r
+                                               s[na] = v || '';\r
+                               }\r
+\r
+                               // Force update of the style data\r
+                               if (t.settings.update_styles)\r
+                                       t.setAttrib(e, 'data-mce-style');\r
+                       });\r
+               },\r
+\r
+               getStyle : function(n, na, c) {\r
+                       n = this.get(n);\r
+\r
+                       if (!n)\r
+                               return;\r
+\r
+                       // Gecko\r
+                       if (this.doc.defaultView && c) {\r
+                               // Remove camelcase\r
+                               na = na.replace(/[A-Z]/g, function(a){\r
+                                       return '-' + a;\r
+                               });\r
+\r
+                               try {\r
+                                       return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);\r
+                               } catch (ex) {\r
+                                       // Old safari might fail\r
+                                       return null;\r
+                               }\r
+                       }\r
+\r
+                       // Camelcase it, if needed\r
+                       na = na.replace(/-(\D)/g, function(a, b){\r
+                               return b.toUpperCase();\r
+                       });\r
+\r
+                       if (na == 'float')\r
+                               na = isIE ? 'styleFloat' : 'cssFloat';\r
+\r
+                       // IE & Opera\r
+                       if (n.currentStyle && c)\r
+                               return n.currentStyle[na];\r
+\r
+                       return n.style ? n.style[na] : undefined;\r
+               },\r
+\r
+               setStyles : function(e, o) {\r
+                       var t = this, s = t.settings, ol;\r
+\r
+                       ol = s.update_styles;\r
+                       s.update_styles = 0;\r
+\r
+                       each(o, function(v, n) {\r
+                               t.setStyle(e, n, v);\r
+                       });\r
+\r
+                       // Update style info\r
+                       s.update_styles = ol;\r
+                       if (s.update_styles)\r
+                               t.setAttrib(e, s.cssText);\r
+               },\r
+\r
+               removeAllAttribs: function(e) {\r
+                       return this.run(e, function(e) {\r
+                               var i, attrs = e.attributes;\r
+                               for (i = attrs.length - 1; i >= 0; i--) {\r
+                                       e.removeAttributeNode(attrs.item(i));\r
+                               }\r
+                       });\r
+               },\r
+\r
+               setAttrib : function(e, n, v) {\r
+                       var t = this;\r
+\r
+                       // Whats the point\r
+                       if (!e || !n)\r
+                               return;\r
+\r
+                       // Strict XML mode\r
+                       if (t.settings.strict)\r
+                               n = n.toLowerCase();\r
+\r
+                       return this.run(e, function(e) {\r
+                               var s = t.settings;\r
+                               var originalValue = e.getAttribute(n);\r
+                               if (v !== null) {\r
+                                       switch (n) {\r
+                                               case "style":\r
+                                                       if (!is(v, 'string')) {\r
+                                                               each(v, function(v, n) {\r
+                                                                       t.setStyle(e, n, v);\r
+                                                               });\r
+\r
+                                                               return;\r
+                                                       }\r
+\r
+                                                       // No mce_style for elements with these since they might get resized by the user\r
+                                                       if (s.keep_values) {\r
+                                                               if (v && !t._isRes(v))\r
+                                                                       e.setAttribute('data-mce-style', v, 2);\r
+                                                               else\r
+                                                                       e.removeAttribute('data-mce-style', 2);\r
+                                                       }\r
+\r
+                                                       e.style.cssText = v;\r
+                                                       break;\r
+\r
+                                               case "class":\r
+                                                       e.className = v || ''; // Fix IE null bug\r
+                                                       break;\r
+\r
+                                               case "src":\r
+                                               case "href":\r
+                                                       if (s.keep_values) {\r
+                                                               if (s.url_converter)\r
+                                                                       v = s.url_converter.call(s.url_converter_scope || t, v, n, e);\r
+\r
+                                                               t.setAttrib(e, 'data-mce-' + n, v, 2);\r
+                                                       }\r
+\r
+                                                       break;\r
+\r
+                                               case "shape":\r
+                                                       e.setAttribute('data-mce-style', v);\r
+                                                       break;\r
+                                       }\r
+                               }\r
+                               if (is(v) && v !== null && v.length !== 0)\r
+                                       e.setAttribute(n, '' + v, 2);\r
+                               else\r
+                                       e.removeAttribute(n, 2);\r
+\r
+                               // fire onChangeAttrib event for attributes that have changed\r
+                               if (tinyMCE.activeEditor && originalValue != v) {\r
+                                       var ed = tinyMCE.activeEditor;\r
+                                       ed.onSetAttrib.dispatch(ed, e, n, v);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               setAttribs : function(e, o) {\r
+                       var t = this;\r
+\r
+                       return this.run(e, function(e) {\r
+                               each(o, function(v, n) {\r
+                                       t.setAttrib(e, n, v);\r
+                               });\r
+                       });\r
+               },\r
+\r
+               getAttrib : function(e, n, dv) {\r
+                       var v, t = this, undef;\r
+\r
+                       e = t.get(e);\r
+\r
+                       if (!e || e.nodeType !== 1)\r
+                               return dv === undef ? false : dv;\r
+\r
+                       if (!is(dv))\r
+                               dv = '';\r
+\r
+                       // Try the mce variant for these\r
+                       if (/^(src|href|style|coords|shape)$/.test(n)) {\r
+                               v = e.getAttribute("data-mce-" + n);\r
+\r
+                               if (v)\r
+                                       return v;\r
+                       }\r
+\r
+                       if (isIE && t.props[n]) {\r
+                               v = e[t.props[n]];\r
+                               v = v && v.nodeValue ? v.nodeValue : v;\r
+                       }\r
+\r
+                       if (!v)\r
+                               v = e.getAttribute(n, 2);\r
+\r
+                       // Check boolean attribs\r
+                       if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {\r
+                               if (e[t.props[n]] === true && v === '')\r
+                                       return n;\r
+\r
+                               return v ? n : '';\r
+                       }\r
+\r
+                       // Inner input elements will override attributes on form elements\r
+                       if (e.nodeName === "FORM" && e.getAttributeNode(n))\r
+                               return e.getAttributeNode(n).nodeValue;\r
+\r
+                       if (n === 'style') {\r
+                               v = v || e.style.cssText;\r
+\r
+                               if (v) {\r
+                                       v = t.serializeStyle(t.parseStyle(v), e.nodeName);\r
+\r
+                                       if (t.settings.keep_values && !t._isRes(v))\r
+                                               e.setAttribute('data-mce-style', v);\r
+                               }\r
+                       }\r
+\r
+                       // Remove Apple and WebKit stuff\r
+                       if (isWebKit && n === "class" && v)\r
+                               v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');\r
+\r
+                       // Handle IE issues\r
+                       if (isIE) {\r
+                               switch (n) {\r
+                                       case 'rowspan':\r
+                                       case 'colspan':\r
+                                               // IE returns 1 as default value\r
+                                               if (v === 1)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'size':\r
+                                               // IE returns +0 as default value for size\r
+                                               if (v === '+0' || v === 20 || v === 0)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'width':\r
+                                       case 'height':\r
+                                       case 'vspace':\r
+                                       case 'checked':\r
+                                       case 'disabled':\r
+                                       case 'readonly':\r
+                                               if (v === 0)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'hspace':\r
+                                               // IE returns -1 as default value\r
+                                               if (v === -1)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'maxlength':\r
+                                       case 'tabindex':\r
+                                               // IE returns default value\r
+                                               if (v === 32768 || v === 2147483647 || v === '32768')\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'multiple':\r
+                                       case 'compact':\r
+                                       case 'noshade':\r
+                                       case 'nowrap':\r
+                                               if (v === 65535)\r
+                                                       return n;\r
+\r
+                                               return dv;\r
+\r
+                                       case 'shape':\r
+                                               v = v.toLowerCase();\r
+                                               break;\r
+\r
+                                       default:\r
+                                               // IE has odd anonymous function for event attributes\r
+                                               if (n.indexOf('on') === 0 && v)\r
+                                                       v = tinymce._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1', '' + v);\r
+                               }\r
+                       }\r
+\r
+                       return (v !== undef && v !== null && v !== '') ? '' + v : dv;\r
+               },\r
+\r
+               getPos : function(n, ro) {\r
+                       var t = this, x = 0, y = 0, e, d = t.doc, r;\r
+\r
+                       n = t.get(n);\r
+                       ro = ro || d.body;\r
+\r
+                       if (n) {\r
+                               // Use getBoundingClientRect if it exists since it's faster than looping offset nodes\r
+                               if (n.getBoundingClientRect) {\r
+                                       n = n.getBoundingClientRect();\r
+                                       e = t.boxModel ? d.documentElement : d.body;\r
+\r
+                                       // Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit\r
+                                       // Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position\r
+                                       x = n.left + (d.documentElement.scrollLeft || d.body.scrollLeft) - e.clientTop;\r
+                                       y = n.top + (d.documentElement.scrollTop || d.body.scrollTop) - e.clientLeft;\r
+\r
+                                       return {x : x, y : y};\r
+                               }\r
+\r
+                               r = n;\r
+                               while (r && r != ro && r.nodeType) {\r
+                                       x += r.offsetLeft || 0;\r
+                                       y += r.offsetTop || 0;\r
+                                       r = r.offsetParent;\r
+                               }\r
+\r
+                               r = n.parentNode;\r
+                               while (r && r != ro && r.nodeType) {\r
+                                       x -= r.scrollLeft || 0;\r
+                                       y -= r.scrollTop || 0;\r
+                                       r = r.parentNode;\r
+                               }\r
+                       }\r
+\r
+                       return {x : x, y : y};\r
+               },\r
+\r
+               parseStyle : function(st) {\r
+                       return this.styles.parse(st);\r
+               },\r
+\r
+               serializeStyle : function(o, name) {\r
+                       return this.styles.serialize(o, name);\r
+               },\r
+\r
+               addStyle: function(cssText) {\r
+                       var doc = this.doc, head;\r
+\r
+                       // Create style element if needed\r
+                       styleElm = doc.getElementById('mceDefaultStyles');\r
+                       if (!styleElm) {\r
+                               styleElm = doc.createElement('style'),\r
+                               styleElm.id = 'mceDefaultStyles';\r
+                               styleElm.type = 'text/css';\r
+\r
+                               head = doc.getElementsByTagName('head')[0];\r
+                               if (head.firstChild) {\r
+                                       head.insertBefore(styleElm, head.firstChild);\r
+                               } else {\r
+                                       head.appendChild(styleElm);\r
+                               }\r
+                       }\r
+\r
+                       // Append style data to old or new style element\r
+                       if (styleElm.styleSheet) {\r
+                               styleElm.styleSheet.cssText += cssText;\r
+                       } else {\r
+                               styleElm.appendChild(doc.createTextNode(cssText));\r
+                       }\r
+               },\r
+\r
+               loadCSS : function(u) {\r
+                       var t = this, d = t.doc, head;\r
+\r
+                       if (!u)\r
+                               u = '';\r
+\r
+                       head = d.getElementsByTagName('head')[0];\r
+\r
+                       each(u.split(','), function(u) {\r
+                               var link;\r
+\r
+                               if (t.files[u])\r
+                                       return;\r
+\r
+                               t.files[u] = true;\r
+                               link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});\r
+\r
+                               // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug\r
+                               // This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading\r
+                               // It's ugly but it seems to work fine.\r
+                               if (isIE && d.documentMode && d.recalc) {\r
+                                       link.onload = function() {\r
+                                               if (d.recalc)\r
+                                                       d.recalc();\r
+\r
+                                               link.onload = null;\r
+                                       };\r
+                               }\r
+\r
+                               head.appendChild(link);\r
+                       });\r
+               },\r
+\r
+               addClass : function(e, c) {\r
+                       return this.run(e, function(e) {\r
+                               var o;\r
+\r
+                               if (!c)\r
+                                       return 0;\r
+\r
+                               if (this.hasClass(e, c))\r
+                                       return e.className;\r
+\r
+                               o = this.removeClass(e, c);\r
+\r
+                               return e.className = (o != '' ? (o + ' ') : '') + c;\r
+                       });\r
+               },\r
+\r
+               removeClass : function(e, c) {\r
+                       var t = this, re;\r
+\r
+                       return t.run(e, function(e) {\r
+                               var v;\r
+\r
+                               if (t.hasClass(e, c)) {\r
+                                       if (!re)\r
+                                               re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");\r
+\r
+                                       v = e.className.replace(re, ' ');\r
+                                       v = tinymce.trim(v != ' ' ? v : '');\r
+\r
+                                       e.className = v;\r
+\r
+                                       // Empty class attr\r
+                                       if (!v) {\r
+                                               e.removeAttribute('class');\r
+                                               e.removeAttribute('className');\r
+                                       }\r
+\r
+                                       return v;\r
+                               }\r
+\r
+                               return e.className;\r
+                       });\r
+               },\r
+\r
+               hasClass : function(n, c) {\r
+                       n = this.get(n);\r
+\r
+                       if (!n || !c)\r
+                               return false;\r
+\r
+                       return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;\r
+               },\r
+\r
+               show : function(e) {\r
+                       return this.setStyle(e, 'display', 'block');\r
+               },\r
+\r
+               hide : function(e) {\r
+                       return this.setStyle(e, 'display', 'none');\r
+               },\r
+\r
+               isHidden : function(e) {\r
+                       e = this.get(e);\r
+\r
+                       return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';\r
+               },\r
+\r
+               uniqueId : function(p) {\r
+                       return (!p ? 'mce_' : p) + (this.counter++);\r
+               },\r
+\r
+               setHTML : function(element, html) {\r
+                       var self = this;\r
+\r
+                       return self.run(element, function(element) {\r
+                               if (isIE) {\r
+                                       // Remove all child nodes, IE keeps empty text nodes in DOM\r
+                                       while (element.firstChild)\r
+                                               element.removeChild(element.firstChild);\r
+\r
+                                       try {\r
+                                               // IE will remove comments from the beginning\r
+                                               // unless you padd the contents with something\r
+                                               element.innerHTML = '<br />' + html;\r
+                                               element.removeChild(element.firstChild);\r
+                                       } catch (ex) {\r
+                                               // IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p\r
+                                               // This seems to fix this problem\r
+\r
+                                               // Create new div with HTML contents and a BR infront to keep comments\r
+                                               var newElement = self.create('div');\r
+                                               newElement.innerHTML = '<br />' + html;\r
+\r
+                                               // Add all children from div to target\r
+                                               each (tinymce.grep(newElement.childNodes), function(node, i) {\r
+                                                       // Skip br element\r
+                                                       if (i && element.canHaveHTML)\r
+                                                               element.appendChild(node);\r
+                                               });\r
+                                       }\r
+                               } else\r
+                                       element.innerHTML = html;\r
+\r
+                               return html;\r
+                       });\r
+               },\r
+\r
+               getOuterHTML : function(elm) {\r
+                       var doc, self = this;\r
+\r
+                       elm = self.get(elm);\r
+\r
+                       if (!elm)\r
+                               return null;\r
+\r
+                       if (elm.nodeType === 1 && self.hasOuterHTML)\r
+                               return elm.outerHTML;\r
+\r
+                       doc = (elm.ownerDocument || self.doc).createElement("body");\r
+                       doc.appendChild(elm.cloneNode(true));\r
+\r
+                       return doc.innerHTML;\r
+               },\r
+\r
+               setOuterHTML : function(e, h, d) {\r
+                       var t = this;\r
+\r
+                       function setHTML(e, h, d) {\r
+                               var n, tp;\r
+\r
+                               tp = d.createElement("body");\r
+                               tp.innerHTML = h;\r
+\r
+                               n = tp.lastChild;\r
+                               while (n) {\r
+                                       t.insertAfter(n.cloneNode(true), e);\r
+                                       n = n.previousSibling;\r
+                               }\r
+\r
+                               t.remove(e);\r
+                       };\r
+\r
+                       return this.run(e, function(e) {\r
+                               e = t.get(e);\r
+\r
+                               // Only set HTML on elements\r
+                               if (e.nodeType == 1) {\r
+                                       d = d || e.ownerDocument || t.doc;\r
+\r
+                                       if (isIE) {\r
+                                               try {\r
+                                                       // Try outerHTML for IE it sometimes produces an unknown runtime error\r
+                                                       if (isIE && e.nodeType == 1)\r
+                                                               e.outerHTML = h;\r
+                                                       else\r
+                                                               setHTML(e, h, d);\r
+                                               } catch (ex) {\r
+                                                       // Fix for unknown runtime error\r
+                                                       setHTML(e, h, d);\r
+                                               }\r
+                                       } else\r
+                                               setHTML(e, h, d);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               decode : Entities.decode,\r
+\r
+               encode : Entities.encodeAllRaw,\r
+\r
+               insertAfter : function(node, reference_node) {\r
+                       reference_node = this.get(reference_node);\r
+\r
+                       return this.run(node, function(node) {\r
+                               var parent, nextSibling;\r
+\r
+                               parent = reference_node.parentNode;\r
+                               nextSibling = reference_node.nextSibling;\r
+\r
+                               if (nextSibling)\r
+                                       parent.insertBefore(node, nextSibling);\r
+                               else\r
+                                       parent.appendChild(node);\r
+\r
+                               return node;\r
+                       });\r
+               },\r
+\r
+               replace : function(n, o, k) {\r
+                       var t = this;\r
+\r
+                       if (is(o, 'array'))\r
+                               n = n.cloneNode(true);\r
+\r
+                       return t.run(o, function(o) {\r
+                               if (k) {\r
+                                       each(tinymce.grep(o.childNodes), function(c) {\r
+                                               n.appendChild(c);\r
+                                       });\r
+                               }\r
+\r
+                               return o.parentNode.replaceChild(n, o);\r
+                       });\r
+               },\r
+\r
+               rename : function(elm, name) {\r
+                       var t = this, newElm;\r
+\r
+                       if (elm.nodeName != name.toUpperCase()) {\r
+                               // Rename block element\r
+                               newElm = t.create(name);\r
+\r
+                               // Copy attribs to new block\r
+                               each(t.getAttribs(elm), function(attr_node) {\r
+                                       t.setAttrib(newElm, attr_node.nodeName, t.getAttrib(elm, attr_node.nodeName));\r
+                               });\r
+\r
+                               // Replace block\r
+                               t.replace(newElm, elm, 1);\r
+                       }\r
+\r
+                       return newElm || elm;\r
+               },\r
+\r
+               findCommonAncestor : function(a, b) {\r
+                       var ps = a, pe;\r
+\r
+                       while (ps) {\r
+                               pe = b;\r
+\r
+                               while (pe && ps != pe)\r
+                                       pe = pe.parentNode;\r
+\r
+                               if (ps == pe)\r
+                                       break;\r
+\r
+                               ps = ps.parentNode;\r
+                       }\r
+\r
+                       if (!ps && a.ownerDocument)\r
+                               return a.ownerDocument.documentElement;\r
+\r
+                       return ps;\r
+               },\r
+\r
+               toHex : function(s) {\r
+                       var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);\r
+\r
+                       function hex(s) {\r
+                               s = parseInt(s, 10).toString(16);\r
+\r
+                               return s.length > 1 ? s : '0' + s; // 0 -> 00\r
+                       };\r
+\r
+                       if (c) {\r
+                               s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);\r
+\r
+                               return s;\r
+                       }\r
+\r
+                       return s;\r
+               },\r
+\r
+               getClasses : function() {\r
+                       var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;\r
+\r
+                       if (t.classes)\r
+                               return t.classes;\r
+\r
+                       function addClasses(s) {\r
+                               // IE style imports\r
+                               each(s.imports, function(r) {\r
+                                       addClasses(r);\r
+                               });\r
+\r
+                               each(s.cssRules || s.rules, function(r) {\r
+                                       // Real type or fake it on IE\r
+                                       switch (r.type || 1) {\r
+                                               // Rule\r
+                                               case 1:\r
+                                                       if (r.selectorText) {\r
+                                                               each(r.selectorText.split(','), function(v) {\r
+                                                                       v = v.replace(/^\s*|\s*$|^\s\./g, "");\r
+\r
+                                                                       // Is internal or it doesn't contain a class\r
+                                                                       if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v))\r
+                                                                               return;\r
+\r
+                                                                       // Remove everything but class name\r
+                                                                       ov = v;\r
+                                                                       v = tinymce._replace(/.*\.([a-z0-9_\-]+).*/i, '$1', v);\r
+\r
+                                                                       // Filter classes\r
+                                                                       if (f && !(v = f(v, ov)))\r
+                                                                               return;\r
+\r
+                                                                       if (!lo[v]) {\r
+                                                                               cl.push({'class' : v});\r
+                                                                               lo[v] = 1;\r
+                                                                       }\r
+                                                               });\r
+                                                       }\r
+                                                       break;\r
+\r
+                                               // Import\r
+                                               case 3:\r
+                                                       addClasses(r.styleSheet);\r
+                                                       break;\r
+                                       }\r
+                               });\r
+                       };\r
+\r
+                       try {\r
+                               each(t.doc.styleSheets, addClasses);\r
+                       } catch (ex) {\r
+                               // Ignore\r
+                       }\r
+\r
+                       if (cl.length > 0)\r
+                               t.classes = cl;\r
+\r
+                       return cl;\r
+               },\r
+\r
+               run : function(e, f, s) {\r
+                       var t = this, o;\r
+\r
+                       if (t.doc && typeof(e) === 'string')\r
+                               e = t.get(e);\r
+\r
+                       if (!e)\r
+                               return false;\r
+\r
+                       s = s || this;\r
+                       if (!e.nodeType && (e.length || e.length === 0)) {\r
+                               o = [];\r
+\r
+                               each(e, function(e, i) {\r
+                                       if (e) {\r
+                                               if (typeof(e) == 'string')\r
+                                                       e = t.doc.getElementById(e);\r
+\r
+                                               o.push(f.call(s, e, i));\r
+                                       }\r
+                               });\r
+\r
+                               return o;\r
+                       }\r
+\r
+                       return f.call(s, e);\r
+               },\r
+\r
+               getAttribs : function(n) {\r
+                       var o;\r
+\r
+                       n = this.get(n);\r
+\r
+                       if (!n)\r
+                               return [];\r
+\r
+                       if (isIE) {\r
+                               o = [];\r
+\r
+                               // Object will throw exception in IE\r
+                               if (n.nodeName == 'OBJECT')\r
+                                       return n.attributes;\r
+\r
+                               // IE doesn't keep the selected attribute if you clone option elements\r
+                               if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))\r
+                                       o.push({specified : 1, nodeName : 'selected'});\r
+\r
+                               // It's crazy that this is faster in IE but it's because it returns all attributes all the time\r
+                               n.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {\r
+                                       o.push({specified : 1, nodeName : a});\r
+                               });\r
+\r
+                               return o;\r
+                       }\r
+\r
+                       return n.attributes;\r
+               },\r
+\r
+               isEmpty : function(node, elements) {\r
+                       var self = this, i, attributes, type, walker, name, brCount = 0;\r
+\r
+                       node = node.firstChild;\r
+                       if (node) {\r
+                               walker = new tinymce.dom.TreeWalker(node, node.parentNode);\r
+                               elements = elements || self.schema ? self.schema.getNonEmptyElements() : null;\r
+\r
+                               do {\r
+                                       type = node.nodeType;\r
+\r
+                                       if (type === 1) {\r
+                                               // Ignore bogus elements\r
+                                               if (node.getAttribute('data-mce-bogus'))\r
+                                                       continue;\r
+\r
+                                               // Keep empty elements like <img />\r
+                                               name = node.nodeName.toLowerCase();\r
+                                               if (elements && elements[name]) {\r
+                                                       // Ignore single BR elements in blocks like <p><br /></p> or <p><span><br /></span></p>\r
+                                                       if (name === 'br') {\r
+                                                               brCount++;\r
+                                                               continue;\r
+                                                       }\r
+\r
+                                                       return false;\r
+                                               }\r
+\r
+                                               // Keep elements with data-bookmark attributes or name attribute like <a name="1"></a>\r
+                                               attributes = self.getAttribs(node);\r
+                                               i = node.attributes.length;\r
+                                               while (i--) {\r
+                                                       name = node.attributes[i].nodeName;\r
+                                                       if (name === "name" || name === 'data-mce-bookmark')\r
+                                                               return false;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Keep comment nodes\r
+                                       if (type == 8)\r
+                                               return false;\r
+\r
+                                       // Keep non whitespace text nodes\r
+                                       if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue)))\r
+                                               return false;\r
+                               } while (node = walker.next());\r
+                       }\r
+\r
+                       return brCount <= 1;\r
+               },\r
+\r
+               destroy : function(s) {\r
+                       var t = this;\r
+\r
+                       t.win = t.doc = t.root = t.events = t.frag = null;\r
+\r
+                       // Manual destroy then remove unload handler\r
+                       if (!s)\r
+                               tinymce.removeUnload(t.destroy);\r
+               },\r
+\r
+               createRng : function() {\r
+                       var d = this.doc;\r
+\r
+                       return d.createRange ? d.createRange() : new tinymce.dom.Range(this);\r
+               },\r
+\r
+               nodeIndex : function(node, normalized) {\r
+                       var idx = 0, lastNodeType, lastNode, nodeType;\r
+\r
+                       if (node) {\r
+                               for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {\r
+                                       nodeType = node.nodeType;\r
+\r
+                                       // Normalize text nodes\r
+                                       if (normalized && nodeType == 3) {\r
+                                               if (nodeType == lastNodeType || !node.nodeValue.length)\r
+                                                       continue;\r
+                                       }\r
+                                       idx++;\r
+                                       lastNodeType = nodeType;\r
+                               }\r
+                       }\r
+\r
+                       return idx;\r
+               },\r
+\r
+               split : function(pe, e, re) {\r
+                       var t = this, r = t.createRng(), bef, aft, pa;\r
+\r
+                       // W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sense\r
+                       // but we don't want that in our code since it serves no purpose for the end user\r
+                       // For example if this is chopped:\r
+                       //   <p>text 1<span><b>CHOP</b></span>text 2</p>\r
+                       // would produce:\r
+                       //   <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>\r
+                       // this function will then trim of empty edges and produce:\r
+                       //   <p>text 1</p><b>CHOP</b><p>text 2</p>\r
+                       function trim(node) {\r
+                               var i, children = node.childNodes, type = node.nodeType;\r
+\r
+                               function surroundedBySpans(node) {\r
+                                       var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN';\r
+                                       var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN';\r
+                                       return previousIsSpan && nextIsSpan;\r
+                               }\r
+\r
+                               if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark')\r
+                                       return;\r
+\r
+                               for (i = children.length - 1; i >= 0; i--)\r
+                                       trim(children[i]);\r
+\r
+                               if (type != 9) {\r
+                                       // Keep non whitespace text nodes\r
+                                       if (type == 3 && node.nodeValue.length > 0) {\r
+                                               // If parent element isn't a block or there isn't any useful contents for example "<p>   </p>"\r
+                                               // Also keep text nodes with only spaces if surrounded by spans.\r
+                                               // eg. "<p><span>a</span> <span>b</span></p>" should keep space between a and b\r
+                                               var trimmedLength = tinymce.trim(node.nodeValue).length;\r
+                                               if (!t.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength === 0 && surroundedBySpans(node))\r
+                                                       return;\r
+                                       } else if (type == 1) {\r
+                                               // If the only child is a bookmark then move it up\r
+                                               children = node.childNodes;\r
+                                               if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('data-mce-type') == 'bookmark')\r
+                                                       node.parentNode.insertBefore(children[0], node);\r
+\r
+                                               // Keep non empty elements or img, hr etc\r
+                                               if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))\r
+                                                       return;\r
+                                       }\r
+\r
+                                       t.remove(node);\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
+\r
+                       if (pe && e) {\r
+                               // Get before chunk\r
+                               r.setStart(pe.parentNode, t.nodeIndex(pe));\r
+                               r.setEnd(e.parentNode, t.nodeIndex(e));\r
+                               bef = r.extractContents();\r
+\r
+                               // Get after chunk\r
+                               r = t.createRng();\r
+                               r.setStart(e.parentNode, t.nodeIndex(e) + 1);\r
+                               r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);\r
+                               aft = r.extractContents();\r
+\r
+                               // Insert before chunk\r
+                               pa = pe.parentNode;\r
+                               pa.insertBefore(trim(bef), pe);\r
+\r
+                               // Insert middle chunk\r
+                               if (re)\r
+                               pa.replaceChild(re, e);\r
+                       else\r
+                               pa.insertBefore(e, pe);\r
+\r
+                               // Insert after chunk\r
+                               pa.insertBefore(trim(aft), pe);\r
+                               t.remove(pe);\r
+\r
+                               return re || e;\r
+                       }\r
+               },\r
+\r
+               bind : function(target, name, func, scope) {\r
+                       return this.events.add(target, name, func, scope || this);\r
+               },\r
+\r
+               unbind : function(target, name, func) {\r
+                       return this.events.remove(target, name, func);\r
+               },\r
+\r
+               fire : function(target, name, evt) {\r
+                       return this.events.fire(target, name, evt);\r
+               },\r
+\r
+               // Returns the content editable state of a node\r
+               getContentEditable: function(node) {\r
+                       var contentEditable;\r
+\r
+                       // Check type\r
+                       if (node.nodeType != 1) {\r
+                               return null;\r
+                       }\r
+\r
+                       // Check for fake content editable\r
+                       contentEditable = node.getAttribute("data-mce-contenteditable");\r
+                       if (contentEditable && contentEditable !== "inherit") {\r
+                               return contentEditable;\r
+                       }\r
+\r
+                       // Check for real content editable\r
+                       return node.contentEditable !== "inherit" ? node.contentEditable : null;\r
+               },\r
+\r
+\r
+               _findSib : function(node, selector, name) {\r
+                       var t = this, f = selector;\r
+\r
+                       if (node) {\r
+                               // If expression make a function of it using is\r
+                               if (is(f, 'string')) {\r
+                                       f = function(node) {\r
+                                               return t.is(node, selector);\r
+                                       };\r
+                               }\r
+\r
+                               // Loop all siblings\r
+                               for (node = node[name]; node; node = node[name]) {\r
+                                       if (f(node))\r
+                                               return node;\r
+                               }\r
+                       }\r
+\r
+                       return null;\r
+               },\r
+\r
+               _isRes : function(c) {\r
+                       // Is live resizble element\r
+                       return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c);\r
+               }\r
+\r
+               /*\r
+               walk : function(n, f, s) {\r
+                       var d = this.doc, w;\r
+\r
+                       if (d.createTreeWalker) {\r
+                               w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);\r
+\r
+                               while ((n = w.nextNode()) != null)\r
+                                       f.call(s || this, n);\r
+                       } else\r
+                               tinymce.walk(n, f, 'childNodes', s);\r
+               }\r
+               */\r
+\r
+               /*\r
+               toRGB : function(s) {\r
+                       var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);\r
+\r
+                       if (c) {\r
+                               // #FFF -> #FFFFFF\r
+                               if (!is(c[3]))\r
+                                       c[3] = c[2] = c[1];\r
+\r
+                               return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";\r
+                       }\r
+\r
+                       return s;\r
+               }\r
+               */\r
+       });\r
+\r
+       tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});\r
+})(tinymce);\r
+\r
+(function(ns) {\r
+       // Range constructor\r
+       function Range(dom) {\r
+               var t = this,\r
+                       doc = dom.doc,\r
+                       EXTRACT = 0,\r
+                       CLONE = 1,\r
+                       DELETE = 2,\r
+                       TRUE = true,\r
+                       FALSE = false,\r
+                       START_OFFSET = 'startOffset',\r
+                       START_CONTAINER = 'startContainer',\r
+                       END_CONTAINER = 'endContainer',\r
+                       END_OFFSET = 'endOffset',\r
+                       extend = tinymce.extend,\r
+                       nodeIndex = dom.nodeIndex;\r
+\r
+               extend(t, {\r
+                       // Inital states\r
+                       startContainer : doc,\r
+                       startOffset : 0,\r
+                       endContainer : doc,\r
+                       endOffset : 0,\r
+                       collapsed : TRUE,\r
+                       commonAncestorContainer : doc,\r
+\r
+                       // Range constants\r
+                       START_TO_START : 0,\r
+                       START_TO_END : 1,\r
+                       END_TO_END : 2,\r
+                       END_TO_START : 3,\r
+\r
+                       // Public methods\r
+                       setStart : setStart,\r
+                       setEnd : setEnd,\r
+                       setStartBefore : setStartBefore,\r
+                       setStartAfter : setStartAfter,\r
+                       setEndBefore : setEndBefore,\r
+                       setEndAfter : setEndAfter,\r
+                       collapse : collapse,\r
+                       selectNode : selectNode,\r
+                       selectNodeContents : selectNodeContents,\r
+                       compareBoundaryPoints : compareBoundaryPoints,\r
+                       deleteContents : deleteContents,\r
+                       extractContents : extractContents,\r
+                       cloneContents : cloneContents,\r
+                       insertNode : insertNode,\r
+                       surroundContents : surroundContents,\r
+                       cloneRange : cloneRange,\r
+                       toStringIE : toStringIE\r
+               });\r
+\r
+               function createDocumentFragment() {\r
+                       return doc.createDocumentFragment();\r
+               };\r
+\r
+               function setStart(n, o) {\r
+                       _setEndPoint(TRUE, n, o);\r
+               };\r
+\r
+               function setEnd(n, o) {\r
+                       _setEndPoint(FALSE, n, o);\r
+               };\r
+\r
+               function setStartBefore(n) {\r
+                       setStart(n.parentNode, nodeIndex(n));\r
+               };\r
+\r
+               function setStartAfter(n) {\r
+                       setStart(n.parentNode, nodeIndex(n) + 1);\r
+               };\r
+\r
+               function setEndBefore(n) {\r
+                       setEnd(n.parentNode, nodeIndex(n));\r
+               };\r
+\r
+               function setEndAfter(n) {\r
+                       setEnd(n.parentNode, nodeIndex(n) + 1);\r
+               };\r
+\r
+               function collapse(ts) {\r
+                       if (ts) {\r
+                               t[END_CONTAINER] = t[START_CONTAINER];\r
+                               t[END_OFFSET] = t[START_OFFSET];\r
+                       } else {\r
+                               t[START_CONTAINER] = t[END_CONTAINER];\r
+                               t[START_OFFSET] = t[END_OFFSET];\r
+                       }\r
+\r
+                       t.collapsed = TRUE;\r
+               };\r
+\r
+               function selectNode(n) {\r
+                       setStartBefore(n);\r
+                       setEndAfter(n);\r
+               };\r
+\r
+               function selectNodeContents(n) {\r
+                       setStart(n, 0);\r
+                       setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);\r
+               };\r
+\r
+               function compareBoundaryPoints(h, r) {\r
+                       var sc = t[START_CONTAINER], so = t[START_OFFSET], ec = t[END_CONTAINER], eo = t[END_OFFSET],\r
+                       rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset;\r
+\r
+                       // Check START_TO_START\r
+                       if (h === 0)\r
+                               return _compareBoundaryPoints(sc, so, rsc, rso);\r
+       \r
+                       // Check START_TO_END\r
+                       if (h === 1)\r
+                               return _compareBoundaryPoints(ec, eo, rsc, rso);\r
+       \r
+                       // Check END_TO_END\r
+                       if (h === 2)\r
+                               return _compareBoundaryPoints(ec, eo, rec, reo);\r
+       \r
+                       // Check END_TO_START\r
+                       if (h === 3) \r
+                               return _compareBoundaryPoints(sc, so, rec, reo);\r
+               };\r
+\r
+               function deleteContents() {\r
+                       _traverse(DELETE);\r
+               };\r
+\r
+               function extractContents() {\r
+                       return _traverse(EXTRACT);\r
+               };\r
+\r
+               function cloneContents() {\r
+                       return _traverse(CLONE);\r
+               };\r
+\r
+               function insertNode(n) {\r
+                       var startContainer = this[START_CONTAINER],\r
+                               startOffset = this[START_OFFSET], nn, o;\r
+\r
+                       // Node is TEXT_NODE or CDATA\r
+                       if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {\r
+                               if (!startOffset) {\r
+                                       // At the start of text\r
+                                       startContainer.parentNode.insertBefore(n, startContainer);\r
+                               } else if (startOffset >= startContainer.nodeValue.length) {\r
+                                       // At the end of text\r
+                                       dom.insertAfter(n, startContainer);\r
+                               } else {\r
+                                       // Middle, need to split\r
+                                       nn = startContainer.splitText(startOffset);\r
+                                       startContainer.parentNode.insertBefore(n, nn);\r
+                               }\r
+                       } else {\r
+                               // Insert element node\r
+                               if (startContainer.childNodes.length > 0)\r
+                                       o = startContainer.childNodes[startOffset];\r
+\r
+                               if (o)\r
+                                       startContainer.insertBefore(n, o);\r
+                               else\r
+                                       startContainer.appendChild(n);\r
+                       }\r
+               };\r
+\r
+               function surroundContents(n) {\r
+                       var f = t.extractContents();\r
+\r
+                       t.insertNode(n);\r
+                       n.appendChild(f);\r
+                       t.selectNode(n);\r
+               };\r
+\r
+               function cloneRange() {\r
+                       return extend(new Range(dom), {\r
+                               startContainer : t[START_CONTAINER],\r
+                               startOffset : t[START_OFFSET],\r
+                               endContainer : t[END_CONTAINER],\r
+                               endOffset : t[END_OFFSET],\r
+                               collapsed : t.collapsed,\r
+                               commonAncestorContainer : t.commonAncestorContainer\r
+                       });\r
+               };\r
+\r
+               // Private methods\r
+\r
+               function _getSelectedNode(container, offset) {\r
+                       var child;\r
+\r
+                       if (container.nodeType == 3 /* TEXT_NODE */)\r
+                               return container;\r
+\r
+                       if (offset < 0)\r
+                               return container;\r
+\r
+                       child = container.firstChild;\r
+                       while (child && offset > 0) {\r
+                               --offset;\r
+                               child = child.nextSibling;\r
+                       }\r
+\r
+                       if (child)\r
+                               return child;\r
+\r
+                       return container;\r
+               };\r
+\r
+               function _isCollapsed() {\r
+                       return (t[START_CONTAINER] == t[END_CONTAINER] && t[START_OFFSET] == t[END_OFFSET]);\r
+               };\r
+\r
+               function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {\r
+                       var c, offsetC, n, cmnRoot, childA, childB;\r
+                       \r
+                       // In the first case the boundary-points have the same container. A is before B\r
+                       // if its offset is less than the offset of B, A is equal to B if its offset is\r
+                       // equal to the offset of B, and A is after B if its offset is greater than the\r
+                       // offset of B.\r
+                       if (containerA == containerB) {\r
+                               if (offsetA == offsetB)\r
+                                       return 0; // equal\r
+\r
+                               if (offsetA < offsetB)\r
+                                       return -1; // before\r
+\r
+                               return 1; // after\r
+                       }\r
+\r
+                       // In the second case a child node C of the container of A is an ancestor\r
+                       // container of B. In this case, A is before B if the offset of A is less than or\r
+                       // equal to the index of the child node C and A is after B otherwise.\r
+                       c = containerB;\r
+                       while (c && c.parentNode != containerA)\r
+                               c = c.parentNode;\r
+\r
+                       if (c) {\r
+                               offsetC = 0;\r
+                               n = containerA.firstChild;\r
+\r
+                               while (n != c && offsetC < offsetA) {\r
+                                       offsetC++;\r
+                                       n = n.nextSibling;\r
+                               }\r
+\r
+                               if (offsetA <= offsetC)\r
+                                       return -1; // before\r
+\r
+                               return 1; // after\r
+                       }\r
+\r
+                       // In the third case a child node C of the container of B is an ancestor container\r
+                       // of A. In this case, A is before B if the index of the child node C is less than\r
+                       // the offset of B and A is after B otherwise.\r
+                       c = containerA;\r
+                       while (c && c.parentNode != containerB) {\r
+                               c = c.parentNode;\r
+                       }\r
+\r
+                       if (c) {\r
+                               offsetC = 0;\r
+                               n = containerB.firstChild;\r
+\r
+                               while (n != c && offsetC < offsetB) {\r
+                                       offsetC++;\r
+                                       n = n.nextSibling;\r
+                               }\r
+\r
+                               if (offsetC < offsetB)\r
+                                       return -1; // before\r
+\r
+                               return 1; // after\r
+                       }\r
+\r
+                       // In the fourth case, none of three other cases hold: the containers of A and B\r
+                       // are siblings or descendants of sibling nodes. In this case, A is before B if\r
+                       // the container of A is before the container of B in a pre-order traversal of the\r
+                       // Ranges' context tree and A is after B otherwise.\r
+                       cmnRoot = dom.findCommonAncestor(containerA, containerB);\r
+                       childA = containerA;\r
+\r
+                       while (childA && childA.parentNode != cmnRoot)\r
+                               childA = childA.parentNode;\r
+\r
+                       if (!childA)\r
+                               childA = cmnRoot;\r
+\r
+                       childB = containerB;\r
+                       while (childB && childB.parentNode != cmnRoot)\r
+                               childB = childB.parentNode;\r
+\r
+                       if (!childB)\r
+                               childB = cmnRoot;\r
+\r
+                       if (childA == childB)\r
+                               return 0; // equal\r
+\r
+                       n = cmnRoot.firstChild;\r
+                       while (n) {\r
+                               if (n == childA)\r
+                                       return -1; // before\r
+\r
+                               if (n == childB)\r
+                                       return 1; // after\r
+\r
+                               n = n.nextSibling;\r
+                       }\r
+               };\r
+\r
+               function _setEndPoint(st, n, o) {\r
+                       var ec, sc;\r
+\r
+                       if (st) {\r
+                               t[START_CONTAINER] = n;\r
+                               t[START_OFFSET] = o;\r
+                       } else {\r
+                               t[END_CONTAINER] = n;\r
+                               t[END_OFFSET] = o;\r
+                       }\r
+\r
+                       // If one boundary-point of a Range is set to have a root container\r
+                       // other than the current one for the Range, the Range is collapsed to\r
+                       // the new position. This enforces the restriction that both boundary-\r
+                       // points of a Range must have the same root container.\r
+                       ec = t[END_CONTAINER];\r
+                       while (ec.parentNode)\r
+                               ec = ec.parentNode;\r
+\r
+                       sc = t[START_CONTAINER];\r
+                       while (sc.parentNode)\r
+                               sc = sc.parentNode;\r
+\r
+                       if (sc == ec) {\r
+                               // The start position of a Range is guaranteed to never be after the\r
+                               // end position. To enforce this restriction, if the start is set to\r
+                               // be at a position after the end, the Range is collapsed to that\r
+                               // position.\r
+                               if (_compareBoundaryPoints(t[START_CONTAINER], t[START_OFFSET], t[END_CONTAINER], t[END_OFFSET]) > 0)\r
+                                       t.collapse(st);\r
+                       } else\r
+                               t.collapse(st);\r
+\r
+                       t.collapsed = _isCollapsed();\r
+                       t.commonAncestorContainer = dom.findCommonAncestor(t[START_CONTAINER], t[END_CONTAINER]);\r
+               };\r
+\r
+               function _traverse(how) {\r
+                       var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;\r
+\r
+                       if (t[START_CONTAINER] == t[END_CONTAINER])\r
+                               return _traverseSameContainer(how);\r
+\r
+                       for (c = t[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {\r
+                               if (p == t[START_CONTAINER])\r
+                                       return _traverseCommonStartContainer(c, how);\r
+\r
+                               ++endContainerDepth;\r
+                       }\r
+\r
+                       for (c = t[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {\r
+                               if (p == t[END_CONTAINER])\r
+                                       return _traverseCommonEndContainer(c, how);\r
+\r
+                               ++startContainerDepth;\r
+                       }\r
+\r
+                       depthDiff = startContainerDepth - endContainerDepth;\r
+\r
+                       startNode = t[START_CONTAINER];\r
+                       while (depthDiff > 0) {\r
+                               startNode = startNode.parentNode;\r
+                               depthDiff--;\r
+                       }\r
+\r
+                       endNode = t[END_CONTAINER];\r
+                       while (depthDiff < 0) {\r
+                               endNode = endNode.parentNode;\r
+                               depthDiff++;\r
+                       }\r
+\r
+                       // ascend the ancestor hierarchy until we have a common parent.\r
+                       for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {\r
+                               startNode = sp;\r
+                               endNode = ep;\r
+                       }\r
+\r
+                       return _traverseCommonAncestors(startNode, endNode, how);\r
+               };\r
+\r
+                function _traverseSameContainer(how) {\r
+                       var frag, s, sub, n, cnt, sibling, xferNode, start, len;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       // If selection is empty, just return the fragment\r
+                       if (t[START_OFFSET] == t[END_OFFSET])\r
+                               return frag;\r
+\r
+                       // Text node needs special case handling\r
+                       if (t[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {\r
+                               // get the substring\r
+                               s = t[START_CONTAINER].nodeValue;\r
+                               sub = s.substring(t[START_OFFSET], t[END_OFFSET]);\r
+\r
+                               // set the original text node to its new value\r
+                               if (how != CLONE) {\r
+                                       n = t[START_CONTAINER];\r
+                                       start = t[START_OFFSET];\r
+                                       len = t[END_OFFSET] - t[START_OFFSET];\r
+\r
+                                       if (start === 0 && len >= n.nodeValue.length - 1) {\r
+                                               n.parentNode.removeChild(n);\r
+                                       } else {\r
+                                               n.deleteData(start, len);\r
+                                       }\r
+\r
+                                       // Nothing is partially selected, so collapse to start point\r
+                                       t.collapse(TRUE);\r
+                               }\r
+\r
+                               if (how == DELETE)\r
+                                       return;\r
+\r
+                               if (sub.length > 0) {\r
+                                       frag.appendChild(doc.createTextNode(sub));\r
+                               }\r
+\r
+                               return frag;\r
+                       }\r
+\r
+                       // Copy nodes between the start/end offsets.\r
+                       n = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]);\r
+                       cnt = t[END_OFFSET] - t[START_OFFSET];\r
+\r
+                       while (n && cnt > 0) {\r
+                               sibling = n.nextSibling;\r
+                               xferNode = _traverseFullySelected(n, how);\r
+\r
+                               if (frag)\r
+                                       frag.appendChild( xferNode );\r
+\r
+                               --cnt;\r
+                               n = sibling;\r
+                       }\r
+\r
+                       // Nothing is partially selected, so collapse to start point\r
+                       if (how != CLONE)\r
+                               t.collapse(TRUE);\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseCommonStartContainer(endAncestor, how) {\r
+                       var frag, n, endIdx, cnt, sibling, xferNode;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       n = _traverseRightBoundary(endAncestor, how);\r
+\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       endIdx = nodeIndex(endAncestor);\r
+                       cnt = endIdx - t[START_OFFSET];\r
+\r
+                       if (cnt <= 0) {\r
+                               // Collapse to just before the endAncestor, which\r
+                               // is partially selected.\r
+                               if (how != CLONE) {\r
+                                       t.setEndBefore(endAncestor);\r
+                                       t.collapse(FALSE);\r
+                               }\r
+\r
+                               return frag;\r
+                       }\r
+\r
+                       n = endAncestor.previousSibling;\r
+                       while (cnt > 0) {\r
+                               sibling = n.previousSibling;\r
+                               xferNode = _traverseFullySelected(n, how);\r
+\r
+                               if (frag)\r
+                                       frag.insertBefore(xferNode, frag.firstChild);\r
+\r
+                               --cnt;\r
+                               n = sibling;\r
+                       }\r
+\r
+                       // Collapse to just before the endAncestor, which\r
+                       // is partially selected.\r
+                       if (how != CLONE) {\r
+                               t.setEndBefore(endAncestor);\r
+                               t.collapse(FALSE);\r
+                       }\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseCommonEndContainer(startAncestor, how) {\r
+                       var frag, startIdx, n, cnt, sibling, xferNode;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       n = _traverseLeftBoundary(startAncestor, how);\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       startIdx = nodeIndex(startAncestor);\r
+                       ++startIdx; // Because we already traversed it\r
+\r
+                       cnt = t[END_OFFSET] - startIdx;\r
+                       n = startAncestor.nextSibling;\r
+                       while (n && cnt > 0) {\r
+                               sibling = n.nextSibling;\r
+                               xferNode = _traverseFullySelected(n, how);\r
+\r
+                               if (frag)\r
+                                       frag.appendChild(xferNode);\r
+\r
+                               --cnt;\r
+                               n = sibling;\r
+                       }\r
+\r
+                       if (how != CLONE) {\r
+                               t.setStartAfter(startAncestor);\r
+                               t.collapse(TRUE);\r
+                       }\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseCommonAncestors(startAncestor, endAncestor, how) {\r
+                       var n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       n = _traverseLeftBoundary(startAncestor, how);\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       commonParent = startAncestor.parentNode;\r
+                       startOffset = nodeIndex(startAncestor);\r
+                       endOffset = nodeIndex(endAncestor);\r
+                       ++startOffset;\r
+\r
+                       cnt = endOffset - startOffset;\r
+                       sibling = startAncestor.nextSibling;\r
+\r
+                       while (cnt > 0) {\r
+                               nextSibling = sibling.nextSibling;\r
+                               n = _traverseFullySelected(sibling, how);\r
+\r
+                               if (frag)\r
+                                       frag.appendChild(n);\r
+\r
+                               sibling = nextSibling;\r
+                               --cnt;\r
+                       }\r
+\r
+                       n = _traverseRightBoundary(endAncestor, how);\r
+\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       if (how != CLONE) {\r
+                               t.setStartAfter(startAncestor);\r
+                               t.collapse(TRUE);\r
+                       }\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseRightBoundary(root, how) {\r
+                       var next = _getSelectedNode(t[END_CONTAINER], t[END_OFFSET] - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != t[END_CONTAINER];\r
+\r
+                       if (next == root)\r
+                               return _traverseNode(next, isFullySelected, FALSE, how);\r
+\r
+                       parent = next.parentNode;\r
+                       clonedParent = _traverseNode(parent, FALSE, FALSE, how);\r
+\r
+                       while (parent) {\r
+                               while (next) {\r
+                                       prevSibling = next.previousSibling;\r
+                                       clonedChild = _traverseNode(next, isFullySelected, FALSE, how);\r
+\r
+                                       if (how != DELETE)\r
+                                               clonedParent.insertBefore(clonedChild, clonedParent.firstChild);\r
+\r
+                                       isFullySelected = TRUE;\r
+                                       next = prevSibling;\r
+                               }\r
+\r
+                               if (parent == root)\r
+                                       return clonedParent;\r
+\r
+                               next = parent.previousSibling;\r
+                               parent = parent.parentNode;\r
+\r
+                               clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);\r
+\r
+                               if (how != DELETE)\r
+                                       clonedGrandParent.appendChild(clonedParent);\r
+\r
+                               clonedParent = clonedGrandParent;\r
+                       }\r
+               };\r
+\r
+               function _traverseLeftBoundary(root, how) {\r
+                       var next = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]), isFullySelected = next != t[START_CONTAINER], parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;\r
+\r
+                       if (next == root)\r
+                               return _traverseNode(next, isFullySelected, TRUE, how);\r
+\r
+                       parent = next.parentNode;\r
+                       clonedParent = _traverseNode(parent, FALSE, TRUE, how);\r
+\r
+                       while (parent) {\r
+                               while (next) {\r
+                                       nextSibling = next.nextSibling;\r
+                                       clonedChild = _traverseNode(next, isFullySelected, TRUE, how);\r
+\r
+                                       if (how != DELETE)\r
+                                               clonedParent.appendChild(clonedChild);\r
+\r
+                                       isFullySelected = TRUE;\r
+                                       next = nextSibling;\r
+                               }\r
+\r
+                               if (parent == root)\r
+                                       return clonedParent;\r
+\r
+                               next = parent.nextSibling;\r
+                               parent = parent.parentNode;\r
+\r
+                               clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);\r
+\r
+                               if (how != DELETE)\r
+                                       clonedGrandParent.appendChild(clonedParent);\r
+\r
+                               clonedParent = clonedGrandParent;\r
+                       }\r
+               };\r
+\r
+               function _traverseNode(n, isFullySelected, isLeft, how) {\r
+                       var txtValue, newNodeValue, oldNodeValue, offset, newNode;\r
+\r
+                       if (isFullySelected)\r
+                               return _traverseFullySelected(n, how);\r
+\r
+                       if (n.nodeType == 3 /* TEXT_NODE */) {\r
+                               txtValue = n.nodeValue;\r
+\r
+                               if (isLeft) {\r
+                                       offset = t[START_OFFSET];\r
+                                       newNodeValue = txtValue.substring(offset);\r
+                                       oldNodeValue = txtValue.substring(0, offset);\r
+                               } else {\r
+                                       offset = t[END_OFFSET];\r
+                                       newNodeValue = txtValue.substring(0, offset);\r
+                                       oldNodeValue = txtValue.substring(offset);\r
+                               }\r
+\r
+                               if (how != CLONE)\r
+                                       n.nodeValue = oldNodeValue;\r
+\r
+                               if (how == DELETE)\r
+                                       return;\r
+\r
+                               newNode = dom.clone(n, FALSE);\r
+                               newNode.nodeValue = newNodeValue;\r
+\r
+                               return newNode;\r
+                       }\r
+\r
+                       if (how == DELETE)\r
+                               return;\r
+\r
+                       return dom.clone(n, FALSE);\r
+               };\r
+\r
+               function _traverseFullySelected(n, how) {\r
+                       if (how != DELETE)\r
+                               return how == CLONE ? dom.clone(n, TRUE) : n;\r
+\r
+                       n.parentNode.removeChild(n);\r
+               };\r
+\r
+               function toStringIE() {\r
+                       return dom.create('body', null, cloneContents()).outerText;\r
+               }\r
+               \r
+               return t;\r
+       };\r
+\r
+       ns.Range = Range;\r
+\r
+       // Older IE versions doesn't let you override toString by it's constructor so we have to stick it in the prototype\r
+       Range.prototype.toString = function() {\r
+               return this.toStringIE();\r
+       };\r
+})(tinymce.dom);\r
+\r
+(function() {\r
+       function Selection(selection) {\r
+               var self = this, dom = selection.dom, TRUE = true, FALSE = false;\r
+\r
+               function getPosition(rng, start) {\r
+                       var checkRng, startIndex = 0, endIndex, inside,\r
+                               children, child, offset, index, position = -1, parent;\r
+\r
+                       // Setup test range, collapse it and get the parent\r
+                       checkRng = rng.duplicate();\r
+                       checkRng.collapse(start);\r
+                       parent = checkRng.parentElement();\r
+\r
+                       // Check if the selection is within the right document\r
+                       if (parent.ownerDocument !== selection.dom.doc)\r
+                               return;\r
+\r
+                       // IE will report non editable elements as it's parent so look for an editable one\r
+                       while (parent.contentEditable === "false") {\r
+                               parent = parent.parentNode;\r
+                       }\r
+\r
+                       // If parent doesn't have any children then return that we are inside the element\r
+                       if (!parent.hasChildNodes()) {\r
+                               return {node : parent, inside : 1};\r
+                       }\r
+\r
+                       // Setup node list and endIndex\r
+                       children = parent.children;\r
+                       endIndex = children.length - 1;\r
+\r
+                       // Perform a binary search for the position\r
+                       while (startIndex <= endIndex) {\r
+                               index = Math.floor((startIndex + endIndex) / 2);\r
+\r
+                               // Move selection to node and compare the ranges\r
+                               child = children[index];\r
+                               checkRng.moveToElementText(child);\r
+                               position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng);\r
+\r
+                               // Before/after or an exact match\r
+                               if (position > 0) {\r
+                                       endIndex = index - 1;\r
+                               } else if (position < 0) {\r
+                                       startIndex = index + 1;\r
+                               } else {\r
+                                       return {node : child};\r
+                               }\r
+                       }\r
+\r
+                       // Check if child position is before or we didn't find a position\r
+                       if (position < 0) {\r
+                               // No element child was found use the parent element and the offset inside that\r
+                               if (!child) {\r
+                                       checkRng.moveToElementText(parent);\r
+                                       checkRng.collapse(true);\r
+                                       child = parent;\r
+                                       inside = true;\r
+                               } else\r
+                                       checkRng.collapse(false);\r
+\r
+                               // Walk character by character in text node until we hit the selected range endpoint, hit the end of document or parent isn't the right one\r
+                               // We need to walk char by char since rng.text or rng.htmlText will trim line endings\r
+                               offset = 0;\r
+                               while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {\r
+                                       if (checkRng.move('character', 1) === 0 || parent != checkRng.parentElement()) {\r
+                                               break;\r
+                                       }\r
+\r
+                                       offset++;\r
+                               }\r
+                       } else {\r
+                               // Child position is after the selection endpoint\r
+                               checkRng.collapse(true);\r
+\r
+                               // Walk character by character in text node until we hit the selected range endpoint, hit the end of document or parent isn't the right one\r
+                               offset = 0;\r
+                               while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {\r
+                                       if (checkRng.move('character', -1) === 0 || parent != checkRng.parentElement()) {\r
+                                               break;\r
+                                       }\r
+\r
+                                       offset++;\r
+                               }\r
+                       }\r
+\r
+                       return {node : child, position : position, offset : offset, inside : inside};\r
+               };\r
+\r
+               // Returns a W3C DOM compatible range object by using the IE Range API\r
+               function getRange() {\r
+                       var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark, fail;\r
+\r
+                       // If selection is outside the current document just return an empty range\r
+                       element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();\r
+                       if (element.ownerDocument != dom.doc)\r
+                               return domRange;\r
+\r
+                       collapsed = selection.isCollapsed();\r
+\r
+                       // Handle control selection\r
+                       if (ieRange.item) {\r
+                               domRange.setStart(element.parentNode, dom.nodeIndex(element));\r
+                               domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);\r
+\r
+                               return domRange;\r
+                       }\r
+\r
+                       function findEndPoint(start) {\r
+                               var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue;\r
+\r
+                               container = endPoint.node;\r
+                               offset = endPoint.offset;\r
+\r
+                               if (endPoint.inside && !container.hasChildNodes()) {\r
+                                       domRange[start ? 'setStart' : 'setEnd'](container, 0);\r
+                                       return;\r
+                               }\r
+\r
+                               if (offset === undef) {\r
+                                       domRange[start ? 'setStartBefore' : 'setEndAfter'](container);\r
+                                       return;\r
+                               }\r
+\r
+                               if (endPoint.position < 0) {\r
+                                       sibling = endPoint.inside ? container.firstChild : container.nextSibling;\r
+\r
+                                       if (!sibling) {\r
+                                               domRange[start ? 'setStartAfter' : 'setEndAfter'](container);\r
+                                               return;\r
+                                       }\r
+\r
+                                       if (!offset) {\r
+                                               if (sibling.nodeType == 3)\r
+                                                       domRange[start ? 'setStart' : 'setEnd'](sibling, 0);\r
+                                               else\r
+                                                       domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling);\r
+\r
+                                               return;\r
+                                       }\r
+\r
+                                       // Find the text node and offset\r
+                                       while (sibling) {\r
+                                               nodeValue = sibling.nodeValue;\r
+                                               textNodeOffset += nodeValue.length;\r
+\r
+                                               // We are at or passed the position we where looking for\r
+                                               if (textNodeOffset >= offset) {\r
+                                                       container = sibling;\r
+                                                       textNodeOffset -= offset;\r
+                                                       textNodeOffset = nodeValue.length - textNodeOffset;\r
+                                                       break;\r
+                                               }\r
+\r
+                                               sibling = sibling.nextSibling;\r
+                                       }\r
+                               } else {\r
+                                       // Find the text node and offset\r
+                                       sibling = container.previousSibling;\r
+\r
+                                       if (!sibling)\r
+                                               return domRange[start ? 'setStartBefore' : 'setEndBefore'](container);\r
+\r
+                                       // If there isn't any text to loop then use the first position\r
+                                       if (!offset) {\r
+                                               if (container.nodeType == 3)\r
+                                                       domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length);\r
+                                               else\r
+                                                       domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling);\r
+\r
+                                               return;\r
+                                       }\r
+\r
+                                       while (sibling) {\r
+                                               textNodeOffset += sibling.nodeValue.length;\r
+\r
+                                               // We are at or passed the position we where looking for\r
+                                               if (textNodeOffset >= offset) {\r
+                                                       container = sibling;\r
+                                                       textNodeOffset -= offset;\r
+                                                       break;\r
+                                               }\r
+\r
+                                               sibling = sibling.previousSibling;\r
+                                       }\r
+                               }\r
+\r
+                               domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset);\r
+                       };\r
+\r
+                       try {\r
+                               // Find start point\r
+                               findEndPoint(true);\r
+\r
+                               // Find end point if needed\r
+                               if (!collapsed)\r
+                                       findEndPoint();\r
+                       } catch (ex) {\r
+                               // IE has a nasty bug where text nodes might throw "invalid argument" when you\r
+                               // access the nodeValue or other properties of text nodes. This seems to happend when\r
+                               // text nodes are split into two nodes by a delete/backspace call. So lets detect it and try to fix it.\r
+                               if (ex.number == -2147024809) {\r
+                                       // Get the current selection\r
+                                       bookmark = self.getBookmark(2);\r
+\r
+                                       // Get start element\r
+                                       tmpRange = ieRange.duplicate();\r
+                                       tmpRange.collapse(true);\r
+                                       element = tmpRange.parentElement();\r
+\r
+                                       // Get end element\r
+                                       if (!collapsed) {\r
+                                               tmpRange = ieRange.duplicate();\r
+                                               tmpRange.collapse(false);\r
+                                               element2 = tmpRange.parentElement();\r
+                                               element2.innerHTML = element2.innerHTML;\r
+                                       }\r
+\r
+                                       // Remove the broken elements\r
+                                       element.innerHTML = element.innerHTML;\r
+\r
+                                       // Restore the selection\r
+                                       self.moveToBookmark(bookmark);\r
+\r
+                                       // Since the range has moved we need to re-get it\r
+                                       ieRange = selection.getRng();\r
+\r
+                                       // Find start point\r
+                                       findEndPoint(true);\r
+\r
+                                       // Find end point if needed\r
+                                       if (!collapsed)\r
+                                               findEndPoint();\r
+                               } else\r
+                                       throw ex; // Throw other errors\r
+                       }\r
+\r
+                       return domRange;\r
+               };\r
+\r
+               this.getBookmark = function(type) {\r
+                       var rng = selection.getRng(), start, end, bookmark = {};\r
+\r
+                       function getIndexes(node) {\r
+                               var parent, root, children, i, indexes = [];\r
+\r
+                               parent = node.parentNode;\r
+                               root = dom.getRoot().parentNode;\r
+\r
+                               while (parent != root && parent.nodeType !== 9) {\r
+                                       children = parent.children;\r
+\r
+                                       i = children.length;\r
+                                       while (i--) {\r
+                                               if (node === children[i]) {\r
+                                                       indexes.push(i);\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+\r
+                                       node = parent;\r
+                                       parent = parent.parentNode;\r
+                               }\r
+\r
+                               return indexes;\r
+                       };\r
+\r
+                       function getBookmarkEndPoint(start) {\r
+                               var position;\r
+\r
+                               position = getPosition(rng, start);\r
+                               if (position) {\r
+                                       return {\r
+                                               position : position.position,\r
+                                               offset : position.offset,\r
+                                               indexes : getIndexes(position.node),\r
+                                               inside : position.inside\r
+                                       };\r
+                               }\r
+                       };\r
+\r
+                       // Non ubstructive bookmark\r
+                       if (type === 2) {\r
+                               // Handle text selection\r
+                               if (!rng.item) {\r
+                                       bookmark.start = getBookmarkEndPoint(true);\r
+\r
+                                       if (!selection.isCollapsed())\r
+                                               bookmark.end = getBookmarkEndPoint();\r
+                               } else\r
+                                       bookmark.start = {ctrl : true, indexes : getIndexes(rng.item(0))};\r
+                       }\r
+\r
+                       return bookmark;\r
+               };\r
+\r
+               this.moveToBookmark = function(bookmark) {\r
+                       var rng, body = dom.doc.body;\r
+\r
+                       function resolveIndexes(indexes) {\r
+                               var node, i, idx, children;\r
+\r
+                               node = dom.getRoot();\r
+                               for (i = indexes.length - 1; i >= 0; i--) {\r
+                                       children = node.children;\r
+                                       idx = indexes[i];\r
+\r
+                                       if (idx <= children.length - 1) {\r
+                                               node = children[idx];\r
+                                       }\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
+                       \r
+                       function setBookmarkEndPoint(start) {\r
+                               var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef;\r
+\r
+                               if (endPoint) {\r
+                                       moveLeft = endPoint.position > 0;\r
+\r
+                                       moveRng = body.createTextRange();\r
+                                       moveRng.moveToElementText(resolveIndexes(endPoint.indexes));\r
+\r
+                                       offset = endPoint.offset;\r
+                                       if (offset !== undef) {\r
+                                               moveRng.collapse(endPoint.inside || moveLeft);\r
+                                               moveRng.moveStart('character', moveLeft ? -offset : offset);\r
+                                       } else\r
+                                               moveRng.collapse(start);\r
+\r
+                                       rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng);\r
+\r
+                                       if (start)\r
+                                               rng.collapse(true);\r
+                               }\r
+                       };\r
+\r
+                       if (bookmark.start) {\r
+                               if (bookmark.start.ctrl) {\r
+                                       rng = body.createControlRange();\r
+                                       rng.addElement(resolveIndexes(bookmark.start.indexes));\r
+                                       rng.select();\r
+                               } else {\r
+                                       rng = body.createTextRange();\r
+                                       setBookmarkEndPoint(true);\r
+                                       setBookmarkEndPoint();\r
+                                       rng.select();\r
+                               }\r
+                       }\r
+               };\r
+\r
+               this.addRange = function(rng) {\r
+                       var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling,\r
+                               doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm;\r
+\r
+                       function setEndPoint(start) {\r
+                               var container, offset, marker, tmpRng, nodes;\r
+\r
+                               marker = dom.create('a');\r
+                               container = start ? startContainer : endContainer;\r
+                               offset = start ? startOffset : endOffset;\r
+                               tmpRng = ieRng.duplicate();\r
+\r
+                               if (container == doc || container == doc.documentElement) {\r
+                                       container = body;\r
+                                       offset = 0;\r
+                               }\r
+\r
+                               if (container.nodeType == 3) {\r
+                                       container.parentNode.insertBefore(marker, container);\r
+                                       tmpRng.moveToElementText(marker);\r
+                                       tmpRng.moveStart('character', offset);\r
+                                       dom.remove(marker);\r
+                                       ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);\r
+                               } else {\r
+                                       nodes = container.childNodes;\r
+\r
+                                       if (nodes.length) {\r
+                                               if (offset >= nodes.length) {\r
+                                                       dom.insertAfter(marker, nodes[nodes.length - 1]);\r
+                                               } else {\r
+                                                       container.insertBefore(marker, nodes[offset]);\r
+                                               }\r
+\r
+                                               tmpRng.moveToElementText(marker);\r
+                                       } else if (container.canHaveHTML) {\r
+                                               // Empty node selection for example <div>|</div>\r
+                                               // Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open\r
+                                               container.innerHTML = '<span>\uFEFF</span>';\r
+                                               marker = container.firstChild;\r
+                                               tmpRng.moveToElementText(marker);\r
+                                               tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason\r
+                                       }\r
+\r
+                                       ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);\r
+                                       dom.remove(marker);\r
+                               }\r
+                       }\r
+\r
+                       // Setup some shorter versions\r
+                       startContainer = rng.startContainer;\r
+                       startOffset = rng.startOffset;\r
+                       endContainer = rng.endContainer;\r
+                       endOffset = rng.endOffset;\r
+                       ieRng = body.createTextRange();\r
+\r
+                       // If single element selection then try making a control selection out of it\r
+                       if (startContainer == endContainer && startContainer.nodeType == 1) {\r
+                               // Trick to place the caret inside an empty block element like <p></p>\r
+                               if (startOffset == endOffset && !startContainer.hasChildNodes()) {\r
+                                       if (startContainer.canHaveHTML) {\r
+                                               // Check if previous sibling is an empty block if it is then we need to render it\r
+                                               // IE would otherwise move the caret into the sibling instead of the empty startContainer see: #5236\r
+                                               // Example this: <p></p><p>|</p> would become this: <p>|</p><p></p>\r
+                                               sibling = startContainer.previousSibling;\r
+                                               if (sibling && !sibling.hasChildNodes() && dom.isBlock(sibling)) {\r
+                                                       sibling.innerHTML = '\uFEFF';\r
+                                               } else {\r
+                                                       sibling = null;\r
+                                               }\r
+\r
+                                               startContainer.innerHTML = '<span>\uFEFF</span><span>\uFEFF</span>';\r
+                                               ieRng.moveToElementText(startContainer.lastChild);\r
+                                               ieRng.select();\r
+                                               dom.doc.selection.clear();\r
+                                               startContainer.innerHTML = '';\r
+\r
+                                               if (sibling) {\r
+                                                       sibling.innerHTML = '';\r
+                                               }\r
+                                               return;\r
+                                       } else {\r
+                                               startOffset = dom.nodeIndex(startContainer);\r
+                                               startContainer = startContainer.parentNode;\r
+                                       }\r
+                               }\r
+\r
+                               if (startOffset == endOffset - 1) {\r
+                                       try {\r
+                                               ctrlElm = startContainer.childNodes[startOffset];\r
+                                               ctrlRng = body.createControlRange();\r
+                                               ctrlRng.addElement(ctrlElm);\r
+                                               ctrlRng.select();\r
+\r
+                                               // Check if the range produced is on the correct element and is a control range\r
+                                               // On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398\r
+                                               nativeRng = selection.getRng();\r
+                                               if (nativeRng.item && ctrlElm === nativeRng.item(0)) {\r
+                                                       return;\r
+                                               }\r
+                                       } catch (ex) {\r
+                                               // Ignore\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       // Set start/end point of selection\r
+                       setEndPoint(true);\r
+                       setEndPoint();\r
+\r
+                       // Select the new range and scroll it into view\r
+                       ieRng.select();\r
+               };\r
+\r
+               // Expose range method\r
+               this.getRangeAt = getRange;\r
+       };\r
+\r
+       // Expose the selection object\r
+       tinymce.dom.TridentSelection = Selection;\r
+})();\r
+\r
+\r
+/*\r
+ * Sizzle CSS Selector Engine\r
+ *  Copyright, The Dojo Foundation\r
+ *  Released under the MIT, BSD, and GPL Licenses.\r
+ *  More information: http://sizzlejs.com/\r
+ */\r
+(function(){\r
+\r
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,\r
+       expando = "sizcache",\r
+       done = 0,\r
+       toString = Object.prototype.toString,\r
+       hasDuplicate = false,\r
+       baseHasDuplicate = true,\r
+       rBackslash = /\\/g,\r
+       rReturn = /\r\n/g,\r
+       rNonWord = /\W/;\r
+\r
+// Here we check if the JavaScript engine is using some sort of\r
+// optimization where it does not always call our comparision\r
+// function. If that is the case, discard the hasDuplicate value.\r
+//   Thus far that includes Google Chrome.\r
+[0, 0].sort(function() {\r
+       baseHasDuplicate = false;\r
+       return 0;\r
+});\r
+\r
+var Sizzle = function( selector, context, results, seed ) {\r
+       results = results || [];\r
+       context = context || document;\r
+\r
+       var origContext = context;\r
+\r
+       if ( context.nodeType !== 1 && context.nodeType !== 9 ) {\r
+               return [];\r
+       }\r
+\r
+       if ( !selector || typeof selector !== "string" ) {\r
+               return results;\r
+       }\r
+\r
+       var m, set, checkSet, extra, ret, cur, pop, i,\r
+               prune = true,\r
+               contextXML = Sizzle.isXML( context ),\r
+               parts = [],\r
+               soFar = selector;\r
+\r
+       // Reset the position of the chunker regexp (start from head)\r
+       do {\r
+               chunker.exec( "" );\r
+               m = chunker.exec( soFar );\r
+\r
+               if ( m ) {\r
+                       soFar = m[3];\r
+\r
+                       parts.push( m[1] );\r
+\r
+                       if ( m[2] ) {\r
+                               extra = m[3];\r
+                               break;\r
+                       }\r
+               }\r
+       } while ( m );\r
+\r
+       if ( parts.length > 1 && origPOS.exec( selector ) ) {\r
+\r
+               if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {\r
+                       set = posProcess( parts[0] + parts[1], context, seed );\r
+\r
+               } else {\r
+                       set = Expr.relative[ parts[0] ] ?\r
+                               [ context ] :\r
+                               Sizzle( parts.shift(), context );\r
+\r
+                       while ( parts.length ) {\r
+                               selector = parts.shift();\r
+\r
+                               if ( Expr.relative[ selector ] ) {\r
+                                       selector += parts.shift();\r
+                               }\r
+\r
+                               set = posProcess( selector, set, seed );\r
+                       }\r
+               }\r
+\r
+       } else {\r
+               // Take a shortcut and set the context if the root selector is an ID\r
+               // (but not if it'll be faster if the inner selector is an ID)\r
+               if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&\r
+                               Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {\r
+\r
+                       ret = Sizzle.find( parts.shift(), context, contextXML );\r
+                       context = ret.expr ?\r
+                               Sizzle.filter( ret.expr, ret.set )[0] :\r
+                               ret.set[0];\r
+               }\r
+\r
+               if ( context ) {\r
+                       ret = seed ?\r
+                               { expr: parts.pop(), set: makeArray(seed) } :\r
+                               Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );\r
+\r
+                       set = ret.expr ?\r
+                               Sizzle.filter( ret.expr, ret.set ) :\r
+                               ret.set;\r
+\r
+                       if ( parts.length > 0 ) {\r
+                               checkSet = makeArray( set );\r
+\r
+                       } else {\r
+                               prune = false;\r
+                       }\r
+\r
+                       while ( parts.length ) {\r
+                               cur = parts.pop();\r
+                               pop = cur;\r
+\r
+                               if ( !Expr.relative[ cur ] ) {\r
+                                       cur = "";\r
+                               } else {\r
+                                       pop = parts.pop();\r
+                               }\r
+\r
+                               if ( pop == null ) {\r
+                                       pop = context;\r
+                               }\r
+\r
+                               Expr.relative[ cur ]( checkSet, pop, contextXML );\r
+                       }\r
+\r
+               } else {\r
+                       checkSet = parts = [];\r
+               }\r
+       }\r
+\r
+       if ( !checkSet ) {\r
+               checkSet = set;\r
+       }\r
+\r
+       if ( !checkSet ) {\r
+               Sizzle.error( cur || selector );\r
+       }\r
+\r
+       if ( toString.call(checkSet) === "[object Array]" ) {\r
+               if ( !prune ) {\r
+                       results.push.apply( results, checkSet );\r
+\r
+               } else if ( context && context.nodeType === 1 ) {\r
+                       for ( i = 0; checkSet[i] != null; i++ ) {\r
+                               if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {\r
+                                       results.push( set[i] );\r
+                               }\r
+                       }\r
+\r
+               } else {\r
+                       for ( i = 0; checkSet[i] != null; i++ ) {\r
+                               if ( checkSet[i] && checkSet[i].nodeType === 1 ) {\r
+                                       results.push( set[i] );\r
+                               }\r
+                       }\r
+               }\r
+\r
+       } else {\r
+               makeArray( checkSet, results );\r
+       }\r
+\r
+       if ( extra ) {\r
+               Sizzle( extra, origContext, results, seed );\r
+               Sizzle.uniqueSort( results );\r
+       }\r
+\r
+       return results;\r
+};\r
+\r
+Sizzle.uniqueSort = function( results ) {\r
+       if ( sortOrder ) {\r
+               hasDuplicate = baseHasDuplicate;\r
+               results.sort( sortOrder );\r
+\r
+               if ( hasDuplicate ) {\r
+                       for ( var i = 1; i < results.length; i++ ) {\r
+                               if ( results[i] === results[ i - 1 ] ) {\r
+                                       results.splice( i--, 1 );\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       return results;\r
+};\r
+\r
+Sizzle.matches = function( expr, set ) {\r
+       return Sizzle( expr, null, null, set );\r
+};\r
+\r
+Sizzle.matchesSelector = function( node, expr ) {\r
+       return Sizzle( expr, null, null, [node] ).length > 0;\r
+};\r
+\r
+Sizzle.find = function( expr, context, isXML ) {\r
+       var set, i, len, match, type, left;\r
+\r
+       if ( !expr ) {\r
+               return [];\r
+       }\r
+\r
+       for ( i = 0, len = Expr.order.length; i < len; i++ ) {\r
+               type = Expr.order[i];\r
+\r
+               if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {\r
+                       left = match[1];\r
+                       match.splice( 1, 1 );\r
+\r
+                       if ( left.substr( left.length - 1 ) !== "\\" ) {\r
+                               match[1] = (match[1] || "").replace( rBackslash, "" );\r
+                               set = Expr.find[ type ]( match, context, isXML );\r
+\r
+                               if ( set != null ) {\r
+                                       expr = expr.replace( Expr.match[ type ], "" );\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       if ( !set ) {\r
+               set = typeof context.getElementsByTagName !== "undefined" ?\r
+                       context.getElementsByTagName( "*" ) :\r
+                       [];\r
+       }\r
+\r
+       return { set: set, expr: expr };\r
+};\r
+\r
+Sizzle.filter = function( expr, set, inplace, not ) {\r
+       var match, anyFound,\r
+               type, found, item, filter, left,\r
+               i, pass,\r
+               old = expr,\r
+               result = [],\r
+               curLoop = set,\r
+               isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );\r
+\r
+       while ( expr && set.length ) {\r
+               for ( type in Expr.filter ) {\r
+                       if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {\r
+                               filter = Expr.filter[ type ];\r
+                               left = match[1];\r
+\r
+                               anyFound = false;\r
+\r
+                               match.splice(1,1);\r
+\r
+                               if ( left.substr( left.length - 1 ) === "\\" ) {\r
+                                       continue;\r
+                               }\r
+\r
+                               if ( curLoop === result ) {\r
+                                       result = [];\r
+                               }\r
+\r
+                               if ( Expr.preFilter[ type ] ) {\r
+                                       match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );\r
+\r
+                                       if ( !match ) {\r
+                                               anyFound = found = true;\r
+\r
+                                       } else if ( match === true ) {\r
+                                               continue;\r
+                                       }\r
+                               }\r
+\r
+                               if ( match ) {\r
+                                       for ( i = 0; (item = curLoop[i]) != null; i++ ) {\r
+                                               if ( item ) {\r
+                                                       found = filter( item, match, i, curLoop );\r
+                                                       pass = not ^ found;\r
+\r
+                                                       if ( inplace && found != null ) {\r
+                                                               if ( pass ) {\r
+                                                                       anyFound = true;\r
+\r
+                                                               } else {\r
+                                                                       curLoop[i] = false;\r
+                                                               }\r
+\r
+                                                       } else if ( pass ) {\r
+                                                               result.push( item );\r
+                                                               anyFound = true;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               if ( found !== undefined ) {\r
+                                       if ( !inplace ) {\r
+                                               curLoop = result;\r
+                                       }\r
+\r
+                                       expr = expr.replace( Expr.match[ type ], "" );\r
+\r
+                                       if ( !anyFound ) {\r
+                                               return [];\r
+                                       }\r
+\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               // Improper expression\r
+               if ( expr === old ) {\r
+                       if ( anyFound == null ) {\r
+                               Sizzle.error( expr );\r
+\r
+                       } else {\r
+                               break;\r
+                       }\r
+               }\r
+\r
+               old = expr;\r
+       }\r
+\r
+       return curLoop;\r
+};\r
+\r
+Sizzle.error = function( msg ) {\r
+       throw new Error( "Syntax error, unrecognized expression: " + msg );\r
+};\r
+\r
+var getText = Sizzle.getText = function( elem ) {\r
+    var i, node,\r
+               nodeType = elem.nodeType,\r
+               ret = "";\r
+\r
+       if ( nodeType ) {\r
+               if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\r
+                       // Use textContent || innerText for elements\r
+                       if ( typeof elem.textContent === 'string' ) {\r
+                               return elem.textContent;\r
+                       } else if ( typeof elem.innerText === 'string' ) {\r
+                               // Replace IE's carriage returns\r
+                               return elem.innerText.replace( rReturn, '' );\r
+                       } else {\r
+                               // Traverse it's children\r
+                               for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {\r
+                                       ret += getText( elem );\r
+                               }\r
+                       }\r
+               } else if ( nodeType === 3 || nodeType === 4 ) {\r
+                       return elem.nodeValue;\r
+               }\r
+       } else {\r
+\r
+               // If no nodeType, this is expected to be an array\r
+               for ( i = 0; (node = elem[i]); i++ ) {\r
+                       // Do not traverse comment nodes\r
+                       if ( node.nodeType !== 8 ) {\r
+                               ret += getText( node );\r
+                       }\r
+               }\r
+       }\r
+       return ret;\r
+};\r
+\r
+var Expr = Sizzle.selectors = {\r
+       order: [ "ID", "NAME", "TAG" ],\r
+\r
+       match: {\r
+               ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
+               CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
+               NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,\r
+               ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,\r
+               TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,\r
+               CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,\r
+               POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,\r
+               PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/\r
+       },\r
+\r
+       leftMatch: {},\r
+\r
+       attrMap: {\r
+               "class": "className",\r
+               "for": "htmlFor"\r
+       },\r
+\r
+       attrHandle: {\r
+               href: function( elem ) {\r
+                       return elem.getAttribute( "href" );\r
+               },\r
+               type: function( elem ) {\r
+                       return elem.getAttribute( "type" );\r
+               }\r
+       },\r
+\r
+       relative: {\r
+               "+": function(checkSet, part){\r
+                       var isPartStr = typeof part === "string",\r
+                               isTag = isPartStr && !rNonWord.test( part ),\r
+                               isPartStrNotTag = isPartStr && !isTag;\r
+\r
+                       if ( isTag ) {\r
+                               part = part.toLowerCase();\r
+                       }\r
+\r
+                       for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {\r
+                               if ( (elem = checkSet[i]) ) {\r
+                                       while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}\r
+\r
+                                       checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?\r
+                                               elem || false :\r
+                                               elem === part;\r
+                               }\r
+                       }\r
+\r
+                       if ( isPartStrNotTag ) {\r
+                               Sizzle.filter( part, checkSet, true );\r
+                       }\r
+               },\r
+\r
+               ">": function( checkSet, part ) {\r
+                       var elem,\r
+                               isPartStr = typeof part === "string",\r
+                               i = 0,\r
+                               l = checkSet.length;\r
+\r
+                       if ( isPartStr && !rNonWord.test( part ) ) {\r
+                               part = part.toLowerCase();\r
+\r
+                               for ( ; i < l; i++ ) {\r
+                                       elem = checkSet[i];\r
+\r
+                                       if ( elem ) {\r
+                                               var parent = elem.parentNode;\r
+                                               checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;\r
+                                       }\r
+                               }\r
+\r
+                       } else {\r
+                               for ( ; i < l; i++ ) {\r
+                                       elem = checkSet[i];\r
+\r
+                                       if ( elem ) {\r
+                                               checkSet[i] = isPartStr ?\r
+                                                       elem.parentNode :\r
+                                                       elem.parentNode === part;\r
+                                       }\r
+                               }\r
+\r
+                               if ( isPartStr ) {\r
+                                       Sizzle.filter( part, checkSet, true );\r
+                               }\r
+                       }\r
+               },\r
+\r
+               "": function(checkSet, part, isXML){\r
+                       var nodeCheck,\r
+                               doneName = done++,\r
+                               checkFn = dirCheck;\r
+\r
+                       if ( typeof part === "string" && !rNonWord.test( part ) ) {\r
+                               part = part.toLowerCase();\r
+                               nodeCheck = part;\r
+                               checkFn = dirNodeCheck;\r
+                       }\r
+\r
+                       checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );\r
+               },\r
+\r
+               "~": function( checkSet, part, isXML ) {\r
+                       var nodeCheck,\r
+                               doneName = done++,\r
+                               checkFn = dirCheck;\r
+\r
+                       if ( typeof part === "string" && !rNonWord.test( part ) ) {\r
+                               part = part.toLowerCase();\r
+                               nodeCheck = part;\r
+                               checkFn = dirNodeCheck;\r
+                       }\r
+\r
+                       checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );\r
+               }\r
+       },\r
+\r
+       find: {\r
+               ID: function( match, context, isXML ) {\r
+                       if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
+                               var m = context.getElementById(match[1]);\r
+                               // Check parentNode to catch when Blackberry 4.6 returns\r
+                               // nodes that are no longer in the document #6963\r
+                               return m && m.parentNode ? [m] : [];\r
+                       }\r
+               },\r
+\r
+               NAME: function( match, context ) {\r
+                       if ( typeof context.getElementsByName !== "undefined" ) {\r
+                               var ret = [],\r
+                                       results = context.getElementsByName( match[1] );\r
+\r
+                               for ( var i = 0, l = results.length; i < l; i++ ) {\r
+                                       if ( results[i].getAttribute("name") === match[1] ) {\r
+                                               ret.push( results[i] );\r
+                                       }\r
+                               }\r
+\r
+                               return ret.length === 0 ? null : ret;\r
+                       }\r
+               },\r
+\r
+               TAG: function( match, context ) {\r
+                       if ( typeof context.getElementsByTagName !== "undefined" ) {\r
+                               return context.getElementsByTagName( match[1] );\r
+                       }\r
+               }\r
+       },\r
+       preFilter: {\r
+               CLASS: function( match, curLoop, inplace, result, not, isXML ) {\r
+                       match = " " + match[1].replace( rBackslash, "" ) + " ";\r
+\r
+                       if ( isXML ) {\r
+                               return match;\r
+                       }\r
+\r
+                       for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {\r
+                               if ( elem ) {\r
+                                       if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {\r
+                                               if ( !inplace ) {\r
+                                                       result.push( elem );\r
+                                               }\r
+\r
+                                       } else if ( inplace ) {\r
+                                               curLoop[i] = false;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return false;\r
+               },\r
+\r
+               ID: function( match ) {\r
+                       return match[1].replace( rBackslash, "" );\r
+               },\r
+\r
+               TAG: function( match, curLoop ) {\r
+                       return match[1].replace( rBackslash, "" ).toLowerCase();\r
+               },\r
+\r
+               CHILD: function( match ) {\r
+                       if ( match[1] === "nth" ) {\r
+                               if ( !match[2] ) {\r
+                                       Sizzle.error( match[0] );\r
+                               }\r
+\r
+                               match[2] = match[2].replace(/^\+|\s*/g, '');\r
+\r
+                               // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'\r
+                               var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(\r
+                                       match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||\r
+                                       !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);\r
+\r
+                               // calculate the numbers (first)n+(last) including if they are negative\r
+                               match[2] = (test[1] + (test[2] || 1)) - 0;\r
+                               match[3] = test[3] - 0;\r
+                       }\r
+                       else if ( match[2] ) {\r
+                               Sizzle.error( match[0] );\r
+                       }\r
+\r
+                       // TODO: Move to normal caching system\r
+                       match[0] = done++;\r
+\r
+                       return match;\r
+               },\r
+\r
+               ATTR: function( match, curLoop, inplace, result, not, isXML ) {\r
+                       var name = match[1] = match[1].replace( rBackslash, "" );\r
+\r
+                       if ( !isXML && Expr.attrMap[name] ) {\r
+                               match[1] = Expr.attrMap[name];\r
+                       }\r
+\r
+                       // Handle if an un-quoted value was used\r
+                       match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );\r
+\r
+                       if ( match[2] === "~=" ) {\r
+                               match[4] = " " + match[4] + " ";\r
+                       }\r
+\r
+                       return match;\r
+               },\r
+\r
+               PSEUDO: function( match, curLoop, inplace, result, not ) {\r
+                       if ( match[1] === "not" ) {\r
+                               // If we're dealing with a complex expression, or a simple one\r
+                               if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {\r
+                                       match[3] = Sizzle(match[3], null, null, curLoop);\r
+\r
+                               } else {\r
+                                       var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);\r
+\r
+                                       if ( !inplace ) {\r
+                                               result.push.apply( result, ret );\r
+                                       }\r
+\r
+                                       return false;\r
+                               }\r
+\r
+                       } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {\r
+                               return true;\r
+                       }\r
+\r
+                       return match;\r
+               },\r
+\r
+               POS: function( match ) {\r
+                       match.unshift( true );\r
+\r
+                       return match;\r
+               }\r
+       },\r
+\r
+       filters: {\r
+               enabled: function( elem ) {\r
+                       return elem.disabled === false && elem.type !== "hidden";\r
+               },\r
+\r
+               disabled: function( elem ) {\r
+                       return elem.disabled === true;\r
+               },\r
+\r
+               checked: function( elem ) {\r
+                       return elem.checked === true;\r
+               },\r
+\r
+               selected: function( elem ) {\r
+                       // Accessing this property makes selected-by-default\r
+                       // options in Safari work properly\r
+                       if ( elem.parentNode ) {\r
+                               elem.parentNode.selectedIndex;\r
+                       }\r
+\r
+                       return elem.selected === true;\r
+               },\r
+\r
+               parent: function( elem ) {\r
+                       return !!elem.firstChild;\r
+               },\r
+\r
+               empty: function( elem ) {\r
+                       return !elem.firstChild;\r
+               },\r
+\r
+               has: function( elem, i, match ) {\r
+                       return !!Sizzle( match[3], elem ).length;\r
+               },\r
+\r
+               header: function( elem ) {\r
+                       return (/h\d/i).test( elem.nodeName );\r
+               },\r
+\r
+               text: function( elem ) {\r
+                       var attr = elem.getAttribute( "type" ), type = elem.type;\r
+                       // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\r
+                       // use getAttribute instead to test this case\r
+                       return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );\r
+               },\r
+\r
+               radio: function( elem ) {\r
+                       return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;\r
+               },\r
+\r
+               checkbox: function( elem ) {\r
+                       return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;\r
+               },\r
+\r
+               file: function( elem ) {\r
+                       return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;\r
+               },\r
+\r
+               password: function( elem ) {\r
+                       return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;\r
+               },\r
+\r
+               submit: function( elem ) {\r
+                       var name = elem.nodeName.toLowerCase();\r
+                       return (name === "input" || name === "button") && "submit" === elem.type;\r
+               },\r
+\r
+               image: function( elem ) {\r
+                       return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;\r
+               },\r
+\r
+               reset: function( elem ) {\r
+                       var name = elem.nodeName.toLowerCase();\r
+                       return (name === "input" || name === "button") && "reset" === elem.type;\r
+               },\r
+\r
+               button: function( elem ) {\r
+                       var name = elem.nodeName.toLowerCase();\r
+                       return name === "input" && "button" === elem.type || name === "button";\r
+               },\r
+\r
+               input: function( elem ) {\r
+                       return (/input|select|textarea|button/i).test( elem.nodeName );\r
+               },\r
+\r
+               focus: function( elem ) {\r
+                       return elem === elem.ownerDocument.activeElement;\r
+               }\r
+       },\r
+       setFilters: {\r
+               first: function( elem, i ) {\r
+                       return i === 0;\r
+               },\r
+\r
+               last: function( elem, i, match, array ) {\r
+                       return i === array.length - 1;\r
+               },\r
+\r
+               even: function( elem, i ) {\r
+                       return i % 2 === 0;\r
+               },\r
+\r
+               odd: function( elem, i ) {\r
+                       return i % 2 === 1;\r
+               },\r
+\r
+               lt: function( elem, i, match ) {\r
+                       return i < match[3] - 0;\r
+               },\r
+\r
+               gt: function( elem, i, match ) {\r
+                       return i > match[3] - 0;\r
+               },\r
+\r
+               nth: function( elem, i, match ) {\r
+                       return match[3] - 0 === i;\r
+               },\r
+\r
+               eq: function( elem, i, match ) {\r
+                       return match[3] - 0 === i;\r
+               }\r
+       },\r
+       filter: {\r
+               PSEUDO: function( elem, match, i, array ) {\r
+                       var name = match[1],\r
+                               filter = Expr.filters[ name ];\r
+\r
+                       if ( filter ) {\r
+                               return filter( elem, i, match, array );\r
+\r
+                       } else if ( name === "contains" ) {\r
+                               return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;\r
+\r
+                       } else if ( name === "not" ) {\r
+                               var not = match[3];\r
+\r
+                               for ( var j = 0, l = not.length; j < l; j++ ) {\r
+                                       if ( not[j] === elem ) {\r
+                                               return false;\r
+                                       }\r
+                               }\r
+\r
+                               return true;\r
+\r
+                       } else {\r
+                               Sizzle.error( name );\r
+                       }\r
+               },\r
+\r
+               CHILD: function( elem, match ) {\r
+                       var first, last,\r
+                               doneName, parent, cache,\r
+                               count, diff,\r
+                               type = match[1],\r
+                               node = elem;\r
+\r
+                       switch ( type ) {\r
+                               case "only":\r
+                               case "first":\r
+                                       while ( (node = node.previousSibling) ) {\r
+                                               if ( node.nodeType === 1 ) {\r
+                                                       return false;\r
+                                               }\r
+                                       }\r
+\r
+                                       if ( type === "first" ) {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       node = elem;\r
+\r
+                                       /* falls through */\r
+                               case "last":\r
+                                       while ( (node = node.nextSibling) ) {\r
+                                               if ( node.nodeType === 1 ) {\r
+                                                       return false;\r
+                                               }\r
+                                       }\r
+\r
+                                       return true;\r
+\r
+                               case "nth":\r
+                                       first = match[2];\r
+                                       last = match[3];\r
+\r
+                                       if ( first === 1 && last === 0 ) {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       doneName = match[0];\r
+                                       parent = elem.parentNode;\r
+\r
+                                       if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {\r
+                                               count = 0;\r
+\r
+                                               for ( node = parent.firstChild; node; node = node.nextSibling ) {\r
+                                                       if ( node.nodeType === 1 ) {\r
+                                                               node.nodeIndex = ++count;\r
+                                                       }\r
+                                               }\r
+\r
+                                               parent[ expando ] = doneName;\r
+                                       }\r
+\r
+                                       diff = elem.nodeIndex - last;\r
+\r
+                                       if ( first === 0 ) {\r
+                                               return diff === 0;\r
+\r
+                                       } else {\r
+                                               return ( diff % first === 0 && diff / first >= 0 );\r
+                                       }\r
+                       }\r
+               },\r
+\r
+               ID: function( elem, match ) {\r
+                       return elem.nodeType === 1 && elem.getAttribute("id") === match;\r
+               },\r
+\r
+               TAG: function( elem, match ) {\r
+                       return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;\r
+               },\r
+\r
+               CLASS: function( elem, match ) {\r
+                       return (" " + (elem.className || elem.getAttribute("class")) + " ")\r
+                               .indexOf( match ) > -1;\r
+               },\r
+\r
+               ATTR: function( elem, match ) {\r
+                       var name = match[1],\r
+                               result = Sizzle.attr ?\r
+                                       Sizzle.attr( elem, name ) :\r
+                                       Expr.attrHandle[ name ] ?\r
+                                       Expr.attrHandle[ name ]( elem ) :\r
+                                       elem[ name ] != null ?\r
+                                               elem[ name ] :\r
+                                               elem.getAttribute( name ),\r
+                               value = result + "",\r
+                               type = match[2],\r
+                               check = match[4];\r
+\r
+                       return result == null ?\r
+                               type === "!=" :\r
+                               !type && Sizzle.attr ?\r
+                               result != null :\r
+                               type === "=" ?\r
+                               value === check :\r
+                               type === "*=" ?\r
+                               value.indexOf(check) >= 0 :\r
+                               type === "~=" ?\r
+                               (" " + value + " ").indexOf(check) >= 0 :\r
+                               !check ?\r
+                               value && result !== false :\r
+                               type === "!=" ?\r
+                               value !== check :\r
+                               type === "^=" ?\r
+                               value.indexOf(check) === 0 :\r
+                               type === "$=" ?\r
+                               value.substr(value.length - check.length) === check :\r
+                               type === "|=" ?\r
+                               value === check || value.substr(0, check.length + 1) === check + "-" :\r
+                               false;\r
+               },\r
+\r
+               POS: function( elem, match, i, array ) {\r
+                       var name = match[2],\r
+                               filter = Expr.setFilters[ name ];\r
+\r
+                       if ( filter ) {\r
+                               return filter( elem, i, match, array );\r
+                       }\r
+               }\r
+       }\r
+};\r
+\r
+var origPOS = Expr.match.POS,\r
+       fescape = function(all, num){\r
+               return "\\" + (num - 0 + 1);\r
+       };\r
+\r
+for ( var type in Expr.match ) {\r
+       Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );\r
+       Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );\r
+}\r
+// Expose origPOS\r
+// "global" as in regardless of relation to brackets/parens\r
+Expr.match.globalPOS = origPOS;\r
+\r
+var makeArray = function( array, results ) {\r
+       array = Array.prototype.slice.call( array, 0 );\r
+\r
+       if ( results ) {\r
+               results.push.apply( results, array );\r
+               return results;\r
+       }\r
+\r
+       return array;\r
+};\r
+\r
+// Perform a simple check to determine if the browser is capable of\r
+// converting a NodeList to an array using builtin methods.\r
+// Also verifies that the returned array holds DOM nodes\r
+// (which is not the case in the Blackberry browser)\r
+try {\r
+       Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;\r
+\r
+// Provide a fallback method if it does not work\r
+} catch( e ) {\r
+       makeArray = function( array, results ) {\r
+               var i = 0,\r
+                       ret = results || [];\r
+\r
+               if ( toString.call(array) === "[object Array]" ) {\r
+                       Array.prototype.push.apply( ret, array );\r
+\r
+               } else {\r
+                       if ( typeof array.length === "number" ) {\r
+                               for ( var l = array.length; i < l; i++ ) {\r
+                                       ret.push( array[i] );\r
+                               }\r
+\r
+                       } else {\r
+                               for ( ; array[i]; i++ ) {\r
+                                       ret.push( array[i] );\r
+                               }\r
+                       }\r
+               }\r
+\r
+               return ret;\r
+       };\r
+}\r
+\r
+var sortOrder, siblingCheck;\r
+\r
+if ( document.documentElement.compareDocumentPosition ) {\r
+       sortOrder = function( a, b ) {\r
+               if ( a === b ) {\r
+                       hasDuplicate = true;\r
+                       return 0;\r
+               }\r
+\r
+               if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {\r
+                       return a.compareDocumentPosition ? -1 : 1;\r
+               }\r
+\r
+               return a.compareDocumentPosition(b) & 4 ? -1 : 1;\r
+       };\r
+\r
+} else {\r
+       sortOrder = function( a, b ) {\r
+               // The nodes are identical, we can exit early\r
+               if ( a === b ) {\r
+                       hasDuplicate = true;\r
+                       return 0;\r
+\r
+               // Fallback to using sourceIndex (in IE) if it's available on both nodes\r
+               } else if ( a.sourceIndex && b.sourceIndex ) {\r
+                       return a.sourceIndex - b.sourceIndex;\r
+               }\r
+\r
+               var al, bl,\r
+                       ap = [],\r
+                       bp = [],\r
+                       aup = a.parentNode,\r
+                       bup = b.parentNode,\r
+                       cur = aup;\r
+\r
+               // If the nodes are siblings (or identical) we can do a quick check\r
+               if ( aup === bup ) {\r
+                       return siblingCheck( a, b );\r
+\r
+               // If no parents were found then the nodes are disconnected\r
+               } else if ( !aup ) {\r
+                       return -1;\r
+\r
+               } else if ( !bup ) {\r
+                       return 1;\r
+               }\r
+\r
+               // Otherwise they're somewhere else in the tree so we need\r
+               // to build up a full list of the parentNodes for comparison\r
+               while ( cur ) {\r
+                       ap.unshift( cur );\r
+                       cur = cur.parentNode;\r
+               }\r
+\r
+               cur = bup;\r
+\r
+               while ( cur ) {\r
+                       bp.unshift( cur );\r
+                       cur = cur.parentNode;\r
+               }\r
+\r
+               al = ap.length;\r
+               bl = bp.length;\r
+\r
+               // Start walking down the tree looking for a discrepancy\r
+               for ( var i = 0; i < al && i < bl; i++ ) {\r
+                       if ( ap[i] !== bp[i] ) {\r
+                               return siblingCheck( ap[i], bp[i] );\r
+                       }\r
+               }\r
+\r
+               // We ended someplace up the tree so do a sibling check\r
+               return i === al ?\r
+                       siblingCheck( a, bp[i], -1 ) :\r
+                       siblingCheck( ap[i], b, 1 );\r
+       };\r
+\r
+       siblingCheck = function( a, b, ret ) {\r
+               if ( a === b ) {\r
+                       return ret;\r
+               }\r
+\r
+               var cur = a.nextSibling;\r
+\r
+               while ( cur ) {\r
+                       if ( cur === b ) {\r
+                               return -1;\r
+                       }\r
+\r
+                       cur = cur.nextSibling;\r
+               }\r
+\r
+               return 1;\r
+       };\r
+}\r
+\r
+// Check to see if the browser returns elements by name when\r
+// querying by getElementById (and provide a workaround)\r
+(function(){\r
+       // We're going to inject a fake input element with a specified name\r
+       var form = document.createElement("div"),\r
+               id = "script" + (new Date()).getTime(),\r
+               root = document.documentElement;\r
+\r
+       form.innerHTML = "<a name='" + id + "'/>";\r
+\r
+       // Inject it into the root element, check its status, and remove it quickly\r
+       root.insertBefore( form, root.firstChild );\r
+\r
+       // The workaround has to do additional checks after a getElementById\r
+       // Which slows things down for other browsers (hence the branching)\r
+       if ( document.getElementById( id ) ) {\r
+               Expr.find.ID = function( match, context, isXML ) {\r
+                       if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
+                               var m = context.getElementById(match[1]);\r
+\r
+                               return m ?\r
+                                       m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?\r
+                                               [m] :\r
+                                               undefined :\r
+                                       [];\r
+                       }\r
+               };\r
+\r
+               Expr.filter.ID = function( elem, match ) {\r
+                       var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");\r
+\r
+                       return elem.nodeType === 1 && node && node.nodeValue === match;\r
+               };\r
+       }\r
+\r
+       root.removeChild( form );\r
+\r
+       // release memory in IE\r
+       root = form = null;\r
+})();\r
+\r
+(function(){\r
+       // Check to see if the browser returns only elements\r
+       // when doing getElementsByTagName("*")\r
+\r
+       // Create a fake element\r
+       var div = document.createElement("div");\r
+       div.appendChild( document.createComment("") );\r
+\r
+       // Make sure no comments are found\r
+       if ( div.getElementsByTagName("*").length > 0 ) {\r
+               Expr.find.TAG = function( match, context ) {\r
+                       var results = context.getElementsByTagName( match[1] );\r
+\r
+                       // Filter out possible comments\r
+                       if ( match[1] === "*" ) {\r
+                               var tmp = [];\r
+\r
+                               for ( var i = 0; results[i]; i++ ) {\r
+                                       if ( results[i].nodeType === 1 ) {\r
+                                               tmp.push( results[i] );\r
+                                       }\r
+                               }\r
+\r
+                               results = tmp;\r
+                       }\r
+\r
+                       return results;\r
+               };\r
+       }\r
+\r
+       // Check to see if an attribute returns normalized href attributes\r
+       div.innerHTML = "<a href='#'></a>";\r
+\r
+       if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&\r
+                       div.firstChild.getAttribute("href") !== "#" ) {\r
+\r
+               Expr.attrHandle.href = function( elem ) {\r
+                       return elem.getAttribute( "href", 2 );\r
+               };\r
+       }\r
+\r
+       // release memory in IE\r
+       div = null;\r
+})();\r
+\r
+if ( document.querySelectorAll ) {\r
+       (function(){\r
+               var oldSizzle = Sizzle,\r
+                       div = document.createElement("div"),\r
+                       id = "__sizzle__";\r
+\r
+               div.innerHTML = "<p class='TEST'></p>";\r
+\r
+               // Safari can't handle uppercase or unicode characters when\r
+               // in quirks mode.\r
+               if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {\r
+                       return;\r
+               }\r
+\r
+               Sizzle = function( query, context, extra, seed ) {\r
+                       context = context || document;\r
+\r
+                       // Only use querySelectorAll on non-XML documents\r
+                       // (ID selectors don't work in non-HTML documents)\r
+                       if ( !seed && !Sizzle.isXML(context) ) {\r
+                               // See if we find a selector to speed up\r
+                               var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );\r
+\r
+                               if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {\r
+                                       // Speed-up: Sizzle("TAG")\r
+                                       if ( match[1] ) {\r
+                                               return makeArray( context.getElementsByTagName( query ), extra );\r
+\r
+                                       // Speed-up: Sizzle(".CLASS")\r
+                                       } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {\r
+                                               return makeArray( context.getElementsByClassName( match[2] ), extra );\r
+                                       }\r
+                               }\r
+\r
+                               if ( context.nodeType === 9 ) {\r
+                                       // Speed-up: Sizzle("body")\r
+                                       // The body element only exists once, optimize finding it\r
+                                       if ( query === "body" && context.body ) {\r
+                                               return makeArray( [ context.body ], extra );\r
+\r
+                                       // Speed-up: Sizzle("#ID")\r
+                                       } else if ( match && match[3] ) {\r
+                                               var elem = context.getElementById( match[3] );\r
+\r
+                                               // Check parentNode to catch when Blackberry 4.6 returns\r
+                                               // nodes that are no longer in the document #6963\r
+                                               if ( elem && elem.parentNode ) {\r
+                                                       // Handle the case where IE and Opera return items\r
+                                                       // by name instead of ID\r
+                                                       if ( elem.id === match[3] ) {\r
+                                                               return makeArray( [ elem ], extra );\r
+                                                       }\r
+\r
+                                               } else {\r
+                                                       return makeArray( [], extra );\r
+                                               }\r
+                                       }\r
+\r
+                                       try {\r
+                                               return makeArray( context.querySelectorAll(query), extra );\r
+                                       } catch(qsaError) {}\r
+\r
+                               // qSA works strangely on Element-rooted queries\r
+                               // We can work around this by specifying an extra ID on the root\r
+                               // and working up from there (Thanks to Andrew Dupont for the technique)\r
+                               // IE 8 doesn't work on object elements\r
+                               } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {\r
+                                       var oldContext = context,\r
+                                               old = context.getAttribute( "id" ),\r
+                                               nid = old || id,\r
+                                               hasParent = context.parentNode,\r
+                                               relativeHierarchySelector = /^\s*[+~]/.test( query );\r
+\r
+                                       if ( !old ) {\r
+                                               context.setAttribute( "id", nid );\r
+                                       } else {\r
+                                               nid = nid.replace( /'/g, "\\$&" );\r
+                                       }\r
+                                       if ( relativeHierarchySelector && hasParent ) {\r
+                                               context = context.parentNode;\r
+                                       }\r
+\r
+                                       try {\r
+                                               if ( !relativeHierarchySelector || hasParent ) {\r
+                                                       return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );\r
+                                               }\r
+\r
+                                       } catch(pseudoError) {\r
+                                       } finally {\r
+                                               if ( !old ) {\r
+                                                       oldContext.removeAttribute( "id" );\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return oldSizzle(query, context, extra, seed);\r
+               };\r
+\r
+               for ( var prop in oldSizzle ) {\r
+                       Sizzle[ prop ] = oldSizzle[ prop ];\r
+               }\r
+\r
+               // release memory in IE\r
+               div = null;\r
+       })();\r
+}\r
+\r
+(function(){\r
+       var html = document.documentElement,\r
+               matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;\r
+\r
+       if ( matches ) {\r
+               // Check to see if it's possible to do matchesSelector\r
+               // on a disconnected node (IE 9 fails this)\r
+               var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),\r
+                       pseudoWorks = false;\r
+\r
+               try {\r
+                       // This should fail with an exception\r
+                       // Gecko does not error, returns false instead\r
+                       matches.call( document.documentElement, "[test!='']:sizzle" );\r
+\r
+               } catch( pseudoError ) {\r
+                       pseudoWorks = true;\r
+               }\r
+\r
+               Sizzle.matchesSelector = function( node, expr ) {\r
+                       // Make sure that attribute selectors are quoted\r
+                       expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");\r
+\r
+                       if ( !Sizzle.isXML( node ) ) {\r
+                               try {\r
+                                       if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {\r
+                                               var ret = matches.call( node, expr );\r
+\r
+                                               // IE 9's matchesSelector returns false on disconnected nodes\r
+                                               if ( ret || !disconnectedMatch ||\r
+                                                               // As well, disconnected nodes are said to be in a document\r
+                                                               // fragment in IE 9, so check for that\r
+                                                               node.document && node.document.nodeType !== 11 ) {\r
+                                                       return ret;\r
+                                               }\r
+                                       }\r
+                               } catch(e) {}\r
+                       }\r
+\r
+                       return Sizzle(expr, null, null, [node]).length > 0;\r
+               };\r
+       }\r
+})();\r
+\r
+(function(){\r
+       var div = document.createElement("div");\r
+\r
+       div.innerHTML = "<div class='test e'></div><div class='test'></div>";\r
+\r
+       // Opera can't find a second classname (in 9.6)\r
+       // Also, make sure that getElementsByClassName actually exists\r
+       if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {\r
+               return;\r
+       }\r
+\r
+       // Safari caches class attributes, doesn't catch changes (in 3.2)\r
+       div.lastChild.className = "e";\r
+\r
+       if ( div.getElementsByClassName("e").length === 1 ) {\r
+               return;\r
+       }\r
+\r
+       Expr.order.splice(1, 0, "CLASS");\r
+       Expr.find.CLASS = function( match, context, isXML ) {\r
+               if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {\r
+                       return context.getElementsByClassName(match[1]);\r
+               }\r
+       };\r
+\r
+       // release memory in IE\r
+       div = null;\r
+})();\r
+\r
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
+               var elem = checkSet[i];\r
+\r
+               if ( elem ) {\r
+                       var match = false;\r
+\r
+                       elem = elem[dir];\r
+\r
+                       while ( elem ) {\r
+                               if ( elem[ expando ] === doneName ) {\r
+                                       match = checkSet[elem.sizset];\r
+                                       break;\r
+                               }\r
+\r
+                               if ( elem.nodeType === 1 && !isXML ){\r
+                                       elem[ expando ] = doneName;\r
+                                       elem.sizset = i;\r
+                               }\r
+\r
+                               if ( elem.nodeName.toLowerCase() === cur ) {\r
+                                       match = elem;\r
+                                       break;\r
+                               }\r
+\r
+                               elem = elem[dir];\r
+                       }\r
+\r
+                       checkSet[i] = match;\r
+               }\r
+       }\r
+}\r
+\r
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
+               var elem = checkSet[i];\r
+\r
+               if ( elem ) {\r
+                       var match = false;\r
+\r
+                       elem = elem[dir];\r
+\r
+                       while ( elem ) {\r
+                               if ( elem[ expando ] === doneName ) {\r
+                                       match = checkSet[elem.sizset];\r
+                                       break;\r
+                               }\r
+\r
+                               if ( elem.nodeType === 1 ) {\r
+                                       if ( !isXML ) {\r
+                                               elem[ expando ] = doneName;\r
+                                               elem.sizset = i;\r
+                                       }\r
+\r
+                                       if ( typeof cur !== "string" ) {\r
+                                               if ( elem === cur ) {\r
+                                                       match = true;\r
+                                                       break;\r
+                                               }\r
+\r
+                                       } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {\r
+                                               match = elem;\r
+                                               break;\r
+                                       }\r
+                               }\r
+\r
+                               elem = elem[dir];\r
+                       }\r
+\r
+                       checkSet[i] = match;\r
+               }\r
+       }\r
+}\r
+\r
+if ( document.documentElement.contains ) {\r
+       Sizzle.contains = function( a, b ) {\r
+               return a !== b && (a.contains ? a.contains(b) : true);\r
+       };\r
+\r
+} else if ( document.documentElement.compareDocumentPosition ) {\r
+       Sizzle.contains = function( a, b ) {\r
+               return !!(a.compareDocumentPosition(b) & 16);\r
+       };\r
+\r
+} else {\r
+       Sizzle.contains = function() {\r
+               return false;\r
+       };\r
+}\r
+\r
+Sizzle.isXML = function( elem ) {\r
+       // documentElement is verified for cases where it doesn't yet exist\r
+       // (such as loading iframes in IE - #4833)\r
+       var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;\r
+\r
+       return documentElement ? documentElement.nodeName !== "HTML" : false;\r
+};\r
+\r
+var posProcess = function( selector, context, seed ) {\r
+       var match,\r
+               tmpSet = [],\r
+               later = "",\r
+               root = context.nodeType ? [context] : context;\r
+\r
+       // Position selectors must be done after the filter\r
+       // And so must :not(positional) so we move all PSEUDOs to the end\r
+       while ( (match = Expr.match.PSEUDO.exec( selector )) ) {\r
+               later += match[0];\r
+               selector = selector.replace( Expr.match.PSEUDO, "" );\r
+       }\r
+\r
+       selector = Expr.relative[selector] ? selector + "*" : selector;\r
+\r
+       for ( var i = 0, l = root.length; i < l; i++ ) {\r
+               Sizzle( selector, root[i], tmpSet, seed );\r
+       }\r
+\r
+       return Sizzle.filter( later, tmpSet );\r
+};\r
+\r
+// EXPOSE\r
+\r
+window.tinymce.dom.Sizzle = Sizzle;\r
+\r
+})();\r
+\r
+\r
+(function(tinymce) {\r
+       tinymce.dom.Element = function(id, settings) {\r
+               var t = this, dom, el;\r
+\r
+               t.settings = settings = settings || {};\r
+               t.id = id;\r
+               t.dom = dom = settings.dom || tinymce.DOM;\r
+\r
+               // Only IE leaks DOM references, this is a lot faster\r
+               if (!tinymce.isIE)\r
+                       el = dom.get(t.id);\r
+\r
+               tinymce.each(\r
+                               ('getPos,getRect,getParent,add,setStyle,getStyle,setStyles,' + \r
+                               'setAttrib,setAttribs,getAttrib,addClass,removeClass,' + \r
+                               'hasClass,getOuterHTML,setOuterHTML,remove,show,hide,' + \r
+                               'isHidden,setHTML,get').split(/,/), function(k) {\r
+                                       t[k] = function() {\r
+                                               var a = [id], i;\r
+\r
+                                               for (i = 0; i < arguments.length; i++)\r
+                                                       a.push(arguments[i]);\r
+\r
+                                               a = dom[k].apply(dom, a);\r
+                                               t.update(k);\r
+\r
+                                               return a;\r
+                                       };\r
+                       }\r
+               );\r
+\r
+               tinymce.extend(t, {\r
+                       on : function(n, f, s) {\r
+                               return tinymce.dom.Event.add(t.id, n, f, s);\r
+                       },\r
+\r
+                       getXY : function() {\r
+                               return {\r
+                                       x : parseInt(t.getStyle('left')),\r
+                                       y : parseInt(t.getStyle('top'))\r
+                               };\r
+                       },\r
+\r
+                       getSize : function() {\r
+                               var n = dom.get(t.id);\r
+\r
+                               return {\r
+                                       w : parseInt(t.getStyle('width') || n.clientWidth),\r
+                                       h : parseInt(t.getStyle('height') || n.clientHeight)\r
+                               };\r
+                       },\r
+\r
+                       moveTo : function(x, y) {\r
+                               t.setStyles({left : x, top : y});\r
+                       },\r
+\r
+                       moveBy : function(x, y) {\r
+                               var p = t.getXY();\r
+\r
+                               t.moveTo(p.x + x, p.y + y);\r
+                       },\r
+\r
+                       resizeTo : function(w, h) {\r
+                               t.setStyles({width : w, height : h});\r
+                       },\r
+\r
+                       resizeBy : function(w, h) {\r
+                               var s = t.getSize();\r
+\r
+                               t.resizeTo(s.w + w, s.h + h);\r
+                       },\r
+\r
+                       update : function(k) {\r
+                               var b;\r
+\r
+                               if (tinymce.isIE6 && settings.blocker) {\r
+                                       k = k || '';\r
+\r
+                                       // Ignore getters\r
+                                       if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)\r
+                                               return;\r
+\r
+                                       // Remove blocker on remove\r
+                                       if (k == 'remove') {\r
+                                               dom.remove(t.blocker);\r
+                                               return;\r
+                                       }\r
+\r
+                                       if (!t.blocker) {\r
+                                               t.blocker = dom.uniqueId();\r
+                                               b = dom.add(settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});\r
+                                               dom.setStyle(b, 'opacity', 0);\r
+                                       } else\r
+                                               b = dom.get(t.blocker);\r
+\r
+                                       dom.setStyles(b, {\r
+                                               left : t.getStyle('left', 1),\r
+                                               top : t.getStyle('top', 1),\r
+                                               width : t.getStyle('width', 1),\r
+                                               height : t.getStyle('height', 1),\r
+                                               display : t.getStyle('display', 1),\r
+                                               zIndex : parseInt(t.getStyle('zIndex', 1) || 0) - 1\r
+                                       });\r
+                               }\r
+                       }\r
+               });\r
+       };\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       function trimNl(s) {\r
+               return s.replace(/[\n\r]+/g, '');\r
+       };\r
+\r
+       // Shorten names\r
+       var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each, TreeWalker = tinymce.dom.TreeWalker;\r
+\r
+       tinymce.create('tinymce.dom.Selection', {\r
+               Selection : function(dom, win, serializer, editor) {\r
+                       var t = this;\r
+\r
+                       t.dom = dom;\r
+                       t.win = win;\r
+                       t.serializer = serializer;\r
+                       t.editor = editor;\r
+\r
+                       // Add events\r
+                       each([\r
+                               'onBeforeSetContent',\r
+\r
+                               'onBeforeGetContent',\r
+\r
+                               'onSetContent',\r
+\r
+                               'onGetContent'\r
+                       ], function(e) {\r
+                               t[e] = new tinymce.util.Dispatcher(t);\r
+                       });\r
+\r
+                       // No W3C Range support\r
+                       if (!t.win.getSelection)\r
+                               t.tridentSel = new tinymce.dom.TridentSelection(t);\r
+\r
+                       if (tinymce.isIE && dom.boxModel)\r
+                               this._fixIESelection();\r
+\r
+                       // Prevent leaks\r
+                       tinymce.addUnload(t.destroy, t);\r
+               },\r
+\r
+               setCursorLocation: function(node, offset) {\r
+                       var t = this; var r = t.dom.createRng();\r
+                       r.setStart(node, offset);\r
+                       r.setEnd(node, offset);\r
+                       t.setRng(r);\r
+                       t.collapse(false);\r
+               },\r
+               getContent : function(s) {\r
+                       var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;\r
+\r
+                       s = s || {};\r
+                       wb = wa = '';\r
+                       s.get = true;\r
+                       s.format = s.format || 'html';\r
+                       s.forced_root_block = '';\r
+                       t.onBeforeGetContent.dispatch(t, s);\r
+\r
+                       if (s.format == 'text')\r
+                               return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));\r
+\r
+                       if (r.cloneContents) {\r
+                               n = r.cloneContents();\r
+\r
+                               if (n)\r
+                                       e.appendChild(n);\r
+                       } else if (is(r.item) || is(r.htmlText)) {\r
+                               // IE will produce invalid markup if elements are present that\r
+                               // it doesn't understand like custom elements or HTML5 elements.\r
+                               // Adding a BR in front of the contents and then remoiving it seems to fix it though.\r
+                               e.innerHTML = '<br>' + (r.item ? r.item(0).outerHTML : r.htmlText);\r
+                               e.removeChild(e.firstChild);\r
+                       } else\r
+                               e.innerHTML = r.toString();\r
+\r
+                       // Keep whitespace before and after\r
+                       if (/^\s/.test(e.innerHTML))\r
+                               wb = ' ';\r
+\r
+                       if (/\s+$/.test(e.innerHTML))\r
+                               wa = ' ';\r
+\r
+                       s.getInner = true;\r
+\r
+                       s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;\r
+                       t.onGetContent.dispatch(t, s);\r
+\r
+                       return s.content;\r
+               },\r
+\r
+               setContent : function(content, args) {\r
+                       var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp;\r
+\r
+                       args = args || {format : 'html'};\r
+                       args.set = true;\r
+                       content = args.content = content;\r
+\r
+                       // Dispatch before set content event\r
+                       if (!args.no_events)\r
+                               self.onBeforeSetContent.dispatch(self, args);\r
+\r
+                       content = args.content;\r
+\r
+                       if (rng.insertNode) {\r
+                               // Make caret marker since insertNode places the caret in the beginning of text after insert\r
+                               content += '<span id="__caret">_</span>';\r
+\r
+                               // Delete and insert new node\r
+                               if (rng.startContainer == doc && rng.endContainer == doc) {\r
+                                       // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents\r
+                                       doc.body.innerHTML = content;\r
+                               } else {\r
+                                       rng.deleteContents();\r
+\r
+                                       if (doc.body.childNodes.length === 0) {\r
+                                               doc.body.innerHTML = content;\r
+                                       } else {\r
+                                               // createContextualFragment doesn't exists in IE 9 DOMRanges\r
+                                               if (rng.createContextualFragment) {\r
+                                                       rng.insertNode(rng.createContextualFragment(content));\r
+                                               } else {\r
+                                                       // Fake createContextualFragment call in IE 9\r
+                                                       frag = doc.createDocumentFragment();\r
+                                                       temp = doc.createElement('div');\r
+\r
+                                                       frag.appendChild(temp);\r
+                                                       temp.outerHTML = content;\r
+\r
+                                                       rng.insertNode(frag);\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               // Move to caret marker\r
+                               caretNode = self.dom.get('__caret');\r
+\r
+                               // Make sure we wrap it compleatly, Opera fails with a simple select call\r
+                               rng = doc.createRange();\r
+                               rng.setStartBefore(caretNode);\r
+                               rng.setEndBefore(caretNode);\r
+                               self.setRng(rng);\r
+\r
+                               // Remove the caret position\r
+                               self.dom.remove('__caret');\r
+\r
+                               try {\r
+                                       self.setRng(rng);\r
+                               } catch (ex) {\r
+                                       // Might fail on Opera for some odd reason\r
+                               }\r
+                       } else {\r
+                               if (rng.item) {\r
+                                       // Delete content and get caret text selection\r
+                                       doc.execCommand('Delete', false, null);\r
+                                       rng = self.getRng();\r
+                               }\r
+\r
+                               // Explorer removes spaces from the beginning of pasted contents\r
+                               if (/^\s+/.test(content)) {\r
+                                       rng.pasteHTML('<span id="__mce_tmp">_</span>' + content);\r
+                                       self.dom.remove('__mce_tmp');\r
+                               } else\r
+                                       rng.pasteHTML(content);\r
+                       }\r
+\r
+                       // Dispatch set content event\r
+                       if (!args.no_events)\r
+                               self.onSetContent.dispatch(self, args);\r
+               },\r
+\r
+               getStart : function() {\r
+                       var self = this, rng = self.getRng(), startElement, parentElement, checkRng, node;\r
+\r
+                       if (rng.duplicate || rng.item) {\r
+                               // Control selection, return first item\r
+                               if (rng.item)\r
+                                       return rng.item(0);\r
+\r
+                               // Get start element\r
+                               checkRng = rng.duplicate();\r
+                               checkRng.collapse(1);\r
+                               startElement = checkRng.parentElement();\r
+                               if (startElement.ownerDocument !== self.dom.doc) {\r
+                                       startElement = self.dom.getRoot();\r
+                               }\r
+\r
+                               // Check if range parent is inside the start element, then return the inner parent element\r
+                               // This will fix issues when a single element is selected, IE would otherwise return the wrong start element\r
+                               parentElement = node = rng.parentElement();\r
+                               while (node = node.parentNode) {\r
+                                       if (node == startElement) {\r
+                                               startElement = parentElement;\r
+                                               break;\r
+                                       }\r
+                               }\r
+\r
+                               return startElement;\r
+                       } else {\r
+                               startElement = rng.startContainer;\r
+\r
+                               if (startElement.nodeType == 1 && startElement.hasChildNodes())\r
+                                       startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];\r
+\r
+                               if (startElement && startElement.nodeType == 3)\r
+                                       return startElement.parentNode;\r
+\r
+                               return startElement;\r
+                       }\r
+               },\r
+\r
+               getEnd : function() {\r
+                       var self = this, rng = self.getRng(), endElement, endOffset;\r
+\r
+                       if (rng.duplicate || rng.item) {\r
+                               if (rng.item)\r
+                                       return rng.item(0);\r
+\r
+                               rng = rng.duplicate();\r
+                               rng.collapse(0);\r
+                               endElement = rng.parentElement();\r
+                               if (endElement.ownerDocument !== self.dom.doc) {\r
+                                       endElement = self.dom.getRoot();\r
+                               }\r
+\r
+                               if (endElement && endElement.nodeName == 'BODY')\r
+                                       return endElement.lastChild || endElement;\r
+\r
+                               return endElement;\r
+                       } else {\r
+                               endElement = rng.endContainer;\r
+                               endOffset = rng.endOffset;\r
+\r
+                               if (endElement.nodeType == 1 && endElement.hasChildNodes())\r
+                                       endElement = endElement.childNodes[endOffset > 0 ? endOffset - 1 : endOffset];\r
+\r
+                               if (endElement && endElement.nodeType == 3)\r
+                                       return endElement.parentNode;\r
+\r
+                               return endElement;\r
+                       }\r
+               },\r
+\r
+               getBookmark : function(type, normalized) {\r
+                       var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;\r
+\r
+                       function findIndex(name, element) {\r
+                               var index = 0;\r
+\r
+                               each(dom.select(name), function(node, i) {\r
+                                       if (node == element)\r
+                                               index = i;\r
+                               });\r
+\r
+                               return index;\r
+                       };\r
+\r
+                       function normalizeTableCellSelection(rng) {\r
+                               function moveEndPoint(start) {\r
+                                       var container, offset, childNodes, prefix = start ? 'start' : 'end';\r
+\r
+                                       container = rng[prefix + 'Container'];\r
+                                       offset = rng[prefix + 'Offset'];\r
+\r
+                                       if (container.nodeType == 1 && container.nodeName == "TR") {\r
+                                               childNodes = container.childNodes;\r
+                                               container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)];\r
+                                               if (container) {\r
+                                                       offset = start ? 0 : container.childNodes.length;\r
+                                                       rng['set' + (start ? 'Start' : 'End')](container, offset);\r
+                                               }\r
+                                       }\r
+                               };\r
+\r
+                               moveEndPoint(true);\r
+                               moveEndPoint();\r
+\r
+                               return rng;\r
+                       };\r
+\r
+                       function getLocation() {\r
+                               var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};\r
+\r
+                               function getPoint(rng, start) {\r
+                                       var container = rng[start ? 'startContainer' : 'endContainer'],\r
+                                               offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;\r
+\r
+                                       if (container.nodeType == 3) {\r
+                                               if (normalized) {\r
+                                                       for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling)\r
+                                                               offset += node.nodeValue.length;\r
+                                               }\r
+\r
+                                               point.push(offset);\r
+                                       } else {\r
+                                               childNodes = container.childNodes;\r
+\r
+                                               if (offset >= childNodes.length && childNodes.length) {\r
+                                                       after = 1;\r
+                                                       offset = Math.max(0, childNodes.length - 1);\r
+                                               }\r
+\r
+                                               point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);\r
+                                       }\r
+\r
+                                       for (; container && container != root; container = container.parentNode)\r
+                                               point.push(t.dom.nodeIndex(container, normalized));\r
+\r
+                                       return point;\r
+                               };\r
+\r
+                               bookmark.start = getPoint(rng, true);\r
+\r
+                               if (!t.isCollapsed())\r
+                                       bookmark.end = getPoint(rng);\r
+\r
+                               return bookmark;\r
+                       };\r
+\r
+                       if (type == 2) {\r
+                               if (t.tridentSel)\r
+                                       return t.tridentSel.getBookmark(type);\r
+\r
+                               return getLocation();\r
+                       }\r
+\r
+                       // Handle simple range\r
+                       if (type)\r
+                               return {rng : t.getRng()};\r
+\r
+                       rng = t.getRng();\r
+                       id = dom.uniqueId();\r
+                       collapsed = tinyMCE.activeEditor.selection.isCollapsed();\r
+                       styles = 'overflow:hidden;line-height:0px';\r
+\r
+                       // Explorer method\r
+                       if (rng.duplicate || rng.item) {\r
+                               // Text selection\r
+                               if (!rng.item) {\r
+                                       rng2 = rng.duplicate();\r
+\r
+                                       try {\r
+                                               // Insert start marker\r
+                                               rng.collapse();\r
+                                               rng.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');\r
+\r
+                                               // Insert end marker\r
+                                               if (!collapsed) {\r
+                                                       rng2.collapse(false);\r
+\r
+                                                       // Detect the empty space after block elements in IE and move the end back one character <p></p>] becomes <p>]</p>\r
+                                                       rng.moveToElementText(rng2.parentElement());\r
+                                                       if (rng.compareEndPoints('StartToEnd', rng2) === 0)\r
+                                                               rng2.move('character', -1);\r
+\r
+                                                       rng2.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');\r
+                                               }\r
+                                       } catch (ex) {\r
+                                               // IE might throw unspecified error so lets ignore it\r
+                                               return null;\r
+                                       }\r
+                               } else {\r
+                                       // Control selection\r
+                                       element = rng.item(0);\r
+                                       name = element.nodeName;\r
+\r
+                                       return {name : name, index : findIndex(name, element)};\r
+                               }\r
+                       } else {\r
+                               element = t.getNode();\r
+                               name = element.nodeName;\r
+                               if (name == 'IMG')\r
+                                       return {name : name, index : findIndex(name, element)};\r
+\r
+                               // W3C method\r
+                               rng2 = normalizeTableCellSelection(rng.cloneRange());\r
+\r
+                               // Insert end marker\r
+                               if (!collapsed) {\r
+                                       rng2.collapse(false);\r
+                                       rng2.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_end', style : styles}, chr));\r
+                               }\r
+\r
+                               rng = normalizeTableCellSelection(rng);\r
+                               rng.collapse(true);\r
+                               rng.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_start', style : styles}, chr));\r
+                       }\r
+\r
+                       t.moveToBookmark({id : id, keep : 1});\r
+\r
+                       return {id : id};\r
+               },\r
+\r
+               moveToBookmark : function(bookmark) {\r
+                       var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;\r
+\r
+                       function setEndPoint(start) {\r
+                               var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;\r
+\r
+                               if (point) {\r
+                                       offset = point[0];\r
+\r
+                                       // Find container node\r
+                                       for (node = root, i = point.length - 1; i >= 1; i--) {\r
+                                               children = node.childNodes;\r
+\r
+                                               if (point[i] > children.length - 1)\r
+                                                       return;\r
+\r
+                                               node = children[point[i]];\r
+                                       }\r
+\r
+                                       // Move text offset to best suitable location\r
+                                       if (node.nodeType === 3)\r
+                                               offset = Math.min(point[0], node.nodeValue.length);\r
+\r
+                                       // Move element offset to best suitable location\r
+                                       if (node.nodeType === 1)\r
+                                               offset = Math.min(point[0], node.childNodes.length);\r
+\r
+                                       // Set offset within container node\r
+                                       if (start)\r
+                                               rng.setStart(node, offset);\r
+                                       else\r
+                                               rng.setEnd(node, offset);\r
+                               }\r
+\r
+                               return true;\r
+                       };\r
+\r
+                       function restoreEndPoint(suffix) {\r
+                               var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;\r
+\r
+                               if (marker) {\r
+                                       node = marker.parentNode;\r
+\r
+                                       if (suffix == 'start') {\r
+                                               if (!keep) {\r
+                                                       idx = dom.nodeIndex(marker);\r
+                                               } else {\r
+                                                       node = marker.firstChild;\r
+                                                       idx = 1;\r
+                                               }\r
+\r
+                                               startContainer = endContainer = node;\r
+                                               startOffset = endOffset = idx;\r
+                                       } else {\r
+                                               if (!keep) {\r
+                                                       idx = dom.nodeIndex(marker);\r
+                                               } else {\r
+                                                       node = marker.firstChild;\r
+                                                       idx = 1;\r
+                                               }\r
+\r
+                                               endContainer = node;\r
+                                               endOffset = idx;\r
+                                       }\r
+\r
+                                       if (!keep) {\r
+                                               prev = marker.previousSibling;\r
+                                               next = marker.nextSibling;\r
+\r
+                                               // Remove all marker text nodes\r
+                                               each(tinymce.grep(marker.childNodes), function(node) {\r
+                                                       if (node.nodeType == 3)\r
+                                                               node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');\r
+                                               });\r
+\r
+                                               // Remove marker but keep children if for example contents where inserted into the marker\r
+                                               // Also remove duplicated instances of the marker for example by a split operation or by WebKit auto split on paste feature\r
+                                               while (marker = dom.get(bookmark.id + '_' + suffix))\r
+                                                       dom.remove(marker, 1);\r
+\r
+                                               // If siblings are text nodes then merge them unless it's Opera since it some how removes the node\r
+                                               // and we are sniffing since adding a lot of detection code for a browser with 3% of the market isn't worth the effort. Sorry, Opera but it's just a fact\r
+                                               if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !tinymce.isOpera) {\r
+                                                       idx = prev.nodeValue.length;\r
+                                                       prev.appendData(next.nodeValue);\r
+                                                       dom.remove(next);\r
+\r
+                                                       if (suffix == 'start') {\r
+                                                               startContainer = endContainer = prev;\r
+                                                               startOffset = endOffset = idx;\r
+                                                       } else {\r
+                                                               endContainer = prev;\r
+                                                               endOffset = idx;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       function addBogus(node) {\r
+                               // Adds a bogus BR element for empty block elements\r
+                               if (dom.isBlock(node) && !node.innerHTML && !isIE)\r
+                                       node.innerHTML = '<br data-mce-bogus="1" />';\r
+\r
+                               return node;\r
+                       };\r
+\r
+                       if (bookmark) {\r
+                               if (bookmark.start) {\r
+                                       rng = dom.createRng();\r
+                                       root = dom.getRoot();\r
+\r
+                                       if (t.tridentSel)\r
+                                               return t.tridentSel.moveToBookmark(bookmark);\r
+\r
+                                       if (setEndPoint(true) && setEndPoint()) {\r
+                                               t.setRng(rng);\r
+                                       }\r
+                               } else if (bookmark.id) {\r
+                                       // Restore start/end points\r
+                                       restoreEndPoint('start');\r
+                                       restoreEndPoint('end');\r
+\r
+                                       if (startContainer) {\r
+                                               rng = dom.createRng();\r
+                                               rng.setStart(addBogus(startContainer), startOffset);\r
+                                               rng.setEnd(addBogus(endContainer), endOffset);\r
+                                               t.setRng(rng);\r
+                                       }\r
+                               } else if (bookmark.name) {\r
+                                       t.select(dom.select(bookmark.name)[bookmark.index]);\r
+                               } else if (bookmark.rng)\r
+                                       t.setRng(bookmark.rng);\r
+                       }\r
+               },\r
+\r
+               select : function(node, content) {\r
+                       var t = this, dom = t.dom, rng = dom.createRng(), idx;\r
+\r
+                       function setPoint(node, start) {\r
+                               var walker = new TreeWalker(node, node);\r
+\r
+                               do {\r
+                                       // Text node\r
+                                       if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length !== 0) {\r
+                                               if (start)\r
+                                                       rng.setStart(node, 0);\r
+                                               else\r
+                                                       rng.setEnd(node, node.nodeValue.length);\r
+\r
+                                               return;\r
+                                       }\r
+\r
+                                       // BR element\r
+                                       if (node.nodeName == 'BR') {\r
+                                               if (start)\r
+                                                       rng.setStartBefore(node);\r
+                                               else\r
+                                                       rng.setEndBefore(node);\r
+\r
+                                               return;\r
+                                       }\r
+                               } while (node = (start ? walker.next() : walker.prev()));\r
+                       };\r
+\r
+                       if (node) {\r
+                               idx = dom.nodeIndex(node);\r
+                               rng.setStart(node.parentNode, idx);\r
+                               rng.setEnd(node.parentNode, idx + 1);\r
+\r
+                               // Find first/last text node or BR element\r
+                               if (content) {\r
+                                       setPoint(node, 1);\r
+                                       setPoint(node);\r
+                               }\r
+\r
+                               t.setRng(rng);\r
+                       }\r
+\r
+                       return node;\r
+               },\r
+\r
+               isCollapsed : function() {\r
+                       var t = this, r = t.getRng(), s = t.getSel();\r
+\r
+                       if (!r || r.item)\r
+                               return false;\r
+\r
+                       if (r.compareEndPoints)\r
+                               return r.compareEndPoints('StartToEnd', r) === 0;\r
+\r
+                       return !s || r.collapsed;\r
+               },\r
+\r
+               collapse : function(to_start) {\r
+                       var self = this, rng = self.getRng(), node;\r
+\r
+                       // Control range on IE\r
+                       if (rng.item) {\r
+                               node = rng.item(0);\r
+                               rng = self.win.document.body.createTextRange();\r
+                               rng.moveToElementText(node);\r
+                       }\r
+\r
+                       rng.collapse(!!to_start);\r
+                       self.setRng(rng);\r
+               },\r
+\r
+               getSel : function() {\r
+                       var t = this, w = this.win;\r
+\r
+                       return w.getSelection ? w.getSelection() : w.document.selection;\r
+               },\r
+\r
+               getRng : function(w3c) {\r
+                       var self = this, selection, rng, elm, doc = self.win.document;\r
+\r
+                       // Found tridentSel object then we need to use that one\r
+                       if (w3c && self.tridentSel) {\r
+                               return self.tridentSel.getRangeAt(0);\r
+                       }\r
+\r
+                       try {\r
+                               if (selection = self.getSel()) {\r
+                                       rng = selection.rangeCount > 0 ? selection.getRangeAt(0) : (selection.createRange ? selection.createRange() : doc.createRange());\r
+                               }\r
+                       } catch (ex) {\r
+                               // IE throws unspecified error here if TinyMCE is placed in a frame/iframe\r
+                       }\r
+\r
+                       // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet\r
+                       if (tinymce.isIE && rng && rng.setStart && doc.selection.createRange().item) {\r
+                               elm = doc.selection.createRange().item(0);\r
+                               rng = doc.createRange();\r
+                               rng.setStartBefore(elm);\r
+                               rng.setEndAfter(elm);\r
+                       }\r
+\r
+                       // No range found then create an empty one\r
+                       // This can occur when the editor is placed in a hidden container element on Gecko\r
+                       // Or on IE when there was an exception\r
+                       if (!rng) {\r
+                               rng = doc.createRange ? doc.createRange() : doc.body.createTextRange();\r
+                       }\r
+\r
+                       // If range is at start of document then move it to start of body\r
+                       if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) {\r
+                               elm = self.dom.getRoot();\r
+                               rng.setStart(elm, 0);\r
+                               rng.setEnd(elm, 0);\r
+                       }\r
+\r
+                       if (self.selectedRange && self.explicitRange) {\r
+                               if (rng.compareBoundaryPoints(rng.START_TO_START, self.selectedRange) === 0 && rng.compareBoundaryPoints(rng.END_TO_END, self.selectedRange) === 0) {\r
+                                       // Safari, Opera and Chrome only ever select text which causes the range to change.\r
+                                       // This lets us use the originally set range if the selection hasn't been changed by the user.\r
+                                       rng = self.explicitRange;\r
+                               } else {\r
+                                       self.selectedRange = null;\r
+                                       self.explicitRange = null;\r
+                               }\r
+                       }\r
+\r
+                       return rng;\r
+               },\r
+\r
+               setRng : function(r, forward) {\r
+                       var s, t = this;\r
+\r
+                       if (!t.tridentSel) {\r
+                               s = t.getSel();\r
+\r
+                               if (s) {\r
+                                       t.explicitRange = r;\r
+\r
+                                       try {\r
+                                               s.removeAllRanges();\r
+                                       } catch (ex) {\r
+                                               // IE9 might throw errors here don't know why\r
+                                       }\r
+\r
+                                       s.addRange(r);\r
+\r
+                                       // Forward is set to false and we have an extend function\r
+                                       if (forward === false && s.extend) {\r
+                                               s.collapse(r.endContainer, r.endOffset);\r
+                                               s.extend(r.startContainer, r.startOffset);\r
+                                       }\r
+\r
+                                       // adding range isn't always successful so we need to check range count otherwise an exception can occur\r
+                                       t.selectedRange = s.rangeCount > 0 ? s.getRangeAt(0) : null;\r
+                               }\r
+                       } else {\r
+                               // Is W3C Range\r
+                               if (r.cloneRange) {\r
+                                       try {\r
+                                               t.tridentSel.addRange(r);\r
+                                               return;\r
+                                       } catch (ex) {\r
+                                               //IE9 throws an error here if called before selection is placed in the editor\r
+                                       }\r
+                               }\r
+\r
+                               // Is IE specific range\r
+                               try {\r
+                                       r.select();\r
+                               } catch (ex) {\r
+                                       // Needed for some odd IE bug #1843306\r
+                               }\r
+                       }\r
+               },\r
+\r
+               setNode : function(n) {\r
+                       var t = this;\r
+\r
+                       t.setContent(t.dom.getOuterHTML(n));\r
+\r
+                       return n;\r
+               },\r
+\r
+               getNode : function() {\r
+                       var t = this, rng = t.getRng(), sel = t.getSel(), elm, start = rng.startContainer, end = rng.endContainer;\r
+\r
+                       function skipEmptyTextNodes(n, forwards) {\r
+                               var orig = n;\r
+                               while (n && n.nodeType === 3 && n.length === 0) {\r
+                                       n = forwards ? n.nextSibling : n.previousSibling;\r
+                               }\r
+                               return n || orig;\r
+                       };\r
+\r
+                       // Range maybe lost after the editor is made visible again\r
+                       if (!rng)\r
+                               return t.dom.getRoot();\r
+\r
+                       if (rng.setStart) {\r
+                               elm = rng.commonAncestorContainer;\r
+\r
+                               // Handle selection a image or other control like element such as anchors\r
+                               if (!rng.collapsed) {\r
+                                       if (rng.startContainer == rng.endContainer) {\r
+                                               if (rng.endOffset - rng.startOffset < 2) {\r
+                                                       if (rng.startContainer.hasChildNodes())\r
+                                                               elm = rng.startContainer.childNodes[rng.startOffset];\r
+                                               }\r
+                                       }\r
+\r
+                                       // If the anchor node is a element instead of a text node then return this element\r
+                                       //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)\r
+                                       //      return sel.anchorNode.childNodes[sel.anchorOffset];\r
+\r
+                                       // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.\r
+                                       // This happens when you double click an underlined word in FireFox.\r
+                                       if (start.nodeType === 3 && end.nodeType === 3) {\r
+                                               if (start.length === rng.startOffset) {\r
+                                                       start = skipEmptyTextNodes(start.nextSibling, true);\r
+                                               } else {\r
+                                                       start = start.parentNode;\r
+                                               }\r
+                                               if (rng.endOffset === 0) {\r
+                                                       end = skipEmptyTextNodes(end.previousSibling, false);\r
+                                               } else {\r
+                                                       end = end.parentNode;\r
+                                               }\r
+\r
+                                               if (start && start === end)\r
+                                                       return start;\r
+                                       }\r
+                               }\r
+\r
+                               if (elm && elm.nodeType == 3)\r
+                                       return elm.parentNode;\r
+\r
+                               return elm;\r
+                       }\r
+\r
+                       return rng.item ? rng.item(0) : rng.parentElement();\r
+               },\r
+\r
+               getSelectedBlocks : function(st, en) {\r
+                       var t = this, dom = t.dom, sb, eb, n, bl = [];\r
+\r
+                       sb = dom.getParent(st || t.getStart(), dom.isBlock);\r
+                       eb = dom.getParent(en || t.getEnd(), dom.isBlock);\r
+\r
+                       if (sb)\r
+                               bl.push(sb);\r
+\r
+                       if (sb && eb && sb != eb) {\r
+                               n = sb;\r
+\r
+                               var walker = new TreeWalker(sb, dom.getRoot());\r
+                               while ((n = walker.next()) && n != eb) {\r
+                                       if (dom.isBlock(n))\r
+                                               bl.push(n);\r
+                               }\r
+                       }\r
+\r
+                       if (eb && sb != eb)\r
+                               bl.push(eb);\r
+\r
+                       return bl;\r
+               },\r
+\r
+               isForward: function(){\r
+                       var dom = this.dom, sel = this.getSel(), anchorRange, focusRange;\r
+\r
+                       // No support for selection direction then always return true\r
+                       if (!sel || sel.anchorNode == null || sel.focusNode == null) {\r
+                               return true;\r
+                       }\r
+\r
+                       anchorRange = dom.createRng();\r
+                       anchorRange.setStart(sel.anchorNode, sel.anchorOffset);\r
+                       anchorRange.collapse(true);\r
+\r
+                       focusRange = dom.createRng();\r
+                       focusRange.setStart(sel.focusNode, sel.focusOffset);\r
+                       focusRange.collapse(true);\r
+\r
+                       return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0;\r
+               },\r
+\r
+               normalize : function() {\r
+                       var self = this, rng, normalized, collapsed, node, sibling;\r
+\r
+                       function normalizeEndPoint(start) {\r
+                               var container, offset, walker, dom = self.dom, body = dom.getRoot(), node, nonEmptyElementsMap, nodeName;\r
+\r
+                               function hasBrBeforeAfter(node, left) {\r
+                                       var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body);\r
+\r
+                                       while (node = walker[left ? 'prev' : 'next']()) {\r
+                                               if (node.nodeName === "BR") {\r
+                                                       return true;\r
+                                               }\r
+                                       }\r
+                               };\r
+\r
+                               // Walks the dom left/right to find a suitable text node to move the endpoint into\r
+                               // It will only walk within the current parent block or body and will stop if it hits a block or a BR/IMG\r
+                               function findTextNodeRelative(left, startNode) {\r
+                                       var walker, lastInlineElement;\r
+\r
+                                       startNode = startNode || container;\r
+                                       walker = new TreeWalker(startNode, dom.getParent(startNode.parentNode, dom.isBlock) || body);\r
+\r
+                                       // Walk left until we hit a text node we can move to or a block/br/img\r
+                                       while (node = walker[left ? 'prev' : 'next']()) {\r
+                                               // Found text node that has a length\r
+                                               if (node.nodeType === 3 && node.nodeValue.length > 0) {\r
+                                                       container = node;\r
+                                                       offset = left ? node.nodeValue.length : 0;\r
+                                                       normalized = true;\r
+                                                       return;\r
+                                               }\r
+\r
+                                               // Break if we find a block or a BR/IMG/INPUT etc\r
+                                               if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\r
+                                                       return;\r
+                                               }\r
+\r
+                                               lastInlineElement = node;\r
+                                       }\r
+\r
+                                       // Only fetch the last inline element when in caret mode for now\r
+                                       if (collapsed && lastInlineElement) {\r
+                                               container = lastInlineElement;\r
+                                               normalized = true;\r
+                                               offset = 0;\r
+                                       }\r
+                               };\r
+\r
+                               container = rng[(start ? 'start' : 'end') + 'Container'];\r
+                               offset = rng[(start ? 'start' : 'end') + 'Offset'];\r
+                               nonEmptyElementsMap = dom.schema.getNonEmptyElements();\r
+\r
+                               // If the container is a document move it to the body element\r
+                               if (container.nodeType === 9) {\r
+                                       container = dom.getRoot();\r
+                                       offset = 0;\r
+                               }\r
+\r
+                               // If the container is body try move it into the closest text node or position\r
+                               if (container === body) {\r
+                                       // If start is before/after a image, table etc\r
+                                       if (start) {\r
+                                               node = container.childNodes[offset > 0 ? offset - 1 : 0];\r
+                                               if (node) {\r
+                                                       nodeName = node.nodeName.toLowerCase();\r
+                                                       if (nonEmptyElementsMap[node.nodeName] || node.nodeName == "TABLE") {\r
+                                                               return;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+\r
+                                       // Resolve the index\r
+                                       if (container.hasChildNodes()) {\r
+                                               container = container.childNodes[Math.min(!start && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1)];\r
+                                               offset = 0;\r
+\r
+                                               // Don't walk into elements that doesn't have any child nodes like a IMG\r
+                                               if (container.hasChildNodes() && !/TABLE/.test(container.nodeName)) {\r
+                                                       // Walk the DOM to find a text node to place the caret at or a BR\r
+                                                       node = container;\r
+                                                       walker = new TreeWalker(container, body);\r
+\r
+                                                       do {\r
+                                                               // Found a text node use that position\r
+                                                               if (node.nodeType === 3 && node.nodeValue.length > 0) {\r
+                                                                       offset = start ? 0 : node.nodeValue.length;\r
+                                                                       container = node;\r
+                                                                       normalized = true;\r
+                                                                       break;\r
+                                                               }\r
+\r
+                                                               // Found a BR/IMG element that we can place the caret before\r
+                                                               if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\r
+                                                                       offset = dom.nodeIndex(node);\r
+                                                                       container = node.parentNode;\r
+\r
+                                                                       // Put caret after image when moving the end point\r
+                                                                       if (node.nodeName ==  "IMG" && !start) {\r
+                                                                               offset++;\r
+                                                                       }\r
+\r
+                                                                       normalized = true;\r
+                                                                       break;\r
+                                                               }\r
+                                                       } while (node = (start ? walker.next() : walker.prev()));\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               // Lean the caret to the left if possible\r
+                               if (collapsed) {\r
+                                       // So this: <b>x</b><i>|x</i>\r
+                                       // Becomes: <b>x|</b><i>x</i>\r
+                                       // Seems that only gecko has issues with this\r
+                                       if (container.nodeType === 3 && offset === 0) {\r
+                                               findTextNodeRelative(true);\r
+                                       }\r
+\r
+                                       // Lean left into empty inline elements when the caret is before a BR\r
+                                       // So this: <i><b></b><i>|<br></i>\r
+                                       // Becomes: <i><b>|</b><i><br></i>\r
+                                       // Seems that only gecko has issues with this\r
+                                       if (container.nodeType === 1) {\r
+                                               node = container.childNodes[offset];\r
+                                               if(node && node.nodeName === 'BR' && !hasBrBeforeAfter(node) && !hasBrBeforeAfter(node, true)) {\r
+                                                       findTextNodeRelative(true, container.childNodes[offset]);\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               // Lean the start of the selection right if possible\r
+                               // So this: x[<b>x]</b>\r
+                               // Becomes: x<b>[x]</b>\r
+                               if (start && !collapsed && container.nodeType === 3 && offset === container.nodeValue.length) {\r
+                                       findTextNodeRelative(false);\r
+                               }\r
+\r
+                               // Set endpoint if it was normalized\r
+                               if (normalized)\r
+                                       rng['set' + (start ? 'Start' : 'End')](container, offset);\r
+                       };\r
+\r
+                       // Normalize only on non IE browsers for now\r
+                       if (tinymce.isIE)\r
+                               return;\r
+                       \r
+                       rng = self.getRng();\r
+                       collapsed = rng.collapsed;\r
+\r
+                       // Normalize the end points\r
+                       normalizeEndPoint(true);\r
+\r
+                       if (!collapsed)\r
+                               normalizeEndPoint();\r
+\r
+                       // Set the selection if it was normalized\r
+                       if (normalized) {\r
+                               // If it was collapsed then make sure it still is\r
+                               if (collapsed) {\r
+                                       rng.collapse(true);\r
+                               }\r
+\r
+                               //console.log(self.dom.dumpRng(rng));\r
+                               self.setRng(rng, self.isForward());\r
+                       }\r
+               },\r
+\r
+               selectorChanged: function(selector, callback) {\r
+                       var self = this, currentSelectors;\r
+\r
+                       if (!self.selectorChangedData) {\r
+                               self.selectorChangedData = {};\r
+                               currentSelectors = {};\r
+\r
+                               self.editor.onNodeChange.addToTop(function(ed, cm, node) {\r
+                                       var dom = self.dom, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {};\r
+\r
+                                       // Check for new matching selectors\r
+                                       each(self.selectorChangedData, function(callbacks, selector) {\r
+                                               each(parents, function(node) {\r
+                                                       if (dom.is(node, selector)) {\r
+                                                               if (!currentSelectors[selector]) {\r
+                                                                       // Execute callbacks\r
+                                                                       each(callbacks, function(callback) {\r
+                                                                               callback(true, {node: node, selector: selector, parents: parents});\r
+                                                                       });\r
+\r
+                                                                       currentSelectors[selector] = callbacks;\r
+                                                               }\r
+\r
+                                                               matchedSelectors[selector] = callbacks;\r
+                                                               return false;\r
+                                                       }\r
+                                               });\r
+                                       });\r
+\r
+                                       // Check if current selectors still match\r
+                                       each(currentSelectors, function(callbacks, selector) {\r
+                                               if (!matchedSelectors[selector]) {\r
+                                                       delete currentSelectors[selector];\r
+\r
+                                                       each(callbacks, function(callback) {\r
+                                                               callback(false, {node: node, selector: selector, parents: parents});\r
+                                                       });\r
+                                               }\r
+                                       });\r
+                               });\r
+                       }\r
+\r
+                       // Add selector listeners\r
+                       if (!self.selectorChangedData[selector]) {\r
+                               self.selectorChangedData[selector] = [];\r
+                       }\r
+\r
+                       self.selectorChangedData[selector].push(callback);\r
+\r
+                       return self;\r
+               },\r
+\r
+               destroy : function(manual) {\r
+                       var self = this;\r
+\r
+                       self.win = null;\r
+\r
+                       // Manual destroy then remove unload handler\r
+                       if (!manual)\r
+                               tinymce.removeUnload(self.destroy);\r
+               },\r
+\r
+               // IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode\r
+               _fixIESelection : function() {\r
+                       var dom = this.dom, doc = dom.doc, body = doc.body, started, startRng, htmlElm;\r
+\r
+                       // Return range from point or null if it failed\r
+                       function rngFromPoint(x, y) {\r
+                               var rng = body.createTextRange();\r
+\r
+                               try {\r
+                                       rng.moveToPoint(x, y);\r
+                               } catch (ex) {\r
+                                       // IE sometimes throws and exception, so lets just ignore it\r
+                                       rng = null;\r
+                               }\r
+\r
+                               return rng;\r
+                       };\r
+\r
+                       // Fires while the selection is changing\r
+                       function selectionChange(e) {\r
+                               var pointRng;\r
+\r
+                               // Check if the button is down or not\r
+                               if (e.button) {\r
+                                       // Create range from mouse position\r
+                                       pointRng = rngFromPoint(e.x, e.y);\r
+\r
+                                       if (pointRng) {\r
+                                               // Check if pointRange is before/after selection then change the endPoint\r
+                                               if (pointRng.compareEndPoints('StartToStart', startRng) > 0)\r
+                                                       pointRng.setEndPoint('StartToStart', startRng);\r
+                                               else\r
+                                                       pointRng.setEndPoint('EndToEnd', startRng);\r
+\r
+                                               pointRng.select();\r
+                                       }\r
+                               } else\r
+                                       endSelection();\r
+                       }\r
+\r
+                       // Removes listeners\r
+                       function endSelection() {\r
+                               var rng = doc.selection.createRange();\r
+\r
+                               // If the range is collapsed then use the last start range\r
+                               if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0)\r
+                                       startRng.select();\r
+\r
+                               dom.unbind(doc, 'mouseup', endSelection);\r
+                               dom.unbind(doc, 'mousemove', selectionChange);\r
+                               startRng = started = 0;\r
+                       };\r
+\r
+                       // Make HTML element unselectable since we are going to handle selection by hand\r
+                       doc.documentElement.unselectable = true;\r
+                       \r
+                       // Detect when user selects outside BODY\r
+                       dom.bind(doc, ['mousedown', 'contextmenu'], function(e) {\r
+                               if (e.target.nodeName === 'HTML') {\r
+                                       if (started)\r
+                                               endSelection();\r
+\r
+                                       // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\r
+                                       htmlElm = doc.documentElement;\r
+                                       if (htmlElm.scrollHeight > htmlElm.clientHeight)\r
+                                               return;\r
+\r
+                                       started = 1;\r
+                                       // Setup start position\r
+                                       startRng = rngFromPoint(e.x, e.y);\r
+                                       if (startRng) {\r
+                                               // Listen for selection change events\r
+                                               dom.bind(doc, 'mouseup', endSelection);\r
+                                               dom.bind(doc, 'mousemove', selectionChange);\r
+\r
+                                               dom.win.focus();\r
+                                               startRng.select();\r
+                                       }\r
+                               }\r
+                       });\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       tinymce.dom.Serializer = function(settings, dom, schema) {\r
+               var onPreProcess, onPostProcess, isIE = tinymce.isIE, each = tinymce.each, htmlParser;\r
+\r
+               // Support the old apply_source_formatting option\r
+               if (!settings.apply_source_formatting)\r
+                       settings.indent = false;\r
+\r
+               // Default DOM and Schema if they are undefined\r
+               dom = dom || tinymce.DOM;\r
+               schema = schema || new tinymce.html.Schema(settings);\r
+               settings.entity_encoding = settings.entity_encoding || 'named';\r
+               settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true;\r
+\r
+               onPreProcess = new tinymce.util.Dispatcher(self);\r
+\r
+               onPostProcess = new tinymce.util.Dispatcher(self);\r
+\r
+               htmlParser = new tinymce.html.DomParser(settings, schema);\r
+\r
+               // Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed\r
+               htmlParser.addAttributeFilter('src,href,style', function(nodes, name) {\r
+                       var i = nodes.length, node, value, internalName = 'data-mce-' + name, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef;\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+\r
+                               value = node.attributes.map[internalName];\r
+                               if (value !== undef) {\r
+                                       // Set external name to internal value and remove internal\r
+                                       node.attr(name, value.length > 0 ? value : null);\r
+                                       node.attr(internalName, null);\r
+                               } else {\r
+                                       // No internal attribute found then convert the value we have in the DOM\r
+                                       value = node.attributes.map[name];\r
+\r
+                                       if (name === "style")\r
+                                               value = dom.serializeStyle(dom.parseStyle(value), node.name);\r
+                                       else if (urlConverter)\r
+                                               value = urlConverter.call(urlConverterScope, value, name, node.name);\r
+\r
+                                       node.attr(name, value.length > 0 ? value : null);\r
+                               }\r
+                       }\r
+               });\r
+\r
+               // Remove internal classes mceItem<..> or mceSelected\r
+               htmlParser.addAttributeFilter('class', function(nodes, name) {\r
+                       var i = nodes.length, node, value;\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               value = node.attr('class').replace(/(?:^|\s)mce(Item\w+|Selected)(?!\S)/g, '');\r
+                               node.attr('class', value.length > 0 ? value : null);\r
+                       }\r
+               });\r
+\r
+               // Remove bookmark elements\r
+               htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) {\r
+                       var i = nodes.length, node;\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+\r
+                               if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup)\r
+                                       node.remove();\r
+                       }\r
+               });\r
+\r
+               // Remove expando attributes\r
+               htmlParser.addAttributeFilter('data-mce-expando', function(nodes, name, args) {\r
+                       var i = nodes.length;\r
+\r
+                       while (i--) {\r
+                               nodes[i].attr(name, null);\r
+                       }\r
+               });\r
+\r
+               // Force script into CDATA sections and remove the mce- prefix also add comments around styles\r
+               htmlParser.addNodeFilter('script,style', function(nodes, name) {\r
+                       var i = nodes.length, node, value;\r
+\r
+                       function trim(value) {\r
+                               return value.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n')\r
+                                               .replace(/^[\r\n]*|[\r\n]*$/g, '')\r
+                                               .replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi, '')\r
+                                               .replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, '');\r
+                       };\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               value = node.firstChild ? node.firstChild.value : '';\r
+\r
+                               if (name === "script") {\r
+                                       // Remove mce- prefix from script elements\r
+                                       node.attr('type', (node.attr('type') || 'text/javascript').replace(/^mce\-/, ''));\r
+\r
+                                       if (value.length > 0)\r
+                                               node.firstChild.value = '// <![CDATA[\n' + trim(value) + '\n// ]]>';\r
+                               } else {\r
+                                       if (value.length > 0)\r
+                                               node.firstChild.value = '<!--\n' + trim(value) + '\n-->';\r
+                               }\r
+                       }\r
+               });\r
+\r
+               // Convert comments to cdata and handle protected comments\r
+               htmlParser.addNodeFilter('#comment', function(nodes, name) {\r
+                       var i = nodes.length, node;\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+\r
+                               if (node.value.indexOf('[CDATA[') === 0) {\r
+                                       node.name = '#cdata';\r
+                                       node.type = 4;\r
+                                       node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, '');\r
+                               } else if (node.value.indexOf('mce:protected ') === 0) {\r
+                                       node.name = "#text";\r
+                                       node.type = 3;\r
+                                       node.raw = true;\r
+                                       node.value = unescape(node.value).substr(14);\r
+                               }\r
+                       }\r
+               });\r
+\r
+               htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) {\r
+                       var i = nodes.length, node;\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               if (node.type === 7)\r
+                                       node.remove();\r
+                               else if (node.type === 1) {\r
+                                       if (name === "input" && !("type" in node.attributes.map))\r
+                                               node.attr('type', 'text');\r
+                               }\r
+                       }\r
+               });\r
+\r
+               // Fix list elements, TODO: Replace this later\r
+               if (settings.fix_list_elements) {\r
+                       htmlParser.addNodeFilter('ul,ol', function(nodes, name) {\r
+                               var i = nodes.length, node, parentNode;\r
+\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       parentNode = node.parent;\r
+\r
+                                       if (parentNode.name === 'ul' || parentNode.name === 'ol') {\r
+                                               if (node.prev && node.prev.name === 'li') {\r
+                                                       node.prev.append(node);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       });\r
+               }\r
+\r
+               // Remove internal data attributes\r
+               htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style', function(nodes, name) {\r
+                       var i = nodes.length;\r
+\r
+                       while (i--) {\r
+                               nodes[i].attr(name, null);\r
+                       }\r
+               });\r
+\r
+               // Return public methods\r
+               return {\r
+                       schema : schema,\r
+\r
+                       addNodeFilter : htmlParser.addNodeFilter,\r
+\r
+                       addAttributeFilter : htmlParser.addAttributeFilter,\r
+\r
+                       onPreProcess : onPreProcess,\r
+\r
+                       onPostProcess : onPostProcess,\r
+\r
+                       serialize : function(node, args) {\r
+                               var impl, doc, oldDoc, htmlSerializer, content;\r
+\r
+                               // Explorer won't clone contents of script and style and the\r
+                               // selected index of select elements are cleared on a clone operation.\r
+                               if (isIE && dom.select('script,style,select,map').length > 0) {\r
+                                       content = node.innerHTML;\r
+                                       node = node.cloneNode(false);\r
+                                       dom.setHTML(node, content);\r
+                               } else\r
+                                       node = node.cloneNode(true);\r
+\r
+                               // Nodes needs to be attached to something in WebKit/Opera\r
+                               // Older builds of Opera crashes if you attach the node to an document created dynamically\r
+                               // and since we can't feature detect a crash we need to sniff the acutal build number\r
+                               // This fix will make DOM ranges and make Sizzle happy!\r
+                               impl = node.ownerDocument.implementation;\r
+                               if (impl.createHTMLDocument) {\r
+                                       // Create an empty HTML document\r
+                                       doc = impl.createHTMLDocument("");\r
+\r
+                                       // Add the element or it's children if it's a body element to the new document\r
+                                       each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) {\r
+                                               doc.body.appendChild(doc.importNode(node, true));\r
+                                       });\r
+\r
+                                       // Grab first child or body element for serialization\r
+                                       if (node.nodeName != 'BODY')\r
+                                               node = doc.body.firstChild;\r
+                                       else\r
+                                               node = doc.body;\r
+\r
+                                       // set the new document in DOMUtils so createElement etc works\r
+                                       oldDoc = dom.doc;\r
+                                       dom.doc = doc;\r
+                               }\r
+\r
+                               args = args || {};\r
+                               args.format = args.format || 'html';\r
+\r
+                               // Pre process\r
+                               if (!args.no_events) {\r
+                                       args.node = node;\r
+                                       onPreProcess.dispatch(self, args);\r
+                               }\r
+\r
+                               // Setup serializer\r
+                               htmlSerializer = new tinymce.html.Serializer(settings, schema);\r
+\r
+                               // Parse and serialize HTML\r
+                               args.content = htmlSerializer.serialize(\r
+                                       htmlParser.parse(tinymce.trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args)\r
+                               );\r
+\r
+                               // Replace all BOM characters for now until we can find a better solution\r
+                               if (!args.cleanup)\r
+                                       args.content = args.content.replace(/\uFEFF/g, '');\r
+\r
+                               // Post process\r
+                               if (!args.no_events)\r
+                                       onPostProcess.dispatch(self, args);\r
+\r
+                               // Restore the old document if it was changed\r
+                               if (oldDoc)\r
+                                       dom.doc = oldDoc;\r
+\r
+                               args.node = null;\r
+\r
+                               return args.content;\r
+                       },\r
+\r
+                       addRules : function(rules) {\r
+                               schema.addValidElements(rules);\r
+                       },\r
+\r
+                       setRules : function(rules) {\r
+                               schema.setValidElements(rules);\r
+                       }\r
+               };\r
+       };\r
+})(tinymce);\r
+(function(tinymce) {\r
+       tinymce.dom.ScriptLoader = function(settings) {\r
+               var QUEUED = 0,\r
+                       LOADING = 1,\r
+                       LOADED = 2,\r
+                       states = {},\r
+                       queue = [],\r
+                       scriptLoadedCallbacks = {},\r
+                       queueLoadedCallbacks = [],\r
+                       loading = 0,\r
+                       undef;\r
+\r
+               function loadScript(url, callback) {\r
+                       var t = this, dom = tinymce.DOM, elm, uri, loc, id;\r
+\r
+                       // Execute callback when script is loaded\r
+                       function done() {\r
+                               dom.remove(id);\r
+\r
+                               if (elm)\r
+                                       elm.onreadystatechange = elm.onload = elm = null;\r
+\r
+                               callback();\r
+                       };\r
+                       \r
+                       function error() {\r
+                               // Report the error so it's easier for people to spot loading errors\r
+                               if (typeof(console) !== "undefined" && console.log)\r
+                                       console.log("Failed to load: " + url);\r
+\r
+                               // We can't mark it as done if there is a load error since\r
+                               // A) We don't want to produce 404 errors on the server and\r
+                               // B) the onerror event won't fire on all browsers.\r
+                               // done();\r
+                       };\r
+\r
+                       id = dom.uniqueId();\r
+\r
+                       if (tinymce.isIE6) {\r
+                               uri = new tinymce.util.URI(url);\r
+                               loc = location;\r
+\r
+                               // If script is from same domain and we\r
+                               // use IE 6 then use XHR since it's more reliable\r
+                               if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol && uri.protocol.toLowerCase() != 'file') {\r
+                                       tinymce.util.XHR.send({\r
+                                               url : tinymce._addVer(uri.getURI()),\r
+                                               success : function(content) {\r
+                                                       // Create new temp script element\r
+                                                       var script = dom.create('script', {\r
+                                                               type : 'text/javascript'\r
+                                                       });\r
+\r
+                                                       // Evaluate script in global scope\r
+                                                       script.text = content;\r
+                                                       document.getElementsByTagName('head')[0].appendChild(script);\r
+                                                       dom.remove(script);\r
+\r
+                                                       done();\r
+                                               },\r
+                                               \r
+                                               error : error\r
+                                       });\r
+\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       // Create new script element\r
+                       elm = document.createElement('script');\r
+                       elm.id = id;\r
+                       elm.type = 'text/javascript';\r
+                       elm.src = tinymce._addVer(url);\r
+\r
+                       // Add onload listener for non IE browsers since IE9\r
+                       // fires onload event before the script is parsed and executed\r
+                       if (!tinymce.isIE)\r
+                               elm.onload = done;\r
+\r
+                       // Add onerror event will get fired on some browsers but not all of them\r
+                       elm.onerror = error;\r
+\r
+                       // Opera 9.60 doesn't seem to fire the onreadystate event at correctly\r
+                       if (!tinymce.isOpera) {\r
+                               elm.onreadystatechange = function() {\r
+                                       var state = elm.readyState;\r
+\r
+                                       // Loaded state is passed on IE 6 however there\r
+                                       // are known issues with this method but we can't use\r
+                                       // XHR in a cross domain loading\r
+                                       if (state == 'complete' || state == 'loaded')\r
+                                               done();\r
+                               };\r
+                       }\r
+\r
+                       // Most browsers support this feature so we report errors\r
+                       // for those at least to help users track their missing plugins etc\r
+                       // todo: Removed since it produced error if the document is unloaded by navigating away, re-add it as an option\r
+                       /*elm.onerror = function() {\r
+                               alert('Failed to load: ' + url);\r
+                       };*/\r
+\r
+                       // Add script to document\r
+                       (document.getElementsByTagName('head')[0] || document.body).appendChild(elm);\r
+               };\r
+\r
+               this.isDone = function(url) {\r
+                       return states[url] == LOADED;\r
+               };\r
+\r
+               this.markDone = function(url) {\r
+                       states[url] = LOADED;\r
+               };\r
+\r
+               this.add = this.load = function(url, callback, scope) {\r
+                       var item, state = states[url];\r
+\r
+                       // Add url to load queue\r
+                       if (state == undef) {\r
+                               queue.push(url);\r
+                               states[url] = QUEUED;\r
+                       }\r
+\r
+                       if (callback) {\r
+                               // Store away callback for later execution\r
+                               if (!scriptLoadedCallbacks[url])\r
+                                       scriptLoadedCallbacks[url] = [];\r
+\r
+                               scriptLoadedCallbacks[url].push({\r
+                                       func : callback,\r
+                                       scope : scope || this\r
+                               });\r
+                       }\r
+               };\r
+\r
+               this.loadQueue = function(callback, scope) {\r
+                       this.loadScripts(queue, callback, scope);\r
+               };\r
+\r
+               this.loadScripts = function(scripts, callback, scope) {\r
+                       var loadScripts;\r
+\r
+                       function execScriptLoadedCallbacks(url) {\r
+                               // Execute URL callback functions\r
+                               tinymce.each(scriptLoadedCallbacks[url], function(callback) {\r
+                                       callback.func.call(callback.scope);\r
+                               });\r
+\r
+                               scriptLoadedCallbacks[url] = undef;\r
+                       };\r
+\r
+                       queueLoadedCallbacks.push({\r
+                               func : callback,\r
+                               scope : scope || this\r
+                       });\r
+\r
+                       loadScripts = function() {\r
+                               var loadingScripts = tinymce.grep(scripts);\r
+\r
+                               // Current scripts has been handled\r
+                               scripts.length = 0;\r
+\r
+                               // Load scripts that needs to be loaded\r
+                               tinymce.each(loadingScripts, function(url) {\r
+                                       // Script is already loaded then execute script callbacks directly\r
+                                       if (states[url] == LOADED) {\r
+                                               execScriptLoadedCallbacks(url);\r
+                                               return;\r
+                                       }\r
+\r
+                                       // Is script not loading then start loading it\r
+                                       if (states[url] != LOADING) {\r
+                                               states[url] = LOADING;\r
+                                               loading++;\r
+\r
+                                               loadScript(url, function() {\r
+                                                       states[url] = LOADED;\r
+                                                       loading--;\r
+\r
+                                                       execScriptLoadedCallbacks(url);\r
+\r
+                                                       // Load more scripts if they where added by the recently loaded script\r
+                                                       loadScripts();\r
+                                               });\r
+                                       }\r
+                               });\r
+\r
+                               // No scripts are currently loading then execute all pending queue loaded callbacks\r
+                               if (!loading) {\r
+                                       tinymce.each(queueLoadedCallbacks, function(callback) {\r
+                                               callback.func.call(callback.scope);\r
+                                       });\r
+\r
+                                       queueLoadedCallbacks.length = 0;\r
+                               }\r
+                       };\r
+\r
+                       loadScripts();\r
+               };\r
+       };\r
+\r
+       // Global script loader\r
+       tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       tinymce.dom.RangeUtils = function(dom) {\r
+               var INVISIBLE_CHAR = '\uFEFF';\r
+\r
+               this.walk = function(rng, callback) {\r
+                       var startContainer = rng.startContainer,\r
+                               startOffset = rng.startOffset,\r
+                               endContainer = rng.endContainer,\r
+                               endOffset = rng.endOffset,\r
+                               ancestor, startPoint,\r
+                               endPoint, node, parent, siblings, nodes;\r
+\r
+                       // Handle table cell selection the table plugin enables\r
+                       // you to fake select table cells and perform formatting actions on them\r
+                       nodes = dom.select('td.mceSelected,th.mceSelected');\r
+                       if (nodes.length > 0) {\r
+                               tinymce.each(nodes, function(node) {\r
+                                       callback([node]);\r
+                               });\r
+\r
+                               return;\r
+                       }\r
+\r
+                       function exclude(nodes) {\r
+                               var node;\r
+\r
+                               // First node is excluded\r
+                               node = nodes[0];\r
+                               if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) {\r
+                                       nodes.splice(0, 1);\r
+                               }\r
+\r
+                               // Last node is excluded\r
+                               node = nodes[nodes.length - 1];\r
+                               if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) {\r
+                                       nodes.splice(nodes.length - 1, 1);\r
+                               }\r
+\r
+                               return nodes;\r
+                       };\r
+\r
+                       function collectSiblings(node, name, end_node) {\r
+                               var siblings = [];\r
+\r
+                               for (; node && node != end_node; node = node[name])\r
+                                       siblings.push(node);\r
+\r
+                               return siblings;\r
+                       };\r
+\r
+                       function findEndPoint(node, root) {\r
+                               do {\r
+                                       if (node.parentNode == root)\r
+                                               return node;\r
+\r
+                                       node = node.parentNode;\r
+                               } while(node);\r
+                       };\r
+\r
+                       function walkBoundary(start_node, end_node, next) {\r
+                               var siblingName = next ? 'nextSibling' : 'previousSibling';\r
+\r
+                               for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) {\r
+                                       parent = node.parentNode;\r
+                                       siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName);\r
+\r
+                                       if (siblings.length) {\r
+                                               if (!next)\r
+                                                       siblings.reverse();\r
+\r
+                                               callback(exclude(siblings));\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       // If index based start position then resolve it\r
+                       if (startContainer.nodeType == 1 && startContainer.hasChildNodes())\r
+                               startContainer = startContainer.childNodes[startOffset];\r
+\r
+                       // If index based end position then resolve it\r
+                       if (endContainer.nodeType == 1 && endContainer.hasChildNodes())\r
+                               endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)];\r
+\r
+                       // Same container\r
+                       if (startContainer == endContainer)\r
+                               return callback(exclude([startContainer]));\r
+\r
+                       // Find common ancestor and end points\r
+                       ancestor = dom.findCommonAncestor(startContainer, endContainer);\r
+                               \r
+                       // Process left side\r
+                       for (node = startContainer; node; node = node.parentNode) {\r
+                               if (node === endContainer)\r
+                                       return walkBoundary(startContainer, ancestor, true);\r
+\r
+                               if (node === ancestor)\r
+                                       break;\r
+                       }\r
+\r
+                       // Process right side\r
+                       for (node = endContainer; node; node = node.parentNode) {\r
+                               if (node === startContainer)\r
+                                       return walkBoundary(endContainer, ancestor);\r
+\r
+                               if (node === ancestor)\r
+                                       break;\r
+                       }\r
+\r
+                       // Find start/end point\r
+                       startPoint = findEndPoint(startContainer, ancestor) || startContainer;\r
+                       endPoint = findEndPoint(endContainer, ancestor) || endContainer;\r
+\r
+                       // Walk left leaf\r
+                       walkBoundary(startContainer, startPoint, true);\r
+\r
+                       // Walk the middle from start to end point\r
+                       siblings = collectSiblings(\r
+                               startPoint == startContainer ? startPoint : startPoint.nextSibling,\r
+                               'nextSibling',\r
+                               endPoint == endContainer ? endPoint.nextSibling : endPoint\r
+                       );\r
+\r
+                       if (siblings.length)\r
+                               callback(exclude(siblings));\r
+\r
+                       // Walk right leaf\r
+                       walkBoundary(endContainer, endPoint);\r
+               };\r
+\r
+               this.split = function(rng) {\r
+                       var startContainer = rng.startContainer,\r
+                               startOffset = rng.startOffset,\r
+                               endContainer = rng.endContainer,\r
+                               endOffset = rng.endOffset;\r
+\r
+                       function splitText(node, offset) {\r
+                               return node.splitText(offset);\r
+                       };\r
+\r
+                       // Handle single text node\r
+                       if (startContainer == endContainer && startContainer.nodeType == 3) {\r
+                               if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {\r
+                                       endContainer = splitText(startContainer, startOffset);\r
+                                       startContainer = endContainer.previousSibling;\r
+\r
+                                       if (endOffset > startOffset) {\r
+                                               endOffset = endOffset - startOffset;\r
+                                               startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;\r
+                                               endOffset = endContainer.nodeValue.length;\r
+                                               startOffset = 0;\r
+                                       } else {\r
+                                               endOffset = 0;\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               // Split startContainer text node if needed\r
+                               if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) {\r
+                                       startContainer = splitText(startContainer, startOffset);\r
+                                       startOffset = 0;\r
+                               }\r
+\r
+                               // Split endContainer text node if needed\r
+                               if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) {\r
+                                       endContainer = splitText(endContainer, endOffset).previousSibling;\r
+                                       endOffset = endContainer.nodeValue.length;\r
+                               }\r
+                       }\r
+\r
+                       return {\r
+                               startContainer : startContainer,\r
+                               startOffset : startOffset,\r
+                               endContainer : endContainer,\r
+                               endOffset : endOffset\r
+                       };\r
+               };\r
+\r
+       };\r
+\r
+       tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) {\r
+               if (rng1 && rng2) {\r
+                       // Compare native IE ranges\r
+                       if (rng1.item || rng1.duplicate) {\r
+                               // Both are control ranges and the selected element matches\r
+                               if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0))\r
+                                       return true;\r
+\r
+                               // Both are text ranges and the range matches\r
+                               if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))\r
+                                       return true;\r
+                       } else {\r
+                               // Compare w3c ranges\r
+                               return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;\r
+                       }\r
+               }\r
+\r
+               return false;\r
+       };\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Event = tinymce.dom.Event, each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.ui.KeyboardNavigation', {\r
+               KeyboardNavigation: function(settings, dom) {\r
+                       var t = this, root = settings.root, items = settings.items,\r
+                                       enableUpDown = settings.enableUpDown, enableLeftRight = settings.enableLeftRight || !settings.enableUpDown,\r
+                                       excludeFromTabOrder = settings.excludeFromTabOrder,\r
+                                       itemFocussed, itemBlurred, rootKeydown, rootFocussed, focussedId;\r
+\r
+                       dom = dom || tinymce.DOM;\r
+\r
+                       itemFocussed = function(evt) {\r
+                               focussedId = evt.target.id;\r
+                       };\r
+                       \r
+                       itemBlurred = function(evt) {\r
+                               dom.setAttrib(evt.target.id, 'tabindex', '-1');\r
+                       };\r
+                       \r
+                       rootFocussed = function(evt) {\r
+                               var item = dom.get(focussedId);\r
+                               dom.setAttrib(item, 'tabindex', '0');\r
+                               item.focus();\r
+                       };\r
+                       \r
+                       t.focus = function() {\r
+                               dom.get(focussedId).focus();\r
+                       };\r
+\r
+                       t.destroy = function() {\r
+                               each(items, function(item) {\r
+                                       var elm = dom.get(item.id);\r
+\r
+                                       dom.unbind(elm, 'focus', itemFocussed);\r
+                                       dom.unbind(elm, 'blur', itemBlurred);\r
+                               });\r
+\r
+                               var rootElm = dom.get(root);\r
+                               dom.unbind(rootElm, 'focus', rootFocussed);\r
+                               dom.unbind(rootElm, 'keydown', rootKeydown);\r
+\r
+                               items = dom = root = t.focus = itemFocussed = itemBlurred = rootKeydown = rootFocussed = null;\r
+                               t.destroy = function() {};\r
+                       };\r
+                       \r
+                       t.moveFocus = function(dir, evt) {\r
+                               var idx = -1, controls = t.controls, newFocus;\r
+\r
+                               if (!focussedId)\r
+                                       return;\r
+\r
+                               each(items, function(item, index) {\r
+                                       if (item.id === focussedId) {\r
+                                               idx = index;\r
+                                               return false;\r
+                                       }\r
+                               });\r
+\r
+                               idx += dir;\r
+                               if (idx < 0) {\r
+                                       idx = items.length - 1;\r
+                               } else if (idx >= items.length) {\r
+                                       idx = 0;\r
+                               }\r
+                               \r
+                               newFocus = items[idx];\r
+                               dom.setAttrib(focussedId, 'tabindex', '-1');\r
+                               dom.setAttrib(newFocus.id, 'tabindex', '0');\r
+                               dom.get(newFocus.id).focus();\r
+\r
+                               if (settings.actOnFocus) {\r
+                                       settings.onAction(newFocus.id);\r
+                               }\r
+\r
+                               if (evt)\r
+                                       Event.cancel(evt);\r
+                       };\r
+                       \r
+                       rootKeydown = function(evt) {\r
+                               var DOM_VK_LEFT = 37, DOM_VK_RIGHT = 39, DOM_VK_UP = 38, DOM_VK_DOWN = 40, DOM_VK_ESCAPE = 27, DOM_VK_ENTER = 14, DOM_VK_RETURN = 13, DOM_VK_SPACE = 32;\r
+                               \r
+                               switch (evt.keyCode) {\r
+                                       case DOM_VK_LEFT:\r
+                                               if (enableLeftRight) t.moveFocus(-1);\r
+                                               break;\r
+       \r
+                                       case DOM_VK_RIGHT:\r
+                                               if (enableLeftRight) t.moveFocus(1);\r
+                                               break;\r
+       \r
+                                       case DOM_VK_UP:\r
+                                               if (enableUpDown) t.moveFocus(-1);\r
+                                               break;\r
+\r
+                                       case DOM_VK_DOWN:\r
+                                               if (enableUpDown) t.moveFocus(1);\r
+                                               break;\r
+\r
+                                       case DOM_VK_ESCAPE:\r
+                                               if (settings.onCancel) {\r
+                                                       settings.onCancel();\r
+                                                       Event.cancel(evt);\r
+                                               }\r
+                                               break;\r
+\r
+                                       case DOM_VK_ENTER:\r
+                                       case DOM_VK_RETURN:\r
+                                       case DOM_VK_SPACE:\r
+                                               if (settings.onAction) {\r
+                                                       settings.onAction(focussedId);\r
+                                                       Event.cancel(evt);\r
+                                               }\r
+                                               break;\r
+                               }\r
+                       };\r
+\r
+                       // Set up state and listeners for each item.\r
+                       each(items, function(item, idx) {\r
+                               var tabindex, elm;\r
+\r
+                               if (!item.id) {\r
+                                       item.id = dom.uniqueId('_mce_item_');\r
+                               }\r
+\r
+                               elm = dom.get(item.id);\r
+\r
+                               if (excludeFromTabOrder) {\r
+                                       dom.bind(elm, 'blur', itemBlurred);\r
+                                       tabindex = '-1';\r
+                               } else {\r
+                                       tabindex = (idx === 0 ? '0' : '-1');\r
+                               }\r
+\r
+                               elm.setAttribute('tabindex', tabindex);\r
+                               dom.bind(elm, 'focus', itemFocussed);\r
+                       });\r
+                       \r
+                       // Setup initial state for root element.\r
+                       if (items[0]){\r
+                               focussedId = items[0].id;\r
+                       }\r
+\r
+                       dom.setAttrib(root, 'tabindex', '-1');\r
+\r
+                       // Setup listeners for root element.\r
+                       var rootElm = dom.get(root);\r
+                       dom.bind(rootElm, 'focus', rootFocussed);\r
+                       dom.bind(rootElm, 'keydown', rootKeydown);\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       // Shorten class names\r
+       var DOM = tinymce.DOM, is = tinymce.is;\r
+\r
+       tinymce.create('tinymce.ui.Control', {\r
+               Control : function(id, s, editor) {\r
+                       this.id = id;\r
+                       this.settings = s = s || {};\r
+                       this.rendered = false;\r
+                       this.onRender = new tinymce.util.Dispatcher(this);\r
+                       this.classPrefix = '';\r
+                       this.scope = s.scope || this;\r
+                       this.disabled = 0;\r
+                       this.active = 0;\r
+                       this.editor = editor;\r
+               },\r
+               \r
+               setAriaProperty : function(property, value) {\r
+                       var element = DOM.get(this.id + '_aria') || DOM.get(this.id);\r
+                       if (element) {\r
+                               DOM.setAttrib(element, 'aria-' + property, !!value);\r
+                       }\r
+               },\r
+               \r
+               focus : function() {\r
+                       DOM.get(this.id).focus();\r
+               },\r
+\r
+               setDisabled : function(s) {\r
+                       if (s != this.disabled) {\r
+                               this.setAriaProperty('disabled', s);\r
+\r
+                               this.setState('Disabled', s);\r
+                               this.setState('Enabled', !s);\r
+                               this.disabled = s;\r
+                       }\r
+               },\r
+\r
+               isDisabled : function() {\r
+                       return this.disabled;\r
+               },\r
+\r
+               setActive : function(s) {\r
+                       if (s != this.active) {\r
+                               this.setState('Active', s);\r
+                               this.active = s;\r
+                               this.setAriaProperty('pressed', s);\r
+                       }\r
+               },\r
+\r
+               isActive : function() {\r
+                       return this.active;\r
+               },\r
+\r
+               setState : function(c, s) {\r
+                       var n = DOM.get(this.id);\r
+\r
+                       c = this.classPrefix + c;\r
+\r
+                       if (s)\r
+                               DOM.addClass(n, c);\r
+                       else\r
+                               DOM.removeClass(n, c);\r
+               },\r
+\r
+               isRendered : function() {\r
+                       return this.rendered;\r
+               },\r
+\r
+               renderHTML : function() {\r
+               },\r
+\r
+               renderTo : function(n) {\r
+                       DOM.setHTML(n, this.renderHTML());\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, b;\r
+\r
+                       // Set pending states\r
+                       if (is(t.disabled)) {\r
+                               b = t.disabled;\r
+                               t.disabled = -1;\r
+                               t.setDisabled(b);\r
+                       }\r
+\r
+                       if (is(t.active)) {\r
+                               b = t.active;\r
+                               t.active = -1;\r
+                               t.setActive(b);\r
+                       }\r
+               },\r
+\r
+               remove : function() {\r
+                       DOM.remove(this.id);\r
+                       this.destroy();\r
+               },\r
+\r
+               destroy : function() {\r
+                       tinymce.dom.Event.clear(this.id);\r
+               }\r
+       });\r
+})(tinymce);\r
+tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {\r
+       Container : function(id, s, editor) {\r
+               this.parent(id, s, editor);\r
+\r
+               this.controls = [];\r
+\r
+               this.lookup = {};\r
+       },\r
+\r
+       add : function(c) {\r
+               this.lookup[c.id] = c;\r
+               this.controls.push(c);\r
+\r
+               return c;\r
+       },\r
+\r
+       get : function(n) {\r
+               return this.lookup[n];\r
+       }\r
+});\r
+\r
+\r
+tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {\r
+       Separator : function(id, s) {\r
+               this.parent(id, s);\r
+               this.classPrefix = 'mceSeparator';\r
+               this.setDisabled(true);\r
+       },\r
+\r
+       renderHTML : function() {\r
+               return tinymce.DOM.createHTML('span', {'class' : this.classPrefix, role : 'separator', 'aria-orientation' : 'vertical', tabindex : '-1'});\r
+       }\r
+});\r
+\r
+(function(tinymce) {\r
+       var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;\r
+\r
+       tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control', {\r
+               MenuItem : function(id, s) {\r
+                       this.parent(id, s);\r
+                       this.classPrefix = 'mceMenuItem';\r
+               },\r
+\r
+               setSelected : function(s) {\r
+                       this.setState('Selected', s);\r
+                       this.setAriaProperty('checked', !!s);\r
+                       this.selected = s;\r
+               },\r
+\r
+               isSelected : function() {\r
+                       return this.selected;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this;\r
+                       \r
+                       t.parent();\r
+\r
+                       // Set pending state\r
+                       if (is(t.selected))\r
+                               t.setSelected(t.selected);\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;\r
+\r
+       tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem', {\r
+               Menu : function(id, s) {\r
+                       var t = this;\r
+\r
+                       t.parent(id, s);\r
+                       t.items = {};\r
+                       t.collapsed = false;\r
+                       t.menuCount = 0;\r
+                       t.onAddItem = new tinymce.util.Dispatcher(this);\r
+               },\r
+\r
+               expand : function(d) {\r
+                       var t = this;\r
+\r
+                       if (d) {\r
+                               walk(t, function(o) {\r
+                                       if (o.expand)\r
+                                               o.expand();\r
+                               }, 'items', t);\r
+                       }\r
+\r
+                       t.collapsed = false;\r
+               },\r
+\r
+               collapse : function(d) {\r
+                       var t = this;\r
+\r
+                       if (d) {\r
+                               walk(t, function(o) {\r
+                                       if (o.collapse)\r
+                                               o.collapse();\r
+                               }, 'items', t);\r
+                       }\r
+\r
+                       t.collapsed = true;\r
+               },\r
+\r
+               isCollapsed : function() {\r
+                       return this.collapsed;\r
+               },\r
+\r
+               add : function(o) {\r
+                       if (!o.settings)\r
+                               o = new tinymce.ui.MenuItem(o.id || DOM.uniqueId(), o);\r
+\r
+                       this.onAddItem.dispatch(this, o);\r
+\r
+                       return this.items[o.id] = o;\r
+               },\r
+\r
+               addSeparator : function() {\r
+                       return this.add({separator : true});\r
+               },\r
+\r
+               addMenu : function(o) {\r
+                       if (!o.collapse)\r
+                               o = this.createMenu(o);\r
+\r
+                       this.menuCount++;\r
+\r
+                       return this.add(o);\r
+               },\r
+\r
+               hasMenus : function() {\r
+                       return this.menuCount !== 0;\r
+               },\r
+\r
+               remove : function(o) {\r
+                       delete this.items[o.id];\r
+               },\r
+\r
+               removeAll : function() {\r
+                       var t = this;\r
+\r
+                       walk(t, function(o) {\r
+                               if (o.removeAll)\r
+                                       o.removeAll();\r
+                               else\r
+                                       o.remove();\r
+\r
+                               o.destroy();\r
+                       }, 'items', t);\r
+\r
+                       t.items = {};\r
+               },\r
+\r
+               createMenu : function(o) {\r
+                       var m = new tinymce.ui.Menu(o.id || DOM.uniqueId(), o);\r
+\r
+                       m.onAddItem.add(this.onAddItem.dispatch, this.onAddItem);\r
+\r
+                       return m;\r
+               }\r
+       });\r
+})(tinymce);\r
+(function(tinymce) {\r
+       var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;\r
+\r
+       tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', {\r
+               DropMenu : function(id, s) {\r
+                       s = s || {};\r
+                       s.container = s.container || DOM.doc.body;\r
+                       s.offset_x = s.offset_x || 0;\r
+                       s.offset_y = s.offset_y || 0;\r
+                       s.vp_offset_x = s.vp_offset_x || 0;\r
+                       s.vp_offset_y = s.vp_offset_y || 0;\r
+\r
+                       if (is(s.icons) && !s.icons)\r
+                               s['class'] += ' mceNoIcons';\r
+\r
+                       this.parent(id, s);\r
+                       this.onShowMenu = new tinymce.util.Dispatcher(this);\r
+                       this.onHideMenu = new tinymce.util.Dispatcher(this);\r
+                       this.classPrefix = 'mceMenu';\r
+               },\r
+\r
+               createMenu : function(s) {\r
+                       var t = this, cs = t.settings, m;\r
+\r
+                       s.container = s.container || cs.container;\r
+                       s.parent = t;\r
+                       s.constrain = s.constrain || cs.constrain;\r
+                       s['class'] = s['class'] || cs['class'];\r
+                       s.vp_offset_x = s.vp_offset_x || cs.vp_offset_x;\r
+                       s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y;\r
+                       s.keyboard_focus = cs.keyboard_focus;\r
+                       m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s);\r
+\r
+                       m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem);\r
+\r
+                       return m;\r
+               },\r
+               \r
+               focus : function() {\r
+                       var t = this;\r
+                       if (t.keyboardNav) {\r
+                               t.keyboardNav.focus();\r
+                       }\r
+               },\r
+\r
+               update : function() {\r
+                       var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th;\r
+\r
+                       tw = s.max_width ? Math.min(tb.offsetWidth, s.max_width) : tb.offsetWidth;\r
+                       th = s.max_height ? Math.min(tb.offsetHeight, s.max_height) : tb.offsetHeight;\r
+\r
+                       if (!DOM.boxModel)\r
+                               t.element.setStyles({width : tw + 2, height : th + 2});\r
+                       else\r
+                               t.element.setStyles({width : tw, height : th});\r
+\r
+                       if (s.max_width)\r
+                               DOM.setStyle(co, 'width', tw);\r
+\r
+                       if (s.max_height) {\r
+                               DOM.setStyle(co, 'height', th);\r
+\r
+                               if (tb.clientHeight < s.max_height)\r
+                                       DOM.setStyle(co, 'overflow', 'hidden');\r
+                       }\r
+               },\r
+\r
+               showMenu : function(x, y, px) {\r
+                       var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb, cp = t.classPrefix;\r
+\r
+                       t.collapse(1);\r
+\r
+                       if (t.isMenuVisible)\r
+                               return;\r
+\r
+                       if (!t.rendered) {\r
+                               co = DOM.add(t.settings.container, t.renderNode());\r
+\r
+                               each(t.items, function(o) {\r
+                                       o.postRender();\r
+                               });\r
+\r
+                               t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});\r
+                       } else\r
+                               co = DOM.get('menu_' + t.id);\r
+\r
+                       // Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug\r
+                       if (!tinymce.isOpera)\r
+                               DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF});\r
+\r
+                       DOM.show(co);\r
+                       t.update();\r
+\r
+                       x += s.offset_x || 0;\r
+                       y += s.offset_y || 0;\r
+                       vp.w -= 4;\r
+                       vp.h -= 4;\r
+\r
+                       // Move inside viewport if not submenu\r
+                       if (s.constrain) {\r
+                               w = co.clientWidth - ot;\r
+                               h = co.clientHeight - ot;\r
+                               mx = vp.x + vp.w;\r
+                               my = vp.y + vp.h;\r
+\r
+                               if ((x + s.vp_offset_x + w) > mx)\r
+                                       x = px ? px - w : Math.max(0, (mx - s.vp_offset_x) - w);\r
+\r
+                               if ((y + s.vp_offset_y + h) > my)\r
+                                       y = Math.max(0, (my - s.vp_offset_y) - h);\r
+                       }\r
+\r
+                       DOM.setStyles(co, {left : x , top : y});\r
+                       t.element.update();\r
+\r
+                       t.isMenuVisible = 1;\r
+                       t.mouseClickFunc = Event.add(co, 'click', function(e) {\r
+                               var m;\r
+\r
+                               e = e.target;\r
+\r
+                               if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) {\r
+                                       m = t.items[e.id];\r
+\r
+                                       if (m.isDisabled())\r
+                                               return;\r
+\r
+                                       dm = t;\r
+\r
+                                       while (dm) {\r
+                                               if (dm.hideMenu)\r
+                                                       dm.hideMenu();\r
+\r
+                                               dm = dm.settings.parent;\r
+                                       }\r
+\r
+                                       if (m.settings.onclick)\r
+                                               m.settings.onclick(e);\r
+\r
+                                       return false; // Cancel to fix onbeforeunload problem\r
+                               }\r
+                       });\r
+\r
+                       if (t.hasMenus()) {\r
+                               t.mouseOverFunc = Event.add(co, 'mouseover', function(e) {\r
+                                       var m, r, mi;\r
+\r
+                                       e = e.target;\r
+                                       if (e && (e = DOM.getParent(e, 'tr'))) {\r
+                                               m = t.items[e.id];\r
+\r
+                                               if (t.lastMenu)\r
+                                                       t.lastMenu.collapse(1);\r
+\r
+                                               if (m.isDisabled())\r
+                                                       return;\r
+\r
+                                               if (e && DOM.hasClass(e, cp + 'ItemSub')) {\r
+                                                       //p = DOM.getPos(s.container);\r
+                                                       r = DOM.getRect(e);\r
+                                                       m.showMenu((r.x + r.w - ot), r.y - ot, r.x);\r
+                                                       t.lastMenu = m;\r
+                                                       DOM.addClass(DOM.get(m.id).firstChild, cp + 'ItemActive');\r
+                                               }\r
+                                       }\r
+                               });\r
+                       }\r
+                       \r
+                       Event.add(co, 'keydown', t._keyHandler, t);\r
+\r
+                       t.onShowMenu.dispatch(t);\r
+\r
+                       if (s.keyboard_focus) { \r
+                               t._setupKeyboardNav(); \r
+                       }\r
+               },\r
+\r
+               hideMenu : function(c) {\r
+                       var t = this, co = DOM.get('menu_' + t.id), e;\r
+\r
+                       if (!t.isMenuVisible)\r
+                               return;\r
+\r
+                       if (t.keyboardNav) t.keyboardNav.destroy();\r
+                       Event.remove(co, 'mouseover', t.mouseOverFunc);\r
+                       Event.remove(co, 'click', t.mouseClickFunc);\r
+                       Event.remove(co, 'keydown', t._keyHandler);\r
+                       DOM.hide(co);\r
+                       t.isMenuVisible = 0;\r
+\r
+                       if (!c)\r
+                               t.collapse(1);\r
+\r
+                       if (t.element)\r
+                               t.element.hide();\r
+\r
+                       if (e = DOM.get(t.id))\r
+                               DOM.removeClass(e.firstChild, t.classPrefix + 'ItemActive');\r
+\r
+                       t.onHideMenu.dispatch(t);\r
+               },\r
+\r
+               add : function(o) {\r
+                       var t = this, co;\r
+\r
+                       o = t.parent(o);\r
+\r
+                       if (t.isRendered && (co = DOM.get('menu_' + t.id)))\r
+                               t._add(DOM.select('tbody', co)[0], o);\r
+\r
+                       return o;\r
+               },\r
+\r
+               collapse : function(d) {\r
+                       this.parent(d);\r
+                       this.hideMenu(1);\r
+               },\r
+\r
+               remove : function(o) {\r
+                       DOM.remove(o.id);\r
+                       this.destroy();\r
+\r
+                       return this.parent(o);\r
+               },\r
+\r
+               destroy : function() {\r
+                       var t = this, co = DOM.get('menu_' + t.id);\r
+\r
+                       if (t.keyboardNav) t.keyboardNav.destroy();\r
+                       Event.remove(co, 'mouseover', t.mouseOverFunc);\r
+                       Event.remove(DOM.select('a', co), 'focus', t.mouseOverFunc);\r
+                       Event.remove(co, 'click', t.mouseClickFunc);\r
+                       Event.remove(co, 'keydown', t._keyHandler);\r
+\r
+                       if (t.element)\r
+                               t.element.remove();\r
+\r
+                       DOM.remove(co);\r
+               },\r
+\r
+               renderNode : function() {\r
+                       var t = this, s = t.settings, n, tb, co, w;\r
+\r
+                       w = DOM.create('div', {role: 'listbox', id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000;outline:0'});\r
+                       if (t.settings.parent) {\r
+                               DOM.setAttrib(w, 'aria-parent', 'menu_' + t.settings.parent.id);\r
+                       }\r
+                       co = DOM.add(w, 'div', {role: 'presentation', id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')});\r
+                       t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});\r
+\r
+                       if (s.menu_line)\r
+                               DOM.add(co, 'span', {'class' : t.classPrefix + 'Line'});\r
+\r
+//                     n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'});\r
+                       n = DOM.add(co, 'table', {role: 'presentation', id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0});\r
+                       tb = DOM.add(n, 'tbody');\r
+\r
+                       each(t.items, function(o) {\r
+                               t._add(tb, o);\r
+                       });\r
+\r
+                       t.rendered = true;\r
+\r
+                       return w;\r
+               },\r
+\r
+               // Internal functions\r
+               _setupKeyboardNav : function(){\r
+                       var contextMenu, menuItems, t=this; \r
+                       contextMenu = DOM.get('menu_' + t.id);\r
+                       menuItems = DOM.select('a[role=option]', 'menu_' + t.id);\r
+                       menuItems.splice(0,0,contextMenu);\r
+                       t.keyboardNav = new tinymce.ui.KeyboardNavigation({\r
+                               root: 'menu_' + t.id,\r
+                               items: menuItems,\r
+                               onCancel: function() {\r
+                                       t.hideMenu();\r
+                               },\r
+                               enableUpDown: true\r
+                       });\r
+                       contextMenu.focus();\r
+               },\r
+\r
+               _keyHandler : function(evt) {\r
+                       var t = this, e;\r
+                       switch (evt.keyCode) {\r
+                               case 37: // Left\r
+                                       if (t.settings.parent) {\r
+                                               t.hideMenu();\r
+                                               t.settings.parent.focus();\r
+                                               Event.cancel(evt);\r
+                                       }\r
+                                       break;\r
+                               case 39: // Right\r
+                                       if (t.mouseOverFunc)\r
+                                               t.mouseOverFunc(evt);\r
+                                       break;\r
+                       }\r
+               },\r
+\r
+               _add : function(tb, o) {\r
+                       var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;\r
+\r
+                       if (s.separator) {\r
+                               ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});\r
+                               DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});\r
+\r
+                               if (n = ro.previousSibling)\r
+                                       DOM.addClass(n, 'mceLast');\r
+\r
+                               return;\r
+                       }\r
+\r
+                       n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'});\r
+                       n = it = DOM.add(n, s.titleItem ? 'th' : 'td');\r
+                       n = a = DOM.add(n, 'a', {id: o.id + '_aria',  role: s.titleItem ? 'presentation' : 'option', href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});\r
+\r
+                       if (s.parent) {\r
+                               DOM.setAttrib(a, 'aria-haspopup', 'true');\r
+                               DOM.setAttrib(a, 'aria-owns', 'menu_' + o.id);\r
+                       }\r
+\r
+                       DOM.addClass(it, s['class']);\r
+//                     n = DOM.add(n, 'span', {'class' : 'item'});\r
+\r
+                       ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});\r
+\r
+                       if (s.icon_src)\r
+                               DOM.add(ic, 'img', {src : s.icon_src});\r
+\r
+                       n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);\r
+\r
+                       if (o.settings.style) {\r
+                               if (typeof o.settings.style == "function")\r
+                                       o.settings.style = o.settings.style();\r
+\r
+                               DOM.setAttrib(n, 'style', o.settings.style);\r
+                       }\r
+\r
+                       if (tb.childNodes.length == 1)\r
+                               DOM.addClass(ro, 'mceFirst');\r
+\r
+                       if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator'))\r
+                               DOM.addClass(ro, 'mceFirst');\r
+\r
+                       if (o.collapse)\r
+                               DOM.addClass(ro, cp + 'ItemSub');\r
+\r
+                       if (n = ro.previousSibling)\r
+                               DOM.removeClass(n, 'mceLast');\r
+\r
+                       DOM.addClass(ro, 'mceLast');\r
+               }\r
+       });\r
+})(tinymce);\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM;\r
+\r
+       tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {\r
+               Button : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
+                       this.classPrefix = 'mceButton';\r
+               },\r
+\r
+               renderHTML : function() {\r
+                       var cp = this.classPrefix, s = this.settings, h, l;\r
+\r
+                       l = DOM.encode(s.label || '');\r
+                       h = '<a role="button" id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" aria-labelledby="' + this.id + '_voice" title="' + DOM.encode(s.title) + '">';\r
+                       if (s.image && !(this.editor  &&this.editor.forcedHighContrastMode) )\r
+                               h += '<span class="mceIcon ' + s['class'] + '"><img class="mceIcon" src="' + s.image + '" alt="' + DOM.encode(s.title) + '" /></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '');\r
+                       else\r
+                               h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '');\r
+\r
+                       h += '<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="' + this.id + '_voice">' + s.title + '</span>'; \r
+                       h += '</a>';\r
+                       return h;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, s = t.settings, imgBookmark;\r
+\r
+                       // In IE a large image that occupies the entire editor area will be deselected when a button is clicked, so\r
+                       // need to keep the selection in case the selection is lost\r
+                       if (tinymce.isIE && t.editor) {\r
+                               tinymce.dom.Event.add(t.id, 'mousedown', function(e) {\r
+                                       var nodeName = t.editor.selection.getNode().nodeName;\r
+                                       imgBookmark = nodeName === 'IMG' ? t.editor.selection.getBookmark() : null;\r
+                               });\r
+                       }\r
+                       tinymce.dom.Event.add(t.id, 'click', function(e) {\r
+                               if (!t.isDisabled()) {\r
+                                       // restore the selection in case the selection is lost in IE\r
+                                       if (tinymce.isIE && t.editor && imgBookmark !== null) {\r
+                                               t.editor.selection.moveToBookmark(imgBookmark);\r
+                                       }\r
+                                       return s.onclick.call(s.scope, e);\r
+                               }\r
+                       });\r
+                       tinymce.dom.Event.add(t.id, 'keyup', function(e) {\r
+                               if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR)\r
+                                       return s.onclick.call(s.scope, e);\r
+                       });\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, undef;\r
+\r
+       tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', {\r
+               ListBox : function(id, s, ed) {\r
+                       var t = this;\r
+\r
+                       t.parent(id, s, ed);\r
+\r
+                       t.items = [];\r
+\r
+                       t.onChange = new Dispatcher(t);\r
+\r
+                       t.onPostRender = new Dispatcher(t);\r
+\r
+                       t.onAdd = new Dispatcher(t);\r
+\r
+                       t.onRenderMenu = new tinymce.util.Dispatcher(this);\r
+\r
+                       t.classPrefix = 'mceListBox';\r
+                       t.marked = {};\r
+               },\r
+\r
+               select : function(va) {\r
+                       var t = this, fv, f;\r
+\r
+                       t.marked = {};\r
+\r
+                       if (va == undef)\r
+                               return t.selectByIndex(-1);\r
+\r
+                       // Is string or number make function selector\r
+                       if (va && typeof(va)=="function")\r
+                               f = va;\r
+                       else {\r
+                               f = function(v) {\r
+                                       return v == va;\r
+                               };\r
+                       }\r
+\r
+                       // Do we need to do something?\r
+                       if (va != t.selectedValue) {\r
+                               // Find item\r
+                               each(t.items, function(o, i) {\r
+                                       if (f(o.value)) {\r
+                                               fv = 1;\r
+                                               t.selectByIndex(i);\r
+                                               return false;\r
+                                       }\r
+                               });\r
+\r
+                               if (!fv)\r
+                                       t.selectByIndex(-1);\r
+                       }\r
+               },\r
+\r
+               selectByIndex : function(idx) {\r
+                       var t = this, e, o, label;\r
+\r
+                       t.marked = {};\r
+\r
+                       if (idx != t.selectedIndex) {\r
+                               e = DOM.get(t.id + '_text');\r
+                               label = DOM.get(t.id + '_voiceDesc');\r
+                               o = t.items[idx];\r
+\r
+                               if (o) {\r
+                                       t.selectedValue = o.value;\r
+                                       t.selectedIndex = idx;\r
+                                       DOM.setHTML(e, DOM.encode(o.title));\r
+                                       DOM.setHTML(label, t.settings.title + " - " + o.title);\r
+                                       DOM.removeClass(e, 'mceTitle');\r
+                                       DOM.setAttrib(t.id, 'aria-valuenow', o.title);\r
+                               } else {\r
+                                       DOM.setHTML(e, DOM.encode(t.settings.title));\r
+                                       DOM.setHTML(label, DOM.encode(t.settings.title));\r
+                                       DOM.addClass(e, 'mceTitle');\r
+                                       t.selectedValue = t.selectedIndex = null;\r
+                                       DOM.setAttrib(t.id, 'aria-valuenow', t.settings.title);\r
+                               }\r
+                               e = 0;\r
+                       }\r
+               },\r
+\r
+               mark : function(value) {\r
+                       this.marked[value] = true;\r
+               },\r
+\r
+               add : function(n, v, o) {\r
+                       var t = this;\r
+\r
+                       o = o || {};\r
+                       o = tinymce.extend(o, {\r
+                               title : n,\r
+                               value : v\r
+                       });\r
+\r
+                       t.items.push(o);\r
+                       t.onAdd.dispatch(t, o);\r
+               },\r
+\r
+               getLength : function() {\r
+                       return this.items.length;\r
+               },\r
+\r
+               renderHTML : function() {\r
+                       var h = '', t = this, s = t.settings, cp = t.classPrefix;\r
+\r
+                       h = '<span role="listbox" aria-haspopup="true" aria-labelledby="' + t.id +'_voiceDesc" aria-describedby="' + t.id + '_voiceDesc"><table role="presentation" tabindex="0" id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';\r
+                       h += '<td>' + DOM.createHTML('span', {id: t.id + '_voiceDesc', 'class': 'voiceLabel', style:'display:none;'}, t.settings.title); \r
+                       h += DOM.createHTML('a', {id : t.id + '_text', tabindex : -1, href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>';\r
+                       h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span><span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span></span>') + '</td>';\r
+                       h += '</tr></tbody></table></span>';\r
+\r
+                       return h;\r
+               },\r
+\r
+               showMenu : function() {\r
+                       var t = this, p2, e = DOM.get(this.id), m;\r
+\r
+                       if (t.isDisabled() || t.items.length === 0)\r
+                               return;\r
+\r
+                       if (t.menu && t.menu.isMenuVisible)\r
+                               return t.hideMenu();\r
+\r
+                       if (!t.isMenuRendered) {\r
+                               t.renderMenu();\r
+                               t.isMenuRendered = true;\r
+                       }\r
+\r
+                       p2 = DOM.getPos(e);\r
+\r
+                       m = t.menu;\r
+                       m.settings.offset_x = p2.x;\r
+                       m.settings.offset_y = p2.y;\r
+                       m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus\r
+\r
+                       // Select in menu\r
+                       each(t.items, function(o) {\r
+                               if (m.items[o.id]) {\r
+                                       m.items[o.id].setSelected(0);\r
+                               }\r
+                       });\r
+\r
+                       each(t.items, function(o) {\r
+                               if (m.items[o.id] && t.marked[o.value]) {\r
+                                       m.items[o.id].setSelected(1);\r
+                               }\r
+\r
+                               if (o.value === t.selectedValue) {\r
+                                       m.items[o.id].setSelected(1);\r
+                               }\r
+                       });\r
+\r
+                       m.showMenu(0, e.clientHeight);\r
+\r
+                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                       DOM.addClass(t.id, t.classPrefix + 'Selected');\r
+\r
+                       //DOM.get(t.id + '_text').focus();\r
+               },\r
+\r
+               hideMenu : function(e) {\r
+                       var t = this;\r
+\r
+                       if (t.menu && t.menu.isMenuVisible) {\r
+                               DOM.removeClass(t.id, t.classPrefix + 'Selected');\r
+\r
+                               // Prevent double toogles by canceling the mouse click event to the button\r
+                               if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))\r
+                                       return;\r
+\r
+                               if (!e || !DOM.getParent(e.target, '.mceMenu')) {\r
+                                       DOM.removeClass(t.id, t.classPrefix + 'Selected');\r
+                                       Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                                       t.menu.hideMenu();\r
+                               }\r
+                       }\r
+               },\r
+\r
+               renderMenu : function() {\r
+                       var t = this, m;\r
+\r
+                       m = t.settings.control_manager.createDropMenu(t.id + '_menu', {\r
+                               menu_line : 1,\r
+                               'class' : t.classPrefix + 'Menu mceNoIcons',\r
+                               max_width : 250,\r
+                               max_height : 150\r
+                       });\r
+\r
+                       m.onHideMenu.add(function() {\r
+                               t.hideMenu();\r
+                               t.focus();\r
+                       });\r
+\r
+                       m.add({\r
+                               title : t.settings.title,\r
+                               'class' : 'mceMenuItemTitle',\r
+                               onclick : function() {\r
+                                       if (t.settings.onselect('') !== false)\r
+                                               t.select(''); // Must be runned after\r
+                               }\r
+                       });\r
+\r
+                       each(t.items, function(o) {\r
+                               // No value then treat it as a title\r
+                               if (o.value === undef) {\r
+                                       m.add({\r
+                                               title : o.title,\r
+                                               role : "option",\r
+                                               'class' : 'mceMenuItemTitle',\r
+                                               onclick : function() {\r
+                                                       if (t.settings.onselect('') !== false)\r
+                                                               t.select(''); // Must be runned after\r
+                                               }\r
+                                       });\r
+                               } else {\r
+                                       o.id = DOM.uniqueId();\r
+                                       o.role= "option";\r
+                                       o.onclick = function() {\r
+                                               if (t.settings.onselect(o.value) !== false)\r
+                                                       t.select(o.value); // Must be runned after\r
+                                       };\r
+\r
+                                       m.add(o);\r
+                               }\r
+                       });\r
+\r
+                       t.onRenderMenu.dispatch(t, m);\r
+                       t.menu = m;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, cp = t.classPrefix;\r
+\r
+                       Event.add(t.id, 'click', t.showMenu, t);\r
+                       Event.add(t.id, 'keydown', function(evt) {\r
+                               if (evt.keyCode == 32) { // Space\r
+                                       t.showMenu(evt);\r
+                                       Event.cancel(evt);\r
+                               }\r
+                       });\r
+                       Event.add(t.id, 'focus', function() {\r
+                               if (!t._focused) {\r
+                                       t.keyDownHandler = Event.add(t.id, 'keydown', function(e) {\r
+                                               if (e.keyCode == 40) {\r
+                                                       t.showMenu();\r
+                                                       Event.cancel(e);\r
+                                               }\r
+                                       });\r
+                                       t.keyPressHandler = Event.add(t.id, 'keypress', function(e) {\r
+                                               var v;\r
+                                               if (e.keyCode == 13) {\r
+                                                       // Fake select on enter\r
+                                                       v = t.selectedValue;\r
+                                                       t.selectedValue = null; // Needs to be null to fake change\r
+                                                       Event.cancel(e);\r
+                                                       t.settings.onselect(v);\r
+                                               }\r
+                                       });\r
+                               }\r
+\r
+                               t._focused = 1;\r
+                       });\r
+                       Event.add(t.id, 'blur', function() {\r
+                               Event.remove(t.id, 'keydown', t.keyDownHandler);\r
+                               Event.remove(t.id, 'keypress', t.keyPressHandler);\r
+                               t._focused = 0;\r
+                       });\r
+\r
+                       // Old IE doesn't have hover on all elements\r
+                       if (tinymce.isIE6 || !DOM.boxModel) {\r
+                               Event.add(t.id, 'mouseover', function() {\r
+                                       if (!DOM.hasClass(t.id, cp + 'Disabled'))\r
+                                               DOM.addClass(t.id, cp + 'Hover');\r
+                               });\r
+\r
+                               Event.add(t.id, 'mouseout', function() {\r
+                                       if (!DOM.hasClass(t.id, cp + 'Disabled'))\r
+                                               DOM.removeClass(t.id, cp + 'Hover');\r
+                               });\r
+                       }\r
+\r
+                       t.onPostRender.dispatch(t, DOM.get(t.id));\r
+               },\r
+\r
+               destroy : function() {\r
+                       this.parent();\r
+\r
+                       Event.clear(this.id + '_text');\r
+                       Event.clear(this.id + '_open');\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, undef;\r
+\r
+       tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {\r
+               NativeListBox : function(id, s) {\r
+                       this.parent(id, s);\r
+                       this.classPrefix = 'mceNativeListBox';\r
+               },\r
+\r
+               setDisabled : function(s) {\r
+                       DOM.get(this.id).disabled = s;\r
+                       this.setAriaProperty('disabled', s);\r
+               },\r
+\r
+               isDisabled : function() {\r
+                       return DOM.get(this.id).disabled;\r
+               },\r
+\r
+               select : function(va) {\r
+                       var t = this, fv, f;\r
+\r
+                       if (va == undef)\r
+                               return t.selectByIndex(-1);\r
+\r
+                       // Is string or number make function selector\r
+                       if (va && typeof(va)=="function")\r
+                               f = va;\r
+                       else {\r
+                               f = function(v) {\r
+                                       return v == va;\r
+                               };\r
+                       }\r
+\r
+                       // Do we need to do something?\r
+                       if (va != t.selectedValue) {\r
+                               // Find item\r
+                               each(t.items, function(o, i) {\r
+                                       if (f(o.value)) {\r
+                                               fv = 1;\r
+                                               t.selectByIndex(i);\r
+                                               return false;\r
+                                       }\r
+                               });\r
+\r
+                               if (!fv)\r
+                                       t.selectByIndex(-1);\r
+                       }\r
+               },\r
+\r
+               selectByIndex : function(idx) {\r
+                       DOM.get(this.id).selectedIndex = idx + 1;\r
+                       this.selectedValue = this.items[idx] ? this.items[idx].value : null;\r
+               },\r
+\r
+               add : function(n, v, a) {\r
+                       var o, t = this;\r
+\r
+                       a = a || {};\r
+                       a.value = v;\r
+\r
+                       if (t.isRendered())\r
+                               DOM.add(DOM.get(this.id), 'option', a, n);\r
+\r
+                       o = {\r
+                               title : n,\r
+                               value : v,\r
+                               attribs : a\r
+                       };\r
+\r
+                       t.items.push(o);\r
+                       t.onAdd.dispatch(t, o);\r
+               },\r
+\r
+               getLength : function() {\r
+                       return this.items.length;\r
+               },\r
+\r
+               renderHTML : function() {\r
+                       var h, t = this;\r
+\r
+                       h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');\r
+\r
+                       each(t.items, function(it) {\r
+                               h += DOM.createHTML('option', {value : it.value}, it.title);\r
+                       });\r
+\r
+                       h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox', 'aria-labelledby': t.id + '_aria'}, h);\r
+                       h += DOM.createHTML('span', {id : t.id + '_aria', 'style': 'display: none'}, t.settings.title);\r
+                       return h;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, ch, changeListenerAdded = true;\r
+\r
+                       t.rendered = true;\r
+\r
+                       function onChange(e) {\r
+                               var v = t.items[e.target.selectedIndex - 1];\r
+\r
+                               if (v && (v = v.value)) {\r
+                                       t.onChange.dispatch(t, v);\r
+\r
+                                       if (t.settings.onselect)\r
+                                               t.settings.onselect(v);\r
+                               }\r
+                       };\r
+\r
+                       Event.add(t.id, 'change', onChange);\r
+\r
+                       // Accessibility keyhandler\r
+                       Event.add(t.id, 'keydown', function(e) {\r
+                               var bf;\r
+\r
+                               Event.remove(t.id, 'change', ch);\r
+                               changeListenerAdded = false;\r
+\r
+                               bf = Event.add(t.id, 'blur', function() {\r
+                                       if (changeListenerAdded) return;\r
+                                       changeListenerAdded = true;\r
+                                       Event.add(t.id, 'change', onChange);\r
+                                       Event.remove(t.id, 'blur', bf);\r
+                               });\r
+\r
+                               //prevent default left and right keys on chrome - so that the keyboard navigation is used.\r
+                               if (tinymce.isWebKit && (e.keyCode==37 ||e.keyCode==39)) {\r
+                                       return Event.prevent(e);\r
+                               }\r
+                               \r
+                               if (e.keyCode == 13 || e.keyCode == 32) {\r
+                                       onChange(e);\r
+                                       return Event.cancel(e);\r
+                               }\r
+                       });\r
+\r
+                       t.onPostRender.dispatch(t, DOM.get(t.id));\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {\r
+               MenuButton : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
+\r
+                       this.onRenderMenu = new tinymce.util.Dispatcher(this);\r
+\r
+                       s.menu_container = s.menu_container || DOM.doc.body;\r
+               },\r
+\r
+               showMenu : function() {\r
+                       var t = this, p1, p2, e = DOM.get(t.id), m;\r
+\r
+                       if (t.isDisabled())\r
+                               return;\r
+\r
+                       if (!t.isMenuRendered) {\r
+                               t.renderMenu();\r
+                               t.isMenuRendered = true;\r
+                       }\r
+\r
+                       if (t.isMenuVisible)\r
+                               return t.hideMenu();\r
+\r
+                       p1 = DOM.getPos(t.settings.menu_container);\r
+                       p2 = DOM.getPos(e);\r
+\r
+                       m = t.menu;\r
+                       m.settings.offset_x = p2.x;\r
+                       m.settings.offset_y = p2.y;\r
+                       m.settings.vp_offset_x = p2.x;\r
+                       m.settings.vp_offset_y = p2.y;\r
+                       m.settings.keyboard_focus = t._focused;\r
+                       m.showMenu(0, e.firstChild.clientHeight);\r
+\r
+                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                       t.setState('Selected', 1);\r
+\r
+                       t.isMenuVisible = 1;\r
+               },\r
+\r
+               renderMenu : function() {\r
+                       var t = this, m;\r
+\r
+                       m = t.settings.control_manager.createDropMenu(t.id + '_menu', {\r
+                               menu_line : 1,\r
+                               'class' : this.classPrefix + 'Menu',\r
+                               icons : t.settings.icons\r
+                       });\r
+\r
+                       m.onHideMenu.add(function() {\r
+                               t.hideMenu();\r
+                               t.focus();\r
+                       });\r
+\r
+                       t.onRenderMenu.dispatch(t, m);\r
+                       t.menu = m;\r
+               },\r
+\r
+               hideMenu : function(e) {\r
+                       var t = this;\r
+\r
+                       // Prevent double toogles by canceling the mouse click event to the button\r
+                       if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';}))\r
+                               return;\r
+\r
+                       if (!e || !DOM.getParent(e.target, '.mceMenu')) {\r
+                               t.setState('Selected', 0);\r
+                               Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                               if (t.menu)\r
+                                       t.menu.hideMenu();\r
+                       }\r
+\r
+                       t.isMenuVisible = 0;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, s = t.settings;\r
+\r
+                       Event.add(t.id, 'click', function() {\r
+                               if (!t.isDisabled()) {\r
+                                       if (s.onclick)\r
+                                               s.onclick(t.value);\r
+\r
+                                       t.showMenu();\r
+                               }\r
+                       });\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', {\r
+               SplitButton : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
+                       this.classPrefix = 'mceSplitButton';\r
+               },\r
+\r
+               renderHTML : function() {\r
+                       var h, t = this, s = t.settings, h1;\r
+\r
+                       h = '<tbody><tr>';\r
+\r
+                       if (s.image)\r
+                               h1 = DOM.createHTML('img ', {src : s.image, role: 'presentation', 'class' : 'mceAction ' + s['class']});\r
+                       else\r
+                               h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');\r
+\r
+                       h1 += DOM.createHTML('span', {'class': 'mceVoiceLabel mceIconOnly', id: t.id + '_voice', style: 'display:none;'}, s.title);\r
+                       h += '<td >' + DOM.createHTML('a', {role: 'button', id : t.id + '_action', tabindex: '-1', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';\r
+       \r
+                       h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']}, '<span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span>');\r
+                       h += '<td >' + DOM.createHTML('a', {role: 'button', id : t.id + '_open', tabindex: '-1', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';\r
+\r
+                       h += '</tr></tbody>';\r
+                       h = DOM.createHTML('table', { role: 'presentation',   'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', title : s.title}, h);\r
+                       return DOM.createHTML('div', {id : t.id, role: 'button', tabindex: '0', 'aria-labelledby': t.id + '_voice', 'aria-haspopup': 'true'}, h);\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, s = t.settings, activate;\r
+\r
+                       if (s.onclick) {\r
+                               activate = function(evt) {\r
+                                       if (!t.isDisabled()) {\r
+                                               s.onclick(t.value);\r
+                                               Event.cancel(evt);\r
+                                       }\r
+                               };\r
+                               Event.add(t.id + '_action', 'click', activate);\r
+                               Event.add(t.id, ['click', 'keydown'], function(evt) {\r
+                                       var DOM_VK_SPACE = 32, DOM_VK_ENTER = 14, DOM_VK_RETURN = 13, DOM_VK_UP = 38, DOM_VK_DOWN = 40;\r
+                                       if ((evt.keyCode === 32 || evt.keyCode === 13 || evt.keyCode === 14) && !evt.altKey && !evt.ctrlKey && !evt.metaKey) {\r
+                                               activate();\r
+                                               Event.cancel(evt);\r
+                                       } else if (evt.type === 'click' || evt.keyCode === DOM_VK_DOWN) {\r
+                                               t.showMenu();\r
+                                               Event.cancel(evt);\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       Event.add(t.id + '_open', 'click', function (evt) {\r
+                               t.showMenu();\r
+                               Event.cancel(evt);\r
+                       });\r
+                       Event.add([t.id, t.id + '_open'], 'focus', function() {t._focused = 1;});\r
+                       Event.add([t.id, t.id + '_open'], 'blur', function() {t._focused = 0;});\r
+\r
+                       // Old IE doesn't have hover on all elements\r
+                       if (tinymce.isIE6 || !DOM.boxModel) {\r
+                               Event.add(t.id, 'mouseover', function() {\r
+                                       if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))\r
+                                               DOM.addClass(t.id, 'mceSplitButtonHover');\r
+                               });\r
+\r
+                               Event.add(t.id, 'mouseout', function() {\r
+                                       if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))\r
+                                               DOM.removeClass(t.id, 'mceSplitButtonHover');\r
+                               });\r
+                       }\r
+               },\r
+\r
+               destroy : function() {\r
+                       this.parent();\r
+\r
+                       Event.clear(this.id + '_action');\r
+                       Event.clear(this.id + '_open');\r
+                       Event.clear(this.id);\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', {\r
+               ColorSplitButton : function(id, s, ed) {\r
+                       var t = this;\r
+\r
+                       t.parent(id, s, ed);\r
+\r
+                       t.settings = s = tinymce.extend({\r
+                               colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',\r
+                               grid_width : 8,\r
+                               default_color : '#888888'\r
+                       }, t.settings);\r
+\r
+                       t.onShowMenu = new tinymce.util.Dispatcher(t);\r
+\r
+                       t.onHideMenu = new tinymce.util.Dispatcher(t);\r
+\r
+                       t.value = s.default_color;\r
+               },\r
+\r
+               showMenu : function() {\r
+                       var t = this, r, p, e, p2;\r
+\r
+                       if (t.isDisabled())\r
+                               return;\r
+\r
+                       if (!t.isMenuRendered) {\r
+                               t.renderMenu();\r
+                               t.isMenuRendered = true;\r
+                       }\r
+\r
+                       if (t.isMenuVisible)\r
+                               return t.hideMenu();\r
+\r
+                       e = DOM.get(t.id);\r
+                       DOM.show(t.id + '_menu');\r
+                       DOM.addClass(e, 'mceSplitButtonSelected');\r
+                       p2 = DOM.getPos(e);\r
+                       DOM.setStyles(t.id + '_menu', {\r
+                               left : p2.x,\r
+                               top : p2.y + e.firstChild.clientHeight,\r
+                               zIndex : 200000\r
+                       });\r
+                       e = 0;\r
+\r
+                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                       t.onShowMenu.dispatch(t);\r
+\r
+                       if (t._focused) {\r
+                               t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) {\r
+                                       if (e.keyCode == 27)\r
+                                               t.hideMenu();\r
+                               });\r
+\r
+                               DOM.select('a', t.id + '_menu')[0].focus(); // Select first link\r
+                       }\r
+\r
+                       t.keyboardNav = new tinymce.ui.KeyboardNavigation({\r
+                               root: t.id + '_menu',\r
+                               items: DOM.select('a', t.id + '_menu'),\r
+                               onCancel: function() {\r
+                                       t.hideMenu();\r
+                                       t.focus();\r
+                               }\r
+                       });\r
+\r
+                       t.keyboardNav.focus();\r
+                       t.isMenuVisible = 1;\r
+               },\r
+\r
+               hideMenu : function(e) {\r
+                       var t = this;\r
+\r
+                       if (t.isMenuVisible) {\r
+                               // Prevent double toogles by canceling the mouse click event to the button\r
+                               if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';}))\r
+                                       return;\r
+\r
+                               if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) {\r
+                                       DOM.removeClass(t.id, 'mceSplitButtonSelected');\r
+                                       Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                                       Event.remove(t.id + '_menu', 'keydown', t._keyHandler);\r
+                                       DOM.hide(t.id + '_menu');\r
+                               }\r
+\r
+                               t.isMenuVisible = 0;\r
+                               t.onHideMenu.dispatch();\r
+                               t.keyboardNav.destroy();\r
+                       }\r
+               },\r
+\r
+               renderMenu : function() {\r
+                       var t = this, m, i = 0, s = t.settings, n, tb, tr, w, context;\r
+\r
+                       w = DOM.add(s.menu_container, 'div', {role: 'listbox', id : t.id + '_menu', 'class' : s.menu_class + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'});\r
+                       m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'});\r
+                       DOM.add(m, 'span', {'class' : 'mceMenuLine'});\r
+\r
+                       n = DOM.add(m, 'table', {role: 'presentation', 'class' : 'mceColorSplitMenu'});\r
+                       tb = DOM.add(n, 'tbody');\r
+\r
+                       // Generate color grid\r
+                       i = 0;\r
+                       each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) {\r
+                               c = c.replace(/^#/, '');\r
+\r
+                               if (!i--) {\r
+                                       tr = DOM.add(tb, 'tr');\r
+                                       i = s.grid_width - 1;\r
+                               }\r
+\r
+                               n = DOM.add(tr, 'td');\r
+                               var settings = {\r
+                                       href : 'javascript:;',\r
+                                       style : {\r
+                                               backgroundColor : '#' + c\r
+                                       },\r
+                                       'title': t.editor.getLang('colors.' + c, c),\r
+                                       'data-mce-color' : '#' + c\r
+                               };\r
+\r
+                               // adding a proper ARIA role = button causes JAWS to read things incorrectly on IE.\r
+                               if (!tinymce.isIE ) {\r
+                                       settings.role = 'option';\r
+                               }\r
+\r
+                               n = DOM.add(n, 'a', settings);\r
+\r
+                               if (t.editor.forcedHighContrastMode) {\r
+                                       n = DOM.add(n, 'canvas', { width: 16, height: 16, 'aria-hidden': 'true' });\r
+                                       if (n.getContext && (context = n.getContext("2d"))) {\r
+                                               context.fillStyle = '#' + c;\r
+                                               context.fillRect(0, 0, 16, 16);\r
+                                       } else {\r
+                                               // No point leaving a canvas element around if it's not supported for drawing on anyway.\r
+                                               DOM.remove(n);\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       if (s.more_colors_func) {\r
+                               n = DOM.add(tb, 'tr');\r
+                               n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'});\r
+                               n = DOM.add(n, 'a', {role: 'option', id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);\r
+\r
+                               Event.add(n, 'click', function(e) {\r
+                                       s.more_colors_func.call(s.more_colors_scope || this);\r
+                                       return Event.cancel(e); // Cancel to fix onbeforeunload problem\r
+                               });\r
+                       }\r
+\r
+                       DOM.addClass(m, 'mceColorSplitMenu');\r
+\r
+                       // Prevent IE from scrolling and hindering click to occur #4019\r
+                       Event.add(t.id + '_menu', 'mousedown', function(e) {return Event.cancel(e);});\r
+\r
+                       Event.add(t.id + '_menu', 'click', function(e) {\r
+                               var c;\r
+\r
+                               e = DOM.getParent(e.target, 'a', tb);\r
+\r
+                               if (e && e.nodeName.toLowerCase() == 'a' && (c = e.getAttribute('data-mce-color')))\r
+                                       t.setColor(c);\r
+\r
+                               return false; // Prevent IE auto save warning\r
+                       });\r
+\r
+                       return w;\r
+               },\r
+\r
+               setColor : function(c) {\r
+                       this.displayColor(c);\r
+                       this.hideMenu();\r
+                       this.settings.onselect(c);\r
+               },\r
+               \r
+               displayColor : function(c) {\r
+                       var t = this;\r
+\r
+                       DOM.setStyle(t.id + '_preview', 'backgroundColor', c);\r
+\r
+                       t.value = c;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, id = t.id;\r
+\r
+                       t.parent();\r
+                       DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});\r
+                       DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);\r
+               },\r
+\r
+               destroy : function() {\r
+                       var self = this;\r
+\r
+                       self.parent();\r
+\r
+                       Event.clear(self.id + '_menu');\r
+                       Event.clear(self.id + '_more');\r
+                       DOM.remove(self.id + '_menu');\r
+\r
+                       if (self.keyboardNav) {\r
+                               self.keyboardNav.destroy();\r
+                       }\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+// Shorten class names\r
+var dom = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event;\r
+tinymce.create('tinymce.ui.ToolbarGroup:tinymce.ui.Container', {\r
+       renderHTML : function() {\r
+               var t = this, h = [], controls = t.controls, each = tinymce.each, settings = t.settings;\r
+\r
+               h.push('<div id="' + t.id + '" role="group" aria-labelledby="' + t.id + '_voice">');\r
+               //TODO: ACC test this out - adding a role = application for getting the landmarks working well.\r
+               h.push("<span role='application'>");\r
+               h.push('<span id="' + t.id + '_voice" class="mceVoiceLabel" style="display:none;">' + dom.encode(settings.name) + '</span>');\r
+               each(controls, function(toolbar) {\r
+                       h.push(toolbar.renderHTML());\r
+               });\r
+               h.push("</span>");\r
+               h.push('</div>');\r
+\r
+               return h.join('');\r
+       },\r
+       \r
+       focus : function() {\r
+               var t = this;\r
+               dom.get(t.id).focus();\r
+       },\r
+       \r
+       postRender : function() {\r
+               var t = this, items = [];\r
+\r
+               each(t.controls, function(toolbar) {\r
+                       each (toolbar.controls, function(control) {\r
+                               if (control.id) {\r
+                                       items.push(control);\r
+                               }\r
+                       });\r
+               });\r
+\r
+               t.keyNav = new tinymce.ui.KeyboardNavigation({\r
+                       root: t.id,\r
+                       items: items,\r
+                       onCancel: function() {\r
+                               //Move focus if webkit so that navigation back will read the item.\r
+                               if (tinymce.isWebKit) {\r
+                                       dom.get(t.editor.id+"_ifr").focus();\r
+                               }\r
+                               t.editor.focus();\r
+                       },\r
+                       excludeFromTabOrder: !t.settings.tab_focus_toolbar\r
+               });\r
+       },\r
+       \r
+       destroy : function() {\r
+               var self = this;\r
+\r
+               self.parent();\r
+               self.keyNav.destroy();\r
+               Event.clear(self.id);\r
+       }\r
+});\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+// Shorten class names\r
+var dom = tinymce.DOM, each = tinymce.each;\r
+tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {\r
+       renderHTML : function() {\r
+               var t = this, h = '', c, co, s = t.settings, i, pr, nx, cl;\r
+\r
+               cl = t.controls;\r
+               for (i=0; i<cl.length; i++) {\r
+                       // Get current control, prev control, next control and if the control is a list box or not\r
+                       co = cl[i];\r
+                       pr = cl[i - 1];\r
+                       nx = cl[i + 1];\r
+\r
+                       // Add toolbar start\r
+                       if (i === 0) {\r
+                               c = 'mceToolbarStart';\r
+\r
+                               if (co.Button)\r
+                                       c += ' mceToolbarStartButton';\r
+                               else if (co.SplitButton)\r
+                                       c += ' mceToolbarStartSplitButton';\r
+                               else if (co.ListBox)\r
+                                       c += ' mceToolbarStartListBox';\r
+\r
+                               h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));\r
+                       }\r
+\r
+                       // Add toolbar end before list box and after the previous button\r
+                       // This is to fix the o2k7 editor skins\r
+                       if (pr && co.ListBox) {\r
+                               if (pr.Button || pr.SplitButton)\r
+                                       h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->'));\r
+                       }\r
+\r
+                       // Render control HTML\r
+\r
+                       // IE 8 quick fix, needed to propertly generate a hit area for anchors\r
+                       if (dom.stdMode)\r
+                               h += '<td style="position: relative">' + co.renderHTML() + '</td>';\r
+                       else\r
+                               h += '<td>' + co.renderHTML() + '</td>';\r
+\r
+                       // Add toolbar start after list box and before the next button\r
+                       // This is to fix the o2k7 editor skins\r
+                       if (nx && co.ListBox) {\r
+                               if (nx.Button || nx.SplitButton)\r
+                                       h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));\r
+                       }\r
+               }\r
+\r
+               c = 'mceToolbarEnd';\r
+\r
+               if (co.Button)\r
+                       c += ' mceToolbarEndButton';\r
+               else if (co.SplitButton)\r
+                       c += ' mceToolbarEndSplitButton';\r
+               else if (co.ListBox)\r
+                       c += ' mceToolbarEndListBox';\r
+\r
+               h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));\r
+\r
+               return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || '', role: 'presentation', tabindex: '-1'}, '<tbody><tr>' + h + '</tr></tbody>');\r
+       }\r
+});\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.AddOnManager', {\r
+               AddOnManager : function() {\r
+                       var self = this;\r
+\r
+                       self.items = [];\r
+                       self.urls = {};\r
+                       self.lookup = {};\r
+                       self.onAdd = new Dispatcher(self);\r
+               },\r
+\r
+               get : function(n) {\r
+                       if (this.lookup[n]) {\r
+                               return this.lookup[n].instance;\r
+                       } else {\r
+                               return undefined;\r
+                       }\r
+               },\r
+\r
+               dependencies : function(n) {\r
+                       var result;\r
+                       if (this.lookup[n]) {\r
+                               result = this.lookup[n].dependencies;\r
+                       }\r
+                       return result || [];\r
+               },\r
+\r
+               requireLangPack : function(n) {\r
+                       var s = tinymce.settings;\r
+\r
+                       if (s && s.language && s.language_load !== false)\r
+                               tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');\r
+               },\r
+\r
+               add : function(id, o, dependencies) {\r
+                       this.items.push(o);\r
+                       this.lookup[id] = {instance:o, dependencies:dependencies};\r
+                       this.onAdd.dispatch(this, id, o);\r
+\r
+                       return o;\r
+               },\r
+               createUrl: function(baseUrl, dep) {\r
+                       if (typeof dep === "object") {\r
+                               return dep\r
+                       } else {\r
+                               return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix};\r
+                       }\r
+               },\r
+\r
+               addComponents: function(pluginName, scripts) {\r
+                       var pluginUrl = this.urls[pluginName];\r
+                       tinymce.each(scripts, function(script){\r
+                               tinymce.ScriptLoader.add(pluginUrl+"/"+script); \r
+                       });\r
+               },\r
+\r
+               load : function(n, u, cb, s) {\r
+                       var t = this, url = u;\r
+\r
+                       function loadDependencies() {\r
+                               var dependencies = t.dependencies(n);\r
+                               tinymce.each(dependencies, function(dep) {\r
+                                       var newUrl = t.createUrl(u, dep);\r
+                                       t.load(newUrl.resource, newUrl, undefined, undefined);\r
+                               });\r
+                               if (cb) {\r
+                                       if (s) {\r
+                                               cb.call(s);\r
+                                       } else {\r
+                                               cb.call(tinymce.ScriptLoader);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       if (t.urls[n])\r
+                               return;\r
+                       if (typeof u === "object")\r
+                               url = u.prefix + u.resource + u.suffix;\r
+\r
+                       if (url.indexOf('/') !== 0 && url.indexOf('://') == -1)\r
+                               url = tinymce.baseURL + '/' + url;\r
+\r
+                       t.urls[n] = url.substring(0, url.lastIndexOf('/'));\r
+\r
+                       if (t.lookup[n]) {\r
+                               loadDependencies();\r
+                       } else {\r
+                               tinymce.ScriptLoader.add(url, loadDependencies, s);\r
+                       }\r
+               }\r
+       });\r
+\r
+       // Create plugin and theme managers\r
+       tinymce.PluginManager = new tinymce.AddOnManager();\r
+       tinymce.ThemeManager = new tinymce.AddOnManager();\r
+}(tinymce));\r
+\r
+(function(tinymce) {\r
+       // Shorten names\r
+       var each = tinymce.each, extend = tinymce.extend,\r
+               DOM = tinymce.DOM, Event = tinymce.dom.Event,\r
+               ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,\r
+               explode = tinymce.explode,\r
+               Dispatcher = tinymce.util.Dispatcher, undef, instanceCounter = 0;\r
+\r
+       // Setup some URLs where the editor API is located and where the document is\r
+       tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');\r
+       if (!/[\/\\]$/.test(tinymce.documentBaseURL))\r
+               tinymce.documentBaseURL += '/';\r
+\r
+       tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);\r
+\r
+       tinymce.baseURI = new tinymce.util.URI(tinymce.baseURL);\r
+\r
+       // Add before unload listener\r
+       // This was required since IE was leaking memory if you added and removed beforeunload listeners\r
+       // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event\r
+       tinymce.onBeforeUnload = new Dispatcher(tinymce);\r
+\r
+       // Must be on window or IE will leak if the editor is placed in frame or iframe\r
+       Event.add(window, 'beforeunload', function(e) {\r
+               tinymce.onBeforeUnload.dispatch(tinymce, e);\r
+       });\r
+\r
+       tinymce.onAddEditor = new Dispatcher(tinymce);\r
+\r
+       tinymce.onRemoveEditor = new Dispatcher(tinymce);\r
+\r
+       tinymce.EditorManager = extend(tinymce, {\r
+               editors : [],\r
+\r
+               i18n : {},\r
+\r
+               activeEditor : null,\r
+\r
+               init : function(s) {\r
+                       var t = this, pl, sl = tinymce.ScriptLoader, e, el = [], ed;\r
+\r
+                       function createId(elm) {\r
+                               var id = elm.id;\r
+       \r
+                               // Use element id, or unique name or generate a unique id\r
+                               if (!id) {\r
+                                       id = elm.name;\r
+       \r
+                                       if (id && !DOM.get(id)) {\r
+                                               id = elm.name;\r
+                                       } else {\r
+                                               // Generate unique name\r
+                                               id = DOM.uniqueId();\r
+                                       }\r
+\r
+                                       elm.setAttribute('id', id);\r
+                               }\r
+\r
+                               return id;\r
+                       };\r
+\r
+                       function execCallback(se, n, s) {\r
+                               var f = se[n];\r
+\r
+                               if (!f)\r
+                                       return;\r
+\r
+                               if (tinymce.is(f, 'string')) {\r
+                                       s = f.replace(/\.\w+$/, '');\r
+                                       s = s ? tinymce.resolve(s) : 0;\r
+                                       f = tinymce.resolve(f);\r
+                               }\r
+\r
+                               return f.apply(s || this, Array.prototype.slice.call(arguments, 2));\r
+                       };\r
+\r
+                       function hasClass(n, c) {\r
+                               return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c);\r
+                       };\r
+\r
+                       t.settings = s;\r
+\r
+                       // Legacy call\r
+                       Event.bind(window, 'ready', function() {\r
+                               var l, co;\r
+\r
+                               execCallback(s, 'onpageload');\r
+\r
+                               switch (s.mode) {\r
+                                       case "exact":\r
+                                               l = s.elements || '';\r
+\r
+                                               if(l.length > 0) {\r
+                                                       each(explode(l), function(v) {\r
+                                                               if (DOM.get(v)) {\r
+                                                                       ed = new tinymce.Editor(v, s);\r
+                                                                       el.push(ed);\r
+                                                                       ed.render(1);\r
+                                                               } else {\r
+                                                                       each(document.forms, function(f) {\r
+                                                                               each(f.elements, function(e) {\r
+                                                                                       if (e.name === v) {\r
+                                                                                               v = 'mce_editor_' + instanceCounter++;\r
+                                                                                               DOM.setAttrib(e, 'id', v);\r
+\r
+                                                                                               ed = new tinymce.Editor(v, s);\r
+                                                                                               el.push(ed);\r
+                                                                                               ed.render(1);\r
+                                                                                       }\r
+                                                                               });\r
+                                                                       });\r
+                                                               }\r
+                                                       });\r
+                                               }\r
+                                               break;\r
+\r
+                                       case "textareas":\r
+                                       case "specific_textareas":\r
+                                               each(DOM.select('textarea'), function(elm) {\r
+                                                       if (s.editor_deselector && hasClass(elm, s.editor_deselector))\r
+                                                               return;\r
+\r
+                                                       if (!s.editor_selector || hasClass(elm, s.editor_selector)) {\r
+                                                               ed = new tinymce.Editor(createId(elm), s);\r
+                                                               el.push(ed);\r
+                                                               ed.render(1);\r
+                                                       }\r
+                                               });\r
+                                               break;\r
+                                       \r
+                                       default:\r
+                                               if (s.types) {\r
+                                                       // Process type specific selector\r
+                                                       each(s.types, function(type) {\r
+                                                               each(DOM.select(type.selector), function(elm) {\r
+                                                                       var editor = new tinymce.Editor(createId(elm), tinymce.extend({}, s, type));\r
+                                                                       el.push(editor);\r
+                                                                       editor.render(1);\r
+                                                               });\r
+                                                       });\r
+                                               } else if (s.selector) {\r
+                                                       // Process global selector\r
+                                                       each(DOM.select(s.selector), function(elm) {\r
+                                                               var editor = new tinymce.Editor(createId(elm), s);\r
+                                                               el.push(editor);\r
+                                                               editor.render(1);\r
+                                                       });\r
+                                               }\r
+                               }\r
+\r
+                               // Call onInit when all editors are initialized\r
+                               if (s.oninit) {\r
+                                       l = co = 0;\r
+\r
+                                       each(el, function(ed) {\r
+                                               co++;\r
+\r
+                                               if (!ed.initialized) {\r
+                                                       // Wait for it\r
+                                                       ed.onInit.add(function() {\r
+                                                               l++;\r
+\r
+                                                               // All done\r
+                                                               if (l == co)\r
+                                                                       execCallback(s, 'oninit');\r
+                                                       });\r
+                                               } else\r
+                                                       l++;\r
+\r
+                                               // All done\r
+                                               if (l == co)\r
+                                                       execCallback(s, 'oninit');                                      \r
+                                       });\r
+                               }\r
+                       });\r
+               },\r
+\r
+               get : function(id) {\r
+                       if (id === undef)\r
+                               return this.editors;\r
+\r
+                       return this.editors[id];\r
+               },\r
+\r
+               getInstanceById : function(id) {\r
+                       return this.get(id);\r
+               },\r
+\r
+               add : function(editor) {\r
+                       var self = this, editors = self.editors;\r
+\r
+                       // Add named and index editor instance\r
+                       editors[editor.id] = editor;\r
+                       editors.push(editor);\r
+\r
+                       self._setActive(editor);\r
+                       self.onAddEditor.dispatch(self, editor);\r
+\r
+\r
+                       return editor;\r
+               },\r
+\r
+               remove : function(editor) {\r
+                       var t = this, i, editors = t.editors;\r
+\r
+                       // Not in the collection\r
+                       if (!editors[editor.id])\r
+                               return null;\r
+\r
+                       delete editors[editor.id];\r
+\r
+                       for (i = 0; i < editors.length; i++) {\r
+                               if (editors[i] == editor) {\r
+                                       editors.splice(i, 1);\r
+                                       break;\r
+                               }\r
+                       }\r
+\r
+                       // Select another editor since the active one was removed\r
+                       if (t.activeEditor == editor)\r
+                               t._setActive(editors[0]);\r
+\r
+                       editor.destroy();\r
+                       t.onRemoveEditor.dispatch(t, editor);\r
+\r
+                       return editor;\r
+               },\r
+\r
+               execCommand : function(c, u, v) {\r
+                       var t = this, ed = t.get(v), w;\r
+\r
+                       function clr() {\r
+                               ed.destroy();\r
+                               w.detachEvent('onunload', clr);\r
+                               w = w.tinyMCE = w.tinymce = null; // IE leak\r
+                       };\r
+\r
+                       // Manager commands\r
+                       switch (c) {\r
+                               case "mceFocus":\r
+                                       ed.focus();\r
+                                       return true;\r
+\r
+                               case "mceAddEditor":\r
+                               case "mceAddControl":\r
+                                       if (!t.get(v))\r
+                                               new tinymce.Editor(v, t.settings).render();\r
+\r
+                                       return true;\r
+\r
+                               case "mceAddFrameControl":\r
+                                       w = v.window;\r
+\r
+                                       // Add tinyMCE global instance and tinymce namespace to specified window\r
+                                       w.tinyMCE = tinyMCE;\r
+                                       w.tinymce = tinymce;\r
+\r
+                                       tinymce.DOM.doc = w.document;\r
+                                       tinymce.DOM.win = w;\r
+\r
+                                       ed = new tinymce.Editor(v.element_id, v);\r
+                                       ed.render();\r
+\r
+                                       // Fix IE memory leaks\r
+                                       if (tinymce.isIE) {\r
+                                               w.attachEvent('onunload', clr);\r
+                                       }\r
+\r
+                                       v.page_window = null;\r
+\r
+                                       return true;\r
+\r
+                               case "mceRemoveEditor":\r
+                               case "mceRemoveControl":\r
+                                       if (ed)\r
+                                               ed.remove();\r
+\r
+                                       return true;\r
+\r
+                               case 'mceToggleEditor':\r
+                                       if (!ed) {\r
+                                               t.execCommand('mceAddControl', 0, v);\r
+                                               return true;\r
+                                       }\r
+\r
+                                       if (ed.isHidden())\r
+                                               ed.show();\r
+                                       else\r
+                                               ed.hide();\r
+\r
+                                       return true;\r
+                       }\r
+\r
+                       // Run command on active editor\r
+                       if (t.activeEditor)\r
+                               return t.activeEditor.execCommand(c, u, v);\r
+\r
+                       return false;\r
+               },\r
+\r
+               execInstanceCommand : function(id, c, u, v) {\r
+                       var ed = this.get(id);\r
+\r
+                       if (ed)\r
+                               return ed.execCommand(c, u, v);\r
+\r
+                       return false;\r
+               },\r
+\r
+               triggerSave : function() {\r
+                       each(this.editors, function(e) {\r
+                               e.save();\r
+                       });\r
+               },\r
+\r
+               addI18n : function(p, o) {\r
+                       var lo, i18n = this.i18n;\r
+\r
+                       if (!tinymce.is(p, 'string')) {\r
+                               each(p, function(o, lc) {\r
+                                       each(o, function(o, g) {\r
+                                               each(o, function(o, k) {\r
+                                                       if (g === 'common')\r
+                                                               i18n[lc + '.' + k] = o;\r
+                                                       else\r
+                                                               i18n[lc + '.' + g + '.' + k] = o;\r
+                                               });\r
+                                       });\r
+                               });\r
+                       } else {\r
+                               each(o, function(o, k) {\r
+                                       i18n[p + '.' + k] = o;\r
+                               });\r
+                       }\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _setActive : function(editor) {\r
+                       this.selectedInstance = this.activeEditor = editor;\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       // Shorten these names\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend,\r
+               each = tinymce.each, isGecko = tinymce.isGecko,\r
+               isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is,\r
+               ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,\r
+               explode = tinymce.explode;\r
+\r
+       tinymce.create('tinymce.Editor', {\r
+               Editor : function(id, settings) {\r
+                       var self = this, TRUE = true;\r
+\r
+                       self.settings = settings = extend({\r
+                               id : id,\r
+                               language : 'en',\r
+                               theme : 'advanced',\r
+                               skin : 'default',\r
+                               delta_width : 0,\r
+                               delta_height : 0,\r
+                               popup_css : '',\r
+                               plugins : '',\r
+                               document_base_url : tinymce.documentBaseURL,\r
+                               add_form_submit_trigger : TRUE,\r
+                               submit_patch : TRUE,\r
+                               add_unload_trigger : TRUE,\r
+                               convert_urls : TRUE,\r
+                               relative_urls : TRUE,\r
+                               remove_script_host : TRUE,\r
+                               table_inline_editing : false,\r
+                               object_resizing : TRUE,\r
+                               accessibility_focus : TRUE,\r
+                               doctype : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll\r
+                               visual : TRUE,\r
+                               font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',\r
+                               font_size_legacy_values : 'xx-small,small,medium,large,x-large,xx-large,300%', // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size\r
+                               apply_source_formatting : TRUE,\r
+                               directionality : 'ltr',\r
+                               forced_root_block : 'p',\r
+                               hidden_input : TRUE,\r
+                               padd_empty_editor : TRUE,\r
+                               render_ui : TRUE,\r
+                               indentation : '30px',\r
+                               fix_table_elements : TRUE,\r
+                               inline_styles : TRUE,\r
+                               convert_fonts_to_spans : TRUE,\r
+                               indent : 'simple',\r
+                               indent_before : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist',\r
+                               indent_after : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist',\r
+                               validate : TRUE,\r
+                               entity_encoding : 'named',\r
+                               url_converter : self.convertURL,\r
+                               url_converter_scope : self,\r
+                               ie7_compat : TRUE\r
+                       }, settings);\r
+\r
+                       self.id = self.editorId = id;\r
+\r
+                       self.isNotDirty = false;\r
+\r
+                       self.plugins = {};\r
+\r
+                       self.documentBaseURI = new tinymce.util.URI(settings.document_base_url || tinymce.documentBaseURL, {\r
+                               base_uri : tinyMCE.baseURI\r
+                       });\r
+\r
+                       self.baseURI = tinymce.baseURI;\r
+\r
+                       self.contentCSS = [];\r
+\r
+                       self.contentStyles = [];\r
+\r
+                       // Creates all events like onClick, onSetContent etc see Editor.Events.js for the actual logic\r
+                       self.setupEvents();\r
+\r
+                       // Internal command handler objects\r
+                       self.execCommands = {};\r
+                       self.queryStateCommands = {};\r
+                       self.queryValueCommands = {};\r
+\r
+                       // Call setup\r
+                       self.execCallback('setup', self);\r
+               },\r
+\r
+               render : function(nst) {\r
+                       var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;\r
+\r
+                       // Page is not loaded yet, wait for it\r
+                       if (!Event.domLoaded) {\r
+                               Event.add(window, 'ready', function() {\r
+                                       t.render();\r
+                               });\r
+                               return;\r
+                       }\r
+\r
+                       tinyMCE.settings = s;\r
+\r
+                       // Element not found, then skip initialization\r
+                       if (!t.getElement())\r
+                               return;\r
+\r
+                       // Is a iPad/iPhone and not on iOS5, then skip initialization. We need to sniff \r
+                       // here since the browser says it has contentEditable support but there is no visible caret.\r
+                       if (tinymce.isIDevice && !tinymce.isIOS5)\r
+                               return;\r
+\r
+                       // Add hidden input for non input elements inside form elements\r
+                       if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))\r
+                               DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);\r
+\r
+                       // Hide target element early to prevent content flashing\r
+                       if (!s.content_editable) {\r
+                               t.orgVisibility = t.getElement().style.visibility;\r
+                               t.getElement().style.visibility = 'hidden';\r
+                       }\r
+\r
+                       if (tinymce.WindowManager)\r
+                               t.windowManager = new tinymce.WindowManager(t);\r
+\r
+                       if (s.encoding == 'xml') {\r
+                               t.onGetContent.add(function(ed, o) {\r
+                                       if (o.save)\r
+                                               o.content = DOM.encode(o.content);\r
+                               });\r
+                       }\r
+\r
+                       if (s.add_form_submit_trigger) {\r
+                               t.onSubmit.addToTop(function() {\r
+                                       if (t.initialized) {\r
+                                               t.save();\r
+                                               t.isNotDirty = 1;\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       if (s.add_unload_trigger) {\r
+                               t._beforeUnload = tinyMCE.onBeforeUnload.add(function() {\r
+                                       if (t.initialized && !t.destroyed && !t.isHidden())\r
+                                               t.save({format : 'raw', no_events : true});\r
+                               });\r
+                       }\r
+\r
+                       tinymce.addUnload(t.destroy, t);\r
+\r
+                       if (s.submit_patch) {\r
+                               t.onBeforeRenderUI.add(function() {\r
+                                       var n = t.getElement().form;\r
+\r
+                                       if (!n)\r
+                                               return;\r
+\r
+                                       // Already patched\r
+                                       if (n._mceOldSubmit)\r
+                                               return;\r
+\r
+                                       // Check page uses id="submit" or name="submit" for it's submit button\r
+                                       if (!n.submit.nodeType && !n.submit.length) {\r
+                                               t.formElement = n;\r
+                                               n._mceOldSubmit = n.submit;\r
+                                               n.submit = function() {\r
+                                                       // Save all instances\r
+                                                       tinymce.triggerSave();\r
+                                                       t.isNotDirty = 1;\r
+\r
+                                                       return t.formElement._mceOldSubmit(t.formElement);\r
+                                               };\r
+                                       }\r
+\r
+                                       n = null;\r
+                               });\r
+                       }\r
+\r
+                       // Load scripts\r
+                       function loadScripts() {\r
+                               if (s.language && s.language_load !== false)\r
+                                       sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');\r
+\r
+                               if (s.theme && typeof s.theme != "function" && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])\r
+                                       ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');\r
+\r
+                               each(explode(s.plugins), function(p) {\r
+                                       if (p &&!PluginManager.urls[p]) {\r
+                                               if (p.charAt(0) == '-') {\r
+                                                       p = p.substr(1, p.length);\r
+                                                       var dependencies = PluginManager.dependencies(p);\r
+                                                       each(dependencies, function(dep) {\r
+                                                               var defaultSettings = {prefix:'plugins/', resource: dep, suffix:'/editor_plugin' + tinymce.suffix + '.js'};\r
+                                                               dep = PluginManager.createUrl(defaultSettings, dep);\r
+                                                               PluginManager.load(dep.resource, dep);\r
+                                                       });\r
+                                               } else {\r
+                                                       // Skip safari plugin, since it is removed as of 3.3b1\r
+                                                       if (p == 'safari') {\r
+                                                               return;\r
+                                                       }\r
+                                                       PluginManager.load(p, {prefix:'plugins/', resource: p, suffix:'/editor_plugin' + tinymce.suffix + '.js'});\r
+                                               }\r
+                                       }\r
+                               });\r
+\r
+                               // Init when que is loaded\r
+                               sl.loadQueue(function() {\r
+                                       if (!t.removed)\r
+                                               t.init();\r
+                               });\r
+                       };\r
+\r
+                       loadScripts();\r
+               },\r
+\r
+               init : function() {\r
+                       var n, t = this, s = t.settings, w, h, mh, e = t.getElement(), o, ti, u, bi, bc, re, i, initializedPlugins = [];\r
+\r
+                       tinymce.add(t);\r
+\r
+                       s.aria_label = s.aria_label || DOM.getAttrib(e, 'aria-label', t.getLang('aria.rich_text_area'));\r
+\r
+                       if (s.theme) {\r
+                               if (typeof s.theme != "function") {\r
+                                       s.theme = s.theme.replace(/-/, '');\r
+                                       o = ThemeManager.get(s.theme);\r
+                                       t.theme = new o();\r
+\r
+                                       if (t.theme.init)\r
+                                               t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));\r
+                               } else {\r
+                                       t.theme = s.theme;\r
+                               }\r
+                       }\r
+\r
+                       function initPlugin(p) {\r
+                               var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;\r
+                               if (c && tinymce.inArray(initializedPlugins,p) === -1) {\r
+                                       each(PluginManager.dependencies(p), function(dep){\r
+                                               initPlugin(dep);\r
+                                       });\r
+                                       po = new c(t, u);\r
+\r
+                                       t.plugins[p] = po;\r
+\r
+                                       if (po.init) {\r
+                                               po.init(t, u);\r
+                                               initializedPlugins.push(p);\r
+                                       }\r
+                               }\r
+                       }\r
+                       \r
+                       // Create all plugins\r
+                       each(explode(s.plugins.replace(/\-/g, '')), initPlugin);\r
+\r
+                       // Setup popup CSS path(s)\r
+                       if (s.popup_css !== false) {\r
+                               if (s.popup_css)\r
+                                       s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);\r
+                               else\r
+                                       s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");\r
+                       }\r
+\r
+                       if (s.popup_css_add)\r
+                               s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);\r
+\r
+                       t.controlManager = new tinymce.ControlManager(t);\r
+\r
+                       // Enables users to override the control factory\r
+                       t.onBeforeRenderUI.dispatch(t, t.controlManager);\r
+\r
+                       // Measure box\r
+                       if (s.render_ui && t.theme) {\r
+                               t.orgDisplay = e.style.display;\r
+\r
+                               if (typeof s.theme != "function") {\r
+                                       w = s.width || e.style.width || e.offsetWidth;\r
+                                       h = s.height || e.style.height || e.offsetHeight;\r
+                                       mh = s.min_height || 100;\r
+                                       re = /^[0-9\.]+(|px)$/i;\r
+\r
+                                       if (re.test('' + w))\r
+                                               w = Math.max(parseInt(w, 10) + (o.deltaWidth || 0), 100);\r
+\r
+                                       if (re.test('' + h))\r
+                                               h = Math.max(parseInt(h, 10) + (o.deltaHeight || 0), mh);\r
+\r
+                                       // Render UI\r
+                                       o = t.theme.renderUI({\r
+                                               targetNode : e,\r
+                                               width : w,\r
+                                               height : h,\r
+                                               deltaWidth : s.delta_width,\r
+                                               deltaHeight : s.delta_height\r
+                                       });\r
+\r
+                                       // Resize editor\r
+                                       DOM.setStyles(o.sizeContainer || o.editorContainer, {\r
+                                               width : w,\r
+                                               height : h\r
+                                       });\r
+\r
+                                       h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');\r
+                                       if (h < mh)\r
+                                               h = mh;\r
+                               } else {\r
+                                       o = s.theme(t, e);\r
+\r
+                                       // Convert element type to id:s\r
+                                       if (o.editorContainer.nodeType) {\r
+                                               o.editorContainer = o.editorContainer.id = o.editorContainer.id || t.id + "_parent";\r
+                                       }\r
+\r
+                                       // Convert element type to id:s\r
+                                       if (o.iframeContainer.nodeType) {\r
+                                               o.iframeContainer = o.iframeContainer.id = o.iframeContainer.id || t.id + "_iframecontainer";\r
+                                       }\r
+\r
+                                       // Use specified iframe height or the targets offsetHeight\r
+                                       h = o.iframeHeight || e.offsetHeight;\r
+\r
+                                       // Store away the selection when it's changed to it can be restored later with a editor.focus() call\r
+                                       if (isIE) {\r
+                                               t.onInit.add(function(ed) {\r
+                                                       ed.dom.bind(ed.getBody(), 'beforedeactivate keydown', function() {\r
+                                                               ed.lastIERng = ed.selection.getRng();\r
+                                                       });\r
+                                               });\r
+                                       }\r
+                               }\r
+\r
+                               t.editorContainer = o.editorContainer;\r
+                       }\r
+\r
+                       // Load specified content CSS last\r
+                       if (s.content_css) {\r
+                               each(explode(s.content_css), function(u) {\r
+                                       t.contentCSS.push(t.documentBaseURI.toAbsolute(u));\r
+                               });\r
+                       }\r
+\r
+                       // Load specified content CSS last\r
+                       if (s.content_style) {\r
+                               t.contentStyles.push(s.content_style);\r
+                       }\r
+\r
+                       // Content editable mode ends here\r
+                       if (s.content_editable) {\r
+                               e = n = o = null; // Fix IE leak\r
+                               return t.initContentBody();\r
+                       }\r
+\r
+                       // User specified a document.domain value\r
+                       if (document.domain && location.hostname != document.domain)\r
+                               tinymce.relaxedDomain = document.domain;\r
+\r
+                       t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';\r
+\r
+                       // We only need to override paths if we have to\r
+                       // IE has a bug where it remove site absolute urls to relative ones if this is specified\r
+                       if (s.document_base_url != tinymce.documentBaseURL)\r
+                               t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';\r
+\r
+                       // IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.\r
+                       if (s.ie7_compat)\r
+                               t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';\r
+                       else\r
+                               t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';\r
+\r
+                       t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';\r
+\r
+                       // Load the CSS by injecting them into the HTML this will reduce "flicker"\r
+                       for (i = 0; i < t.contentCSS.length; i++) {\r
+                               t.iframeHTML += '<link type="text/css" rel="stylesheet" href="' + t.contentCSS[i] + '" />';\r
+                       }\r
+\r
+                       t.contentCSS = [];\r
+\r
+                       bi = s.body_id || 'tinymce';\r
+                       if (bi.indexOf('=') != -1) {\r
+                               bi = t.getParam('body_id', '', 'hash');\r
+                               bi = bi[t.id] || bi;\r
+                       }\r
+\r
+                       bc = s.body_class || '';\r
+                       if (bc.indexOf('=') != -1) {\r
+                               bc = t.getParam('body_class', '', 'hash');\r
+                               bc = bc[t.id] || '';\r
+                       }\r
+\r
+                       t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '" onload="window.parent.tinyMCE.get(\'' + t.id + '\').onLoad.dispatch();"><br></body></html>';\r
+\r
+                       // Domain relaxing enabled, then set document domain\r
+                       if (tinymce.relaxedDomain && (isIE || (tinymce.isOpera && parseFloat(opera.version()) < 11))) {\r
+                               // We need to write the contents here in IE since multiple writes messes up refresh button and back button\r
+                               u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.initContentBody();})()';\r
+                       }\r
+\r
+                       // Create iframe\r
+                       // TODO: ACC add the appropriate description on this.\r
+                       n = DOM.add(o.iframeContainer, 'iframe', { \r
+                               id : t.id + "_ifr",\r
+                               src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7\r
+                               frameBorder : '0',\r
+                               allowTransparency : "true",\r
+                               title : s.aria_label,\r
+                               style : {\r
+                                       width : '100%',\r
+                                       height : h,\r
+                                       display : 'block' // Important for Gecko to render the iframe correctly\r
+                               }\r
+                       });\r
+\r
+                       t.contentAreaContainer = o.iframeContainer;\r
+\r
+                       if (o.editorContainer) {\r
+                               DOM.get(o.editorContainer).style.display = t.orgDisplay;\r
+                       }\r
+\r
+                       // Restore visibility on target element\r
+                       e.style.visibility = t.orgVisibility;\r
+\r
+                       DOM.get(t.id).style.display = 'none';\r
+                       DOM.setAttrib(t.id, 'aria-hidden', true);\r
+\r
+                       if (!tinymce.relaxedDomain || !u)\r
+                               t.initContentBody();\r
+\r
+                       e = n = o = null; // Cleanup\r
+               },\r
+\r
+               initContentBody : function() {\r
+                       var self = this, settings = self.settings, targetElm = DOM.get(self.id), doc = self.getDoc(), html, body, contentCssText;\r
+\r
+                       // Setup iframe body\r
+                       if ((!isIE || !tinymce.relaxedDomain) && !settings.content_editable) {\r
+                               doc.open();\r
+                               doc.write(self.iframeHTML);\r
+                               doc.close();\r
+\r
+                               if (tinymce.relaxedDomain)\r
+                                       doc.domain = tinymce.relaxedDomain;\r
+                       }\r
+\r
+                       if (settings.content_editable) {\r
+                               DOM.addClass(targetElm, 'mceContentBody');\r
+                               self.contentDocument = doc = settings.content_document || document;\r
+                               self.contentWindow = settings.content_window || window;\r
+                               self.bodyElement = targetElm;\r
+\r
+                               // Prevent leak in IE\r
+                               settings.content_document = settings.content_window = null;\r
+                       }\r
+\r
+                       // It will not steal focus while setting contentEditable\r
+                       body = self.getBody();\r
+                       body.disabled = true;\r
+\r
+                       if (!settings.readonly)\r
+                               body.contentEditable = self.getParam('content_editable_state', true);\r
+\r
+                       body.disabled = false;\r
+\r
+                       self.schema = new tinymce.html.Schema(settings);\r
+\r
+                       self.dom = new tinymce.dom.DOMUtils(doc, {\r
+                               keep_values : true,\r
+                               url_converter : self.convertURL,\r
+                               url_converter_scope : self,\r
+                               hex_colors : settings.force_hex_style_colors,\r
+                               class_filter : settings.class_filter,\r
+                               update_styles : true,\r
+                               root_element : settings.content_editable ? self.id : null,\r
+                               schema : self.schema\r
+                       });\r
+\r
+                       self.parser = new tinymce.html.DomParser(settings, self.schema);\r
+\r
+                       // Convert src and href into data-mce-src, data-mce-href and data-mce-style\r
+                       self.parser.addAttributeFilter('src,href,style', function(nodes, name) {\r
+                               var i = nodes.length, node, dom = self.dom, value, internalName;\r
+\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       value = node.attr(name);\r
+                                       internalName = 'data-mce-' + name;\r
+\r
+                                       // Add internal attribute if we need to we don't on a refresh of the document\r
+                                       if (!node.attributes.map[internalName]) {       \r
+                                               if (name === "style")\r
+                                                       node.attr(internalName, dom.serializeStyle(dom.parseStyle(value), node.name));\r
+                                               else\r
+                                                       node.attr(internalName, self.convertURL(value, name, node.name));\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       // Keep scripts from executing\r
+                       self.parser.addNodeFilter('script', function(nodes, name) {\r
+                               var i = nodes.length, node;\r
+\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       node.attr('type', 'mce-' + (node.attr('type') || 'text/javascript'));\r
+                               }\r
+                       });\r
+\r
+                       self.parser.addNodeFilter('#cdata', function(nodes, name) {\r
+                               var i = nodes.length, node;\r
+\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       node.type = 8;\r
+                                       node.name = '#comment';\r
+                                       node.value = '[CDATA[' + node.value + ']]';\r
+                               }\r
+                       });\r
+\r
+                       self.parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function(nodes, name) {\r
+                               var i = nodes.length, node, nonEmptyElements = self.schema.getNonEmptyElements();\r
+\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+\r
+                                       if (node.isEmpty(nonEmptyElements))\r
+                                               node.empty().append(new tinymce.html.Node('br', 1)).shortEnded = true;\r
+                               }\r
+                       });\r
+\r
+                       self.serializer = new tinymce.dom.Serializer(settings, self.dom, self.schema);\r
+\r
+                       self.selection = new tinymce.dom.Selection(self.dom, self.getWin(), self.serializer, self);\r
+\r
+                       self.formatter = new tinymce.Formatter(self);\r
+\r
+                       self.undoManager = new tinymce.UndoManager(self);\r
+\r
+                       self.forceBlocks = new tinymce.ForceBlocks(self);\r
+                       self.enterKey = new tinymce.EnterKey(self);\r
+                       self.editorCommands = new tinymce.EditorCommands(self);\r
+\r
+                       self.onExecCommand.add(function(editor, command) {\r
+                               // Don't refresh the select lists until caret move\r
+                               if (!/^(FontName|FontSize)$/.test(command))\r
+                                       self.nodeChanged();\r
+                       });\r
+\r
+                       // Pass through\r
+                       self.serializer.onPreProcess.add(function(se, o) {\r
+                               return self.onPreProcess.dispatch(self, o, se);\r
+                       });\r
+\r
+                       self.serializer.onPostProcess.add(function(se, o) {\r
+                               return self.onPostProcess.dispatch(self, o, se);\r
+                       });\r
+\r
+                       self.onPreInit.dispatch(self);\r
+\r
+                       if (!settings.browser_spellcheck && !settings.gecko_spellcheck)\r
+                               doc.body.spellcheck = false;\r
+\r
+                       if (!settings.readonly) {\r
+                               self.bindNativeEvents();\r
+                       }\r
+\r
+                       self.controlManager.onPostRender.dispatch(self, self.controlManager);\r
+                       self.onPostRender.dispatch(self);\r
+\r
+                       self.quirks = tinymce.util.Quirks(self);\r
+\r
+                       if (settings.directionality)\r
+                               body.dir = settings.directionality;\r
+\r
+                       if (settings.nowrap)\r
+                               body.style.whiteSpace = "nowrap";\r
+\r
+                       if (settings.protect) {\r
+                               self.onBeforeSetContent.add(function(ed, o) {\r
+                                       each(settings.protect, function(pattern) {\r
+                                               o.content = o.content.replace(pattern, function(str) {\r
+                                                       return '<!--mce:protected ' + escape(str) + '-->';\r
+                                               });\r
+                                       });\r
+                               });\r
+                       }\r
+\r
+                       // Add visual aids when new contents is added\r
+                       self.onSetContent.add(function() {\r
+                               self.addVisual(self.getBody());\r
+                       });\r
+\r
+                       // Remove empty contents\r
+                       if (settings.padd_empty_editor) {\r
+                               self.onPostProcess.add(function(ed, o) {\r
+                                       o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');\r
+                               });\r
+                       }\r
+\r
+                       self.load({initial : true, format : 'html'});\r
+                       self.startContent = self.getContent({format : 'raw'});\r
+\r
+                       self.initialized = true;\r
+\r
+                       self.onInit.dispatch(self);\r
+                       self.execCallback('setupcontent_callback', self.id, body, doc);\r
+                       self.execCallback('init_instance_callback', self);\r
+                       self.focus(true);\r
+                       self.nodeChanged({initial : true});\r
+\r
+                       // Add editor specific CSS styles\r
+                       if (self.contentStyles.length > 0) {\r
+                               contentCssText = '';\r
+\r
+                               each(self.contentStyles, function(style) {\r
+                                       contentCssText += style + "\r\n";\r
+                               });\r
+\r
+                               self.dom.addStyle(contentCssText);\r
+                       }\r
+\r
+                       // Load specified content CSS last\r
+                       each(self.contentCSS, function(url) {\r
+                               self.dom.loadCSS(url);\r
+                       });\r
+\r
+                       // Handle auto focus\r
+                       if (settings.auto_focus) {\r
+                               setTimeout(function () {\r
+                                       var ed = tinymce.get(settings.auto_focus);\r
+\r
+                                       ed.selection.select(ed.getBody(), 1);\r
+                                       ed.selection.collapse(1);\r
+                                       ed.getBody().focus();\r
+                                       ed.getWin().focus();\r
+                               }, 100);\r
+                       }\r
+\r
+                       // Clean up references for IE\r
+                       targetElm = doc = body = null;\r
+               },\r
+\r
+               focus : function(skip_focus) {\r
+                       var oed, self = this, selection = self.selection, contentEditable = self.settings.content_editable, ieRng, controlElm, doc = self.getDoc(), body;\r
+\r
+                       if (!skip_focus) {\r
+                               if (self.lastIERng) {\r
+                                       selection.setRng(self.lastIERng);\r
+                               }\r
+\r
+                               // Get selected control element\r
+                               ieRng = selection.getRng();\r
+                               if (ieRng.item) {\r
+                                       controlElm = ieRng.item(0);\r
+                               }\r
+\r
+                               self._refreshContentEditable();\r
+\r
+                               // Focus the window iframe\r
+                               if (!contentEditable) {\r
+                                       self.getWin().focus();\r
+                               }\r
+\r
+                               // Focus the body as well since it's contentEditable\r
+                               if (tinymce.isGecko || contentEditable) {\r
+                                       body = self.getBody();\r
+\r
+                                       // Check for setActive since it doesn't scroll to the element\r
+                                       if (body.setActive) {\r
+                                               body.setActive();\r
+                                       } else {\r
+                                               body.focus();\r
+                                       }\r
+\r
+                                       if (contentEditable) {\r
+                                               selection.normalize();\r
+                                       }\r
+                               }\r
+\r
+                               // Restore selected control element\r
+                               // This is needed when for example an image is selected within a\r
+                               // layer a call to focus will then remove the control selection\r
+                               if (controlElm && controlElm.ownerDocument == doc) {\r
+                                       ieRng = doc.body.createControlRange();\r
+                                       ieRng.addElement(controlElm);\r
+                                       ieRng.select();\r
+                               }\r
+                       }\r
+\r
+                       if (tinymce.activeEditor != self) {\r
+                               if ((oed = tinymce.activeEditor) != null)\r
+                                       oed.onDeactivate.dispatch(oed, self);\r
+\r
+                               self.onActivate.dispatch(self, oed);\r
+                       }\r
+\r
+                       tinymce._setActive(self);\r
+               },\r
+\r
+               execCallback : function(n) {\r
+                       var t = this, f = t.settings[n], s;\r
+\r
+                       if (!f)\r
+                               return;\r
+\r
+                       // Look through lookup\r
+                       if (t.callbackLookup && (s = t.callbackLookup[n])) {\r
+                               f = s.func;\r
+                               s = s.scope;\r
+                       }\r
+\r
+                       if (is(f, 'string')) {\r
+                               s = f.replace(/\.\w+$/, '');\r
+                               s = s ? tinymce.resolve(s) : 0;\r
+                               f = tinymce.resolve(f);\r
+                               t.callbackLookup = t.callbackLookup || {};\r
+                               t.callbackLookup[n] = {func : f, scope : s};\r
+                       }\r
+\r
+                       return f.apply(s || t, Array.prototype.slice.call(arguments, 1));\r
+               },\r
+\r
+               translate : function(s) {\r
+                       var c = this.settings.language || 'en', i18n = tinymce.i18n;\r
+\r
+                       if (!s)\r
+                               return '';\r
+\r
+                       return i18n[c + '.' + s] || s.replace(/\{\#([^\}]+)\}/g, function(a, b) {\r
+                               return i18n[c + '.' + b] || '{#' + b + '}';\r
+                       });\r
+               },\r
+\r
+               getLang : function(n, dv) {\r
+                       return tinymce.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');\r
+               },\r
+\r
+               getParam : function(n, dv, ty) {\r
+                       var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;\r
+\r
+                       if (ty === 'hash') {\r
+                               o = {};\r
+\r
+                               if (is(v, 'string')) {\r
+                                       each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) {\r
+                                               v = v.split('=');\r
+\r
+                                               if (v.length > 1)\r
+                                                       o[tr(v[0])] = tr(v[1]);\r
+                                               else\r
+                                                       o[tr(v[0])] = tr(v);\r
+                                       });\r
+                               } else\r
+                                       o = v;\r
+\r
+                               return o;\r
+                       }\r
+\r
+                       return v;\r
+               },\r
+\r
+               nodeChanged : function(o) {\r
+                       var self = this, selection = self.selection, node;\r
+\r
+                       // Fix for bug #1896577 it seems that this can not be fired while the editor is loading\r
+                       if (self.initialized) {\r
+                               o = o || {};\r
+\r
+                               // Get start node\r
+                               node = selection.getStart() || self.getBody();\r
+                               node = isIE && node.ownerDocument != self.getDoc() ? self.getBody() : node; // Fix for IE initial state\r
+\r
+                               // Get parents and add them to object\r
+                               o.parents = [];\r
+                               self.dom.getParent(node, function(node) {\r
+                                       if (node.nodeName == 'BODY')\r
+                                               return true;\r
+\r
+                                       o.parents.push(node);\r
+                               });\r
+\r
+                               self.onNodeChange.dispatch(\r
+                                       self,\r
+                                       o ? o.controlManager || self.controlManager : self.controlManager,\r
+                                       node,\r
+                                       selection.isCollapsed(),\r
+                                       o\r
+                               );\r
+                       }\r
+               },\r
+\r
+               addButton : function(name, settings) {\r
+                       var self = this;\r
+\r
+                       self.buttons = self.buttons || {};\r
+                       self.buttons[name] = settings;\r
+               },\r
+\r
+               addCommand : function(name, callback, scope) {\r
+                       this.execCommands[name] = {func : callback, scope : scope || this};\r
+               },\r
+\r
+               addQueryStateHandler : function(name, callback, scope) {\r
+                       this.queryStateCommands[name] = {func : callback, scope : scope || this};\r
+               },\r
+\r
+               addQueryValueHandler : function(name, callback, scope) {\r
+                       this.queryValueCommands[name] = {func : callback, scope : scope || this};\r
+               },\r
+\r
+               addShortcut : function(pa, desc, cmd_func, sc) {\r
+                       var t = this, c;\r
+\r
+                       if (t.settings.custom_shortcuts === false)\r
+                               return false;\r
+\r
+                       t.shortcuts = t.shortcuts || {};\r
+\r
+                       if (is(cmd_func, 'string')) {\r
+                               c = cmd_func;\r
+\r
+                               cmd_func = function() {\r
+                                       t.execCommand(c, false, null);\r
+                               };\r
+                       }\r
+\r
+                       if (is(cmd_func, 'object')) {\r
+                               c = cmd_func;\r
+\r
+                               cmd_func = function() {\r
+                                       t.execCommand(c[0], c[1], c[2]);\r
+                               };\r
+                       }\r
+\r
+                       each(explode(pa), function(pa) {\r
+                               var o = {\r
+                                       func : cmd_func,\r
+                                       scope : sc || this,\r
+                                       desc : t.translate(desc),\r
+                                       alt : false,\r
+                                       ctrl : false,\r
+                                       shift : false\r
+                               };\r
+\r
+                               each(explode(pa, '+'), function(v) {\r
+                                       switch (v) {\r
+                                               case 'alt':\r
+                                               case 'ctrl':\r
+                                               case 'shift':\r
+                                                       o[v] = true;\r
+                                                       break;\r
+\r
+                                               default:\r
+                                                       o.charCode = v.charCodeAt(0);\r
+                                                       o.keyCode = v.toUpperCase().charCodeAt(0);\r
+                                       }\r
+                               });\r
+\r
+                               t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;\r
+                       });\r
+\r
+                       return true;\r
+               },\r
+\r
+               execCommand : function(cmd, ui, val, a) {\r
+                       var t = this, s = 0, o, st;\r
+\r
+                       if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))\r
+                               t.focus();\r
+\r
+                       a = extend({}, a);\r
+                       t.onBeforeExecCommand.dispatch(t, cmd, ui, val, a);\r
+                       if (a.terminate)\r
+                               return false;\r
+\r
+                       // Command callback\r
+                       if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) {\r
+                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                               return true;\r
+                       }\r
+\r
+                       // Registred commands\r
+                       if (o = t.execCommands[cmd]) {\r
+                               st = o.func.call(o.scope, ui, val);\r
+\r
+                               // Fall through on true\r
+                               if (st !== true) {\r
+                                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                                       return st;\r
+                               }\r
+                       }\r
+\r
+                       // Plugin commands\r
+                       each(t.plugins, function(p) {\r
+                               if (p.execCommand && p.execCommand(cmd, ui, val)) {\r
+                                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                                       s = 1;\r
+                                       return false;\r
+                               }\r
+                       });\r
+\r
+                       if (s)\r
+                               return true;\r
+\r
+                       // Theme commands\r
+                       if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {\r
+                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                               return true;\r
+                       }\r
+\r
+                       // Editor commands\r
+                       if (t.editorCommands.execCommand(cmd, ui, val)) {\r
+                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                               return true;\r
+                       }\r
+\r
+                       // Browser commands\r
+                       t.getDoc().execCommand(cmd, ui, val);\r
+                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+               },\r
+\r
+               queryCommandState : function(cmd) {\r
+                       var t = this, o, s;\r
+\r
+                       // Is hidden then return undefined\r
+                       if (t._isHidden())\r
+                               return;\r
+\r
+                       // Registred commands\r
+                       if (o = t.queryStateCommands[cmd]) {\r
+                               s = o.func.call(o.scope);\r
+\r
+                               // Fall though on true\r
+                               if (s !== true)\r
+                                       return s;\r
+                       }\r
+\r
+                       // Registred commands\r
+                       o = t.editorCommands.queryCommandState(cmd);\r
+                       if (o !== -1)\r
+                               return o;\r
+\r
+                       // Browser commands\r
+                       try {\r
+                               return this.getDoc().queryCommandState(cmd);\r
+                       } catch (ex) {\r
+                               // Fails sometimes see bug: 1896577\r
+                       }\r
+               },\r
+\r
+               queryCommandValue : function(c) {\r
+                       var t = this, o, s;\r
+\r
+                       // Is hidden then return undefined\r
+                       if (t._isHidden())\r
+                               return;\r
+\r
+                       // Registred commands\r
+                       if (o = t.queryValueCommands[c]) {\r
+                               s = o.func.call(o.scope);\r
+\r
+                               // Fall though on true\r
+                               if (s !== true)\r
+                                       return s;\r
+                       }\r
+\r
+                       // Registred commands\r
+                       o = t.editorCommands.queryCommandValue(c);\r
+                       if (is(o))\r
+                               return o;\r
+\r
+                       // Browser commands\r
+                       try {\r
+                               return this.getDoc().queryCommandValue(c);\r
+                       } catch (ex) {\r
+                               // Fails sometimes see bug: 1896577\r
+                       }\r
+               },\r
+\r
+               show : function() {\r
+                       var self = this;\r
+\r
+                       DOM.show(self.getContainer());\r
+                       DOM.hide(self.id);\r
+                       self.load();\r
+               },\r
+\r
+               hide : function() {\r
+                       var self = this, doc = self.getDoc();\r
+\r
+                       // Fixed bug where IE has a blinking cursor left from the editor\r
+                       if (isIE && doc)\r
+                               doc.execCommand('SelectAll');\r
+\r
+                       // We must save before we hide so Safari doesn't crash\r
+                       self.save();\r
+                       DOM.hide(self.getContainer());\r
+                       DOM.setStyle(self.id, 'display', self.orgDisplay);\r
+               },\r
+\r
+               isHidden : function() {\r
+                       return !DOM.isHidden(this.id);\r
+               },\r
+\r
+               setProgressState : function(b, ti, o) {\r
+                       this.onSetProgressState.dispatch(this, b, ti, o);\r
+\r
+                       return b;\r
+               },\r
+\r
+               load : function(o) {\r
+                       var t = this, e = t.getElement(), h;\r
+\r
+                       if (e) {\r
+                               o = o || {};\r
+                               o.load = true;\r
+\r
+                               // Double encode existing entities in the value\r
+                               h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);\r
+                               o.element = e;\r
+\r
+                               if (!o.no_events)\r
+                                       t.onLoadContent.dispatch(t, o);\r
+\r
+                               o.element = e = null;\r
+\r
+                               return h;\r
+                       }\r
+               },\r
+\r
+               save : function(o) {\r
+                       var t = this, e = t.getElement(), h, f;\r
+\r
+                       if (!e || !t.initialized)\r
+                               return;\r
+\r
+                       o = o || {};\r
+                       o.save = true;\r
+\r
+                       o.element = e;\r
+                       h = o.content = t.getContent(o);\r
+\r
+                       if (!o.no_events)\r
+                               t.onSaveContent.dispatch(t, o);\r
+\r
+                       h = o.content;\r
+\r
+                       if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {\r
+                               e.innerHTML = h;\r
+\r
+                               // Update hidden form element\r
+                               if (f = DOM.getParent(t.id, 'form')) {\r
+                                       each(f.elements, function(e) {\r
+                                               if (e.name == t.id) {\r
+                                                       e.value = h;\r
+                                                       return false;\r
+                                               }\r
+                                       });\r
+                               }\r
+                       } else\r
+                               e.value = h;\r
+\r
+                       o.element = e = null;\r
+\r
+                       return h;\r
+               },\r
+\r
+               setContent : function(content, args) {\r
+                       var self = this, rootNode, body = self.getBody(), forcedRootBlockName;\r
+\r
+                       // Setup args object\r
+                       args = args || {};\r
+                       args.format = args.format || 'html';\r
+                       args.set = true;\r
+                       args.content = content;\r
+\r
+                       // Do preprocessing\r
+                       if (!args.no_events)\r
+                               self.onBeforeSetContent.dispatch(self, args);\r
+\r
+                       content = args.content;\r
+\r
+                       // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content\r
+                       // It will also be impossible to place the caret in the editor unless there is a BR element present\r
+                       if (!tinymce.isIE && (content.length === 0 || /^\s+$/.test(content))) {\r
+                               forcedRootBlockName = self.settings.forced_root_block;\r
+                               if (forcedRootBlockName)\r
+                                       content = '<' + forcedRootBlockName + '><br data-mce-bogus="1"></' + forcedRootBlockName + '>';\r
+                               else\r
+                                       content = '<br data-mce-bogus="1">';\r
+\r
+                               body.innerHTML = content;\r
+                               self.selection.select(body, true);\r
+                               self.selection.collapse(true);\r
+                               return;\r
+                       }\r
+\r
+                       // Parse and serialize the html\r
+                       if (args.format !== 'raw') {\r
+                               content = new tinymce.html.Serializer({}, self.schema).serialize(\r
+                                       self.parser.parse(content)\r
+                               );\r
+                       }\r
+\r
+                       // Set the new cleaned contents to the editor\r
+                       args.content = tinymce.trim(content);\r
+                       self.dom.setHTML(body, args.content);\r
+\r
+                       // Do post processing\r
+                       if (!args.no_events)\r
+                               self.onSetContent.dispatch(self, args);\r
+\r
+                       // Don't normalize selection if the focused element isn't the body in content editable mode since it will steal focus otherwise\r
+                       if (!self.settings.content_editable || document.activeElement === self.getBody()) {\r
+                               self.selection.normalize();\r
+                       }\r
+\r
+                       return args.content;\r
+               },\r
+\r
+               getContent : function(args) {\r
+                       var self = this, content, body = self.getBody();\r
+\r
+                       // Setup args object\r
+                       args = args || {};\r
+                       args.format = args.format || 'html';\r
+                       args.get = true;\r
+                       args.getInner = true;\r
+\r
+                       // Do preprocessing\r
+                       if (!args.no_events)\r
+                               self.onBeforeGetContent.dispatch(self, args);\r
+\r
+                       // Get raw contents or by default the cleaned contents\r
+                       if (args.format == 'raw')\r
+                               content = body.innerHTML;\r
+                       else if (args.format == 'text')\r
+                               content = body.innerText || body.textContent;\r
+                       else\r
+                               content = self.serializer.serialize(body, args);\r
+\r
+                       // Trim whitespace in beginning/end of HTML\r
+                       if (args.format != 'text') {\r
+                               args.content = tinymce.trim(content);\r
+                       } else {\r
+                               args.content = content;\r
+                       }\r
+\r
+                       // Do post processing\r
+                       if (!args.no_events)\r
+                               self.onGetContent.dispatch(self, args);\r
+\r
+                       return args.content;\r
+               },\r
+\r
+               isDirty : function() {\r
+                       var self = this;\r
+\r
+                       return tinymce.trim(self.startContent) != tinymce.trim(self.getContent({format : 'raw', no_events : 1})) && !self.isNotDirty;\r
+               },\r
+\r
+               getContainer : function() {\r
+                       var self = this;\r
+\r
+                       if (!self.container)\r
+                               self.container = DOM.get(self.editorContainer || self.id + '_parent');\r
+\r
+                       return self.container;\r
+               },\r
+\r
+               getContentAreaContainer : function() {\r
+                       return this.contentAreaContainer;\r
+               },\r
+\r
+               getElement : function() {\r
+                       return DOM.get(this.settings.content_element || this.id);\r
+               },\r
+\r
+               getWin : function() {\r
+                       var self = this, elm;\r
+\r
+                       if (!self.contentWindow) {\r
+                               elm = DOM.get(self.id + "_ifr");\r
+\r
+                               if (elm)\r
+                                       self.contentWindow = elm.contentWindow;\r
+                       }\r
+\r
+                       return self.contentWindow;\r
+               },\r
+\r
+               getDoc : function() {\r
+                       var self = this, win;\r
+\r
+                       if (!self.contentDocument) {\r
+                               win = self.getWin();\r
+\r
+                               if (win)\r
+                                       self.contentDocument = win.document;\r
+                       }\r
+\r
+                       return self.contentDocument;\r
+               },\r
+\r
+               getBody : function() {\r
+                       return this.bodyElement || this.getDoc().body;\r
+               },\r
+\r
+               convertURL : function(url, name, elm) {\r
+                       var self = this, settings = self.settings;\r
+\r
+                       // Use callback instead\r
+                       if (settings.urlconverter_callback)\r
+                               return self.execCallback('urlconverter_callback', url, elm, true, name);\r
+\r
+                       // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs\r
+                       if (!settings.convert_urls || (elm && elm.nodeName == 'LINK') || url.indexOf('file:') === 0)\r
+                               return url;\r
+\r
+                       // Convert to relative\r
+                       if (settings.relative_urls)\r
+                               return self.documentBaseURI.toRelative(url);\r
+\r
+                       // Convert to absolute\r
+                       url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host);\r
+\r
+                       return url;\r
+               },\r
+\r
+               addVisual : function(elm) {\r
+                       var self = this, settings = self.settings, dom = self.dom, cls;\r
+\r
+                       elm = elm || self.getBody();\r
+\r
+                       if (!is(self.hasVisual))\r
+                               self.hasVisual = settings.visual;\r
+\r
+                       each(dom.select('table,a', elm), function(elm) {\r
+                               var value;\r
+\r
+                               switch (elm.nodeName) {\r
+                                       case 'TABLE':\r
+                                               cls = settings.visual_table_class || 'mceItemTable';\r
+                                               value = dom.getAttrib(elm, 'border');\r
+\r
+                                               if (!value || value == '0') {\r
+                                                       if (self.hasVisual)\r
+                                                               dom.addClass(elm, cls);\r
+                                                       else\r
+                                                               dom.removeClass(elm, cls);\r
+                                               }\r
+\r
+                                               return;\r
+\r
+                                       case 'A':\r
+                                               if (!dom.getAttrib(elm, 'href', false)) {\r
+                                                       value = dom.getAttrib(elm, 'name') || elm.id;\r
+                                                       cls = 'mceItemAnchor';\r
+\r
+                                                       if (value) {\r
+                                                               if (self.hasVisual)\r
+                                                                       dom.addClass(elm, cls);\r
+                                                               else\r
+                                                                       dom.removeClass(elm, cls);\r
+                                                       }\r
+                                               }\r
+\r
+                                               return;\r
+                               }\r
+                       });\r
+\r
+                       self.onVisualAid.dispatch(self, elm, self.hasVisual);\r
+               },\r
+\r
+               remove : function() {\r
+                       var self = this, elm = self.getContainer();\r
+\r
+                       if (!self.removed) {\r
+                               self.removed = 1; // Cancels post remove event execution\r
+                               self.hide();\r
+\r
+                               // Don't clear the window or document if content editable\r
+                               // is enabled since other instances might still be present\r
+                               if (!self.settings.content_editable) {\r
+                                       Event.unbind(self.getWin());\r
+                                       Event.unbind(self.getDoc());\r
+                               }\r
+\r
+                               Event.unbind(self.getBody());\r
+                               Event.clear(elm);\r
+\r
+                               self.execCallback('remove_instance_callback', self);\r
+                               self.onRemove.dispatch(self);\r
+\r
+                               // Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command\r
+                               self.onExecCommand.listeners = [];\r
+\r
+                               tinymce.remove(self);\r
+                               DOM.remove(elm);\r
+                       }\r
+               },\r
+\r
+               destroy : function(s) {\r
+                       var t = this;\r
+\r
+                       // One time is enough\r
+                       if (t.destroyed)\r
+                               return;\r
+\r
+                       // We must unbind on Gecko since it would otherwise produce the pesky "attempt to run compile-and-go script on a cleared scope" message\r
+                       if (isGecko) {\r
+                               Event.unbind(t.getDoc());\r
+                               Event.unbind(t.getWin());\r
+                               Event.unbind(t.getBody());\r
+                       }\r
+\r
+                       if (!s) {\r
+                               tinymce.removeUnload(t.destroy);\r
+                               tinyMCE.onBeforeUnload.remove(t._beforeUnload);\r
+\r
+                               // Manual destroy\r
+                               if (t.theme && t.theme.destroy)\r
+                                       t.theme.destroy();\r
+\r
+                               // Destroy controls, selection and dom\r
+                               t.controlManager.destroy();\r
+                               t.selection.destroy();\r
+                               t.dom.destroy();\r
+                       }\r
+\r
+                       if (t.formElement) {\r
+                               t.formElement.submit = t.formElement._mceOldSubmit;\r
+                               t.formElement._mceOldSubmit = null;\r
+                       }\r
+\r
+                       t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;\r
+\r
+                       if (t.selection)\r
+                               t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;\r
+\r
+                       t.destroyed = 1;\r
+               },\r
+\r
+               // Internal functions\r
+\r
+               _refreshContentEditable : function() {\r
+                       var self = this, body, parent;\r
+\r
+                       // Check if the editor was hidden and the re-initalize contentEditable mode by removing and adding the body again\r
+                       if (self._isHidden()) {\r
+                               body = self.getBody();\r
+                               parent = body.parentNode;\r
+\r
+                               parent.removeChild(body);\r
+                               parent.appendChild(body);\r
+\r
+                               body.focus();\r
+                       }\r
+               },\r
+\r
+               _isHidden : function() {\r
+                       var s;\r
+\r
+                       if (!isGecko)\r
+                               return 0;\r
+\r
+                       // Weird, wheres that cursor selection?\r
+                       s = this.selection.getSel();\r
+                       return (!s || !s.rangeCount || s.rangeCount === 0);\r
+               }\r
+       });\r
+})(tinymce);\r
+(function(tinymce) {\r
+       var each = tinymce.each;\r
+\r
+       tinymce.Editor.prototype.setupEvents = function() {\r
+               var self = this, settings = self.settings;\r
+\r
+               // Add events to the editor\r
+               each([\r
+                       'onPreInit',\r
+\r
+                       'onBeforeRenderUI',\r
+\r
+                       'onPostRender',\r
+\r
+                       'onLoad',\r
+\r
+                       'onInit',\r
+\r
+                       'onRemove',\r
+\r
+                       'onActivate',\r
+\r
+                       'onDeactivate',\r
+\r
+                       'onClick',\r
+\r
+                       'onEvent',\r
+\r
+                       'onMouseUp',\r
+\r
+                       'onMouseDown',\r
+\r
+                       'onDblClick',\r
+\r
+                       'onKeyDown',\r
+\r
+                       'onKeyUp',\r
+\r
+                       'onKeyPress',\r
+\r
+                       'onContextMenu',\r
+\r
+                       'onSubmit',\r
+\r
+                       'onReset',\r
+\r
+                       'onPaste',\r
+\r
+                       'onPreProcess',\r
+\r
+                       'onPostProcess',\r
+\r
+                       'onBeforeSetContent',\r
+\r
+                       'onBeforeGetContent',\r
+\r
+                       'onSetContent',\r
+\r
+                       'onGetContent',\r
+\r
+                       'onLoadContent',\r
+\r
+                       'onSaveContent',\r
+\r
+                       'onNodeChange',\r
+\r
+                       'onChange',\r
+\r
+                       'onBeforeExecCommand',\r
+\r
+                       'onExecCommand',\r
+\r
+                       'onUndo',\r
+\r
+                       'onRedo',\r
+\r
+                       'onVisualAid',\r
+\r
+                       'onSetProgressState',\r
+\r
+                       'onSetAttrib'\r
+               ], function(name) {\r
+                       self[name] = new tinymce.util.Dispatcher(self);\r
+               });\r
+\r
+               // Handle legacy cleanup_callback option\r
+               if (settings.cleanup_callback) {\r
+                       self.onBeforeSetContent.add(function(ed, o) {\r
+                               o.content = ed.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);\r
+                       });\r
+\r
+                       self.onPreProcess.add(function(ed, o) {\r
+                               if (o.set)\r
+                                       ed.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);\r
+\r
+                               if (o.get)\r
+                                       ed.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);\r
+                       });\r
+\r
+                       self.onPostProcess.add(function(ed, o) {\r
+                               if (o.set)\r
+                                       o.content = ed.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);\r
+\r
+                               if (o.get)                                              \r
+                                       o.content = ed.execCallback('cleanup_callback', 'get_from_editor', o.content, o);\r
+                       });\r
+               }\r
+\r
+               // Handle legacy save_callback option\r
+               if (settings.save_callback) {\r
+                       self.onGetContent.add(function(ed, o) {\r
+                               if (o.save)\r
+                                       o.content = ed.execCallback('save_callback', ed.id, o.content, ed.getBody());\r
+                       });\r
+               }\r
+\r
+               // Handle legacy handle_event_callback option\r
+               if (settings.handle_event_callback) {\r
+                       self.onEvent.add(function(ed, e, o) {\r
+                               if (self.execCallback('handle_event_callback', e, ed, o) === false) {\r
+                                       e.preventDefault();\r
+                                       e.stopPropagation();\r
+                               }\r
+                       });\r
+               }\r
+\r
+               // Handle legacy handle_node_change_callback option\r
+               if (settings.handle_node_change_callback) {\r
+                       self.onNodeChange.add(function(ed, cm, n) {\r
+                               ed.execCallback('handle_node_change_callback', ed.id, n, -1, -1, true, ed.selection.isCollapsed());\r
+                       });\r
+               }\r
+\r
+               // Handle legacy save_callback option\r
+               if (settings.save_callback) {\r
+                       self.onSaveContent.add(function(ed, o) {\r
+                               var h = ed.execCallback('save_callback', ed.id, o.content, ed.getBody());\r
+\r
+                               if (h)\r
+                                       o.content = h;\r
+                       });\r
+               }\r
+\r
+               // Handle legacy onchange_callback option\r
+               if (settings.onchange_callback) {\r
+                       self.onChange.add(function(ed, l) {\r
+                               ed.execCallback('onchange_callback', ed, l);\r
+                       });\r
+               }\r
+       };\r
+\r
+       tinymce.Editor.prototype.bindNativeEvents = function() {\r
+               // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset\r
+               var self = this, i, settings = self.settings, dom = self.dom, nativeToDispatcherMap;\r
+\r
+               nativeToDispatcherMap = {\r
+                       mouseup : 'onMouseUp',\r
+                       mousedown : 'onMouseDown',\r
+                       click : 'onClick',\r
+                       keyup : 'onKeyUp',\r
+                       keydown : 'onKeyDown',\r
+                       keypress : 'onKeyPress',\r
+                       submit : 'onSubmit',\r
+                       reset : 'onReset',\r
+                       contextmenu : 'onContextMenu',\r
+                       dblclick : 'onDblClick',\r
+                       paste : 'onPaste' // Doesn't work in all browsers yet\r
+               };\r
+\r
+               // Handler that takes a native event and sends it out to a dispatcher like onKeyDown\r
+               function eventHandler(evt, args) {\r
+                       var type = evt.type;\r
+\r
+                       // Don't fire events when it's removed\r
+                       if (self.removed)\r
+                               return;\r
+\r
+                       // Sends the native event out to a global dispatcher then to the specific event dispatcher\r
+                       if (self.onEvent.dispatch(self, evt, args) !== false) {\r
+                               self[nativeToDispatcherMap[evt.fakeType || evt.type]].dispatch(self, evt, args);\r
+                       }\r
+               };\r
+\r
+               // Opera doesn't support focus event for contentEditable elements so we need to fake it\r
+               function doOperaFocus(e) {\r
+                       self.focus(true);\r
+               };\r
+\r
+               function nodeChanged(ed, e) {\r
+                       // Normalize selection for example <b>a</b><i>|a</i> becomes <b>a|</b><i>a</i> except for Ctrl+A since it selects everything\r
+                       if (e.keyCode != 65 || !tinymce.VK.metaKeyPressed(e)) {\r
+                               self.selection.normalize();\r
+                       }\r
+\r
+                       self.nodeChanged();\r
+               }\r
+\r
+               // Add DOM events\r
+               each(nativeToDispatcherMap, function(dispatcherName, nativeName) {\r
+                       var root = settings.content_editable ? self.getBody() : self.getDoc();\r
+\r
+                       switch (nativeName) {\r
+                               case 'contextmenu':\r
+                                       dom.bind(root, nativeName, eventHandler);\r
+                                       break;\r
+\r
+                               case 'paste':\r
+                                       dom.bind(self.getBody(), nativeName, eventHandler);\r
+                                       break;\r
+\r
+                               case 'submit':\r
+                               case 'reset':\r
+                                       dom.bind(self.getElement().form || tinymce.DOM.getParent(self.id, 'form'), nativeName, eventHandler);\r
+                                       break;\r
+\r
+                               default:\r
+                                       dom.bind(root, nativeName, eventHandler);\r
+                       }\r
+               });\r
+\r
+               // Set the editor as active when focused\r
+               dom.bind(settings.content_editable ? self.getBody() : (tinymce.isGecko ? self.getDoc() : self.getWin()), 'focus', function(e) {\r
+                       self.focus(true);\r
+               });\r
+\r
+               if (settings.content_editable && tinymce.isOpera) {\r
+                       dom.bind(self.getBody(), 'click', doOperaFocus);\r
+                       dom.bind(self.getBody(), 'keydown', doOperaFocus);\r
+               }\r
+\r
+               // Add node change handler\r
+               self.onMouseUp.add(nodeChanged);\r
+\r
+               self.onKeyUp.add(function(ed, e) {\r
+                       var keyCode = e.keyCode;\r
+\r
+                       if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 13 || keyCode == 45 || keyCode == 46 || keyCode == 8 || (tinymce.isMac && (keyCode == 91 || keyCode == 93)) || e.ctrlKey)\r
+                               nodeChanged(ed, e);\r
+               });\r
+\r
+               // Add reset handler\r
+               self.onReset.add(function() {\r
+                       self.setContent(self.startContent, {format : 'raw'});\r
+               });\r
+\r
+               // Add shortcuts\r
+               function handleShortcut(e, execute) {\r
+                       if (e.altKey || e.ctrlKey || e.metaKey) {\r
+                               each(self.shortcuts, function(shortcut) {\r
+                                       var ctrlState = tinymce.isMac ? e.metaKey : e.ctrlKey;\r
+\r
+                                       if (shortcut.ctrl != ctrlState || shortcut.alt != e.altKey || shortcut.shift != e.shiftKey)\r
+                                               return;\r
+\r
+                                       if (e.keyCode == shortcut.keyCode || (e.charCode && e.charCode == shortcut.charCode)) {\r
+                                               e.preventDefault();\r
+\r
+                                               if (execute) {\r
+                                                       shortcut.func.call(shortcut.scope);\r
+                                               }\r
+\r
+                                               return true;\r
+                                       }\r
+                               });\r
+                       }\r
+               };\r
+\r
+               self.onKeyUp.add(function(ed, e) {\r
+                       handleShortcut(e);\r
+               });\r
+\r
+               self.onKeyPress.add(function(ed, e) {\r
+                       handleShortcut(e);\r
+               });\r
+\r
+               self.onKeyDown.add(function(ed, e) {\r
+                       handleShortcut(e, true);\r
+               });\r
+\r
+               if (tinymce.isOpera) {\r
+                       self.onClick.add(function(ed, e) {\r
+                               e.preventDefault();\r
+                       });\r
+               }\r
+       };\r
+})(tinymce);\r
+(function(tinymce) {\r
+       // Added for compression purposes\r
+       var each = tinymce.each, undef, TRUE = true, FALSE = false;\r
+\r
+       tinymce.EditorCommands = function(editor) {\r
+               var dom = editor.dom,\r
+                       selection = editor.selection,\r
+                       commands = {state: {}, exec : {}, value : {}},\r
+                       settings = editor.settings,\r
+                       formatter = editor.formatter,\r
+                       bookmark;\r
+\r
+               function execCommand(command, ui, value) {\r
+                       var func;\r
+\r
+                       command = command.toLowerCase();\r
+                       if (func = commands.exec[command]) {\r
+                               func(command, ui, value);\r
+                               return TRUE;\r
+                       }\r
+\r
+                       return FALSE;\r
+               };\r
+\r
+               function queryCommandState(command) {\r
+                       var func;\r
+\r
+                       command = command.toLowerCase();\r
+                       if (func = commands.state[command])\r
+                               return func(command);\r
+\r
+                       return -1;\r
+               };\r
+\r
+               function queryCommandValue(command) {\r
+                       var func;\r
+\r
+                       command = command.toLowerCase();\r
+                       if (func = commands.value[command])\r
+                               return func(command);\r
+\r
+                       return FALSE;\r
+               };\r
+\r
+               function addCommands(command_list, type) {\r
+                       type = type || 'exec';\r
+\r
+                       each(command_list, function(callback, command) {\r
+                               each(command.toLowerCase().split(','), function(command) {\r
+                                       commands[type][command] = callback;\r
+                               });\r
+                       });\r
+               };\r
+\r
+               // Expose public methods\r
+               tinymce.extend(this, {\r
+                       execCommand : execCommand,\r
+                       queryCommandState : queryCommandState,\r
+                       queryCommandValue : queryCommandValue,\r
+                       addCommands : addCommands\r
+               });\r
+\r
+               // Private methods\r
+\r
+               function execNativeCommand(command, ui, value) {\r
+                       if (ui === undef)\r
+                               ui = FALSE;\r
+\r
+                       if (value === undef)\r
+                               value = null;\r
+\r
+                       return editor.getDoc().execCommand(command, ui, value);\r
+               };\r
+\r
+               function isFormatMatch(name) {\r
+                       return formatter.match(name);\r
+               };\r
+\r
+               function toggleFormat(name, value) {\r
+                       formatter.toggle(name, value ? {value : value} : undef);\r
+               };\r
+\r
+               function storeSelection(type) {\r
+                       bookmark = selection.getBookmark(type);\r
+               };\r
+\r
+               function restoreSelection() {\r
+                       selection.moveToBookmark(bookmark);\r
+               };\r
+\r
+               // Add execCommand overrides\r
+               addCommands({\r
+                       // Ignore these, added for compatibility\r
+                       'mceResetDesignMode,mceBeginUndoLevel' : function() {},\r
+\r
+                       // Add undo manager logic\r
+                       'mceEndUndoLevel,mceAddUndoLevel' : function() {\r
+                               editor.undoManager.add();\r
+                       },\r
+\r
+                       'Cut,Copy,Paste' : function(command) {\r
+                               var doc = editor.getDoc(), failed;\r
+\r
+                               // Try executing the native command\r
+                               try {\r
+                                       execNativeCommand(command);\r
+                               } catch (ex) {\r
+                                       // Command failed\r
+                                       failed = TRUE;\r
+                               }\r
+\r
+                               // Present alert message about clipboard access not being available\r
+                               if (failed || !doc.queryCommandSupported(command)) {\r
+                                       if (tinymce.isGecko) {\r
+                                               editor.windowManager.confirm(editor.getLang('clipboard_msg'), function(state) {\r
+                                                       if (state)\r
+                                                               open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');\r
+                                               });\r
+                                       } else\r
+                                               editor.windowManager.alert(editor.getLang('clipboard_no_support'));\r
+                               }\r
+                       },\r
+\r
+                       // Override unlink command\r
+                       unlink : function(command) {\r
+                               if (selection.isCollapsed())\r
+                                       selection.select(selection.getNode());\r
+\r
+                               execNativeCommand(command);\r
+                               selection.collapse(FALSE);\r
+                       },\r
+\r
+                       // Override justify commands to use the text formatter engine\r
+                       'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {\r
+                               var align = command.substring(7);\r
+\r
+                               // Remove all other alignments first\r
+                               each('left,center,right,full'.split(','), function(name) {\r
+                                       if (align != name)\r
+                                               formatter.remove('align' + name);\r
+                               });\r
+\r
+                               toggleFormat('align' + align);\r
+                               execCommand('mceRepaint');\r
+                       },\r
+\r
+                       // Override list commands to fix WebKit bug\r
+                       'InsertUnorderedList,InsertOrderedList' : function(command) {\r
+                               var listElm, listParent;\r
+\r
+                               execNativeCommand(command);\r
+\r
+                               // WebKit produces lists within block elements so we need to split them\r
+                               // we will replace the native list creation logic to custom logic later on\r
+                               // TODO: Remove this when the list creation logic is removed\r
+                               listElm = dom.getParent(selection.getNode(), 'ol,ul');\r
+                               if (listElm) {\r
+                                       listParent = listElm.parentNode;\r
+\r
+                                       // If list is within a text block then split that block\r
+                                       if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {\r
+                                               storeSelection();\r
+                                               dom.split(listParent, listElm);\r
+                                               restoreSelection();\r
+                                       }\r
+                               }\r
+                       },\r
+\r
+                       // Override commands to use the text formatter engine\r
+                       'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {\r
+                               toggleFormat(command);\r
+                       },\r
+\r
+                       // Override commands to use the text formatter engine\r
+                       'ForeColor,HiliteColor,FontName' : function(command, ui, value) {\r
+                               toggleFormat(command, value);\r
+                       },\r
+\r
+                       FontSize : function(command, ui, value) {\r
+                               var fontClasses, fontSizes;\r
+\r
+                               // Convert font size 1-7 to styles\r
+                               if (value >= 1 && value <= 7) {\r
+                                       fontSizes = tinymce.explode(settings.font_size_style_values);\r
+                                       fontClasses = tinymce.explode(settings.font_size_classes);\r
+\r
+                                       if (fontClasses)\r
+                                               value = fontClasses[value - 1] || value;\r
+                                       else\r
+                                               value = fontSizes[value - 1] || value;\r
+                               }\r
+\r
+                               toggleFormat(command, value);\r
+                       },\r
+\r
+                       RemoveFormat : function(command) {\r
+                               formatter.remove(command);\r
+                       },\r
+\r
+                       mceBlockQuote : function(command) {\r
+                               toggleFormat('blockquote');\r
+                       },\r
+\r
+                       FormatBlock : function(command, ui, value) {\r
+                               return toggleFormat(value || 'p');\r
+                       },\r
+\r
+                       mceCleanup : function() {\r
+                               var bookmark = selection.getBookmark();\r
+\r
+                               editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});\r
+\r
+                               selection.moveToBookmark(bookmark);\r
+                       },\r
+\r
+                       mceRemoveNode : function(command, ui, value) {\r
+                               var node = value || selection.getNode();\r
+\r
+                               // Make sure that the body node isn't removed\r
+                               if (node != editor.getBody()) {\r
+                                       storeSelection();\r
+                                       editor.dom.remove(node, TRUE);\r
+                                       restoreSelection();\r
+                               }\r
+                       },\r
+\r
+                       mceSelectNodeDepth : function(command, ui, value) {\r
+                               var counter = 0;\r
+\r
+                               dom.getParent(selection.getNode(), function(node) {\r
+                                       if (node.nodeType == 1 && counter++ == value) {\r
+                                               selection.select(node);\r
+                                               return FALSE;\r
+                                       }\r
+                               }, editor.getBody());\r
+                       },\r
+\r
+                       mceSelectNode : function(command, ui, value) {\r
+                               selection.select(value);\r
+                       },\r
+\r
+                       mceInsertContent : function(command, ui, value) {\r
+                               var parser, serializer, parentNode, rootNode, fragment, args,\r
+                                       marker, nodeRect, viewPortRect, rng, node, node2, bookmarkHtml, viewportBodyElement;\r
+\r
+                               //selection.normalize();\r
+\r
+                               // Setup parser and serializer\r
+                               parser = editor.parser;\r
+                               serializer = new tinymce.html.Serializer({}, editor.schema);\r
+                               bookmarkHtml = '<span id="mce_marker" data-mce-type="bookmark">\uFEFF</span>';\r
+\r
+                               // Run beforeSetContent handlers on the HTML to be inserted\r
+                               args = {content: value, format: 'html'};\r
+                               selection.onBeforeSetContent.dispatch(selection, args);\r
+                               value = args.content;\r
+\r
+                               // Add caret at end of contents if it's missing\r
+                               if (value.indexOf('{$caret}') == -1)\r
+                                       value += '{$caret}';\r
+\r
+                               // Replace the caret marker with a span bookmark element\r
+                               value = value.replace(/\{\$caret\}/, bookmarkHtml);\r
+\r
+                               // Insert node maker where we will insert the new HTML and get it's parent\r
+                               if (!selection.isCollapsed())\r
+                                       editor.getDoc().execCommand('Delete', false, null);\r
+\r
+                               parentNode = selection.getNode();\r
+\r
+                               // Parse the fragment within the context of the parent node\r
+                               args = {context : parentNode.nodeName.toLowerCase()};\r
+                               fragment = parser.parse(value, args);\r
+\r
+                               // Move the caret to a more suitable location\r
+                               node = fragment.lastChild;\r
+                               if (node.attr('id') == 'mce_marker') {\r
+                                       marker = node;\r
+\r
+                                       for (node = node.prev; node; node = node.walk(true)) {\r
+                                               if (node.type == 3 || !dom.isBlock(node.name)) {\r
+                                                       node.parent.insert(marker, node, node.name === 'br');\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               // If parser says valid we can insert the contents into that parent\r
+                               if (!args.invalid) {\r
+                                       value = serializer.serialize(fragment);\r
+\r
+                                       // Check if parent is empty or only has one BR element then set the innerHTML of that parent\r
+                                       node = parentNode.firstChild;\r
+                                       node2 = parentNode.lastChild;\r
+                                       if (!node || (node === node2 && node.nodeName === 'BR'))\r
+                                               dom.setHTML(parentNode, value);\r
+                                       else\r
+                                               selection.setContent(value);\r
+                               } else {\r
+                                       // If the fragment was invalid within that context then we need\r
+                                       // to parse and process the parent it's inserted into\r
+\r
+                                       // Insert bookmark node and get the parent\r
+                                       selection.setContent(bookmarkHtml);\r
+                                       parentNode = selection.getNode();\r
+                                       rootNode = editor.getBody();\r
+\r
+                                       // Opera will return the document node when selection is in root\r
+                                       if (parentNode.nodeType == 9)\r
+                                               parentNode = node = rootNode;\r
+                                       else\r
+                                               node = parentNode;\r
+\r
+                                       // Find the ancestor just before the root element\r
+                                       while (node !== rootNode) {\r
+                                               parentNode = node;\r
+                                               node = node.parentNode;\r
+                                       }\r
+\r
+                                       // Get the outer/inner HTML depending on if we are in the root and parser and serialize that\r
+                                       value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);\r
+                                       value = serializer.serialize(\r
+                                               parser.parse(\r
+                                                       // Need to replace by using a function since $ in the contents would otherwise be a problem\r
+                                                       value.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i, function() {\r
+                                                               return serializer.serialize(fragment);\r
+                                                       })\r
+                                               )\r
+                                       );\r
+\r
+                                       // Set the inner/outer HTML depending on if we are in the root or not\r
+                                       if (parentNode == rootNode)\r
+                                               dom.setHTML(rootNode, value);\r
+                                       else\r
+                                               dom.setOuterHTML(parentNode, value);\r
+                               }\r
+\r
+                               marker = dom.get('mce_marker');\r
+\r
+                               // Scroll range into view scrollIntoView on element can't be used since it will scroll the main view port as well\r
+                               nodeRect = dom.getRect(marker);\r
+                               viewPortRect = dom.getViewPort(editor.getWin());\r
+\r
+                               // Check if node is out side the viewport if it is then scroll to it\r
+                               if ((nodeRect.y + nodeRect.h > viewPortRect.y + viewPortRect.h || nodeRect.y < viewPortRect.y) ||\r
+                                       (nodeRect.x > viewPortRect.x + viewPortRect.w || nodeRect.x < viewPortRect.x)) {\r
+                                       viewportBodyElement = tinymce.isIE ? editor.getDoc().documentElement : editor.getBody();\r
+                                       viewportBodyElement.scrollLeft = nodeRect.x;\r
+                                       viewportBodyElement.scrollTop = nodeRect.y - viewPortRect.h + 25;\r
+                               }\r
+\r
+                               // Move selection before marker and remove it\r
+                               rng = dom.createRng();\r
+\r
+                               // If previous sibling is a text node set the selection to the end of that node\r
+                               node = marker.previousSibling;\r
+                               if (node && node.nodeType == 3) {\r
+                                       rng.setStart(node, node.nodeValue.length);\r
+                               } else {\r
+                                       // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node\r
+                                       rng.setStartBefore(marker);\r
+                                       rng.setEndBefore(marker);\r
+                               }\r
+\r
+                               // Remove the marker node and set the new range\r
+                               dom.remove(marker);\r
+                               selection.setRng(rng);\r
+\r
+                               // Dispatch after event and add any visual elements needed\r
+                               selection.onSetContent.dispatch(selection, args);\r
+                               editor.addVisual();\r
+                       },\r
+\r
+                       mceInsertRawHTML : function(command, ui, value) {\r
+                               selection.setContent('tiny_mce_marker');\r
+                               editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, function() { return value }));\r
+                       },\r
+\r
+                       mceToggleFormat : function(command, ui, value) {\r
+                               toggleFormat(value);\r
+                       },\r
+\r
+                       mceSetContent : function(command, ui, value) {\r
+                               editor.setContent(value);\r
+                       },\r
+\r
+                       'Indent,Outdent' : function(command) {\r
+                               var intentValue, indentUnit, value;\r
+\r
+                               // Setup indent level\r
+                               intentValue = settings.indentation;\r
+                               indentUnit = /[a-z%]+$/i.exec(intentValue);\r
+                               intentValue = parseInt(intentValue);\r
+\r
+                               if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {\r
+                                       // If forced_root_blocks is set to false we don't have a block to indent so lets create a div\r
+                                       if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) {\r
+                                               formatter.apply('div');\r
+                                       }\r
+\r
+                                       each(selection.getSelectedBlocks(), function(element) {\r
+                                               if (command == 'outdent') {\r
+                                                       value = Math.max(0, parseInt(element.style.paddingLeft || 0) - intentValue);\r
+                                                       dom.setStyle(element, 'paddingLeft', value ? value + indentUnit : '');\r
+                                               } else\r
+                                                       dom.setStyle(element, 'paddingLeft', (parseInt(element.style.paddingLeft || 0) + intentValue) + indentUnit);\r
+                                       });\r
+                               } else\r
+                                       execNativeCommand(command);\r
+                       },\r
+\r
+                       mceRepaint : function() {\r
+                               var bookmark;\r
+\r
+                               if (tinymce.isGecko) {\r
+                                       try {\r
+                                               storeSelection(TRUE);\r
+\r
+                                               if (selection.getSel())\r
+                                                       selection.getSel().selectAllChildren(editor.getBody());\r
+\r
+                                               selection.collapse(TRUE);\r
+                                               restoreSelection();\r
+                                       } catch (ex) {\r
+                                               // Ignore\r
+                                       }\r
+                               }\r
+                       },\r
+\r
+                       mceToggleFormat : function(command, ui, value) {\r
+                               formatter.toggle(value);\r
+                       },\r
+\r
+                       InsertHorizontalRule : function() {\r
+                               editor.execCommand('mceInsertContent', false, '<hr />');\r
+                       },\r
+\r
+                       mceToggleVisualAid : function() {\r
+                               editor.hasVisual = !editor.hasVisual;\r
+                               editor.addVisual();\r
+                       },\r
+\r
+                       mceReplaceContent : function(command, ui, value) {\r
+                               editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));\r
+                       },\r
+\r
+                       mceInsertLink : function(command, ui, value) {\r
+                               var anchor;\r
+\r
+                               if (typeof(value) == 'string')\r
+                                       value = {href : value};\r
+\r
+                               anchor = dom.getParent(selection.getNode(), 'a');\r
+\r
+                               // Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here.\r
+                               value.href = value.href.replace(' ', '%20');\r
+\r
+                               // Remove existing links if there could be child links or that the href isn't specified\r
+                               if (!anchor || !value.href) {\r
+                                       formatter.remove('link');\r
+                               }               \r
+\r
+                               // Apply new link to selection\r
+                               if (value.href) {\r
+                                       formatter.apply('link', value, anchor);\r
+                               }\r
+                       },\r
+\r
+                       selectAll : function() {\r
+                               var root = dom.getRoot(), rng = dom.createRng();\r
+\r
+                               // Old IE does a better job with selectall than new versions\r
+                               if (selection.getRng().setStart) {\r
+                                       rng.setStart(root, 0);\r
+                                       rng.setEnd(root, root.childNodes.length);\r
+\r
+                                       selection.setRng(rng);\r
+                               } else {\r
+                                       execNativeCommand('SelectAll');\r
+                               }\r
+                       }\r
+               });\r
+\r
+               // Add queryCommandState overrides\r
+               addCommands({\r
+                       // Override justify commands\r
+                       'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {\r
+                               var name = 'align' + command.substring(7);\r
+                               var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks();\r
+                               var matches = tinymce.map(nodes, function(node) {\r
+                                       return !!formatter.matchNode(node, name);\r
+                               });\r
+                               return tinymce.inArray(matches, TRUE) !== -1;\r
+                       },\r
+\r
+                       'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {\r
+                               return isFormatMatch(command);\r
+                       },\r
+\r
+                       mceBlockQuote : function() {\r
+                               return isFormatMatch('blockquote');\r
+                       },\r
+\r
+                       Outdent : function() {\r
+                               var node;\r
+\r
+                               if (settings.inline_styles) {\r
+                                       if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)\r
+                                               return TRUE;\r
+\r
+                                       if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)\r
+                                               return TRUE;\r
+                               }\r
+\r
+                               return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'));\r
+                       },\r
+\r
+                       'InsertUnorderedList,InsertOrderedList' : function(command) {\r
+                               var list = dom.getParent(selection.getNode(), 'ul,ol');\r
+                               return list && \r
+                                    (command === 'insertunorderedlist' && list.tagName === 'UL'\r
+                                  || command === 'insertorderedlist' && list.tagName === 'OL');\r
+                       }\r
+               }, 'state');\r
+\r
+               // Add queryCommandValue overrides\r
+               addCommands({\r
+                       'FontSize,FontName' : function(command) {\r
+                               var value = 0, parent;\r
+\r
+                               if (parent = dom.getParent(selection.getNode(), 'span')) {\r
+                                       if (command == 'fontsize')\r
+                                               value = parent.style.fontSize;\r
+                                       else\r
+                                               value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();\r
+                               }\r
+\r
+                               return value;\r
+                       }\r
+               }, 'value');\r
+\r
+               // Add undo manager logic\r
+               addCommands({\r
+                       Undo : function() {\r
+                               editor.undoManager.undo();\r
+                       },\r
+\r
+                       Redo : function() {\r
+                               editor.undoManager.redo();\r
+                       }\r
+               });\r
+       };\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Dispatcher = tinymce.util.Dispatcher;\r
+\r
+       tinymce.UndoManager = function(editor) {\r
+               var self, index = 0, data = [], beforeBookmark, onAdd, onUndo, onRedo;\r
+\r
+               function getContent() {\r
+                       // Remove whitespace before/after and remove pure bogus nodes\r
+                       return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}).replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g, ''));\r
+               };\r
+\r
+               function addNonTypingUndoLevel() {\r
+                       self.typing = false;\r
+                       self.add();\r
+               };\r
+\r
+               // Create event instances\r
+               onBeforeAdd = new Dispatcher(self);\r
+               onAdd       = new Dispatcher(self);\r
+               onUndo      = new Dispatcher(self);\r
+               onRedo      = new Dispatcher(self);\r
+\r
+               // Pass though onAdd event from UndoManager to Editor as onChange\r
+               onAdd.add(function(undoman, level) {\r
+                       if (undoman.hasUndo())\r
+                               return editor.onChange.dispatch(editor, level, undoman);\r
+               });\r
+\r
+               // Pass though onUndo event from UndoManager to Editor\r
+               onUndo.add(function(undoman, level) {\r
+                       return editor.onUndo.dispatch(editor, level, undoman);\r
+               });\r
+\r
+               // Pass though onRedo event from UndoManager to Editor\r
+               onRedo.add(function(undoman, level) {\r
+                       return editor.onRedo.dispatch(editor, level, undoman);\r
+               });\r
+\r
+               // Add initial undo level when the editor is initialized\r
+               editor.onInit.add(function() {\r
+                       self.add();\r
+               });\r
+\r
+               // Get position before an execCommand is processed\r
+               editor.onBeforeExecCommand.add(function(ed, cmd, ui, val, args) {\r
+                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!args || !args.skip_undo)) {\r
+                               self.beforeChange();\r
+                       }\r
+               });\r
+\r
+               // Add undo level after an execCommand call was made\r
+               editor.onExecCommand.add(function(ed, cmd, ui, val, args) {\r
+                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!args || !args.skip_undo)) {\r
+                               self.add();\r
+                       }\r
+               });\r
+\r
+               // Add undo level on save contents, drag end and blur/focusout\r
+               editor.onSaveContent.add(addNonTypingUndoLevel);\r
+               editor.dom.bind(editor.dom.getRoot(), 'dragend', addNonTypingUndoLevel);\r
+               editor.dom.bind(editor.getDoc(), tinymce.isGecko ? 'blur' : 'focusout', function(e) {\r
+                       if (!editor.removed && self.typing) {\r
+                               addNonTypingUndoLevel();\r
+                       }\r
+               });\r
+\r
+               editor.onKeyUp.add(function(editor, e) {\r
+                       var keyCode = e.keyCode;\r
+\r
+                       if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) {\r
+                               addNonTypingUndoLevel();\r
+                       }\r
+               });\r
+\r
+               editor.onKeyDown.add(function(editor, e) {\r
+                       var keyCode = e.keyCode;\r
+\r
+                       // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter\r
+                       if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) {\r
+                               if (self.typing) {\r
+                                       addNonTypingUndoLevel();\r
+                               }\r
+\r
+                               return;\r
+                       }\r
+\r
+                       // If key isn't shift,ctrl,alt,capslock,metakey\r
+                       if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing) {\r
+                               self.beforeChange();\r
+                               self.typing = true;\r
+                               self.add();\r
+                       }\r
+               });\r
+\r
+               editor.onMouseDown.add(function(editor, e) {\r
+                       if (self.typing) {\r
+                               addNonTypingUndoLevel();\r
+                       }\r
+               });\r
+\r
+               // Add keyboard shortcuts for undo/redo keys\r
+               editor.addShortcut('ctrl+z', 'undo_desc', 'Undo');\r
+               editor.addShortcut('ctrl+y', 'redo_desc', 'Redo');\r
+\r
+               self = {\r
+                       // Explose for debugging reasons\r
+                       data : data,\r
+\r
+                       typing : false,\r
+                       \r
+                       onBeforeAdd: onBeforeAdd,\r
+\r
+                       onAdd : onAdd,\r
+\r
+                       onUndo : onUndo,\r
+\r
+                       onRedo : onRedo,\r
+\r
+                       beforeChange : function() {\r
+                               beforeBookmark = editor.selection.getBookmark(2, true);\r
+                       },\r
+\r
+                       add : function(level) {\r
+                               var i, settings = editor.settings, lastLevel;\r
+\r
+                               level = level || {};\r
+                               level.content = getContent();\r
+                               \r
+                               self.onBeforeAdd.dispatch(self, level);\r
+\r
+                               // Add undo level if needed\r
+                               lastLevel = data[index];\r
+                               if (lastLevel && lastLevel.content == level.content)\r
+                                       return null;\r
+\r
+                               // Set before bookmark on previous level\r
+                               if (data[index])\r
+                                       data[index].beforeBookmark = beforeBookmark;\r
+\r
+                               // Time to compress\r
+                               if (settings.custom_undo_redo_levels) {\r
+                                       if (data.length > settings.custom_undo_redo_levels) {\r
+                                               for (i = 0; i < data.length - 1; i++)\r
+                                                       data[i] = data[i + 1];\r
+\r
+                                               data.length--;\r
+                                               index = data.length;\r
+                                       }\r
+                               }\r
+\r
+                               // Get a non intrusive normalized bookmark\r
+                               level.bookmark = editor.selection.getBookmark(2, true);\r
+\r
+                               // Crop array if needed\r
+                               if (index < data.length - 1)\r
+                                       data.length = index + 1;\r
+\r
+                               data.push(level);\r
+                               index = data.length - 1;\r
+\r
+                               self.onAdd.dispatch(self, level);\r
+                               editor.isNotDirty = 0;\r
+\r
+                               return level;\r
+                       },\r
+\r
+                       undo : function() {\r
+                               var level, i;\r
+\r
+                               if (self.typing) {\r
+                                       self.add();\r
+                                       self.typing = false;\r
+                               }\r
+\r
+                               if (index > 0) {\r
+                                       level = data[--index];\r
+\r
+                                       editor.setContent(level.content, {format : 'raw'});\r
+                                       editor.selection.moveToBookmark(level.beforeBookmark);\r
+\r
+                                       self.onUndo.dispatch(self, level);\r
+                               }\r
+\r
+                               return level;\r
+                       },\r
+\r
+                       redo : function() {\r
+                               var level;\r
+\r
+                               if (index < data.length - 1) {\r
+                                       level = data[++index];\r
+\r
+                                       editor.setContent(level.content, {format : 'raw'});\r
+                                       editor.selection.moveToBookmark(level.bookmark);\r
+\r
+                                       self.onRedo.dispatch(self, level);\r
+                               }\r
+\r
+                               return level;\r
+                       },\r
+\r
+                       clear : function() {\r
+                               data = [];\r
+                               index = 0;\r
+                               self.typing = false;\r
+                       },\r
+\r
+                       hasUndo : function() {\r
+                               return index > 0 || this.typing;\r
+                       },\r
+\r
+                       hasRedo : function() {\r
+                               return index < data.length - 1 && !this.typing;\r
+                       }\r
+               };\r
+\r
+               return self;\r
+       };\r
+})(tinymce);\r
+\r
+tinymce.ForceBlocks = function(editor) {\r
+       var settings = editor.settings, dom = editor.dom, selection = editor.selection, blockElements = editor.schema.getBlockElements();\r
+\r
+       function addRootBlocks() {\r
+               var node = selection.getStart(), rootNode = editor.getBody(), rng, startContainer, startOffset, endContainer, endOffset, rootBlockNode, tempNode, offset = -0xFFFFFF, wrapped, isInEditorDocument;\r
+\r
+               if (!node || node.nodeType !== 1 || !settings.forced_root_block)\r
+                       return;\r
+\r
+               // Check if node is wrapped in block\r
+               while (node && node != rootNode) {\r
+                       if (blockElements[node.nodeName])\r
+                               return;\r
+\r
+                       node = node.parentNode;\r
+               }\r
+\r
+               // Get current selection\r
+               rng = selection.getRng();\r
+               if (rng.setStart) {\r
+                       startContainer = rng.startContainer;\r
+                       startOffset = rng.startOffset;\r
+                       endContainer = rng.endContainer;\r
+                       endOffset = rng.endOffset;\r
+               } else {\r
+                       // Force control range into text range\r
+                       if (rng.item) {\r
+                               node = rng.item(0);\r
+                               rng = editor.getDoc().body.createTextRange();\r
+                               rng.moveToElementText(node);\r
+                       }\r
+\r
+                       isInEditorDocument = rng.parentElement().ownerDocument === editor.getDoc();\r
+                       tmpRng = rng.duplicate();\r
+                       tmpRng.collapse(true);\r
+                       startOffset = tmpRng.move('character', offset) * -1;\r
+\r
+                       if (!tmpRng.collapsed) {\r
+                               tmpRng = rng.duplicate();\r
+                               tmpRng.collapse(false);\r
+                               endOffset = (tmpRng.move('character', offset) * -1) - startOffset;\r
+                       }\r
+               }\r
+\r
+               // Wrap non block elements and text nodes\r
+               node = rootNode.firstChild;\r
+               while (node) {\r
+                       if (node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName])) {\r
+                               // Remove empty text nodes\r
+                               if (node.nodeType === 3 && node.nodeValue.length == 0) {\r
+                                       tempNode = node;\r
+                                       node = node.nextSibling;\r
+                                       dom.remove(tempNode);\r
+                                       continue;\r
+                               }\r
+\r
+                               if (!rootBlockNode) {\r
+                                       rootBlockNode = dom.create(settings.forced_root_block);\r
+                                       node.parentNode.insertBefore(rootBlockNode, node);\r
+                                       wrapped = true;\r
+                               }\r
+\r
+                               tempNode = node;\r
+                               node = node.nextSibling;\r
+                               rootBlockNode.appendChild(tempNode);\r
+                       } else {\r
+                               rootBlockNode = null;\r
+                               node = node.nextSibling;\r
+                       }\r
+               }\r
+\r
+               if (wrapped) {\r
+                       if (rng.setStart) {\r
+                               rng.setStart(startContainer, startOffset);\r
+                               rng.setEnd(endContainer, endOffset);\r
+                               selection.setRng(rng);\r
+                       } else {\r
+                               // Only select if the previous selection was inside the document to prevent auto focus in quirks mode\r
+                               if (isInEditorDocument) {\r
+                                       try {\r
+                                               rng = editor.getDoc().body.createTextRange();\r
+                                               rng.moveToElementText(rootNode);\r
+                                               rng.collapse(true);\r
+                                               rng.moveStart('character', startOffset);\r
+\r
+                                               if (endOffset > 0)\r
+                                                       rng.moveEnd('character', endOffset);\r
+\r
+                                               rng.select();\r
+                                       } catch (ex) {\r
+                                               // Ignore\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       editor.nodeChanged();\r
+               }\r
+       };\r
+\r
+       // Force root blocks\r
+       if (settings.forced_root_block) {\r
+               editor.onKeyUp.add(addRootBlocks);\r
+               editor.onNodeChange.add(addRootBlocks);\r
+       }\r
+};\r
+\r
+(function(tinymce) {\r
+       // Shorten names\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend;\r
+\r
+       tinymce.create('tinymce.ControlManager', {\r
+               ControlManager : function(ed, s) {\r
+                       var t = this, i;\r
+\r
+                       s = s || {};\r
+                       t.editor = ed;\r
+                       t.controls = {};\r
+                       t.onAdd = new tinymce.util.Dispatcher(t);\r
+                       t.onPostRender = new tinymce.util.Dispatcher(t);\r
+                       t.prefix = s.prefix || ed.id + '_';\r
+                       t._cls = {};\r
+\r
+                       t.onPostRender.add(function() {\r
+                               each(t.controls, function(c) {\r
+                                       c.postRender();\r
+                               });\r
+                       });\r
+               },\r
+\r
+               get : function(id) {\r
+                       return this.controls[this.prefix + id] || this.controls[id];\r
+               },\r
+\r
+               setActive : function(id, s) {\r
+                       var c = null;\r
+\r
+                       if (c = this.get(id))\r
+                               c.setActive(s);\r
+\r
+                       return c;\r
+               },\r
+\r
+               setDisabled : function(id, s) {\r
+                       var c = null;\r
+\r
+                       if (c = this.get(id))\r
+                               c.setDisabled(s);\r
+\r
+                       return c;\r
+               },\r
+\r
+               add : function(c) {\r
+                       var t = this;\r
+\r
+                       if (c) {\r
+                               t.controls[c.id] = c;\r
+                               t.onAdd.dispatch(c, t);\r
+                       }\r
+\r
+                       return c;\r
+               },\r
+\r
+               createControl : function(name) {\r
+                       var ctrl, i, l, self = this, editor = self.editor, factories, ctrlName;\r
+\r
+                       // Build control factory cache\r
+                       if (!self.controlFactories) {\r
+                               self.controlFactories = [];\r
+                               each(editor.plugins, function(plugin) {\r
+                                       if (plugin.createControl) {\r
+                                               self.controlFactories.push(plugin);\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       // Create controls by asking cached factories\r
+                       factories = self.controlFactories;\r
+                       for (i = 0, l = factories.length; i < l; i++) {\r
+                               ctrl = factories[i].createControl(name, self);\r
+\r
+                               if (ctrl) {\r
+                                       return self.add(ctrl);\r
+                               }\r
+                       }\r
+\r
+                       // Create sepearator\r
+                       if (name === "|" || name === "separator") {\r
+                               return self.createSeparator();\r
+                       }\r
+\r
+                       // Create control from button collection\r
+                       if (editor.buttons && (ctrl = editor.buttons[name])) {\r
+                               return self.createButton(name, ctrl);\r
+                       }\r
+\r
+                       return self.add(ctrl);\r
+               },\r
+\r
+               createDropMenu : function(id, s, cc) {\r
+                       var t = this, ed = t.editor, c, bm, v, cls;\r
+\r
+                       s = extend({\r
+                               'class' : 'mceDropDown',\r
+                               constrain : ed.settings.constrain_menus\r
+                       }, s);\r
+\r
+                       s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin';\r
+                       if (v = ed.getParam('skin_variant'))\r
+                               s['class'] += ' ' + ed.getParam('skin') + 'Skin' + v.substring(0, 1).toUpperCase() + v.substring(1);\r
+\r
+                       s['class'] += ed.settings.directionality == "rtl" ? ' mceRtl' : '';\r
+\r
+                       id = t.prefix + id;\r
+                       cls = cc || t._cls.dropmenu || tinymce.ui.DropMenu;\r
+                       c = t.controls[id] = new cls(id, s);\r
+                       c.onAddItem.add(function(c, o) {\r
+                               var s = o.settings;\r
+\r
+                               s.title = ed.getLang(s.title, s.title);\r
+\r
+                               if (!s.onclick) {\r
+                                       s.onclick = function(v) {\r
+                                               if (s.cmd)\r
+                                                       ed.execCommand(s.cmd, s.ui || false, s.value);\r
+                                       };\r
+                               }\r
+                       });\r
+\r
+                       ed.onRemove.add(function() {\r
+                               c.destroy();\r
+                       });\r
+\r
+                       // Fix for bug #1897785, #1898007\r
+                       if (tinymce.isIE) {\r
+                               c.onShowMenu.add(function() {\r
+                                       // IE 8 needs focus in order to store away a range with the current collapsed caret location\r
+                                       ed.focus();\r
+\r
+                                       bm = ed.selection.getBookmark(1);\r
+                               });\r
+\r
+                               c.onHideMenu.add(function() {\r
+                                       if (bm) {\r
+                                               ed.selection.moveToBookmark(bm);\r
+                                               bm = 0;\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       return t.add(c);\r
+               },\r
+\r
+               createListBox : function(id, s, cc) {\r
+                       var t = this, ed = t.editor, cmd, c, cls;\r
+\r
+                       if (t.get(id))\r
+                               return null;\r
+\r
+                       s.title = ed.translate(s.title);\r
+                       s.scope = s.scope || ed;\r
+\r
+                       if (!s.onselect) {\r
+                               s.onselect = function(v) {\r
+                                       ed.execCommand(s.cmd, s.ui || false, v || s.value);\r
+                               };\r
+                       }\r
+\r
+                       s = extend({\r
+                               title : s.title,\r
+                               'class' : 'mce_' + id,\r
+                               scope : s.scope,\r
+                               control_manager : t\r
+                       }, s);\r
+\r
+                       id = t.prefix + id;\r
+\r
+\r
+                       function useNativeListForAccessibility(ed) {\r
+                               return ed.settings.use_accessible_selects && !tinymce.isGecko\r
+                       }\r
+\r
+                       if (ed.settings.use_native_selects || useNativeListForAccessibility(ed))\r
+                               c = new tinymce.ui.NativeListBox(id, s);\r
+                       else {\r
+                               cls = cc || t._cls.listbox || tinymce.ui.ListBox;\r
+                               c = new cls(id, s, ed);\r
+                       }\r
+\r
+                       t.controls[id] = c;\r
+\r
+                       // Fix focus problem in Safari\r
+                       if (tinymce.isWebKit) {\r
+                               c.onPostRender.add(function(c, n) {\r
+                                       // Store bookmark on mousedown\r
+                                       Event.add(n, 'mousedown', function() {\r
+                                               ed.bookmark = ed.selection.getBookmark(1);\r
+                                       });\r
+\r
+                                       // Restore on focus, since it might be lost\r
+                                       Event.add(n, 'focus', function() {\r
+                                               ed.selection.moveToBookmark(ed.bookmark);\r
+                                               ed.bookmark = null;\r
+                                       });\r
+                               });\r
+                       }\r
+\r
+                       if (c.hideMenu)\r
+                               ed.onMouseDown.add(c.hideMenu, c);\r
+\r
+                       return t.add(c);\r
+               },\r
+\r
+               createButton : function(id, s, cc) {\r
+                       var t = this, ed = t.editor, o, c, cls;\r
+\r
+                       if (t.get(id))\r
+                               return null;\r
+\r
+                       s.title = ed.translate(s.title);\r
+                       s.label = ed.translate(s.label);\r
+                       s.scope = s.scope || ed;\r
+\r
+                       if (!s.onclick && !s.menu_button) {\r
+                               s.onclick = function() {\r
+                                       ed.execCommand(s.cmd, s.ui || false, s.value);\r
+                               };\r
+                       }\r
+\r
+                       s = extend({\r
+                               title : s.title,\r
+                               'class' : 'mce_' + id,\r
+                               unavailable_prefix : ed.getLang('unavailable', ''),\r
+                               scope : s.scope,\r
+                               control_manager : t\r
+                       }, s);\r
+\r
+                       id = t.prefix + id;\r
+\r
+                       if (s.menu_button) {\r
+                               cls = cc || t._cls.menubutton || tinymce.ui.MenuButton;\r
+                               c = new cls(id, s, ed);\r
+                               ed.onMouseDown.add(c.hideMenu, c);\r
+                       } else {\r
+                               cls = t._cls.button || tinymce.ui.Button;\r
+                               c = new cls(id, s, ed);\r
+                       }\r
+\r
+                       return t.add(c);\r
+               },\r
+\r
+               createMenuButton : function(id, s, cc) {\r
+                       s = s || {};\r
+                       s.menu_button = 1;\r
+\r
+                       return this.createButton(id, s, cc);\r
+               },\r
+\r
+               createSplitButton : function(id, s, cc) {\r
+                       var t = this, ed = t.editor, cmd, c, cls;\r
+\r
+                       if (t.get(id))\r
+                               return null;\r
+\r
+                       s.title = ed.translate(s.title);\r
+                       s.scope = s.scope || ed;\r
+\r
+                       if (!s.onclick) {\r
+                               s.onclick = function(v) {\r
+                                       ed.execCommand(s.cmd, s.ui || false, v || s.value);\r
+                               };\r
+                       }\r
+\r
+                       if (!s.onselect) {\r
+                               s.onselect = function(v) {\r
+                                       ed.execCommand(s.cmd, s.ui || false, v || s.value);\r
+                               };\r
+                       }\r
+\r
+                       s = extend({\r
+                               title : s.title,\r
+                               'class' : 'mce_' + id,\r
+                               scope : s.scope,\r
+                               control_manager : t\r
+                       }, s);\r
+\r
+                       id = t.prefix + id;\r
+                       cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton;\r
+                       c = t.add(new cls(id, s, ed));\r
+                       ed.onMouseDown.add(c.hideMenu, c);\r
+\r
+                       return c;\r
+               },\r
+\r
+               createColorSplitButton : function(id, s, cc) {\r
+                       var t = this, ed = t.editor, cmd, c, cls, bm;\r
+\r
+                       if (t.get(id))\r
+                               return null;\r
+\r
+                       s.title = ed.translate(s.title);\r
+                       s.scope = s.scope || ed;\r
+\r
+                       if (!s.onclick) {\r
+                               s.onclick = function(v) {\r
+                                       if (tinymce.isIE)\r
+                                               bm = ed.selection.getBookmark(1);\r
+\r
+                                       ed.execCommand(s.cmd, s.ui || false, v || s.value);\r
+                               };\r
+                       }\r
+\r
+                       if (!s.onselect) {\r
+                               s.onselect = function(v) {\r
+                                       ed.execCommand(s.cmd, s.ui || false, v || s.value);\r
+                               };\r
+                       }\r
+\r
+                       s = extend({\r
+                               title : s.title,\r
+                               'class' : 'mce_' + id,\r
+                               'menu_class' : ed.getParam('skin') + 'Skin',\r
+                               scope : s.scope,\r
+                               more_colors_title : ed.getLang('more_colors')\r
+                       }, s);\r
+\r
+                       id = t.prefix + id;\r
+                       cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton;\r
+                       c = new cls(id, s, ed);\r
+                       ed.onMouseDown.add(c.hideMenu, c);\r
+\r
+                       // Remove the menu element when the editor is removed\r
+                       ed.onRemove.add(function() {\r
+                               c.destroy();\r
+                       });\r
+\r
+                       // Fix for bug #1897785, #1898007\r
+                       if (tinymce.isIE) {\r
+                               c.onShowMenu.add(function() {\r
+                                       // IE 8 needs focus in order to store away a range with the current collapsed caret location\r
+                                       ed.focus();\r
+                                       bm = ed.selection.getBookmark(1);\r
+                               });\r
+\r
+                               c.onHideMenu.add(function() {\r
+                                       if (bm) {\r
+                                               ed.selection.moveToBookmark(bm);\r
+                                               bm = 0;\r
+                                       }\r
+                               });\r
+                       }\r
+\r
+                       return t.add(c);\r
+               },\r
+\r
+               createToolbar : function(id, s, cc) {\r
+                       var c, t = this, cls;\r
+\r
+                       id = t.prefix + id;\r
+                       cls = cc || t._cls.toolbar || tinymce.ui.Toolbar;\r
+                       c = new cls(id, s, t.editor);\r
+\r
+                       if (t.get(id))\r
+                               return null;\r
+\r
+                       return t.add(c);\r
+               },\r
+               \r
+               createToolbarGroup : function(id, s, cc) {\r
+                       var c, t = this, cls;\r
+                       id = t.prefix + id;\r
+                       cls = cc || this._cls.toolbarGroup || tinymce.ui.ToolbarGroup;\r
+                       c = new cls(id, s, t.editor);\r
+                       \r
+                       if (t.get(id))\r
+                               return null;\r
+                       \r
+                       return t.add(c);\r
+               },\r
+\r
+               createSeparator : function(cc) {\r
+                       var cls = cc || this._cls.separator || tinymce.ui.Separator;\r
+\r
+                       return new cls();\r
+               },\r
+\r
+               setControlType : function(n, c) {\r
+                       return this._cls[n.toLowerCase()] = c;\r
+               },\r
+       \r
+               destroy : function() {\r
+                       each(this.controls, function(c) {\r
+                               c.destroy();\r
+                       });\r
+\r
+                       this.controls = null;\r
+               }\r
+       });\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;\r
+\r
+       tinymce.create('tinymce.WindowManager', {\r
+               WindowManager : function(ed) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+                       t.onOpen = new Dispatcher(t);\r
+                       t.onClose = new Dispatcher(t);\r
+                       t.params = {};\r
+                       t.features = {};\r
+               },\r
+\r
+               open : function(s, p) {\r
+                       var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u;\r
+\r
+                       // Default some options\r
+                       s = s || {};\r
+                       p = p || {};\r
+                       sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window\r
+                       sh = isOpera ? vp.h : screen.height;\r
+                       s.name = s.name || 'mc_' + new Date().getTime();\r
+                       s.width = parseInt(s.width || 320);\r
+                       s.height = parseInt(s.height || 240);\r
+                       s.resizable = true;\r
+                       s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0);\r
+                       s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0);\r
+                       p.inline = false;\r
+                       p.mce_width = s.width;\r
+                       p.mce_height = s.height;\r
+                       p.mce_auto_focus = s.auto_focus;\r
+\r
+                       if (mo) {\r
+                               if (isIE) {\r
+                                       s.center = true;\r
+                                       s.help = false;\r
+                                       s.dialogWidth = s.width + 'px';\r
+                                       s.dialogHeight = s.height + 'px';\r
+                                       s.scroll = s.scrollbars || false;\r
+                               }\r
+                       }\r
+\r
+                       // Build features string\r
+                       each(s, function(v, k) {\r
+                               if (tinymce.is(v, 'boolean'))\r
+                                       v = v ? 'yes' : 'no';\r
+\r
+                               if (!/^(name|url)$/.test(k)) {\r
+                                       if (isIE && mo)\r
+                                               f += (f ? ';' : '') + k + ':' + v;\r
+                                       else\r
+                                               f += (f ? ',' : '') + k + '=' + v;\r
+                               }\r
+                       });\r
+\r
+                       t.features = s;\r
+                       t.params = p;\r
+                       t.onOpen.dispatch(t, s, p);\r
+\r
+                       u = s.url || s.file;\r
+                       u = tinymce._addVer(u);\r
+\r
+                       try {\r
+                               if (isIE && mo) {\r
+                                       w = 1;\r
+                                       window.showModalDialog(u, window, f);\r
+                               } else\r
+                                       w = window.open(u, s.name, f);\r
+                       } catch (ex) {\r
+                               // Ignore\r
+                       }\r
+\r
+                       if (!w)\r
+                               alert(t.editor.getLang('popup_blocked'));\r
+               },\r
+\r
+               close : function(w) {\r
+                       w.close();\r
+                       this.onClose.dispatch(this);\r
+               },\r
+\r
+               createInstance : function(cl, a, b, c, d, e) {\r
+                       var f = tinymce.resolve(cl);\r
+\r
+                       return new f(a, b, c, d, e);\r
+               },\r
+\r
+               confirm : function(t, cb, s, w) {\r
+                       w = w || window;\r
+\r
+                       cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t))));\r
+               },\r
+\r
+               alert : function(tx, cb, s, w) {\r
+                       var t = this;\r
+\r
+                       w = w || window;\r
+                       w.alert(t._decode(t.editor.getLang(tx, tx)));\r
+\r
+                       if (cb)\r
+                               cb.call(s || t);\r
+               },\r
+\r
+               resizeBy : function(dw, dh, win) {\r
+                       win.resizeBy(dw, dh);\r
+               },\r
+\r
+               // Internal functions\r
+\r
+               _decode : function(s) {\r
+                       return tinymce.DOM.decode(s).replace(/\\n/g, '\n');\r
+               }\r
+       });\r
+}(tinymce));\r
+(function(tinymce) {\r
+       tinymce.Formatter = function(ed) {\r
+               var formats = {},\r
+                       each = tinymce.each,\r
+                       dom = ed.dom,\r
+                       selection = ed.selection,\r
+                       TreeWalker = tinymce.dom.TreeWalker,\r
+                       rangeUtils = new tinymce.dom.RangeUtils(dom),\r
+                       isValid = ed.schema.isValidChild,\r
+                       isBlock = dom.isBlock,\r
+                       forcedRootBlock = ed.settings.forced_root_block,\r
+                       nodeIndex = dom.nodeIndex,\r
+                       INVISIBLE_CHAR = '\uFEFF',\r
+                       MCE_ATTR_RE = /^(src|href|style)$/,\r
+                       FALSE = false,\r
+                       TRUE = true,\r
+                       formatChangeData,\r
+                       undef,\r
+                       getContentEditable = dom.getContentEditable;\r
+\r
+               function isArray(obj) {\r
+                       return obj instanceof Array;\r
+               };\r
+\r
+               function getParents(node, selector) {\r
+                       return dom.getParents(node, selector, dom.getRoot());\r
+               };\r
+\r
+               function isCaretNode(node) {\r
+                       return node.nodeType === 1 && node.id === '_mce_caret';\r
+               };\r
+\r
+               function defaultFormats() {\r
+                       register({\r
+                               alignleft : [\r
+                                       {selector : 'figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}, defaultBlock: 'div'},\r
+                                       {selector : 'img,table', collapsed : false, styles : {'float' : 'left'}}\r
+                               ],\r
+\r
+                               aligncenter : [\r
+                                       {selector : 'figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}, defaultBlock: 'div'},\r
+                                       {selector : 'img', collapsed : false, styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},\r
+                                       {selector : 'table', collapsed : false, styles : {marginLeft : 'auto', marginRight : 'auto'}}\r
+                               ],\r
+\r
+                               alignright : [\r
+                                       {selector : 'figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}, defaultBlock: 'div'},\r
+                                       {selector : 'img,table', collapsed : false, styles : {'float' : 'right'}}\r
+                               ],\r
+\r
+                               alignfull : [\r
+                                       {selector : 'figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'justify'}, defaultBlock: 'div'}\r
+                               ],\r
+\r
+                               bold : [\r
+                                       {inline : 'strong', remove : 'all'},\r
+                                       {inline : 'span', styles : {fontWeight : 'bold'}},\r
+                                       {inline : 'b', remove : 'all'}\r
+                               ],\r
+\r
+                               italic : [\r
+                                       {inline : 'em', remove : 'all'},\r
+                                       {inline : 'span', styles : {fontStyle : 'italic'}},\r
+                                       {inline : 'i', remove : 'all'}\r
+                               ],\r
+\r
+                               underline : [\r
+                                       {inline : 'span', styles : {textDecoration : 'underline'}, exact : true},\r
+                                       {inline : 'u', remove : 'all'}\r
+                               ],\r
+\r
+                               strikethrough : [\r
+                                       {inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},\r
+                                       {inline : 'strike', remove : 'all'}\r
+                               ],\r
+\r
+                               forecolor : {inline : 'span', styles : {color : '%value'}, wrap_links : false},\r
+                               hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}, wrap_links : false},\r
+                               fontname : {inline : 'span', styles : {fontFamily : '%value'}},\r
+                               fontsize : {inline : 'span', styles : {fontSize : '%value'}},\r
+                               fontsize_class : {inline : 'span', attributes : {'class' : '%value'}},\r
+                               blockquote : {block : 'blockquote', wrapper : 1, remove : 'all'},\r
+                               subscript : {inline : 'sub'},\r
+                               superscript : {inline : 'sup'},\r
+\r
+                               link : {inline : 'a', selector : 'a', remove : 'all', split : true, deep : true,\r
+                                       onmatch : function(node) {\r
+                                               return true;\r
+                                       },\r
+\r
+                                       onformat : function(elm, fmt, vars) {\r
+                                               each(vars, function(value, key) {\r
+                                                       dom.setAttrib(elm, key, value);\r
+                                               });\r
+                                       }\r
+                               },\r
+\r
+                               removeformat : [\r
+                                       {selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},\r
+                                       {selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},\r
+                                       {selector : '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}\r
+                               ]\r
+                       });\r
+\r
+                       // Register default block formats\r
+                       each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {\r
+                               register(name, {block : name, remove : 'all'});\r
+                       });\r
+\r
+                       // Register user defined formats\r
+                       register(ed.settings.formats);\r
+               };\r
+\r
+               function addKeyboardShortcuts() {\r
+                       // Add some inline shortcuts\r
+                       ed.addShortcut('ctrl+b', 'bold_desc', 'Bold');\r
+                       ed.addShortcut('ctrl+i', 'italic_desc', 'Italic');\r
+                       ed.addShortcut('ctrl+u', 'underline_desc', 'Underline');\r
+\r
+                       // BlockFormat shortcuts keys\r
+                       for (var i = 1; i <= 6; i++) {\r
+                               ed.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);\r
+                       }\r
+\r
+                       ed.addShortcut('ctrl+7', '', ['FormatBlock', false, 'p']);\r
+                       ed.addShortcut('ctrl+8', '', ['FormatBlock', false, 'div']);\r
+                       ed.addShortcut('ctrl+9', '', ['FormatBlock', false, 'address']);\r
+               };\r
+\r
+               // Public functions\r
+\r
+               function get(name) {\r
+                       return name ? formats[name] : formats;\r
+               };\r
+\r
+               function register(name, format) {\r
+                       if (name) {\r
+                               if (typeof(name) !== 'string') {\r
+                                       each(name, function(format, name) {\r
+                                               register(name, format);\r
+                                       });\r
+                               } else {\r
+                                       // Force format into array and add it to internal collection\r
+                                       format = format.length ? format : [format];\r
+\r
+                                       each(format, function(format) {\r
+                                               // Set deep to false by default on selector formats this to avoid removing\r
+                                               // alignment on images inside paragraphs when alignment is changed on paragraphs\r
+                                               if (format.deep === undef)\r
+                                                       format.deep = !format.selector;\r
+\r
+                                               // Default to true\r
+                                               if (format.split === undef)\r
+                                                       format.split = !format.selector || format.inline;\r
+\r
+                                               // Default to true\r
+                                               if (format.remove === undef && format.selector && !format.inline)\r
+                                                       format.remove = 'none';\r
+\r
+                                               // Mark format as a mixed format inline + block level\r
+                                               if (format.selector && format.inline) {\r
+                                                       format.mixed = true;\r
+                                                       format.block_expand = true;\r
+                                               }\r
+\r
+                                               // Split classes if needed\r
+                                               if (typeof(format.classes) === 'string')\r
+                                                       format.classes = format.classes.split(/\s+/);\r
+                                       });\r
+\r
+                                       formats[name] = format;\r
+                               }\r
+                       }\r
+               };\r
+\r
+               var getTextDecoration = function(node) {\r
+                       var decoration;\r
+\r
+                       ed.dom.getParent(node, function(n) {\r
+                               decoration = ed.dom.getStyle(n, 'text-decoration');\r
+                               return decoration && decoration !== 'none';\r
+                       });\r
+\r
+                       return decoration;\r
+               };\r
+\r
+               var processUnderlineAndColor = function(node) {\r
+                       var textDecoration;\r
+                       if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {\r
+                               textDecoration = getTextDecoration(node.parentNode);\r
+                               if (ed.dom.getStyle(node, 'color') && textDecoration) {\r
+                                       ed.dom.setStyle(node, 'text-decoration', textDecoration);\r
+                               } else if (ed.dom.getStyle(node, 'textdecoration') === textDecoration) {\r
+                                       ed.dom.setStyle(node, 'text-decoration', null);\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function apply(name, vars, node) {\r
+                       var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed();\r
+\r
+                       function setElementFormat(elm, fmt) {\r
+                               fmt = fmt || format;\r
+\r
+                               if (elm) {\r
+                                       if (fmt.onformat) {\r
+                                               fmt.onformat(elm, fmt, vars, node);\r
+                                       }\r
+\r
+                                       each(fmt.styles, function(value, name) {\r
+                                               dom.setStyle(elm, name, replaceVars(value, vars));\r
+                                       });\r
+\r
+                                       each(fmt.attributes, function(value, name) {\r
+                                               dom.setAttrib(elm, name, replaceVars(value, vars));\r
+                                       });\r
+\r
+                                       each(fmt.classes, function(value) {\r
+                                               value = replaceVars(value, vars);\r
+\r
+                                               if (!dom.hasClass(elm, value))\r
+                                                       dom.addClass(elm, value);\r
+                                       });\r
+                               }\r
+                       };\r
+                       function adjustSelectionToVisibleSelection() {\r
+                               function findSelectionEnd(start, end) {\r
+                                       var walker = new TreeWalker(end);\r
+                                       for (node = walker.current(); node; node = walker.prev()) {\r
+                                               if (node.childNodes.length > 1 || node == start || node.tagName == 'BR') {\r
+                                                       return node;\r
+                                               }\r
+                                       }\r
+                               };\r
+\r
+                               // Adjust selection so that a end container with a end offset of zero is not included in the selection\r
+                               // as this isn't visible to the user.\r
+                               var rng = ed.selection.getRng();\r
+                               var start = rng.startContainer;\r
+                               var end = rng.endContainer;\r
+\r
+                               if (start != end && rng.endOffset === 0) {\r
+                                       var newEnd = findSelectionEnd(start, end);\r
+                                       var endOffset = newEnd.nodeType == 3 ? newEnd.length : newEnd.childNodes.length;\r
+\r
+                                       rng.setEnd(newEnd, endOffset);\r
+                               }\r
+\r
+                               return rng;\r
+                       }\r
+                       \r
+                       function applyStyleToList(node, bookmark, wrapElm, newWrappers, process){\r
+                               var nodes = [], listIndex = -1, list, startIndex = -1, endIndex = -1, currentWrapElm;\r
+                               \r
+                               // find the index of the first child list.\r
+                               each(node.childNodes, function(n, index) {\r
+                                       if (n.nodeName === "UL" || n.nodeName === "OL") {\r
+                                               listIndex = index;\r
+                                               list = n;\r
+                                               return false;\r
+                                       }\r
+                               });\r
+                               \r
+                               // get the index of the bookmarks\r
+                               each(node.childNodes, function(n, index) {\r
+                                       if (n.nodeName === "SPAN" && dom.getAttrib(n, "data-mce-type") == "bookmark") {\r
+                                               if (n.id == bookmark.id + "_start") {\r
+                                                       startIndex = index;\r
+                                               } else if (n.id == bookmark.id + "_end") {\r
+                                                       endIndex = index;\r
+                                               }\r
+                                       }\r
+                               });\r
+                               \r
+                               // if the selection spans across an embedded list, or there isn't an embedded list - handle processing normally\r
+                               if (listIndex <= 0 || (startIndex < listIndex && endIndex > listIndex)) {\r
+                                       each(tinymce.grep(node.childNodes), process);\r
+                                       return 0;\r
+                               } else {\r
+                                       currentWrapElm = dom.clone(wrapElm, FALSE);\r
+\r
+                                       // create a list of the nodes on the same side of the list as the selection\r
+                                       each(tinymce.grep(node.childNodes), function(n, index) {\r
+                                               if ((startIndex < listIndex && index < listIndex) || (startIndex > listIndex && index > listIndex)) {\r
+                                                       nodes.push(n); \r
+                                                       n.parentNode.removeChild(n);\r
+                                               }\r
+                                       });\r
+\r
+                                       // insert the wrapping element either before or after the list.\r
+                                       if (startIndex < listIndex) {\r
+                                               node.insertBefore(currentWrapElm, list);\r
+                                       } else if (startIndex > listIndex) {\r
+                                               node.insertBefore(currentWrapElm, list.nextSibling);\r
+                                       }\r
+                                       \r
+                                       // add the new nodes to the list.\r
+                                       newWrappers.push(currentWrapElm);\r
+\r
+                                       each(nodes, function(node) {\r
+                                               currentWrapElm.appendChild(node);\r
+                                       });\r
+\r
+                                       return currentWrapElm;\r
+                               }\r
+                       };\r
+\r
+                       function applyRngStyle(rng, bookmark, node_specific) {\r
+                               var newWrappers = [], wrapName, wrapElm, contentEditable = true;\r
+\r
+                               // Setup wrapper element\r
+                               wrapName = format.inline || format.block;\r
+                               wrapElm = dom.create(wrapName);\r
+                               setElementFormat(wrapElm);\r
+\r
+                               rangeUtils.walk(rng, function(nodes) {\r
+                                       var currentWrapElm;\r
+\r
+                                       function process(node) {\r
+                                               var nodeName, parentName, found, hasContentEditableState, lastContentEditable;\r
+\r
+                                               lastContentEditable = contentEditable;\r
+                                               nodeName = node.nodeName.toLowerCase();\r
+                                               parentName = node.parentNode.nodeName.toLowerCase();\r
+\r
+                                               // Node has a contentEditable value\r
+                                               if (node.nodeType === 1 && getContentEditable(node)) {\r
+                                                       lastContentEditable = contentEditable;\r
+                                                       contentEditable = getContentEditable(node) === "true";\r
+                                                       hasContentEditableState = true; // We don't want to wrap the container only it's children\r
+                                               }\r
+\r
+                                               // Stop wrapping on br elements\r
+                                               if (isEq(nodeName, 'br')) {\r
+                                                       currentWrapElm = 0;\r
+\r
+                                                       // Remove any br elements when we wrap things\r
+                                                       if (format.block)\r
+                                                               dom.remove(node);\r
+\r
+                                                       return;\r
+                                               }\r
+\r
+                                               // If node is wrapper type\r
+                                               if (format.wrapper && matchNode(node, name, vars)) {\r
+                                                       currentWrapElm = 0;\r
+                                                       return;\r
+                                               }\r
+\r
+                                               // Can we rename the block\r
+                                               if (contentEditable && !hasContentEditableState && format.block && !format.wrapper && isTextBlock(nodeName)) {\r
+                                                       node = dom.rename(node, wrapName);\r
+                                                       setElementFormat(node);\r
+                                                       newWrappers.push(node);\r
+                                                       currentWrapElm = 0;\r
+                                                       return;\r
+                                               }\r
+\r
+                                               // Handle selector patterns\r
+                                               if (format.selector) {\r
+                                                       // Look for matching formats\r
+                                                       each(formatList, function(format) {\r
+                                                               // Check collapsed state if it exists\r
+                                                               if ('collapsed' in format && format.collapsed !== isCollapsed) {\r
+                                                                       return;\r
+                                                               }\r
+\r
+                                                               if (dom.is(node, format.selector) && !isCaretNode(node)) {\r
+                                                                       setElementFormat(node, format);\r
+                                                                       found = true;\r
+                                                               }\r
+                                                       });\r
+\r
+                                                       // Continue processing if a selector match wasn't found and a inline element is defined\r
+                                                       if (!format.inline || found) {\r
+                                                               currentWrapElm = 0;\r
+                                                               return;\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Is it valid to wrap this item\r
+                                               if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&\r
+                                                               !(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) {\r
+                                                       // Start wrapping\r
+                                                       if (!currentWrapElm) {\r
+                                                               // Wrap the node\r
+                                                               currentWrapElm = dom.clone(wrapElm, FALSE);\r
+                                                               node.parentNode.insertBefore(currentWrapElm, node);\r
+                                                               newWrappers.push(currentWrapElm);\r
+                                                       }\r
+\r
+                                                       currentWrapElm.appendChild(node);\r
+                                               } else if (nodeName == 'li' && bookmark) {\r
+                                                       // Start wrapping - if we are in a list node and have a bookmark, then we will always begin by wrapping in a new element.\r
+                                                       currentWrapElm = applyStyleToList(node, bookmark, wrapElm, newWrappers, process);\r
+                                               } else {\r
+                                                       // Start a new wrapper for possible children\r
+                                                       currentWrapElm = 0;\r
+                                                       \r
+                                                       each(tinymce.grep(node.childNodes), process);\r
+\r
+                                                       if (hasContentEditableState) {\r
+                                                               contentEditable = lastContentEditable; // Restore last contentEditable state from stack\r
+                                                       }\r
+\r
+                                                       // End the last wrapper\r
+                                                       currentWrapElm = 0;\r
+                                               }\r
+                                       };\r
+\r
+                                       // Process siblings from range\r
+                                       each(nodes, process);\r
+                               });\r
+\r
+                               // Wrap links inside as well, for example color inside a link when the wrapper is around the link\r
+                               if (format.wrap_links === false) {\r
+                                       each(newWrappers, function(node) {\r
+                                               function process(node) {\r
+                                                       var i, currentWrapElm, children;\r
+\r
+                                                       if (node.nodeName === 'A') {\r
+                                                               currentWrapElm = dom.clone(wrapElm, FALSE);\r
+                                                               newWrappers.push(currentWrapElm);\r
+\r
+                                                               children = tinymce.grep(node.childNodes);\r
+                                                               for (i = 0; i < children.length; i++)\r
+                                                                       currentWrapElm.appendChild(children[i]);\r
+\r
+                                                               node.appendChild(currentWrapElm);\r
+                                                       }\r
+\r
+                                                       each(tinymce.grep(node.childNodes), process);\r
+                                               };\r
+\r
+                                               process(node);\r
+                                       });\r
+                               }\r
+\r
+                               // Cleanup\r
+                               \r
+                               each(newWrappers, function(node) {\r
+                                       var childCount;\r
+\r
+                                       function getChildCount(node) {\r
+                                               var count = 0;\r
+\r
+                                               each(node.childNodes, function(node) {\r
+                                                       if (!isWhiteSpaceNode(node) && !isBookmarkNode(node))\r
+                                                               count++;\r
+                                               });\r
+\r
+                                               return count;\r
+                                       };\r
+\r
+                                       function mergeStyles(node) {\r
+                                               var child, clone;\r
+\r
+                                               each(node.childNodes, function(node) {\r
+                                                       if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) {\r
+                                                               child = node;\r
+                                                               return FALSE; // break loop\r
+                                                       }\r
+                                               });\r
+\r
+                                               // If child was found and of the same type as the current node\r
+                                               if (child && matchName(child, format)) {\r
+                                                       clone = dom.clone(child, FALSE);\r
+                                                       setElementFormat(clone);\r
+\r
+                                                       dom.replace(clone, node, TRUE);\r
+                                                       dom.remove(child, 1);\r
+                                               }\r
+\r
+                                               return clone || node;\r
+                                       };\r
+\r
+                                       childCount = getChildCount(node);\r
+\r
+                                       // Remove empty nodes but only if there is multiple wrappers and they are not block\r
+                                       // elements so never remove single <h1></h1> since that would remove the currrent empty block element where the caret is at\r
+                                       if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) {\r
+                                               dom.remove(node, 1);\r
+                                               return;\r
+                                       }\r
+\r
+                                       if (format.inline || format.wrapper) {\r
+                                               // Merges the current node with it's children of similar type to reduce the number of elements\r
+                                               if (!format.exact && childCount === 1)\r
+                                                       node = mergeStyles(node);\r
+\r
+                                               // Remove/merge children\r
+                                               each(formatList, function(format) {\r
+                                                       // Merge all children of similar type will move styles from child to parent\r
+                                                       // this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>\r
+                                                       // will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>\r
+                                                       each(dom.select(format.inline, node), function(child) {\r
+                                                               var parent;\r
+\r
+                                                               // When wrap_links is set to false we don't want\r
+                                                               // to remove the format on children within links\r
+                                                               if (format.wrap_links === false) {\r
+                                                                       parent = child.parentNode;\r
+\r
+                                                                       do {\r
+                                                                               if (parent.nodeName === 'A')\r
+                                                                                       return;\r
+                                                                       } while (parent = parent.parentNode);\r
+                                                               }\r
+\r
+                                                               removeFormat(format, vars, child, format.exact ? child : null);\r
+                                                       });\r
+                                               });\r
+\r
+                                               // Remove child if direct parent is of same type\r
+                                               if (matchNode(node.parentNode, name, vars)) {\r
+                                                       dom.remove(node, 1);\r
+                                                       node = 0;\r
+                                                       return TRUE;\r
+                                               }\r
+\r
+                                               // Look for parent with similar style format\r
+                                               if (format.merge_with_parents) {\r
+                                                       dom.getParent(node.parentNode, function(parent) {\r
+                                                               if (matchNode(parent, name, vars)) {\r
+                                                                       dom.remove(node, 1);\r
+                                                                       node = 0;\r
+                                                                       return TRUE;\r
+                                                               }\r
+                                                       });\r
+                                               }\r
+\r
+                                               // Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>\r
+                                               if (node && format.merge_siblings !== false) {\r
+                                                       node = mergeSiblings(getNonWhiteSpaceSibling(node), node);\r
+                                                       node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE));\r
+                                               }\r
+                                       }\r
+                               });\r
+                       };\r
+\r
+                       if (format) {\r
+                               if (node) {\r
+                                       if (node.nodeType) {\r
+                                               rng = dom.createRng();\r
+                                               rng.setStartBefore(node);\r
+                                               rng.setEndAfter(node);\r
+                                               applyRngStyle(expandRng(rng, formatList), null, true);\r
+                                       } else {\r
+                                               applyRngStyle(node, null, true);\r
+                                       }\r
+                               } else {\r
+                                       if (!isCollapsed || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) {\r
+                                               // Obtain selection node before selection is unselected by applyRngStyle()\r
+                                               var curSelNode = ed.selection.getNode();\r
+\r
+                                               // If the formats have a default block and we can't find a parent block then start wrapping it with a DIV this is for forced_root_blocks: false\r
+                                               // It's kind of a hack but people should be using the default block type P since all desktop editors work that way\r
+                                               if (!forcedRootBlock && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {\r
+                                                       apply(formatList[0].defaultBlock);\r
+                                               }\r
+\r
+                                               // Apply formatting to selection\r
+                                               ed.selection.setRng(adjustSelectionToVisibleSelection());\r
+                                               bookmark = selection.getBookmark();\r
+                                               applyRngStyle(expandRng(selection.getRng(TRUE), formatList), bookmark);\r
+\r
+                                               // Colored nodes should be underlined so that the color of the underline matches the text color.\r
+                                               if (format.styles && (format.styles.color || format.styles.textDecoration)) {\r
+                                                       tinymce.walk(curSelNode, processUnderlineAndColor, 'childNodes');\r
+                                                       processUnderlineAndColor(curSelNode);\r
+                                               }\r
+\r
+                                               selection.moveToBookmark(bookmark);\r
+                                               moveStart(selection.getRng(TRUE));\r
+                                               ed.nodeChanged();\r
+                                       } else\r
+                                               performCaretAction('apply', name, vars);\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function remove(name, vars, node) {\r
+                       var formatList = get(name), format = formatList[0], bookmark, i, rng, contentEditable = true;\r
+\r
+                       // Merges the styles for each node\r
+                       function process(node) {\r
+                               var children, i, l, localContentEditable, lastContentEditable, hasContentEditableState;\r
+\r
+                               // Node has a contentEditable value\r
+                               if (node.nodeType === 1 && getContentEditable(node)) {\r
+                                       lastContentEditable = contentEditable;\r
+                                       contentEditable = getContentEditable(node) === "true";\r
+                                       hasContentEditableState = true; // We don't want to wrap the container only it's children\r
+                               }\r
+\r
+                               // Grab the children first since the nodelist might be changed\r
+                               children = tinymce.grep(node.childNodes);\r
+\r
+                               // Process current node\r
+                               if (contentEditable && !hasContentEditableState) {\r
+                                       for (i = 0, l = formatList.length; i < l; i++) {\r
+                                               if (removeFormat(formatList[i], vars, node, node))\r
+                                                       break;\r
+                                       }\r
+                               }\r
+\r
+                               // Process the children\r
+                               if (format.deep) {\r
+                                       if (children.length) {                                  \r
+                                               for (i = 0, l = children.length; i < l; i++)\r
+                                                       process(children[i]);\r
+\r
+                                               if (hasContentEditableState) {\r
+                                                       contentEditable = lastContentEditable; // Restore last contentEditable state from stack\r
+                                               }\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       function findFormatRoot(container) {\r
+                               var formatRoot;\r
+\r
+                               // Find format root\r
+                               each(getParents(container.parentNode).reverse(), function(parent) {\r
+                                       var format;\r
+\r
+                                       // Find format root element\r
+                                       if (!formatRoot && parent.id != '_start' && parent.id != '_end') {\r
+                                               // Is the node matching the format we are looking for\r
+                                               format = matchNode(parent, name, vars);\r
+                                               if (format && format.split !== false)\r
+                                                       formatRoot = parent;\r
+                                       }\r
+                               });\r
+\r
+                               return formatRoot;\r
+                       };\r
+\r
+                       function wrapAndSplit(format_root, container, target, split) {\r
+                               var parent, clone, lastClone, firstClone, i, formatRootParent;\r
+\r
+                               // Format root found then clone formats and split it\r
+                               if (format_root) {\r
+                                       formatRootParent = format_root.parentNode;\r
+\r
+                                       for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) {\r
+                                               clone = dom.clone(parent, FALSE);\r
+\r
+                                               for (i = 0; i < formatList.length; i++) {\r
+                                                       if (removeFormat(formatList[i], vars, clone, clone)) {\r
+                                                               clone = 0;\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Build wrapper node\r
+                                               if (clone) {\r
+                                                       if (lastClone)\r
+                                                               clone.appendChild(lastClone);\r
+\r
+                                                       if (!firstClone)\r
+                                                               firstClone = clone;\r
+\r
+                                                       lastClone = clone;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Never split block elements if the format is mixed\r
+                                       if (split && (!format.mixed || !isBlock(format_root)))\r
+                                               container = dom.split(format_root, container);\r
+\r
+                                       // Wrap container in cloned formats\r
+                                       if (lastClone) {\r
+                                               target.parentNode.insertBefore(lastClone, target);\r
+                                               firstClone.appendChild(target);\r
+                                       }\r
+                               }\r
+\r
+                               return container;\r
+                       };\r
+\r
+                       function splitToFormatRoot(container) {\r
+                               return wrapAndSplit(findFormatRoot(container), container, container, true);\r
+                       };\r
+\r
+                       function unwrap(start) {\r
+                               var node = dom.get(start ? '_start' : '_end'),\r
+                                       out = node[start ? 'firstChild' : 'lastChild'];\r
+\r
+                               // If the end is placed within the start the result will be removed\r
+                               // So this checks if the out node is a bookmark node if it is it\r
+                               // checks for another more suitable node\r
+                               if (isBookmarkNode(out))\r
+                                       out = out[start ? 'firstChild' : 'lastChild'];\r
+\r
+                               dom.remove(node, true);\r
+\r
+                               return out;\r
+                       };\r
+\r
+                       function removeRngStyle(rng) {\r
+                               var startContainer, endContainer, node;\r
+\r
+                               rng = expandRng(rng, formatList, TRUE);\r
+\r
+                               if (format.split) {\r
+                                       startContainer = getContainer(rng, TRUE);\r
+                                       endContainer = getContainer(rng);\r
+\r
+                                       if (startContainer != endContainer) {\r
+                                               // WebKit will render the table incorrectly if we wrap a TD in a SPAN so lets see if the can use the first child instead\r
+                                               // This will happen if you tripple click a table cell and use remove formatting\r
+                                               if (/^(TR|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) {\r
+                                                       startContainer = (startContainer.nodeName == "TD" ? startContainer.firstChild : startContainer.firstChild.firstChild) || startContainer;\r
+                                               }\r
+\r
+                                               // Wrap start/end nodes in span element since these might be cloned/moved\r
+                                               startContainer = wrap(startContainer, 'span', {id : '_start', 'data-mce-type' : 'bookmark'});\r
+                                               endContainer = wrap(endContainer, 'span', {id : '_end', 'data-mce-type' : 'bookmark'});\r
+\r
+                                               // Split start/end\r
+                                               splitToFormatRoot(startContainer);\r
+                                               splitToFormatRoot(endContainer);\r
+\r
+                                               // Unwrap start/end to get real elements again\r
+                                               startContainer = unwrap(TRUE);\r
+                                               endContainer = unwrap();\r
+                                       } else\r
+                                               startContainer = endContainer = splitToFormatRoot(startContainer);\r
+\r
+                                       // Update range positions since they might have changed after the split operations\r
+                                       rng.startContainer = startContainer.parentNode;\r
+                                       rng.startOffset = nodeIndex(startContainer);\r
+                                       rng.endContainer = endContainer.parentNode;\r
+                                       rng.endOffset = nodeIndex(endContainer) + 1;\r
+                               }\r
+\r
+                               // Remove items between start/end\r
+                               rangeUtils.walk(rng, function(nodes) {\r
+                                       each(nodes, function(node) {\r
+                                               process(node);\r
+\r
+                                               // Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined.\r
+                                               if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' && node.parentNode && getTextDecoration(node.parentNode) === 'underline') {\r
+                                                       removeFormat({'deep': false, 'exact': true, 'inline': 'span', 'styles': {'textDecoration' : 'underline'}}, null, node);\r
+                                               }\r
+                                       });\r
+                               });\r
+                       };\r
+\r
+                       // Handle node\r
+                       if (node) {\r
+                               if (node.nodeType) {\r
+                                       rng = dom.createRng();\r
+                                       rng.setStartBefore(node);\r
+                                       rng.setEndAfter(node);\r
+                                       removeRngStyle(rng);\r
+                               } else {\r
+                                       removeRngStyle(node);\r
+                               }\r
+\r
+                               return;\r
+                       }\r
+\r
+                       if (!selection.isCollapsed() || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) {\r
+                               bookmark = selection.getBookmark();\r
+                               removeRngStyle(selection.getRng(TRUE));\r
+                               selection.moveToBookmark(bookmark);\r
+\r
+                               // Check if start element still has formatting then we are at: "<b>text|</b>text" and need to move the start into the next text node\r
+                               if (format.inline && match(name, vars, selection.getStart())) {\r
+                                       moveStart(selection.getRng(true));\r
+                               }\r
+\r
+                               ed.nodeChanged();\r
+                       } else\r
+                               performCaretAction('remove', name, vars);\r
+               };\r
+\r
+               function toggle(name, vars, node) {\r
+                       var fmt = get(name);\r
+\r
+                       if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle))\r
+                               remove(name, vars, node);\r
+                       else\r
+                               apply(name, vars, node);\r
+               };\r
+\r
+               function matchNode(node, name, vars, similar) {\r
+                       var formatList = get(name), format, i, classes;\r
+\r
+                       function matchItems(node, format, item_name) {\r
+                               var key, value, items = format[item_name], i;\r
+\r
+                               // Custom match\r
+                               if (format.onmatch) {\r
+                                       return format.onmatch(node, format, item_name);\r
+                               }\r
+\r
+                               // Check all items\r
+                               if (items) {\r
+                                       // Non indexed object\r
+                                       if (items.length === undef) {\r
+                                               for (key in items) {\r
+                                                       if (items.hasOwnProperty(key)) {\r
+                                                               if (item_name === 'attributes')\r
+                                                                       value = dom.getAttrib(node, key);\r
+                                                               else\r
+                                                                       value = getStyle(node, key);\r
+\r
+                                                               if (similar && !value && !format.exact)\r
+                                                                       return;\r
+\r
+                                                               if ((!similar || format.exact) && !isEq(value, replaceVars(items[key], vars)))\r
+                                                                       return;\r
+                                                       }\r
+                                               }\r
+                                       } else {\r
+                                               // Only one match needed for indexed arrays\r
+                                               for (i = 0; i < items.length; i++) {\r
+                                                       if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i]))\r
+                                                               return format;\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               return format;\r
+                       };\r
+\r
+                       if (formatList && node) {\r
+                               // Check each format in list\r
+                               for (i = 0; i < formatList.length; i++) {\r
+                                       format = formatList[i];\r
+\r
+                                       // Name name, attributes, styles and classes\r
+                                       if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) {\r
+                                               // Match classes\r
+                                               if (classes = format.classes) {\r
+                                                       for (i = 0; i < classes.length; i++) {\r
+                                                               if (!dom.hasClass(node, classes[i]))\r
+                                                                       return;\r
+                                                       }\r
+                                               }\r
+\r
+                                               return format;\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function match(name, vars, node) {\r
+                       var startNode;\r
+\r
+                       function matchParents(node) {\r
+                               // Find first node with similar format settings\r
+                               node = dom.getParent(node, function(node) {\r
+                                       return !!matchNode(node, name, vars, true);\r
+                               });\r
+\r
+                               // Do an exact check on the similar format element\r
+                               return matchNode(node, name, vars);\r
+                       };\r
+\r
+                       // Check specified node\r
+                       if (node)\r
+                               return matchParents(node);\r
+\r
+                       // Check selected node\r
+                       node = selection.getNode();\r
+                       if (matchParents(node))\r
+                               return TRUE;\r
+\r
+                       // Check start node if it's different\r
+                       startNode = selection.getStart();\r
+                       if (startNode != node) {\r
+                               if (matchParents(startNode))\r
+                                       return TRUE;\r
+                       }\r
+\r
+                       return FALSE;\r
+               };\r
+\r
+               function matchAll(names, vars) {\r
+                       var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name;\r
+\r
+                       // Check start of selection for formats\r
+                       startElement = selection.getStart();\r
+                       dom.getParent(startElement, function(node) {\r
+                               var i, name;\r
+\r
+                               for (i = 0; i < names.length; i++) {\r
+                                       name = names[i];\r
+\r
+                                       if (!checkedMap[name] && matchNode(node, name, vars)) {\r
+                                               checkedMap[name] = true;\r
+                                               matchedFormatNames.push(name);\r
+                                       }\r
+                               }\r
+                       }, dom.getRoot());\r
+\r
+                       return matchedFormatNames;\r
+               };\r
+\r
+               function canApply(name) {\r
+                       var formatList = get(name), startNode, parents, i, x, selector;\r
+\r
+                       if (formatList) {\r
+                               startNode = selection.getStart();\r
+                               parents = getParents(startNode);\r
+\r
+                               for (x = formatList.length - 1; x >= 0; x--) {\r
+                                       selector = formatList[x].selector;\r
+\r
+                                       // Format is not selector based, then always return TRUE\r
+                                       if (!selector)\r
+                                               return TRUE;\r
+\r
+                                       for (i = parents.length - 1; i >= 0; i--) {\r
+                                               if (dom.is(parents[i], selector))\r
+                                                       return TRUE;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return FALSE;\r
+               };\r
+\r
+               function formatChanged(formats, callback, similar) {\r
+                       var currentFormats;\r
+\r
+                       // Setup format node change logic\r
+                       if (!formatChangeData) {\r
+                               formatChangeData = {};\r
+                               currentFormats = {};\r
+\r
+                               ed.onNodeChange.addToTop(function(ed, cm, node) {\r
+                                       var parents = getParents(node), matchedFormats = {};\r
+\r
+                                       // Check for new formats\r
+                                       each(formatChangeData, function(callbacks, format) {\r
+                                               each(parents, function(node) {\r
+                                                       if (matchNode(node, format, {}, callbacks.similar)) {\r
+                                                               if (!currentFormats[format]) {\r
+                                                                       // Execute callbacks\r
+                                                                       each(callbacks, function(callback) {\r
+                                                                               callback(true, {node: node, format: format, parents: parents});\r
+                                                                       });\r
+\r
+                                                                       currentFormats[format] = callbacks;\r
+                                                               }\r
+\r
+                                                               matchedFormats[format] = callbacks;\r
+                                                               return false;\r
+                                                       }\r
+                                               });\r
+                                       });\r
+\r
+                                       // Check if current formats still match\r
+                                       each(currentFormats, function(callbacks, format) {\r
+                                               if (!matchedFormats[format]) {\r
+                                                       delete currentFormats[format];\r
+\r
+                                                       each(callbacks, function(callback) {\r
+                                                               callback(false, {node: node, format: format, parents: parents});\r
+                                                       });\r
+                                               }\r
+                                       });\r
+                               });\r
+                       }\r
+\r
+                       // Add format listeners\r
+                       each(formats.split(','), function(format) {\r
+                               if (!formatChangeData[format]) {\r
+                                       formatChangeData[format] = [];\r
+                                       formatChangeData[format].similar = similar;\r
+                               }\r
+\r
+                               formatChangeData[format].push(callback);\r
+                       });\r
+\r
+                       return this;\r
+               };\r
+\r
+               // Expose to public\r
+               tinymce.extend(this, {\r
+                       get : get,\r
+                       register : register,\r
+                       apply : apply,\r
+                       remove : remove,\r
+                       toggle : toggle,\r
+                       match : match,\r
+                       matchAll : matchAll,\r
+                       matchNode : matchNode,\r
+                       canApply : canApply,\r
+                       formatChanged: formatChanged\r
+               });\r
+\r
+               // Initialize\r
+               defaultFormats();\r
+               addKeyboardShortcuts();\r
+\r
+               // Private functions\r
+\r
+               function matchName(node, format) {\r
+                       // Check for inline match\r
+                       if (isEq(node, format.inline))\r
+                               return TRUE;\r
+\r
+                       // Check for block match\r
+                       if (isEq(node, format.block))\r
+                               return TRUE;\r
+\r
+                       // Check for selector match\r
+                       if (format.selector)\r
+                               return dom.is(node, format.selector);\r
+               };\r
+\r
+               function isEq(str1, str2) {\r
+                       str1 = str1 || '';\r
+                       str2 = str2 || '';\r
+\r
+                       str1 = '' + (str1.nodeName || str1);\r
+                       str2 = '' + (str2.nodeName || str2);\r
+\r
+                       return str1.toLowerCase() == str2.toLowerCase();\r
+               };\r
+\r
+               function getStyle(node, name) {\r
+                       var styleVal = dom.getStyle(node, name);\r
+\r
+                       // Force the format to hex\r
+                       if (name == 'color' || name == 'backgroundColor')\r
+                               styleVal = dom.toHex(styleVal);\r
+\r
+                       // Opera will return bold as 700\r
+                       if (name == 'fontWeight' && styleVal == 700)\r
+                               styleVal = 'bold';\r
+\r
+                       return '' + styleVal;\r
+               };\r
+\r
+               function replaceVars(value, vars) {\r
+                       if (typeof(value) != "string")\r
+                               value = value(vars);\r
+                       else if (vars) {\r
+                               value = value.replace(/%(\w+)/g, function(str, name) {\r
+                                       return vars[name] || str;\r
+                               });\r
+                       }\r
+\r
+                       return value;\r
+               };\r
+\r
+               function isWhiteSpaceNode(node) {\r
+                       return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue);\r
+               };\r
+\r
+               function wrap(node, name, attrs) {\r
+                       var wrapper = dom.create(name, attrs);\r
+\r
+                       node.parentNode.insertBefore(wrapper, node);\r
+                       wrapper.appendChild(node);\r
+\r
+                       return wrapper;\r
+               };\r
+\r
+               function expandRng(rng, format, remove) {\r
+                       var sibling, lastIdx, leaf, endPoint,\r
+                               startContainer = rng.startContainer,\r
+                               startOffset = rng.startOffset,\r
+                               endContainer = rng.endContainer,\r
+                               endOffset = rng.endOffset;\r
+\r
+                       // This function walks up the tree if there is no siblings before/after the node\r
+                       function findParentContainer(start) {\r
+                               var container, parent, child, sibling, siblingName, root;\r
+\r
+                               container = parent = start ? startContainer : endContainer;\r
+                               siblingName = start ? 'previousSibling' : 'nextSibling';\r
+                               root = dom.getRoot();\r
+\r
+                               // If it's a text node and the offset is inside the text\r
+                               if (container.nodeType == 3 && !isWhiteSpaceNode(container)) {\r
+                                       if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {\r
+                                               return container;\r
+                                       }\r
+                               }\r
+\r
+                               for (;;) {\r
+                                       // Stop expanding on block elements\r
+                                       if (!format[0].block_expand && isBlock(parent))\r
+                                               return parent;\r
+\r
+                                       // Walk left/right\r
+                                       for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {\r
+                                               if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling)) {\r
+                                                       return parent;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Check if we can move up are we at root level or body level\r
+                                       if (parent.parentNode == root) {\r
+                                               container = parent;\r
+                                               break;\r
+                                       }\r
+\r
+                                       parent = parent.parentNode;\r
+                               }\r
+\r
+                               return container;\r
+                       };\r
+\r
+                       // This function walks down the tree to find the leaf at the selection.\r
+                       // The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node.\r
+                       function findLeaf(node, offset) {\r
+                               if (offset === undef)\r
+                                       offset = node.nodeType === 3 ? node.length : node.childNodes.length;\r
+                               while (node && node.hasChildNodes()) {\r
+                                       node = node.childNodes[offset];\r
+                                       if (node)\r
+                                               offset = node.nodeType === 3 ? node.length : node.childNodes.length;\r
+                               }\r
+                               return { node: node, offset: offset };\r
+                       }\r
+\r
+                       // If index based start position then resolve it\r
+                       if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {\r
+                               lastIdx = startContainer.childNodes.length - 1;\r
+                               startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset];\r
+\r
+                               if (startContainer.nodeType == 3)\r
+                                       startOffset = 0;\r
+                       }\r
+\r
+                       // If index based end position then resolve it\r
+                       if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {\r
+                               lastIdx = endContainer.childNodes.length - 1;\r
+                               endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1];\r
+\r
+                               if (endContainer.nodeType == 3)\r
+                                       endOffset = endContainer.nodeValue.length;\r
+                       }\r
+\r
+                       // Expands the node to the closes contentEditable false element if it exists\r
+                       function findParentContentEditable(node) {\r
+                               var parent = node;\r
+\r
+                               while (parent) {\r
+                                       if (parent.nodeType === 1 && getContentEditable(parent)) {\r
+                                               return getContentEditable(parent) === "false" ? parent : node;\r
+                                       }\r
+\r
+                                       parent = parent.parentNode;\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
+\r
+                       function findWordEndPoint(container, offset, start) {\r
+                               var walker, node, pos, lastTextNode;\r
+\r
+                               function findSpace(node, offset) {\r
+                                       var pos, pos2, str = node.nodeValue;\r
+\r
+                                       if (typeof(offset) == "undefined") {\r
+                                               offset = start ? str.length : 0;\r
+                                       }\r
+\r
+                                       if (start) {\r
+                                               pos = str.lastIndexOf(' ', offset);\r
+                                               pos2 = str.lastIndexOf('\u00a0', offset);\r
+                                               pos = pos > pos2 ? pos : pos2;\r
+\r
+                                               // Include the space on remove to avoid tag soup\r
+                                               if (pos !== -1 && !remove) {\r
+                                                       pos++;\r
+                                               }\r
+                                       } else {\r
+                                               pos = str.indexOf(' ', offset);\r
+                                               pos2 = str.indexOf('\u00a0', offset);\r
+                                               pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2;\r
+                                       }\r
+\r
+                                       return pos;\r
+                               };\r
+\r
+                               if (container.nodeType === 3) {\r
+                                       pos = findSpace(container, offset);\r
+\r
+                                       if (pos !== -1) {\r
+                                               return {container : container, offset : pos};\r
+                                       }\r
+\r
+                                       lastTextNode = container;\r
+                               }\r
+\r
+                               // Walk the nodes inside the block\r
+                               walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody());\r
+                               while (node = walker[start ? 'prev' : 'next']()) {\r
+                                       if (node.nodeType === 3) {\r
+                                               lastTextNode = node;\r
+                                               pos = findSpace(node);\r
+\r
+                                               if (pos !== -1) {\r
+                                                       return {container : node, offset : pos};\r
+                                               }\r
+                                       } else if (isBlock(node)) {\r
+                                               break;\r
+                                       }\r
+                               }\r
+\r
+                               if (lastTextNode) {\r
+                                       if (start) {\r
+                                               offset = 0;\r
+                                       } else {\r
+                                               offset = lastTextNode.length;\r
+                                       }\r
+\r
+                                       return {container: lastTextNode, offset: offset};\r
+                               }\r
+                       };\r
+\r
+                       function findSelectorEndPoint(container, sibling_name) {\r
+                               var parents, i, y, curFormat;\r
+\r
+                               if (container.nodeType == 3 && container.nodeValue.length === 0 && container[sibling_name])\r
+                                       container = container[sibling_name];\r
+\r
+                               parents = getParents(container);\r
+                               for (i = 0; i < parents.length; i++) {\r
+                                       for (y = 0; y < format.length; y++) {\r
+                                               curFormat = format[y];\r
+\r
+                                               // If collapsed state is set then skip formats that doesn't match that\r
+                                               if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed)\r
+                                                       continue;\r
+\r
+                                               if (dom.is(parents[i], curFormat.selector))\r
+                                                       return parents[i];\r
+                                       }\r
+                               }\r
+\r
+                               return container;\r
+                       };\r
+\r
+                       function findBlockEndPoint(container, sibling_name, sibling_name2) {\r
+                               var node;\r
+\r
+                               // Expand to block of similar type\r
+                               if (!format[0].wrapper)\r
+                                       node = dom.getParent(container, format[0].block);\r
+\r
+                               // Expand to first wrappable block element or any block element\r
+                               if (!node)\r
+                                       node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, isBlock);\r
+\r
+                               // Exclude inner lists from wrapping\r
+                               if (node && format[0].wrapper)\r
+                                       node = getParents(node, 'ul,ol').reverse()[0] || node;\r
+\r
+                               // Didn't find a block element look for first/last wrappable element\r
+                               if (!node) {\r
+                                       node = container;\r
+\r
+                                       while (node[sibling_name] && !isBlock(node[sibling_name])) {\r
+                                               node = node[sibling_name];\r
+\r
+                                               // Break on BR but include it will be removed later on\r
+                                               // we can't remove it now since we need to check if it can be wrapped\r
+                                               if (isEq(node, 'br'))\r
+                                                       break;\r
+                                       }\r
+                               }\r
+\r
+                               return node || container;\r
+                       };\r
+\r
+                       // Expand to closest contentEditable element\r
+                       startContainer = findParentContentEditable(startContainer);\r
+                       endContainer = findParentContentEditable(endContainer);\r
+\r
+                       // Exclude bookmark nodes if possible\r
+                       if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) {\r
+                               startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode;\r
+                               startContainer = startContainer.nextSibling || startContainer;\r
+\r
+                               if (startContainer.nodeType == 3)\r
+                                       startOffset = 0;\r
+                       }\r
+\r
+                       if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) {\r
+                               endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode;\r
+                               endContainer = endContainer.previousSibling || endContainer;\r
+\r
+                               if (endContainer.nodeType == 3)\r
+                                       endOffset = endContainer.length;\r
+                       }\r
+\r
+                       if (format[0].inline) {\r
+                               if (rng.collapsed) {\r
+                                       // Expand left to closest word boundery\r
+                                       endPoint = findWordEndPoint(startContainer, startOffset, true);\r
+                                       if (endPoint) {\r
+                                               startContainer = endPoint.container;\r
+                                               startOffset = endPoint.offset;\r
+                                       }\r
+\r
+                                       // Expand right to closest word boundery\r
+                                       endPoint = findWordEndPoint(endContainer, endOffset);\r
+                                       if (endPoint) {\r
+                                               endContainer = endPoint.container;\r
+                                               endOffset = endPoint.offset;\r
+                                       }\r
+                               }\r
+\r
+                               // Avoid applying formatting to a trailing space.\r
+                               leaf = findLeaf(endContainer, endOffset);\r
+                               if (leaf.node) {\r
+                                       while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling)\r
+                                               leaf = findLeaf(leaf.node.previousSibling);\r
+\r
+                                       if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 &&\r
+                                                       leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {\r
+\r
+                                               if (leaf.offset > 1) {\r
+                                                       endContainer = leaf.node;\r
+                                                       endContainer.splitText(leaf.offset - 1);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       // Move start/end point up the tree if the leaves are sharp and if we are in different containers\r
+                       // Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!\r
+                       // This will reduce the number of wrapper elements that needs to be created\r
+                       // Move start point up the tree\r
+                       if (format[0].inline || format[0].block_expand) {\r
+                               if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) {\r
+                                       startContainer = findParentContainer(true);\r
+                               }\r
+\r
+                               if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) {\r
+                                       endContainer = findParentContainer();\r
+                               }\r
+                       }\r
+\r
+                       // Expand start/end container to matching selector\r
+                       if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) {\r
+                               // Find new startContainer/endContainer if there is better one\r
+                               startContainer = findSelectorEndPoint(startContainer, 'previousSibling');\r
+                               endContainer = findSelectorEndPoint(endContainer, 'nextSibling');\r
+                       }\r
+\r
+                       // Expand start/end container to matching block element or text node\r
+                       if (format[0].block || format[0].selector) {\r
+                               // Find new startContainer/endContainer if there is better one\r
+                               startContainer = findBlockEndPoint(startContainer, 'previousSibling');\r
+                               endContainer = findBlockEndPoint(endContainer, 'nextSibling');\r
+\r
+                               // Non block element then try to expand up the leaf\r
+                               if (format[0].block) {\r
+                                       if (!isBlock(startContainer))\r
+                                               startContainer = findParentContainer(true);\r
+\r
+                                       if (!isBlock(endContainer))\r
+                                               endContainer = findParentContainer();\r
+                               }\r
+                       }\r
+\r
+                       // Setup index for startContainer\r
+                       if (startContainer.nodeType == 1) {\r
+                               startOffset = nodeIndex(startContainer);\r
+                               startContainer = startContainer.parentNode;\r
+                       }\r
+\r
+                       // Setup index for endContainer\r
+                       if (endContainer.nodeType == 1) {\r
+                               endOffset = nodeIndex(endContainer) + 1;\r
+                               endContainer = endContainer.parentNode;\r
+                       }\r
+\r
+                       // Return new range like object\r
+                       return {\r
+                               startContainer : startContainer,\r
+                               startOffset : startOffset,\r
+                               endContainer : endContainer,\r
+                               endOffset : endOffset\r
+                       };\r
+               }\r
+\r
+               function removeFormat(format, vars, node, compare_node) {\r
+                       var i, attrs, stylesModified;\r
+\r
+                       // Check if node matches format\r
+                       if (!matchName(node, format))\r
+                               return FALSE;\r
+\r
+                       // Should we compare with format attribs and styles\r
+                       if (format.remove != 'all') {\r
+                               // Remove styles\r
+                               each(format.styles, function(value, name) {\r
+                                       value = replaceVars(value, vars);\r
+\r
+                                       // Indexed array\r
+                                       if (typeof(name) === 'number') {\r
+                                               name = value;\r
+                                               compare_node = 0;\r
+                                       }\r
+\r
+                                       if (!compare_node || isEq(getStyle(compare_node, name), value))\r
+                                               dom.setStyle(node, name, '');\r
+\r
+                                       stylesModified = 1;\r
+                               });\r
+\r
+                               // Remove style attribute if it's empty\r
+                               if (stylesModified && dom.getAttrib(node, 'style') == '') {\r
+                                       node.removeAttribute('style');\r
+                                       node.removeAttribute('data-mce-style');\r
+                               }\r
+\r
+                               // Remove attributes\r
+                               each(format.attributes, function(value, name) {\r
+                                       var valueOut;\r
+\r
+                                       value = replaceVars(value, vars);\r
+\r
+                                       // Indexed array\r
+                                       if (typeof(name) === 'number') {\r
+                                               name = value;\r
+                                               compare_node = 0;\r
+                                       }\r
+\r
+                                       if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) {\r
+                                               // Keep internal classes\r
+                                               if (name == 'class') {\r
+                                                       value = dom.getAttrib(node, name);\r
+                                                       if (value) {\r
+                                                               // Build new class value where everything is removed except the internal prefixed classes\r
+                                                               valueOut = '';\r
+                                                               each(value.split(/\s+/), function(cls) {\r
+                                                                       if (/mce\w+/.test(cls))\r
+                                                                               valueOut += (valueOut ? ' ' : '') + cls;\r
+                                                               });\r
+\r
+                                                               // We got some internal classes left\r
+                                                               if (valueOut) {\r
+                                                                       dom.setAttrib(node, name, valueOut);\r
+                                                                       return;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+\r
+                                               // IE6 has a bug where the attribute doesn't get removed correctly\r
+                                               if (name == "class")\r
+                                                       node.removeAttribute('className');\r
+\r
+                                               // Remove mce prefixed attributes\r
+                                               if (MCE_ATTR_RE.test(name))\r
+                                                       node.removeAttribute('data-mce-' + name);\r
+\r
+                                               node.removeAttribute(name);\r
+                                       }\r
+                               });\r
+\r
+                               // Remove classes\r
+                               each(format.classes, function(value) {\r
+                                       value = replaceVars(value, vars);\r
+\r
+                                       if (!compare_node || dom.hasClass(compare_node, value))\r
+                                               dom.removeClass(node, value);\r
+                               });\r
+\r
+                               // Check for non internal attributes\r
+                               attrs = dom.getAttribs(node);\r
+                               for (i = 0; i < attrs.length; i++) {\r
+                                       if (attrs[i].nodeName.indexOf('_') !== 0)\r
+                                               return FALSE;\r
+                               }\r
+                       }\r
+\r
+                       // Remove the inline child if it's empty for example <b> or <span>\r
+                       if (format.remove != 'none') {\r
+                               removeNode(node, format);\r
+                               return TRUE;\r
+                       }\r
+               };\r
+\r
+               function removeNode(node, format) {\r
+                       var parentNode = node.parentNode, rootBlockElm;\r
+\r
+                       function find(node, next, inc) {\r
+                               node = getNonWhiteSpaceSibling(node, next, inc);\r
+\r
+                               return !node || (node.nodeName == 'BR' || isBlock(node));\r
+                       };\r
+\r
+                       if (format.block) {\r
+                               if (!forcedRootBlock) {\r
+                                       // Append BR elements if needed before we remove the block\r
+                                       if (isBlock(node) && !isBlock(parentNode)) {\r
+                                               if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1))\r
+                                                       node.insertBefore(dom.create('br'), node.firstChild);\r
+\r
+                                               if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1))\r
+                                                       node.appendChild(dom.create('br'));\r
+                                       }\r
+                               } else {\r
+                                       // Wrap the block in a forcedRootBlock if we are at the root of document\r
+                                       if (parentNode == dom.getRoot()) {\r
+                                               if (!format.list_block || !isEq(node, format.list_block)) {\r
+                                                       each(tinymce.grep(node.childNodes), function(node) {\r
+                                                               if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) {\r
+                                                                       if (!rootBlockElm)\r
+                                                                               rootBlockElm = wrap(node, forcedRootBlock);\r
+                                                                       else\r
+                                                                               rootBlockElm.appendChild(node);\r
+                                                               } else\r
+                                                                       rootBlockElm = 0;\r
+                                                       });\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       // Never remove nodes that isn't the specified inline element if a selector is specified too\r
+                       if (format.selector && format.inline && !isEq(format.inline, node))\r
+                               return;\r
+\r
+                       dom.remove(node, 1);\r
+               };\r
+\r
+               function getNonWhiteSpaceSibling(node, next, inc) {\r
+                       if (node) {\r
+                               next = next ? 'nextSibling' : 'previousSibling';\r
+\r
+                               for (node = inc ? node : node[next]; node; node = node[next]) {\r
+                                       if (node.nodeType == 1 || !isWhiteSpaceNode(node))\r
+                                               return node;\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function isBookmarkNode(node) {\r
+                       return node && node.nodeType == 1 && node.getAttribute('data-mce-type') == 'bookmark';\r
+               };\r
+\r
+               function mergeSiblings(prev, next) {\r
+                       var marker, sibling, tmpSibling;\r
+\r
+                       function compareElements(node1, node2) {\r
+                               // Not the same name\r
+                               if (node1.nodeName != node2.nodeName)\r
+                                       return FALSE;\r
+\r
+                               function getAttribs(node) {\r
+                                       var attribs = {};\r
+\r
+                                       each(dom.getAttribs(node), function(attr) {\r
+                                               var name = attr.nodeName.toLowerCase();\r
+\r
+                                               // Don't compare internal attributes or style\r
+                                               if (name.indexOf('_') !== 0 && name !== 'style')\r
+                                                       attribs[name] = dom.getAttrib(node, name);\r
+                                       });\r
+\r
+                                       return attribs;\r
+                               };\r
+\r
+                               function compareObjects(obj1, obj2) {\r
+                                       var value, name;\r
+\r
+                                       for (name in obj1) {\r
+                                               // Obj1 has item obj2 doesn't have\r
+                                               if (obj1.hasOwnProperty(name)) {\r
+                                                       value = obj2[name];\r
+\r
+                                                       // Obj2 doesn't have obj1 item\r
+                                                       if (value === undef)\r
+                                                               return FALSE;\r
+\r
+                                                       // Obj2 item has a different value\r
+                                                       if (obj1[name] != value)\r
+                                                               return FALSE;\r
+\r
+                                                       // Delete similar value\r
+                                                       delete obj2[name];\r
+                                               }\r
+                                       }\r
+\r
+                                       // Check if obj 2 has something obj 1 doesn't have\r
+                                       for (name in obj2) {\r
+                                               // Obj2 has item obj1 doesn't have\r
+                                               if (obj2.hasOwnProperty(name))\r
+                                                       return FALSE;\r
+                                       }\r
+\r
+                                       return TRUE;\r
+                               };\r
+\r
+                               // Attribs are not the same\r
+                               if (!compareObjects(getAttribs(node1), getAttribs(node2)))\r
+                                       return FALSE;\r
+\r
+                               // Styles are not the same\r
+                               if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style'))))\r
+                                       return FALSE;\r
+\r
+                               return TRUE;\r
+                       };\r
+\r
+                       function findElementSibling(node, sibling_name) {\r
+                               for (sibling = node; sibling; sibling = sibling[sibling_name]) {\r
+                                       if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0)\r
+                                               return node;\r
+\r
+                                       if (sibling.nodeType == 1 && !isBookmarkNode(sibling))\r
+                                               return sibling;\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
+\r
+                       // Check if next/prev exists and that they are elements\r
+                       if (prev && next) {\r
+                               // If previous sibling is empty then jump over it\r
+                               prev = findElementSibling(prev, 'previousSibling');\r
+                               next = findElementSibling(next, 'nextSibling');\r
+\r
+                               // Compare next and previous nodes\r
+                               if (compareElements(prev, next)) {\r
+                                       // Append nodes between\r
+                                       for (sibling = prev.nextSibling; sibling && sibling != next;) {\r
+                                               tmpSibling = sibling;\r
+                                               sibling = sibling.nextSibling;\r
+                                               prev.appendChild(tmpSibling);\r
+                                       }\r
+\r
+                                       // Remove next node\r
+                                       dom.remove(next);\r
+\r
+                                       // Move children into prev node\r
+                                       each(tinymce.grep(next.childNodes), function(node) {\r
+                                               prev.appendChild(node);\r
+                                       });\r
+\r
+                                       return prev;\r
+                               }\r
+                       }\r
+\r
+                       return next;\r
+               };\r
+\r
+               function isTextBlock(name) {\r
+                       return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);\r
+               };\r
+\r
+               function getContainer(rng, start) {\r
+                       var container, offset, lastIdx, walker;\r
+\r
+                       container = rng[start ? 'startContainer' : 'endContainer'];\r
+                       offset = rng[start ? 'startOffset' : 'endOffset'];\r
+\r
+                       if (container.nodeType == 1) {\r
+                               lastIdx = container.childNodes.length - 1;\r
+\r
+                               if (!start && offset)\r
+                                       offset--;\r
+\r
+                               container = container.childNodes[offset > lastIdx ? lastIdx : offset];\r
+                       }\r
+\r
+                       // If start text node is excluded then walk to the next node\r
+                       if (container.nodeType === 3 && start && offset >= container.nodeValue.length) {\r
+                               container = new TreeWalker(container, ed.getBody()).next() || container;\r
+                       }\r
+\r
+                       // If end text node is excluded then walk to the previous node\r
+                       if (container.nodeType === 3 && !start && offset === 0) {\r
+                               container = new TreeWalker(container, ed.getBody()).prev() || container;\r
+                       }\r
+\r
+                       return container;\r
+               };\r
+\r
+               function performCaretAction(type, name, vars) {\r
+                       var caretContainerId = '_mce_caret', debug = ed.settings.caret_debug;\r
+\r
+                       // Creates a caret container bogus element\r
+                       function createCaretContainer(fill) {\r
+                               var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''});\r
+\r
+                               if (fill) {\r
+                                       caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR));\r
+                               }\r
+\r
+                               return caretContainer;\r
+                       };\r
+\r
+                       function isCaretContainerEmpty(node, nodes) {\r
+                               while (node) {\r
+                                       if ((node.nodeType === 3 && node.nodeValue !== INVISIBLE_CHAR) || node.childNodes.length > 1) {\r
+                                               return false;\r
+                                       }\r
+\r
+                                       // Collect nodes\r
+                                       if (nodes && node.nodeType === 1) {\r
+                                               nodes.push(node);\r
+                                       }\r
+\r
+                                       node = node.firstChild;\r
+                               }\r
+\r
+                               return true;\r
+                       };\r
+                       \r
+                       // Returns any parent caret container element\r
+                       function getParentCaretContainer(node) {\r
+                               while (node) {\r
+                                       if (node.id === caretContainerId) {\r
+                                               return node;\r
+                                       }\r
+\r
+                                       node = node.parentNode;\r
+                               }\r
+                       };\r
+\r
+                       // Finds the first text node in the specified node\r
+                       function findFirstTextNode(node) {\r
+                               var walker;\r
+\r
+                               if (node) {\r
+                                       walker = new TreeWalker(node, node);\r
+\r
+                                       for (node = walker.current(); node; node = walker.next()) {\r
+                                               if (node.nodeType === 3) {\r
+                                                       return node;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       // Removes the caret container for the specified node or all on the current document\r
+                       function removeCaretContainer(node, move_caret) {\r
+                               var child, rng;\r
+\r
+                               if (!node) {\r
+                                       node = getParentCaretContainer(selection.getStart());\r
+\r
+                                       if (!node) {\r
+                                               while (node = dom.get(caretContainerId)) {\r
+                                                       removeCaretContainer(node, false);\r
+                                               }\r
+                                       }\r
+                               } else {\r
+                                       rng = selection.getRng(true);\r
+\r
+                                       if (isCaretContainerEmpty(node)) {\r
+                                               if (move_caret !== false) {\r
+                                                       rng.setStartBefore(node);\r
+                                                       rng.setEndBefore(node);\r
+                                               }\r
+\r
+                                               dom.remove(node);\r
+                                       } else {\r
+                                               child = findFirstTextNode(node);\r
+\r
+                                               if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) {\r
+                                                       child = child.deleteData(0, 1);\r
+                                               }\r
+\r
+                                               dom.remove(node, 1);\r
+                                       }\r
+\r
+                                       selection.setRng(rng);\r
+                               }\r
+                       };\r
+                       \r
+                       // Applies formatting to the caret postion\r
+                       function applyCaretFormat() {\r
+                               var rng, caretContainer, textNode, offset, bookmark, container, text;\r
+\r
+                               rng = selection.getRng(true);\r
+                               offset = rng.startOffset;\r
+                               container = rng.startContainer;\r
+                               text = container.nodeValue;\r
+\r
+                               caretContainer = getParentCaretContainer(selection.getStart());\r
+                               if (caretContainer) {\r
+                                       textNode = findFirstTextNode(caretContainer);\r
+                               }\r
+\r
+                               // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character\r
+                               if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) {\r
+                                       // Get bookmark of caret position\r
+                                       bookmark = selection.getBookmark();\r
+\r
+                                       // Collapse bookmark range (WebKit)\r
+                                       rng.collapse(true);\r
+\r
+                                       // Expand the range to the closest word and split it at those points\r
+                                       rng = expandRng(rng, get(name));\r
+                                       rng = rangeUtils.split(rng);\r
+\r
+                                       // Apply the format to the range\r
+                                       apply(name, vars, rng);\r
+\r
+                                       // Move selection back to caret position\r
+                                       selection.moveToBookmark(bookmark);\r
+                               } else {\r
+                                       if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) {\r
+                                               caretContainer = createCaretContainer(true);\r
+                                               textNode = caretContainer.firstChild;\r
+\r
+                                               rng.insertNode(caretContainer);\r
+                                               offset = 1;\r
+\r
+                                               apply(name, vars, caretContainer);\r
+                                       } else {\r
+                                               apply(name, vars, caretContainer);\r
+                                       }\r
+\r
+                                       // Move selection to text node\r
+                                       selection.setCursorLocation(textNode, offset);\r
+                               }\r
+                       };\r
+\r
+                       function removeCaretFormat() {\r
+                               var rng = selection.getRng(true), container, offset, bookmark,\r
+                                       hasContentAfter, node, formatNode, parents = [], i, caretContainer;\r
+\r
+                               container = rng.startContainer;\r
+                               offset = rng.startOffset;\r
+                               node = container;\r
+\r
+                               if (container.nodeType == 3) {\r
+                                       if (offset != container.nodeValue.length || container.nodeValue === INVISIBLE_CHAR) {\r
+                                               hasContentAfter = true;\r
+                                       }\r
+\r
+                                       node = node.parentNode;\r
+                               }\r
+\r
+                               while (node) {\r
+                                       if (matchNode(node, name, vars)) {\r
+                                               formatNode = node;\r
+                                               break;\r
+                                       }\r
+\r
+                                       if (node.nextSibling) {\r
+                                               hasContentAfter = true;\r
+                                       }\r
+\r
+                                       parents.push(node);\r
+                                       node = node.parentNode;\r
+                               }\r
+\r
+                               // Node doesn't have the specified format\r
+                               if (!formatNode) {\r
+                                       return;\r
+                               }\r
+\r
+                               // Is there contents after the caret then remove the format on the element\r
+                               if (hasContentAfter) {\r
+                                       // Get bookmark of caret position\r
+                                       bookmark = selection.getBookmark();\r
+\r
+                                       // Collapse bookmark range (WebKit)\r
+                                       rng.collapse(true);\r
+\r
+                                       // Expand the range to the closest word and split it at those points\r
+                                       rng = expandRng(rng, get(name), true);\r
+                                       rng = rangeUtils.split(rng);\r
+\r
+                                       // Remove the format from the range\r
+                                       remove(name, vars, rng);\r
+\r
+                                       // Move selection back to caret position\r
+                                       selection.moveToBookmark(bookmark);\r
+                               } else {\r
+                                       caretContainer = createCaretContainer();\r
+\r
+                                       node = caretContainer;\r
+                                       for (i = parents.length - 1; i >= 0; i--) {\r
+                                               node.appendChild(dom.clone(parents[i], false));\r
+                                               node = node.firstChild;\r
+                                       }\r
+\r
+                                       // Insert invisible character into inner most format element\r
+                                       node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR));\r
+                                       node = node.firstChild;\r
+\r
+                                       // Insert caret container after the formated node\r
+                                       dom.insertAfter(caretContainer, formatNode);\r
+\r
+                                       // Move selection to text node\r
+                                       selection.setCursorLocation(node, 1);\r
+                               }\r
+                       };\r
+\r
+                       // Checks if the parent caret container node isn't empty if that is the case it\r
+                       // will remove the bogus state on all children that isn't empty\r
+                       function unmarkBogusCaretParents() {\r
+                               var i, caretContainer, node;\r
+\r
+                               caretContainer = getParentCaretContainer(selection.getStart());\r
+                               if (caretContainer && !dom.isEmpty(caretContainer)) {\r
+                                       tinymce.walk(caretContainer, function(node) {\r
+                                               if (node.nodeType == 1 && node.id !== caretContainerId && !dom.isEmpty(node)) {\r
+                                                       dom.setAttrib(node, 'data-mce-bogus', null);\r
+                                               }\r
+                                       }, 'childNodes');\r
+                               }\r
+                       };\r
+\r
+                       // Only bind the caret events once\r
+                       if (!self._hasCaretEvents) {\r
+                               // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements\r
+                               ed.onBeforeGetContent.addToTop(function() {\r
+                                       var nodes = [], i;\r
+\r
+                                       if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) {\r
+                                               // Mark children\r
+                                               i = nodes.length;\r
+                                               while (i--) {\r
+                                                       dom.setAttrib(nodes[i], 'data-mce-bogus', '1');\r
+                                               }\r
+                                       }\r
+                               });\r
+\r
+                               // Remove caret container on mouse up and on key up\r
+                               tinymce.each('onMouseUp onKeyUp'.split(' '), function(name) {\r
+                                       ed[name].addToTop(function() {\r
+                                               removeCaretContainer();\r
+                                               unmarkBogusCaretParents();\r
+                                       });\r
+                               });\r
+\r
+                               // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys\r
+                               ed.onKeyDown.addToTop(function(ed, e) {\r
+                                       var keyCode = e.keyCode;\r
+\r
+                                       if (keyCode == 8 || keyCode == 37 || keyCode == 39) {\r
+                                               removeCaretContainer(getParentCaretContainer(selection.getStart()));\r
+                                       }\r
+\r
+                                       unmarkBogusCaretParents();\r
+                               });\r
+\r
+                               // Remove bogus state if they got filled by contents using editor.selection.setContent\r
+                               selection.onSetContent.add(unmarkBogusCaretParents);\r
+\r
+                               self._hasCaretEvents = true;\r
+                       }\r
+\r
+                       // Do apply or remove caret format\r
+                       if (type == "apply") {\r
+                               applyCaretFormat();\r
+                       } else {\r
+                               removeCaretFormat();\r
+                       }\r
+               };\r
+\r
+               function moveStart(rng) {\r
+                       var container = rng.startContainer,\r
+                                       offset = rng.startOffset, isAtEndOfText,\r
+                                       walker, node, nodes, tmpNode;\r
+\r
+                       // Convert text node into index if possible\r
+                       if (container.nodeType == 3 && offset >= container.nodeValue.length) {\r
+                               // Get the parent container location and walk from there\r
+                               offset = nodeIndex(container);\r
+                               container = container.parentNode;\r
+                               isAtEndOfText = true;\r
+                       }\r
+\r
+                       // Move startContainer/startOffset in to a suitable node\r
+                       if (container.nodeType == 1) {\r
+                               nodes = container.childNodes;\r
+                               container = nodes[Math.min(offset, nodes.length - 1)];\r
+                               walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\r
+\r
+                               // If offset is at end of the parent node walk to the next one\r
+                               if (offset > nodes.length - 1 || isAtEndOfText)\r
+                                       walker.next();\r
+\r
+                               for (node = walker.current(); node; node = walker.next()) {\r
+                                       if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {\r
+                                               // IE has a "neat" feature where it moves the start node into the closest element\r
+                                               // we can avoid this by inserting an element before it and then remove it after we set the selection\r
+                                               tmpNode = dom.create('a', null, INVISIBLE_CHAR);\r
+                                               node.parentNode.insertBefore(tmpNode, node);\r
+\r
+                                               // Set selection and remove tmpNode\r
+                                               rng.setStart(node, 0);\r
+                                               selection.setRng(rng);\r
+                                               dom.remove(tmpNode);\r
+\r
+                                               return;\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+       };\r
+})(tinymce);\r
+\r
+tinymce.onAddEditor.add(function(tinymce, ed) {\r
+       var filters, fontSizes, dom, settings = ed.settings;\r
+\r
+       function replaceWithSpan(node, styles) {\r
+               tinymce.each(styles, function(value, name) {\r
+                       if (value)\r
+                               dom.setStyle(node, name, value);\r
+               });\r
+\r
+               dom.rename(node, 'span');\r
+       };\r
+\r
+       function convert(editor, params) {\r
+               dom = editor.dom;\r
+\r
+               if (settings.convert_fonts_to_spans) {\r
+                       tinymce.each(dom.select('font,u,strike', params.node), function(node) {\r
+                               filters[node.nodeName.toLowerCase()](ed.dom, node);\r
+                       });\r
+               }\r
+       };\r
+\r
+       if (settings.inline_styles) {\r
+               fontSizes = tinymce.explode(settings.font_size_legacy_values);\r
+\r
+               filters = {\r
+                       font : function(dom, node) {\r
+                               replaceWithSpan(node, {\r
+                                       backgroundColor : node.style.backgroundColor,\r
+                                       color : node.color,\r
+                                       fontFamily : node.face,\r
+                                       fontSize : fontSizes[parseInt(node.size, 10) - 1]\r
+                               });\r
+                       },\r
+\r
+                       u : function(dom, node) {\r
+                               replaceWithSpan(node, {\r
+                                       textDecoration : 'underline'\r
+                               });\r
+                       },\r
+\r
+                       strike : function(dom, node) {\r
+                               replaceWithSpan(node, {\r
+                                       textDecoration : 'line-through'\r
+                               });\r
+                       }\r
+               };\r
+\r
+               ed.onPreProcess.add(convert);\r
+               ed.onSetContent.add(convert);\r
+\r
+               ed.onInit.add(function() {\r
+                       ed.selection.onSetContent.add(convert);\r
+               });\r
+       }\r
+});\r
+\r
+(function(tinymce) {\r
+       var TreeWalker = tinymce.dom.TreeWalker;\r
+\r
+       tinymce.EnterKey = function(editor) {\r
+               var dom = editor.dom, selection = editor.selection, settings = editor.settings, undoManager = editor.undoManager, nonEmptyElementsMap = editor.schema.getNonEmptyElements();\r
+\r
+               function handleEnterKey(evt) {\r
+                       var rng = selection.getRng(true), tmpRng, editableRoot, container, offset, parentBlock, documentMode, shiftKey,\r
+                               newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;\r
+\r
+                       // Returns true if the block can be split into two blocks or not\r
+                       function canSplitBlock(node) {\r
+                               return node &&\r
+                                       dom.isBlock(node) &&\r
+                                       !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) &&\r
+                                       !/^(fixed|absolute)/i.test(node.style.position) && \r
+                                       dom.getContentEditable(node) !== "true";\r
+                       };\r
+\r
+                       // Renders empty block on IE\r
+                       function renderBlockOnIE(block) {\r
+                               var oldRng;\r
+\r
+                               if (tinymce.isIE && dom.isBlock(block)) {\r
+                                       oldRng = selection.getRng();\r
+                                       block.appendChild(dom.create('span', null, '\u00a0'));\r
+                                       selection.select(block);\r
+                                       block.lastChild.outerHTML = '';\r
+                                       selection.setRng(oldRng);\r
+                               }\r
+                       };\r
+\r
+                       // Remove the first empty inline element of the block so this: <p><b><em></em></b>x</p> becomes this: <p>x</p>\r
+                       function trimInlineElementsOnLeftSideOfBlock(block) {\r
+                               var node = block, firstChilds = [], i;\r
+\r
+                               // Find inner most first child ex: <p><i><b>*</b></i></p>\r
+                               while (node = node.firstChild) {\r
+                                       if (dom.isBlock(node)) {\r
+                                               return;\r
+                                       }\r
+\r
+                                       if (node.nodeType == 1 && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\r
+                                               firstChilds.push(node);\r
+                                       }\r
+                               }\r
+\r
+                               i = firstChilds.length;\r
+                               while (i--) {\r
+                                       node = firstChilds[i];\r
+                                       if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) {\r
+                                               dom.remove(node);\r
+                                       } else {\r
+                                               // Remove <a> </a> see #5381\r
+                                               if (node.nodeName == "A" && (node.innerText || node.textContent) === ' ') {\r
+                                                       dom.remove(node);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       };\r
+                       \r
+                       // Moves the caret to a suitable position within the root for example in the first non pure whitespace text node or before an image\r
+                       function moveToCaretPosition(root) {\r
+                               var walker, node, rng, y, viewPort, lastNode = root, tempElm;\r
+\r
+                               rng = dom.createRng();\r
+\r
+                               if (root.hasChildNodes()) {\r
+                                       walker = new TreeWalker(root, root);\r
+\r
+                                       while (node = walker.current()) {\r
+                                               if (node.nodeType == 3) {\r
+                                                       rng.setStart(node, 0);\r
+                                                       rng.setEnd(node, 0);\r
+                                                       break;\r
+                                               }\r
+\r
+                                               if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\r
+                                                       rng.setStartBefore(node);\r
+                                                       rng.setEndBefore(node);\r
+                                                       break;\r
+                                               }\r
+\r
+                                               lastNode = node;\r
+                                               node = walker.next();\r
+                                       }\r
+\r
+                                       if (!node) {\r
+                                               rng.setStart(lastNode, 0);\r
+                                               rng.setEnd(lastNode, 0);\r
+                                       }\r
+                               } else {\r
+                                       if (root.nodeName == 'BR') {\r
+                                               if (root.nextSibling && dom.isBlock(root.nextSibling)) {\r
+                                                       // Trick on older IE versions to render the caret before the BR between two lists\r
+                                                       if (!documentMode || documentMode < 9) {\r
+                                                               tempElm = dom.create('br');\r
+                                                               root.parentNode.insertBefore(tempElm, root);\r
+                                                       }\r
+\r
+                                                       rng.setStartBefore(root);\r
+                                                       rng.setEndBefore(root);\r
+                                               } else {\r
+                                                       rng.setStartAfter(root);\r
+                                                       rng.setEndAfter(root);\r
+                                               }\r
+                                       } else {\r
+                                               rng.setStart(root, 0);\r
+                                               rng.setEnd(root, 0);\r
+                                       }\r
+                               }\r
+\r
+                               selection.setRng(rng);\r
+\r
+                               // Remove tempElm created for old IE:s\r
+                               dom.remove(tempElm);\r
+\r
+                               viewPort = dom.getViewPort(editor.getWin());\r
+\r
+                               // scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs\r
+                               y = dom.getPos(root).y;\r
+                               if (y < viewPort.y || y + 25 > viewPort.y + viewPort.h) {\r
+                                       editor.getWin().scrollTo(0, y < viewPort.y ? y : y - viewPort.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks\r
+                               }\r
+                       };\r
+\r
+                       // Creates a new block element by cloning the current one or creating a new one if the name is specified\r
+                       // This function will also copy any text formatting from the parent block and add it to the new one\r
+                       function createNewBlock(name) {\r
+                               var node = container, block, clonedNode, caretNode;\r
+\r
+                               block = name || parentBlockName == "TABLE" ? dom.create(name || newBlockName) : parentBlock.cloneNode(false);\r
+                               caretNode = block;\r
+\r
+                               // Clone any parent styles\r
+                               if (settings.keep_styles !== false) {\r
+                                       do {\r
+                                               if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {\r
+                                                       clonedNode = node.cloneNode(false);\r
+                                                       dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique\r
+\r
+                                                       if (block.hasChildNodes()) {\r
+                                                               clonedNode.appendChild(block.firstChild);\r
+                                                               block.appendChild(clonedNode);\r
+                                                       } else {\r
+                                                               caretNode = clonedNode;\r
+                                                               block.appendChild(clonedNode);\r
+                                                       }\r
+                                               }\r
+                                       } while (node = node.parentNode);\r
+                               }\r
+\r
+                               // BR is needed in empty blocks on non IE browsers\r
+                               if (!tinymce.isIE) {\r
+                                       caretNode.innerHTML = '<br>';\r
+                               }\r
+\r
+                               return block;\r
+                       };\r
+\r
+                       // Returns true/false if the caret is at the start/end of the parent block element\r
+                       function isCaretAtStartOrEndOfBlock(start) {\r
+                               var walker, node, name;\r
+\r
+                               // Caret is in the middle of a text node like "a|b"\r
+                               if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) {\r
+                                       return false;\r
+                               }\r
+\r
+                               // If after the last element in block node edge case for #5091\r
+                               if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) {\r
+                                       return true;\r
+                               }\r
+\r
+                               // If the caret if before the first element in parentBlock\r
+                               if (start && container.nodeType == 1 && container == parentBlock.firstChild) {\r
+                                       return true;\r
+                               }\r
+\r
+                               // Caret can be before/after a table\r
+                               if (container.nodeName === "TABLE" || (container.previousSibling && container.previousSibling.nodeName == "TABLE")) {\r
+                                       return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start);\r
+                               }\r
+\r
+                               // Walk the DOM and look for text nodes or non empty elements\r
+                               walker = new TreeWalker(container, parentBlock);\r
+       \r
+                               // If caret is in beginning or end of a text block then jump to the next/previous node\r
+                               if (container.nodeType == 3) {\r
+                                       if (start && offset == 0) {\r
+                                               walker.prev();\r
+                                       } else if (!start && offset == container.nodeValue.length) {\r
+                                               walker.next();\r
+                                       }\r
+                               }\r
+\r
+                               while (node = walker.current()) {\r
+                                       if (node.nodeType === 1) {\r
+                                               // Ignore bogus elements\r
+                                               if (!node.getAttribute('data-mce-bogus')) {\r
+                                                       // Keep empty elements like <img /> <input /> but not trailing br:s like <p>text|<br></p>\r
+                                                       name = node.nodeName.toLowerCase();\r
+                                                       if (nonEmptyElementsMap[name] && name !== 'br') {\r
+                                                               return false;\r
+                                                       }\r
+                                               }\r
+                                       } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) {\r
+                                               return false;\r
+                                       }\r
+\r
+                                       if (start) {\r
+                                               walker.prev();\r
+                                       } else {\r
+                                               walker.next();\r
+                                       }\r
+                               }\r
+\r
+                               return true;\r
+                       };\r
+\r
+                       // Wraps any text nodes or inline elements in the specified forced root block name\r
+                       function wrapSelfAndSiblingsInDefaultBlock(container, offset) {\r
+                               var newBlock, parentBlock, startNode, node, next, blockName = newBlockName || 'P';\r
+\r
+                               // Not in a block element or in a table cell or caption\r
+                               parentBlock = dom.getParent(container, dom.isBlock);\r
+                               if (!parentBlock || !canSplitBlock(parentBlock)) {\r
+                                       parentBlock = parentBlock || editableRoot;\r
+\r
+                                       if (!parentBlock.hasChildNodes()) {\r
+                                               newBlock = dom.create(blockName);\r
+                                               parentBlock.appendChild(newBlock);\r
+                                               rng.setStart(newBlock, 0);\r
+                                               rng.setEnd(newBlock, 0);\r
+                                               return newBlock;\r
+                                       }\r
+\r
+                                       // Find parent that is the first child of parentBlock\r
+                                       node = container;\r
+                                       while (node.parentNode != parentBlock) {\r
+                                               node = node.parentNode;\r
+                                       }\r
+\r
+                                       // Loop left to find start node start wrapping at\r
+                                       while (node && !dom.isBlock(node)) {\r
+                                               startNode = node;\r
+                                               node = node.previousSibling;\r
+                                       }\r
+\r
+                                       if (startNode) {\r
+                                               newBlock = dom.create(blockName);\r
+                                               startNode.parentNode.insertBefore(newBlock, startNode);\r
+\r
+                                               // Start wrapping until we hit a block\r
+                                               node = startNode;\r
+                                               while (node && !dom.isBlock(node)) {\r
+                                                       next = node.nextSibling;\r
+                                                       newBlock.appendChild(node);\r
+                                                       node = next;\r
+                                               }\r
+\r
+                                               // Restore range to it's past location\r
+                                               rng.setStart(container, offset);\r
+                                               rng.setEnd(container, offset);\r
+                                       }\r
+                               }\r
+\r
+                               return container;\r
+                       };\r
+\r
+                       // Inserts a block or br before/after or in the middle of a split list of the LI is empty\r
+                       function handleEmptyListItem() {\r
+                               function isFirstOrLastLi(first) {\r
+                                       var node = containerBlock[first ? 'firstChild' : 'lastChild'];\r
+\r
+                                       // Find first/last element since there might be whitespace there\r
+                                       while (node) {\r
+                                               if (node.nodeType == 1) {\r
+                                                       break;\r
+                                               }\r
+\r
+                                               node = node[first ? 'nextSibling' : 'previousSibling'];\r
+                                       }\r
+\r
+                                       return node === parentBlock;\r
+                               };\r
+\r
+                               newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');\r
+\r
+                               if (isFirstOrLastLi(true) && isFirstOrLastLi()) {\r
+                                       // Is first and last list item then replace the OL/UL with a text block\r
+                                       dom.replace(newBlock, containerBlock);\r
+                               } else if (isFirstOrLastLi(true)) {\r
+                                       // First LI in list then remove LI and add text block before list\r
+                                       containerBlock.parentNode.insertBefore(newBlock, containerBlock);\r
+                               } else if (isFirstOrLastLi()) {\r
+                                       // Last LI in list then temove LI and add text block after list\r
+                                       dom.insertAfter(newBlock, containerBlock);\r
+                                       renderBlockOnIE(newBlock);\r
+                               } else {\r
+                                       // Middle LI in list the split the list and insert a text block in the middle\r
+                                       // Extract after fragment and insert it after the current block\r
+                                       tmpRng = rng.cloneRange();\r
+                                       tmpRng.setStartAfter(parentBlock);\r
+                                       tmpRng.setEndAfter(containerBlock);\r
+                                       fragment = tmpRng.extractContents();\r
+                                       dom.insertAfter(fragment, containerBlock);\r
+                                       dom.insertAfter(newBlock, containerBlock);\r
+                               }\r
+\r
+                               dom.remove(parentBlock);\r
+                               moveToCaretPosition(newBlock);\r
+                               undoManager.add();\r
+                       };\r
+\r
+                       // Walks the parent block to the right and look for BR elements\r
+                       function hasRightSideBr() {\r
+                               var walker = new TreeWalker(container, parentBlock), node;\r
+\r
+                               while (node = walker.current()) {\r
+                                       if (node.nodeName == 'BR') {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       node = walker.next();\r
+                               }\r
+                       }\r
+                       \r
+                       // Inserts a BR element if the forced_root_block option is set to false or empty string\r
+                       function insertBr() {\r
+                               var brElm, extraBr;\r
+\r
+                               if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {\r
+                                       // Insert extra BR element at the end block elements\r
+                                       if (!tinymce.isIE && !hasRightSideBr()) {\r
+                                               brElm = dom.create('br');\r
+                                               rng.insertNode(brElm);\r
+                                               rng.setStartAfter(brElm);\r
+                                               rng.setEndAfter(brElm);\r
+                                               extraBr = true;\r
+                                       }\r
+                               }\r
+\r
+                               brElm = dom.create('br');\r
+                               rng.insertNode(brElm);\r
+\r
+                               // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it\r
+                               if (tinymce.isIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {\r
+                                       brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);\r
+                               }\r
+\r
+                               if (!extraBr) {\r
+                                       rng.setStartAfter(brElm);\r
+                                       rng.setEndAfter(brElm);\r
+                               } else {\r
+                                       rng.setStartBefore(brElm);\r
+                                       rng.setEndBefore(brElm);\r
+                               }\r
+\r
+                               selection.setRng(rng);\r
+                               undoManager.add();\r
+                       };\r
+\r
+                       // Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element\r
+                       function trimLeadingLineBreaks(node) {\r
+                               do {\r
+                                       if (node.nodeType === 3) {\r
+                                               node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');\r
+                                       }\r
+\r
+                                       node = node.firstChild;\r
+                               } while (node);\r
+                       };\r
+\r
+                       function getEditableRoot(node) {\r
+                               var root = dom.getRoot(), parent, editableRoot;\r
+\r
+                               // Get all parents until we hit a non editable parent or the root\r
+                               parent = node;\r
+                               while (parent !== root && dom.getContentEditable(parent) !== "false") {\r
+                                       if (dom.getContentEditable(parent) === "true") {\r
+                                               editableRoot = parent;\r
+                                       }\r
+\r
+                                       parent = parent.parentNode;\r
+                               }\r
+                               \r
+                               return parent !== root ? editableRoot : root;\r
+                       };\r
+\r
+                       // Adds a BR at the end of blocks that only contains an IMG or INPUT since these might be floated and then they won't expand the block\r
+                       function addBrToBlockIfNeeded(block) {\r
+                               var lastChild;\r
+\r
+                               // IE will render the blocks correctly other browsers needs a BR\r
+                               if (!tinymce.isIE) {\r
+                                       block.normalize(); // Remove empty text nodes that got left behind by the extract\r
+\r
+                                       // Check if the block is empty or contains a floated last child\r
+                                       lastChild = block.lastChild;\r
+                                       if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) {\r
+                                               dom.add(block, 'br');\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       // Delete any selected contents\r
+                       if (!rng.collapsed) {\r
+                               editor.execCommand('Delete');\r
+                               return;\r
+                       }\r
+\r
+                       // Event is blocked by some other handler for example the lists plugin\r
+                       if (evt.isDefaultPrevented()) {\r
+                               return;\r
+                       }\r
+\r
+                       // Setup range items and newBlockName\r
+                       container = rng.startContainer;\r
+                       offset = rng.startOffset;\r
+                       newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block;\r
+                       newBlockName = newBlockName ? newBlockName.toUpperCase() : '';\r
+                       documentMode = dom.doc.documentMode;\r
+                       shiftKey = evt.shiftKey;\r
+\r
+                       // Resolve node index\r
+                       if (container.nodeType == 1 && container.hasChildNodes()) {\r
+                               isAfterLastNodeInContainer = offset > container.childNodes.length - 1;\r
+                               container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\r
+                               if (isAfterLastNodeInContainer && container.nodeType == 3) {\r
+                                       offset = container.nodeValue.length;\r
+                               } else {\r
+                                       offset = 0;\r
+                               }\r
+                       }\r
+\r
+                       // Get editable root node normaly the body element but sometimes a div or span\r
+                       editableRoot = getEditableRoot(container);\r
+\r
+                       // If there is no editable root then enter is done inside a contentEditable false element\r
+                       if (!editableRoot) {\r
+                               return;\r
+                       }\r
+\r
+                       undoManager.beforeChange();\r
+\r
+                       // If editable root isn't block nor the root of the editor\r
+                       if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) {\r
+                               if (!newBlockName || shiftKey) {\r
+                                       insertBr();\r
+                               }\r
+\r
+                               return;\r
+                       }\r
+\r
+                       // Wrap the current node and it's sibling in a default block if it's needed.\r
+                       // for example this <td>text|<b>text2</b></td> will become this <td><p>text|<b>text2</p></b></td>\r
+                       // This won't happen if root blocks are disabled or the shiftKey is pressed\r
+                       if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) {\r
+                               container = wrapSelfAndSiblingsInDefaultBlock(container, offset);\r
+                       }\r
+\r
+                       // Find parent block and setup empty block paddings\r
+                       parentBlock = dom.getParent(container, dom.isBlock);\r
+                       containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;\r
+\r
+                       // Setup block names\r
+                       parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5\r
+                       containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5\r
+\r
+                       // Handle enter in LI\r
+                       if (parentBlockName == 'LI') {\r
+                               if (!newBlockName && shiftKey) {\r
+                                       insertBr();\r
+                                       return;\r
+                               }\r
+\r
+                               // Handle enter inside an empty list item\r
+                               if (dom.isEmpty(parentBlock)) {\r
+                                       // Let the list plugin or browser handle nested lists for now\r
+                                       if (/^(UL|OL|LI)$/.test(containerBlock.parentNode.nodeName)) {\r
+                                               return false;\r
+                                       }\r
+\r
+                                       handleEmptyListItem();\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       // Don't split PRE tags but insert a BR instead easier when writing code samples etc\r
+                       if (parentBlockName == 'PRE' && settings.br_in_pre !== false) {\r
+                               if (!shiftKey) {\r
+                                       insertBr();\r
+                                       return;\r
+                               }\r
+                       } else {\r
+                               // If no root block is configured then insert a BR by default or if the shiftKey is pressed\r
+                               if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) {\r
+                                       insertBr();\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       // Default block name if it's not configured\r
+                       newBlockName = newBlockName || 'P';\r
+\r
+                       // Insert new block before/after the parent block depending on caret location\r
+                       if (isCaretAtStartOrEndOfBlock()) {\r
+                               // If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup\r
+                               if (/^(H[1-6]|PRE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') {\r
+                                       newBlock = createNewBlock(newBlockName);\r
+                               } else {\r
+                                       newBlock = createNewBlock();\r
+                               }\r
+\r
+                               // Split the current container block element if enter is pressed inside an empty inner block element\r
+                               if (settings.end_container_on_empty_block && canSplitBlock(containerBlock) && dom.isEmpty(parentBlock)) {\r
+                                       // Split container block for example a BLOCKQUOTE at the current blockParent location for example a P\r
+                                       newBlock = dom.split(containerBlock, parentBlock);\r
+                               } else {\r
+                                       dom.insertAfter(newBlock, parentBlock);\r
+                               }\r
+\r
+                               moveToCaretPosition(newBlock);\r
+                       } else if (isCaretAtStartOrEndOfBlock(true)) {\r
+                               // Insert new block before\r
+                               newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);\r
+                               renderBlockOnIE(newBlock);\r
+                       } else {\r
+                               // Extract after fragment and insert it after the current block\r
+                               tmpRng = rng.cloneRange();\r
+                               tmpRng.setEndAfter(parentBlock);\r
+                               fragment = tmpRng.extractContents();\r
+                               trimLeadingLineBreaks(fragment);\r
+                               newBlock = fragment.firstChild;\r
+                               dom.insertAfter(fragment, parentBlock);\r
+                               trimInlineElementsOnLeftSideOfBlock(newBlock);\r
+                               addBrToBlockIfNeeded(parentBlock);\r
+                               moveToCaretPosition(newBlock);\r
+                       }\r
+\r
+                       dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique\r
+                       undoManager.add();\r
+               }\r
+\r
+               editor.onKeyDown.add(function(ed, evt) {\r
+                       if (evt.keyCode == 13) {\r
+                               if (handleEnterKey(evt) !== false) {\r
+                                       evt.preventDefault();\r
+                               }\r
+                       }\r
+               });\r
+       };\r
+})(tinymce);\r
+\r
diff --git a/3.x/src/resources/javascript/TinyMCE/utils/editable_selects.js b/3.x/src/resources/javascript/TinyMCE/utils/editable_selects.js
new file mode 100644 (file)
index 0000000..4b920f3
--- /dev/null
@@ -0,0 +1,70 @@
+/**\r
+ * editable_selects.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+var TinyMCE_EditableSelects = {\r
+       editSelectElm : null,\r
+\r
+       init : function() {\r
+               var nl = document.getElementsByTagName("select"), i, d = document, o;\r
+\r
+               for (i=0; i<nl.length; i++) {\r
+                       if (nl[i].className.indexOf('mceEditableSelect') != -1) {\r
+                               o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');\r
+\r
+                               o.className = 'mceAddSelectValue';\r
+\r
+                               nl[i].options[nl[i].options.length] = o;\r
+                               nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;\r
+                       }\r
+               }\r
+       },\r
+\r
+       onChangeEditableSelect : function(e) {\r
+               var d = document, ne, se = window.event ? window.event.srcElement : e.target;\r
+\r
+               if (se.options[se.selectedIndex].value == '__mce_add_custom__') {\r
+                       ne = d.createElement("input");\r
+                       ne.id = se.id + "_custom";\r
+                       ne.name = se.name + "_custom";\r
+                       ne.type = "text";\r
+\r
+                       ne.style.width = se.offsetWidth + 'px';\r
+                       se.parentNode.insertBefore(ne, se);\r
+                       se.style.display = 'none';\r
+                       ne.focus();\r
+                       ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;\r
+                       ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;\r
+                       TinyMCE_EditableSelects.editSelectElm = se;\r
+               }\r
+       },\r
+\r
+       onBlurEditableSelectInput : function() {\r
+               var se = TinyMCE_EditableSelects.editSelectElm;\r
+\r
+               if (se) {\r
+                       if (se.previousSibling.value != '') {\r
+                               addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);\r
+                               selectByValue(document.forms[0], se.id, se.previousSibling.value);\r
+                       } else\r
+                               selectByValue(document.forms[0], se.id, '');\r
+\r
+                       se.style.display = 'inline';\r
+                       se.parentNode.removeChild(se.previousSibling);\r
+                       TinyMCE_EditableSelects.editSelectElm = null;\r
+               }\r
+       },\r
+\r
+       onKeyDown : function(e) {\r
+               e = e || window.event;\r
+\r
+               if (e.keyCode == 13)\r
+                       TinyMCE_EditableSelects.onBlurEditableSelectInput();\r
+       }\r
+};\r
diff --git a/3.x/src/resources/javascript/TinyMCE/utils/form_utils.js b/3.x/src/resources/javascript/TinyMCE/utils/form_utils.js
new file mode 100644 (file)
index 0000000..59da013
--- /dev/null
@@ -0,0 +1,210 @@
+/**\r
+ * form_utils.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));\r
+\r
+function getColorPickerHTML(id, target_form_element) {\r
+       var h = "", dom = tinyMCEPopup.dom;\r
+\r
+       if (label = dom.select('label[for=' + target_form_element + ']')[0]) {\r
+               label.id = label.id || dom.uniqueId();\r
+       }\r
+\r
+       h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';\r
+       h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;<span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';\r
+\r
+       return h;\r
+}\r
+\r
+function updateColor(img_id, form_element_id) {\r
+       document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;\r
+}\r
+\r
+function setBrowserDisabled(id, state) {\r
+       var img = document.getElementById(id);\r
+       var lnk = document.getElementById(id + "_link");\r
+\r
+       if (lnk) {\r
+               if (state) {\r
+                       lnk.setAttribute("realhref", lnk.getAttribute("href"));\r
+                       lnk.removeAttribute("href");\r
+                       tinyMCEPopup.dom.addClass(img, 'disabled');\r
+               } else {\r
+                       if (lnk.getAttribute("realhref"))\r
+                               lnk.setAttribute("href", lnk.getAttribute("realhref"));\r
+\r
+                       tinyMCEPopup.dom.removeClass(img, 'disabled');\r
+               }\r
+       }\r
+}\r
+\r
+function getBrowserHTML(id, target_form_element, type, prefix) {\r
+       var option = prefix + "_" + type + "_browser_callback", cb, html;\r
+\r
+       cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));\r
+\r
+       if (!cb)\r
+               return "";\r
+\r
+       html = "";\r
+       html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';\r
+       html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';\r
+\r
+       return html;\r
+}\r
+\r
+function openBrowser(img_id, target_form_element, type, option) {\r
+       var img = document.getElementById(img_id);\r
+\r
+       if (img.className != "mceButtonDisabled")\r
+               tinyMCEPopup.openBrowser(target_form_element, type, option);\r
+}\r
+\r
+function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {\r
+       if (!form_obj || !form_obj.elements[field_name])\r
+               return;\r
+\r
+       if (!value)\r
+               value = "";\r
+\r
+       var sel = form_obj.elements[field_name];\r
+\r
+       var found = false;\r
+       for (var i=0; i<sel.options.length; i++) {\r
+               var option = sel.options[i];\r
+\r
+               if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {\r
+                       option.selected = true;\r
+                       found = true;\r
+               } else\r
+                       option.selected = false;\r
+       }\r
+\r
+       if (!found && add_custom && value != '') {\r
+               var option = new Option(value, value);\r
+               option.selected = true;\r
+               sel.options[sel.options.length] = option;\r
+               sel.selectedIndex = sel.options.length - 1;\r
+       }\r
+\r
+       return found;\r
+}\r
+\r
+function getSelectValue(form_obj, field_name) {\r
+       var elm = form_obj.elements[field_name];\r
+\r
+       if (elm == null || elm.options == null || elm.selectedIndex === -1)\r
+               return "";\r
+\r
+       return elm.options[elm.selectedIndex].value;\r
+}\r
+\r
+function addSelectValue(form_obj, field_name, name, value) {\r
+       var s = form_obj.elements[field_name];\r
+       var o = new Option(name, value);\r
+       s.options[s.options.length] = o;\r
+}\r
+\r
+function addClassesToList(list_id, specific_option) {\r
+       // Setup class droplist\r
+       var styleSelectElm = document.getElementById(list_id);\r
+       var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);\r
+       styles = tinyMCEPopup.getParam(specific_option, styles);\r
+\r
+       if (styles) {\r
+               var stylesAr = styles.split(';');\r
+\r
+               for (var i=0; i<stylesAr.length; i++) {\r
+                       if (stylesAr != "") {\r
+                               var key, value;\r
+\r
+                               key = stylesAr[i].split('=')[0];\r
+                               value = stylesAr[i].split('=')[1];\r
+\r
+                               styleSelectElm.options[styleSelectElm.length] = new Option(key, value);\r
+                       }\r
+               }\r
+       } else {\r
+               tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {\r
+                       styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);\r
+               });\r
+       }\r
+}\r
+\r
+function isVisible(element_id) {\r
+       var elm = document.getElementById(element_id);\r
+\r
+       return elm && elm.style.display != "none";\r
+}\r
+\r
+function convertRGBToHex(col) {\r
+       var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");\r
+\r
+       var rgb = col.replace(re, "$1,$2,$3").split(',');\r
+       if (rgb.length == 3) {\r
+               r = parseInt(rgb[0]).toString(16);\r
+               g = parseInt(rgb[1]).toString(16);\r
+               b = parseInt(rgb[2]).toString(16);\r
+\r
+               r = r.length == 1 ? '0' + r : r;\r
+               g = g.length == 1 ? '0' + g : g;\r
+               b = b.length == 1 ? '0' + b : b;\r
+\r
+               return "#" + r + g + b;\r
+       }\r
+\r
+       return col;\r
+}\r
+\r
+function convertHexToRGB(col) {\r
+       if (col.indexOf('#') != -1) {\r
+               col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');\r
+\r
+               r = parseInt(col.substring(0, 2), 16);\r
+               g = parseInt(col.substring(2, 4), 16);\r
+               b = parseInt(col.substring(4, 6), 16);\r
+\r
+               return "rgb(" + r + "," + g + "," + b + ")";\r
+       }\r
+\r
+       return col;\r
+}\r
+\r
+function trimSize(size) {\r
+       return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');\r
+}\r
+\r
+function getCSSSize(size) {\r
+       size = trimSize(size);\r
+\r
+       if (size == "")\r
+               return "";\r
+\r
+       // Add px\r
+       if (/^[0-9]+$/.test(size))\r
+               size += 'px';\r
+       // Sanity check, IE doesn't like broken values\r
+       else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))\r
+               return "";\r
+\r
+       return size;\r
+}\r
+\r
+function getStyle(elm, attrib, style) {\r
+       var val = tinyMCEPopup.dom.getAttrib(elm, attrib);\r
+\r
+       if (val != '')\r
+               return '' + val;\r
+\r
+       if (typeof(style) == 'undefined')\r
+               style = attrib;\r
+\r
+       return tinyMCEPopup.dom.getStyle(elm, style);\r
+}\r
diff --git a/3.x/src/resources/javascript/TinyMCE/utils/mctabs.js b/3.x/src/resources/javascript/TinyMCE/utils/mctabs.js
new file mode 100644 (file)
index 0000000..458ec86
--- /dev/null
@@ -0,0 +1,162 @@
+/**\r
+ * mctabs.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+function MCTabs() {\r
+       this.settings = [];\r
+       this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');\r
+};\r
+\r
+MCTabs.prototype.init = function(settings) {\r
+       this.settings = settings;\r
+};\r
+\r
+MCTabs.prototype.getParam = function(name, default_value) {\r
+       var value = null;\r
+\r
+       value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];\r
+\r
+       // Fix bool values\r
+       if (value == "true" || value == "false")\r
+               return (value == "true");\r
+\r
+       return value;\r
+};\r
+\r
+MCTabs.prototype.showTab =function(tab){\r
+       tab.className = 'current';\r
+       tab.setAttribute("aria-selected", true);\r
+       tab.setAttribute("aria-expanded", true);\r
+       tab.tabIndex = 0;\r
+};\r
+\r
+MCTabs.prototype.hideTab =function(tab){\r
+       var t=this;\r
+\r
+       tab.className = '';\r
+       tab.setAttribute("aria-selected", false);\r
+       tab.setAttribute("aria-expanded", false);\r
+       tab.tabIndex = -1;\r
+};\r
+\r
+MCTabs.prototype.showPanel = function(panel) {\r
+       panel.className = 'current'; \r
+       panel.setAttribute("aria-hidden", false);\r
+};\r
+\r
+MCTabs.prototype.hidePanel = function(panel) {\r
+       panel.className = 'panel';\r
+       panel.setAttribute("aria-hidden", true);\r
+}; \r
+\r
+MCTabs.prototype.getPanelForTab = function(tabElm) {\r
+       return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");\r
+};\r
+\r
+MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {\r
+       var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;\r
+\r
+       tabElm = document.getElementById(tab_id);\r
+\r
+       if (panel_id === undefined) {\r
+               panel_id = t.getPanelForTab(tabElm);\r
+       }\r
+\r
+       panelElm= document.getElementById(panel_id);\r
+       panelContainerElm = panelElm ? panelElm.parentNode : null;\r
+       tabContainerElm = tabElm ? tabElm.parentNode : null;\r
+       selectionClass = t.getParam('selection_class', 'current');\r
+\r
+       if (tabElm && tabContainerElm) {\r
+               nodes = tabContainerElm.childNodes;\r
+\r
+               // Hide all other tabs\r
+               for (i = 0; i < nodes.length; i++) {\r
+                       if (nodes[i].nodeName == "LI") {\r
+                               t.hideTab(nodes[i]);\r
+                       }\r
+               }\r
+\r
+               // Show selected tab\r
+               t.showTab(tabElm);\r
+       }\r
+\r
+       if (panelElm && panelContainerElm) {\r
+               nodes = panelContainerElm.childNodes;\r
+\r
+               // Hide all other panels\r
+               for (i = 0; i < nodes.length; i++) {\r
+                       if (nodes[i].nodeName == "DIV")\r
+                               t.hidePanel(nodes[i]);\r
+               }\r
+\r
+               if (!avoid_focus) { \r
+                       tabElm.focus();\r
+               }\r
+\r
+               // Show selected panel\r
+               t.showPanel(panelElm);\r
+       }\r
+};\r
+\r
+MCTabs.prototype.getAnchor = function() {\r
+       var pos, url = document.location.href;\r
+\r
+       if ((pos = url.lastIndexOf('#')) != -1)\r
+               return url.substring(pos + 1);\r
+\r
+       return "";\r
+};\r
+\r
+\r
+//Global instance\r
+var mcTabs = new MCTabs();\r
+\r
+tinyMCEPopup.onInit.add(function() {\r
+       var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;\r
+\r
+       each(dom.select('div.tabs'), function(tabContainerElm) {\r
+               var keyNav;\r
+\r
+               dom.setAttrib(tabContainerElm, "role", "tablist"); \r
+\r
+               var items = tinyMCEPopup.dom.select('li', tabContainerElm);\r
+               var action = function(id) {\r
+                       mcTabs.displayTab(id, mcTabs.getPanelForTab(id));\r
+                       mcTabs.onChange.dispatch(id);\r
+               };\r
+\r
+               each(items, function(item) {\r
+                       dom.setAttrib(item, 'role', 'tab');\r
+                       dom.bind(item, 'click', function(evt) {\r
+                               action(item.id);\r
+                       });\r
+               });\r
+\r
+               dom.bind(dom.getRoot(), 'keydown', function(evt) {\r
+                       if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab\r
+                               keyNav.moveFocus(evt.shiftKey ? -1 : 1);\r
+                               tinymce.dom.Event.cancel(evt);\r
+                       }\r
+               });\r
+\r
+               each(dom.select('a', tabContainerElm), function(a) {\r
+                       dom.setAttrib(a, 'tabindex', '-1');\r
+               });\r
+\r
+               keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {\r
+                       root: tabContainerElm,\r
+                       items: items,\r
+                       onAction: action,\r
+                       actOnFocus: true,\r
+                       enableLeftRight: true,\r
+                       enableUpDown: true\r
+               }, tinyMCEPopup.dom);\r
+       });\r
+});
\ No newline at end of file
diff --git a/3.x/src/resources/javascript/TinyMCE/utils/validate.js b/3.x/src/resources/javascript/TinyMCE/utils/validate.js
new file mode 100644 (file)
index 0000000..27cbfab
--- /dev/null
@@ -0,0 +1,252 @@
+/**\r
+ * validate.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+/**\r
+       // String validation:\r
+\r
+       if (!Validator.isEmail('myemail'))\r
+               alert('Invalid email.');\r
+\r
+       // Form validation:\r
+\r
+       var f = document.forms['myform'];\r
+\r
+       if (!Validator.isEmail(f.myemail))\r
+               alert('Invalid email.');\r
+*/\r
+\r
+var Validator = {\r
+       isEmail : function(s) {\r
+               return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');\r
+       },\r
+\r
+       isAbsUrl : function(s) {\r
+               return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');\r
+       },\r
+\r
+       isSize : function(s) {\r
+               return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');\r
+       },\r
+\r
+       isId : function(s) {\r
+               return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');\r
+       },\r
+\r
+       isEmpty : function(s) {\r
+               var nl, i;\r
+\r
+               if (s.nodeName == 'SELECT' && s.selectedIndex < 1)\r
+                       return true;\r
+\r
+               if (s.type == 'checkbox' && !s.checked)\r
+                       return true;\r
+\r
+               if (s.type == 'radio') {\r
+                       for (i=0, nl = s.form.elements; i<nl.length; i++) {\r
+                               if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)\r
+                                       return false;\r
+                       }\r
+\r
+                       return true;\r
+               }\r
+\r
+               return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);\r
+       },\r
+\r
+       isNumber : function(s, d) {\r
+               return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));\r
+       },\r
+\r
+       test : function(s, p) {\r
+               s = s.nodeType == 1 ? s.value : s;\r
+\r
+               return s == '' || new RegExp(p).test(s);\r
+       }\r
+};\r
+\r
+var AutoValidator = {\r
+       settings : {\r
+               id_cls : 'id',\r
+               int_cls : 'int',\r
+               url_cls : 'url',\r
+               number_cls : 'number',\r
+               email_cls : 'email',\r
+               size_cls : 'size',\r
+               required_cls : 'required',\r
+               invalid_cls : 'invalid',\r
+               min_cls : 'min',\r
+               max_cls : 'max'\r
+       },\r
+\r
+       init : function(s) {\r
+               var n;\r
+\r
+               for (n in s)\r
+                       this.settings[n] = s[n];\r
+       },\r
+\r
+       validate : function(f) {\r
+               var i, nl, s = this.settings, c = 0;\r
+\r
+               nl = this.tags(f, 'label');\r
+               for (i=0; i<nl.length; i++) {\r
+                       this.removeClass(nl[i], s.invalid_cls);\r
+                       nl[i].setAttribute('aria-invalid', false);\r
+               }\r
+\r
+               c += this.validateElms(f, 'input');\r
+               c += this.validateElms(f, 'select');\r
+               c += this.validateElms(f, 'textarea');\r
+\r
+               return c == 3;\r
+       },\r
+\r
+       invalidate : function(n) {\r
+               this.mark(n.form, n);\r
+       },\r
+       \r
+       getErrorMessages : function(f) {\r
+               var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;\r
+               nl = this.tags(f, "label");\r
+               for (i=0; i<nl.length; i++) {\r
+                       if (this.hasClass(nl[i], s.invalid_cls)) {\r
+                               field = document.getElementById(nl[i].getAttribute("for"));\r
+                               values = { field: nl[i].textContent };\r
+                               if (this.hasClass(field, s.min_cls, true)) {\r
+                                       message = ed.getLang('invalid_data_min');\r
+                                       values.min = this.getNum(field, s.min_cls);\r
+                               } else if (this.hasClass(field, s.number_cls)) {\r
+                                       message = ed.getLang('invalid_data_number');\r
+                               } else if (this.hasClass(field, s.size_cls)) {\r
+                                       message = ed.getLang('invalid_data_size');\r
+                               } else {\r
+                                       message = ed.getLang('invalid_data');\r
+                               }\r
+                               \r
+                               message = message.replace(/{\#([^}]+)\}/g, function(a, b) {\r
+                                       return values[b] || '{#' + b + '}';\r
+                               });\r
+                               messages.push(message);\r
+                       }\r
+               }\r
+               return messages;\r
+       },\r
+\r
+       reset : function(e) {\r
+               var t = ['label', 'input', 'select', 'textarea'];\r
+               var i, j, nl, s = this.settings;\r
+\r
+               if (e == null)\r
+                       return;\r
+\r
+               for (i=0; i<t.length; i++) {\r
+                       nl = this.tags(e.form ? e.form : e, t[i]);\r
+                       for (j=0; j<nl.length; j++) {\r
+                               this.removeClass(nl[j], s.invalid_cls);\r
+                               nl[j].setAttribute('aria-invalid', false);\r
+                       }\r
+               }\r
+       },\r
+\r
+       validateElms : function(f, e) {\r
+               var nl, i, n, s = this.settings, st = true, va = Validator, v;\r
+\r
+               nl = this.tags(f, e);\r
+               for (i=0; i<nl.length; i++) {\r
+                       n = nl[i];\r
+\r
+                       this.removeClass(n, s.invalid_cls);\r
+\r
+                       if (this.hasClass(n, s.required_cls) && va.isEmpty(n))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.number_cls) && !va.isNumber(n))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.email_cls) && !va.isEmail(n))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.size_cls) && !va.isSize(n))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.id_cls) && !va.isId(n))\r
+                               st = this.mark(f, n);\r
+\r
+                       if (this.hasClass(n, s.min_cls, true)) {\r
+                               v = this.getNum(n, s.min_cls);\r
+\r
+                               if (isNaN(v) || parseInt(n.value) < parseInt(v))\r
+                                       st = this.mark(f, n);\r
+                       }\r
+\r
+                       if (this.hasClass(n, s.max_cls, true)) {\r
+                               v = this.getNum(n, s.max_cls);\r
+\r
+                               if (isNaN(v) || parseInt(n.value) > parseInt(v))\r
+                                       st = this.mark(f, n);\r
+                       }\r
+               }\r
+\r
+               return st;\r
+       },\r
+\r
+       hasClass : function(n, c, d) {\r
+               return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);\r
+       },\r
+\r
+       getNum : function(n, c) {\r
+               c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];\r
+               c = c.replace(/[^0-9]/g, '');\r
+\r
+               return c;\r
+       },\r
+\r
+       addClass : function(n, c, b) {\r
+               var o = this.removeClass(n, c);\r
+               n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;\r
+       },\r
+\r
+       removeClass : function(n, c) {\r
+               c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');\r
+               return n.className = c != ' ' ? c : '';\r
+       },\r
+\r
+       tags : function(f, s) {\r
+               return f.getElementsByTagName(s);\r
+       },\r
+\r
+       mark : function(f, n) {\r
+               var s = this.settings;\r
+\r
+               this.addClass(n, s.invalid_cls);\r
+               n.setAttribute('aria-invalid', 'true');\r
+               this.markLabels(f, n, s.invalid_cls);\r
+\r
+               return false;\r
+       },\r
+\r
+       markLabels : function(f, n, ic) {\r
+               var nl, i;\r
+\r
+               nl = this.tags(f, "label");\r
+               for (i=0; i<nl.length; i++) {\r
+                       if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)\r
+                               this.addClass(nl[i], ic);\r
+               }\r
+\r
+               return null;\r
+       }\r
+};\r