diff --git a/sites/all/modules/ckeditor/CHANGELOG.txt b/sites/all/modules/ckeditor/CHANGELOG.txt new file mode 100644 index 0000000..31bf14e --- /dev/null +++ b/sites/all/modules/ckeditor/CHANGELOG.txt @@ -0,0 +1,456 @@ +6.x-1.x dev + +[#1971566] by wwalc: Mediaembed throws JS error with ACF enabled +[#1971502] by wwalc: Mediaembed plugin should define allowedContent for ACF +[#1950498] by wwalc: Advanced Content Filter introduced in CKEditor 4.1 is now configurable in CKEditor profile. + +----------------------------- + 2013-04-12 + New stable release: 6.x-1.14 +----------------------------- + +[#1908980] by wwalc: Moono should be set as the default skin on install. +[#1961596] by jcisio: Added 'feature_source()' option so that ckeditor_profile() component is visible in drush. +[#1959754] by wwalc: CKFinder is not installed correctly - improve information in the status report +[#1898642] by Elaman, bahaik: Fixed warning: file_get_contents()(./sites/all/libraries/ckeditor/ckeditor.js?I) [function.file-get-contents]: failed to open stream +[#1829574] by bdlangton: Fixed Notice: Trying to get property of non-object in ckeditor_user_delegate(). +[#1885952] by michal_cksource: Fix HTML validation for iframe in profile configuration. +[#1885940] by michal_cksource: Disable div based editor on default + +----------------------------- + 2012-12-22 + New stable release: 6.x-1.13 +----------------------------- + +Bug fixes: +[#1870288] by dczepierga: Disable plugins which not exists and are stored in ckeditor profiles +[#1866704] by dczepierga: Remove "Skin" and "Toolbar state on startup" options from user profile +[#1866708] by dczepierga: Set default theme if selected not exists + +----------------------------- + 2012-12-12 + New stable release: 6.x-1.12 +----------------------------- + +New features: +[#1858882] by dczepierga: Add option to enable/disable aggregate ckeditor.js script +[#1851606] by dczepierga: Add support for CKEditor v4 +[#1514376] by dczepierga: Change ckeditor xss url to be passed through url() + +Bug fixes: +[#1862820] by ceng: CKEditor features are not reverted or applied from the command line +[#1857920] by dczepierga: Using extraPlugins config option in Custom JavaScript (Advanced options) does not work +[#1663462] by dczepierga: Destroys existing instance when trying to replace it +[#1216096] by michal_cksource: Fix description to "Custom JavaScript configuration" option +[#1594382] by kmcnamee: Wrong instructions for configuring CKFinder +[#1397812] by dczepierga: External plugins not working in ckeditor_basic.js loading method +[#1398910] by dczepierga: Trying to get property of non-object when editing user with no access or profile + +----------------------------- + 2012-03-30 + New stable release: 6.x-1.11 +----------------------------- + +New features: +[#1489366] by dczepierga: Add support for the Stylesheet Parser plugin + +Bug fixes: +[#1436432] by dczepierga: Problems with the simplified toolbar configuration in the Global profile +[#1497184] by dczepierga: Style changes lost after saving +[#1507362] by kevin.dutra: Path to CKFinder can be constructed improperly +[#1506080] by dczepierga: Refactor code with titles and descriptions now available for translation +[#1496162] by michal_cksource: Buttons are too high when using the drag & drop feature in Firefox +[#1491884] by dczepierga: Portuguese language missing +[#1482874] by dczepierga: Body field is blank +[#1491462] by kevin.dutra: All filters applied in ckeditor_filter_xss() instead of just selected ones + +----------------------------- + 2012-03-15 + New stable release: 6.x-1.10 +----------------------------- + +Bug fixes: +[#1483508] by dczepierga: CKFinder requirement check needs fixing + +----------------------------- + 2012-03-14 + New stable release: 6.x-1.9 +----------------------------- + +New features: +[#1347994] by dczepierga: Add an option to disable the toolbar wizard +[#1349332] by dczepierga: Add a configuration option to set the CKFinder library path + +Bug fixes: +[#1345742] by michal_cksource: Included JavaScript files for the toolbar drag & drop wizard should be minified +[#1376276] by dczepierga: CKEditor is blank if reopened in a pop-up window +[#1363224] by michal_cksource: CKEditor appears despite a global exclude on the field +[#1365510] by jlea9378: CKFinder requirement check needs fixing +[#1361894] by dczepierga: Double scrollbar on drop-down menus in IE +[#1357050] by dczepierga: Invalid attribute "disc-type" in ckeditor.css +[#1350474] by dczepierga: CKEditor plugins added with the "hook_ckeditor_plugin" button do not appear in the toolbar +[#1350386] by michal_cksource: Improve regex pattern to find plugins for CKEditor +[#1349308] by michal_cksource: Change description in CKEditor help page +[#1343314] by michal_cksource: Change settings for private download +[#1348194] by michal_cksource: Change of the default path for CKFinder settings +[#1346820] by michal_cksource: Change of Full toolbar buttons +[#1345788] by michal_cksource: Remove redundant Drupal Page Break button if there is no module to support this feature +[#1345660] by michal_cksource: Enable the Drupal Breaks plugin by default +[#1341988] by michal_cksource: CSS rule to hide the toolbar can hide more than is expected +[#1334518] by michal_cksource: Unable to hide CKEditor on views edit pages by defining a path +[#1333882] by michal_cksource: Cannot select any toolbars +[#1334064] by dczepierga: Changes in the "ckeditor_load_plugins" function + +----------------------------- + 2011-11-04 + New stable release: 6.x-1.8 +----------------------------- + +Bug fixes: +[#1327818] by michal_cksource: Fix to edit settings +[#1326660] by michal_cksource: Fix for "Rewrite the output of this field" (Views option) +[#1329166] by michal_cksource: Fix Notice: Undefined index: ckeditor_allow_download_private_files in ckeditor.module +[#1325926] by michal_cksource: Fix jQuery support problems +[#1327196] by michal_cksource: Fix popup window no longer available + +----------------------------- + 2011-10-28 + New stable release: 6.x-1.7 +----------------------------- + +New features: +[#1308426] by duozersk: Add plugin to count symbols and words inside CKEditor +[#1297774] by dczepierga: Add Drag & Drop toolbar configuration +[#1294394] by dczepierga: Add multi toolbar configuration, and different settings for each profile + +Bug fixes: +[#1278062] by dczepierga: Allow security filters to run their 'prepare' code before 'process' +[#1319668] by michal_cksource: Correct language list in the CKEditor profile configuration +[#963208] by michal_cksource: Fix for CKEditor implementation of hook_file_download globally undermines private file download system +[#1314262] by michal_cksource: Fix for invalid link in CKEditor profile +[#1311926] by dczepierga: Add jquery_ui support to the Drag & Drop toolbar configuration +[#1310390] by dczepierga: Fix for undefined CKEDITOR_FORCE_SIMPLE_TOOLBAR_NAME name +[#1310298] by dczepierga: Fix Notice: Undefined index: default in ckeditor_admin_profile_form() - when editing CKEditor profile +[#1296804] by michal_cksource: Add patch for Tabledrag compatibility +[#1300140] by michal_cksource: Correct messages and add language fixes +[#1298302] by dczepierga: Fix to call to undefined function ckeditor_load_toolbar_options() +[#1297570] by dczepierga: Add sorting to the profiles list +[#1297090] by AlexisWilke: Fix E_NOTICE when calling $conf['ckeditor_load_method'] in module file +[#1286192] by dczepierga: Fix for CKEditor support to Imagefield module textareas +[#1288664] by dczepierga: Fix for CKEditor is not working in Views header and footer text areas +[#1289218] by dczepierga: Disable Linktocontent and IMCE module selection if these modules are not installed +[#1269544] by dczepierga: Call to undefined function ckeditor_plugins_path() when try to update module + +----------------------------- + 2011-08-30 + New stable release: 6.x-1.6 +----------------------------- +--2011-08-25 +- [#1248532] by dczepierga: Replace static paths to plugins in the database with dynamic paths + +--2011-08-16 +- [#1063458] by tobykilroy: 'CKEDITOR' is not defined - problem with ckeditor.styles.js + +--2011-08-11 +- [#1224726] by dczepierga: Use either underscores or hyphens for excluding/including, not both + +--2011-08-10 +- [#1243616] by dczepierga: "Custom JavaScript configuration" field description is wrong + +--2011-08-02 +- [#1234274] by GDI: Drupal Pagebreak button not showing +- [#1211554] by dczepierga: Bug with CKFinder path when CKEditor is in the libraries directory + +--2011-07-14 +- [#1216458] by dczepierga: Rewrite the loading of CKEditor libraries files + +--2011-07-12 +- [#1216096] by dczepierga: Bug in custom JavaScript configuration - semicolon problem + +--2011-07-08 +- [#1191634] by ptoly: CKEditor: Using LESS file instead of CSS for custom editor stylesheet + +--2011-06-30 +- [#1204786] by dczepierga: Bug in custom JavaScript configuration - editor not showing in some cases + +--2011-06-28 +- [#1202508] by dczepierga: Fix warning: array_key_exists(): The first argument should be either a string or an integer in ckeditor.module + +----------------------------- + 2011-06-28 + New stable release: 6.x-1.5 +----------------------------- +--2011-06-27 +- [#1177132] by tangent: Add SCAYT spelling language to match node language + +--2011-06-20 +- [#1192676] by dczepierga: Fix is_dir() function error and broken pagebreak button +- [#1193978] by dczepierga: Cleanup CKEditor config file from plugins definitions + +----------------------------- + 2011-06-16 + New stable release: 6.x-1.4 +----------------------------- +--2011-06-16 +- [#1190280] by dczepierga: Add configuration option for setting CKEditor's plugins directory + +--2011-06-14 +- [#1080270] by RolandK: Not formatting text between code tags + +--2011-06-13 +- [#975746] by dczepierga: Handling arrays in the "Custom javascript configuration" + +--2011-06-10 +- [#1184792] by anrikun: Move CKEditor module to "User interface" package + +--2011-06-09 +- [#1177062] by neclimdul: Fix broken teasers for long paragraphs + +--2011-06-06 +- [#1179912] by dczepierga: Add hook to register plugin +- [#1179766] by dczepierga: Fix calling undefined index: "loadPlugins" in ckeditor_admin_values_to_settings() + +--2011-06-02 +- [#1174144] by dczepierga: Add plugins managment in profile settings + +--2011-05-24 +- [#1167034] by dczepierga: Add tableresize plugin support for CKEditor library >= 3.6 +- [#1166984] by dczepierga: Correct CKEditor simple toolbar +- [#1166972] by dczepierga: Remove bullets from drop-down lists (Format, Font, etc.) in CKEditor on Garland theme +- [#1166936] by dczepierga: Update User Guide link + +--2011-05-23 +- [#1165870] by dczepierga: Improve manual selection of the user interface color + +-- 2011-05-17 +- [#1095908] by dczepierga: Add Google PageSpeed and Drupal JS/CSS aggregation support + +-- 2011-04-21 +- [#1117548] by dczepierga: Add HTML Entities configurable option in each profile + +-- 2011-03-29 +- [#738270] Add support for theme name in include/exclude in editor profile configuration +- [#1108900] by dczepierga: Add a warning message when the wysiwyg module is enabled in Drupal 6 + +-- 2011-03-28 +- [#1102518] by dczepierga: Fix for editing blocks, now the second field is not modified + +-- 2011-03-25 +- [#758936] by Diogenes: Add automatic setting of the CKFinder library path based on CKEditor library path + +-- 2011-03-24 +- [#1103872] by dczepierga: Change "ckeditor.make" name to "ckeditor.make.example" for drush make module + +-- 2011-03-23 +- [#1099748] by tbfisher: Fix drush make error when building a site with CKEditor + +-- 2011-03-18 +- [#763978] by gaellafond: Fix to work with "Drupal.settings.ckeditor.theme" value when using multiple instances + +-- 2011-03-17 +- [#1095174] by draenen: Fix to prevent calling "Toggle rich text link" multiple times +- [#1094960] by tobey_p: Fix to display CKEditor in Internet Explorer 6, 7, and 8 + +----------------------------- + 2011-03-17 + New stable release: 6.x-1.3 +----------------------------- + +-- 2011-03-16 +- [#1050118] by dczepierga: Added better support for Line break converter. CKEditor is now able to load properly content where new line characters were used to create new lines + Improve syntax with Coder module + +-- 2011-03-15 +- [#1050118] by dczepierga: Added better support for Line break converter. CKEditor is now able to load properly content where new line characters were used to create new lines + +-- 2011-02-22 +- [#960576] by rjacobs: Add loading ckeditor.css from theme + +-- 2011-02-21 +- [#1068026] by dczepierga: Added support for CKEditor Link (http://drupal.org/project/ckeditor_link) module +- [#695264] by dczepierga: Added support for CKEditor SWF (http://drupal.org/project/ckeditor_swf) module + +-- 2011-02-17 +- [#1037882] by dczepierga: Add admin/build/views/* to 'Fields to exclude/include' section in Global Profile +- [#1050118] by jcisio: Added better support for Line break converter. CKEditor is now able to load properly content where new line characters were used to create new lines + +-- 2011-02-15 +- [#906846] by jcisio: Support the Features module API (http://drupal.org/project/features) to allow bundling of CKEditor's visibility settings + +-- 2011-02-14 +- [#969486] by dczepierga: Added support for elFinder (http://drupal.org/project/elfinder) file manager support + +-- 2011-02-04 +- [#1011178] by dczepierga: Added support for the 'drush make' command + +-- 2011-01-25 +- [#1019950] by dczepierga: CKEditor Will Not Load - remove CKEditor is not defined +- [#1022208] by dczepierga: 'Send to rich text editor' fails with latest WebFM + +-- 2011-01-24 +- [#751672] by dczepierga: Table top border creates unwanted borderline + +-- 2011-01-20 +- [#1015822] by dczepierga: IMCE button in not visible in toolbar with CKEditor 3.5 + +-- 2011-01-17 +- [#940376] by dczepierga: Added schema version 6202 from FCKeditor module during migration +- [#964556] by jcisio: Fix Drupal.ckeditorCompareVersion does not check properly version number + +-- 2011-01-13 +- [#921826] by dczepierga: CKEditor indenting and aligning problems +- [#865710] by dczepierga: Provide a " Drupal.ckeditorActiveId" variable for tracking the active editor + +-- 2010-10-11 +- [#935566] by altavis: Added Media Embed translation + +----------------------------- + 2010-09-29 + New stable release: 6.x-1.2 +----------------------------- + +-- 2010-09-27 +- [#924020] by dczepierga: Add BiDi buttons to toolbar as default +- [#818378] by ahwebd&fmjrey: Not all css files are loaded + +-- 2010-09-15 +- [#738474] by dczepierga: Cannot edit or delete poorly named profile that include forward slashes +- [#742160] by dczepierga: warning: strtok() expects parameter 1 to be string in ckeditor.page.inc +- [#772396] by jcisio: Put ckeditor.utils.js in header for better aggregation + +-- 2010-06-18 +- [#827238]: README.txt should include the information about sites/all/libraries/ +- [#824918]: Disabling, enabling Scayt + +-- 2010-06-16 +- [#822948]: Fixed: Migrating from fckeditor to ckeditor causes postgresql error +- [#725086] by Dmitriy.trt: Fixed CKEditor does not appear on windows with non-empty window.opener + +-- 2010-06-14 +- [#814970]: Fixed: Teaser break not working with CKEditor 3.3 + +-- 2010-05-07 +- [#776026]: Fixed: output default values are kept when editing a ckeditor profile + +-- 2010-05-06 +- [#772134]: Avoid Javascript Caching of editor CSS + +-- 2010-03-30 +- [#756516] by kosilka: mistake in variable name + +-- 2010-03-22 +- [#741572] Fixed compatibility with the Ajax module + +-- 2010-03-15 +- [#742662] Fixed Notices Undefined index: language_direction and forcePasteAsPlainText +- [#742680] Fixed Notice: Undefined property: stdClass::$name +- [#742244] Fixed Creating a CKEditor Profile makes editor disappear + +----------------------------- + 2010-03-11 + New stable release: 6.x-1.1 +----------------------------- + +-- 2010-03-10 +- [#674454] Changed drush command name + +-- 2010-03-09 +- [#736786] by irakli: CKEditor is incompatible with Installation profiles + +-- 2010-03-06 +- [#732264] Fixed ckeditor dialog when editor is running in modal window from ctools + +-- 2010-03-05 +- [#733512] Fixed editing area size + +-- 2010-03-04 +- [#731086] Notice: Undefined index: #rows / #value +- [#703960] by hinanui: The CKEditor fails to load sporadically if the teaser of the node is empty +- [#703428] Add forcePasteAsPlainText to CKEditor profile +- [#707878] Add output formatting +- [#725880] RTL solution for editor + +-- 2010-03-02 +- [#729142] Notice: Undefined variable: filebroswer in ckeditor.module on line 703 +- [#728212] by morningtime: Looks for contents.css in wrong location +- [#679976] support Panels +- [#721914] Opening IMCE window without Image Dialog + +-- 2010-03-01 +- [#716274] Clone Profile incompatible with PCRE <7.0 + +-- 2010-02-17 +- [#651616] by FrankT: added German translation +- [#707370] support Tinybrowser + +-- 2010-02-16 +- [#651616] by samuelsan: added Spanish translation +- [#713804] by thebuckst0p: Fixed migration from fckeditor (doesn't respect DB prefix for fckeditor_role) + +-- 2010-02-03 +- [#651616] by chmoindron: added French translation +- [#703316] Advanced settings are broken in the dev release +- [#695474] by jeeba: Fixed warning: Invalid argument supplied for foreach() in ckeditor.module line 998 +- [#694082] by FrankT: Fixed string issues + +-- 2010-01-25 +- [#692558] by J0nathan: Fixed problem with adding boolean values into "Custom javascript configuration + +-- 2010-01-15 +- Added current instance tracking in javascript for easier integration with other module (Drupal.ckeditorInstance) +- Added Drupal.ckeditorInsertHtml function +- [#686024] by Grizz: Fixed errors in CSS file + +------------------------------ + 2010-01-14 + First stable release: 6.x-1.0 +------------------------------ + +-- 2010-01-14 +- [#680798] Improved compatibility with NewsFlash theme + +-- 2010-01-12 +- [#680202] Fixed: image preview not working in IE8 +- [#664488] Fixed: CKEditor grabs initial focus in IE + +-- 2010-01-08 +- [#665108] Fixed: CKeditor Show summary in full view checkbox always checked in editing mode + +-- 2010-01-06 +- [#674454] by Dave Reid: Add drush integration to download the CKEditor library. + +-- 2009-12-23 +- [#659278], [#666560], [#666616] Teaser buttons were missing when teasers were disabled by other modules + +-- 2009-12-22 +- [#663228] Fixed: Link to node not working properly +- [#665108] Fixed: CKeditor hide "Show summary in full view" checkbox +- [#662590] Fixed: If more than one editor css file set in "Edit CKEditor profile" > "Define CSS path", then none are used +- Improvements in MediaEmbed plugin + +-- 2009-12-17 +- [#654626] Fixed PHP notice (Undefined offset in ckeditor_get_nodetype) + +-- 2009-12-16 +- Fixed names of 'NumberedList' and 'BulletedList' buttons in Basic Toolbar +- [#656570] Fixed problems with missing ckeditor.styles.js +- [#654626] Fixed PHP notices "Undefined index: simple_incl, excl" +- Fixed double slash in path to break and teaserbreak button images + +-- 2009-12-15 +- [#659314] Fixed name of Format button in Basic Toolbar + +-- 2009-12-10 +- Added MediaEmbed plugin + - [#652274] Fixed: Error Message from Color module with CKEditor + - [#653498] Fixed: Empty teasers when editing content + - [#651904] Fixed: CKEditor Widens Beyond content area when Resized + - [#652570] Fixed: Force simple toolbar doesn't work + +------------------------------------------- + 2009-12-05 + First public (beta) release: 6.x-1.0-beta1 +------------------------------------------- + +-- 2009-10-05 +- Created initial dev version of the CKEditor module diff --git a/sites/all/modules/ckeditor/LICENSE.txt b/sites/all/modules/ckeditor/LICENSE.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/sites/all/modules/ckeditor/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/sites/all/modules/ckeditor/README.txt b/sites/all/modules/ckeditor/README.txt new file mode 100644 index 0000000..aa38b34 --- /dev/null +++ b/sites/all/modules/ckeditor/README.txt @@ -0,0 +1,36 @@ +About CKEditor for Drupal +------------------------- +This module allows Drupal to replace textarea fields with CKEditor. +CKEditor is an online rich text editor that can be embedded inside web pages. +It is a WYSIWYG (What You See Is What You Get) editor which means that the +text edited in it looks as similar as possible to the results end users will +see after the document gets published. It brings to the Web popular editing +features found in desktop word processors such as Microsoft Word and +OpenOffice.org Writer. CKEditor is truly lightweight and does not require any +kind of installation on the client computer. + +Help & Documentation +-------------------- +If you are looking for more information, have any trouble with the configuration of the module +or found an issue, please visit the official project page: + http://drupal.org/project/ckeditor + +Extensive CKEditor for Drupal documentation is available at: + http://docs.cksource.com/CKEditor_for_Drupal/Open_Source/Drupal_6 + +Contribution +------------ +If you would like to help in the development of the module, we encourage you to join our team. +Any help will be greatly appreciated! + +Module Information and License +---------------------------- +CKEditor - The text editor for the Internet +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +http://cksource.com/ + +Licensed under the terms of the GNU Lesser General Public License: + http://www.opensource.org/licenses/lgpl-license.php + +For further information visit: + http://ckeditor.com/ diff --git a/sites/all/modules/ckeditor/ckeditor-rtl.css b/sites/all/modules/ckeditor/ckeditor-rtl.css new file mode 100644 index 0000000..3974a82 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor-rtl.css @@ -0,0 +1,34 @@ +/* Indent & Justify classes */ + +.rteindent1 { + margin-right: 40px; + margin-left: 0; +} +.rteindent2 { + margin-right: 80px; + margin-left: 0; +} +.rteindent3 { + margin-right: 120px; + margin-left: 0; +} +.rteindent4 { + margin-right: 160px; + margin-left: 0; +} +.rteindent1[dir=ltr] { + margin-left: 40px; + margin-right: 0; +} +.rteindent2[dir=ltr] { + margin-left: 80px; + margin-right: 0; +} +.rteindent3[dir=ltr] { + margin-left: 120px; + margin-right: 0; +} +.rteindent4[dir=ltr] { + margin-left: 160px; + margin-right: 0; +} \ No newline at end of file diff --git a/sites/all/modules/ckeditor/ckeditor.api.php b/sites/all/modules/ckeditor/ckeditor.api.php new file mode 100644 index 0000000..1f5caf8 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.api.php @@ -0,0 +1,65 @@ + array( + // Name of the plugin used to write it. + 'name' => 'plugin_name', + // Description of the plugin - it would be displayed in the plugins management section of profile settings. + 'desc' => t('Plugin description'), + // The full path to the CKEditor plugins directory, with the trailing slash. + 'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/', + 'buttons' => array( + 'button_name' => array( + 'icon' => 'path to button icon', + 'label' => 'Button Label', + ) + ) + ) + ); +} + +/** + * Hook to extend CKEditor security allowed tags list. + * + * This hook is invoked from ckeditor_filter_xss() where text is filtered from potentially insecure tags. + */ +function hook_ckeditor_filter_xss_allowed_tags() { + // Return an array of additional allowed tags +} \ No newline at end of file diff --git a/sites/all/modules/ckeditor/ckeditor.config.js b/sites/all/modules/ckeditor/ckeditor.config.js new file mode 100644 index 0000000..967ecde --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.config.js @@ -0,0 +1,105 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +/* + WARNING: Clear the browser cache after you modify this file. + If you do not do this, you may notice that the browser is ignoring all your changes. + */ +CKEDITOR.editorConfig = function(config) { + config.indentClasses = [ 'rteindent1', 'rteindent2', 'rteindent3', 'rteindent4' ]; + + // [ Left, Center, Right, Justified ] + config.justifyClasses = [ 'rteleft', 'rtecenter', 'rteright', 'rtejustify' ]; + + // The minimum editor width, in pixels, when resizing it with the resize handle. + config.resize_minWidth = 450; + + // Protect PHP code tags () so CKEditor will not break them when + // switching from Source view to WYSIWYG. + // Uncommenting this line doesn't mean the user will not be able to type PHP + // code in the source. This kind of prevention must be done in the server + // side + // (as does Drupal), so just leave this line as is. + config.protectedSource.push(/<\?[\s\S]*?\?>/g); // PHP Code + config.protectedSource.push(/[\s\S]*?<\/code>/gi); // Code tags + config.extraPlugins = ''; + + /* + * Append here extra CSS rules that should be applied into the editing area. + * Example: + * config.extraCss = 'body {color:#FF0000;}'; + */ + config.extraCss = ''; + /** + * Sample extraCss code for the "marinelli" theme. + */ + var themeName = Drupal.settings.ckeditor.theme; + if (typeof themeName == "object") { + themeName = Drupal.settings.ckeditor.theme[0]; + } + if (themeName == "marinelli") { + config.extraCss += "body{background:#FFF;text-align:left;font-size:0.8em;}"; + config.extraCss += "#primary ol, #primary ul{margin:10px 0 10px 25px;}"; + } + if (themeName == "newsflash") { + config.extraCss = "body{min-width:400px}"; + } + + /** + * CKEditor's editing area body ID & class. + * See http://drupal.ckeditor.com/tricks + * This setting can be used if CKEditor does not work well with your theme by default. + */ + config.bodyClass = ''; + config.bodyId = ''; + /** + * Sample bodyClass and BodyId for the "marinelli" theme. + */ + if (themeName == "marinelli") { + config.bodyClass = 'singlepage'; + config.bodyId = 'primary'; + } +}; + +/* + * Sample toolbars + */ + +//Toolbar definition for basic buttons +Drupal.settings.cke_toolbar_DrupalBasic = [ [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] ]; + +//Toolbar definition for Advanced buttons +Drupal.settings.cke_toolbar_DrupalAdvanced = [ + ['Source'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], + ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'], + ['Maximize', 'ShowBlocks'], + '/', + ['Format'], + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], + ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'], + ['DrupalBreak', 'DrupalPageBreak'] +]; + +// Toolbar definiton for all buttons +Drupal.settings.cke_toolbar_DrupalFull = [ + ['Source'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], + ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','Iframe'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], + ['Link','Unlink','Anchor','Linkit','LinkToNode', 'LinkToMenu'], + '/', + ['Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks'], + ['DrupalBreak', 'DrupalPageBreak'] +]; \ No newline at end of file diff --git a/sites/all/modules/ckeditor/ckeditor.css b/sites/all/modules/ckeditor/ckeditor.css new file mode 100644 index 0000000..bcd51a2 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.css @@ -0,0 +1,135 @@ +/* Indent & Justify classes */ + +.rteindent1 { + margin-left: 40px; +} +.rteindent2 { + margin-left: 80px; +} +.rteindent3 { + margin-left: 120px; +} +.rteindent4 { + margin-left: 160px; +} +.rteleft { + text-align: left; +} +.rteright { + text-align: right; +} +.rtecenter { + text-align: center; +} +.rtejustify { + text-align: justify; +} +.ibimage_left { + float: left; +} +.ibimage_right { + float: right; +} + +/* CKEditor padding in IE */ +table.cke_editor fieldset { + padding:0 !important; +} +/* hack with ie and garland editing area size fix - [#733512] */ +.cke_editor{ + display: table !important; +} +.cke_editor,#ie#bug { + display: inline-table !important; +} + +.cke_panel_listItem { + background-image: none; + padding-left: 0; +} +/* remove top border from tbody - overwrite system.css - [#751672] */ +tbody { + border: 0; +} + +/*toolbar wizzard*/ +form#ckeditor-admin-profile-form textarea#edit-toolbar, form#ckeditor-admin-global-profile-form textarea#edit-toolbar { + display: none; +} +form#ckeditor-admin-profile-form #edit-toolbar + .grippie, form#ckeditor-admin-global-profile-form #edit-toolbar + .grippie { + display: none; +} +div.sortableList { + cursor: n-resize; +} +div.widthMarker { + height: 20px; + border-top: 1px dashed #CCC; + margin: 10px 0px 0px 1px; + padding-left: 1px; + text-align: center; +} +div.sortableList.group { + margin: 20px 0px 0px 0px; +} +div.sortableList div.sortableListDiv { + height: 30px; + margin-bottom: 3px; + width: 900px; +} +div.sortableList div.sortableListDiv span.sortableListSpan { + background-color: #F0F0EE; + height: 30px; + border-right: 1px dashed #CCC; + display: block; +} +div.sortableList div.sortableListDiv span.sortableListSpan ul { + background: none; + width: 900px; + white-space: nowrap; + border: 1px solid #CCC; + list-style: none; + margin:0px; + padding: 0px 0px 0px 1px; + height: 30px; +} +div.sortableList div.sortableListDiv span.sortableListSpan ul li { + background: none; + list-style: none; + cursor: move; + height: 18px; + min-width: 18px; + padding: 2px; +} +div.sortableList div.sortableListDiv span.sortableListSpan ul li.group { + min-width: 5px; + padding-left: 2px; +} +div.sortableList div.sortableListDiv span.sortableListSpan ul li img { + border: 0; + padding: 0; + margin: 0 +} +li.sortableItem { + position: relative; + float: left; + margin: 3px 1px 1px 0px; + border: 1px solid #CCC; + background-color: #F0F0EE; + z-index: 99; +} + +/* Fix for fieldset for-edit-apperance in Firefox*/ +fieldset#edit-appearance div#groupLayout, div#allButtons { + border: 0; + padding: 0 0 0 0; + margin: 1em 0; + overflow: auto; +} + +/** + * Fix for double scrollbar on ckeditor menu dropdowns in IE - [#1361894] + */ +.cke_browser_ie .cke_panel_block { + overflow: hidden !important; +} diff --git a/sites/all/modules/ckeditor/ckeditor.info b/sites/all/modules/ckeditor/ckeditor.info new file mode 100644 index 0000000..2b00aa3 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.info @@ -0,0 +1,10 @@ +name = CKEditor +description = "Enables CKEditor (WYSIWYG HTML editor) for use instead of plain text fields." +core = 6.x +package = User interface +; Information added by Drupal.org packaging script on 2014-10-14 +version = "6.x-1.15" +core = "6.x" +project = "ckeditor" +datestamp = "1413311937" + diff --git a/sites/all/modules/ckeditor/ckeditor.install b/sites/all/modules/ckeditor/ckeditor.install new file mode 100644 index 0000000..951b469 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.install @@ -0,0 +1,637 @@ + $v) { + if (FALSE!==strpos($k, 'fckeditor')) { + unset($settings[$k]); + $k=str_replace('fckeditor', 'ckeditor', $k); + } + if ((!is_array($v))&&(FALSE!==strpos($v, 'fckeditor'))) { + $v=str_replace('fckeditor', 'ckeditor', $v); + } + if ($k == 'skin' && $v != 'office2003') { + $v = 'kama'; + } + if ($k == 'css_style' && $v != 'default') { + $v = 'default'; + } + if ($k == 'styles_path' && strlen($v) > 0) { + $v=''; + } + if ($editor_path && $k == 'ckeditor_path') { + $v=$editor_path; + } + $settings[$k]=$v; + } + if (!array_key_exists('excl', $settings)) { + $settings['excl']=''; + } + if (!array_key_exists('simple_incl', $settings)) { + $settings['simple_incl']=''; + } + $settings=serialize($settings); + db_query("INSERT INTO {ckeditor_settings}(name, settings) VALUES('%s', '%s')", $nname, $settings); + } + break; + default: + //create two default roles based on previous settings + db_query("INSERT INTO {ckeditor_role} (name, rid) VALUES ('%s', %d)", + "Default", defined('DRUPAL_ANONYMOUS_RID') ? DRUPAL_ANONYMOUS_RID : 1); + db_query("INSERT INTO {ckeditor_role} (name, rid) VALUES ('%s', %d)", + "Advanced", defined('DRUPAL_AUTHENTICATED_RID') ? DRUPAL_AUTHENTICATED_RID : 2); + + //insert settings for default role + $arr = array(); + $arr['allow_user_conf'] = "f"; + $arr['min_rows'] = variable_get('ckeditor_minimum_rows', 1); + $arr['excl_mode'] = variable_get('ckeditor_exclude_toggle', 0); + $arr['filebrowser'] = 'none'; + $arr['quickupload'] = 'f'; + $arr['excl']=''; + $arr['simple_incl']=''; + + //security + $arr['ss'] = "2"; + $arr['filters']['filter/0'] = 1; + + //appearance + $arr['default'] = "t"; + $arr['show_toggle'] = "t"; + $arr['popup'] = variable_get('ckeditor_popup', 0) ? "t" : "f"; + $arr['skin'] = "moono"; + $arr['toolbar'] = " +[ + [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] +] + "; + $arr['expand'] = variable_get('ckeditor_toolbar_start_expanded', 1) ? "t" : "f"; + $arr['width'] = variable_get("ckeditor_width", "100%"); + $arr['lang'] = "en"; + $arr['auto_lang'] = "t"; + $arr['language_direction'] = "default"; + + //output + $arr['enter_mode'] = "p"; + $arr['shift_enter_mode'] = "br"; + $arr['font_format'] = 'p;div;pre;address;h1;h2;h3;h4;h5;h6'; + $arr['format_source'] = "t"; + $arr['format_output'] = "t"; + $arr['custom_formatting'] = "f"; + $arr['formatting']['custom_formatting_options'] = array('indent' => 'indent', 'breakBeforeOpen' => 'breakBeforeOpen', 'breakAfterOpen' => 'breakAfterOpen', 'breakAfterClose' => 'breakAfterClose'); + + //css + $arr['css_mode'] = "theme"; + $arr['css_path'] = variable_get("ckeditor_stylesheet", ""); + + //upload + //get permissions here like in _update_role_permissions + $arr['filebrowser'] = "none"; + $arr['user_choose'] = "f"; + $arr['show_fieldnamehint'] = "t"; + $arr['ckeditor_load_method'] = "ckeditor.js"; + $arr['ckeditor_load_time_out'] = 0; + $arr['scayt_autoStartup'] = "f"; + + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", "Default", serialize($arr)); + + //insert settings for advanced role + $arr['toolbar'] = " +[ + ['Source'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], + ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','Iframe'], + ['Maximize', 'ShowBlocks'], + '/', + ['Format'], + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], + ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'], + ['DrupalBreak'] +] + "; + + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", "Advanced", serialize($arr)); + + $arr = array(); + + //exclude by default some known textareas where HTML is not expected + //edit-recipients //contact module + //edit-reply //contact module + //edit-description //taxonomy module + //edit-synonyms //taxonomy module + //edit-img-assist-textareas //img assist module + $arr['excl_mode'] = 0; + $arr['excl'] = variable_get("ckeditor_exclude", + "admin/user/settings.edit-user-mail-*\n". + "*.edit-pages\n". + "*.edit-pathauto-ignore-words\n". + "*.edit-recipients\n". + "*.edit-reply\n". + "*.edit-description\n". + "*.edit-synonyms\n". + "*.edit-img-assist-textareas\n". + "*.edit-img-assist-paths\n". + "*.edit-nodewords-description\n". + "*.edit-nodewords-description-value\n". + "admin/content/nodewords/global*\n". + "*.edit-relatedlinks-fieldset-relatedlinks\n". + "*.edit-allowed-values-php\n". + "*.edit-allowed-values\n". + "*.edit-update-notify-emails\n". + "*.edit-googleanalytics-*\n". + "*.edit-piwik-*\n". + "*.edit-feedburner-useragents\n". + "*@*.edit-webform-*\n". + "webform@*.edit-extra-items\n". + "admin/*/logintoboggan\n". + "admin/settings/actions/configure/*\n". + "*.edit-target\n". + "*.edit-wysiwyg-filter-*\n". + "admin/build/views*\n" + ); + + //force by default simple toolbar on selected textareas + $arr['simple_incl_mode'] = 1; + $arr['simple_incl'] = + "*.edit-signature\n". + "admin/settings/site-information.*\n". + "admin/settings/site-maintenance.*\n". + "*.edit-page-help\n". + "*.edit-user-registration-help\n". + "*.edit-user-picture-guidelines\n"; + if ($editor_path) { + $arr['ckeditor_path']=$editor_path; + } + + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", "CKEditor Global Profile", serialize($arr)); + } + module_load_include('inc', 'ckeditor', 'includes/ckeditor.admin'); + ckeditor_rebuild_selectors(); +} + +/** + * Implementation of hook_schema(). + */ +function ckeditor_schema() { + $schema['ckeditor_settings'] = array( + 'description' => 'Stores CKEditor profile settings', + 'fields' => array( + 'name' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => '', + 'length' => 128, + 'description' => 'Name of the CKEditor profile', + ), + 'settings' => array( + 'type' => 'text', + 'description' => 'Profile settings', + ), + ), + 'primary key' => array('name'), + ); + $schema['ckeditor_role'] = array( + 'description' => 'Stores CKEditor profile assignments', + 'fields' => array( + 'name' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => '', + 'length' => 128, + 'description' => 'Name of the CKEditor role', + ), + 'rid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Drupal role ID', + ), + ), + 'primary key' => array('name', 'rid'), + ); + + return $schema; +} + +/** + * Implementation of hook_requirements(). + * + * This hook will issue warnings if: + * - The CKEditor source files are not found. + * - The CKEditor source files are out of date. + * - Quick upload and/or the built-in file browser are used and $cookie_domain is not set. + */ +function ckeditor_requirements($phase) { + $requirements = array(); + + if ($phase == 'runtime') { + module_load_include('module', 'ckeditor'); + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + $requirements['ckeditor'] = array( + 'title' => t('CKEditor'), + 'value' => t('Unknown'), + ); + + $requirements['ckeditor']['severity'] = REQUIREMENT_OK; + + if (!_ckeditor_requirements_isinstalled()) { + $sourcepath = ckeditor_path(TRUE); + + $requirements['ckeditor']['description'] = t('CKEditor was not found in %sourcepath.', array('%sourcepath' => $sourcepath)); + $requirements['ckeditor']['severity'] = REQUIREMENT_ERROR; + } + elseif (($installed_version = _ckeditor_requirements_getinstalledversion()) === NULL) { + $requirements['ckeditor']['description'] = t('CKEditor version could not be determined.'); + $requirements['ckeditor']['severity'] = REQUIREMENT_INFO; + } + else { + $profile_name = _ckeditor_requirements_ckfinder_filebrowser_enabled(); + if ($profile_name !== FALSE) { + if (!_ckeditor_requirements_cookiedomainset()) { + $requirements['ckeditor']['severity'] = REQUIREMENT_ERROR; + $requirements['ckeditor']['description'] = t('You are using a feature that requires $cookie_domain to be set, but it is not set in your settings.php file (CKFinder is enabled in the !profile profile).', array('!profile' => l($profile_name, 'admin/settings/ckeditor/edit/'. urlencode($profile_name)))); + } + elseif ($error = _ckeditor_requirements_ckfinder_config_check($profile_name)) { + $requirements['ckeditor']['severity'] = REQUIREMENT_ERROR; + $requirements['ckeditor']['description'] = $error; + } + } + } + if ((($installed_version = _ckeditor_requirements_getinstalledversion()) !== NULL) && (-1==version_compare($installed_version, '3.1 SVN')) && $installed_version != '%VERSION%') { + $requirements['ckeditor']['description'] = t('Some features are disabled because you are using an older version of CKEditor. Please upgrade the editor to CKEditor 3.1 (or higher).'); + $requirements['ckeditor']['severity'] = REQUIREMENT_INFO; + } + if (!empty($installed_version)) { + if ($installed_version == '%VERSION%') { + $requirements['ckeditor']['value'] = 'GIT version'; + } + else { + $requirements['ckeditor']['value'] = $installed_version; + } + } + } + + return $requirements; +} + +/** + * Fetches the version of the installed CKEditor sources. + * + * It tries to locate the version of the CKEditor sources in + * ckeditor.js. + * + * Releases have a version number such as "3.0.1". + * SVN nightly releases have a minor version number with SVN appended: "3.0 SVN". + * SVN checkouts have the string "[Development]". + * + * This function is used by ckeditor_requirements(). + * + * @return string Version number (eg. 3.0) of CKEditor. Null if not found in ckeditor_basic.js. + */ +function _ckeditor_requirements_getinstalledversion() { + module_load_include('module', 'ckeditor'); + $editor_path = ckeditor_path(TRUE, TRUE); + $jspath = $editor_path .'/ckeditor.js'; + + $configcontents = @file_get_contents($jspath); + if (!$configcontents) { + return NULL; + } + $matches = array(); + if (preg_match('#,version:[\'\"]{1}(.*?)[\'\"]{1},#', $configcontents, $matches)) { + return $matches[1]; + } + return NULL; +} + +/** + * Executed when the built-in file browser is enabled. + * Returns FALSE if no errors are found in the config.php file, otherwise it returns an error message. + * + * @return string|boolean + */ +function _ckeditor_requirements_ckfinder_config_check($profile_name) { + module_load_include('module', 'ckeditor'); + $ckfinder_full_path = ckfinder_path(); + $config_path = $ckfinder_full_path . '/config.php'; + + if (!file_exists($config_path)) { + return t('!ckfinder is not installed correctly: !config not found. Make sure that you uploaded all files and did not accidentally remove the configuration file. If you installed CKFinder in other location (e.g. in the libraries folder), make sure to update the path to CKFinder in !global.', array( + '!config' => $config_path, + '!ckfinder' => 'CKFinder', + '!global' => l(t('CKEditor Global Profile'), 'admin/settings/ckeditor/editg') + )); + } + + if (!is_readable($config_path)) { + return t('CKEditor needs read permission to the !config file.', array('!config' => $config_path)); + } + + $config_contents = file($config_path); + + //not a 100% valid check, but well... let's have at least some error checking + $require_once_found = FALSE; + $require_once_line = 0; + $userfiles_absolute_path_line = 0; + $force_single_extension_line = 0; + + if ($config_contents) + foreach ($config_contents as $line_num => $line) { + //make sure it doesn't start with a comment, unfortunately we're not protected if code is commented with /* */ + if (!$require_once_found && strpos($line, "filemanager.config.php") !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) { + $require_once_found = TRUE; + $require_once_line = $line_num; + } + /** + * @todo Finish this + */ + if (!$userfiles_absolute_path_line && strpos($line, '$Config[\'UserFilesAbsolutePath\']') !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) { + $userfiles_absolute_path_line = $line_num; + } + if (!$force_single_extension_line && strpos($line, '$Config[\'ForceSingleExtension\']') !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) { + $force_single_extension_line = $line_num; + } + } + + if (!$require_once_found) { + return t('You are using a feature that requires manual integration in the config.php file. Please read the "Installing CKFinder" section in the !readme file carefully and add a require_once ... statement to the %ckfconfig file.', array('%ckfconfig' => $config_path, '!readme' => l(t('README.txt'), $base_url . '/' . drupal_get_path('module', 'ckeditor') . '/README.txt', array('absolute' => TRUE)))); + } + + if ($userfiles_absolute_path_line && $force_single_extension_line && ( + $require_once_line < $userfiles_absolute_path_line || $require_once_line > $force_single_extension_line)) { + return t('You are using a feature that requires manual integration in the config.php file. You have added a require_once ... statement to the %ckfconfig file, but in the wrong line.', array('%ckfconfig' => $config_path)); + } + + return FALSE; +} + +/** + * Checks if any profile requires an explicit setting of $cookie_domain + * in settings.php. + * + * %cookie_domain is required when the internal file browser or quick upload is used. + * + * This function is used by ckeditor_requirements(). + * + * @return boolean True if any profile requires $cookie_domain. + */ +function _ckeditor_requirements_ckfinder_filebrowser_enabled() { + module_load_include('module', 'ckeditor'); + $profiles = ckeditor_profile_load(); + + foreach ($profiles as $profile) { + if ((isset($profile->settings['filebrowser']) && $profile->settings['filebrowser'] == 'ckfinder')) { + return $profile->name; + } + } + + return FALSE; +} + +/** + * Checks if $cookie_domain was set. + * + * It has to include settings.php again because conf_init() sets + * $cookie_domain regardless of its presence in settings.php, so + * simply checking $GLOBALS['cookie_domain'] is not possible. + * + * This function is used by ckeditor_requirements(). + * + * @return boolean True iff $cookie_domain was set in settings.php. + */ +function _ckeditor_requirements_cookiedomainset() { + if (file_exists('./'. conf_path() .'/settings.php')) { + $settings = file_get_contents('./'. conf_path() .'/settings.php'); + + if (preg_match('#^\s*\$cookie_domain#m', $settings)) { + return TRUE; + } + } + + return FALSE; +} + +/** + * Implementation of hook_update_N(). + * + * Deletes all plus signs from profile names. + */ + +function ckeditor_update_6100() { + $ret = array(); + $ret[] = update_sql( "UPDATE {ckeditor_role} SET name = REPLACE(name,'+','')"); + $ret[] = update_sql( "UPDATE {ckeditor_role} SET name = REPLACE(name,'/','')"); + $ret[] = update_sql( "UPDATE {ckeditor_settings} SET name = REPLACE(name,'+','')"); + $ret[] = update_sql( "UPDATE {ckeditor_settings} SET name = REPLACE(name,'/','')"); + + return $ret; +} + +/** + * Implementation of hook_update_N(). + * + * Fixes static paths to plugin files. + */ + +function ckeditor_update_6101() { + module_load_include('module', 'ckeditor'); + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + + $render = array(); + $render["%base_path%"] = base_path(); + $render["%editor_path%"] = ckeditor_path(TRUE) . '/'; + $render["%ckeditor_path%"] = drupal_get_path('module', 'ckeditor') . '/'; + $render["%plugin_dir%"] = $render["%ckeditor_path%"] . 'plugins/'; + $render["%plugin_dir_extra%"] = ckeditor_plugins_path(TRUE) . '/'; + + if ($render["%plugin_dir%"] == $render["%plugin_dir_extra%"]) { + unset($render["%plugin_dir_extra%"]); + } + + $ret = array(); + + $result = db_query("SELECT * FROM {ckeditor_settings} WHERE name <> 'CKEditor Global Profile'"); + + while (($profile = db_fetch_object($result))) { + $name = $profile->name; + $settings = unserialize($profile->settings); + + foreach ((array) $settings['loadPlugins'] as $i => $plugin) { + $settings['loadPlugins'][$i]['path'] = str_replace(array_values($render), array_keys($render), $plugin['path']); + } + + $settings = serialize($settings); + + $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); + $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); + } + + return $ret; +} + +/** + * Implementation of hook_update_N(). + * + * Moves toolbar definition from the configuration file to the database - toolbar definition is now set in the CKEditor profile. + */ + +function ckeditor_update_6102() { + module_load_include('module', 'ckeditor'); + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + + $ret = array(); + + $result = db_query("SELECT * FROM {ckeditor_settings} WHERE name <> 'CKEditor Global Profile'"); + + while (($profile = db_fetch_object($result))) { + $name = $profile->name; + $settings = unserialize($profile->settings); + + if ($settings['toolbar'] == 'DrupalBasic') { + $settings['toolbar'] = " +[ + [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] +] + "; + + $settings = serialize($settings); + + $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); + $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); + } + elseif ($settings['toolbar'] == 'DrupalFiltered') { + $settings['toolbar'] = " +[ + ['Source'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], + ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'], + ['Maximize', 'ShowBlocks'], + '/', + ['Format'], + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], + ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'], + ['DrupalBreak', 'DrupalPageBreak'] +] + "; + + $settings = serialize($settings); + + $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); + $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); + } + elseif ($settings['toolbar'] == 'DrupalFull') { + $settings['toolbar'] = " +[ + ['Source'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], + ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], + ['Link','Unlink','Anchor','Linkit','LinkToNode', 'LinkToMenu'], + '/', + ['Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks'], + ['DrupalBreak', 'DrupalPageBreak'] +] + "; + + $settings = serialize($settings); + + $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); + $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); + } + else { + $settings['toolbar'] = ""; + $settings = serialize($settings); + + $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); + $ret[] = array('success' => $return !== FALSE, 'query' => "[!!] UPDATE PROFILE - {$name} - Custom toolbar cannot be converted, please set this toolbar manually in the CKEditor profile!"); + } + } + + return $ret; +} + +/** + * Implementation of hook_uninstall(). + */ +function ckeditor_uninstall() { + drupal_uninstall_schema('ckeditor'); +} \ No newline at end of file diff --git a/sites/all/modules/ckeditor/ckeditor.make.example b/sites/all/modules/ckeditor/ckeditor.make.example new file mode 100644 index 0000000..fb54fd6 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.make.example @@ -0,0 +1,10 @@ +; $Id$ + +core = 6.x +api = 2 + +projects[] = drupal + +libraries[ckeditor][download][type] = "svn" +libraries[ckeditor][download][url] = "http://svn.ckeditor.com/CKEditor/releases/stable/" +libraries[ckeditor][directory_name] = "ckeditor" \ No newline at end of file diff --git a/sites/all/modules/ckeditor/ckeditor.module b/sites/all/modules/ckeditor/ckeditor.module new file mode 100644 index 0000000..52ecbb3 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.module @@ -0,0 +1,1487 @@ +language)) { + $form['body_field']['body']['#scayt_language'] = _ckeditor_scayt_langcode($form['#node']->language); + } + if (!empty($form['body_field']['teaser_js']['#teaser'])) { + $setting['ckeditor']['teaser'] = $form['body_field']['teaser_js']['#teaser']; + drupal_add_js($setting, 'setting'); + } + } +} + +/** + * Implementation of hook_help(). + * + * This function delegates the execution to ckeditor_help_delegate() in includes/ckeditor.page.inc to + * lower the amount of code in ckeditor.module. + */ +function ckeditor_help($path, $arg) { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.page'); + return module_invoke('ckeditor', 'help_delegate', $path, $arg); +} + +/** + * Implementation of hook_user(). + * + * This function delegates the execution to ckeditor_user_delegate() in includes/ckeditor.user.inc to + * lower the amount of code in ckeditor.module. + */ +function ckeditor_user($type, $edit, &$user, $category = NULL) { + if (($type == 'form' && $category == 'account' && user_access('access ckeditor')) || $type == 'validate') { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.user'); + return ckeditor_user_delegate($type, $edit, $user, $category); + } + return NULL; +} + +/** + * Implementation of hook_perm(). + * Administer -> User management -> Permissions + */ +function ckeditor_perm() { + $arr = array('administer ckeditor', 'access ckeditor'); + $ckfinder_full_path = ckfinder_path(); + $config_path = $ckfinder_full_path . '/config.php'; + if (file_exists($config_path)) { + $arr[] = 'allow CKFinder file uploads'; + } + return $arr; +} + +/** + * Check CKEditor version + */ +function ckeditor_get_version($main_version = FALSE) { + static $ckeditor_version = FALSE; + + if ($ckeditor_version !== FALSE) { + if (!$main_version) { + return $ckeditor_version; + } + $version = explode('.', $ckeditor_version); + return trim($version[0]); + } + + $editor_path = ckeditor_path(TRUE, TRUE); + $jspath = $editor_path . '/ckeditor.js'; + + $configcontents = @file_get_contents($jspath); + if (!$configcontents) { + return $ckeditor_version = NULL; + } + $matches = array(); + if (preg_match('#,version:[\'\"]{1}(.*?)[\'\"]{1},#', $configcontents, $matches)) { + $ckeditor_version = $matches[1]; + if ($ckeditor_version == '%VERSION%') { + $ckeditor_version = '4.0.0'; + } + if (!$main_version) { + return $ckeditor_version; + } + $version = explode('.', $ckeditor_version); + return trim($version[0]); + } + return $ckeditor_version = NULL; +} + +/** + * Implementation of hook_elements(). + * Replace the textarea with CKEditor using a callback function (ckeditor_process_textarea) + */ +function ckeditor_elements() { + $type = array(); + $type['textfield'] = array( + '#process' => array( + 'ckeditor_process_input' + ), + ); + // only roles with permission get CKEditor + if (user_access('access ckeditor')) { + $type['textarea'] = array('#process' => array('ckeditor_process_textarea')); + $type['form'] = array('#after_build' => array('ckeditor_process_form')); + $type['hidden'] = array('#process' => array('ckeditor_process_hidden')); + } + return $type; +} + +function ckeditor_process_hidden($element, $edit, $form_state, $complete_form) { + if (!empty($element['#value']) && in_array($element['#value'], array('panels_edit_display_form', 'panels_panel_context_edit_content'))) { + $fake_element = array('#id' => 'edit-body'); + ckeditor_process_textarea($fake_element); + } + return $element; +} + +function ckeditor_process_form(&$form) { + global $_ckeditor_configuration, $_ckeditor_ids; + static $processed_textareas = array(); + static $found_textareas = array(); + + //Skip if: + // - we're not editing an element + // - ckeditor is not enabled (configuration is empty) + if (arg(1) == "add" || arg(1) == "reply" || !count($_ckeditor_configuration)) { + return $form; + } + + $ckeditor_filters = array(); + + // Iterate over element children; resetting array keys to access last index. + if ($children = array_values(element_children($form))) { + foreach ($children as $index => $item) { + $element = &$form[$item]; + + if (isset($element['#id']) && in_array($element['#id'], $_ckeditor_ids)) { + $found_textareas[$element['#id']] = &$element; + } + + // filter_form() always uses the key 'format'. We need a type-agnostic + // match to prevent FALSE positives. Also, there must have been at least + // one element on this level. + if ($item === 'format' && $index > 0) { + + // Make sure we either match a input format selector or input format + // guidelines (displayed if user has access to one input format only). + if ((isset($element['#type']) && $element['#type'] == 'fieldset') || isset($element['format']['guidelines'])) { + // The element before this element is the target form field. + $field = &$form[$children[$index - 1]]; + $textarea_id = $field['#id']; + + array_push($processed_textareas, $textarea_id); + + //search for checkxss1/2 class + if (empty($field['#attributes']['class']) || strpos($field['#attributes']['class'], "checkxss") === FALSE) { + continue; + } + + // Determine the available input formats. The last child element is a + // link to "More information about formatting options". When only one + // input format is displayed, we also have to remove formatting + // guidelines, stored in the child 'format'. + $formats = element_children($element); + + foreach ($formats as $format_id) { + $format = !empty($element[$format_id]['#default_value']) ? $element[$format_id]['#default_value'] : $element[$format_id]['#value']; + break; + } + + $enabled = filter_list_format($format); + $ckeditor_filters = array(); + + //loop through all enabled filters + foreach ($enabled as $id => $filter) { + //but use only that one selected in CKEditor profile + if (in_array($id, array_keys($_ckeditor_configuration[$textarea_id]['filters'])) && $_ckeditor_configuration[$textarea_id]['filters'][$id]) { + if (!isset($ckeditor_filters[$textarea_id])) { + $ckeditor_filters[$textarea_id] = array(); + } + $ckeditor_filters[$textarea_id][] = $id ."/". $format; + } + } + + drupal_add_js(array('ckeditor' => array('settings' => array($textarea_id => array('input_format' => $format)))), 'setting'); + + //No filters assigned, remove xss class + if (empty($ckeditor_filters[$textarea_id])) { + $field['#attributes']['class'] = preg_replace("/checkxss(1|2)/", "", $field['#attributes']['class']); + } + else { + $field['#attributes']['class'] = strtr($field['#attributes']['class'], array("checkxss1" => "filterxss1", "checkxss2" => "filterxss2")); + } + + array_pop($formats); + unset($formats['format']); + } + // If this element is 'format', do not recurse further. + continue; + } + // Recurse into children. + ckeditor_process_form($element); + } + } + + //We're in a form + if (isset($form['#action'])) { + //some textareas associated with CKEditor has not been processed + if (count($processed_textareas) < count($_ckeditor_ids)) { + //loop through all found textfields + foreach (array_keys($found_textareas) as $id) { + $element = &$found_textareas[$id]; + //if not processed yet (checkxss class is before final processing) + if (strpos($element['#attributes']['class'], "checkxss") !== FALSE && !in_array($element['#id'], $processed_textareas) && !empty($_ckeditor_configuration[$id]['filters']) && array_sum($_ckeditor_configuration[$id]['filters'])) { + //assign default Filtered HTML to be safe on fields that do not have input format assigned, but only if at least one security filter is enabled in Security settings + $ckeditor_filters[$element['#id']][] = "filter/0/1"; + $element['#attributes']['class'] = strtr($element['#attributes']['class'], array("checkxss1" => "filterxss1", "checkxss2" => "filterxss2")); + } + } + } + } + + if (!empty($ckeditor_filters)) { + foreach ($ckeditor_filters as $id => $filters) { + $arr['settings'][$id]['filters'] = $filters; + } + drupal_add_js(array('ckeditor' => $arr), 'setting'); + } + return $form; +} + +/** + * Allow more than 255 chars in Allowed HTML tags textfield + */ +function ckeditor_process_input($element) { + if ($element['#id']=='edit-allowed-html-1') { + $element['#maxlength'] = max($element['#maxlength'], 1024); + } + return $element; +} + +/** + * Implementation of hook_menu(). + */ +function ckeditor_menu() { + $items = array(); + + $items['ckeditor/xss'] = array( + 'title' => 'XSS Filter', + 'description' => 'XSS Filter.', + 'page callback' => 'ckeditor_filter_xss', + 'file' => 'includes/ckeditor.page.inc', + 'access arguments' => array('access ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['ckeditor/disable/wysiwyg/%'] = array( + 'title' => 'Disable WYSIWYG module', + 'description' => 'Disable the WYSIWYG module.', + 'page callback' => 'ckeditor_disable_wysiwyg', + 'page arguments' => array(3), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor'] = array( + 'title' => 'CKEditor', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'ckeditor_admin_main', + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/settings/ckeditor/skinframe'] = array( + 'title' => 'Change skin of CKEditor', + 'description' => 'Configure skin for CKEditor.', + 'page callback' => 'ckeditor_skinframe', + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor/add'] = array( + 'title' => 'Add a new CKEditor profile', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ckeditor_admin_profile_form'), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor/clone/%ckeditor_profile'] = array( + 'title' => 'Clone the CKEditor profile', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ckeditor_admin_profile_clone_form', 4), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor/edit/%ckeditor_profile'] = array( + 'title' => 'Edit the CKEditor profile', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ckeditor_admin_profile_form', 4), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor/delete/%ckeditor_profile'] = array( + 'title' => 'Delete the CKEditor profile', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ckeditor_admin_profile_delete_form', 4), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor/addg'] = array( + 'title' => 'Add the CKEditor Global profile', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ckeditor_admin_global_profile_form', 'add'), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/settings/ckeditor/editg'] = array( + 'title' => 'Edit the CKEditor Global profile', + 'description' => 'Configure the rich text editor.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ckeditor_admin_global_profile_form', 'edit'), + 'file' => 'includes/ckeditor.admin.inc', + 'access arguments' => array('administer ckeditor'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/ckeditor/get_settings'] = array( + 'title' => 'Get settings for the CKEditor instance', + 'description' => 'Get settings for the CKEditor instance', + 'page callback' => 'ckeditor_get_settings', + 'access arguments' => array('access ckeditor'), + 'type' => MENU_CALLBACK, + ); + + return $items; +} + +/** + * Implementation of hook_init(). + */ +function ckeditor_init() { + drupal_add_css(drupal_get_path('module', 'ckeditor') .'/ckeditor.css'); + + // Added for support [#1288664] Views + if (module_exists('views') && preg_match('/admin\/build\/views/', $_GET['q'])) { + $module_drupal_path = drupal_get_path('module', 'ckeditor'); + $editor_local_path = ckeditor_path(TRUE); + drupal_add_js($editor_local_path . '/ckeditor.js', 'module', 'footer', FALSE, TRUE, FALSE); + drupal_add_js($module_drupal_path .'/includes/ckeditor.utils.js', 'module', 'footer' ); + drupal_add_js(array('ckeditor' => array('ajaxToken' => drupal_get_token('ckeditorAjaxCall'), 'xss_url' => url('ckeditor/xss'), 'default_input_format' => variable_get('filter_default_format', 1), 'settings' => array('edit-footer', 'edit-header'))), 'setting'); + } +} + +/** + * Implementation of hook_file_download(). + * Support for private downloads. + * CKEditor does not implement any kind of potection on private files. + */ +function ckeditor_file_download($file) { + if ($path = file_create_path($file)) { + $result = db_query("SELECT f.* FROM {files} f WHERE filepath = '%s'", $path); + if (db_fetch_object($result)) { + return NULL; + } + + //No info in DB? Probably a file uploaded with FCKeditor / CKFinder + $global_profile = ckeditor_profile_load("CKEditor Global Profile"); + + //Assume that files inside of ckeditor directory belong to the CKEditor. If private directory is set, let the decision about protection to the user. + $private_dir = isset($global_profile->settings['private_dir']) ? trim($global_profile->settings['private_dir'], '\/') : ''; + $private_dir = preg_quote($private_dir, '#'); + $private_dir = strtr($private_dir, array('%u' => '(\d+)', '%n' => '([\x80-\xF7 \w@.-]+)')); // regex for %n taken from user_validate_name() in user.module + $private_dir = trim($private_dir, '\/'); + $regex = '#^'. preg_quote(file_directory_path() .'/', '#') . $private_dir .'#'; + //check if CKEditor's "Enable access to files located in the private folder" option is disabled or enabled + $allow_download_private_files = FALSE; + if (isset($global_profile->settings['ckeditor_allow_download_private_files']) && $global_profile->settings['ckeditor_allow_download_private_files'] === 't') { + $allow_download_private_files = TRUE; + } + //denied access to file if private upload is set and CKEditor's "Enable access to files located in the private folder" option is disabled + if ($allow_download_private_files == FALSE ) return NULL; + //check if file can be served by comparing regex and path to file + if (preg_match($regex, $path)) { + $ctype = ($info = @getimagesize($path)) ? $info['mime'] : (function_exists('mime_content_type') ? mime_content_type($path) : 'application/x-download'); + return array('Content-Type: '. $ctype); + } + } +} + +/** + * Load all profiles. Just load one profile if $name is passed in. + */ +function ckeditor_profile_load($name = '', $clear = FALSE) { + static $profiles = array(); + + if (empty($profiles) || $clear === TRUE) { + $result = db_query("SELECT * FROM {ckeditor_settings} ORDER BY name"); + while (($data = db_fetch_object($result))) { + $data->settings = unserialize($data->settings); + $data->rids = array(); + + $profiles[$data->name] = $data; + } + + $roles = user_roles(); + $result = db_query("SELECT name, rid FROM {ckeditor_role}"); + while (($data = db_fetch_object($result))) { + $profiles[$data->name]->rids[$data->rid] = $roles[$data->rid]; + } + } + + return ($name ? (isset($profiles[urldecode($name)]) ? $profiles[urldecode($name)] : FALSE) : $profiles); +} + +/** + * This function creates the HTML objects required for CKEditor. + * + * @param $element + * A fully populated form elment to add the editor to. + * @return + * The same $element with extra CKEditor markup and initialization. + */ +function ckeditor_process_textarea($element) { + static $is_running = FALSE; + static $num = 1; + static $processed_ids=array(); + global $user, $theme, $language, $_ckeditor_configuration, $_ckeditor_ids; + $settings = array(); + $enabled = TRUE; + $suffix = ""; + $class = ""; + //hack for module developers that want to disable ckeditor on their textareas + if (key_exists('#wysiwyg', $element) && !$element['#wysiwyg']) { + return $element; + } + + if (isset($element['#access']) && !$element['#access']) { + return $element; + } + //skip this one, surely nobody wants WYSIWYG here + switch ($element['#id']) { + case 'edit-log': + return $element; + break; + } + + if (isset($element['#attributes']['disabled']) && $element['#attributes']['disabled'] == 'disabled') { + return $element; + } + + if (isset($processed_ids[$element['#id']])) { + //statement for node preview purpose, when second textarea element with the same id is processing to add class which ckeditor behavior must process + if (empty($element['#attributes']['class'])) { + $element['#attributes']['class'] = $processed_ids[$element['#id']]['class']; + } + else { + $element['#attributes']['class'] .= " ". $processed_ids[$element['#id']]['class']; + } + if (empty($element['#suffix'])) { + $element['#suffix'] = $processed_ids[$element['#id']]['suffix']; + } + else { + $element['#suffix'] .= $processed_ids[$element['#id']]['suffix']; + } + return $element; + } + else { + $processed_ids[$element['#id']] = array(); + } + + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + + $global_profile = ckeditor_profile_load('CKEditor Global Profile'); + if ($global_profile) { + $global_conf = $global_profile->settings; + if ($global_conf) { + $enabled = ckeditor_is_enabled(empty($global_conf['excl_mode']) ? '0' : $global_conf['excl_mode'], empty($global_conf['excl_regex']) ? '' : $global_conf['excl_regex'], $element['#id'], $_GET['q']); + } + } + if ($enabled) { + $profile = ckeditor_user_get_profile($user, $element['#id']); + if ($profile) { + $conf = array(); + $conf = $profile->settings; + + if ($conf['allow_user_conf']=='t') { + foreach (array('default', 'show_toggle', 'popup', 'width', 'lang', 'auto_lang') as $setting) { + $conf[$setting] = ckeditor_user_get_setting($user, $profile, $setting); + } + } + if ($conf['popup'] == 't' && $conf['show_toggle'] == 't') { + $conf['show_toggle'] = 'f'; + } + } + else { + $enabled = FALSE; + } + } + + //old profile info, assume Filtered HTML is enabled + if (!isset($conf['ss'])) { + $conf['ss'] = 2; + $conf['filters']['filter/0'] = 1; + } + if (!isset($conf['filters'])) { + $conf['filters'] = array(); + } + + $themepath = path_to_theme() .'/'; + $host = base_path(); + if (!isset($element['#rows'])) { + $element['#rows'] = 5; + } + // only replace textarea when it has enough rows and it is enabled + if ($enabled && (($element['#rows'] > $conf['min_rows']) || ($conf['min_rows'] <= 1 && empty($element['#rows'])))) { + $textarea_id = $element['#id']; + $class = 'ckeditor-mod'; + $_ckeditor_ids[] = $textarea_id; + $ckeditor_on = ($conf['default']=='t') ? 1 : 0 ; + $xss_check = 0; + //it's not a problem when adding new content/comment + if (arg(1) != "add" && arg(1) != "reply") { + $_ckeditor_configuration[$element['#id']] = $conf; + + //let ckeditor know when perform XSS checks auto/manual + if ($conf['ss'] == 1) { + $xss_class = 'checkxss1'; + } + else { + $xss_class = 'checkxss2'; + } + + $class .= ' '. $xss_class; + $xss_check = 1; + } + + //settings are saved as strings, not booleans + if ($conf['show_toggle'] == 't') { + $content = ''; + if (isset($element['#post']['teaser_js'])) { + $content .= $element['#post']['teaser_js'] .''; + } + if (isset($element['#value'])) { + $content .= $element['#value']; + } + $wysiwyg_link = ''; + $wysiwyg_link .= ""; + $wysiwyg_link .= $ckeditor_on ? t('Switch to plain text editor') : t('Switch to rich text editor'); + $wysiwyg_link .= ''; + + // Make sure to append to #suffix so it isn't completely overwritten + $suffix .= $wysiwyg_link; + } + // setting some variables + $module_drupal_path = drupal_get_path('module', 'ckeditor'); + $module_full_path = $host . $module_drupal_path; + $editor_path = ckeditor_path(FALSE); + $lib_path = dirname($editor_path); + $editor_local_path = ckeditor_path(TRUE); + $lib_local_path = dirname($editor_local_path); + // get the default drupal files path + $files_path = $host . file_directory_path(); + + drupal_set_html_head(''); + + // sensible default for small toolbars + if (isset($element['#rows'])) { + $height = intval($element['#rows']) * 14 + 140; + } + else { + $height = 400; + } + if (!$is_running) { + $preprocess = FALSE; + if (isset($global_profile->settings['ckeditor_aggregate']) && $global_profile->settings['ckeditor_aggregate'] == 't') { + $preprocess = TRUE; + } + drupal_add_js($module_drupal_path .'/includes/ckeditor.utils.js', 'module', variable_get('preprocess_js', FALSE) ? 'header' : 'footer'); + /* In D6 drupal_add_js() can't add external JS, in D7 use drupal_add_js(...,'external') */ + if ( $conf['popup'] != 't' ) { + if (isset($conf['ckeditor_load_method']) && file_exists($editor_local_path . '/' . $conf['ckeditor_load_method'])) { + drupal_add_js($editor_local_path . '/' . $conf['ckeditor_load_method'], 'module', 'header', FALSE, TRUE, $preprocess); + if ($conf['ckeditor_load_method'] == 'ckeditor_basic.js') { + drupal_add_js('CKEDITOR.loadFullCoreTimeout = ' . $conf['ckeditor_load_time_out'] . ';', 'inline'); + drupal_add_js(array('ckeditor' => array('load_timeout' => TRUE)), 'setting'); + } + } + else { + drupal_add_js($editor_local_path . '/ckeditor.js', 'module', 'header', FALSE, TRUE, $preprocess); + } + } + else { + if (file_exists($editor_local_path . '/ckeditor_basic.js')) { + drupal_add_js($editor_local_path . '/ckeditor_basic.js', 'module', 'header', FALSE, TRUE, $preprocess); + } + else { + drupal_add_js($editor_local_path . '/ckeditor.js', 'module', 'header', FALSE, TRUE, $preprocess); + } + } + drupal_add_js(array('ckeditor' => array('module_path' => $module_full_path, 'editor_path' => $editor_path)), 'setting'); + drupal_add_js(array('ckeditor' => array('ajaxToken' => drupal_get_token('ckeditorAjaxCall'), 'xss_url' => url('ckeditor/xss'))), 'setting'); + drupal_add_js(array('ckeditor' => array('query' => $_GET['q'])), 'setting'); + drupal_add_js(array('ckeditor' => array('default_input_format' => variable_get('filter_default_format', 1))), 'setting'); + $is_running = TRUE; + } + + $toolbar = $conf['toolbar']; + //$height += 100; // for larger toolbars + + $force_simple_toolbar = ckeditor_is_enabled('1', empty($conf['simple_incl_regex']) ? '' : $conf['simple_incl_regex'], $element['#id'], $_GET['q']); + if (!$force_simple_toolbar) { + $force_simple_toolbar = ckeditor_is_enabled('1', empty($global_conf['simple_incl_regex']) ? '' : $global_conf['simple_incl_regex'], $element['#id'], $_GET['q']); + } + if ($force_simple_toolbar) { + if (!isset($global_conf['simple_toolbar'])) { + $toolbar = "[ [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] ]"; + } + else { + $toolbar = $global_conf['simple_toolbar']; + } + } + + if (!empty($conf['theme_config_js']) && $conf['theme_config_js'] == 't' && file_exists($themepath .'ckeditor.config.js')) { + $ckeditor_config_path = $host . $themepath .'ckeditor.config.js?'. @filemtime($themepath .'ckeditor.config.js'); + } + else { + $ckeditor_config_path = $module_full_path ."/ckeditor.config.js?". @filemtime($module_drupal_path ."/ckeditor.config.js"); + } + + $settings[$textarea_id]['customConfig'] = $ckeditor_config_path; + $settings[$textarea_id]['defaultLanguage'] = $conf['lang']; + $settings[$textarea_id]['toolbar'] = $toolbar; + $settings[$textarea_id]['enterMode'] = constant("CKEDITOR_ENTERMODE_" . strtoupper($conf['enter_mode'])); + $settings[$textarea_id]['shiftEnterMode'] = constant("CKEDITOR_ENTERMODE_" . strtoupper($conf['shift_enter_mode'])); + $settings[$textarea_id]['toolbarStartupExpanded'] = ( $conf['expand']=='t' ); + $settings[$textarea_id]['customConfig'] = $ckeditor_config_path; + $settings[$textarea_id]['width'] = $conf['width']; + $settings[$textarea_id]['height'] = $height; + //check if skin exists, if not select default one + if (file_exists($editor_local_path . '/skins/' . $conf['skin'])) { + $settings[$textarea_id]['skin'] = $conf['skin']; + } + else { + $settings[$textarea_id]['skin'] = ckeditor_default_skin(); + } + $settings[$textarea_id]['format_tags'] = $conf['font_format']; + if (!empty($conf['allowed_content']) && $conf['allowed_content'] === 'f') { + $settings[$textarea_id]['allowedContent'] = true; + } + if (!empty($conf['extraAllowedContent'])) { + $settings[$textarea_id]['extraAllowedContent'] = $conf['extraAllowedContent']; + } + if (isset($conf['language_direction'])) { + switch ($conf['language_direction']) { + case 'default': + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + $settings[$textarea_id]['contentsLangDirection'] = 'rtl'; + } + break; + case 'ltr': + $settings[$textarea_id]['contentsLangDirection'] = 'ltr'; + break; + case 'rtl': + $settings[$textarea_id]['contentsLangDirection'] = 'rtl'; + break; + } + } + if (isset($conf['loadPlugins'])) { + $settings[$textarea_id]['loadPlugins'] = ckeditor_plugins_render($conf['loadPlugins']); + } + else { + $settings[$textarea_id]['loadPlugins'] = array(); + } + + //add support for divarea plugin from CKE4 + if (isset($conf['use_divarea']) && $conf['use_divarea'] == 't' && file_exists($editor_local_path . '/plugins/divarea/plugin.js')) { + $settings[$textarea_id]['loadPlugins']['divarea'] = array('name' => 'divarea', 'path' => $editor_path . '/plugins/divarea/', 'buttons' => FALSE, 'default' => 'f'); + } + + if (isset($conf['html_entities']) && $conf['html_entities'] == 'f') { + $settings[$textarea_id]['entities'] = FALSE; + $settings[$textarea_id]['entities_greek'] = FALSE; + $settings[$textarea_id]['entities_latin'] = FALSE; + } + if (isset($conf['scayt_autoStartup']) && $conf['scayt_autoStartup'] == 't') { + $settings[$textarea_id]['scayt_autoStartup'] = TRUE; + } + else { + $settings[$textarea_id]['scayt_autoStartup'] = FALSE; + } + if ($conf['auto_lang']=="f") { + $settings[$textarea_id]['language'] = $conf['lang']; + } + if (isset($element['#scayt_language'])) { + $settings[$textarea_id]['scayt_sLang'] = $element['#scayt_language']; + } + if (isset($conf['forcePasteAsPlainText']) && $conf['forcePasteAsPlainText'] == 't') { + $settings[$textarea_id]['forcePasteAsPlainText'] = TRUE; + } + if (isset($conf['custom_formatting']) && $conf['custom_formatting'] == 't') { + foreach ($conf['formatting']['custom_formatting_options'] as $k => $v) { + if ($v === 0) { + $conf['formatting']['custom_formatting_options'][$k] = FALSE; + } + else { + $conf['formatting']['custom_formatting_options'][$k] = TRUE; + } + } + $settings[$textarea_id]['output_pre_indent'] = $conf['formatting']['custom_formatting_options']['pre_indent']; + unset($conf['formatting']['custom_formatting_options']['pre_indent']); + $settings[$textarea_id]['custom_formatting'] = $conf['formatting']['custom_formatting_options']; + } + // add code for filebrowser for users that have access + $filebrowser = !empty($conf['filebrowser']) ? $conf['filebrowser'] : 'none'; + $filebrowser_image = !empty($conf['filebrowser_image']) ? $conf['filebrowser_image'] : $filebrowser; + $filebrowser_flash = !empty($conf['filebrowser_flash']) ? $conf['filebrowser_flash'] : $filebrowser; + + if ($filebrowser == 'imce' && !module_exists('imce')) { + $filebrowser = 'none'; + } + + if ($filebrowser == 'tinybrowser' && !module_exists('tinybrowser')) { + $filebrowser = 'none'; + } + + if ($filebrowser == 'ib' && !module_exists('imagebrowser')) { + $filebrowser = 'none'; + } + if ($filebrowser == 'webfm' && !module_exists('webfm_popup')) { + $filebrowser = 'none'; + } + + if ($filebrowser == 'elfinder' && !module_exists('elfinder')) { + $filebrowser = 'none'; + } + + if ($filebrowser_image != $filebrowser) { + if ($filebrowser_image == 'imce' && !module_exists('imce')) { + $filebrowser_image = $filebrowser; + } + if ($filebrowser_image == 'tinybrowser' && !module_exists('tinybrowser')) { + $filebrowser_image = $filebrowser; + } + if ($filebrowser_image == 'ib' && !module_exists('imagebrowser')) { + $filebrowser_image = $filebrowser; + } + if ($filebrowser_image == 'webfm' && !module_exists('webfm_popup')) { + $filebrowser_image = $filebrowser; + } + if ($filebrowser_image == 'elfinder' && !module_exists('elfinder')) { + $filebrowser_image = $filebrowser; + } + } + + if ($filebrowser_flash != $filebrowser) { + if ($filebrowser_flash == 'imce' && !module_exists('imce')) { + $filebrowser_flash = $filebrowser; + } + if ($filebrowser_image == 'tinybrowser' && !module_exists('tinybrowser')) { + $filebrowser_flash = $filebrowser; + } + if ($filebrowser_flash == 'ib' && !module_exists('imagebrowser')) { + $filebrowser_flash = $filebrowser; + } + if ($filebrowser_flash == 'webfm' && !module_exists('webfm_popup')) { + $filebrowser_flash = $filebrowser; + } + if ($filebrowser_flash == 'elfinder' && !module_exists('elfinder')) { + $filebrowser_flash = $filebrowser; + } + } + + if ($filebrowser == 'ckfinder' || $filebrowser_image == 'ckfinder' || $filebrowser_flash == 'ckfinder') { + if (user_access('allow CKFinder file uploads')) { + if (!empty($profile->settings['UserFilesPath'])) { + $_SESSION['ckeditor']['UserFilesPath'] = strtr($profile->settings['UserFilesPath'], array("%f" => file_directory_path(), "%u" => $user->uid, "%b" => $host, "%n" => $user->name)); + } + else{ + $_SESSION['ckeditor']['UserFilesPath'] = strtr('%b%f/', array("%f" => file_directory_path(), "%u" => $user->uid, "%b" => $host, "%n" => $user->name)); + } + if (!empty($profile->settings['UserFilesAbsolutePath'])) { + $_SESSION['ckeditor']['UserFilesAbsolutePath'] = strtr($profile->settings['UserFilesAbsolutePath'], array("%f" => file_directory_path(), "%u" => $user->uid, "%b" => base_path(), "%d" => $_SERVER['DOCUMENT_ROOT'], "%n" => $user->name)); + } + else{ + $_SESSION['ckeditor']['UserFilesAbsolutePath'] = strtr('%d%b%f/', array("%f" => file_directory_path(), "%u" => $user->uid, "%b" => base_path(), "%d" => $_SERVER['DOCUMENT_ROOT'], "%n" => $user->name)); + } + if (variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE) { + $private_dir = isset($global_profile->settings['private_dir']) ? trim($global_profile->settings['private_dir'], '\/') : ''; + if (!empty($private_dir)) { + $private_dir = strtr($private_dir, array('%u' => $user->uid, '%n' => $user->name)); + $_SESSION['ckeditor']['UserFilesPath'] = url('system/files') .'/'. $private_dir .'/'; + $_SESSION['ckeditor']['UserFilesAbsolutePath'] = realpath(file_directory_path()) . DIRECTORY_SEPARATOR . $private_dir . DIRECTORY_SEPARATOR; + } + else { + $_SESSION['ckeditor']['UserFilesPath'] = url('system/files') .'/'; + $_SESSION['ckeditor']['UserFilesAbsolutePath'] = realpath(file_directory_path()) . DIRECTORY_SEPARATOR; + } + } + } + } + + if (in_array('tinybrowser', array($filebrowser, $filebrowser_image, $filebrowser_flash))) { + $popup_win_size = variable_get('tinybrowser_popup_window_size', '770x480'); + if (!preg_match('#\d+x\d+#is', $popup_win_size)) { + $popup_win_size = '770x480'; + } + $popup_win_size = trim($popup_win_size); + $popup_win_size = strtolower($popup_win_size); + $win_size = split('x', $popup_win_size); + } + + switch ($filebrowser) { + case 'ckfinder': + if (user_access('allow CKFinder file uploads')) { + $ckfinder_full_path = base_path() . ckfinder_path(); + $settings[$textarea_id]['filebrowserBrowseUrl'] = $ckfinder_full_path .'/ckfinder.html'; + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $ckfinder_full_path .'/ckfinder.html?Type=Images'; + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $ckfinder_full_path .'/ckfinder.html?Type=Flash'; + $settings[$textarea_id]['filebrowserUploadUrl'] = $ckfinder_full_path .'/core/connector/php/connector.php?command=QuickUpload&type=Files'; + $settings[$textarea_id]['filebrowserImageUploadUrl'] = $ckfinder_full_path .'/core/connector/php/connector.php?command=QuickUpload&type=Images'; + $settings[$textarea_id]['filebrowserFlashUploadUrl'] = $ckfinder_full_path .'/core/connector/php/connector.php?command=QuickUpload&type=Flash'; + } + break; + case 'imce': + $settings[$textarea_id]['filebrowserBrowseUrl'] = $host ."index.php?q=imce&app=ckeditor|sendto@ckeditor_fileUrl|"; + break; + case 'webfm': + if (user_access('access webfm')) { + $settings[$textarea_id]['filebrowserBrowseUrl'] = $host ."index.php?q=webfm_popup&caller=ckeditor"; + } + break; + case 'ib': + if (user_access('browse own images')) { + $settings[$textarea_id]['filebrowserBrowseUrl'] = $host ."index.php?q=imagebrowser/view/browser&app=ckeditor"; + $settings[$textarea_id]['filebrowserWindowWidth'] = 700; + $settings[$textarea_id]['filebrowserWindowHeight'] = 520; + } + break; + case 'tinybrowser': + $settings[$textarea_id]['filebrowserBrowseUrl'] = $host . drupal_get_path('module', 'tinybrowser') . "/tinybrowser/tinybrowser.php?type=file"; + $settings[$textarea_id]['filebrowserWindowWidth'] = (int)$win_size[0] + 15; + $settings[$textarea_id]['filebrowserWindowHeight'] = (int)$win_size[1] + 15; + break; + case 'elfinder': + $settings[$textarea_id]['filebrowserBrowseUrl'] = $host ."index.php?q=elfinder&app=ckeditor"; + break; + } + + if ($filebrowser_image != $filebrowser) { + switch ($filebrowser_image) { + case 'ckfinder': + if (user_access('allow CKFinder file uploads')) { + $ckfinder_full_path = base_path() . ckfinder_path(); + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $ckfinder_full_path .'/ckfinder.html?Type=Images'; + $settings[$textarea_id]['filebrowserImageUploadUrl'] = $ckfinder_full_path .'/core/connector/php/connector.php?command=QuickUpload&type=Images'; + } + break; + case 'imce': + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $host ."index.php?q=imce&app=ckeditor|sendto@ckeditor_fileUrl|"; + break; + case 'webfm': + if (user_access('access webfm')) { + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $host ."index.php?q=webfm_popup&caller=ckeditor"; + } + break; + case 'ib': + if (user_access('browse own images')) { + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $host ."index.php?q=imagebrowser/view/browser&app=ckeditor"; + $settings[$textarea_id]['filebrowserImageWindowWidth'] = 680; + $settings[$textarea_id]['filebrowserImageWindowHeight'] = 439; + } + break; + case 'tinybrowser': + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $host . drupal_get_path('module', 'tinybrowser') . "/tinybrowser/tinybrowser.php?type=image"; + $settings[$textarea_id]['filebrowserImageWindowWidth'] = (int)$win_size[0] + 15; + $settings[$textarea_id]['filebrowserImageWindowHeight'] = (int)$win_size[1] + 15; + break; + case 'elfinder': + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $host ."index.php?q=elfinder&app=ckeditor"; + break; + } + } + + if ($filebrowser_flash != $filebrowser) { + switch ($filebrowser_flash) { + case 'ckfinder': + if (user_access('allow CKFinder file uploads')) { + $ckfinder_full_path = base_path() . ckfinder_path(); + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $ckfinder_full_path .'/ckfinder.html?Type=Images'; + $settings[$textarea_id]['filebrowserFlashUploadUrl'] = $ckfinder_full_path .'/core/connector/php/connector.php?command=QuickUpload&type=Images'; + } + break; + case 'imce': + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $host ."index.php?q=imce&app=ckeditor|sendto@ckeditor_fileUrl|"; + break; + case 'webfm': + if (user_access('access webfm')) { + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $host ."index.php?q=webfm_popup&caller=ckeditor"; + } + break; + case 'ib': + if (user_access('browse own images')) { + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $host ."index.php?q=imagebrowser/view/browser&app=ckeditor"; + $settings[$textarea_id]['filebrowserFlashWindowWidth'] = 680; + $settings[$textarea_id]['filebrowserFlashWindowHeight'] = 439; + } + break; + case 'tinybrowser': + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $host . drupal_get_path('module', 'tinybrowser') . "/tinybrowser/tinybrowser.php?type=media"; + $settings[$textarea_id]['filebrowserFlashWindowWidth'] = (int)$win_size[0] + 15; + $settings[$textarea_id]['filebrowserFlashWindowHeight'] = (int)$win_size[1] + 15; + break; + case 'elfinder': + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $host ."index.php?q=elfinder&app=ckeditor"; + break; + } + } + + if (!empty($conf['js_conf'])) { + //parsing lines with custom configuration + preg_match_all('#config\.(\w+)[\s]*=[\s]*(.+?);[\s]*(?=config\.|$)#is', preg_replace("/[\n\r]+/", "", $conf['js_conf']), $matches); + foreach ($matches[2] as $i => $match) { + if (!empty($match)) { + $value=trim($match, " ;\n\r\t\0\x0B"); + if ( strcasecmp($value, 'true') == 0 ) { + $value=TRUE; + } + if ( strcasecmp($value, 'false') == 0 ) { + $value=FALSE; + } + $settings[$textarea_id]["js_conf"][$matches[1][$i]]=$value; + } + } + } + + $settings[$textarea_id]['stylesCombo_stylesSet'] = "drupal:" . $module_full_path . '/ckeditor.styles.js'; + if (!empty($conf['css_style'])) { + if ($conf['css_style'] == 'theme' && file_exists($themepath . 'ckeditor.styles.js')) { + $settings[$textarea_id]['stylesCombo_stylesSet'] = "drupal:" . $host . $themepath . 'ckeditor.styles.js'; + } + elseif (!empty($conf['css_style']) && $conf['css_style'] == 'self') { + $conf['styles_path'] = str_replace("%h%t", "%t", $conf['styles_path']); + $settings[$textarea_id]['stylesCombo_stylesSet'] = "drupal:" . str_replace(array('%h', '%t', '%m'), array($host, $host . $themepath, $module_drupal_path), $conf['styles_path']); + } + } + // add custom stylesheet if configured + // lets hope it exists but we'll leave that to the site admin + $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); + $css_files = array(); + switch ($conf['css_mode']) { + case 'theme': + global $language, $theme_info, $base_theme_info; + + if (!empty($theme_info->stylesheets)) { + $editorcss = "\""; + foreach ($base_theme_info as $base) { // Grab stylesheets from base theme + if (!empty($base->stylesheets)) { // may be empty when the base theme reference in the info file is invalid + foreach ($base->stylesheets as $type => $stylesheets) { + if ($type != "print") { + foreach ($stylesheets as $name => $path) { + if (file_exists($path)) { + $css_files[$name] = $host . $path . $query_string; + // Grab rtl stylesheets ( will get rtl css files when thay are named with suffix "-rtl.css" (ex: fusion baased themes) ) + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL && substr($path, 0, -8) != "-rtl.css") { + $rtl_path = substr($path, 0, -4) . "-rtl.css"; + if (file_exists($rtl_path)) { + $css_files[$name . "-rtl"] = $host . $rtl_path . $query_string; + } + } + } + } + } + } + } + } + if (!empty($theme_info->stylesheets)) { // Grab stylesheets from current theme + foreach ($theme_info->stylesheets as $type => $stylesheets) { + if ($type != "print") { + foreach ($stylesheets as $name => $path) { + // Checks if less module exists... + if (strstr($path, '.less') && module_exists('less')) { + $path = 'sites/default/files/less/' . $path; // append the less file path + $path = str_replace('.less', '', $path); // remove the .less + } + if (file_exists($path)) { + $css_files[$name] = $host . $path . $query_string; + // Grab rtl stylesheets ( will get rtl css files when thay are named with suffix "-rtl.css" (ex: fusion baased themes) ) + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL && substr($path, 0, -8) != "-rtl.css") { + $rtl_path = substr($path, 0, -4) . "-rtl.css"; + if (file_exists($rtl_path)) { + $css_files[$name . "-rtl"] = $host . $rtl_path . $query_string; + } + } + } + elseif (!empty($css_files[$name])) { + unset($css_files[$name]); + } + } + } + } + } + // Grab stylesheets local.css and local-rtl.css if they exist (fusion based themes) + if (file_exists($themepath . 'css/local.css')) { + $css_files[] = $host . $themepath . 'css/local.css' . $query_string; + } + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL && file_exists($themepath . 'css/local-rtl.css')) { + $css_files[] = $host . $themepath . 'css/local-rtl.css' . $query_string; + } + + // Grab stylesheets from color module + $color_paths = variable_get('color_'. $theme .'_stylesheets', array()); + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + if (!empty($color_paths[1])) { + $css_files[] = $host . $color_paths[1] . $query_string; + } + } + elseif (!empty($color_paths[0])) { + $css_files[] = $host . $color_paths[0] . $query_string; + } + } + else { + if (file_exists($themepath .'style.css')) { + $css_files[] = $host . $themepath .'style.css' . $query_string; + } + } + if (file_exists($module_drupal_path .'/ckeditor.css')) { + $css_files[] = $module_full_path .'/ckeditor.css' . $query_string; + } + if (file_exists($themepath . 'ckeditor.css')) { + $css_files[] = $host . $themepath .'ckeditor.css' . $query_string; + } + break; + + case 'self': + if (file_exists($module_drupal_path .'/ckeditor.css')) { + $css_files[] = $module_full_path .'/ckeditor.css' . $query_string; + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + if (file_exists($module_drupal_path . '/ckeditor-rtl.css')) { + $css_files[] = $module_full_path . '/ckeditor-rtl.css' . $query_string; + } + } + } + foreach (explode(',', $conf['css_path']) as $css_path) { + $css_path = trim(str_replace("%h%t", "%t", $css_path)); + $css_files[] = str_replace(array('%h', '%t'), array($host, $host . $themepath), $css_path) . $query_string; + } + break; + + case 'none': + if (file_exists($module_drupal_path .'/ckeditor.css')) { + $css_files[] = $module_full_path .'/ckeditor.css' . $query_string; + if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + if (file_exists($module_drupal_path . '/ckeditor-rtl.css')) { + $css_files[] = $module_full_path . '/ckeditor-rtl.css' . $query_string; + } + } + } + $css_files[] = $editor_path .'/contents.css' . $query_string; + break; + } + if (isset($conf['ckeditor_load_method']) && $conf['ckeditor_load_method'] == 'ckeditor_source.js') { + foreach ($css_files as $k => $v) { + $css_files[$k] = $v . '&t=' . time(); + } + } + $settings[$textarea_id]['contentsCss'] = array_values($css_files); + + if ($ckeditor_on) { + $autostart[$textarea_id] = TRUE; + } + + if (!empty($conf['uicolor']) && $conf['uicolor']=="custom" && !empty($conf['uicolor_user'])) { + $settings[$textarea_id]['uiColor'] = $conf['uicolor_user']; + } + if (!empty($conf['uicolor']) && strpos($conf['uicolor'], "color_") === 0) { + if (function_exists('color_get_palette')) { + $palette = @color_get_palette($theme, FALSE); //[#652274] + $color = str_replace("color_", "", $conf['uicolor']); + if (!empty($palette[$color])) { + $settings[$textarea_id]['uiColor'] = $palette[$color]; + } + } + } + + drupal_add_js(array('ckeditor' => array( 'theme' => $theme )), 'setting'); + if (!empty($settings)) { + $_SESSION['cke_get_settings'] = $settings; + drupal_add_js(array('ckeditor' => array('settings' => $settings)), 'setting'); + } + if (!empty($autostart)) { + drupal_add_js(array('ckeditor' => array('autostart' => $autostart)), 'setting'); + } + + if ($conf['popup'] == 't') { + $suffix .= ' "; + } + } + + // display the field id for administrators + if (user_access('administer ckeditor') && (!isset($global_conf['show_fieldnamehint']) || $global_conf['show_fieldnamehint'] == 't')) { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.admin'); + $suffix .= '
'. t('CKEditor: the ID for excluding or including this element is %fieldname.', array('!excluding' => url('admin/settings/ckeditor'), '%fieldname' => ckeditor_rule_to_string(ckeditor_rule_create(ckeditor_get_nodetype($_GET['q']), $_GET['q'], $element['#id'])))) .'
'; + } + + // Remember extra information and reuse it during "Preview" + $processed_ids[$element['#id']]['suffix'] = $suffix; + $processed_ids[$element['#id']]['class'] = $class; + + if (empty($element['#suffix'])) { + $element['#suffix'] = $suffix; + } + else { + $element['#suffix'] .= $suffix; + } + + if (empty($element['#attributes']['class'])) { + $element['#attributes']['class'] = $class; + } + else { + $element['#attributes']['class'] .= ' '. $class; + } + //hack with patch jquery-ui dialog + return $element; +} + +/** + * Read the CKEditor path from the Global profile. + * + * @return + * Path to CKEditor folder. + */ +function ckeditor_path($local = FALSE, $refresh = FALSE) { + static $cke_path; + static $cke_local_path; + + if ($refresh || (!$cke_path)) { + $mod_path = drupal_get_path('module', 'ckeditor'); + $lib_path = 'sites/all/libraries'; + $global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh); + + //default: path to ckeditor subdirectory in the ckeditor module directory (starting from the document root) + //e.g. for http://example.com/drupal it will be /drupal/sites/all/modules/ckeditor/ckeditor + $cke_path = base_path() . $mod_path .'/ckeditor'; + + //default: path to ckeditor subdirectory in the ckeditor module directory (relative to index.php) + //e.g.: sites/all/modules/ckeditor/ckeditor + $cke_local_path = $mod_path .'/ckeditor'; + if ($global_profile) { + $gs = $global_profile->settings; + + if (isset($gs['ckeditor_path'])) { + $tmp_path = $gs['ckeditor_path']; + $tmp_path = strtr($tmp_path, array("%b" => base_path(), "%m" => base_path() . $mod_path, "%l" => base_path() . $lib_path)); + $tmp_path = str_replace('\\', '/', $tmp_path); + $tmp_path = str_replace('//', '/', $tmp_path); + $tmp_path = rtrim($tmp_path, ' \/'); + if (substr($tmp_path, 0, 1) != '/') { + $tmp_path = '/'. $tmp_path; //starts with '/' + } + $cke_path = $tmp_path; + + if (empty($gs['ckeditor_local_path'])) { + //fortunately wildcards are used, we can easily get the right server path + if (FALSE !== strpos($gs['ckeditor_path'], "%m")) { + $gs['ckeditor_local_path'] = strtr($gs['ckeditor_path'], array("%m" => $mod_path)); + } + if (FALSE !== strpos($gs['ckeditor_path'], "%b")) { + $gs['ckeditor_local_path'] = strtr($gs['ckeditor_path'], array("%b" => ".")); + } + if (FALSE !== strpos($gs['ckeditor_path'], "%l")) { + $gs['ckeditor_local_path'] = strtr($gs['ckeditor_path'], array("%l" => "sites/all/libraries")); + } + } + } + + //ckeditor_path is defined, but wildcards are not used, we need to try to find out where is + //the document root located and append ckeditor_path to it. + if (!empty($gs['ckeditor_local_path'])) { + $cke_local_path = $gs['ckeditor_local_path']; + } + elseif (!empty($gs['ckeditor_path'])) { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + $local_path = ckeditor_resolve_url( $gs['ckeditor_path'] ."/" ); + if (FALSE !== $local_path) { + $cke_local_path = $local_path; + } + } + } + } + if ($local) { + return $cke_local_path; + } + else { + return $cke_path; + } +} + +/** + * Read the CKEditor plugins path from the Global profile. + * + * @return + * Path to CKEditor plugins folder. + */ +function ckeditor_plugins_path($local = FALSE, $refresh = FALSE) { + static $cke_plugins_path; + static $cke_plugins_local_path; + + if ($refresh || (!$cke_plugins_path)) { + $mod_path = drupal_get_path('module', 'ckeditor'); + $lib_path = 'sites/all/libraries'; + $global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh); + + //default: path to plugins subdirectory in the ckeditor module directory (starting from the document root) + //e.g. for http://example.com/drupal it will be /drupal/sites/all/modules/ckeditor/plugins + $cke_plugins_path = base_path() . $mod_path .'/plugins'; + + //default: path to plugins subdirectory in the ckeditor module directory (relative to index.php) + //e.g.: sites/all/modules/ckeditor/plugins + $cke_plugins_local_path = $mod_path .'/plugins'; + + if ($global_profile) { + $gs = $global_profile->settings; + + if (isset($gs['ckeditor_plugins_path'])) { + $tmp_path = $gs['ckeditor_plugins_path']; + $tmp_path = strtr($tmp_path, array("%b" => base_path(), "%m" => base_path() . $mod_path, "%l" => base_path() . $lib_path)); + $tmp_path = str_replace('\\', '/', $tmp_path); + $tmp_path = str_replace('//', '/', $tmp_path); + $tmp_path = rtrim($tmp_path, ' \/'); + if (substr($tmp_path, 0, 1) != '/') { + $tmp_path = '/'. $tmp_path; //starts with '/' + } + $cke_plugins_path = $tmp_path; + + if (empty($gs['ckeditor_plugins_local_path'])) { + //fortunately wildcards are used, we can easily get the right server path + if (FALSE !== strpos($gs['ckeditor_plugins_path'], "%m")) { + $gs['ckeditor_plugins_local_path'] = strtr($gs['ckeditor_plugins_path'], array("%m" => $mod_path)); + } + if (FALSE !== strpos($gs['ckeditor_plugins_path'], "%b")) { + $gs['ckeditor_plugins_local_path'] = strtr($gs['ckeditor_plugins_path'], array("%b" => ".")); + } + if (FALSE !== strpos($gs['ckeditor_plugins_path'], "%l")) { + $gs['ckeditor_plugins_local_path'] = strtr($gs['ckeditor_plugins_path'], array("%l" => "sites/all/libraries")); + } + } + } + + //ckeditor_plugins_path is defined, but wildcards are not used, we need to try to find out where is + //the document root located and append ckeditor_plugins_path to it. + if (!empty($gs['ckeditor_plugins_local_path']) && !is_null($gs['ckeditor_plugins_local_path'])) { + $cke_plugins_local_path = $gs['ckeditor_plugins_local_path']; + } + elseif (!empty($gs['ckeditor_plugins_path'])) { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + $local_path = ckeditor_resolve_url( $gs['ckeditor_plugins_path'] ."/" ); + if (FALSE !== $local_path) { + $cke_plugins_local_path = $local_path; + } + } + } + } + + if ($local) { + return $cke_plugins_local_path; + } + else { + return $cke_plugins_path; + } +} + +/** + * Read the CKFinder path from the Global profile. + * + * @return + * Path to CKFinder folder. + */ +function ckfinder_path($refresh = FALSE) { + static $ckf_path; + + if ($refresh || (!$ckf_path)) { + $mod_path = drupal_get_path('module', 'ckeditor'); + $lib_path = 'sites/all/libraries'; + $global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh); + + //default: path to ckeditor subdirectory in the ckeditor module directory (starting from the document root) + //e.g. for http://example.com/drupal it will be /drupal/sites/all/modules/ckeditor/ckeditor + $ckf_path = $mod_path . '/ckfinder'; + if ($global_profile) { + $gs = $global_profile->settings; + + if (isset($gs['ckfinder_path'])) { + $tmp_path = $gs['ckfinder_path']; + $tmp_path = strtr($tmp_path, array("%b" => base_path(), "%m" => $mod_path, "%l" => $lib_path)); + $tmp_path = str_replace('\\', '/', $tmp_path); + $tmp_path = str_replace('//', '/', $tmp_path); + $ckf_path = $tmp_path; + } + } + } + + return $ckf_path; +} + +function ckeditor_get_nodetype($get_q) { + static $nodetype; + + if (!isset($nodetype)) { + $menuitem = menu_get_item($get_q); + $nodetype = '*'; + if (!empty($menuitem['page_arguments']) && is_array($menuitem['page_arguments'])) { + foreach ($menuitem['page_arguments'] as $item) { + if (!empty($item->nid) && !empty($item->type)) { + // not 100% valid check if $item is a node + $nodetype = $item->type; + break; + } + } + } + + if ($nodetype == '*') { + $get_q = explode("/", $get_q, 3); + if ($get_q[0] == "node" && !empty($get_q[1]) && $get_q[1] == "add" && !empty($get_q[2])) { + $nodetype = $get_q[2]; + } + } + } + $nodetype = str_replace('-', '_', $nodetype); + return $nodetype; +} + +/** + * Implementation of hook_features_api(). + * + * Allow exporting of CKEditor profiles by the Features module. + */ +function ckeditor_features_api() { + return array( + 'ckeditor_profile' => array( + 'name' => t('CKEditor profiles'), + 'feature_source' => TRUE, + 'default_hook' => 'ckeditor_profile_defaults', + 'default_file' => FEATURES_DEFAULTS_INCLUDED, + 'file' => drupal_get_path('module', 'ckeditor') .'/includes/ckeditor.features.inc', + ) + ); +} + +/** + * Get the language locale code supported by Scayt for the specified language + */ +function _ckeditor_scayt_langcode($lang) { + $scayt_langs = array( + 'en' => 'en_US', + 'es' => 'es_ES', + 'fr' => 'fr_FR', + 'de' => 'de_DE', + 'it' => 'it_IT', + 'el' => 'el_EL', + 'pt' => 'pt_PT', + 'da' => 'da_DA', + 'sv' => 'sv_SE', + 'nl' => 'nl_NL', + 'nb' => 'no_NO', + 'fi' => 'fi_FI', + ); + if (array_key_exists($lang, $scayt_langs)) { + return $scayt_langs[$lang]; + } + + $default = language_default('language'); + if (array_key_exists($default, $scayt_langs)) { + return $scayt_langs[$default]; + } + + return 'en_US'; +} +/* + * Get settings for ckeditor + * Added for support [#1288664] Views + */ +function ckeditor_get_settings() { + global $user; + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + if (empty($_POST['id']) || !isset($_POST['token']) || !drupal_valid_token($_POST['token'], 'ckeditorAjaxCall')) { + echo json_encode(array()); + die(); + } + unset($_SESSION['cke_get_settings']); + $enabled = FALSE; + + $global_profile = ckeditor_profile_load('CKEditor Global Profile'); + if ($global_profile) { + $global_conf = $global_profile->settings; + if ($global_conf) { + $enabled = ckeditor_is_enabled(empty($global_conf['excl_mode']) ? '0' : $global_conf['excl_mode'], empty($global_conf['excl_regex']) ? '' : $global_conf['excl_regex'], $_POST['id'], $_POST['url']); + } + } + if ($enabled) { + $profile = ckeditor_user_get_profile($user, $_POST['#id']); + if ($profile) { + $conf = array(); + $conf = $profile->settings; + $enabled = ckeditor_is_enabled(empty($conf['excl_mode']) ? '0' : $conf['excl_mode'], empty($conf['excl_regex']) ? '' : $conf['excl_regex'], $_POST['id'], $_POST['url']); + } + else { + $enabled = FALSE; + } + } + + if (!$enabled) { + echo json_encode(array()); die(); + } + $element = ckeditor_process_textarea(array('#id' => $_POST['id'])); + if (empty($_SESSION['cke_get_settings'][$_POST['id']])) echo json_encode(array()); + echo json_encode($_SESSION['cke_get_settings'][$_POST['id']]); + die(); +} + diff --git a/sites/all/modules/ckeditor/ckeditor.styles.js b/sites/all/modules/ckeditor/ckeditor.styles.js new file mode 100644 index 0000000..b87d4b0 --- /dev/null +++ b/sites/all/modules/ckeditor/ckeditor.styles.js @@ -0,0 +1,91 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +/* + * This file is used/requested by the 'Styles' button. + * The 'Styles' button is not enabled by default in DrupalFull and DrupalFiltered toolbars. + */ +if(typeof(CKEDITOR) !== 'undefined') { + CKEDITOR.addStylesSet( 'drupal', + [ + /* Block Styles */ + + // These styles are already available in the "Format" drop-down list, so they are + // not needed here by default. You may enable them to avoid placing the + // "Format" drop-down list in the toolbar, maintaining the same features. + /* + { name : 'Paragraph' , element : 'p' }, + { name : 'Heading 1' , element : 'h1' }, + { name : 'Heading 2' , element : 'h2' }, + { name : 'Heading 3' , element : 'h3' }, + { name : 'Heading 4' , element : 'h4' }, + { name : 'Heading 5' , element : 'h5' }, + { name : 'Heading 6' , element : 'h6' }, + { name : 'Preformatted Text', element : 'pre' }, + { name : 'Address' , element : 'address' }, + */ + + { name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } }, + { name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } }, + + /* Inline Styles */ + + // These are core styles available as toolbar buttons. You may opt enabling + // some of them in the "Styles" drop-down list, removing them from the toolbar. + /* + { name : 'Strong' , element : 'strong', overrides : 'b' }, + { name : 'Emphasis' , element : 'em' , overrides : 'i' }, + { name : 'Underline' , element : 'u' }, + { name : 'Strikethrough' , element : 'strike' }, + { name : 'Subscript' , element : 'sub' }, + { name : 'Superscript' , element : 'sup' }, + */ + + { name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } }, + { name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } }, + + { name : 'Big' , element : 'big' }, + { name : 'Small' , element : 'small' }, + { name : 'Typewriter' , element : 'tt' }, + + { name : 'Computer Code' , element : 'code' }, + { name : 'Keyboard Phrase' , element : 'kbd' }, + { name : 'Sample Text' , element : 'samp' }, + { name : 'Variable' , element : 'var' }, + + { name : 'Deleted Text' , element : 'del' }, + { name : 'Inserted Text' , element : 'ins' }, + + { name : 'Cited Work' , element : 'cite' }, + { name : 'Inline Quotation' , element : 'q' }, + + { name : 'Language: RTL' , element : 'span', attributes : { 'dir' : 'rtl' } }, + { name : 'Language: LTR' , element : 'span', attributes : { 'dir' : 'ltr' } }, + + /* Object Styles */ + + { + name : 'Image on Left', + element : 'img', + attributes : + { + 'style' : 'padding: 5px; margin-right: 5px', + 'border' : '2', + 'align' : 'left' + } + }, + + { + name : 'Image on Right', + element : 'img', + attributes : + { + 'style' : 'padding: 5px; margin-left: 5px', + 'border' : '2', + 'align' : 'right' + } + } + ]); +} \ No newline at end of file diff --git a/sites/all/modules/ckeditor/images/buttons/about.png b/sites/all/modules/ckeditor/images/buttons/about.png new file mode 100644 index 0000000..0322c35 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/about.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/anchor.png b/sites/all/modules/ckeditor/images/buttons/anchor.png new file mode 100644 index 0000000..4cca695 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/anchor.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/backgroundColor.png b/sites/all/modules/ckeditor/images/buttons/backgroundColor.png new file mode 100644 index 0000000..40b50a1 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/backgroundColor.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/bidiLeft.png b/sites/all/modules/ckeditor/images/buttons/bidiLeft.png new file mode 100644 index 0000000..f10b360 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/bidiLeft.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/bidiRight.png b/sites/all/modules/ckeditor/images/buttons/bidiRight.png new file mode 100644 index 0000000..ba1ec2e Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/bidiRight.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/blockJustify.png b/sites/all/modules/ckeditor/images/buttons/blockJustify.png new file mode 100644 index 0000000..a3f3a83 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/blockJustify.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/blockQuote.png b/sites/all/modules/ckeditor/images/buttons/blockQuote.png new file mode 100644 index 0000000..c9b71c5 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/blockQuote.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/bold.png b/sites/all/modules/ckeditor/images/buttons/bold.png new file mode 100644 index 0000000..e1094e2 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/bold.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/bulletedList.png b/sites/all/modules/ckeditor/images/buttons/bulletedList.png new file mode 100644 index 0000000..8d0896a Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/bulletedList.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/button.png b/sites/all/modules/ckeditor/images/buttons/button.png new file mode 100644 index 0000000..21484f8 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/button.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/centerJustify.png b/sites/all/modules/ckeditor/images/buttons/centerJustify.png new file mode 100644 index 0000000..b4d9f96 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/centerJustify.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/checkSpelling.png b/sites/all/modules/ckeditor/images/buttons/checkSpelling.png new file mode 100644 index 0000000..8e580c7 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/checkSpelling.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/checkbox.png b/sites/all/modules/ckeditor/images/buttons/checkbox.png new file mode 100644 index 0000000..5592a45 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/checkbox.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/copy.png b/sites/all/modules/ckeditor/images/buttons/copy.png new file mode 100644 index 0000000..fd5bb46 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/copy.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/createDivContainer.png b/sites/all/modules/ckeditor/images/buttons/createDivContainer.png new file mode 100644 index 0000000..5b13638 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/createDivContainer.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/cut.png b/sites/all/modules/ckeditor/images/buttons/cut.png new file mode 100644 index 0000000..24b5d57 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/cut.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/decreaseIndent.png b/sites/all/modules/ckeditor/images/buttons/decreaseIndent.png new file mode 100644 index 0000000..c23a31b Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/decreaseIndent.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/drupalbreak.png b/sites/all/modules/ckeditor/images/buttons/drupalbreak.png new file mode 100644 index 0000000..97dfea4 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/drupalbreak.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/drupalpagebreak.png b/sites/all/modules/ckeditor/images/buttons/drupalpagebreak.png new file mode 100644 index 0000000..ab96d5d Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/drupalpagebreak.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/find.png b/sites/all/modules/ckeditor/images/buttons/find.png new file mode 100644 index 0000000..7244dc2 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/find.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/flash.png b/sites/all/modules/ckeditor/images/buttons/flash.png new file mode 100644 index 0000000..09c0da0 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/flash.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/font.png b/sites/all/modules/ckeditor/images/buttons/font.png new file mode 100644 index 0000000..d8fa5b7 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/font.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/fontSize.png b/sites/all/modules/ckeditor/images/buttons/fontSize.png new file mode 100644 index 0000000..8ad6ce4 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/fontSize.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/form.png b/sites/all/modules/ckeditor/images/buttons/form.png new file mode 100644 index 0000000..35e055b Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/form.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/format.png b/sites/all/modules/ckeditor/images/buttons/format.png new file mode 100644 index 0000000..3d813f6 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/format.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/group.png b/sites/all/modules/ckeditor/images/buttons/group.png new file mode 100644 index 0000000..977e58e Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/group.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/hiddenField.png b/sites/all/modules/ckeditor/images/buttons/hiddenField.png new file mode 100644 index 0000000..4714544 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/hiddenField.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/horizontalLine.png b/sites/all/modules/ckeditor/images/buttons/horizontalLine.png new file mode 100644 index 0000000..2453110 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/horizontalLine.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/icon.png b/sites/all/modules/ckeditor/images/buttons/icon.png new file mode 100644 index 0000000..99606b2 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/icon.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/iframe.png b/sites/all/modules/ckeditor/images/buttons/iframe.png new file mode 100644 index 0000000..89e456c Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/iframe.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/image.png b/sites/all/modules/ckeditor/images/buttons/image.png new file mode 100644 index 0000000..28e09de Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/image.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/imageButton.png b/sites/all/modules/ckeditor/images/buttons/imageButton.png new file mode 100644 index 0000000..0d7d072 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/imageButton.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/increaseIndent.png b/sites/all/modules/ckeditor/images/buttons/increaseIndent.png new file mode 100644 index 0000000..4341b2f Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/increaseIndent.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/index.html b/sites/all/modules/ckeditor/images/buttons/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/sites/all/modules/ckeditor/images/buttons/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sites/all/modules/ckeditor/images/buttons/italic.png b/sites/all/modules/ckeditor/images/buttons/italic.png new file mode 100644 index 0000000..8ada3d1 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/italic.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/leftJustify.png b/sites/all/modules/ckeditor/images/buttons/leftJustify.png new file mode 100644 index 0000000..76aa5b4 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/leftJustify.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/link.png b/sites/all/modules/ckeditor/images/buttons/link.png new file mode 100644 index 0000000..0c2052d Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/link.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/linkit.png b/sites/all/modules/ckeditor/images/buttons/linkit.png new file mode 100644 index 0000000..dd25023 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/linkit.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/linktomenu.gif b/sites/all/modules/ckeditor/images/buttons/linktomenu.gif new file mode 100644 index 0000000..51a908e Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/linktomenu.gif differ diff --git a/sites/all/modules/ckeditor/images/buttons/linktonode.gif b/sites/all/modules/ckeditor/images/buttons/linktonode.gif new file mode 100644 index 0000000..f09db7c Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/linktonode.gif differ diff --git a/sites/all/modules/ckeditor/images/buttons/maximize.png b/sites/all/modules/ckeditor/images/buttons/maximize.png new file mode 100644 index 0000000..8ea2a62 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/maximize.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/newPage.png b/sites/all/modules/ckeditor/images/buttons/newPage.png new file mode 100644 index 0000000..58071d9 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/newPage.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/numberedList.png b/sites/all/modules/ckeditor/images/buttons/numberedList.png new file mode 100644 index 0000000..651395e Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/numberedList.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/pageBreakPrinting.png b/sites/all/modules/ckeditor/images/buttons/pageBreakPrinting.png new file mode 100644 index 0000000..5548558 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/pageBreakPrinting.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/paste.png b/sites/all/modules/ckeditor/images/buttons/paste.png new file mode 100644 index 0000000..3b9c091 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/paste.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/pastePlainText.png b/sites/all/modules/ckeditor/images/buttons/pastePlainText.png new file mode 100644 index 0000000..5a7a4ee Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/pastePlainText.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/pasteWord.png b/sites/all/modules/ckeditor/images/buttons/pasteWord.png new file mode 100644 index 0000000..014b9eb Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/pasteWord.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/preview.png b/sites/all/modules/ckeditor/images/buttons/preview.png new file mode 100644 index 0000000..8a22da1 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/preview.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/print.png b/sites/all/modules/ckeditor/images/buttons/print.png new file mode 100644 index 0000000..07489b3 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/print.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/radioButton.png b/sites/all/modules/ckeditor/images/buttons/radioButton.png new file mode 100644 index 0000000..af40a3d Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/radioButton.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/readmoreButton.png b/sites/all/modules/ckeditor/images/buttons/readmoreButton.png new file mode 100644 index 0000000..76bcf5e Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/readmoreButton.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/redo.png b/sites/all/modules/ckeditor/images/buttons/redo.png new file mode 100644 index 0000000..cc27e1f Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/redo.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/removeFormat.png b/sites/all/modules/ckeditor/images/buttons/removeFormat.png new file mode 100644 index 0000000..ec18656 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/removeFormat.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/replace.png b/sites/all/modules/ckeditor/images/buttons/replace.png new file mode 100644 index 0000000..8263ebb Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/replace.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/rightJustify.png b/sites/all/modules/ckeditor/images/buttons/rightJustify.png new file mode 100644 index 0000000..1987182 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/rightJustify.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/save.png b/sites/all/modules/ckeditor/images/buttons/save.png new file mode 100644 index 0000000..753415b Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/save.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/selectAll.png b/sites/all/modules/ckeditor/images/buttons/selectAll.png new file mode 100644 index 0000000..ed9665a Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/selectAll.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/selectionField.png b/sites/all/modules/ckeditor/images/buttons/selectionField.png new file mode 100644 index 0000000..dd6715b Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/selectionField.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/showBlocks.png b/sites/all/modules/ckeditor/images/buttons/showBlocks.png new file mode 100644 index 0000000..d89520c Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/showBlocks.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/smiley.png b/sites/all/modules/ckeditor/images/buttons/smiley.png new file mode 100644 index 0000000..f9ad72a Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/smiley.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/source.png b/sites/all/modules/ckeditor/images/buttons/source.png new file mode 100644 index 0000000..1c55058 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/source.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/spacer.png b/sites/all/modules/ckeditor/images/buttons/spacer.png new file mode 100644 index 0000000..cca2392 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/spacer.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/specialCharacter.png b/sites/all/modules/ckeditor/images/buttons/specialCharacter.png new file mode 100644 index 0000000..f4a5594 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/specialCharacter.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/strike.png b/sites/all/modules/ckeditor/images/buttons/strike.png new file mode 100644 index 0000000..b295a96 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/strike.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/styles.png b/sites/all/modules/ckeditor/images/buttons/styles.png new file mode 100644 index 0000000..54e1f7b Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/styles.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/subscript.png b/sites/all/modules/ckeditor/images/buttons/subscript.png new file mode 100644 index 0000000..e60bf6c Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/subscript.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/superscript.png b/sites/all/modules/ckeditor/images/buttons/superscript.png new file mode 100644 index 0000000..b5ac6ee Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/superscript.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/table.png b/sites/all/modules/ckeditor/images/buttons/table.png new file mode 100644 index 0000000..d86417d Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/table.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/templates.png b/sites/all/modules/ckeditor/images/buttons/templates.png new file mode 100644 index 0000000..c208cd2 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/templates.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/textColor.png b/sites/all/modules/ckeditor/images/buttons/textColor.png new file mode 100644 index 0000000..006ed64 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/textColor.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/textField.png b/sites/all/modules/ckeditor/images/buttons/textField.png new file mode 100644 index 0000000..f6b412a Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/textField.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/textarea.png b/sites/all/modules/ckeditor/images/buttons/textarea.png new file mode 100644 index 0000000..3b12d4c Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/textarea.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/underline.png b/sites/all/modules/ckeditor/images/buttons/underline.png new file mode 100644 index 0000000..52b93ce Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/underline.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/undo.png b/sites/all/modules/ckeditor/images/buttons/undo.png new file mode 100644 index 0000000..90587f8 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/undo.png differ diff --git a/sites/all/modules/ckeditor/images/buttons/unlink.png b/sites/all/modules/ckeditor/images/buttons/unlink.png new file mode 100644 index 0000000..e8b8fe5 Binary files /dev/null and b/sites/all/modules/ckeditor/images/buttons/unlink.png differ diff --git a/sites/all/modules/ckeditor/includes/ckeditor.admin.inc b/sites/all/modules/ckeditor/includes/ckeditor.admin.inc new file mode 100644 index 0000000..89cd8c4 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/ckeditor.admin.inc @@ -0,0 +1,2325 @@ + '' . $ckconfig_file . '', + '!file' => 'sites/all/libraries/ckeditor/ckeditor.js' + ) + )); + drupal_set_message(t( + 'The CKEditor component is not installed correctly. Please go to the !ckeditorlink in order to download the latest version. After that you must extract the files to the !ckeditorpath or !librarypath directory and make sure that the !ckeditorfile or !ckeditorlibrary file exists. Refer to the !readme file for more information.', + array( + '!ckeditorlink' => l(t('CKEditor homepage'), 'http://ckeditor.com/download'), + '!readme' => l(t('README.txt'), drupal_get_path('module', 'ckeditor') . '/README.txt', array('absolute' => TRUE)), + '!ckeditorpath' => '' . $editor_path . '', + '!ckeditorsubdir' => '' . $editor_path . '/editor', + '!ckeditorfile' => '' . $editor_path . '/ckeditor.js', + '!ckeditorlibrary' => 'sites/all/libraries/ckeditor/ckeditor.js', + '!librarypath' => 'sites/all/libraries/ckeditor' + ) + ), 'error'); + drupal_set_message(t( + 'If you have CKEditor already installed, edit the !editg and update the CKEditor path.', + array( + '!editg' => l(t('CKEditor Global Profile'), 'admin/settings/ckeditor/editg') + ) + ), 'warning'); + return FALSE; + } + + if (module_exists('wysiwyg')) { + drupal_set_message(t( + 'The WYSIWYG module was detected. Using both modules at the same time may cause problems. It is recommended to turn the WYSIWYG module off (!wysiwygdisablelink").', + array( + '!wysiwygdisablelink' => l(t('click here to disable'), 'ckeditor/disable/wysiwyg/' . drupal_get_token('ckeditorDisableWysiwyg')) + ) + ), 'warning'); + } + + $access_ckeditor_roles = user_roles(FALSE, 'access ckeditor'); + if (!$access_ckeditor_roles) { + drupal_set_message(t( + 'There is currently no role with the "access ckeditor" permission. Visit the !acl administration section.', + array( + '!acl' => l(t('Permissions'), 'admin/user/permissions') + ) + ), 'warning'); + } + else { + $result = db_query_range("SELECT name FROM {ckeditor_settings} WHERE name<>'CKEditor Global Profile'", 0, 1); + $has_profiles = FALSE; + //find profile other than Global + if (($obj = db_fetch_object($result))) { + $has_profiles = TRUE; + } + + //find roles with profiles + $result = db_query("SELECT rid FROM {ckeditor_role}"); + $rids = array(); + while (($obj = db_fetch_object($result))) { + $rids[] = $obj->rid; + } + $rids = array_unique($rids); + if (!$has_profiles) { + drupal_set_message(t('No CKEditor profiles found. Right now nobody is able to use CKEditor. Create a new profile below.'), 'error'); + } + else { + //not all roles with access ckeditor has their CKEditor profile assigned + $diff = array_diff(array_keys($access_ckeditor_roles), $rids); + if ($diff) { + $list = "
    "; + foreach ($diff as $rid) { + $list .= "
  • ". $access_ckeditor_roles[$rid] ."
  • "; + } + $list .= "
"; + drupal_set_message(t( + 'Not all roles with the "!access" permission are associated with CKEditor profiles. As a result, users with the following roles may be unable to use CKEditor: !list Create new or edit existing CKEditor profiles below and check the "Roles allowed to use this profile" option in the Basic setup section.', + array( + '!access' => l(t('access ckeditor'), 'admin/user/permissions'), + '!list' => $list + ) + ), 'warning'); + } + } + } + + return ckeditor_profile_overview(); +} + +/** + * Controller for CKEditor profiles. + */ +function ckeditor_profile_overview() { + $output = ''; + + $profiles = ckeditor_profile_load(); + if ($profiles) { + $access_ckeditor_roles = user_roles(FALSE, 'access ckeditor'); + $header = array(t('Profile'), t('Roles'), t('Operations')); + $skins = ckeditor_load_skin_options(); + $plugins = ckeditor_load_plugins(); + $disabled_plugins = array(); + foreach ($profiles as $p) { + $rids = $p->rids; + if ($p->name !== "CKEditor Global Profile") { + if (isset($p->settings['loadPlugins']) && is_array($p->settings['loadPlugins']) && count($p->settings['loadPlugins']) > 0) { + $changed = FALSE; + foreach ($p->settings['loadPlugins'] as $plugin_name => $plugin_settings) { + if (!array_key_exists($plugin_name, $plugins)) { + if (isset($plugin_settings['active']) && $plugin_settings['active'] == 0) { + continue; + } + if (!isset($disabled_plugins[$p->name])) { + $disabled_plugins[$p->name] = array(); + } + $p->settings['loadPlugins'][$plugin_name]['active'] = 0; + $disabled_plugins[$p->name][] = $plugin_name; + $changed = TRUE; + } + } + if ($changed === TRUE) { + db_query("UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", serialize($p->settings), $p->name); + } + } + foreach (array_keys($p->rids) as $rid) { + if (!isset($access_ckeditor_roles[$rid])) { + unset($rids[$rid]); + } + } + if (isset($p->settings['skin']) && !array_key_exists($p->settings['skin'], $skins)) { + drupal_set_message(t( + 'The `!profile` profile is using `!skin` skin which cannot be found. Please !profile_settings.', array( + '!profile' => $p->name, + '!skin' => $p->settings['skin'], + '!profile_settings' => l(t('update your settings'), 'admin/settings/ckeditor/edit/' . urlencode($p->name)) + ) + ), 'warning'); + } + $rows[] = array( + array('data' => $p->name, 'valign' => 'top'), + array('data' => implode("
\n", $rids)), + array( + 'data' => + l(t('edit'), 'admin/settings/ckeditor/edit/'. urlencode($p->name)) .' '. + l(t('clone'), 'admin/settings/ckeditor/clone/'. urlencode($p->name)) .' '. + l(t('delete'), 'admin/settings/ckeditor/delete/'. urlencode($p->name)), + 'valign' => 'top' + ) + ); + } + } + + if (count($disabled_plugins) > 0) { + $msg = t("The following plugins could not be found and were automatically disabled in CKEditor profiles:"); + foreach ($disabled_plugins as $profile_name => $profile_plugins) { + $msg .= "

"; + $msg .= t("Profile: %profile_name", array("%profile_name" => $profile_name)); + $msg .= "
"; + $msg .= t("Plugins: %profile_plugins", array("%profile_plugins" => implode(', ', $profile_plugins))); + } + drupal_set_message($msg, 'warning'); + } + + $output .= '

' . t('Profiles') .'

'; + $output .= theme('table', $header, $rows); + $output .= '

' . l(t('Create a new profile'), 'admin/settings/ckeditor/add') . '

'; + } + else { + drupal_set_message(t( + 'No profiles found. Click here to !create.', + array( + '!create' => l(t('create a new profile'), 'admin/settings/ckeditor/add') + ) + )); + } + + $rows = array(); + if (!isset($profiles['CKEditor Global Profile'])) { + drupal_set_message(t( + 'The global profile can not be found. Click here to !create.', + array( + '!create' => l(t('create the global profile'), 'admin/settings/ckeditor/addg') + ) + )); + } + else { + $output .= "

" . t("Global settings") ."

"; + $rows[] = array( + array('data' => t('CKEditor Global Profile'), 'valign' => 'top'), + array( + 'data' => + l(t('edit'), 'admin/settings/ckeditor/editg') . " " . + l(t('delete'), 'admin/settings/ckeditor/delete/CKEditor Global Profile'), + 'valign' => 'top' + ) + ); + $output .= theme('table', array(t('Profile'), t('Operations')), $rows); + } + return $output; +} + +/** + * Clone profile + */ +function ckeditor_admin_profile_clone_form($form_state, $oldprofile) { + return ckeditor_admin_profile_form($form_state, $oldprofile); +} + +function ckeditor_admin_profile_clone_form_validate($form_state, $oldprofile) { + ckeditor_admin_profile_form_validate($form_state, $oldprofile); +} + +function ckeditor_admin_profile_clone_form_submit($form, &$form_state) { + $edit =& $form_state['values']; + drupal_set_message(t('Your CKEditor profile was created.')); + $settings = ckeditor_admin_values_to_settings($edit); + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], $settings); + ckeditor_rebuild_selectors($edit['name']); + if (!empty($edit['rids'])) { + foreach (array_keys($edit['rids']) as $rid) { + if ($edit['rids'][$rid]!=0) { + db_query("INSERT INTO {ckeditor_role} (name, rid) VALUES ('%s', %d)", $edit['name'], $rid); + } + } + } + $form_state['redirect'] = 'admin/settings/ckeditor'; +} + +/** + * Form builder for a normal profile + */ +function ckeditor_admin_profile_form($form_state, $profile = NULL) { + global $theme; + if ($profile != NULL) { + $form['_profile'] = array( + '#type' => 'value', + '#value' => $profile, + ); + } + else { + $profile = new stdClass(); + } + + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + + drupal_add_js(array('ckeditor_version' => ckeditor_get_version()), 'setting'); + + $skin_options = ckeditor_load_skin_options(); + $lang_options = ckeditor_load_lang_options(); + + // Only display the roles that currently don't have a ckeditor profile. One + // profile per role. + $orig_roles = user_roles(FALSE, 'access ckeditor'); + $roles = $orig_roles; + + if (!empty($profile->rids) && !user_roles(FALSE, 'access ckeditor')) { + drupal_set_message(t( + 'You have not assigned the "access ckeditor" !permissions yet. It is recommended to assign the "access ckeditor" !permissions before updating CKEditor profiles.', + array( + '!permissions' => l(t('permissions'), 'admin/user/permissions') + ) + ), 'warning'); + } + + if (empty($profile->name)) { + $result = db_query("SELECT DISTINCT(rid) FROM {ckeditor_role}"); + while (($data = db_fetch_object($result))) { + if ((empty($profile->rids) || !in_array($data->rid, array_keys((array) $profile->rids))) && !form_get_errors()) { + unset($roles[$data->rid]); + } + } + if (count($orig_roles) != count($roles)) { + drupal_set_message(t('Not all user roles are shown since they already have CKEditor profiles assigned. You must first remove the assignment of profiles in order to add them to a new one.')); + } + } + + $form['basic'] = array( + '#type' => 'fieldset', + '#title' => t('Basic setup'), + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + + + switch (arg(3)) { + case 'clone': + //load all profiles to check their names + $profiles = ckeditor_profile_load(); + $oldname = $profile->name; + $maxsize=128; //default max name length + + $res=array(); + $pat = "/^(.*?)_([0-9]+)$/"; + if (preg_match($pat, $oldname, $res)) { // oldname like 'name_nr' + $name=$res[1]; + $num=$res[2]+1; + } + else{ + $name=$oldname; + $num=2; + } + + $newname=substr($name, 0, $maxsize-3) .'_'. $num; // +limit + while (isset($profiles[$newname])) { //find next free number + $num++; + $newname=substr($name, 0, $maxsize-3) .'_'. $num; + } + //dont clone rids + $profile->settings['rids']=array(); + $profile->rids=array(); + break; + case 'edit': + $newname = $profile->name; + break; + } + + $global_profile = ckeditor_profile_load("CKEditor Global Profile"); + $toolbar_wizard = !empty($global_profile->settings['toolbar_wizard']) ? $global_profile->settings['toolbar_wizard'] : 't'; + drupal_add_js(array('ckeditor_toolbar_wizard' => $toolbar_wizard), 'setting'); + + $form['basic']['name'] = array( + '#type' => 'textfield', + '#title' => t('Profile name'), + '#default_value' => !empty($profile->name) ? $newname : '', + '#size' => 40, + '#maxlength' => 128, + '#description' => t('Enter a name for this profile. This name is only visible within the CKEditor administration page.'), + '#required' => TRUE + ); + + $form['basic']['rids'] = array( + '#type' => 'checkboxes', + '#title' => t('Roles allowed to use this profile'), + '#default_value' => !empty($profile->rids) ? array_keys((array) $profile->rids) : array(), + '#options' => $roles, + '#description' => t( + 'Only roles with the "access ckeditor" permission will be shown here. If no role is available, make sure that you have assigned the "access ckeditor" permission.', + array( + '!permission' => l(t('permission'), 'admin/user/permissions') + ) + ), + '#required' => TRUE + ); + + $form['basic']['allow_user_conf'] = array( + '#type' => 'radios', + '#title' => t('Allow users to customize CKEditor appearance'), + '#default_value' => !empty($profile->settings['allow_user_conf']) ? $profile->settings['allow_user_conf'] : 'f', + '#options' => array( + 'f' => t('No'), + 't' => t('Yes') + ), + '#description' => t('If allowed, users will be able to override the "Editor appearance" by visiting their profile page.'), + ); + + $form['security'] = array( + '#type' => 'fieldset', + '#title' => t('Security'), + '#description' => '

'. t('The CKEditor security system protects you from executing malicious code that is already in your database. In plain textareas database content is harmless because it is not executed, but the CKEditor WYSIWYG editor interprets HTML like a web browser and thus the content needs to be filtered before it is loaded.') .'

', + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + + $all = filter_list_all(); + + $form['security']['filters'] = array( + '#type' => 'fieldset', + '#title' => t('Security filters'), + '#description' => t('Please choose all filters that protect your content (probably not all filters listed below are security filters).'), + '#tree' => TRUE, + ); + + //don't bother administrator with filters that definitely are not security filters + $modules_with_filters_to_skip = array('amazon_filter', 'asy', 'bbcode', 'biblio', 'blockquote', 'bookpost', 'chessboard', 'citation_filter', 'codefilter', 'collapse_text', 'contextlinks', 'coolfilter', 'dialectic', 'dript', 'dme', 'drutex', 'embedfilter', 'ext_link_page', 'extlink', 'elf', 'flickr', 'flickrstickr', 'footnotes', 'formdefaults', 'freelinking', 'gallery', 'geogebra', 'geshifilter', 'gotwo', 'googtube', 'gotcha', 'gtspam', 'hidden_content', 'img_assist', 'image_filter', 'imagebrowser', 'inlinetags', 'insert_view', 'insertframe', 'insertnode', 'interwiki', 'jlightbox', 'jsmath', 'language_sections', 'link_node', 'lootz', 'markdown', 'marksmarty', 'mobile_codes', 'mykml', 'nofollowlist', 'oagwt', 'paging', 'pathfilter', 'pearwiki_filter', 'php', 'pirate', 'reptag', 'scrippet', 'scripturefilter', 'signwriter', 'slideshowpro', 'smartlinebreakconverter', 'smartypants', 'smileys', 'spamspan', 'spam_tokens', 'spoiler', 'table_altrow', 'tablemanager', 'tableofcontents', 'textile', 'tooltips', 'twikifilter', 'typogrify', 'unwrap', 'urlclass', 'urlicon', 'url_replace_filter', 'username_highlighter', 'video_filter', 'quote'); + + if (!isset($profile->settings['ss'])) { + $profile->settings['filters']['filter/0'] = 1; + } + + foreach ($all as $id => $filter) { + if (in_array(strtolower($filter->module), $modules_with_filters_to_skip)) { + continue; + } + //skip line break converter and email -> link + if ($filter->module == 'filter' && in_array($filter->delta, array(1, 2))) { + continue; + } + $form['security']['filters'][$id] = array( + '#type' => 'checkbox', + '#title' => check_plain($filter->name), + '#default_value' => !empty($profile->settings['filters'][$id]), + '#description' => check_plain(module_invoke($filter->module, 'filter', 'description', $filter->delta)), + ); + } + + $form['security']['ss'] = array( + '#type' => 'radios', + '#title' => t('Security settings'), + '#default_value' => isset($profile->settings['ss']) ? $profile->settings['ss'] : '2', + '#options' => array( + '2' => t('Always run security filters for CKEditor.'), + '1' => t('Run security filters only when CKEditor is set to start automatically.'), + ), + '#description' => t('There are two ways of starting CKEditor: automatically and manually (via toggle or in a popup). If you decide to apply security filters only when CKEditor starts automatically, you will not be protected when toggling manually from plain textarea to CKEditor or when using CKEditor in the popup mode. Choose this option only if you can detect various attacks (mainly XSS) by yourself just by looking at the HTML code.'), + ); + + $form['ckeditor_exclude_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Visibility settings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('The following settings are combined with the visibility settings of the global profile.'), + ); + + $form['ckeditor_exclude_settings']['min_rows'] = array( + '#type' => 'textfield', + '#title' => t('Minimum rows'), + '#default_value' => !empty($profile->settings['min_rows']) ? $profile->settings['min_rows'] : '1', + '#description' => t("CKEditor will be triggered if the textarea has more rows than the number given here. Enter '1' if you do not want to use this feature."), + ); + + $form['ckeditor_exclude_settings']['excl_mode'] = array( + '#type' => 'radios', + '#title' => t('Use inclusion or exclusion mode'), + '#default_value' => (empty($profile->settings['excl_mode']) || in_array($profile->settings['excl_mode'], array(0, 2))) ? 0 : 1, + '#options' => array( + '0' => t('Exclude'), + '1' => t('Include') + ), + '#description' => t('Choose the way of disabling/enabling CKEditor on selected fields/paths (see below). Use Exclude to disable CKEditor on selected fields/paths. Use Include if you want to load CKEditor only on selected paths/fields.'), + ); + + /** + * get excluded fields - so we can have normal textareas too + * split the phrase by any number of commas or space characters, + * which include " ", \r, \t, \n and \f + */ + $form['ckeditor_exclude_settings']['excl'] = array( + '#type' => 'textarea', + '#title' => t('Fields to exclude/include'), + '#cols' => 60, + '#rows' => 5, + '#prefix' => '
', + '#suffix' => '
', + '#default_value' => !empty($profile->settings['excl']) ? $profile->settings['excl'] : '', + '#description' => t('Enter the paths to the textarea fields for which you want to enable or disable CKEditor.') . + ' ' . + t('See the !helppagelink for more information about defining field names. Short instruction is available below.', + array( + '!helppagelink' => l(t('Help page'), 'admin/help/ckeditor', array('fragment' => 'fieldinclexcl')) + ) + ) . + '
  • ' . + t('Path structure: theme_name:content_type@path.element_id') . + '
  • ' . + t('The following wildcards are available: "*", "?".') . + '
  • ' . + t('Content type and theme name is optional. You may even just specify the path or the field ID.') . + '
  • ' . + t('Examples:') . + '
    • garland:blog@*.edit-body - ' . + t('matches all fields of type blog called edit-body in the garland theme, on any page.') . + '
    • node/add/*.edit-user-* - ' . + t('matches fields starting with edit-user- on pages starting with node/add/') . + '
', + '#wysiwyg' => FALSE, + ); + + $form['ckeditor_exclude_settings']['simple_incl'] = array( + '#type' => 'textarea', + '#title' => t('Force simplified toolbar on the following fields'), + '#cols' => 60, + '#rows' => 5, + '#default_value' => !empty($profile->settings['simple_incl']) ? $profile->settings['simple_incl'] : '', + '#description' => t('Enter the paths to the textarea fields for which you want to force the simplified toolbar.') . + ' ' . + t( + 'Please see the !helppagelink for more information about defining field names. Take a look at the exclusion settings (above) for a short instruction.', + array( + '!helppagelink' => l(t('Help page'), 'admin/help/ckeditor', array('fragment' => 'fieldinclexcl')) + ) + ), + '#wysiwyg' => FALSE, + ); + + $form['appearance'] = array( + '#type' => 'fieldset', + '#title' => t('Editor appearance'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $form['appearance']['default'] = array( + '#type' => 'radios', + '#title' => t('Default state'), + '#default_value' => !empty($profile->settings['default']) ? $profile->settings['default'] : 't', + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled') + ), + '#description' => t('Default editor state. If disabled, the rich text editor may still be enabled by using toggle or popup window.'), + ); + + $form['appearance']['show_toggle'] = array( + '#type' => 'radios', + '#title' => t('Show the disable/enable rich text editor toggle'), + '#default_value' => !empty($profile->settings['show_toggle']) ? $profile->settings['show_toggle'] : 't', + '#options' => array( + 't' => t('Show'), + 'f' => t('Hide') + ), + '#description' => t('Whether or not to show the disable/enable rich text editor toggle below the textarea. Works only if CKEditor is not running in a popup window (see below).'), + ); + + $form['appearance']['popup'] = array( + '#type' => 'radios', + '#title' => t('Use CKEditor in a popup window'), + '#default_value' => !empty($profile->settings['popup']) ? $profile->settings['popup'] : 'f', + '#options' => array( + 'f' => t('No'), + 't' => t('Yes') + ), + '#description' => t('If this option is enabled, a link to a popup window will be used instead of a textarea replace.'), + ); + + //if skin is not set or not exists select default skin (moono or skin) or first on the skin list + if (empty($profile->settings['skin']) || (!empty($profile->settings['skin']) && !array_key_exists($profile->settings['skin'], $skin_options))) { + if (count($skin_options) > 0) { + if (array_key_exists('moono', $skin_options)) { + $profile->settings['skin'] = 'moono'; + } + else if (array_key_exists('kama', $skin_options)) { + $profile->settings['skin'] = 'kama'; + } + else { + $profile->settings['skin'] = $skin_options[0]; + } + } + } + $form['appearance']['skin'] = array( + '#type' => 'select', + '#title' => t('Skin'), + '#default_value' => !empty($profile->settings['skin']) ? $profile->settings['skin'] : 'default', + '#options' => $skin_options, + '#description' => t('Choose a CKEditor skin.'), + ); + + $ui_colors = array( + "default" => t('CKEditor default'), + "custom" => t('Select manually') + ); + if (function_exists('color_get_palette')) { + // apparently $theme is not initialized (?) + if (empty($theme)) { + init_theme(); + } + $palette = @color_get_palette($theme, FALSE); //[#652274] + $color_palette['default'] = '#D3D3D3'; + if (!empty($palette)) { + if (!empty($palette['base'])) { + $color_palette['color_base'] = $palette['base']; + $ui_colors["color_base"] = t('Color module: base'); + } + if (!empty($palette['top'])) { + $color_palette['color_top'] = $palette['top']; + $ui_colors["color_top"] = t('Color module: top'); + } + if (!empty($palette['bottom'])) { + $color_palette['color_bottom'] = $palette['bottom']; + $ui_colors["color_bottom"] = t('Color module: bottom'); + } + } + drupal_add_js(array('ckeditor_uicolor' => $color_palette), 'setting'); + } + + $editor_path = ckeditor_path(FALSE); + $module_drupal_path = drupal_get_path('module', 'ckeditor'); + + drupal_set_html_head(''); + drupal_set_html_head(''); + drupal_add_js($module_drupal_path . '/ckeditor.config.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/ckeditor.admin.js', 'file'); + + if ($toolbar_wizard == 't') { + if (module_exists('jquery_ui')) { + if (!module_exists('jquery_update') || jquery_update_get_version() <= 1.2 ) + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-1.4.4.min.js', 'core'); + if (jquery_ui_get_version() > 1.6) { + jquery_ui_add(array('ui.sortable')); + } + else { + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-ui.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.widget.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.sortable.min.js', 'file'); + } + } + else { + if (!module_exists('jquery_update') || jquery_update_get_version() <= 1.2 ) + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-1.4.4.min.js', 'core'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-ui.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.widget.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.sortable.min.js', 'file'); + } + drupal_add_js($module_drupal_path . '/includes/jqueryUI/sort.js', 'file'); + } + + $form['appearance']['uicolor'] = array( + '#type' => 'select', + '#title' => t('User interface color'), + '#default_value' => !empty($profile->settings['uicolor']) ? $profile->settings['uicolor'] : 'default', + '#options' => $ui_colors, + ); + $skinframe_url = url('admin/settings/ckeditor/skinframe', array( + 'query' => array( + 'token' => drupal_get_token('ckeditorSkinframeCall'), + 'skin' => 'kama', + 'uicolor' => (!empty($profile->settings['uicolor_user']) && $profile->settings['uicolor'] == 'custom') ? ltrim($profile->settings['uicolor_user'], '#') : 'D3D3D3' + ) + )); + $form['appearance']['skinframe'] = array( + '#type' => 'markup', + '#value' => '
', + '#description' => '' + ); + $form['appearance']['uicolor_user'] = array( + '#type' => 'hidden', + '#default_value' => !empty($profile->settings['uicolor_user']) ? $profile->settings['uicolor_user'] : 'default', + ); + + $form['appearance']['toolbar'] = array( + '#type' => 'textarea', + '#title' => t('Toolbar'), + '#default_value' => !empty($profile->settings['toolbar']) ? $profile->settings['toolbar'] : '', + '#description' => t('Load sample toolbar: Basic | Advanced | Full'), + '#wysiwyg' => FALSE, + '#rows' => 15 + ); + + if ($toolbar_wizard == 't') { + $form['appearance']['toolbar_wizzard_used'] = array( + '#type' => 'markup', + '#value' => '
' . t('Used buttons') . '

', + '#description' => t('Currently used buttons'), + ); + + drupal_add_js(array('cke_toolbar_buttons_all' => ckeditor_toolbar_buttons_all()), 'setting'); + + $form['appearance']['toolbar_wizzard_all'] = array( + '#type' => 'markup', + '#value' => '
' . t('All buttons') . '

', + '#description' => t('All available buttons'), + ); + } + + $plugin_list = ckeditor_load_plugins(); + $plugins = array(); + if (isset($profile->settings['loadPlugins'])) { + foreach ($plugin_list AS $key => $val) { + $plugins[$key] = $val['desc']; + } + } + else { + $default_plugins = array(); + foreach ($plugin_list AS $key => $val) { + $plugins[$key] = $val['desc']; + if (isset($val['default']) && $val['default'] == 't') { + $default_plugins[] = $key; + } + } + } + + $form['appearance']['loadPlugins'] = array( + '#type' => 'checkboxes', + '#title' => t('Plugins'), + '#default_value' => isset($profile->settings['loadPlugins']) ? array_keys((array) $profile->settings['loadPlugins']) : $default_plugins, + '#options' => $plugins, + '#description' => t('Choose the plugins that you want to enable in CKEditor.') + ); + + $form['appearance']['expand'] = array( + '#type' => 'radios', + '#title' => t('Toolbar state on startup'), + '#default_value' => !empty($profile->settings['expand']) ? $profile->settings['expand'] : 't', + '#options' => array( + 't' => t('Expanded'), + 'f' => t('Collapsed') + ), + '#description' => t('The toolbar will start in an expanded or collapsed state.'), + ); + + if (file_exists(ckeditor_path(TRUE) . '/plugins/divarea/plugin.js')) { + $form['appearance']['use_divarea'] = array( + '#type' => 'radios', + '#title' => t('"Div-based" editor'), + '#default_value' => !empty($profile->settings['use_divarea']) ? $profile->settings['use_divarea'] : 'f', + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled') + ), + '#description' => t("Loading editor into div instead of iframe.") + ); + } + + $form['appearance']['width'] = array( + '#type' => 'textfield', + '#title' => t('Editor width'), + '#default_value' => !empty($profile->settings['width']) ? $profile->settings['width'] : '100%', + '#description' => t("Editor interface width in pixels or percent. Examples: 400, 100%."), + '#size' => 40, + '#maxlength' => 128, + ); + + $form['appearance']['lang'] = array( + '#type' => 'select', + '#title' => t('Language'), + '#default_value' => !empty($profile->settings['lang']) ? $profile->settings['lang'] : 'en', + '#options' => $lang_options, + '#description' => t('The language for the CKEditor user interface.') + ); + + $form['appearance']['auto_lang'] = array( + '#type' => 'radios', + '#title' => t('Auto-detect language'), + '#default_value' => !empty($profile->settings['auto_lang']) ? $profile->settings['auto_lang'] : 't', + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled') + ), + '#description' => t('Automatically detect the user language.') + ); + + $form['appearance']['language_direction'] = array( + '#type' => 'select', + '#title' => t('Language direction'), + '#default_value' => !empty($profile->settings['language_direction']) ? $profile->settings['language_direction'] : 'default', + '#options' => array( + 'default' => t('Get from current locale (default)'), + 'ltr' => t('Left-To-Right'),// language like English + 'rtl' => t('Right-To-Left') // languages like Arabic + ), + '#description' => t( + 'Choose the language direction used in the editing area. Even when CKEditor automatically detects the user language and adjusts its user interface, the editing area is not automatically changed into the LTR or RTL mode. To be able to type LTR (like English) and RTL (like Arabic, Hebrew, Persian) content at the same time, please make sure that the !bidiltr and !bidirtl buttons are enabled in the toolbar.', + array( + '!bidiltr' => 'BidiLtr', + '!bidirtl' => 'BidiRtl' + ) + ) + ); + + $form['acf'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced content filter'), + '#description' => t('Configure input data filtering in CKEditor. See !link for more information about ACF.', array( + '!link' => l(t('this blog post'), 'http://ckeditor.com/blog/Upgrading-to-CKEditor-4.1') + )), + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + + $form['acf']['allowed_content'] = array( + '#type' => 'radios', + '#title' => t('Advanced content filter'), + '#description' => t('Enabled: CKEditor will only allow tags/attributes/styles provided by CKEditor features. Disallowed content will be removed directly by CKEditor. When configured properly, it helps to ensure a true WYSIWYG experience.').'
'.'
'. + t('Disabled: CKEditor will not filter any tags and as a result, the user will be able to insert any content into the editor. The content will only be filtered by server-side filters associated with input formats.').'
'.'
'. + t('Example: if only Bold and Link buttons are enabled, only !strong and !a tags will be allowed. Any !b tags will automatically be converted into !strong. The !img tag will not be allowed, unless the Image button is added to the toolbar.', array( + '!strong' => '<strong>', + '!a' => '<a>', + '!img' => '<img>', + '!b' => '<b>' + )).'

'. + t('Warning: CKEditor will not use the set of tags associated with text format. Only the buttons enabled in the toolbar and optional plugins will determine which tags/attributes/styles are handled by CKEditor. Enabling ACF in CKEditor does not affect server-side filtering done by Drupal in any way.'), + + '#default_value' => !empty($profile->settings['allowed_content']) ? $profile->settings['allowed_content'] : 't', + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled'), + ), + ); + + $form['acf']['extraAllowedContent'] = array( + '#type' => 'textarea', + '#title' => t('Extra allowed content'), + '#default_value' => !empty($profile->settings['extraAllowedContent']) ? $profile->settings['extraAllowedContent'] : "", + '#cols' => 60, + '#rows' => 5, + '#description' => t( + 'Set additional allowed content rules for CKEditor. Separate rules with a semicolon. See !docs for more information.', array( + '!docs' => l(t('CKEditor documentation'), 'http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent') + )).'

'. + t('Example: !rules', array( + '!rules' => "object[width,height];param[name,value];embed[*];" + )).'

', + '#wysiwyg' => FALSE, + ); + + $form['output'] = array( + '#type' => 'fieldset', + '#title' => t('Cleanup and output'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $form['output']['enter_mode'] = array( + '#type' => 'select', + '#title' => t('Enter mode'), + '#default_value' => !empty($profile->settings['enter_mode']) ? $profile->settings['enter_mode'] : 'p', + '#options' => array( + 'p' => '

', + 'br' => '
', + 'div' => '

' + ), + '#description' => t('Set which tag should be used by CKEditor when the Enter key is pressed.') + ); + + $form['output']['shift_enter_mode'] = array( + '#type' => 'select', + '#title' => t('Shift+Enter mode'), + '#default_value' => !empty($profile->settings['shift_enter_mode']) ? $profile->settings['shift_enter_mode'] : 'br', + '#options' => array( + 'p' => '

', + 'br' => '
', + 'div' => '

' + ), + '#description' => t('Set which tag should be used by CKEditor when the Shift+Enter key combination is pressed.') + ); + + $form['output']['font_format'] = array( + '#type' => 'textfield', + '#title' => t('Font formats'), + '#default_value' => !empty($profile->settings['font_format']) ? $profile->settings['font_format'] : 'p;div;pre;address;h1;h2;h3;h4;h5;h6', + '#size' => 40, + '#maxlength' => 250, + '#description' => t( + 'Semicolon-separated list of HTML font formats. Allowed values are: !allowed_values', + array( + '!allowed_values' => 'p;div;pre;address;h1;h2;h3;h4;h5;h6' + ) + ) + ); + + if (!empty($profile->settings['formatting']['custom_formatting_options'])) + foreach ($profile->settings['formatting']['custom_formatting_options'] as $k => $v) { + if ($v === 0) { + unset($profile->settings['formatting']['custom_formatting_options'][$k]); + } + } + + $form['output']['custom_formatting'] = array( + '#type' => 'radios', + '#title' => t('Use custom formatting options'), + '#default_value' => !empty($profile->settings['custom_formatting']) ? $profile->settings['custom_formatting'] : 'f', + '#options' => array( + 't' => t('Yes'), + 'f' => t('No'), + ), + ); + + $form['output']['formatting'] = array( + '#type' => 'fieldset', + '#title' => t('Custom formatting options'), + '#tree' => TRUE, + ); + + $form['output']['formatting']['custom_formatting_options'] = array( + '#type' => 'checkboxes', + '#default_value' => isset($profile->settings['formatting']['custom_formatting_options']) ? array_keys((array) $profile->settings['formatting']['custom_formatting_options']) : array('indent' => 'indent', 'breakBeforeOpen' => 'breakBeforeOpen', 'breakAfterOpen' => 'breakAfterOpen', 'breakAfterClose' => 'breakAfterClose'), + '#options' => array( + 'indent' => t('Indent the element contents.'), + 'breakBeforeOpen' => t('Break line before the opening tag.'), + 'breakAfterOpen' => t('Break line after the opening tag.'), + 'breakBeforeClose' => t('Break line before the closing tag.'), + 'breakAfterClose' => t('Break line after the closing tag.'), + 'pre_indent' => t('Indent the <pre> element contents.'), + ), + ); + + $form['css'] = array( + '#type' => 'fieldset', + '#title' => t('CSS'), + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + + $form['css']['css_mode'] = array( + '#type' => 'select', + '#title' => t('Editor CSS'), + '#default_value' => !empty($profile->settings['css_mode']) ? $profile->settings['css_mode'] : 'theme', + '#options' => array( + 'theme' => t('Use theme CSS'), + 'self' => t('Define CSS'), + 'none' => t('CKEditor default') + ), + '#description' => t( + 'Defines the CSS to be used in the editor area.!title_theme_css – load the !style_css file from the current site theme.!title_define_css – enter the CSS file path below.!title_ckeditor_default – use the default editor CSS.', + array( + '!title_theme_css' => '
' . t('Use theme CSS') . '', + '!title_define_css' => '
' . t('Define CSS') . '', + '!title_ckeditor_default' => '
' . t('CKEditor default') . '', + '!style_css' => 'style.css' + ) + ) + ); + + $form['css']['css_path'] = array( + '#type' => 'textfield', + '#title' => t('CSS file path'), + '#default_value' => !empty($profile->settings['css_path']) ? $profile->settings['css_path'] : "", + '#size' => 40, + '#maxlength' => 255, + '#description' => t( + 'Enter the path to the CSS file (Example: !example1) or a list of CSS files separated with a comma (Example: !example2). Make sure you select the Define CSS option above.', + array( + '!example1' => '"css/editor.css"', + '!example2' => '"/themes/garland/style.css,http://example.com/style.css"', + )) . + '
' . + t( + 'Available placeholders:!h - host name (!host).!t - path to theme (!theme).', + array( + '!h' => '
%h', + '!t' => '
%t', + '!host' => base_path(), + '!theme' => base_path() . path_to_theme() .'/' + ) + ) + ); + + $form['css']['css_style'] = array( + '#type' => 'select', + '#title' => t('Predefined styles'), + '#default_value' => !empty($profile->settings['css_style']) ? $profile->settings['css_style'] : 'theme', + '#options' => array( + 'theme' => t('Use theme ckeditor.styles.js'), + 'self' => t('Define path to ckeditor.styles.js'), + 'default' => t('CKEditor default') + ), + '#description' => t( + 'Define the location of the !ckeditor_styles_js_file file. It is used by the Style drop-down list available in the default toolbar. Copy the !ckeditor_styles_js_path file into your theme directory (!theme) and adjust it to your needs.', + array( + '!ckeditor_styles_js_file' => 'ckeditor.styles.js', + '!ckeditor_styles_js_path' => '' . ckeditor_path(TRUE) .'/ckeditor.styles.js', + '!theme' => '' . path_to_theme() . '/ckeditor.styles.js' + ) + ) + ); + + $form['css']['styles_path'] = array( + '#type' => 'textfield', + '#title' => t('Predefined styles path'), + '#default_value' => !empty($profile->settings['styles_path']) ? $profile->settings['styles_path'] : "", + '#size' => 40, + '#maxlength' => 255, + '#description' => t( + 'Enter the path to a file with predefined styles (Example: !example1). Make sure you select the Define path to ckeditor.styles.js option above.', + array( + '!example1' => '/ckeditor.styles.js' + ) + ) . + '
' . + t( + 'Available placeholders:!h – host name (!host).!t – path to theme !theme.!m – path to the CKEditor module !module.', + array( + '!h' => '
%h', + '!t' => '
%t', + '!m' => '
%m', + '!host' => '' . base_path() . '', + '!theme' => '' . base_path() . path_to_theme() . '/', + '!module' => '' . drupal_get_path('module', 'ckeditor') . '' + ) + ) + ); + + $form['ckeditor_upload_settings'] = array( + '#type' => 'fieldset', + '#title' => t('File browser settings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t( + 'Set the file browser settings. A file browser will allow you to browse the files stored on the server and embed them as links, images, or Flash movies. CKEditor is compatible with such Drupal modules as !imce, !ib, !webfm or !elfinder. CKEditor can be also integrated with !ckfinder, an advanced Ajax file manager.', + array( + '!imce' => l(t('IMCE'), 'http://drupal.org/project/imce'), + '!ib' => l(t('Image Browser'), 'http://drupal.org/project/imagebrowser'), + '!webfm' => l(t('Web File Manager'), 'http://drupal.org/project/webfm'), + '!ckfinder' => l(t('CKFinder'), 'http://cksource.com/ckfinder'), + '!elfinder' => l(t('elFinder'), 'http://drupal.org/project/elfinder') + ) + ) + ); + + $filebrowsers = array( + 'none' => t('None'), + 'ckfinder' => t('CKFinder'), + ); + + $filebrowsers_dialogs = array( + '' => t('Same as in the Link dialog window'), + 'ckfinder' => t('CKFinder'), + ); + + if (module_exists('imce')) { + $filebrowsers['imce'] = t('IMCE'); + $filebrowsers_dialogs['imce'] = t('IMCE'); + } + + if (module_exists('tinybrowser')) { + $filebrowsers['tinybrowser'] = t('TinyBrowser'); + $filebrowsers_dialogs['tinybrowser'] = t('TinyBrowser'); + } + + if (module_exists('imagebrowser')) { + $filebrowsers['ib'] = t('Image Browser'); + $filebrowsers_dialogs['ib'] = t('Image Browser'); + } + + if (module_exists('webfm_popup')) { + $filebrowsers['webfm'] = t('Web File Manager'); + $filebrowsers_dialogs['webfm'] = t('Web File Manager'); + } + + if (module_exists('elfinder')) { + $filebrowsers['elfinder'] = t('elFinder'); + $filebrowsers_dialogs['elfinder'] = t('elFinder'); + } + + $form['ckeditor_upload_settings']['filebrowser'] = array( + '#type' => 'select', + '#title' => t('File browser type (Link dialog window)'), + '#default_value' => !empty($profile->settings['filebrowser']) ? $profile->settings['filebrowser'] : 'none', + '#options' => $filebrowsers, + '#description' => t('Select the file browser that you would like to use to upload files.'), + ); + + $form['ckeditor_upload_settings']['filebrowser_image'] = array( + '#type' => 'select', + '#title' => t('File browser type (Image dialog window)'), + '#default_value' => !empty($profile->settings['filebrowser_image']) ? $profile->settings['filebrowser_image'] : 'none', + '#options' => $filebrowsers_dialogs, + '#description' => t('Select the file browser that you would like to use to upload images.'), + ); + + $form['ckeditor_upload_settings']['filebrowser_flash'] = array( + '#type' => 'select', + '#title' => t('File browser type (Flash dialog window)'), + '#default_value' => !empty($profile->settings['filebrowser_flash']) ? $profile->settings['filebrowser_flash'] : 'none', + '#options' => $filebrowsers_dialogs, + '#description' => t('Select the file browser that you would like to use to upload Flash movies.'), + ); + + $current_user_files_path = empty($profile->settings['UserFilesPath']) ? "%b%f/" : $profile->settings['UserFilesPath']; + $current_user_files_path = strtr($current_user_files_path, array("%f" => file_directory_path(), "%u" => "UID", "%b" => base_path(), "%n" => "UNAME")); + + $current_user_files_absolute_path = empty($profile->settings['UserFilesAbsolutePath']) ? "%d%b%f/" : $profile->settings['UserFilesAbsolutePath']; + $current_user_files_absolute_path = strtr($current_user_files_absolute_path, array("%f" => file_directory_path(), "%u" => "UID", "%b" => base_path(), "%d" => $_SERVER['DOCUMENT_ROOT'], "%n" => "UNAME")); + + if (variable_get('file_downloads', '') != FILE_DOWNLOADS_PRIVATE) { + + $form['ckeditor_upload_settings']['UserFilesPath'] = array( + '#type' => 'textfield', + '#prefix' => '
' . t('CKFinder settings') .'', + '#title' => t('Path to uploaded files'), + '#default_value' => !empty($profile->settings['UserFilesPath']) ? $profile->settings['UserFilesPath'] : "%b%f/", + '#size' => 40, + '#maxlength' => 255, + '#description' => t('Path to uploaded files relative to the document root.') . + '
' . + t( + 'Available placeholders:!b – the base URL path of the Drupal installation !base.!f – Drupal file system path where the files are stored !files.!u – User ID.!n – Username.', + array( + '!n' => '
%n', + '!u' => '
%u', + '!f' => '
%f', + '!b' => '
%b', + '!files' => file_directory_path(), + '!base' => base_path() + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . $current_user_files_path . '' + ) + ) + ); + + $form['ckeditor_upload_settings']['UserFilesAbsolutePath'] = array( + '#type' => 'textfield', + '#title' => t('Absolute path to uploaded files'), + '#default_value' => !empty($profile->settings['UserFilesAbsolutePath']) ? $profile->settings['UserFilesAbsolutePath'] : "%d%b%f/", + '#size' => 40, + '#maxlength' => 255, + '#suffix' => '
', + '#description' => t('The path to the local directory (on the server) which points to the path defined above. If left empty, CKEditor will try to discover the right path.') . + '
' . + t( + 'Available placeholders:!d – the server path to document root !root.!b – base URL path of the Drupal installation !base.!f – Drupal file system path where the files are stored !files.!u – User ID.!n – Username.', + array( + '!u' => '
%u', + '!n' => '
%n', + '!d' => '
%d', + '!b' => '
%b', + '!f' => '
%f', + '!files' => '' . file_directory_path() . '', + '!base' => '' . base_path() . '', + '!root' => '' . $_SERVER['DOCUMENT_ROOT'] . '' + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . $current_user_files_absolute_path . '' + ) + ) + ); + } + + if (variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE) { + $form['ckeditor_upload_settings']['private_path_descrption'] = array( + '#value' => '
' . t( + 'Setting a relative path to uploaded files was disabled because private downloads are enabled and thus this path is calculated automatically. To change the location of uploaded files in the private file system, edit the !url.', + array( + '!url' => l(t('CKEditor Global Profile'), 'admin/settings/ckeditor/editg') + ) + ) . + '
' + ); + } + + $form['advanced'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced options'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + if (ckeditor_get_version(TRUE) == 3) { + $form['advanced']['ckeditor_load_method'] = array( + '#type' => 'select', + '#title' => t('Loading method'), + '#default_value' => !empty($profile->settings['ckeditor_load_method']) ? $profile->settings['ckeditor_load_method'] : 'ckeditor.js', + '#options' => _ckeditor_load_methods(), + '#description' => t('Select the loading method of CKEditor. If the !ckeditor_basic_js file is used, only a small file is loaded initially and the rest of the editor is loaded later (see Loading timeout). This might be useful if CKEditor is disabled by default.', + array( + '!ckeditor_basic_js' => 'ckeditor_basic.js' + ) + ) + ); + $form['advanced']['ckeditor_load_time_out'] = array( + '#type' => 'textfield', + '#title' => t('Loading timeout'), + '#default_value' => !empty($profile->settings['ckeditor_load_time_out']) ? $profile->settings['ckeditor_load_time_out'] : "0", + '#size' => 40, + '#maxlength' => 255, + '#description' => t('The time to wait (in seconds) to load the full editor code after the page is loaded, if the !ckeditor_basic_js file is used. If set to zero, the editor is loaded on demand.', + array( + '!ckeditor_basic_js' => 'ckeditor_basic.js' + ) + ) + ); + } + + $form['advanced']['forcePasteAsPlainText'] = array( + '#type' => 'select', + '#title' => t('Force pasting as plain text'), + '#default_value' => !empty($profile->settings['forcePasteAsPlainText']) ? $profile->settings['forcePasteAsPlainText'] : "f", + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled') + ), + '#description' => t('If enabled, HTML content will be automatically changed to plain text when pasting.'), + ); + $form['advanced']['html_entities'] = array( + '#type' => 'radios', + '#title' => t('HTML Entities'), + '#default_value' => !empty($profile->settings['html_entities']) ? $profile->settings['html_entities'] : 't', + '#description' => t('Convert all applicable characters to HTML entities.'), + '#options' => array( + 'f' => t('No'), + 't' => t('Yes') + ), + ); + $form['advanced']['scayt_autoStartup'] = array( + '#type' => 'radios', + '#title' => t('Spellchecker'), + '#default_value' => !empty($profile->settings['scayt_autoStartup']) ? $profile->settings['scayt_autoStartup'] : 'f', + '#description' => t('If enabled, turns on SCAYT (Spell Check As You Type) automatically after loading the editor.'), + '#options' => array( + 'f' => t('No'), + 't' => t('Yes') + ), + ); + $form['advanced']['theme_config_js'] = array( + '#type' => 'radios', + '#title' => t('Load !ckeditor_config_js from the theme path', + array( + '!ckeditor_config_js' => 'ckeditor.config.js' + ) + ), + '#default_value' => !empty($profile->settings['theme_config_js']) ? $profile->settings['theme_config_js'] : 'f', + '#options' => array( + 't' => t('Yes'), + 'f' => t('No') + ), + '#description' => t('When enabled, the editor will try to load the !ckeditor_config_js file from the theme directory.', + array( + '!ckeditor_config_js' => 'ckeditor.config.js' + ) + ), + ); + $form['advanced']['js_conf'] = array( + '#type' => 'textarea', + '#title' => t('Custom JavaScript configuration'), + '#default_value' => !empty($profile->settings['js_conf']) ? $profile->settings['js_conf'] : "", + '#cols' => 60, + '#rows' => 5, + '#description' => t( + 'In order to change CKEditor configuration globally, you should modify the !ckeditor_config configuration file. Sometimes it is required to change the CKEditor configuration for a single profile only. Use this box to define settings that are unique for this profile. Available options are listed in the !docs. Add the following code snippet to change the fonts available in the CKEditor Font and Size drop-down lists:
@code
Warning: If you make a mistake here, CKEditor may not load correctly.', + array( + '!ckeditor_config' => '' . drupal_get_path('module', 'ckeditor') . "/ckeditor.config.js", + '!docs' => l(t('CKEditor documentation'), 'http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html'), + '@code' => "config.fontSize_sizes = '16/16px;24/24px;48/48px;';\nconfig.font_names = 'Arial;Times New Roman;Verdana';" + ) + ), + '#wysiwyg' => FALSE + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Save') + ); + + return $form; +} + +/** + * Profile validation. + */ +function ckeditor_admin_profile_form_validate($form, &$form_state) { + $edit =& $form_state['values']; + + //include mode and all other fields are empty, invalid + if ($edit['excl_mode'] == 1 && empty($edit['excl'])) { + form_set_error('excl_mode', t('Include mode selected, but no paths given. Enter at least one path where CKEditor should appear.')); + } + else { + ckeditor_admin_profile_validate_fieldpaths('excl', $edit['excl']); + } + + ckeditor_admin_profile_validate_fieldpaths('simple_incl', $edit['simple_incl']); + + if (!preg_match('/^\d+$/', trim($edit['min_rows']))) { + form_set_error('min_rows', t('Minimum rows must be a valid number.')); + } + + if ($edit['default'] == 't' && $edit['popup'] == 't') { + form_set_error('popup', t('If CKEditor is enabled by default, the popup window must be disabled.')); + } + + if ($edit['show_toggle'] == 't' && $edit['popup'] == 't') { + form_set_error('popup', t('If toggle is enabled, the popup window must be disabled.')); + } + + if (!$edit['name']) { + form_set_error('name', t('You must give a profile name.')); + } + elseif (!preg_match('/^[A-Za-z0-9_]+$/', $edit['name'])) { + form_set_error('name', t('Enter a valid profile name. Only alphanumeric and underscore characters are allowed.')); + } + elseif ($edit['name'] == 'CKEditor Global Profile') { + form_set_error('name', t('This profile name is reserved. Please choose a different name.')); + } + elseif (!isset($edit['_profile']) || ($edit['_profile']->name != $edit['name'])) { + $result = ckeditor_profile_load($edit['name']); + if (!empty($result)) { + form_set_error('name', t('The profile name must be unique. A profile with this name already exists.')); + } + } + + if (!preg_match('/^\d+%?$/', $edit['width'])) { + form_set_error('width', t('Enter a valid width value. Examples: 400, 100%.')); + } + + if (!empty($edit['css_path'])) { + if ($edit['css_mode'] != 'self') { + form_set_error('css_path', t('The CSS path is not empty. Please set the Editor CSS option to the Define CSS mode.')); + } + elseif (FALSE !== strpos($edit['css_path'], '"')) { + form_set_error('css_path', t('Double quotes are not allowed in the CSS path.')); + } + elseif (substr($edit['css_path'], 0, 1) == "'" && substr($edit['css_path'], -1) == "'") { + form_set_error('css_path', t('Enter a valid CSS path, do not surround it with quotes.')); + } + } + + if (!empty($edit['styles_path'])) { + if ($edit['css_style'] != 'self') { + form_set_error('styles_path', t('The path to predefined styles is not empty. Please set the Predefined styles option to the Define path to ckeditor.styles.js mode.')); + } + elseif (FALSE !== strpos($edit['styles_path'], '"')) { + form_set_error('styles_path', t('Double quotes are not allowed in the styles path.')); + } + elseif (substr($edit['styles_path'], 0, 1) == "'" && substr($edit['styles_path'], -1) == "'") { + form_set_error('styles_path', t('Enter a valid styles path, do not surround it with quotes.')); + } + } + + if (!empty($edit['font_format'])) { + if (!preg_match("/^((p|div|pre|address|h1|h2|h3|h4|h5|h6);)*(p|div|pre|address|h1|h2|h3|h4|h5|h6)$/", $edit['font_format'])) { + form_set_error('font_format', t('Enter a valid, semicolon-separated list of HTML font formats (no semicolon at the end of the list is expected).')); + } + } + + if (variable_get('file_downloads', '') !== FILE_DOWNLOADS_PRIVATE) { + if (!empty($edit['UserFilesAbsolutePath']) && empty($edit['UserFilesPath'])) { + form_set_error('UserFilesPath', t('The path to uploaded files is required.')); + } + if (!empty($edit['UserFilesPath']) && empty($edit['UserFilesAbsolutePath'])) { + form_set_error('UserFilesPath', t('An absolute path to uploaded files is required.')); + } + } + + if (ckeditor_get_version(TRUE) == 3) { + $load_methods=_ckeditor_load_methods(); + if (!isset($load_methods[$edit['ckeditor_load_method']])) { + form_set_error('ckeditor_load_method', t('Set a valid loading method.')); + } + if (!preg_match('#\d+#', $edit['ckeditor_load_time_out'])) { + form_set_error('ckeditor_load_time_out', t('Enter a valid loading timeout in seconds.')); + } + } + if (!preg_match('#^\s*\[(?:\s*(?:\{\s*[\w:\'" ,]*\s*\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]\s*\}|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#U', $edit['toolbar']) && !preg_match('#^\s*\[(?:\s*(?:\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#', $edit['toolbar'])) { + form_set_error('toolbar', t('Enter a valid toolbar configuration.')); + } +} + +function ckeditor_admin_profile_form_submit($form, &$form_state) { + $edit =& $form_state['values']; + + if (isset($edit['_profile'])) { + db_query("DELETE FROM {ckeditor_settings} WHERE name = '%s'", $edit['_profile']->name); + db_query("DELETE FROM {ckeditor_role} WHERE name = '%s'", $edit['_profile']->name); + drupal_set_message(t('Your CKEditor profile was updated.')); + } + else { + drupal_set_message(t('Your CKEditor profile was created.')); + } + + $settings = ckeditor_admin_values_to_settings($edit); + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], $settings); + ckeditor_rebuild_selectors($edit['name']); + if (!empty($edit['rids'])) { + foreach (array_keys($edit['rids']) as $rid) { + if ($edit['rids'][$rid]!=0) { + db_query("INSERT INTO {ckeditor_role} (name, rid) VALUES ('%s', %d)", $edit['name'], $rid); + } + } + } + + $form_state['redirect'] = 'admin/settings/ckeditor'; +} + +function ckeditor_admin_global_profile_form($form_state, $mode = 'add') { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + if ($mode == 'edit') { + $profile = ckeditor_profile_load('CKEditor Global Profile'); + + $form['_profile'] = array( + '#type' => 'value', + '#value' => $profile, + ); + } + else { + $profile = new stdClass(); + } + + if ($mode == 'add') { + $data = ckeditor_profile_load('CKEditor Global Profile'); + if (!empty($data)) { + drupal_set_message(t('The global profile already exists. Only one global profile is allowed.'), 'error'); + drupal_not_found(); + } + + $btn = t('Create a global profile'); + } + else { + $btn = t('Update the global profile'); + } + + $toolbar_wizard = !empty($profile->settings['toolbar_wizard']) ? $profile->settings['toolbar_wizard'] : 't'; + drupal_add_js(array('ckeditor_toolbar_wizard' => $toolbar_wizard), 'setting'); + + $form['common'] = array( + '#type' => 'fieldset', + '#title' => t('Main setup'), + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + + $roles = ckeditor_sorted_roles(); + $rids = $rtext = array(); + foreach ($roles as $rid => $name) { + $rids[] = $rid; + $rtext[] = ''. $rid .' - '. $name; + } + $form['common']['rank'] = array( + '#type' => 'textfield', + '#title' => t('Role precedence'), + '#default_value' => implode('>', $rids), + '#description' => t('A user with multiple roles gets the permissions of the highest one. Sort role IDs according to their precedence from higher to lower by putting the ">" character in between.'), + ); + if ($rids) { + $form['common']['rank']['#description'] .= '
'. t('The following list contains the ID-name pairs of roles with access to CKEditor:') .'
'. implode('
', $rtext) .'
'; + } + else { + $form['common']['rank']['#description'] .= '
'. t( + 'You have not assigned the "access ckeditor" !permissions yet.', + array( + '!permissions' => l(t('permissions'), 'admin/user/permissions') + ) + ); + } + + $form['ckeditor_exclude_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Visibility settings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#description' => t('The following settings are combined with the visibility settings of the specific profile.'), + ); + + $form['ckeditor_exclude_settings']['excl_mode'] = array( + '#type' => 'radios', + '#title' => t('Use inclusion or exclusion mode'), + '#default_value' => (empty($profile->settings['excl_mode']) || in_array($profile->settings['excl_mode'], array(0, 2))) ? 0 : 1, + '#options' => array( + '0' => t('Exclude'), + '1' => t('Include') + ), + '#description' => t('Choose the way of disabling/enabling CKEditor on selected fields/paths (see below). Use Exclude to disable CKEditor on selected fields/paths. Use Include if you want to load CKEditor only on selected paths/fields.'), + ); + /** + * get excluded fields - so we can have normal textareas too + * split the phrase by any number of commas or space characters, + * which include " ", \r, \t, \n and \f + */ + $form['ckeditor_exclude_settings']['excl'] = array( + '#type' => 'textarea', + '#title' => t('Fields to exclude/include'), + '#cols' => 60, + '#rows' => 5, + '#prefix' => '
', + '#suffix' => '
', + '#default_value' => !empty($profile->settings['excl']) ? $profile->settings['excl'] : '', + '#description' => t('Enter the paths to the textarea fields for which you want to enable or disable CKEditor.') . + ' ' . + t( + 'See the !helppagelink for more information about defining field names. Short instruction is available below.', + array( + '!helppagelink' => l(t('Help page'), 'admin/help/ckeditor', array('fragment' => 'fieldinclexcl')) + ) + ) . + '
  • ' . + t('Path structure: theme_name:content_type@path.element_id') . + '
  • ' . + t('The following wildcards are available: "*", "?".') . + '
  • ' . + t('Content type and theme name is optional. You may even specify only path or field id.') . + '
  • ' . + t('Examples:') . + '
    • garland:blog@*.edit-body - ' . + t('matches all fields of type "blog" called edit-body in garland theme, on any page.') . + '
    • node/add/*.edit-user-* - ' . + t('matches fields starting with "edit-user-" on pages starting with "node/add/') . + '
', + '#wysiwyg' => FALSE, + ); + + $form['ckeditor_exclude_settings']['simple_incl'] = array( + '#type' => 'textarea', + '#title' => t('Force simplified toolbar on the following fields'), + '#cols' => 60, + '#rows' => 5, + '#default_value' => !empty($profile->settings['simple_incl']) ? $profile->settings['simple_incl'] : '', + '#description' => t('Enter the paths to the textarea fields for which you want to force the simplified toolbar.') . + ' ' . + t( + 'See the !helppagelink for more information about defining field names. Take a look at the exclusion settings (above) for a short instruction.', + array( + '!helppagelink' => l(t('Help page'), 'admin/help/ckeditor', array('fragment' => 'fieldinclexcl')) + ) + ), + '#wysiwyg' => FALSE, + ); + + $module_drupal_path = drupal_get_path('module', 'ckeditor'); + + drupal_add_js($module_drupal_path . '/includes/ckeditor.admin.js', 'file'); + + if ($toolbar_wizard == 't') { + if (module_exists('jquery_ui')) { + if (!module_exists('jquery_update') || jquery_update_get_version() <= 1.2 ) + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-1.4.4.min.js', 'core'); + if (jquery_ui_get_version() > 1.6) { + jquery_ui_add(array('ui.sortable')); + } + else { + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-ui.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.widget.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.sortable.min.js', 'file'); + } + } + else { + if (!module_exists('jquery_update') || jquery_update_get_version() <= 1.2 ) + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-1.4.4.min.js', 'core'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery-ui.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.widget.min.js', 'file'); + drupal_add_js($module_drupal_path . '/includes/jqueryUI/jquery.ui.sortable.min.js', 'file'); + } + drupal_add_js($module_drupal_path . '/includes/jqueryUI/sort.js', 'file'); + } + + $form['ckeditor_exclude_settings']['simple_toolbar'] = array( + '#id' => 'edit-toolbar', + '#type' => 'textarea', + '#title' => t('Simplified toolbar'), + '#default_value' => isset($profile->settings['simple_toolbar']) ? $profile->settings['simple_toolbar'] : "[ [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] ]", + '#wysiwyg' => FALSE, + '#rows' => 15 + ); + + if ($toolbar_wizard == 't') { + $form['ckeditor_exclude_settings']['toolbar_wizzard_used'] = array( + '#type' => 'markup', + '#value' => '
' . t('Used buttons') . '

', + '#description' => t('Currently used buttons'), + ); + + drupal_add_js(array('cke_toolbar_buttons_all' => ckeditor_toolbar_buttons_all(FALSE)), 'setting'); + + $form['ckeditor_exclude_settings']['toolbar_wizzard_all'] = array( + '#type' => 'markup', + '#value' => '
' . t('All buttons') . '

', + '#description' => t('All available buttons'), + ); + } + + $form['ckeditor_advanced_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced settings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $module_drupal_path = drupal_get_path('module', 'ckeditor'); + + $form['ckeditor_advanced_settings']['ckeditor_path'] = array( + '#type' => 'textfield', + '#title' => t('Path to CKEditor'), + '#default_value' => !empty($profile->settings['ckeditor_path']) ? $profile->settings['ckeditor_path'] : '%m/ckeditor', + '#size' => 40, + '#maxlength' => 128, + '#description' => t( + 'The path to CKEditor (the WYSIWYG rich text editor downloaded from !ckeditorcom) relative to the document root.', + array( + '!ckeditorcom' => l(t('ckeditor.com'), 'http://ckeditor.com/download') + ) + ) . + '
'. + t( + 'Available placeholders:!b – base URL path of the Drupal installation (!base).!m – base URL path where the CKEditor module is stored (!files).!l – base URL path to the libraries directory (!library).
Current path: !path', + array( + '!b' => '
%b', + '!m' => '
%m', + '!l' => '
%l', + '!path' => '' . ckeditor_path(FALSE) . '', + '!base' => '' . base_path() . '', + '!files' => '' . base_path() . $module_drupal_path . '', + '!library' => '' . base_path() . 'sites/all/libraries/' + ) + ), + '#required' => TRUE + ); + + $form['ckeditor_advanced_settings']['ckeditor_local_path'] = array( + '#type' => 'textfield', + '#title' => t('Local path to CKEditor'), + '#default_value' => isset($profile->settings['ckeditor_local_path'])?$profile->settings['ckeditor_local_path']:'', + '#size' => 40, + '#maxlength' => 128, + '#description' => t( + 'The path to the local directory (on the server) that points to the path defined above. Enter either an absolute server path or a path relative to the !indexphp file. If left empty, the CKEditor module will try to find the right path.', + array( + '!indexphp' => 'index.php' + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . ckeditor_path(TRUE) . '' + ) + ) + ); + + $form['ckeditor_advanced_settings']['ckeditor_plugins_path'] = array( + '#type' => 'textfield', + '#title' => t('Path to the CKEditor plugins directory'), + '#default_value' => !empty($profile->settings['ckeditor_plugins_path']) ? $profile->settings['ckeditor_plugins_path'] : '%m/plugins', + '#size' => 40, + '#maxlength' => 128, + '#description' => t('Path to the CKEditor plugins directory relative to the document root.') . + '
' . + t( + 'Available placeholders:!b – the base URL path of the Drupal installation (!base).!m – the base URL path where the CKEditor module is stored (!files).!l – the base URL path to the libraries directory (!library).', + array( + '!b' => '
%b', + '!m' => '
%m', + '!l' => '
%l', + '!base' => '' . base_path() . '', + '!files' => '' . base_path() . $module_drupal_path . '' , + '!library' => '' . base_path() . 'sites/all/libraries/' + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . ckeditor_plugins_path() . '' + ) + ) + ); + + $form['ckeditor_advanced_settings']['ckeditor_plugins_local_path'] = array( + '#type' => 'textfield', + '#title' => t('Local path to the CKEditor plugins directory'), + '#default_value' => isset($profile->settings['ckeditor_plugins_local_path'])?$profile->settings['ckeditor_plugins_local_path']:'', + '#size' => 40, + '#maxlength' => 128, + '#description' => t( + 'The path to the local directory (on the server) that points to the path defined above. Enter either an absolute server path or a path relative to the !indexphp file. If left empty, the CKEditor module will try to find the right path.
Current path: !path', + array( + '!indexphp' => 'index.php' + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . ckeditor_plugins_path(TRUE) . '' + ) + ) + ); + + $form['ckeditor_advanced_settings']['ckfinder_path'] = array( + '#type' => 'textfield', + '#title' => t('Path to CKFinder'), + '#default_value' => !empty($profile->settings['ckfinder_path']) ? $profile->settings['ckfinder_path'] : '%m/ckfinder', + '#size' => 40, + '#maxlength' => 128, + '#description' => t( + 'The path to CKFinder (AJAX based file manager downloaded from !ckfindercom) relative to the document root.', + array( + '!ckfindercom' => l(t('ckfinder.com'), 'http://cksource.com/ckfinder') + ) + ) . + '
' . + t( + 'Available placeholders:!b – the base URL path of the Drupal installation (!base).!m – path where the CKEditor module is stored (!files).!l – path to the libraries directory (!library).', + array( + '!b' => '
%b', + '!m' => '
%m', + '!l' => '
%l', + '!base' => '' . base_path() . '', + '!files' => '' . base_path() . $module_drupal_path . '', + '!library' => '' . base_path() . 'sites/all/libraries/' + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . ckfinder_path() . '' + ) + ) + ); + + $form['ckeditor_advanced_settings']['show_fieldnamehint'] = array( + '#type' => 'radios', + '#title' => t('Show field name hint below each rich text editor'), + '#default_value' => !empty($profile->settings['show_fieldnamehint']) ? $profile->settings['show_fieldnamehint'] : 't', + '#options' => array( + 't' => t('Yes'), + 'f' => t('No') + ), + '#description' => t('This only applies to users with the "administer ckeditor" permissions.'), + ); + + if (variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE) { + $form['ckeditor_advanced_settings']['ckeditor_allow_download_private_files'] = array( + '#type' => 'checkbox', + '#title' => t('Enable access to files located in the private folder'), + '#default_value' => !empty($profile->settings['ckeditor_allow_download_private_files']), + '#return_value' => 't', + '#description' => t( + 'Use this option with care. If checked, CKEditor will allow anyone knowing the URL to view a file located inside of the private path (!private_path), but only if there is no information about the file in the Drupal database. If the path below is specified, anyone will have access only to that location.', + array( + '!private_path' => '' . realpath(file_directory_path()) . '' + ) + ), + '#required' => FALSE + ); + + $current_private_dir = !empty($profile->settings['private_dir']) ? $profile->settings['private_dir'] : ''; + $form['ckeditor_advanced_settings']['private_dir'] = array( + '#type' => 'textfield', + '#title' => t('Location of files uploaded with CKEditor in the private folder'), + '#default_value' => !empty($profile->settings['private_dir']) ? $profile->settings['private_dir'] : '', + '#size' => 40, + '#maxlength' => 255, + '#description' => t('The path relative to the location of the private directory where CKEditor should store uploaded files.') . + '
' . + t('System path to the private folder is: !system_path.', + array( + '!system_path' => '' . realpath(file_directory_path()) . DIRECTORY_SEPARATOR . '' + ) + ) . + '
' . + t('Available wildcard characters: !u – User ID.!n – Username', + array( + '!u' => '
%u', + '!n' => '
%n' + ) + ) . + '
' . + t('Current path: !path', + array( + '!path' => '' . $current_private_dir . ' (' . str_replace('/', DIRECTORY_SEPARATOR, file_create_path(str_replace(array('%u', '%n'), array('UID', 'UNAME'), $current_private_dir))) . ')' + ) + ) + ); + } + + if (function_exists('linktocontent_node_menu') && function_exists('pathfilter_filter')) { + $form['ckeditor_advanced_settings']['linktoc'] = array( + '#type' => 'select', + '#options' => array('p' => t('Link to paths only'), 'n' => t('Link using internal: links'), 'pn' => t('Allow the user to select between paths and internal links')), + '#title' => t('Path Filter & Link To Content integration'), + '#default_value' => empty($profile->settings['linktoc']) ? 'p' : $profile->settings['linktoc'], + '#description' => t( + 'With the !plink extension it is possible to use internal: links. By default the !link extension is linking to nodes using paths.', + array( + '!plink' => l(t('Path Filter'), 'http://drupal.org/project/pathfilter'), + '!link' => l(t('Link To Content'), 'http://drupal.org/project/linktocontent') + ) + ) + ); + } + + $form['ckeditor_advanced_settings']['ckeditor_aggregate'] = array( + '#type' => 'radios', + '#title' => t('Aggregate ckeditor.js'), + '#default_value' => !empty($profile->settings['ckeditor_aggregate']) ? $profile->settings['ckeditor_aggregate'] : 'f', + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled') + ), + '#description' => t('When enabled, ckeditor.js will be aggregated if JavaScript aggregation is enabled. Not recommended.'), + ); + + $form['ckeditor_advanced_settings']['toolbar_wizard'] = array( + '#type' => 'radios', + '#title' => t('Use toolbar Drag&Drop feature'), + '#default_value' => !empty($profile->settings['toolbar_wizard']) ? $profile->settings['toolbar_wizard'] : 't', + '#options' => array( + 't' => t('Enabled'), + 'f' => t('Disabled') + ), + '#description' => t('When enabled, the toolbar can be built by using the drag-and-drop feature. Otherwise you will need to enter the toolbar configuration manually to the text box.'), + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => $btn + ); + + return $form; +} + +function ckeditor_admin_global_profile_form_validate($form, &$form_state) { + $edit =& $form_state['values']; + + if (!preg_match('#^\s*\[(?:\s*(?:\{\s*[\w:\'" ,]*\s*\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]\s*\}|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#U', $edit['simple_toolbar']) && !preg_match('#^\s*\[(?:\s*(?:\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#', $edit['simple_toolbar'])) { + form_set_error('simple_toolbar', t('Enter a valid toolbar configuration.')); + } + + //include mode and all other fields are empty, invalid + if ($edit['excl_mode'] == 1 && empty($edit['excl'])) { + form_set_error('excl_mode', t('Include mode selected, but no paths given. Enter at least one path where CKEditor should appear.')); + } + else { + ckeditor_admin_profile_validate_fieldpaths('excl', $edit['excl']); + } + + ckeditor_admin_profile_validate_fieldpaths('simple_incl', $edit['simple_incl']); +} + +function ckeditor_admin_global_profile_form_submit($form, &$form_state) { + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + $edit =& $form_state['values']; + $edit['name'] = 'CKEditor Global Profile'; + + if (isset($edit['rank'])) { + $edit['rank'] = explode('>', str_replace(' ', '', $edit['rank'])); + } + + if (isset($edit['_profile'])) { + db_query("DELETE FROM {ckeditor_settings} WHERE name = '%s'", $edit['_profile']->name); + db_query("DELETE FROM {ckeditor_role} WHERE name = '%s'", $edit['_profile']->name); + } + + //strip whitespaces + if (empty($edit['ckeditor_local_path'])) { + $edit['ckeditor_local_path'] = ''; + } + else { + $edit['ckeditor_local_path'] = trim($edit['ckeditor_local_path']); + } + + //strip slash from the end + if (empty($edit['ckeditor_path'])) { + $edit['ckeditor_path'] = ''; + } + $edit['ckeditor_path'] = trim(rtrim($edit['ckeditor_path'], "/")); + if ($edit['ckeditor_path'] && 0 !== strpos($edit['ckeditor_path'], "/") && 0 !== strpos($edit['ckeditor_path'], "%")) { + //ensure that slash is at the beginning + $edit['ckeditor_path'] = "/". $edit['ckeditor_path']; + } + //no slash at the end + $edit['ckeditor_local_path'] = trim(rtrim($edit['ckeditor_local_path'], "/")); + + //strip whitespaces + if (empty($edit['ckeditor_plugins_local_path'])) { + $edit['ckeditor_plugins_local_path'] = ''; + } + else { + $edit['ckeditor_plugins_local_path'] = trim($edit['ckeditor_plugins_local_path']); + } + + //strip slash from the end + if (empty($edit['ckeditor_plugins_path'])) { + $edit['ckeditor_plugins_path'] = ''; + } + $edit['ckeditor_plugins_path'] = trim(rtrim($edit['ckeditor_plugins_path'], "/")); + if ($edit['ckeditor_plugins_path'] && 0 !== strpos($edit['ckeditor_plugins_path'], "/") && 0 !== strpos($edit['ckeditor_plugins_path'], "%")) { + //ensure that slash is at the beginning + $edit['ckeditor_plugins_path'] = "/". $edit['ckeditor_plugins_path']; + } + //no slash at the end + $edit['ckeditor_plugins_path'] = trim(rtrim($edit['ckeditor_plugins_path'], "/")); + + //strip slash from the end + if (empty($edit['ckfinder_path'])) { + $edit['ckfinder_path'] = ''; + } + $edit['ckfinder_path'] = trim(rtrim($edit['ckfinder_path'], "/")); + if ($edit['ckfinder_path'] && 0 !== strpos($edit['ckfinder_path'], "/") && 0 !== strpos($edit['ckfinder_path'], "%")) { + //ensure that slash is at the beginning + $edit['ckfinder_path'] = "/" . $edit['ckfinder_path']; + } + + $settings = ckeditor_admin_values_to_settings($edit); + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], $settings); + ckeditor_rebuild_selectors($edit['name']); + + drupal_set_message(t('The CKEditor Global Profile was saved.')); + $form_state['redirect'] = 'admin/settings/ckeditor'; +} + +/** + * Converts an array of form values to a serialized array that does not + * contain Drupal Form API values + */ +function ckeditor_admin_values_to_settings($values) { + $plugins = array(); + if (isset($values['loadPlugins'])) { + $plugins = $values['loadPlugins']; + } + unset($values['name'], $values['rids'], $values['_profile'], $values['op'], $values['submit'], $values['form_build_id'], $values['form_token'], $values['form_id'], $values['loadPlugins']); + + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); + $plugin_list = ckeditor_load_plugins(); + $values['loadPlugins'] = array(); + if (!empty($plugins)) { + foreach (array_keys($plugins) as $plugin) { + if ($plugins[$plugin] != '0') { + $values['loadPlugins'][$plugin] = $plugin_list[$plugin]; + } + } + } + + return serialize($values); +} + +function ckeditor_admin_profile_validate_fieldpaths($fieldname, $paths) { + $myerrors = array(); + + $rules = preg_split('/[\s,]+/', $paths); + + foreach ($rules as $rule) { + $rule = trim($rule); + if (!empty($rule) && strpos($rule, '.') === FALSE && strpos($rule, '/') === FALSE && strpos($rule, '-') === FALSE) { + $myerrors[] = t( + 'Rule %rule is ambiguous: please append .* if %rule is a path or prepend *. if %rule is a field.', + array( + '%rule' => $rule + ) + ); + } + } + + if (!empty($myerrors)) { + form_set_error($fieldname, check_plain(implode('
', $myerrors))); + } +} + +function ckeditor_admin_profile_delete_form($form_state, $profile) { + $form = array(); + + $form['_profile'] = array( + '#type' => 'value', + '#value' => $profile, + ); + + $form['question'] = array( + '#type' => 'item', + '#value' => t( + 'Are you sure that you want to delete the CKEditor profile %profile?', + array( + '%profile' => $profile->name + ) + ) + ); + + $form['delete'] = array( + '#type' => 'submit', + '#id' => 'delete', + '#value' => t('Delete'), + ); + + $form['back'] = array( + '#type' => 'submit', + '#id' => 'back', + '#value' => t('Cancel'), + ); + + return $form; +} + +function ckeditor_admin_profile_delete_form_submit($form, &$form_state) { + $v =& $form_state['values']; + + if ($form_state['clicked_button']['#id'] == 'delete') { + ckeditor_profile_delete($v['_profile']->name); + drupal_set_message(t('The CKEditor profile was deleted.')); + } + + $form_state['redirect'] = 'admin/settings/ckeditor'; +} + +/** + * Rebuilds the regular expression that is used to match the inclusion/exclusion rules + * and the simplified toolbar rules + * + * @param string $name Name of the profile to process. If omitted, all profiles are rebuilt + */ +function ckeditor_rebuild_selectors($name = NULL) { + if ($name == NULL) { + $result = db_query("SELECT * FROM {ckeditor_settings}"); + } + else { + $result = db_query("SELECT * FROM {ckeditor_settings} WHERE name = '%s'", $name); + } + + while (($data = db_fetch_object($result))) { + if ($data->settings) { + $settings = unserialize($data->settings); + // [#654626] + if (!isset($settings['excl'])) { + $settings['excl'] = ''; + } + if (!isset($settings['simple_incl'])) { + $settings['simple_incl'] = ''; + } + + foreach (array('excl', 'simple_incl') as $var) { + $settings[$var .'_regex'] = ''; + $rules = preg_split('/[\s,]+/', $settings[$var]); + $regex = array(); + + if (!empty($rules)) { + foreach ($rules as $rule) { + if (!empty($rule)) { + $rule = ckeditor_parse_rule($rule); + $regex[] = '(?:'. ckeditor_rule_to_regex($rule) .')'; + } + } + + if (!empty($regex)) { + $settings[$var .'_regex'] = '#'. implode('|', $regex) .'#'; + } + } + } + + db_query("UPDATE {ckeditor_settings} SET settings='%s' WHERE name='%s'", serialize($settings), $data->name); + } + } +} + +function ckeditor_rule_create($nodetype = '*', $path = '*', $fieldname = '*') { + global $theme; + + $rule = new stdClass(); + $rule->nodetype = $nodetype; + $rule->path = $path; + $rule->field = $fieldname; + $rule->theme = $theme; + + return $rule; +} + +function ckeditor_parse_rule($rule) { + $ruleobj = new stdClass(); + + $colonpos = strpos($rule, ':'); + if ($colonpos !== FALSE) { + $ruleobj->theme = substr($rule, 0, $colonpos); + $rule = substr($rule, $colonpos + 1); + } + else { + $ruleobj->theme = '*'; + } + + $atpos = strpos($rule, '@'); + if ($atpos !== FALSE) { + $ruleobj->nodetype = substr($rule, 0, $atpos); + $rule = substr($rule, $atpos + 1); + } + else { + $ruleobj->nodetype = '*'; + } + + $dotpos = strpos($rule, '.'); + if ($dotpos === FALSE) { + if (strpos($rule, '/') === FALSE && strpos($rule, '-') !== FALSE) { + // assume it's a field + $ruleobj->path = '*'; + $ruleobj->field = $rule; + } + elseif (strpos($rule, '/') !== FALSE) { + // assume it's a path + $ruleobj->path = $rule; + $ruleobj->field = '*'; + } + else { + return NULL; + } + } + else { + $ruleobj->path = substr($rule, 0, $dotpos); + $ruleobj->field = str_replace('\.', '.', substr($rule, $dotpos + 1)); + } + + return $ruleobj; +} + +function ckeditor_rule_to_regex($rule) { + static $replace = array('\*' => '.*', '\?' => '.'); + + $field = str_replace('.', '\.', $rule->field); + $regex = '^'. preg_quote($rule->theme, '#') . ':' . preg_quote($rule->nodetype, '#') .'@'. preg_quote($rule->path, '#') .'\.'. preg_quote($field, '#') .'$'; + $regex = strtr($regex, $replace); + + return $regex; +} + +function ckeditor_rule_to_string($rule) { + $field = str_replace('.', '\.', $rule->field); + $rulestr = $rule->theme . ':'; + if ($rule->nodetype != '*') { + $rulestr .= $rule->nodetype .'@'; + } + return $rulestr . $rule->path .'.'. $field; +} + +/** + * Remove a profile from the database. + */ +function ckeditor_profile_delete($name) { + db_query("DELETE FROM {ckeditor_settings} WHERE name = '%s'", $name); + db_query("DELETE FROM {ckeditor_role} WHERE name = '%s'", $name); +} + +function _ckeditor_load_methods() { + $result = array('ckeditor.js' => 'ckeditor.js'); + if (file_exists(ckeditor_path(TRUE) . '/ckeditor_basic.js')) { + $result['ckeditor_basic.js'] = 'ckeditor_basic.js'; + } + if (file_exists(ckeditor_path(TRUE) . '/ckeditor_source.js')) { + $result['ckeditor_source.js'] = 'ckeditor_source.js (' . t('for developers only') . ')'; + } + return $result; +} + +/* + * Disable WYSIWYG module + */ +function ckeditor_disable_wysiwyg($token) { + if (!drupal_valid_token($token, 'ckeditorDisableWysiwyg')) { + exit(); + } + module_disable(array('wysiwyg')); + drupal_set_message(t('The WYSIWYG module is disabled.')); + + drupal_goto('admin/settings/ckeditor'); +} + +/* + * Get all available toolbar buttons + */ +function ckeditor_toolbar_buttons_all($addPlugins = TRUE) { + $path = base_path() . drupal_get_path('module', 'ckeditor'); + + //CKEditor default buttons + $buttons = array( + 'Source' => array('name' => 'Source', 'icon' => $path . '/images/buttons/source.png', 'title' => 'Source', 'row' => 1), + 'Save' => array('name' => 'Save', 'icon' => $path . '/images/buttons/save.png', 'title' => 'Save', 'row' => 1), + 'NewPage' => array('name' => 'NewPage', 'icon' => $path . '/images/buttons/newPage.png', 'title' => 'New Page', 'row' => 1), + 'Preview' => array('name' => 'Preview', 'icon' => $path . '/images/buttons/preview.png', 'title' => 'Preview', 'row' => 1), + 'Templates' => array('name' => 'Templates', 'icon' => $path . '/images/buttons/templates.png', 'title' => 'Templates', 'row' => 1), + 'Cut' => array('name' => 'Cut', 'icon' => $path . '/images/buttons/cut.png', 'title' => 'Cut', 'row' => 1), + 'Copy' => array('name' => 'Copy', 'icon' => $path . '/images/buttons/copy.png', 'title' => 'Copy', 'row' => 1), + 'Paste' => array('name' => 'Paste', 'icon' => $path . '/images/buttons/paste.png', 'title' => 'Paste', 'row' => 1), + 'PasteText' => array('name' => 'PasteText', 'icon' => $path . '/images/buttons/pastePlainText.png', 'title' => 'Paste as plain text', 'row' => 1), + 'PasteFromWord' => array('name' => 'PasteFromWord', 'icon' => $path . '/images/buttons/pasteWord.png', 'title' => 'Paste from Word', 'row' => 1), + 'Print' => array('name' => 'Print', 'icon' => $path . '/images/buttons/print.png', 'title' => 'Print', 'row' => 1), + 'SpellChecker' => array('name' => 'SpellChecker', 'icon' => $path . '/images/buttons/checkSpelling.png', 'title' => 'Check Spelling', 'row' => 1), + 'Scayt' => array('name' => 'Scayt', 'icon' => $path . '/images/buttons/checkSpelling.png', 'title' => 'Spell Check As you Type', 'row' => 1), //TODO sprawdzic ta opcje + 'Undo' => array('name' => 'Undo', 'icon' => $path . '/images/buttons/undo.png', 'title' => 'Undo', 'row' => 1), + 'Redo' => array('name' => 'Redo', 'icon' => $path . '/images/buttons/redo.png', 'title' => 'Redo', 'row' => 1), + 'Find' => array('name' => 'Find', 'icon' => $path . '/images/buttons/find.png', 'title' => 'Find', 'row' => 1), + 'Replace' => array('name' => 'Replace', 'icon' => $path . '/images/buttons/replace.png', 'title' => 'Replace', 'row' => 1), + 'SelectAll' => array('name' => 'SelectAll', 'icon' => $path . '/images/buttons/selectAll.png', 'title' => 'Select All', 'row' => 1), + 'RemoveFormat' => array('name' => 'RemoveFormat', 'icon' => $path . '/images/buttons/removeFormat.png', 'title' => 'Remove Format', 'row' => 1), + 'Form' => array('name' => 'Form', 'icon' => $path . '/images/buttons/form.png', 'title' => 'Form', 'row' => 1), + 'Checkbox' => array('name' => 'Checkbox', 'icon' => $path . '/images/buttons/checkbox.png', 'title' => 'Checkbox', 'row' => 1), + 'Radio' => array('name' => 'Radio', 'icon' => $path . '/images/buttons/radioButton.png', 'title' => 'Radio Button', 'row' => 1), + 'TextField' => array('name' => 'TextField', 'icon' => $path . '/images/buttons/textField.png', 'title' => 'Text Field', 'row' => 1), + 'Select' => array('name' => 'Select', 'icon' => $path . '/images/buttons/selectionField.png', 'title' => 'Selection Field', 'row' => 1), + 'Button' => array('name' => 'Button', 'icon' => $path . '/images/buttons/button.png', 'title' => 'Button', 'row' => 1), + 'ImageButton' => array('name' => 'ImageButton', 'icon' => $path . '/images/buttons/imageButton.png', 'title' => 'Image Button', 'row' => 1), + 'HiddenField' => array('name' => 'HiddenField', 'icon' => $path . '/images/buttons/hiddenField.png', 'title' => 'Hidden Field', 'row' => 1), + 'Bold' => array('name' => 'Bold', 'icon' => $path . '/images/buttons/bold.png', 'title' => 'Bold', 'row' => 2), + 'Italic' => array('name' => 'Italic', 'icon' => $path . '/images/buttons/italic.png', 'type' => 'command' , 'title' => 'Italic', 'row' => 2), + 'Underline' => array('name' => 'Underline', 'icon' => $path . '/images/buttons/underline.png', 'title' => 'Underline', 'row' => 2), + 'Strike' => array('name' => 'Strike', 'icon' => $path . '/images/buttons/strike.png', 'title' => 'Strike Through', 'row' => 2), + 'Subscript' => array('name' => 'Subscript', 'icon' => $path . '/images/buttons/subscript.png', 'title' => 'Subscript', 'row' => 2), + 'Superscript' => array('name' => 'Superscript', 'icon' => $path . '/images/buttons/superscript.png', 'title' => 'Superscript', 'row' => 2), + 'NumberedList' => array('name' => 'NumberedList', 'icon' => $path . '/images/buttons/numberedList.png', 'title' => 'Insert/Remove Numbered List', 'row' => 2), + 'BulletedList' => array('name' => 'BulletedList', 'icon' => $path . '/images/buttons/bulletedList.png', 'title' => 'Insert/Remove Bulleted List', 'row' => 2), + 'Outdent' => array('name' => 'Outdent', 'icon' => $path . '/images/buttons/decreaseIndent.png', 'title' => 'Decrease Indent', 'row' => 2), + 'Indent' => array('name' => 'Indent', 'icon' => $path . '/images/buttons/increaseIndent.png', 'title' => 'Increase Indent', 'row' => 2), + 'Blockquote' => array('name' => 'Blockquote', 'icon' => $path . '/images/buttons/blockQuote.png', 'title' => 'Block Quote', 'row' => 2), + 'CreateDiv' => array('name' => 'CreateDiv', 'icon' => $path . '/images/buttons/createDivContainer.png', 'title' => 'Create Div Container', 'row' => 2), + 'JustifyLeft' => array('name' => 'JustifyLeft', 'icon' => $path . '/images/buttons/leftJustify.png', 'title' => 'Left Justify', 'row' => 2), + 'JustifyCenter' => array('name' => 'JustifyCenter', 'icon' => $path . '/images/buttons/centerJustify.png', 'title' => 'Center Justify', 'row' => 2), + 'JustifyRight' => array('name' => 'JustifyRight', 'icon' => $path . '/images/buttons/rightJustify.png', 'title' => 'Right Justify', 'row' => 2), + 'JustifyBlock' => array('name' => 'JustifyBlock', 'icon' => $path . '/images/buttons/blockJustify.png', 'title' => 'Block Justify', 'row' => 2), + 'BidiLtr' => array('name' => 'BidiLtr', 'icon' => $path . '/images/buttons/bidiLeft.png', 'title' => 'Text direction from left to right', 'row' => 2), + 'BidiRtl' => array('name' => 'BidiRtl', 'icon' => $path . '/images/buttons/bidiRight.png', 'title' => 'Text direction from right to left', 'row' => 2), + 'Link' => array('name' => 'Link', 'icon' => $path . '/images/buttons/link.png', 'title' => 'Link', 'row' => 2), + 'Unlink' => array('name' => 'Unlink', 'icon' => $path . '/images/buttons/unlink.png', 'title' => 'Unlink', 'row' => 2), + 'Anchor' => array('name' => 'Anchor', 'icon' => $path . '/images/buttons/anchor.png', 'title' => 'Anchor', 'row' => 2), + 'Image' => array('name' => 'Image', 'icon' => $path . '/images/buttons/image.png', 'title' => 'Image', 'row' => 2), + 'Flash' => array('name' => 'Flash', 'icon' => $path . '/images/buttons/flash.png', 'title' => 'Flash', 'row' => 2), + 'Table' => array('name' => 'Table', 'icon' => $path . '/images/buttons/table.png', 'title' => 'Table', 'row' => 2), + 'HorizontalRule' => array('name' => 'HorizontalRule', 'icon' => $path . '/images/buttons/horizontalLine.png', 'title' => 'Insert Horizontal Line', 'row' => 2), + 'Smiley' => array('name' => 'Smiley', 'icon' => $path . '/images/buttons/smiley.png', 'title' => 'Smiley', 'row' => 2), + 'SpecialChar' => array('name' => 'SpecialChar', 'icon' => $path . '/images/buttons/specialCharacter.png', 'title' => 'Inseert Special Character', 'row' => 2), + 'PageBreak' => array('name' => 'PageBreak', 'icon' => $path . '/images/buttons/pageBreakPrinting.png', 'title' => 'Insert Page Break for Printing', 'row' => 2), + 'Styles' => array('name' => 'Styles', 'icon' => $path . '/images/buttons/styles.png', 'title' => 'Formatting Styles', 'row' => 3), + 'Format' => array('name' => 'Format', 'icon' => $path . '/images/buttons/format.png', 'title' => 'Paragraph Format', 'row' => 3), + 'Font' => array('name' => 'Font', 'icon' => $path . '/images/buttons/font.png', 'title' => 'Font Name', 'row' => 3), + 'FontSize' => array('name' => 'FontSize', 'icon' => $path . '/images/buttons/fontSize.png', 'title' => 'Font Size', 'row' => 3), + 'TextColor' => array('name' => 'TextColor', 'icon' => $path . '/images/buttons/textColor.png', 'title' => 'Text Color', 'row' => 3), + 'BGColor' => array('name' => 'BGColor', 'icon' => $path . '/images/buttons/backgroundColor.png', 'title' => 'Background Color', 'row' => 3), + 'Maximize' => array('name' => 'Maximize', 'icon' => $path . '/images/buttons/maximize.png', 'title' => 'Maximize', 'row' => 3), + 'ShowBlocks' => array('name' => 'ShowBlocks', 'icon' => $path . '/images/buttons/showBlocks.png', 'title' => 'Show Blocks', 'row' => 3), + 'Iframe' => array('name' => 'Iframe', 'icon' => $path . '/images/buttons/iframe.png', 'title' => 'IFrame', 'row' => 3), + 'About' => array('name' => 'About', 'icon' => $path . '/images/buttons/about.png', 'title' => 'About', 'row' => 3), + '__spacer' => array('name' => FALSE, 'icon' => $path . '/images/buttons/spacer.png', 'title' => 'Spacer', 'row' => 4), + '__group' => array('name' => FALSE, 'icon' => $path . '/images/buttons/group.png', 'title' => 'Group', 'row' => 4) + ); + + if ($addPlugins === TRUE) { + $plugins = ckeditor_load_plugins(TRUE); + foreach ($plugins as $plugin_name => $plugin) { + if (!isset($plugin['buttons']) || $plugin['buttons'] == FALSE) continue; + foreach ((array) $plugin['buttons'] as $button_name => $button) { + $buttons[$button_name] = array('name' => $button_name, 'icon' => $plugin['path'] . $button['icon'], 'title' => t($button['label']), 'row' => 4); + } + } + } + + return $buttons; +} + +function ckeditor_skinframe() { + header('Content-Type: text/html; charset=utf-8'); + + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'ckeditorSkinframeCall')) { + exit; + } + + $editor_path = ckeditor_path(); + $module_drupal_path = base_path() . drupal_get_path('module', 'ckeditor'); + + $html = ""; + $html .= ""; + $html .= ""; + $html .= 'CKEditor UI Color Picker'; + $html .= ""; + $html .= ""; + $html .= ""; + $html .= ""; + $html .= "
Click the UI Color Picker button to set your color preferences.
"; + $html .= ""; + $html .= ""; + $html .= ""; + echo $html; +} \ No newline at end of file diff --git a/sites/all/modules/ckeditor/includes/ckeditor.admin.js b/sites/all/modules/ckeditor/includes/ckeditor.admin.js new file mode 100644 index 0000000..583a773 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/ckeditor.admin.js @@ -0,0 +1,83 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +$(document).ready(function() { + if (typeof(CKEDITOR) == "undefined") + return; + + $('#edit-uicolor-textarea').show(); + + Drupal.ckeditor_ver = Drupal.settings.ckeditor_version.split('.')[0]; + + Drupal.editSkinEditorInit = function() { + var skinframe_src = $('#skinframe').attr('src'); + skinframe_src = skinframe_src.replace(/skin=[^&]+/, 'skin='+$("#edit-skin").val()); + if ($('#edit-uicolor').val() == 'custom') { + skinframe_src = skinframe_src.replace(/uicolor=[^&]+/, 'uicolor='+$('input[name$="uicolor_user"]').val().replace('#', '') || 'D3D3D3'); + } + else { + skinframe_src = skinframe_src.replace(/uicolor=[^&]+/, 'uicolor=D3D3D3'); + } + $('#skinframe').attr('src', skinframe_src); + + if (Drupal.ckeditor_ver == 3) { + if ($("#edit-skin").val() == "kama") { + $("#edit-uicolor").removeAttr('disabled'); + $("#edit-uicolor").parent().removeClass('form-disabled'); + } + else { + $("#edit-uicolor").attr('disabled', 'disabled'); + $("#edit-uicolor").parent().addClass('form-disabled'); + } + } + else { + $("#edit-uicolor").removeAttr('disabled'); + $("#edit-uicolor").parent().removeClass('form-disabled'); + } + }; + Drupal.editSkinEditorInit(); + + $("#edit-skin, #edit-uicolor").bind("change", function() { + Drupal.editSkinEditorInit(); + }); + + $(".cke_load_toolbar").click(function() { + var buttons = eval('Drupal.settings.'+$(this).attr("id")); + var text = "[\n"; + for(i in buttons) { + if (typeof buttons[i] == 'string'){ + text = text + " '/',\n"; + } + else { + text = text + " ["; + max = buttons[i].length - 1; + rows = buttons.length - 1; + for (j in buttons[i]) { + if (j < max){ + text = text + "'" + buttons[i][j] + "',"; + } else { + text = text + "'" + buttons[i][j] + "'"; + } + } + if (i < rows){ + text = text + "],\n"; + } else { + text = text + "]\n"; + } + } + } + + text = text + "]"; + text = text.replace(/\['\/'\]/g,"'/'"); + $("#edit-toolbar").attr('value',text); + if (Drupal.settings.ckeditor_toolbar_wizard == 't'){ + Drupal.ckeditorToolbarReload(); + } + return false; + }); + + if (Drupal.settings.ckeditor_toolbar_wizard == 'f'){ + $("form#ckeditor-admin-profile-form textarea#edit-toolbar, form#ckeditor-admin-profile-form #edit-toolbar + .grippie, form#ckeditor-admin-global-profile-form textarea#edit-toolbar, form#ckeditor-admin-global-profile-form #edit-toolbar + .grippie").show(); + } +}); diff --git a/sites/all/modules/ckeditor/includes/ckeditor.drush.inc b/sites/all/modules/ckeditor/includes/ckeditor.drush.inc new file mode 100644 index 0000000..d2a3503 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/ckeditor.drush.inc @@ -0,0 +1,83 @@ + 'ckeditor_drush_download', + 'description' => dt('Downloads the required CKEditor library from svn.ckeditor.com.'), + 'arguments' => array( + 'path' => dt('Optional. The path to the download folder. If omitted, Drush will use the default location (sites/all/libraries/ckeditor).'), + ), + ); + return $items; +} + +/** + * Downloads + */ +function ckeditor_drush_download() { + $args = func_get_args(); + if ($args[0]) { + $path = $args[0]; + } + else { + $path = drush_get_context('DRUSH_DRUPAL_ROOT') . '/sites/all/libraries/ckeditor'; + } + + if (drush_shell_exec('svn checkout http://svn.ckeditor.com/CKEditor/releases/stable/ ' . $path)) { + drush_log(dt('CKEditor was downloaded to @path.', array('@path' => $path)), 'success'); + } + else { + drush_log(dt('Drush was unable to download CKEditor to @path.', array('@path' => $path)), 'error'); + } +} + +/** + * Implements drush_MODULE_post_COMMAND(). + */ +function drush_ckeditor_post_enable() { + $modules = func_get_args(); + if (in_array('ckeditor', $modules)) { + ckeditor_drush_download(); + } +} diff --git a/sites/all/modules/ckeditor/includes/ckeditor.features.inc b/sites/all/modules/ckeditor/includes/ckeditor.features.inc new file mode 100644 index 0000000..2130761 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/ckeditor.features.inc @@ -0,0 +1,120 @@ + $profile) { + $options[$name] = $profile->name; + } + return $options; +} + +/** + * Implementation of hook_features_export() + */ +function ckeditor_profile_features_export($data, &$export, $module_name = '') { + $pipe = array(); + foreach ((array)$data as $name) { + $profile = ckeditor_profile_load($name); + if ($profile) { + $export['features']['ckeditor_profile'][$name] = $name; + + // Write dependencies on all the roles referenced by this profile + foreach ((array) $profile->rids as $rid => $role_name) { + $pipe['user_role'][] = $role_name; + } + } + } + $export['dependencies'][] = 'ckeditor'; + return $pipe; +} + +/** + * Implementation of hook_features_export_render() + */ +function ckeditor_profile_features_export_render($module_name, $data) { + $profiles = array(); + $roles = user_roles(); + foreach ($data as $name) { + $profile = (array) ckeditor_profile_load($name); + + // Convert Role IDs into role names only + $roles = array_values((array) $profile['rids']); + if (empty($roles)) { + $profile['roles'] = array(); + } + else { + $profile['roles'] = array_combine($roles, $roles); + } + unset($profile['rids']); + + $profiles[$name] = $profile; + } + $code = ' $data = '. features_var_export($profiles, ' ') .';'. PHP_EOL; + $code .= ' return $data;'; + + return array('ckeditor_profile_defaults' => $code); +} + +/** + * Implementation of hook_features_revert() + */ +function ckeditor_profile_features_revert($module) { + if ($data = features_get_default('ckeditor_profile', $module)) { + $roles = user_roles(); + foreach ($data as $name => $profile) { + // Restore the profile settings + db_query("DELETE FROM {ckeditor_settings} WHERE name = '%s'", $name); + db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES('%s', '%s')", $name, serialize($profile['settings'])); + + // Restore the profile roles + foreach ($roles as $rid => $role_name) { + if (in_array($role_name, (array) $profile['roles'])) { + if (!db_result(db_query("SELECT rid FROM {ckeditor_role} WHERE rid = %d AND name = '%s'", $rid, $name))) { + db_query("INSERT INTO {ckeditor_role} (rid, name) VALUES(%d, '%s')", $rid, $name); + } + } + else { + // Make sure they don't have access + db_query("DELETE FROM {ckeditor_role} WHERE rid = %d AND name = '%s'", $rid, $name); + } + } + } + } +} \ No newline at end of file diff --git a/sites/all/modules/ckeditor/includes/ckeditor.lib.inc b/sites/all/modules/ckeditor/includes/ckeditor.lib.inc new file mode 100644 index 0000000..3511dc9 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/ckeditor.lib.inc @@ -0,0 +1,648 @@ += 3) { + return $document_root_dir; + } + else{ + return FALSE; + } +} + +/** + * Emulates the asp Server.mapPath function. + * Given an url path return the physical directory that it corresponds to. + * + * Returns absolute path or false on failure + * + * @param string $path + * @return @return string|boolean + */ +function ckeditor_resolve_url($path) { + if (function_exists('apache_lookup_uri')) { + $info = @apache_lookup_uri($path); + if (!$info) { + return FALSE; + } + return $info->filename . $info->path_info ; + } + + $document_root = ckeditor_get_document_root_full_path(); + if ($document_root !== FALSE) { + return $document_root . $path; + } + + return FALSE; +} + +function ckeditor_load_skin_options() { + $arr = array(); + $editor_local_path = ckeditor_path(TRUE); + $skin_dir = $editor_local_path .'/skins'; + if (is_dir($skin_dir)) { + $dh = @opendir($skin_dir); + if (FALSE !== $dh) { + while (($file = readdir($dh)) !== FALSE ) { + if (in_array($file, array(".", "..", "CVS", ".svn"))) { + continue; + } + if (is_dir($skin_dir . DIRECTORY_SEPARATOR . $file)) { + $arr[$file] = drupal_ucfirst($file); + } + } + closedir( $dh ); + } + } + + //oops, we have no information about skins, let's use only default + if (empty($arr)) { + $arr = array( + 'kama' => 'Kama', + ); + } + asort($arr); + + return $arr; +} + +/** + * Return default skin for CKEditor + * + * @return string + */ +function ckeditor_default_skin() { + $skin_options = ckeditor_load_skin_options(); + if (array_key_exists('moono', $skin_options)) { + return 'moono'; + } + if (array_key_exists('kama', $skin_options)) { + return 'kama'; + } + //if any default theme not exists select first from the list + return key(reset($skin_options)); +} + +function ckeditor_load_lang_options() { + $arr = array(); + $editor_local_path = ckeditor_path(TRUE); + $lang_file = $editor_local_path . '/lang/_languages.js'; + if (file_exists($lang_file)) { + $f = fopen($lang_file, 'r'); + $file = fread($f, filesize($lang_file)); + $tmp = explode('{', $file); + if (isset($tmp[2])) { + $tmp = explode('}', $tmp[2]); + } + $langs = explode(',', $tmp[0]); + foreach ($langs AS $lang) { + preg_match("/'?(\w+-?\w+)'?:'([\w\s\(\)]+)'/i", $lang, $matches); + if (isset($matches[1]) && isset($matches[2])) + $arr[$matches[1]] = $matches[2]; + } + } + + //oops, we have no information about languages, let's use those available in CKEditor 2.4.3 + if (empty($arr)) { + $arr = array( + 'af' => 'Afrikaans', + 'ar' => 'Arabic', + 'bg' => 'Bulgarian', + 'bn' => 'Bengali/Bangla', + 'bs' => 'Bosnian', + 'ca' => 'Catalan', + 'cs' => 'Czech', + 'da' => 'Danish', + 'de' => 'German', + 'el' => 'Greek', + 'en' => 'English', + 'en-au' => 'English (Australia)', + 'en-ca' => 'English (Canadian)', + 'en-uk' => 'English (United Kingdom)', + 'eo' => 'Esperanto', + 'es' => 'Spanish', + 'et' => 'Estonian', + 'eu' => 'Basque', + 'fa' => 'Persian', + 'fi' => 'Finnish', + 'fo' => 'Faroese', + 'fr' => 'French', + 'gl' => 'Galician', + 'he' => 'Hebrew', + 'hi' => 'Hindi', + 'hr' => 'Croatian', + 'hu' => 'Hungarian', + 'it' => 'Italian', + 'ja' => 'Japanese', + 'km' => 'Khmer', + 'ko' => 'Korean', + 'lt' => 'Lithuanian', + 'lv' => 'Latvian', + 'mn' => 'Mongolian', + 'ms' => 'Malay', + 'nb' => 'Norwegian Bokmal', + 'nl' => 'Dutch', + 'no' => 'Norwegian', + 'pl' => 'Polish', + 'pt' => 'Portuguese (Portugal)', + 'pt-br' => 'Portuguese (Brazil)', + 'ro' => 'Romanian', + 'ru' => 'Russian', + 'sk' => 'Slovak', + 'sl' => 'Slovenian', + 'sr' => 'Serbian (Cyrillic)', + 'sr-latn' => 'Serbian (Latin)', + 'sv' => 'Swedish', + 'th' => 'Thai', + 'tr' => 'Turkish', + 'uk' => 'Ukrainian', + 'vi' => 'Vietnamese', + 'zh' => 'Chinese Traditional', + 'zh-cn' => 'Chinese Simplified', + ); + } + + asort($arr); + + return $arr; +} + +/** + * List of CKEditor plugins + * + * @return array + */ +function ckeditor_load_plugins($render = FALSE) { + $arr = array(); + $base_path = '%base_path%'; + $editor_path = '%editor_path%'; + $ckeditor_path = '%ckeditor_path%'; + $plugin_dir = '%plugin_dir%'; + $plugin_dir_additional = '%plugin_dir_extra%'; + $pattern = '#\.addButton\([\s]*[\'"](.*?)[\'"][\s]*\,[\s]*\{[\s]*(.*?)[\s]*\}#s'; + + /* + * External plugins + */ + if (module_exists('ckeditor_swf') && file_exists(drupal_get_path('module', 'ckeditor_swf') . '/plugins/swf/plugin.js')) { + $arr['ckeditor_swf'] = array( + 'name' => 'swf', + 'desc' => t('Support for the CKEditor SWF module'), + 'path' => $base_path . drupal_get_path('module', 'ckeditor_swf') . '/plugins/swf/', + 'buttons' => FALSE, + 'default' => 't' + ); + } + + if (module_exists('ckeditor_link') && file_exists(drupal_get_path('module', 'ckeditor_link') . '/plugins/link/plugin.js')) { + $arr['ckeditor_link'] = array( + 'name' => 'drupal_path', + 'desc' => t('Support for the CKEditor Link module'), + 'path' => $base_path . drupal_get_path('module', 'ckeditor_link') . '/plugins/link/', + 'buttons' => FALSE, + 'default' => 't' + ); + } + + if (module_exists('linkit') && file_exists(drupal_get_path('module', 'linkit') . '/editors/ckeditor/plugin.js')) { + $arr['linkit'] = array( + 'name' => 'Linkit', + 'desc' => t('Support for the Linkit module (buttons: Linkit)'), + 'path' => $base_path . drupal_get_path('module', 'linkit') . '/editors/ckeditor/', + 'buttons' => array( + 'Linkit' => array( + 'title' => 'Linkit', + 'icon' => $base_path . drupal_get_path('module', 'linkit') . '/editors/ckeditor/linkit.png' + ) + ), + 'default' => 't' + ); + } + + /* + * CKEditor build-in plugins + */ + $_editor_path = ckeditor_path(TRUE) . '/'; + if (file_exists($_editor_path . 'plugins/tableresize/plugin.js')) { + $arr['tableresize'] = array( + 'name' => 'tableresize', + 'desc' => t('Table Resize plugin'), + 'path' => $base_path . $editor_path . 'plugins/tableresize/', + 'buttons' => FALSE, + 'default' => 't' + ); + } + + if (file_exists($_editor_path . 'plugins/autogrow/plugin.js')) { + $arr['autogrow'] = array( + 'name' => 'autogrow', + 'desc' => t('Auto Grow plugin'), + 'path' => $base_path . $editor_path . 'plugins/autogrow/', + 'buttons' => FALSE, + 'default' => 'f' + ); + } + + if (file_exists($_editor_path . 'plugins/stylesheetparser/plugin.js')) { + $arr['stylesheetparser'] = array( + 'name' => 'stylesheetparser', + 'desc' => t('Stylesheet Parser plugin'), + 'path' => $base_path . $editor_path . 'plugins/stylesheetparser/', + 'buttons' => FALSE, + 'default' => 'f' + ); +} + + /* + * CKEditor module plugins + */ + $_plugin_dir = drupal_get_path('module', 'ckeditor') . '/plugins/'; + if (is_dir($_plugin_dir) && $handle = opendir($_plugin_dir)) { + while (false !== ($file = readdir($handle))) { + if (is_dir($_plugin_dir . $file) && file_exists($_plugin_dir . $file . '/plugin.js')) { + $source = file_get_contents($_plugin_dir . $file . '/plugin.js'); + $buttons = array(); + if (preg_match_all($pattern, $source, $matches)) { + foreach ($matches[1] as $i => $button_name) { + if (preg_match('#(icon)[\s]*\:[\s]*([^\,\n]*)#', $matches[2][$i], $matches2)) { + $buttons[$button_name] = array(); + $buttons[$button_name]['label'] = $button_name; + $matches2[2] = str_replace(array('this.path', '+', '\'', '"'), array('', '', '', ''), $matches2[2]); + $buttons[$button_name]['icon'] = trim($matches2[2]); + } + } + } + if (preg_match('#@file ([^\n\r]*)#', $source, $matches)) { + $arr[$file] = array( + 'name' => $file, + 'desc' => t($matches[1]), + 'path' => $base_path . $plugin_dir . $file . '/', + 'buttons' => (count($buttons) > 0) ? $buttons : FALSE, + 'default' => 'f' + ); + } + else { + $arr[$file] = array( + 'name' => $file, + 'desc' => t('Plugin file: ' . $file), + 'path' => $base_path . $plugin_dir . $file . '/', + 'buttons' => (count($buttons) > 0) ? $buttons : FALSE, + 'default' => 'f' + ); + } + } + } + + closedir($handle); + } + + /* + * CKEditor module plugins - additional directory + */ + $_plugin_dir_additional = ckeditor_plugins_path(TRUE) . '/'; + if ($_plugin_dir != $_plugin_dir_additional && is_dir($_plugin_dir_additional) && $handle = opendir($_plugin_dir_additional)) { + while (false !== ($file = readdir($handle))) { + if (is_dir($_plugin_dir_additional . $file) && file_exists($_plugin_dir_additional . $file . '/plugin.js')) { + $source = file_get_contents($_plugin_dir_additional . $file . '/plugin.js'); + $buttons = array(); + if (preg_match_all($pattern, $source, $matches)) { + foreach ($matches[1] as $i => $button_name) { + if (preg_match('#(icon)[\s]*\:[\s]*([^\,\n]*)#', $matches[2][$i], $matches2)) { + $buttons[$button_name] = array(); + $buttons[$button_name]['label'] = $button_name; + $matches2[2] = str_replace(array('this.path', '+', '\'', '"'), array('', '', '', ''), $matches2[2]); + $buttons[$button_name]['icon'] = trim($matches2[2]); + } + } + } + if (preg_match('#@file ([^\n\r]*)#', $source, $matches)) { + $arr[$file] = array( + 'name' => $file, + 'desc' => t($matches[1]), + 'path' => $base_path . $plugin_dir_additional . $file . '/', + 'buttons' => (count($buttons) > 0) ? $buttons : FALSE, + 'default' => 'f' + ); + } + else { + $arr[$file] = array( + 'name' => $file, + 'desc' => t('Plugin file: ' . $file), + 'path' => $base_path . $plugin_dir_additional . $file . '/', + 'buttons' => (count($buttons) > 0) ? $buttons : FALSE, + 'default' => 'f' + ); + } + } + } + + closedir($handle); + } + + /* + * CKEditor plugins registered by hook + */ + $plugins = module_invoke_all('ckeditor_plugin'); + + foreach ($plugins as $i => $plugin) { + if (file_exists($plugin['path'] . 'plugin.js')) { + $source = file_get_contents($plugin['path'] . 'plugin.js'); + $plugins[$i]['path'] = $base_path . $plugin['path']; + if (!isset($plugin['buttons']) || count($plugin['buttons']) == 0) { + $buttons = array(); + if (preg_match_all($pattern, $source, $matches)) { + foreach ($matches[1] as $j => $button_name) { + if (preg_match('#(icon)[\s]*\:[\s]*([^\,\n]*)#', $matches[2][$j], $matches2)) { + $buttons[$button_name] = array(); + $buttons[$button_name]['label'] = $button_name; + $matches2[2] = str_replace(array('this.path', '+', '\'', '"'), array('', '', '', ''), $matches2[2]); + $buttons[$button_name]['icon'] = trim($matches2[2]); + } + } + } + $plugins[$i]['buttons'] = (count($buttons) > 0) ? $buttons : FALSE; + } + } + else { + unset($plugins[$i]); + } + } + $arr = array_merge($arr, $plugins); + + if (isset($arr['linktomenu']) && module_exists('linktocontent') == FALSE) { + unset($arr['linktomenu']); + } + + if (isset($arr['linktonode']) && module_exists('linktocontent') == FALSE) { + unset($arr['linktonode']); + } + + if (isset($arr['imce']) && module_exists('imce') == FALSE) { + unset($arr['imce']); + } + + //remove page break button if there is no module to do this + if (isset($arr['drupalbreaks']['buttons']['DrupalPageBreak']) && !module_exists('paging') && !module_exists('pagebreak')) { + unset($arr['drupalbreaks']['buttons']['DrupalPageBreak']); + } + + if (isset($arr['drupalbreaks'])) { + $arr['drupalbreaks']['default'] = 't'; + } + + ksort($arr); + + if ($render === TRUE) { + $arr = ckeditor_plugins_render($arr); + } + + return $arr; +} + +/** + * Render CKEditor plugins path + */ +function ckeditor_plugins_render($plugins) { + $render = array(); + $render["%base_path%"] = base_path(); + $render["%editor_path%"] = ckeditor_path(TRUE) . '/'; + $render["%ckeditor_path%"] = drupal_get_path('module', 'ckeditor') . '/'; + $render["%plugin_dir%"] = $render["%ckeditor_path%"] . 'plugins/'; + $render["%plugin_dir_extra%"] = ckeditor_plugins_path(TRUE) . '/'; + + foreach ((array) $plugins as $i => $plugin) { + $plugins[$i]['path'] = str_replace(array_keys($render), array_values($render), $plugin['path']); + } + + return $plugins; +} + + +function ckeditor_user_get_setting($user, $profile, $setting) { + $default = array( + 'default' => 't', + 'show_toggle' => 't', + 'popup' => 'f', + 'toolbar' => 'default', + 'width' => '100%', + 'lang' => 'en', + 'auto_lang' => 't', + ); + + if ($profile->settings['allow_user_conf']) { + $status = isset($user->{'ckeditor_'. $setting}) ? $user->{'ckeditor_'. $setting} : (isset($profile->settings[$setting]) ? $profile->settings[$setting] : $default[$setting]); + } + else { + $status = isset($profile->settings[$setting]) ? $profile->settings[$setting] : $default[$setting]; + } + + return $status; +} + +function ckeditor_user_get_profile($user, $element_id = 'edit-body', $url = NULL) { + $rids = array(); + if (is_null($url)) { + $url = $_GET['q']; + } + // Since ckeditor_profile_load() makes a db hit, only call it when we're pretty sure + // we're gonna render ckeditor. + $sorted_roles = ckeditor_sorted_roles(); + foreach (array_keys($sorted_roles) as $rid) { + if (isset($user->roles[$rid])) { + $rids[] = $rid; + } + } + + if ($user->uid == 1 && !sizeof($rids)) { + $r = db_fetch_object(db_query_range("SELECT r.rid FROM {ckeditor_role} r ORDER BY r.rid DESC", 1)); + $rids[] = $r->rid; + } + + $profile_names = array(); + if (sizeof($rids)) { + $result = db_query("SELECT r.rid, s.name FROM {ckeditor_settings} s INNER JOIN {ckeditor_role} r ON r.name = s.name WHERE r.rid IN (". implode(",", $rids) .")"); + while (($row = db_fetch_array($result))) { + if (!isset($profile_names[$row['rid']])) { + $profile_names[$row['rid']] = array(); + } + array_push($profile_names[$row['rid']], $row['name']); + } + } + + foreach ($rids as $rid) { + if (!empty($profile_names[$rid])) { + foreach ($profile_names[$rid] as $profile_name) { + $profile = ckeditor_profile_load($profile_name); + + $conf = $profile->settings; + $enabled = ckeditor_is_enabled(empty($conf['excl_mode']) ? '0' : $conf['excl_mode'], empty($conf['excl_regex']) ? '' : $conf['excl_regex'], $element_id, $url); + + if ($enabled) { + return $profile; + } + } + } + } + + return FALSE; +} + +/** + * sort roles according to precedence settings. previously sorted roles are followed by latest added roles. + */ +function ckeditor_sorted_roles($clear = FALSE) { + static $order; + if (isset($order) && $clear !== TRUE) { + return $order; + } + $order = array(); + $roles = user_roles(0, 'access ckeditor'); + + $result = db_query("SELECT settings FROM {ckeditor_settings} WHERE name='CKEditor Global Profile'"); + $data = db_fetch_object($result); + if (!empty($data->settings)) { + $settings = unserialize($data->settings); + if (isset($settings['rank']) && !empty($settings['rank'])) + foreach ($settings['rank'] as $rid) { + if (isset($roles[$rid])) { + $order[$rid] = $roles[$rid]; + unset($roles[$rid]); + } + } + } + krsort($roles);//sort the remaining unsorted roles by id, descending. + $order += $roles; + return $order; +} + +/** + * @param int $excl_mode 1/include, exclude otherwise + * @param string $excl_regex paths (drupal paths with ids attached) + * @param string $element_id current ID + * @param string $get_q current path + * + * @return boolean + * returns true if CKEditor is enabled + */ +function ckeditor_is_enabled($excl_mode, $excl_regex, $element_id, $get_q) { + global $theme; + + $front = variable_get('site_frontpage', 'node'); + $excl_regex = str_replace('', $front, $excl_regex); + $nodetype = ckeditor_get_nodetype($get_q); + $element_id = str_replace('.', '\.', $element_id); + + $match = !empty($excl_regex) && preg_match($excl_regex, $theme . ':' . $nodetype .'@'. $get_q .'.'. $element_id); + + return ($excl_mode == '0' xor $match); +} + +function _ckeditor_script_path() { + $jspath = FALSE; + $module_path=drupal_get_path('module', 'ckeditor'); + + if (file_exists($module_path . '/ckeditor/ckeditor.js')) { + $jspath='%m/ckeditor'; + } + elseif (file_exists($module_path . '/ckeditor/ckeditor/ckeditor.js')) { + $jspath='%m/ckeditor/ckeditor'; + } + elseif (file_exists('sites/all/libraries/ckeditor/ckeditor.js')) { + $jspath='%b/sites/all/libraries/ckeditor'; + } + return $jspath; +} + +/** + * Determines whether the CKEditor sources are present + * + * It checks if ckeditor.js is present. + * + * This function is used by ckeditor_requirements() + * + * @return boolean True if CKEditor is installed + */ +function _ckeditor_requirements_isinstalled() { + $editor_path = ckeditor_path(TRUE); + $jspath = $editor_path .'/ckeditor.js'; + $jsp=file_exists($jspath); + if (!$jsp && ($editor_path = _ckeditor_script_path())) { + $result = db_query("SELECT name, settings FROM {ckeditor_settings} WHERE name = 'CKEditor Global Profile'"); + if ($rs=db_fetch_array($result)) { + $rs['settings']=unserialize($rs['settings']); + $rs['settings']['ckeditor_path']=$editor_path; + $rs['settings']=serialize($rs['settings']); + db_query("UPDATE {ckeditor_settings} SET settings='%s' WHERE name = 'CKEditor Global Profile'", $rs['settings']); + $jsp=TRUE; + ckeditor_path(TRUE, TRUE); + } + } + return $jsp; +} diff --git a/sites/all/modules/ckeditor/includes/ckeditor.page.inc b/sites/all/modules/ckeditor/includes/ckeditor.page.inc new file mode 100644 index 0000000..75f839d --- /dev/null +++ b/sites/all/modules/ckeditor/includes/ckeditor.page.inc @@ -0,0 +1,374 @@ +'. t('CKEditor is highly configurable. The most commonly used features are listed below. You can also adjust CKEditor to your needs by changing the !ckeditor_module_config configuration file.', + array( + '!ckeditor_module_config' => '' . drupal_get_path('module', 'ckeditor') .'/ckeditor.config.js', + )) . + '

' . + '

' . + t('It is recommended to not edit the !ckeditor_config_file (!ckeditor_config_path) configuration file that is distributed with CKEditor, because you may overwrite it accidentally when you update the editor.', + array( + '!ckeditor_config_path' => '' . drupal_get_path('module', 'ckeditor') .'/ckeditor/config.js', + '!ckeditor_config_file' => 'config.js', + )) .'

'; + break; + + case 'admin/settings/ckeditor/editg': + case 'admin/settings/ckeditor/add': + $output = '

' . t('The Global Profile allows you to define settings that are common for all profiles. Values defined in other profiles will be appended to the global configuration. This way you can avoid repeating some of the settings that are usually the same for each profile.') . '

'; + break; + + case 'admin/settings/ckeditor': + $output = + '

'. t('The CKEditor module allows Drupal to replace textarea fields with CKEditor. CKEditor is an online rich text editor that can be embedded inside web pages. It is a !wysiwyg editor which means that the text edited in it looks as similar as possible to the results end users will see after the document gets published. It brings to the Web popular editing features found in desktop word processors such as Microsoft Word and OpenOffice.org Writer. CKEditor is truly lightweight and does not require any kind of installation on the client computer.', + array( + '!wysiwyg' => ''. t('WYSIWYG') .'', + ) + ) . + '

' . + t('More information about the editor can be found at the !ckeditorlink. A handy !userguidelink is available, too.', + array( + '!ckeditorlink' => l(t('CKEditor website'), 'http://ckeditor.com'), + '!userguidelink' => l(t('User\'s Guide'), 'http://docs.cksource.com/CKEditor_3.x/Users_Guide'), + ) + ) . + '

' . + t('Profiles can be defined based on user roles. A CKEditor profile may define which pages receive the CKEditor support, which buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor functions. It is also possible to define the Global Profile that will store values which will be appended to all other profiles.') . + '

' . + t('Please note that only users with the "%accesspermission" !permissionlink will be able to use CKEditor.', + array( + '%accesspermission' => t('access ckeditor'), + '!permissionlink' => l(t('permission'), 'admin/user/permissions') + ) + ) . + '

'; + break; + + case 'admin/help#ckeditor': + $output = + '

' . t('Introduction') . '

' . + '

' . + t('The CKEditor module allows Drupal to replace textarea fields with CKEditor. CKEditor is an online rich text editor that can be embedded inside web pages. It is a !wysiwyg editor which means that the text edited in it looks as similar as possible to the results end users will see after the document gets published. It brings to the Web popular editing features found in desktop word processors such as Microsoft Word and OpenOffice.org Writer. CKEditor is truly lightweight and does not require any kind of installation on the client computer.', + array( + '!wysiwyg' => '' . t('WYSIWYG') . '', + ) + ) . + '

' . + t('More information about the editor can be found at the !ckeditorlink. A handy !userguidelink is available, too.', + array( + '!ckeditorlink' => l(t('CKEditor website'), 'http://ckeditor.com'), + '!userguidelink' => l(t('User\'s Guide'), 'http://docs.cksource.com/CKEditor_3.x/Users_Guide'), + ) + ) . + '

' . + '

' . t('Configuration') . '

' . + '
    ' . + '
  1. '. + t('To start using CKEditor, first you need to grant permissions for use of CKEditor in the !adminpath section.', + array( + '!adminpath' => l(t('Administer') .' > '. t('User management') .' > '. t('Permissions'), 'admin/user/permissions'), + ) + ) . + '
  2. ' . + '
  3. ' . + t('CKEditor profiles can be configured in the !adminpath section. In each profile you can choose which textareas will be replaced by CKEditor as well as select the default toolbar and configure some more advanced settings.', + array( + '!adminpath' => l(t('Administer') .' > '. t('Site configuration') .' > '. t('CKEditor'), 'admin/settings/ckeditor'), + ) + ) . + '
  4. ' . + '
  5. ' . + t('For the Rich Text Editing to work you also need to configure your !filterlink for the users that may access Rich Text Editing. Either grant those users Full HTML access or use the following list of tags in the HTML filter:', + array( + '!filterlink' => l(t('filters'), 'admin/settings/filters'), + ) + ) . + '
    '. htmlspecialchars('




      1. ').appendTo('#nodelist tbody'); + tr.hover( function() { + if (!selectedNode || this != selectedNode) + $(this).css('background', '#cecece'); + }, function() { + if (!selectedNode || this != selectedNode) + $(this).css('background', 'transparent'); + }); + tr.click( function() { + selectRow(this); + }); + + $('').appendTo(tr); + $('').appendTo(tr); +} + +/** + * make the nodelist accessible by keyboard + **/ +$('.accessible').keypress( function(e) { + switch (e.keyCode) { + case 39: + case 40: // move selection down + if (selectedNode == null) + selectedNode = $('#nodelist tbody tr').get(0); + else + selectedNode = $(selectedNode).next('tr').get(0); + selectRow(selectedNode); + break; + case 37: + case 38: // move selection up + if (selectedNode == null) + selectedNode = $('#nodelist tbody tr').get($('#nodelist tbody tr').length - 1); + else + selectedNode = $(selectedNode).prev('tr').get(0); + selectRow(selectedNode); + break; + } + }); + +// options +$.fn.addOption = function() { + if (arguments.length == 0) + return this; + // select option when added? default is false + var selectOption = false; + // multiple items + var multiple = false; + if (typeof arguments[0] == "object") { + multiple = true; + var items = arguments[0]; + } + if (arguments.length >= 2) { + if (typeof arguments[1] == "boolean") + selectOption = arguments[1]; + else if (typeof arguments[2] == "boolean") + selectOption = arguments[2]; + if (!multiple) { + var value = arguments[0]; + var text = arguments[1]; + } + } + this.each( function() { + if (this.nodeName.toLowerCase() != "select") + return; + if (multiple) { + for (v in items) { + $(this).addOption(v, items[v], selectOption); + } + } else { + var option = document.createElement("option"); + option.value = value; + option.text = text; + this.options.add(option); + } + if (selectOption) { + this.options[this.options.length - 1].selected = true; + } + }) + return this; +} + +$.fn.removeOption = function() { + if (arguments.length == 0) + return this; + if (typeof arguments[0] == "string") + var value = arguments[0]; + else if (typeof arguments[0] == "number") + var index = arguments[0]; + else + return this; + this.each( function() { + if (this.nodeName.toLowerCase() != "select") + return; + if (value) { + var optionsLength = this.options.length; + for ( var i = optionsLength - 1; i >= 0; i--) { + if (this.options[i].value == value) { + this.options[i] = null; + } + } + } else { + this.remove(index); + } + }) + return this; +} diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/plugin.js b/sites/all/modules/ckeditor/plugins/linktomenu/plugin.js new file mode 100644 index 0000000..fd300c0 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktomenu/plugin.js @@ -0,0 +1,56 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.add( 'linktomenu', +{ + init : function( editor ) + { + // Add the link and unlink buttons. + editor.addCommand( 'linktomenu', new CKEDITOR.dialogCommand( 'linktomenu' ) ); + editor.ui.addButton( 'LinkToMenu', + { + label : 'Link to menu', + icon : this.path + 'images/linktomenu.gif', + command : 'linktomenu' + } ); + CKEDITOR.dialog.add( 'linktomenu', this.path + 'dialogs/link.js' ); + + // If the "menu" plugin is loaded, register the menu items. + if ( editor.addMenuItems ) + { + editor.addMenuItems( + { + linktomenu : + { + label : 'Link to menu', + command : 'linktomenu', + group : 'linktomenu', + order : 1 + } + }); + } + + // If the "contextmenu" plugin is loaded, register the listeners. + if ( editor.contextMenu ) + { + editor.contextMenu.addListener( function( element, selection ) + { + if ( !element ) + return null; + + var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' ); + + if ( !isAnchor ) + { + if ( !( element = element.getAscendant( 'a', true ) ) ) + return null; + + isAnchor = ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) ); + } + + return { linktomenu : CKEDITOR.TRISTATE_OFF }; + }); + } + } +} ); diff --git a/sites/all/modules/ckeditor/plugins/linktonode/css/linktocontent.css b/sites/all/modules/ckeditor/plugins/linktonode/css/linktocontent.css new file mode 100644 index 0000000..04cde34 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktonode/css/linktocontent.css @@ -0,0 +1,60 @@ +form { padding: 0; margin: 0; } + +.panel_wrapper { display: none; } +/* +.panel_wrap { + border: 1px solid #919b9c; + border-top: 0; + padding: .5em 0; + margin: 0; + background: #fff; + float: left; + width: 100%; +}*/ +.panel_wrap .panel { display: none; } +.panel_wrap .current { display: block; width: 100%; height: auto; } + +label { margin-bottom: .5em; display: block; } + +#form_browse { margin: 0 .5em; } + +.mceActionPanel { float: left; margin: .5em 0 0 0; } + +.panel_wrap .nodes { margin: 0 .5em; padding: 0; } + +#nodelist +{ + padding: 0; + height: 13.5em; + width: 96%; + overflow: auto; + border: #D5D59D; +} + + th { font-size:11px; border-bottom: 1px solid #D5D59D; } + td { text-align: left; padding: .05em .5em .05em 0; white-space: nowrap; } + + tr { cursor: pointer; } + tr.head { cursor: auto; } + td.nid { display: none; } + + #statusImg + { + display: block; + position: absolute; + left: 15px; + top: 125px; + width: 90%; + font-size: 14px; + color: #333333; + width: auto; + padding-right: .5em; + line-height: 82px; + vertical-align: middle; + } + + #statusImg img + { + margin: 36px 10px; + float: left; + } \ No newline at end of file diff --git a/sites/all/modules/ckeditor/plugins/linktonode/dialogs/link.js b/sites/all/modules/ckeditor/plugins/linktonode/dialogs/link.js new file mode 100644 index 0000000..1a2ad13 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktonode/dialogs/link.js @@ -0,0 +1,908 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.dialog.add( 'linktonode', function( editor ) +{ + // + CKEDITOR.scriptLoader.load( Drupal.settings.basePath + "misc/jquery.js"); + CKEDITOR.scriptLoader.load( Drupal.settings.ckeditor.module_path + "/plugins/linktonode/jscripts/functions.js", function() { + //window.focus(); + loadCategories(null); + }); + // + + // Handles the event when the "Target" selection box is changed. + var targetChanged = function() + { + var dialog = this.getDialog(), + popupFeatures = dialog.getContentElement( 'target', 'popupFeatures' ), + targetName = dialog.getContentElement( 'target', 'linkTargetName' ), + value = this.getValue(); + + if ( !popupFeatures || !targetName ) + return; + + popupFeatures = popupFeatures.getElement(); + + if ( value == 'popup' ) + { + popupFeatures.show(); + targetName.setLabel( editor.lang.link.targetPopupName ); + } + else + { + popupFeatures.hide(); + targetName.setLabel( editor.lang.link.targetFrameName ); + this.getDialog().setValueOf( 'target', 'linkTargetName', value.charAt( 0 ) == '_' ? value : '' ); + } + }; + + // Loads the parameters in a selected link to the link dialog fields. + var emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/, + emailSubjectRegex = /subject=([^;?:@&=$,\/]*)/, + emailBodyRegex = /body=([^;?:@&=$,\/]*)/, + anchorRegex = /^#(.*)$/, + urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/, + selectableTargets = /^(_(?:self|top|parent|blank))$/; + + var popupRegex = + /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/; + var popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi; + + var parseLink = function( editor, element ) + { + var href = element ? ( element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) : '', + emailMatch = '', + anchorMatch = '', + urlMatch = false, + retval = {}; + + if ( href ) + { + emailMatch = href.match( emailRegex ); + anchorMatch = href.match( anchorRegex ); + urlMatch = href.match( urlRegex ); + } + + // Load the link type and URL. + if ( emailMatch ) + { + var subjectMatch = href.match( emailSubjectRegex ), + bodyMatch = href.match( emailBodyRegex ); + retval.type = 'email'; + retval.email = {}; + retval.email.address = emailMatch[1]; + subjectMatch && ( retval.email.subject = decodeURIComponent( subjectMatch[1] ) ); + bodyMatch && ( retval.email.body = decodeURIComponent( bodyMatch[1] ) ); + } + else if ( anchorMatch ) + { + retval.type = 'anchor'; + retval.anchor = {}; + retval.anchor.name = retval.anchor.id = anchorMatch[1]; + } + else if ( href && urlMatch ) // urlRegex matches empty strings, so need to check for href as well. + { + retval.type = 'url'; + retval.url = {}; + retval.url.protocol = urlMatch[1]; + retval.url.url = urlMatch[2]; + } + else + retval.type = 'url'; + + // Load target and popup settings. + if ( element ) + { + var target = element.getAttribute( 'target' ); + retval.target = {}; + retval.adv = {}; + + // IE BUG: target attribute is an empty string instead of null in IE if it's not set. + if ( !target ) + { + var onclick = element.getAttribute( '_cke_pa_onclick' ) || element.getAttribute( 'onclick' ), + onclickMatch = onclick && onclick.match( popupRegex ); + if ( onclickMatch ) + { + retval.target.type = 'popup'; + retval.target.name = onclickMatch[1]; + + var featureMatch; + while ( ( featureMatch = popupFeaturesRegex.exec( onclickMatch[2] ) ) ) + { + if ( featureMatch[2] == 'yes' || featureMatch[2] == '1' ) + retval.target[ featureMatch[1] ] = true; + else if ( isFinite( featureMatch[2] ) ) + retval.target[ featureMatch[1] ] = featureMatch[2]; + } + } + } + else + { + var targetMatch = target.match( selectableTargets ); + if ( targetMatch ) + retval.target.type = retval.target.name = target; + else + { + retval.target.type = 'frame'; + retval.target.name = target; + } + } + + var me = this; + var advAttr = function( inputName, attrName ) + { + var value = element.getAttribute( attrName ); + if ( value !== null ) + retval.adv[ inputName ] = value || ''; + }; + advAttr( 'advId', 'id' ); + advAttr( 'advLangDir', 'dir' ); + advAttr( 'advAccessKey', 'accessKey' ); + advAttr( 'advName', 'name' ); + advAttr( 'advLangCode', 'lang' ); + advAttr( 'advTabIndex', 'tabindex' ); + advAttr( 'advTitle', 'title' ); + advAttr( 'advContentType', 'type' ); + advAttr( 'advCSSClasses', 'class' ); + advAttr( 'advCharset', 'charset' ); + advAttr( 'advStyles', 'style' ); + } + + // Find out whether we have any anchors in the editor. + // Get all IMG elements in CK document. + var elements = editor.document.getElementsByTag( 'img' ), + realAnchors = new CKEDITOR.dom.nodeList( editor.document.$.anchors ), + anchors = retval.anchors = []; + + for( var i = 0; i < elements.count() ; i++ ) + { + var item = elements.getItem( i ); + if ( item.getAttribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type' ) == 'anchor' ) + { + anchors.push( editor.restoreRealElement( item ) ); + } + } + + for ( i = 0 ; i < realAnchors.count() ; i++ ) + anchors.push( realAnchors.getItem( i ) ); + + for ( i = 0 ; i < anchors.length ; i++ ) + { + item = anchors[ i ]; + anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) }; + } + + // Record down the selected element in the dialog. + this._.selectedElement = element; + + return retval; + }; + + var setupParams = function( page, data ) + { + if ( data[page] ) + this.setValue( data[page][this.id] || '' ); + }; + + var setupPopupParams = function( data ) + { + return setupParams.call( this, 'target', data ); + }; + + var setupAdvParams = function( data ) + { + return setupParams.call( this, 'adv', data ); + }; + + var commitParams = function( page, data ) + { + if ( !data[page] ) + data[page] = {}; + + data[page][this.id] = this.getValue() || ''; + }; + + var commitPopupParams = function( data ) + { + return commitParams.call( this, 'target', data ); + }; + + var commitAdvParams = function( data ) + { + return commitParams.call( this, 'adv', data ); + }; + + return { + title : 'Link to node', + minWidth : 350, + minHeight : 230, + contents : [ + { + id : 'info', + label : editor.lang.link.info, + title : editor.lang.link.info, + elements : + [ + { + type : 'vbox', + id : 'urlOptions', + children : + [ + { + type : 'hbox', + widths : [ '25%', '75%' ], + children : + [ + { + id : 'linkType', + type : 'select', + label : editor.lang.link.type, + hidden : !Drupal.settings.ckeditor.linktocontent_node_select_type, + 'default' : 'url', + items : + [ + [ 'path', 'path' ], + [ 'internal', 'internal' ], + ], + onChange : function() { + var url = this.getDialog().getContentElement( 'info', 'url' ); + if ( ( !Drupal.settings.ckeditor.linktocontent_node_select_type && Drupal.settings.ckeditor.linktocontent_node_path_filter ) + || this.getValue() == 'internal' ) { + url.setValue($('#txtUrlInternal').val()); + } + else { + url.setValue($('#txtUrlPath').val()); + } + }, + setup : function( data ) + { + if ( data.type ) + this.setValue( data.type ); + }, + commit : function( data ) + { + data.type = this.getValue(); + } + }, + { + type : 'text', + id : 'url', + label : editor.lang.common.url, + onLoad : function () + { + this.allowOnChange = true; + }, + validate : function() + { + var dialog = this.getDialog(); + var func = CKEDITOR.dialog.validate.notEmpty( editor.lang.link.noUrl ); + return func.apply( this ); + }, + setup : function( data ) + { + this.allowOnChange = false; + if ( data.url ) + this.setValue( data.url.url ); + this.allowOnChange = true; + + var linkType = this.getDialog().getContentElement( 'info', 'linkType' ); + if ( linkType && linkType.getValue() == 'url' ) + this.select(); + + }, + commit : function( data ) + { + if ( !data.url ) + data.url = {}; + + data.url.url = this.getValue(); + this.allowOnChange = false; + } + } + ], + setup : function( data ) + { + if ( !this.getDialog().getContentElement( 'info', 'linkType' ) ) + this.getElement().show(); + } + } + ] + }, + { + type : 'html', + html : + '' + + '
        ' + + '
        ' + + '
        ' + + '
         
        ': +"");b._keyEvent=false;return D},_generateMonthYearHeader:function(b,f,j,l,o,n,k,m){var p=this._get(b,"changeMonth"),q=this._get(b,"changeYear"),s=this._get(b,"showMonthAfterYear"),r='
        ',u="";if(n||!p)u+=''+k[f]+"";else{k=l&&l.getFullYear()==j;var v=o&&o.getFullYear()==j;u+='"}s||(r+=u+(n||!(p&&q)?" ":""));if(!b.yearshtml){b.yearshtml="";if(n||!q)r+=''+j+"";else{m=this._get(b,"yearRange").split(":");var x=(new Date).getFullYear();k=function(y){y=y.match(/c[+-].*/)?j+parseInt(y.substring(1),10):y.match(/[+-].*/)?x+parseInt(y,10):parseInt(y,10);return isNaN(y)?x:y};f=k(m[0]);m=Math.max(f,k(m[1]||""));f=l?Math.max(f, +l.getFullYear()):f;m=o?Math.min(m,o.getFullYear()):m;for(b.yearshtml+='";r+=b.yearshtml;b.yearshtml=null}}r+=this._get(b,"yearSuffix");if(s)r+=(n||!(p&&q)?" ":"")+u;r+="
        ";return r},_adjustInstDate:function(b,f,j){var l=b.drawYear+(j=="Y"?f:0),o=b.drawMonth+ +(j=="M"?f:0);f=Math.min(b.selectedDay,this._getDaysInMonth(l,o))+(j=="D"?f:0);l=this._restrictMinMax(b,this._daylightSavingAdjust(new Date(l,o,f)));b.selectedDay=l.getDate();b.drawMonth=b.selectedMonth=l.getMonth();b.drawYear=b.selectedYear=l.getFullYear();if(j=="M"||j=="Y")this._notifyChange(b)},_restrictMinMax:function(b,f){var j=this._getMinMaxDate(b,"min");b=this._getMinMaxDate(b,"max");f=j&&fb?b:f},_notifyChange:function(b){var f=this._get(b,"onChangeMonthYear");if(f)f.apply(b.input? +b.input[0]:null,[b.selectedYear,b.selectedMonth+1,b])},_getNumberOfMonths:function(b){b=this._get(b,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(b,f){return this._determineDate(b,this._get(b,f+"Date"),null)},_getDaysInMonth:function(b,f){return 32-this._daylightSavingAdjust(new Date(b,f,32)).getDate()},_getFirstDayOfMonth:function(b,f){return(new Date(b,f,1)).getDay()},_canAdjustMonth:function(b,f,j,l){var o=this._getNumberOfMonths(b);j=this._daylightSavingAdjust(new Date(j, +l+(f<0?f:o[0]*o[1]),1));f<0&&j.setDate(this._getDaysInMonth(j.getFullYear(),j.getMonth()));return this._isInRange(b,j)},_isInRange:function(b,f){var j=this._getMinMaxDate(b,"min");b=this._getMinMaxDate(b,"max");return(!j||f.getTime()>=j.getTime())&&(!b||f.getTime()<=b.getTime())},_getFormatConfig:function(b){var f=this._get(b,"shortYearCutoff");f=typeof f!="string"?f:(new Date).getFullYear()%100+parseInt(f,10);return{shortYearCutoff:f,dayNamesShort:this._get(b,"dayNamesShort"),dayNames:this._get(b, +"dayNames"),monthNamesShort:this._get(b,"monthNamesShort"),monthNames:this._get(b,"monthNames")}},_formatDate:function(b,f,j,l){if(!f){b.currentDay=b.selectedDay;b.currentMonth=b.selectedMonth;b.currentYear=b.selectedYear}f=f?typeof f=="object"?f:this._daylightSavingAdjust(new Date(l,j,f)):this._daylightSavingAdjust(new Date(b.currentYear,b.currentMonth,b.currentDay));return this.formatDate(this._get(b,"dateFormat"),f,this._getFormatConfig(b))}});a.fn.datepicker=function(b){if(!this.length)return this; +if(!a.datepicker.initialized){a(document).mousedown(a.datepicker._checkExternalClick).find("body").append(a.datepicker.dpDiv);a.datepicker.initialized=true}var f=Array.prototype.slice.call(arguments,1);if(typeof b=="string"&&(b=="isDisabled"||b=="getDate"||b=="widget"))return a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this[0]].concat(f));if(b=="option"&&arguments.length==2&&typeof arguments[1]=="string")return a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this[0]].concat(f));return this.each(function(){typeof b== +"string"?a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this].concat(f)):a.datepicker._attachDatepicker(this,b)})};a.datepicker=new c;a.datepicker.initialized=false;a.datepicker.uuid=(new Date).getTime();a.datepicker.version="1.8.16";window["DP_jQuery_"+g]=a})(jQuery); +(function(a,d){var c={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},e={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},h=a.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};a.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, +position:{my:"center",at:"center",collision:"fit",using:function(g){var i=a(this).css(g).offset().top;i<0&&a(this).css("top",g.top-i)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var g=this,i=g.options,b=i.title||" ",f=a.ui.dialog.getTitleId(g.element),j=(g.uiDialog=a("
        ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ +i.dialogClass).css({zIndex:i.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){if(i.closeOnEscape&&!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===a.ui.keyCode.ESCAPE){g.close(n);n.preventDefault()}}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(n){g.moveToTop(false,n)});g.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(j);var l=(g.uiDialogTitlebar=a("
        ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(j), +o=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){o.addClass("ui-state-hover")},function(){o.removeClass("ui-state-hover")}).focus(function(){o.addClass("ui-state-focus")}).blur(function(){o.removeClass("ui-state-focus")}).click(function(n){g.close(n);return false}).appendTo(l);(g.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(i.closeText).appendTo(o);a("").addClass("ui-dialog-title").attr("id", +f).html(b).prependTo(l);if(a.isFunction(i.beforeclose)&&!a.isFunction(i.beforeClose))i.beforeClose=i.beforeclose;l.find("*").add(l).disableSelection();i.draggable&&a.fn.draggable&&g._makeDraggable();i.resizable&&a.fn.resizable&&g._makeResizable();g._createButtons(i.buttons);g._isOpen=false;a.fn.bgiframe&&j.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var g=this;g.overlay&&g.overlay.destroy();g.uiDialog.hide();g.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); +g.uiDialog.remove();g.originalTitle&&g.element.attr("title",g.originalTitle);return g},widget:function(){return this.uiDialog},close:function(g){var i=this,b,f;if(false!==i._trigger("beforeClose",g)){i.overlay&&i.overlay.destroy();i.uiDialog.unbind("keypress.ui-dialog");i._isOpen=false;if(i.options.hide)i.uiDialog.hide(i.options.hide,function(){i._trigger("close",g)});else{i.uiDialog.hide();i._trigger("close",g)}a.ui.dialog.overlay.resize();if(i.options.modal){b=0;a(".ui-dialog").each(function(){if(this!== +i.uiDialog[0]){f=a(this).css("z-index");isNaN(f)||(b=Math.max(b,f))}});a.ui.dialog.maxZ=b}return i}},isOpen:function(){return this._isOpen},moveToTop:function(g,i){var b=this,f=b.options;if(f.modal&&!g||!f.stack&&!f.modal)return b._trigger("focus",i);if(f.zIndex>a.ui.dialog.maxZ)a.ui.dialog.maxZ=f.zIndex;if(b.overlay){a.ui.dialog.maxZ+=1;b.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)}g={scrollTop:b.element.scrollTop(),scrollLeft:b.element.scrollLeft()};a.ui.dialog.maxZ+=1; +b.uiDialog.css("z-index",a.ui.dialog.maxZ);b.element.attr(g);b._trigger("focus",i);return b},open:function(){if(!this._isOpen){var g=this,i=g.options,b=g.uiDialog;g.overlay=i.modal?new a.ui.dialog.overlay(g):null;g._size();g._position(i.position);b.show(i.show);g.moveToTop(true);i.modal&&b.bind("keypress.ui-dialog",function(f){if(f.keyCode===a.ui.keyCode.TAB){var j=a(":tabbable",this),l=j.filter(":first");j=j.filter(":last");if(f.target===j[0]&&!f.shiftKey){l.focus(1);return false}else if(f.target=== +l[0]&&f.shiftKey){j.focus(1);return false}}});a(g.element.find(":tabbable").get().concat(b.find(".ui-dialog-buttonpane :tabbable").get().concat(b.get()))).eq(0).focus();g._isOpen=true;g._trigger("open");return g}},_createButtons:function(g){var i=this,b=false,f=a("
        ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),j=a("
        ").addClass("ui-dialog-buttonset").appendTo(f);i.uiDialog.find(".ui-dialog-buttonpane").remove();typeof g==="object"&&g!==null&&a.each(g, +function(){return!(b=true)});if(b){a.each(g,function(l,o){o=a.isFunction(o)?{click:o,text:l}:o;var n=a('').click(function(){o.click.apply(i.element[0],arguments)}).appendTo(j);a.each(o,function(k,m){if(k!=="click")k in h?n[k](m):n.attr(k,m)});a.fn.button&&n.button()});f.appendTo(i.uiDialog)}},_makeDraggable:function(){function g(l){return{position:l.position,offset:l.offset}}var i=this,b=i.options,f=a(document),j;i.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", +handle:".ui-dialog-titlebar",containment:"document",start:function(l,o){j=b.height==="auto"?"auto":a(this).height();a(this).height(a(this).height()).addClass("ui-dialog-dragging");i._trigger("dragStart",l,g(o))},drag:function(l,o){i._trigger("drag",l,g(o))},stop:function(l,o){b.position=[o.position.left-f.scrollLeft(),o.position.top-f.scrollTop()];a(this).removeClass("ui-dialog-dragging").height(j);i._trigger("dragStop",l,g(o));a.ui.dialog.overlay.resize()}})},_makeResizable:function(g){function i(l){return{originalPosition:l.originalPosition, +originalSize:l.originalSize,position:l.position,size:l.size}}g=g===d?this.options.resizable:g;var b=this,f=b.options,j=b.uiDialog.css("position");g=typeof g==="string"?g:"n,e,s,w,se,sw,ne,nw";b.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:b.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:b._minHeight(),handles:g,start:function(l,o){a(this).addClass("ui-dialog-resizing");b._trigger("resizeStart",l,i(o))},resize:function(l,o){b._trigger("resize", +l,i(o))},stop:function(l,o){a(this).removeClass("ui-dialog-resizing");f.height=a(this).height();f.width=a(this).width();b._trigger("resizeStop",l,i(o));a.ui.dialog.overlay.resize()}}).css("position",j).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var g=this.options;return g.height==="auto"?g.minHeight:Math.min(g.minHeight,g.height)},_position:function(g){var i=[],b=[0,0],f;if(g){if(typeof g==="string"||typeof g==="object"&&"0"in g){i=g.split?g.split(" "): +[g[0],g[1]];if(i.length===1)i[1]=i[0];a.each(["left","top"],function(j,l){if(+i[j]===i[j]){b[j]=i[j];i[j]=l}});g={my:i.join(" "),at:i.join(" "),offset:b.join(" ")}}g=a.extend({},a.ui.dialog.prototype.options.position,g)}else g=a.ui.dialog.prototype.options.position;(f=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},g));f||this.uiDialog.hide()},_setOptions:function(g){var i=this,b={},f=false;a.each(g,function(j,l){i._setOption(j,l); +if(j in c)f=true;if(j in e)b[j]=l});f&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",b)},_setOption:function(g,i){var b=this,f=b.uiDialog;switch(g){case "beforeclose":g="beforeClose";break;case "buttons":b._createButtons(i);break;case "closeText":b.uiDialogTitlebarCloseText.text(""+i);break;case "dialogClass":f.removeClass(b.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+i);break;case "disabled":i?f.addClass("ui-dialog-disabled"): +f.removeClass("ui-dialog-disabled");break;case "draggable":var j=f.is(":data(draggable)");j&&!i&&f.draggable("destroy");!j&&i&&b._makeDraggable();break;case "position":b._position(i);break;case "resizable":(j=f.is(":data(resizable)"))&&!i&&f.resizable("destroy");j&&typeof i==="string"&&f.resizable("option","handles",i);!j&&i!==false&&b._makeResizable(i);break;case "title":a(".ui-dialog-title",b.uiDialogTitlebar).html(""+(i||" "));break}a.Widget.prototype._setOption.apply(b,arguments)},_size:function(){var g= +this.options,i,b,f=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(g.minWidth>g.width)g.width=g.minWidth;i=this.uiDialog.css({height:"auto",width:g.width}).height();b=Math.max(0,g.minHeight-i);if(g.height==="auto")if(a.support.minHeight)this.element.css({minHeight:b,height:"auto"});else{this.uiDialog.show();g=this.element.css("height","auto").height();f||this.uiDialog.hide();this.element.height(Math.max(g,b))}else this.element.height(Math.max(g.height- +i,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});a.extend(a.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function(g){g=g.attr("id");if(!g){this.uuid+=1;g=this.uuid}return"ui-dialog-title-"+g},overlay:function(g){this.$el=a.ui.dialog.overlay.create(g)}});a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(g){return g+".dialog-overlay"}).join(" "), +create:function(g){if(this.instances.length===0){setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&i.bgiframe();this.instances.push(i);return i},destroy:function(g){var i=a.inArray(g,this.instances);i!=-1&&this.oldInstances.push(this.instances.splice(i,1)[0]);this.instances.length===0&&a([document,window]).unbind(".dialog-overlay");g.remove();var b=0;a.each(this.instances,function(){b=Math.max(b,this.css("z-index"))});this.maxZ=b},height:function(){var g,i;if(a.browser.msie&& +a.browser.version<7){g=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);i=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return g0?g.left-b:Math.max(g.left-i.collisionPosition.left,g.left)},top:function(g,i){var b=a(window);b=i.collisionPosition.top+i.collisionHeight-b.height()-b.scrollTop();g.top=b>0?g.top-b:Math.max(g.top-i.collisionPosition.top,g.top)}},flip:{left:function(g,i){if(i.at[0]!=="center"){var b=a(window);b=i.collisionPosition.left+i.collisionWidth-b.width()-b.scrollLeft();var f=i.my[0]==="left"?-i.elemWidth:i.my[0]==="right"?i.elemWidth:0,j=i.at[0]==="left"?i.targetWidth:-i.targetWidth,l=-2*i.offset[0];g.left+= +i.collisionPosition.left<0?f+j+l:b>0?f+j+l:0}},top:function(g,i){if(i.at[1]!=="center"){var b=a(window);b=i.collisionPosition.top+i.collisionHeight-b.height()-b.scrollTop();var f=i.my[1]==="top"?-i.elemHeight:i.my[1]==="bottom"?i.elemHeight:0,j=i.at[1]==="top"?i.targetHeight:-i.targetHeight,l=-2*i.offset[1];g.top+=i.collisionPosition.top<0?f+j+l:b>0?f+j+l:0}}}};if(!a.offset.setOffset){a.offset.setOffset=function(g,i){if(/static/.test(a.curCSS(g,"position")))g.style.position="relative";var b=a(g), +f=b.offset(),j=parseInt(a.curCSS(g,"top",true),10)||0,l=parseInt(a.curCSS(g,"left",true),10)||0;f={top:i.top-f.top+j,left:i.left-f.left+l};"using"in i?i.using.call(g,f):b.css(f)};a.fn.offset=function(g){var i=this[0];if(!i||!i.ownerDocument)return null;if(g)return this.each(function(){a.offset.setOffset(this,g)});return h.call(this)}}})(jQuery); +(function(a,d){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=a("
        ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); +this.valueDiv.remove();a.Widget.prototype.destroy.apply(this,arguments)},value:function(c){if(c===d)return this._value();this._setOption("value",c);return this},_setOption:function(c,e){if(c==="value"){this.options.value=e;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var c=this.options.value;if(typeof c!=="number")c=0;return Math.min(this.options.max,Math.max(this.min,c))},_percentage:function(){return 100* +this._value()/this.options.max},_refreshValue:function(){var c=this.value(),e=this._percentage();if(this.oldValue!==c){this.oldValue=c;this._trigger("change")}this.valueDiv.toggle(c>this.min).toggleClass("ui-corner-right",c===this.options.max).width(e.toFixed(0)+"%");this.element.attr("aria-valuenow",c)}});a.extend(a.ui.progressbar,{version:"1.8.16"})})(jQuery); +(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var d=this,c=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),h=c.values&&c.values.length||1,g=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+ +this.orientation+" ui-widget ui-widget-content ui-corner-all"+(c.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);if(c.range){if(c.range===true){if(!c.values)c.values=[this._valueMin(),this._valueMin()];if(c.values.length&&c.values.length!==2)c.values=[c.values[0],c.values[0]]}this.range=a("
        ").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(c.range==="min"||c.range==="max"?" ui-slider-range-"+c.range:""))}for(var i=e.length;i"); +this.handles=e.add(a(g.join("")).appendTo(d.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(b){b.preventDefault()}).hover(function(){c.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(c.disabled)a(this).blur();else{a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(b){a(this).data("index.ui-slider-handle", +b)});this.handles.keydown(function(b){var f=true,j=a(this).data("index.ui-slider-handle"),l,o,n;if(!d.options.disabled){switch(b.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!d._keySliding){d._keySliding=true;a(this).addClass("ui-state-active");l=d._start(b,j);if(l===false)return}break}n=d.options.step;l=d.options.values&&d.options.values.length? +(o=d.values(j)):(o=d.value());switch(b.keyCode){case a.ui.keyCode.HOME:o=d._valueMin();break;case a.ui.keyCode.END:o=d._valueMax();break;case a.ui.keyCode.PAGE_UP:o=d._trimAlignValue(l+(d._valueMax()-d._valueMin())/5);break;case a.ui.keyCode.PAGE_DOWN:o=d._trimAlignValue(l-(d._valueMax()-d._valueMin())/5);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(l===d._valueMax())return;o=d._trimAlignValue(l+n);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(l===d._valueMin())return;o=d._trimAlignValue(l- +n);break}d._slide(b,j,o);return f}}).keyup(function(b){var f=a(this).data("index.ui-slider-handle");if(d._keySliding){d._keySliding=false;d._stop(b,f);d._change(b,f);a(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy(); +return this},_mouseCapture:function(d){var c=this.options,e,h,g,i,b;if(c.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();e=this._normValueFromMouse({x:d.pageX,y:d.pageY});h=this._valueMax()-this._valueMin()+1;i=this;this.handles.each(function(f){var j=Math.abs(e-i.values(f));if(h>j){h=j;g=a(this);b=f}});if(c.range===true&&this.values(1)===c.min){b+=1;g=a(this.handles[b])}if(this._start(d,b)===false)return false; +this._mouseSliding=true;i._handleIndex=b;g.addClass("ui-state-active").focus();c=g.offset();this._clickOffset=!a(d.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:d.pageX-c.left-g.width()/2,top:d.pageY-c.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(d,b,e);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(d){var c= +this._normValueFromMouse({x:d.pageX,y:d.pageY});this._slide(d,this._handleIndex,c);return false},_mouseStop:function(d){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(d,this._handleIndex);this._change(d,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c;if(this.orientation==="horizontal"){c= +this.elementSize.width;d=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;d=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}c=d/c;if(c>1)c=1;if(c<0)c=0;if(this.orientation==="vertical")c=1-c;d=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+c*d)},_start:function(d,c){var e={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){e.value=this.values(c); +e.values=this.values()}return this._trigger("start",d,e)},_slide:function(d,c,e){var h;if(this.options.values&&this.options.values.length){h=this.values(c?0:1);if(this.options.values.length===2&&this.options.range===true&&(c===0&&e>h||c===1&&e1){this.options.values[d]=this._trimAlignValue(c);this._refreshValue();this._change(null,d)}else if(arguments.length)if(a.isArray(arguments[0])){e=this.options.values;h=arguments[0];for(g=0;g=this._valueMax())return this._valueMax();var c=this.options.step>0?this.options.step:1,e=(d-this._valueMin())%c;d=d-e;if(Math.abs(e)*2>=c)d+=e>0?c:-c;return parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var d= +this.options.range,c=this.options,e=this,h=!this._animateOff?c.animate:false,g,i={},b,f,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(o){g=(e.values(o)-e._valueMin())/(e._valueMax()-e._valueMin())*100;i[e.orientation==="horizontal"?"left":"bottom"]=g+"%";a(this).stop(1,1)[h?"animate":"css"](i,c.animate);if(e.options.range===true)if(e.orientation==="horizontal"){if(o===0)e.range.stop(1,1)[h?"animate":"css"]({left:g+"%"},c.animate);if(o===1)e.range[h?"animate":"css"]({width:g- +b+"%"},{queue:false,duration:c.animate})}else{if(o===0)e.range.stop(1,1)[h?"animate":"css"]({bottom:g+"%"},c.animate);if(o===1)e.range[h?"animate":"css"]({height:g-b+"%"},{queue:false,duration:c.animate})}b=g});else{f=this.value();j=this._valueMin();l=this._valueMax();g=l!==j?(f-j)/(l-j)*100:0;i[e.orientation==="horizontal"?"left":"bottom"]=g+"%";this.handle.stop(1,1)[h?"animate":"css"](i,c.animate);if(d==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[h?"animate":"css"]({width:g+"%"}, +c.animate);if(d==="max"&&this.orientation==="horizontal")this.range[h?"animate":"css"]({width:100-g+"%"},{queue:false,duration:c.animate});if(d==="min"&&this.orientation==="vertical")this.range.stop(1,1)[h?"animate":"css"]({height:g+"%"},c.animate);if(d==="max"&&this.orientation==="vertical")this.range[h?"animate":"css"]({height:100-g+"%"},{queue:false,duration:c.animate})}}});a.extend(a.ui.slider,{version:"1.8.16"})})(jQuery); +(function(a,d){function c(){return++h}function e(){return++g}var h=0,g=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
        ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
      2. #{label}
      3. "},_create:function(){this._tabify(true)},_setOption:function(i,b){if(i=="selected")this.options.collapsible&& +b==this.options.selected||this.select(b);else{this.options[i]=b;this._tabify()}},_tabId:function(i){return i.title&&i.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+c()},_sanitizeSelector:function(i){return i.replace(/:/g,"\\:")},_cookie:function(){var i=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+e());return a.cookie.apply(null,[i].concat(a.makeArray(arguments)))},_ui:function(i,b){return{tab:i,panel:b,index:this.anchors.index(i)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var i= +a(this);i.html(i.data("label.tabs")).removeData("label.tabs")})},_tabify:function(i){function b(r,u){r.css("display","");!a.support.opacity&&u.opacity&&r[0].style.removeAttribute("filter")}var f=this,j=this.options,l=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=a(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);this.anchors.each(function(r,u){var v=a(u).attr("href"),w=v.split("#")[0],x;if(w&&(w===location.toString().split("#")[0]|| +(x=a("base")[0])&&w===x.href)){v=u.hash;u.href=v}if(l.test(v))f.panels=f.panels.add(f.element.find(f._sanitizeSelector(v)));else if(v&&v!=="#"){a.data(u,"href.tabs",v);a.data(u,"load.tabs",v.replace(/#.*$/,""));v=f._tabId(u);u.href="#"+v;u=f.element.find("#"+v);if(!u.length){u=a(j.panelTemplate).attr("id",v).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(f.panels[r-1]||f.list);u.data("destroy.tabs",true)}f.panels=f.panels.add(u)}else j.disabled.push(r)});if(i){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); +this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(j.selected===d){location.hash&&this.anchors.each(function(r,u){if(u.hash==location.hash){j.selected=r;return false}});if(typeof j.selected!=="number"&&j.cookie)j.selected=parseInt(f._cookie(),10);if(typeof j.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)j.selected= +this.lis.index(this.lis.filter(".ui-tabs-selected"));j.selected=j.selected||(this.lis.length?0:-1)}else if(j.selected===null)j.selected=-1;j.selected=j.selected>=0&&this.anchors[j.selected]||j.selected<0?j.selected:0;j.disabled=a.unique(j.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(r){return f.lis.index(r)}))).sort();a.inArray(j.selected,j.disabled)!=-1&&j.disabled.splice(a.inArray(j.selected,j.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); +if(j.selected>=0&&this.anchors.length){f.element.find(f._sanitizeSelector(f.anchors[j.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(j.selected).addClass("ui-tabs-selected ui-state-active");f.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[j.selected],f.element.find(f._sanitizeSelector(f.anchors[j.selected].hash))[0]))});this.load(j.selected)}a(window).bind("unload",function(){f.lis.add(f.anchors).unbind(".tabs");f.lis=f.anchors=f.panels=null})}else j.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); +this.element[j.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");j.cookie&&this._cookie(j.selected,j.cookie);i=0;for(var o;o=this.lis[i];i++)a(o)[a.inArray(i,j.disabled)!=-1&&!a(o).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");j.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(j.event!=="mouseover"){var n=function(r,u){u.is(":not(.ui-state-disabled)")&&u.addClass("ui-state-"+r)},k=function(r,u){u.removeClass("ui-state-"+ +r)};this.lis.bind("mouseover.tabs",function(){n("hover",a(this))});this.lis.bind("mouseout.tabs",function(){k("hover",a(this))});this.anchors.bind("focus.tabs",function(){n("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){k("focus",a(this).closest("li"))})}var m,p;if(j.fx)if(a.isArray(j.fx)){m=j.fx[0];p=j.fx[1]}else m=p=j.fx;var q=p?function(r,u){a(r).closest("li").addClass("ui-tabs-selected ui-state-active");u.hide().removeClass("ui-tabs-hide").animate(p,p.duration||"normal", +function(){b(u,p);f._trigger("show",null,f._ui(r,u[0]))})}:function(r,u){a(r).closest("li").addClass("ui-tabs-selected ui-state-active");u.removeClass("ui-tabs-hide");f._trigger("show",null,f._ui(r,u[0]))},s=m?function(r,u){u.animate(m,m.duration||"normal",function(){f.lis.removeClass("ui-tabs-selected ui-state-active");u.addClass("ui-tabs-hide");b(u,m);f.element.dequeue("tabs")})}:function(r,u){f.lis.removeClass("ui-tabs-selected ui-state-active");u.addClass("ui-tabs-hide");f.element.dequeue("tabs")}; +this.anchors.bind(j.event+".tabs",function(){var r=this,u=a(r).closest("li"),v=f.panels.filter(":not(.ui-tabs-hide)"),w=f.element.find(f._sanitizeSelector(r.hash));if(u.hasClass("ui-tabs-selected")&&!j.collapsible||u.hasClass("ui-state-disabled")||u.hasClass("ui-state-processing")||f.panels.filter(":animated").length||f._trigger("select",null,f._ui(this,w[0]))===false){this.blur();return false}j.selected=f.anchors.index(this);f.abort();if(j.collapsible)if(u.hasClass("ui-tabs-selected")){j.selected= +-1;j.cookie&&f._cookie(j.selected,j.cookie);f.element.queue("tabs",function(){s(r,v)}).dequeue("tabs");this.blur();return false}else if(!v.length){j.cookie&&f._cookie(j.selected,j.cookie);f.element.queue("tabs",function(){q(r,w)});f.load(f.anchors.index(this));this.blur();return false}j.cookie&&f._cookie(j.selected,j.cookie);if(w.length){v.length&&f.element.queue("tabs",function(){s(r,v)});f.element.queue("tabs",function(){q(r,w)});f.load(f.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; +a.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(i){if(typeof i=="string")i=this.anchors.index(this.anchors.filter("[href$="+i+"]"));return i},destroy:function(){var i=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var b= +a.data(this,"href.tabs");if(b)this.href=b;var f=a(this).unbind(".tabs");a.each(["href","load","cache"],function(j,l){f.removeData(l+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});i.cookie&&this._cookie(null,i.cookie);return this},add:function(i, +b,f){if(f===d)f=this.anchors.length;var j=this,l=this.options;b=a(l.tabTemplate.replace(/#\{href\}/g,i).replace(/#\{label\}/g,b));i=!i.indexOf("#")?i.replace("#",""):this._tabId(a("a",b)[0]);b.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var o=j.element.find("#"+i);o.length||(o=a(l.panelTemplate).attr("id",i).data("destroy.tabs",true));o.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(f>=this.lis.length){b.appendTo(this.list);o.appendTo(this.list[0].parentNode)}else{b.insertBefore(this.lis[f]); +o.insertBefore(this.panels[f])}l.disabled=a.map(l.disabled,function(n){return n>=f?++n:n});this._tabify();if(this.anchors.length==1){l.selected=0;b.addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){j._trigger("show",null,j._ui(j.anchors[0],j.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[f],this.panels[f]));return this},remove:function(i){i=this._getIndex(i);var b=this.options,f=this.lis.eq(i).remove(),j=this.panels.eq(i).remove(); +if(f.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(i+(i+1=i?--l:l});this._tabify();this._trigger("remove",null,this._ui(f.find("a")[0],j[0]));return this},enable:function(i){i=this._getIndex(i);var b=this.options;if(a.inArray(i,b.disabled)!=-1){this.lis.eq(i).removeClass("ui-state-disabled");b.disabled=a.grep(b.disabled,function(f){return f!=i});this._trigger("enable",null, +this._ui(this.anchors[i],this.panels[i]));return this}},disable:function(i){i=this._getIndex(i);var b=this.options;if(i!=b.selected){this.lis.eq(i).addClass("ui-state-disabled");b.disabled.push(i);b.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[i],this.panels[i]))}return this},select:function(i){i=this._getIndex(i);if(i==-1)if(this.options.collapsible&&this.options.selected!=-1)i=this.options.selected;else return this;this.anchors.eq(i).trigger(this.options.event+".tabs");return this}, +load:function(i){i=this._getIndex(i);var b=this,f=this.options,j=this.anchors.eq(i)[0],l=a.data(j,"load.tabs");this.abort();if(!l||this.element.queue("tabs").length!==0&&a.data(j,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(i).addClass("ui-state-processing");if(f.spinner){var o=a("span",j);o.data("label.tabs",o.html()).html(f.spinner)}this.xhr=a.ajax(a.extend({},f.ajaxOptions,{url:l,success:function(n,k){b.element.find(b._sanitizeSelector(j.hash)).html(n);b._cleanup();f.cache&&a.data(j, +"cache.tabs",true);b._trigger("load",null,b._ui(b.anchors[i],b.panels[i]));try{f.ajaxOptions.success(n,k)}catch(m){}},error:function(n,k){b._cleanup();b._trigger("load",null,b._ui(b.anchors[i],b.panels[i]));try{f.ajaxOptions.error(n,k,i,j)}catch(m){}}}));b.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, +url:function(i,b){this.anchors.eq(i).removeData("cache.tabs").data("load.tabs",b);return this},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.8.16"});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(i,b){var f=this,j=this.options,l=f._rotate||(f._rotate=function(o){clearTimeout(f.rotation);f.rotation=setTimeout(function(){var n=j.selected;f.select(++n *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); +this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== +"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&& +!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top, +left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; +this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= +document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); +return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], +e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); +c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"): +this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null, +dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, +toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); +if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), +this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= +this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= +d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| +0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", +a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- +f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- +this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, +this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", +a,this._uiHash());for(e=0;e 0) { + tools = tools + " ["; + } + //inner loop for toolbar buttons + jQuery.each(jQuery("li",rowValue), function(buttonIndex, buttonValue) { + if (jQuery(buttonValue).hasClass('spacer')) { + tools = tools + ",'-'"; + } + else if (jQuery(buttonValue).hasClass('group')) { + tools = tools + "],\n ["; + } + else { + tools = tools + ",'" + jQuery(buttonValue).attr('id') + "'" ; + } + }); + + if (jQuery("li" ,rowValue).length > 0) { + if (rowIndex < (rows -1)) { + tools = tools + "],\n '/',\n"; + } + else { + tools = tools + "]\n"; + } + } + }); + tools = tools + "]"; + tools = tools.replace(/\[,/g, '['); + tools = tools.replace(/\[],/g, ''); + jQuery("#edit-toolbar").attr('value', tools); + } + + Drupal.ckeditorToolbaInit = function() { + Drupal.ckeditorToolbarUsedRender(); + Drupal.ckeditorToolbarAllRender(); + + var firefox = navigator.userAgent.toLowerCase().match(/firefox\/[0-9]\./); + jQuery(".sortableList").sortable({ + connectWith: ".sortableList", + items: "div.sortableListDiv", + sort: function(event, ui) { + if (firefox){ + ui.helper.css({'top' : ui.position.top - 35 + 'px'}); + } + }, + stop: function(event, ui) { + Tools(event, ui); + } + }).disableSelection(); + + jQuery(".sortableRow").sortable({ + connectWith: ".sortableRow", + items: "li.sortableItem", + sort: function(event, ui) { + if (firefox){ + ui.helper.css({'top' : ui.position.top - 35 + 'px'}); + } + }, + stop: function(event, ui) { + Tools(event, ui); + } + }).disableSelection(); + + jQuery("li.sortableItem").mouseover(function(){ + jQuery(".sortableList").sortable("disable"); + }); + jQuery("li.sortableItem").mouseout(function(){ + jQuery(".sortableList").sortable("enable"); + }); + } + + Drupal.ckeditorToolbarReload = function() { + jQuery(".sortableList").sortable('destroy'); + jQuery(".sortableRow").sortable('destroy'); + jQuery("li.sortableItem").unbind(); + Drupal.ckeditorToolbaInit(); + } + + Drupal.ckeditorToolbarUsedRender = function() { + var toolbar = jQuery('#edit-toolbar').val(); + toolbar = eval(toolbar); + var html = '
          '; + var group = false; + + for (var row in toolbar) { + if (typeof toolbar[row] == 'string' && toolbar[row] == '/') { + group = false; + html += '
          '; + } + else { + if (group == false){ + group = true; + } + else { + html += '
        • group
        • '; + } + for (var button in toolbar[row]) { + if (toolbar[row][button] == '-') { + html += '
        • spacer
        • '; + } + else if (Drupal.settings.cke_toolbar_buttons_all[toolbar[row][button]]) { + html += '
        • ' + Drupal.settings.cke_toolbar_buttons_all[toolbar[row][button]]['title'] + '
        • '; + } + } + } + } + html += '
        '; + jQuery('#groupLayout').empty().append(html); + } + + Drupal.ckeditorToolbarAllRender = function() { + var toolbarUsed = jQuery('#edit-toolbar').val(); + var toolbarAll = Drupal.settings.cke_toolbar_buttons_all; + + var htmlArray = new Array(); + var html = ''; + + for (var i in toolbarAll) { + if (new RegExp("\'[\s]*" + toolbarAll[i].name + "[\s]*\'").test(toolbarUsed) == false) { + if (toolbarAll[i].name == false) continue; + if (typeof htmlArray[toolbarAll[i].row] == 'undefined') htmlArray[toolbarAll[i].row] = ''; + htmlArray[toolbarAll[i].row] += '
      4. ' + toolbarAll[i].title + '
      5. '; + } + } + + if (typeof htmlArray[5] == 'undefined') htmlArray[5] = ''; + htmlArray[5] += '
      6. ' + toolbarAll['__group'].title + '
      7. ' + toolbarAll['__group'].title + '
      8. ' + toolbarAll['__group'].title + '
      9. ' + toolbarAll['__group'].title + '
      10. ' + toolbarAll['__group'].title + '
      11. ' + toolbarAll['__group'].title + '
      12. ' + toolbarAll['__group'].title + '
      13. ' + toolbarAll['__group'].title + '
      14. ' + toolbarAll['__group'].title + '
      15. ' + toolbarAll['__group'].title + '
      16. ' + toolbarAll['__group'].title + '
      17. ' + toolbarAll['__group'].title + '
      18. ' + toolbarAll['__group'].title + '
      19. ' + toolbarAll['__group'].title + '
      20. ' + toolbarAll['__group'].title + '
      21. ' + toolbarAll['__group'].title + '
      22. ' + toolbarAll['__group'].title + '
      23. ' + toolbarAll['__group'].title + '
      24. ' + toolbarAll['__group'].title + '
      25. ' + toolbarAll['__group'].title + '
      26. '; + + if (typeof htmlArray[6] == 'undefined') htmlArray[6] = ''; + htmlArray[6] += '
      27. ' + toolbarAll['__spacer'].title + '
      28. ' + toolbarAll['__spacer'].title + '
      29. ' + toolbarAll['__spacer'].title + '
      30. ' + toolbarAll['__spacer'].title + '
      31. ' + toolbarAll['__spacer'].title + '
      32. ' + toolbarAll['__spacer'].title + '
      33. ' + toolbarAll['__spacer'].title + '
      34. ' + toolbarAll['__spacer'].title + '
      35. ' + toolbarAll['__spacer'].title + '
      36. ' + toolbarAll['__spacer'].title + '
      37. ' + toolbarAll['__spacer'].title + '
      38. ' + toolbarAll['__spacer'].title + '
      39. ' + toolbarAll['__spacer'].title + '
      40. ' + toolbarAll['__spacer'].title + '
      41. ' + toolbarAll['__spacer'].title + '
      42. ' + toolbarAll['__spacer'].title + '
      43. ' + toolbarAll['__spacer'].title + '
      44. ' + toolbarAll['__spacer'].title + '
      45. ' + toolbarAll['__spacer'].title + '
      46. ' + toolbarAll['__spacer'].title + '
      47. '; + + if (typeof htmlArray[7] == 'undefined') htmlArray[7] = ''; + + for (var j in htmlArray){ + html += '
          ' + htmlArray[j] + '
        '; + } + jQuery('#allButtons').empty().append(html); + } + + Drupal.ckeditorToolbaInit(); +}); \ No newline at end of file diff --git a/sites/all/modules/ckeditor/includes/uicolor/dialogs/uicolor.js b/sites/all/modules/ckeditor/includes/uicolor/dialogs/uicolor.js new file mode 100644 index 0000000..16ddf2e --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/dialogs/uicolor.js @@ -0,0 +1,179 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.dialog.add( 'uicolor', function( editor ) { + var dialog, picker, pickerContents, + // Actual UI color value. + uiColor = editor.getUiColor(), + pickerId = 'cke_uicolor_picker' + CKEDITOR.tools.getNextNumber(); + + function setNewPickerColor( color ) { + // Convert HEX representation to RGB, stripping # char. + if ( /^#/.test( color ) ) + color = window.YAHOO.util.Color.hex2rgb( color.substr( 1 ) ); + picker.setValue( color, true ); + // Refresh picker UI. + picker.refresh( pickerId ); + } + + function setNewUiColor( color, force ) { + if ( force || dialog._.contents.tab1.livePeview.getValue() ) + editor.setUiColor( color ); + // Write new config string into textbox. + dialog._.contents.tab1.configBox.setValue( 'config.uiColor = "#' + picker.get( "hex" ) + '"' ); + } + + pickerContents = { + id: 'yuiColorPicker', + type: 'html', + html: "
        ", + onLoad: function( event ) { + var url = CKEDITOR.getUrl( editor.plugins.uicolor.path + 'yui/' ); + + // Create new color picker widget. + picker = new window.YAHOO.widget.ColorPicker( pickerId, { + showhsvcontrols: true, + showhexcontrols: true, + images: { + PICKER_THUMB: url + "assets/picker_thumb.png", + HUE_THUMB: url + "assets/hue_thumb.png" + } + }); + + // Set actual UI color to the picker. + if ( uiColor ) + setNewPickerColor( uiColor ); + + // Subscribe to the rgbChange event. + picker.on( "rgbChange", function() { + // Reset predefined box. + dialog._.contents.tab1.predefined.setValue( '' ); + setNewUiColor( '#' + picker.get( 'hex' ) ); + }); + + // Fix input class names. + var inputs = new CKEDITOR.dom.nodeList( picker.getElementsByTagName( 'input' ) ); + for ( var i = 0; i < inputs.count(); i++ ) + inputs.getItem( i ).addClass( 'cke_dialog_ui_input_text' ); + } + }; + + var skipPreviewChange = true; + + return { + title: editor.lang.uicolor.title, + minWidth: 360, + minHeight: 320, + onLoad: function() { + dialog = this; + this.setupContent(); + + // #3808 + if ( CKEDITOR.env.ie7Compat ) + dialog.parts.contents.setStyle( 'overflow', 'hidden' ); + }, + contents: [ + { + id: 'tab1', + label: '', + title: '', + expand: true, + padding: 0, + elements: [ + pickerContents, + { + id: 'tab1', + type: 'vbox', + children: [ + { + id: 'livePeview', + type: 'checkbox', + label: editor.lang.uicolor.preview, + 'default': 1, + onLoad: function() { + skipPreviewChange = true; + }, + onChange: function() { + if ( skipPreviewChange ) + return; + var on = this.getValue(), + color = on ? '#' + picker.get( 'hex' ) : uiColor; + setNewUiColor( color, true ); + } + }, + { + type: 'hbox', + children: [ + { + id: 'predefined', + type: 'select', + 'default': '', + label: editor.lang.uicolor.predefined, + items: [ + [ '' ], + [ 'Light blue', '#9AB8F3' ], + [ 'Sand', '#D2B48C' ], + [ 'Metallic', '#949AAA' ], + [ 'Purple', '#C2A3C7' ], + [ 'Olive', '#A2C980' ], + [ 'Happy green', '#9BD446' ], + [ 'Jezebel Blue', '#14B8C4' ], + [ 'Burn', '#FF893A' ], + [ 'Easy red', '#FF6969' ], + [ 'Pisces 3', '#48B4F2' ], + [ 'Aquarius 5', '#487ED4' ], + [ 'Absinthe', '#A8CF76' ], + [ 'Scrambled Egg', '#C7A622' ], + [ 'Hello monday', '#8E8D80' ], + [ 'Lovely sunshine', '#F1E8B1' ], + [ 'Recycled air', '#B3C593' ], + [ 'Down', '#BCBCA4' ], + [ 'Mark Twain', '#CFE91D' ], + [ 'Specks of dust', '#D1B596' ], + [ 'Lollipop', '#F6CE23' ] + ], + onChange: function() { + var color = this.getValue(); + if ( color ) { + setNewPickerColor( color ); + setNewUiColor( color ); + // Refresh predefined preview box. + CKEDITOR.document.getById( 'predefinedPreview' ).setStyle( 'background', color ); + } else + CKEDITOR.document.getById( 'predefinedPreview' ).setStyle( 'background', '' ); + }, + onShow: function() { + var color = editor.getUiColor(); + if ( color ) + this.setValue( color ); + } + }, + { + id: 'predefinedPreview', + type: 'html', + html: '
        ' + + '
         
        ' + + '
        ' + } + ] + }, + { + id: 'configBox', + type: 'text', + label: editor.lang.uicolor.config, + onShow: function() { + var color = editor.getUiColor(); + if ( color ) + this.setValue( 'config.uiColor = "' + color + '"' ); + } + } + ] + } + ] + } + ], + buttons: [ CKEDITOR.dialog.okButton ] + }; +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/icons/uicolor.png b/sites/all/modules/ckeditor/includes/uicolor/icons/uicolor.png new file mode 100644 index 0000000..8ec6b11 Binary files /dev/null and b/sites/all/modules/ckeditor/includes/uicolor/icons/uicolor.png differ diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/_translationstatus.txt b/sites/all/modules/ckeditor/includes/uicolor/lang/_translationstatus.txt new file mode 100644 index 0000000..e9f06e2 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/_translationstatus.txt @@ -0,0 +1,27 @@ +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license + +bg.js Found: 4 Missing: 0 +cs.js Found: 4 Missing: 0 +cy.js Found: 4 Missing: 0 +da.js Found: 4 Missing: 0 +de.js Found: 4 Missing: 0 +el.js Found: 4 Missing: 0 +eo.js Found: 4 Missing: 0 +et.js Found: 4 Missing: 0 +fa.js Found: 4 Missing: 0 +fi.js Found: 4 Missing: 0 +fr.js Found: 4 Missing: 0 +he.js Found: 4 Missing: 0 +hr.js Found: 4 Missing: 0 +it.js Found: 4 Missing: 0 +mk.js Found: 4 Missing: 0 +nb.js Found: 4 Missing: 0 +nl.js Found: 4 Missing: 0 +no.js Found: 4 Missing: 0 +pl.js Found: 4 Missing: 0 +tr.js Found: 4 Missing: 0 +ug.js Found: 4 Missing: 0 +uk.js Found: 4 Missing: 0 +vi.js Found: 4 Missing: 0 +zh-cn.js Found: 4 Missing: 0 diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/bg.js b/sites/all/modules/ckeditor/includes/uicolor/lang/bg.js new file mode 100644 index 0000000..96e28ef --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/bg.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'bg', { + title: 'ПИ избор на цвят', + preview: 'Преглед', + config: 'Вмъкнете този низ във Вашия config.js fajl', + predefined: 'Предефинирани цветови палитри' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/cs.js b/sites/all/modules/ckeditor/includes/uicolor/lang/cs.js new file mode 100644 index 0000000..048ad31 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/cs.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'cs', { + title: 'Výběr barvy rozhraní', + preview: 'Živý náhled', + config: 'Vložte tento řetězec do Vašeho souboru config.js', + predefined: 'Přednastavené sady barev' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/cy.js b/sites/all/modules/ckeditor/includes/uicolor/lang/cy.js new file mode 100644 index 0000000..6e4adb8 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/cy.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'cy', { + title: 'Dewisydd Lliwiau\'r UI', + preview: 'Rhagolwg Byw', + config: 'Gludwch y llinyn hwn i\'ch ffeil config.js', + predefined: 'Setiau lliw wedi\'u cyn-ddiffinio' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/da.js b/sites/all/modules/ckeditor/includes/uicolor/lang/da.js new file mode 100644 index 0000000..10040a8 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/da.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'da', { + title: 'Brugerflade på farvevælger', + preview: 'Vis liveeksempel', + config: 'Indsæt denne streng i din config.js fil', + predefined: 'Prædefinerede farveskemaer' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/de.js b/sites/all/modules/ckeditor/includes/uicolor/lang/de.js new file mode 100644 index 0000000..b469f10 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/de.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'de', { + title: 'UI Pipette', + preview: 'Live-Vorschau', + config: 'Fügen Sie diese Zeichenfolge in die \'config.js\' Datei.', + predefined: 'Vordefinierte Farbsätze' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/el.js b/sites/all/modules/ckeditor/includes/uicolor/lang/el.js new file mode 100644 index 0000000..a84deea --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/el.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'el', { + title: 'Διεπαφή Επιλογέα Χρωμάτων', + preview: 'Ζωντανή Προεπισκόπηση', + config: 'Επικολλήστε αυτό το κείμενο στο αρχείο config.js', + predefined: 'Προκαθορισμένα σύνολα χρωμάτων' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/en.js b/sites/all/modules/ckeditor/includes/uicolor/lang/en.js new file mode 100644 index 0000000..80ad586 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/en.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'en', { + title: 'UI Color Picker', + preview: 'Live preview', + config: 'Paste this string into your config.js file', + predefined: 'Predefined color sets' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/eo.js b/sites/all/modules/ckeditor/includes/uicolor/lang/eo.js new file mode 100644 index 0000000..ac2c79b --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/eo.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'eo', { + title: 'UI Kolorselektilo', + preview: 'Vidigi la aspekton', + config: 'Gluu tiun signoĉenon en vian dosieron config.js', + predefined: 'Antaŭdifinita koloraro' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/et.js b/sites/all/modules/ckeditor/includes/uicolor/lang/et.js new file mode 100644 index 0000000..e2c4871 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/et.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'et', { + title: 'Värvivalija kasutajaliides', + preview: 'Automaatne eelvaade', + config: 'Aseta see sõne oma config.js faili.', + predefined: 'Eelmääratud värvikomplektid' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/fa.js b/sites/all/modules/ckeditor/includes/uicolor/lang/fa.js new file mode 100644 index 0000000..98f0187 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/fa.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'fa', { + title: 'انتخاب رنگ UI', + preview: 'پیش‌نمایش زنده', + config: 'این رشته را در فایل config.js خود بچسبانید.', + predefined: 'مجموعه رنگ از پیش تعریف شده' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/fi.js b/sites/all/modules/ckeditor/includes/uicolor/lang/fi.js new file mode 100644 index 0000000..08c2ac1 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/fi.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'fi', { + title: 'Käyttöliittymän värivalitsin', + preview: 'Esikatsele', + config: 'Liitä tämä merkkijono config.js tiedostoosi', + predefined: 'Esimääritellyt värijoukot' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/fr.js b/sites/all/modules/ckeditor/includes/uicolor/lang/fr.js new file mode 100644 index 0000000..aa40c7b --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/fr.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'fr', { + title: 'UI Sélecteur de couleur', + preview: 'Aperçu', + config: 'Collez cette chaîne de caractères dans votre fichier config.js', + predefined: 'Palettes de couleurs prédéfinies' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/he.js b/sites/all/modules/ckeditor/includes/uicolor/lang/he.js new file mode 100644 index 0000000..7f9db2f --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/he.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'he', { + title: 'בחירת צבע ממשק משתמש', + preview: 'תצוגה מקדימה', + config: 'הדבק את הטקסט הבא לתוך הקובץ config.js', + predefined: 'קבוצות צבעים מוגדרות מראש' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/hr.js b/sites/all/modules/ckeditor/includes/uicolor/lang/hr.js new file mode 100644 index 0000000..f328bae --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/hr.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'hr', { + title: 'UI odabir boja', + preview: 'Pregled uživo', + config: 'Zalijepite ovaj tekst u Vašu config.js datoteku.', + predefined: 'Već postavljeni setovi boja' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/it.js b/sites/all/modules/ckeditor/includes/uicolor/lang/it.js new file mode 100644 index 0000000..58b4939 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/it.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'it', { + title: 'Selettore Colore UI', + preview: 'Anteprima Live', + config: 'Incolla questa stringa nel tuo file config.js', + predefined: 'Set di colori predefiniti' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/mk.js b/sites/all/modules/ckeditor/includes/uicolor/lang/mk.js new file mode 100644 index 0000000..880eee0 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/mk.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'mk', { + title: 'Палета со бои', + preview: 'Преглед', + config: 'Залепи го овој текст во config.js датотеката', + predefined: 'Предефинирани множества на бои' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/nb.js b/sites/all/modules/ckeditor/includes/uicolor/lang/nb.js new file mode 100644 index 0000000..611ccce --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/nb.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'nb', { + title: 'Fargevelger for brukergrensesnitt', + preview: 'Forhåndsvisning i sanntid', + config: 'Lim inn følgende tekst i din config.js-fil', + predefined: 'Forhåndsdefinerte fargesett' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/nl.js b/sites/all/modules/ckeditor/includes/uicolor/lang/nl.js new file mode 100644 index 0000000..ac383f5 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/nl.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'nl', { + title: 'UI Kleurenkiezer', + preview: 'Live voorbeeld', + config: 'Plak deze tekst in jouw config.js bestand', + predefined: 'Voorgedefinieerde kleurensets' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/no.js b/sites/all/modules/ckeditor/includes/uicolor/lang/no.js new file mode 100644 index 0000000..4b7e729 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/no.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'no', { + title: 'Fargevelger for brukergrensesnitt', + preview: 'Forhåndsvisning i sanntid', + config: 'Lim inn følgende tekst i din config.js-fil', + predefined: 'Forhåndsdefinerte fargesett' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/pl.js b/sites/all/modules/ckeditor/includes/uicolor/lang/pl.js new file mode 100644 index 0000000..2104dd9 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/pl.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'pl', { + title: 'Wybór koloru interfejsu', + preview: 'Podgląd na żywo', + config: 'Wklej poniższy łańcuch znaków do pliku config.js:', + predefined: 'Predefiniowane zestawy kolorów' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/tr.js b/sites/all/modules/ckeditor/includes/uicolor/lang/tr.js new file mode 100644 index 0000000..56c683b --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/tr.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'tr', { + title: 'UI Renk Seçicisi', + preview: 'Canlı önizleme', + config: 'Bu dizeyi config.js dosyasının içine yapıştırın', + predefined: 'Önceden tanımlanmış renk kümeleri' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/ug.js b/sites/all/modules/ckeditor/includes/uicolor/lang/ug.js new file mode 100644 index 0000000..4eee7df --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/ug.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'ug', { + title: 'ئىشلەتكۈچى ئارايۈزى رەڭ تاللىغۇچ', + preview: 'شۇئان ئالدىن كۆزىتىش', + config: 'بۇ ھەرپ تىزىقىنى config.js ھۆججەتكە چاپلايدۇ', + predefined: 'ئالدىن بەلگىلەنگەن رەڭلەر' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/uk.js b/sites/all/modules/ckeditor/includes/uicolor/lang/uk.js new file mode 100644 index 0000000..7c738bd --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/uk.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'uk', { + title: 'Color Picker Інтерфейс', + preview: 'Перегляд наживо', + config: 'Вставте цей рядок у файл config.js', + predefined: 'Стандартний набір кольорів' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/vi.js b/sites/all/modules/ckeditor/includes/uicolor/lang/vi.js new file mode 100644 index 0000000..0dc823a --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/vi.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'vi', { + title: 'Giao diện người dùng Color Picker', + preview: 'Xem trước trực tiếp', + config: 'Dán chuỗi này vào tập tin config.js của bạn', + predefined: 'Tập màu định nghĩa sẵn' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/lang/zh-cn.js b/sites/all/modules/ckeditor/includes/uicolor/lang/zh-cn.js new file mode 100644 index 0000000..df03892 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/lang/zh-cn.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.setLang( 'uicolor', 'zh-cn', { + title: '用户界面颜色选择器', + preview: '即时预览', + config: '粘贴此字符串到你的 config.js 文件', + predefined: '预定义颜色集' +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/plugin.js b/sites/all/modules/ckeditor/includes/uicolor/plugin.js new file mode 100644 index 0000000..cc638da --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/plugin.js @@ -0,0 +1,28 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.add( 'uicolor', { + requires: 'dialog', + lang: 'bg,cs,cy,da,de,el,en,eo,et,fa,fi,fr,he,hr,it,ku,mk,nb,nl,no,pl,tr,ug,uk,vi,zh-cn', // %REMOVE_LINE_CORE% + icons: 'uicolor', // %REMOVE_LINE_CORE% + init: function( editor ) { + if ( CKEDITOR.env.ie6Compat ) + return; + + editor.addCommand( 'uicolor', new CKEDITOR.dialogCommand( 'uicolor' ) ); + editor.ui.addButton && editor.ui.addButton( 'UIColor', { + label: editor.lang.uicolor.title, + command: 'uicolor', + toolbar: 'tools,1' + }); + CKEDITOR.dialog.add( 'uicolor', this.path + 'dialogs/uicolor.js' ); + + // Load YUI js files. + CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( this.path + 'yui/yui.js' ) ); + + // Load YUI css files. + CKEDITOR.document.appendStyleSheet( CKEDITOR.getUrl( this.path + 'yui/assets/yui.css' ) ); + } +}); diff --git a/sites/all/modules/ckeditor/includes/uicolor/samples/uicolor.html b/sites/all/modules/ckeditor/includes/uicolor/samples/uicolor.html new file mode 100644 index 0000000..8b656f0 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/samples/uicolor.html @@ -0,0 +1,103 @@ + + + + + UI Color Picker — CKEditor Sample + + + + + + + + +

        + CKEditor Samples » UI Color Plugin +

        +
        +

        + This sample shows how to use the UI Color picker toolbar button to preview the skin color of the editor. + Note:The UI skin color feature depends on the CKEditor skin + compatibility. The Moono and Kama skins are examples of skins that work with it. +

        +
        +
        +
        +

        + If the uicolor plugin along with the dedicated UIColor + toolbar button is added to CKEditor, the user will also be able to pick the color of the + UI from the color palette available in the UI Color Picker dialog window. +

        +

        + To insert a CKEditor instance with the uicolor plugin enabled, + use the following JavaScript call: +

        +
        +CKEDITOR.replace( 'textarea_id', {
        +	extraPlugins: 'uicolor',
        +	toolbar: [ [ 'Bold', 'Italic' ], [ 'UIColor' ] ]
        +});
        +

        Used in themed instance

        +

        + Click the UI Color Picker toolbar button to open up a color picker dialog. +

        +

        + + +

        +

        Used in inline instance

        +

        + Click the below editable region to display floating toolbar, then click UI Color Picker button. +

        +
        +

        This is some sample text. You are using CKEditor.

        +
        + +
        +

        + +

        +
        + + + diff --git a/sites/all/modules/ckeditor/includes/uicolor/yui/assets/hue_bg.png b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/hue_bg.png new file mode 100644 index 0000000..d9bcdeb Binary files /dev/null and b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/hue_bg.png differ diff --git a/sites/all/modules/ckeditor/includes/uicolor/yui/assets/hue_thumb.png b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/hue_thumb.png new file mode 100644 index 0000000..14d5db4 Binary files /dev/null and b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/hue_thumb.png differ diff --git a/sites/all/modules/ckeditor/includes/uicolor/yui/assets/picker_mask.png b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/picker_mask.png new file mode 100644 index 0000000..f8d9193 Binary files /dev/null and b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/picker_mask.png differ diff --git a/sites/all/modules/ckeditor/includes/uicolor/yui/assets/picker_thumb.png b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/picker_thumb.png new file mode 100644 index 0000000..78445a2 Binary files /dev/null and b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/picker_thumb.png differ diff --git a/sites/all/modules/ckeditor/includes/uicolor/yui/assets/yui.css b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/yui.css new file mode 100644 index 0000000..1bb7c75 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/yui/assets/yui.css @@ -0,0 +1,15 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +.yui-h-slider,.yui-v-slider{position:relative;}.yui-h-slider .yui-slider-thumb,.yui-v-slider .yui-slider-thumb{position:absolute;cursor:default;}.yui-skin-sam .yui-h-slider{background:url(bg-h.gif) no-repeat 5px 0;height:28px;width:228px;}.yui-skin-sam .yui-h-slider .yui-slider-thumb{top:4px;}.yui-skin-sam .yui-v-slider{background:url(bg-v.gif) no-repeat 12px 0;height:228px;width:48px;} + +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +.cke_uicolor_picker .yui-picker-panel{background:#e3e3e3;border-color:#888;}.cke_uicolor_picker .yui-picker-panel .hd{background-color:#ccc;font-size:100%;line-height:100%;border:1px solid #e3e3e3;font-weight:bold;overflow:hidden;padding:6px;color:#000;}.cke_uicolor_picker .yui-picker-panel .bd{background:#e8e8e8;margin:1px;height:200px;}.cke_uicolor_picker .yui-picker-panel .ft{background:#e8e8e8;margin:1px;padding:1px;}.cke_uicolor_picker .yui-picker{position:relative;}.cke_uicolor_picker .yui-picker-hue-thumb{cursor:default;width:18px;height:18px;top:-8px;left:-2px;z-index:9;position:absolute;}.cke_uicolor_picker .yui-picker-hue-bg{-moz-outline:none;outline:0 none;position:absolute;left:200px;height:183px;width:14px;background:url(hue_bg.png) no-repeat;top:4px;}.cke_uicolor_picker .yui-picker-bg{-moz-outline:none;outline:0 none;position:absolute;top:4px;left:4px;height:182px;width:182px;background-color:#F00;background-image:url(picker_mask.png);}*html .cke_uicolor_picker .yui-picker-bg{background-image:none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='picker_mask.png',sizingMethod='scale');}.cke_uicolor_picker .yui-picker-mask{position:absolute;z-index:1;top:0;left:0;}.cke_uicolor_picker .yui-picker-thumb{cursor:default;width:11px;height:11px;z-index:9;position:absolute;top:-4px;left:-4px;}.cke_uicolor_picker .yui-picker-swatch{position:absolute;left:240px;top:4px;height:60px;width:55px;border:1px solid #888;}.cke_uicolor_picker .yui-picker-websafe-swatch{position:absolute;left:304px;top:4px;height:24px;width:24px;border:1px solid #888;}.cke_uicolor_picker .yui-picker-controls{position:absolute;top:72px;left:226px;font:1em monospace;}.cke_uicolor_picker .yui-picker-controls .hd{background:transparent;border-width:0!important;}.cke_uicolor_picker .yui-picker-controls .bd{height:100px;border-width:0!important;}.cke_uicolor_picker .yui-picker-controls ul{float:left;padding:0 2px 0 0;margin:0;}.cke_uicolor_picker .yui-picker-controls li{padding:2px;list-style:none;margin:0;}.cke_uicolor_picker .yui-picker-controls input{font-size:.85em;width:2.4em;}.cke_uicolor_picker .yui-picker-hex-controls{clear:both;padding:2px;}.cke_uicolor_picker .yui-picker-hex-controls input{width:4.6em;}.cke_uicolor_picker .yui-picker-controls a{font:1em arial,helvetica,clean,sans-serif;display:block;*display:inline-block;padding:0;color:#000;} diff --git a/sites/all/modules/ckeditor/includes/uicolor/yui/yui.js b/sites/all/modules/ckeditor/includes/uicolor/yui/yui.js new file mode 100644 index 0000000..7af4080 --- /dev/null +++ b/sites/all/modules/ckeditor/includes/uicolor/yui/yui.js @@ -0,0 +1,5914 @@ +/*jsl:ignoreall*/ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +if ( typeof YAHOO == "undefined" || !YAHOO ) { + var YAHOO = {}; +} +YAHOO.namespace = function() { + var A = arguments, + E = null, + C, B, D; + for ( C = 0; C < A.length; C = C + 1 ) { + D = ( "" + A[ C ] ).split( "." ); + E = YAHOO; + for ( B = ( D[ 0 ] == "YAHOO" ) ? 1 : 0; B < D.length; B = B + 1 ) { + E[ D[ B ] ] = E[ D[ B ] ] || {}; + E = E[ D[ B ] ]; + } + } + return E; +}; +YAHOO.log = function( D, A, C ) { + var B = YAHOO.widget.Logger; + if ( B && B.log ) { + return B.log( D, A, C ); + } else { + return false; + } +}; +YAHOO.register = function( A, E, D ) { + var I = YAHOO.env.modules, + B, H, G, F, C; + if ( !I[ A ] ) { + I[ A ] = { versions: [], builds: [] }; + } + B = I[ A ]; + H = D.version; + G = D.build; + F = YAHOO.env.listeners; + B.name = A; + B.version = H; + B.build = G; + B.versions.push( H ); + B.builds.push( G ); + B.mainClass = E; + for ( C = 0; C < F.length; C = C + 1 ) { + F[ C ]( B ); + } + if ( E ) { + E.VERSION = H; + E.BUILD = G; + } else { + YAHOO.log( "mainClass is undefined for module " + A, "warn" ); + } +}; +YAHOO.env = YAHOO.env || { modules: [], listeners: [] }; YAHOO.env.getVersion = function( A ) { + return YAHOO.env.modules[ A ] || null; +}; +YAHOO.env.ua = function() { + var C = { ie: 0, opera: 0, gecko: 0, webkit: 0, mobile: null, air: 0, caja: 0 }, + B = navigator.userAgent, + A; if ( ( /KHTML/ ).test( B ) ) { + C.webkit = 1; + } + A = B.match( /AppleWebKit\/([^\s]*)/ ); + if ( A && A[ 1 ] ) { + C.webkit = parseFloat( A[ 1 ] ); + if ( / Mobile\//.test( B ) ) { + C.mobile = "Apple"; + } else { + A = B.match( /NokiaN[^\/]*/ ); + if ( A ) { + C.mobile = A[ 0 ]; + } + } + A = B.match( /AdobeAIR\/([^\s]*)/ ); + if ( A ) { + C.air = A[ 0 ]; + } + } + if ( !C.webkit ) { + A = B.match( /Opera[\s\/]([^\s]*)/ ); + if ( A && A[ 1 ] ) { + C.opera = parseFloat( A[ 1 ] ); + A = B.match( /Opera Mini[^;]*/ ); + if ( A ) { + C.mobile = A[ 0 ]; + } + } else { + A = B.match( /MSIE\s([^;]*)/ ); + if ( A && A[ 1 ] ) { + C.ie = parseFloat( A[ 1 ] ); + } else { + A = B.match( /Gecko\/([^\s]*)/ ); + if ( A ) { + C.gecko = 1; + A = B.match( /rv:([^\s\)]*)/ ); + if ( A && A[ 1 ] ) { + C.gecko = parseFloat( A[ 1 ] ); + } + } + } + } + } + A = B.match( /Caja\/([^\s]*)/ ); + if ( A && A[ 1 ] ) { + C.caja = parseFloat( A[ 1 ] ); + } + return C; +}(); +(function() { + YAHOO.namespace( "util", "widget", "example" ); + if ( "undefined" !== typeof YAHOO_config ) { + var B = YAHOO_config.listener, + A = YAHOO.env.listeners, + D = true, + C; + if ( B ) { + for ( C = 0; C < A.length; C = C + 1 ) { + if ( A[ C ] == B ) { + D = false; + break; + } + } + if ( D ) { + A.push( B ); + } + } + } +})(); +YAHOO.lang = YAHOO.lang || {}; +(function() { + var B = YAHOO.lang, + F = "[object Array]", + C = "[object Function]", + A = Object.prototype, + E = [ "toString", "valueOf" ], + D = { + isArray: function( G ) { + return A.toString.apply( G ) === F; + }, + isBoolean: function( G ) { + return typeof G === "boolean"; + }, + isFunction: function( G ) { + return A.toString.apply( G ) === C; + }, + isNull: function( G ) { + return G === null; + }, + isNumber: function( G ) { + return typeof G === "number" && isFinite( G ); + }, + isObject: function( G ) { + return ( G && ( typeof G === "object" || B.isFunction( G ) ) ) || false; + }, + isString: function( G ) { + return typeof G === "string"; + }, + isUndefined: function( G ) { + return typeof G === "undefined"; + }, + _IEEnumFix: ( YAHOO.env.ua.ie ) ? + function( I, H ) { + var G, K, J; for ( G = 0; G < E.length; G = G + 1 ) { + K = E[ G ]; + J = H[ K ]; + if ( B.isFunction( J ) && J != A[ K ] ) { + I[ K ] = J; + } + } + } : function() {}, + extend: function( J, K, I ) { + if ( !K || !J ) { + throw new Error( "extend failed, please check that " + "all dependencies are included." ); + } + var H = function() {}, + G; + H.prototype = K.prototype; + J.prototype = new H(); + J.prototype.constructor = J; + J.superclass = K.prototype; + if ( K.prototype.constructor == A.constructor ) { + K.prototype.constructor = K; + } + if ( I ) { + for ( G in I ) { + if ( B.hasOwnProperty( I, G ) ) { + J.prototype[ G ] = I[ G ]; + } + } + B._IEEnumFix( J.prototype, I ); + } + }, + augmentObject: function( K, J ) { + if ( !J || !K ) { + throw new Error( "Absorb failed, verify dependencies." ); + } + var G = arguments, + I, L, + H = G[ 2 ]; + if ( H && H !== true ) { + for ( I = 2; I < G.length; I = I + 1 ) { + K[ G[ I ] ] = J[ G[ I ] ]; + } + } else { + for ( L in J ) { + if ( H || !( L in K ) ) { + K[ L ] = J[ L ]; + } + } + B._IEEnumFix( K, J ); + } + }, + augmentProto: function( J, I ) { + if ( !I || !J ) { + throw new Error( "Augment failed, verify dependencies." ); + } + var G = [ J.prototype, I.prototype ], + H; + for ( H = 2; H < arguments.length; H = H + 1 ) { + G.push( arguments[ H ] ); + } + B.augmentObject.apply( this, G ); + }, + dump: function( G, L ) { + var I, K, + N = [], + O = "{...}", + H = "f(){...}", + M = ", ", + J = " => "; + if ( !B.isObject( G ) ) { + return G + ""; + } else { + if ( G instanceof Date || ( "nodeType" in G && "tagName" in G ) ) { + return G; + } else { + if ( B.isFunction( G ) ) { + return H; + } + } + } + L = ( B.isNumber( L ) ) ? L : 3; + if ( B.isArray( G ) ) { + N.push( "[" ); + for ( I = 0, K = G.length; I < K; I = I + 1 ) { + if ( B.isObject( G[ I ] ) ) { + N.push( ( L > 0 ) ? B.dump( G[ I ], L - 1 ) : O ); + } else { + N.push( G[ I ] ); + } + N.push( M ); + } + if ( N.length > 1 ) { + N.pop(); + } + N.push( "]" ); + } else { + N.push( "{" ); + for ( I in G ) { + if ( B.hasOwnProperty( G, I ) ) { + N.push( I + J ); + if ( B.isObject( G[ I ] ) ) { + N.push( ( L > 0 ) ? B.dump( G[ I ], L - 1 ) : O ); + } else { + N.push( G[ I ] ); + } + N.push( M ); + } + } + if ( N.length > 1 ) { + N.pop(); + } + N.push( "}" ); + } + return N.join( "" ); + }, + substitute: function( V, H, O ) { + var L, K, J, R, S, U, + Q = [], + I, + M = "dump", + P = " ", + G = "{", + T = "}", + N; + for ( ;; ) { + L = V.lastIndexOf( G ); + if ( L < 0 ) { + break; + } + K = V.indexOf( T, L ); + if ( L + 1 >= K ) { + break; + } + I = V.substring( L + 1, K ); + R = I; + U = null; + J = R.indexOf( P ); + if ( J > -1 ) { + U = R.substring( J + 1 ); + R = R.substring( 0, J ); + } + S = H[ R ]; + if ( O ) { + S = O( R, S, U ); + } + if ( B.isObject( S ) ) { + if ( B.isArray( S ) ) { + S = B.dump( S, parseInt( U, 10 ) ); + } else { + U = U || ""; + N = U.indexOf( M ); + if ( N > -1 ) { + U = U.substring( 4 ); + } + if ( S.toString === A.toString || N > -1 ) { + S = B.dump( S, parseInt( U, 10 ) ); + } else { + S = S.toString(); + } + } + } else { + if ( !B.isString( S ) && !B.isNumber( S ) ) { + S = "~-" + Q.length + "-~"; + Q[ Q.length ] = I; + } + } + V = V.substring( 0, L ) + S + V.substring( K + 1 ); + } + for ( L = Q.length - 1; L >= 0; L = L - 1 ) { + V = V.replace( new RegExp( "~-" + L + "-~" ), "{" + Q[ L ] + "}", "g" ); + } + return V; + }, + trim: function( G ) { + try { + return G.replace( /^\s+|\s+$/g, "" ); + } catch ( H ) { + return G; + } + }, + merge: function() { + var J = {}, + H = arguments, + G = H.length, + I; + for ( I = 0; I < G; I = I + 1 ) { + B.augmentObject( J, H[ I ], true ); + } + return J; + }, + later: function( N, H, O, J, K ) { + N = N || 0; H = H || {}; + var I = O, + M = J, + L, G; + if ( B.isString( O ) ) { + I = H[ O ]; + } + if ( !I ) { + throw new TypeError( "method undefined" ); + } + if ( !B.isArray( M ) ) { + M = [ J ]; + } + L = function() { + I.apply( H, M ); + }; + G = ( K ) ? setInterval( L, N ) : setTimeout( L, N ); + return { + interval: K, cancel: function() { + if ( this.interval ) { + clearInterval( G ); + } else { + clearTimeout( G ); + } + } }; + }, + isValue: function( G ) { + return ( B.isObject( G ) || B.isString( G ) || B.isNumber( G ) || B.isBoolean( G ) ); + } }; B.hasOwnProperty = ( A.hasOwnProperty ) ? + function( G, H ) { + return G && G.hasOwnProperty( H ); + } : function( G, H ) { + return !B.isUndefined( G[ H ] ) && G.constructor.prototype[ H ] !== G[ H ]; + }; + D.augmentObject( B, D, true ); + YAHOO.util.Lang = B; + B.augment = B.augmentProto; + YAHOO.augment = B.augmentProto; + YAHOO.extend = B.extend; +})(); +YAHOO.register( "yahoo", YAHOO, { version: "2.7.0", build: "1796" } ); +(function() { + YAHOO.env._id_counter = YAHOO.env._id_counter || 0; + var E = YAHOO.util, + L = YAHOO.lang, + m = YAHOO.env.ua, + A = YAHOO.lang.trim, + d = {}, + h = {}, + N = /^t(?:able|d|h)$/i, + X = /color$/i, + K = window.document, + W = K.documentElement, + e = "ownerDocument", + n = "defaultView", + v = "documentElement", + t = "compatMode", + b = "offsetLeft", + P = "offsetTop", + u = "offsetParent", + Z = "parentNode", + l = "nodeType", + C = "tagName", + O = "scrollLeft", + i = "scrollTop", + Q = "getBoundingClientRect", + w = "getComputedStyle", + a = "currentStyle", + M = "CSS1Compat", + c = "BackCompat", + g = "class", + F = "className", + J = "", + B = " ", + s = "(?:^|\\s)", + k = "(?= |$)", + U = "g", + p = "position", + f = "fixed", + V = "relative", + j = "left", + o = "top", + r = "medium", + q = "borderLeftWidth", + R = "borderTopWidth", + D = m.opera, + I = m.webkit, + H = m.gecko, + T = m.ie; + E.Dom = { + CUSTOM_ATTRIBUTES: ( !W.hasAttribute ) ? { "for": "htmlFor", "class": F } : { "htmlFor": "for", "className": g }, + get: function( y ) { + var AA, Y, z, x, G; if ( y ) { + if ( y[ l ] || y.item ) { + return y; + } + if ( typeof y === "string" ) { + AA = y; + y = K.getElementById( y ); + if ( y && y.id === AA ) { + return y; + } else { + if ( y && K.all ) { + y = null; + Y = K.all[ AA ]; + for ( x = 0, G = Y.length; x < G; ++x ) { + if ( Y[ x ].id === AA ) { + return Y[ x ]; + } + } + } + } + return y; + } + if ( y.DOM_EVENTS ) { + y = y.get( "element" ); + } + if ( "length" in y ) { + z = []; + for ( x = 0, G = y.length; x < G; ++x ) { + z[ z.length ] = E.Dom.get( y[ x ] ); + } + return z; + } + return y; + } + return null; + }, + getComputedStyle: function( G, Y ) { + if ( window[ w ] ) { + return G[ e ][ n ][ w ]( G, null )[ Y ]; + } else { + if ( G[ a ] ) { + return E.Dom.IE_ComputedStyle.get( G, Y ); + } + } + }, + getStyle: function( G, Y ) { + return E.Dom.batch( G, E.Dom._getStyle, Y ); + }, + _getStyle: function() { + if ( window[ w ] ) { + return function( G, y ) { + y = ( y === "float" ) ? y = "cssFloat" : E.Dom._toCamel( y ); + var x = G.style[ y ], + Y; + if ( !x ) { + Y = G[ e ][ n ][ w ]( G, null ); + if ( Y ) { + x = Y[ y ]; + } + } + return x; + }; + } else { + if ( W[ a ] ) { + return function( G, y ) { + var x; + switch ( y ) { + case "opacity": + x = 100; + try { + x = G.filters[ "DXImageTransform.Microsoft.Alpha" ].opacity; + } catch ( z ) { + try { + x = G.filters( "alpha" ).opacity; + } catch ( Y ) {} + } + return x / 100;case "float": + y = "styleFloat";default: + y = E.Dom._toCamel( y ); + x = G[ a ] ? G[ a ][ y ] : null; + return ( G.style[ y ] || x ); + } + }; + } + } + }(), setStyle: function( G, Y, x ) { + E.Dom.batch( G, E.Dom._setStyle, { prop: Y, val: x } ); + }, + _setStyle: function() { + if ( T ) { + return function( Y, G ) { + var x = E.Dom._toCamel( G.prop ), + y = G.val; + if ( Y ) { + switch ( x ) { + case "opacity": + if ( L.isString( Y.style.filter ) ) { + Y.style.filter = "alpha(opacity=" + y * 100 + ")"; + if ( !Y[ a ] || !Y[ a ].hasLayout ) { + Y.style.zoom = 1; + } + } + break;case "float": + x = "styleFloat";default: + Y.style[ x ] = y; + } + } else {} + }; + } else { + return function( Y, G ) { + var x = E.Dom._toCamel( G.prop ), + y = G.val; + if ( Y ) { + if ( x == "float" ) { + x = "cssFloat"; + } + Y.style[ x ] = y; + } else {} + }; + } + }(), getXY: function( G ) { + return E.Dom.batch( G, E.Dom._getXY ); + }, + _canPosition: function( G ) { + return ( E.Dom._getStyle( G, "display" ) !== "none" && E.Dom._inDoc( G ) ); + }, + _getXY: function() { + if ( K[ v ][ Q ] ) { + return function( y ) { + var z, Y, AA, AF, AE, AD, AC, G, x, + AB = Math.floor, + AG = false; + if ( E.Dom._canPosition( y ) ) { + AA = y[ Q ](); + AF = y[ e ]; + z = E.Dom.getDocumentScrollLeft( AF ); + Y = E.Dom.getDocumentScrollTop( AF ); + AG = [ AB( AA[ j ] ), AB( AA[ o ] ) ]; + if ( T && m.ie < 8 ) { + AE = 2; + AD = 2; + AC = AF[ t ]; + G = S( AF[ v ], q ); + x = S( AF[ v ], R ); + if ( m.ie === 6 ) { + if ( AC !== c ) { + AE = 0; + AD = 0; + } + } + if ( ( AC == c ) ) { + if ( G !== r ) { + AE = parseInt( G, 10 ); + } + if ( x !== r ) { + AD = parseInt( x, 10 ); + } + } + AG[ 0 ] -= AE; + AG[ 1 ] -= AD; + } + if ( ( Y || z ) ) { + AG[ 0 ] += z; + AG[ 1 ] += Y; + } + AG[ 0 ] = AB( AG[ 0 ] ); + AG[ 1 ] = AB( AG[ 1 ] ); + } else {} + return AG; + }; + } else { + return function( y ) { + var x, Y, AA, AB, AC, + z = false, + G = y; + if ( E.Dom._canPosition( y ) ) { + z = [ y[ b ], y[ P ] ]; + x = E.Dom.getDocumentScrollLeft( y[ e ] ); + Y = E.Dom.getDocumentScrollTop( y[ e ] ); + AC = ( ( H || m.webkit > 519 ) ? true : false ); + while ( ( G = G[ u ] ) ) { + z[ 0 ] += G[ b ]; + z[ 1 ] += G[ P ]; + if ( AC ) { + z = E.Dom._calcBorders( G, z ); + } + } + if ( E.Dom._getStyle( y, p ) !== f ) { + G = y; + while ( ( G = G[ Z ] ) && G[ C ] ) { + AA = G[ i ]; + AB = G[ O ]; + if ( H && ( E.Dom._getStyle( G, "overflow" ) !== "visible" ) ) { + z = E.Dom._calcBorders( G, z ); + } + if ( AA || AB ) { + z[ 0 ] -= AB; + z[ 1 ] -= AA; + } + } + z[ 0 ] += x; + z[ 1 ] += Y; + } else { + if ( D ) { + z[ 0 ] -= x; + z[ 1 ] -= Y; + } else { + if ( I || H ) { + z[ 0 ] += x; + z[ 1 ] += Y; + } + } + } + z[ 0 ] = Math.floor( z[ 0 ] ); + z[ 1 ] = Math.floor( z[ 1 ] ); + } else {} + return z; + }; + } + }(), getX: function( G ) { + var Y = function( x ) { + return E.Dom.getXY( x )[ 0 ]; + }; + return E.Dom.batch( G, Y, E.Dom, true ); + }, + getY: function( G ) { + var Y = function( x ) { + return E.Dom.getXY( x )[ 1 ]; + }; + return E.Dom.batch( G, Y, E.Dom, true ); + }, + setXY: function( G, x, Y ) { + E.Dom.batch( G, E.Dom._setXY, { pos: x, noRetry: Y } ); + }, + _setXY: function( G, z ) { + var AA = E.Dom._getStyle( G, p ), + y = E.Dom.setStyle, + AD = z.pos, + Y = z.noRetry, + AB = [ parseInt( E.Dom.getComputedStyle( G, j ), 10 ), parseInt( E.Dom.getComputedStyle( G, o ), 10 ) ], + AC, x; + if ( AA == "static" ) { + AA = V; + y( G, p, AA ); + } + AC = E.Dom._getXY( G ); + if ( !AD || AC === false ) { + return false; + } + if ( isNaN( AB[ 0 ] ) ) { + AB[ 0 ] = ( AA == V ) ? 0 : G[ b ]; + } + if ( isNaN( AB[ 1 ] ) ) { + AB[ 1 ] = ( AA == V ) ? 0 : G[ P ]; + } + if ( AD[ 0 ] !== null ) { + y( G, j, AD[ 0 ] - AC[ 0 ] + AB[ 0 ] + "px" ); + } + if ( AD[ 1 ] !== null ) { + y( G, o, AD[ 1 ] - AC[ 1 ] + AB[ 1 ] + "px" ); + } + if ( !Y ) { + x = E.Dom._getXY( G ); + if ( ( AD[ 0 ] !== null && x[ 0 ] != AD[ 0 ] ) || ( AD[ 1 ] !== null && x[ 1 ] != AD[ 1 ] ) ) { + E.Dom._setXY( G, { pos: AD, noRetry: true } ); + } + } + }, + setX: function( Y, G ) { + E.Dom.setXY( Y, [ G, null ] ); + }, + setY: function( G, Y ) { + E.Dom.setXY( G, [ null, Y ] ); + }, + getRegion: function( G ) { + var Y = function( x ) { + var y = false; + if ( E.Dom._canPosition( x ) ) { + y = E.Region.getRegion( x ); + } else {} + return y; + }; + return E.Dom.batch( G, Y, E.Dom, true ); + }, + getClientWidth: function() { + return E.Dom.getViewportWidth(); + }, + getClientHeight: function() { + return E.Dom.getViewportHeight(); + }, + getElementsByClassName: function( AB, AF, AC, AE, x, AD ) { + AB = L.trim( AB ); + AF = AF || "*"; + AC = ( AC ) ? E.Dom.get( AC ) : null || K; + if ( !AC ) { + return []; + } + var Y = [], + G = AC.getElementsByTagName( AF ), + z = E.Dom.hasClass; + for ( var y = 0, AA = G.length; y < AA; ++y ) { + if ( z( G[ y ], AB ) ) { + Y[ Y.length ] = G[ y ]; + } + } + if ( AE ) { + E.Dom.batch( Y, AE, x, AD ); + } + return Y; + }, + hasClass: function( Y, G ) { + return E.Dom.batch( Y, E.Dom._hasClass, G ); + }, + _hasClass: function( x, Y ) { + var G = false, + y; if ( x && Y ) { + y = E.Dom.getAttribute( x, F ) || J; + if ( Y.exec ) { + G = Y.test( y ); + } else { + G = Y && ( B + y + B ).indexOf( B + Y + B ) > -1; + } + } else {} + return G; + }, + addClass: function( Y, G ) { + return E.Dom.batch( Y, E.Dom._addClass, G ); + }, + _addClass: function( x, Y ) { + var G = false, + y; if ( x && Y ) { + y = E.Dom.getAttribute( x, F ) || J; + if ( !E.Dom._hasClass( x, Y ) ) { + E.Dom.setAttribute( x, F, A( y + B + Y ) ); + G = true; + } + } else {} + return G; + }, + removeClass: function( Y, G ) { + return E.Dom.batch( Y, E.Dom._removeClass, G ); + }, + _removeClass: function( y, x ) { + var Y = false, + AA, z, G; if ( y && x ) { + AA = E.Dom.getAttribute( y, F ) || J; + E.Dom.setAttribute( y, F, AA.replace( E.Dom._getClassRegex( x ), J ) ); + z = E.Dom.getAttribute( y, F ); + if ( AA !== z ) { + E.Dom.setAttribute( y, F, A( z ) ); + Y = true; + if ( E.Dom.getAttribute( y, F ) === "" ) { + G = ( y.hasAttribute && y.hasAttribute( g ) ) ? g : F; + y.removeAttribute( G ); + } + } + } else {} + return Y; + }, + replaceClass: function( x, Y, G ) { + return E.Dom.batch( x, E.Dom._replaceClass, { from: Y, to: G } ); + }, + _replaceClass: function( y, x ) { + var Y, AB, AA, + G = false, + z; if ( y && x ) { + AB = x.from; + AA = x.to; + if ( !AA ) { + G = false; + } else { + if ( !AB ) { + G = E.Dom._addClass( y, x.to ); + } else { + if ( AB !== AA ) { + z = E.Dom.getAttribute( y, F ) || J; + Y = ( B + z.replace( E.Dom._getClassRegex( AB ), B + AA ) ).split( E.Dom._getClassRegex( AA ) ); + Y.splice( 1, 0, B + AA ); + E.Dom.setAttribute( y, F, A( Y.join( J ) ) ); + G = true; + } + } + } + } else {} + return G; + }, + generateId: function( G, x ) { + x = x || "yui-gen"; var Y = function( y ) { + if ( y && y.id ) { + return y.id; + } + var z = x + YAHOO.env._id_counter++; + if ( y ) { + if ( y[ e ].getElementById( z ) ) { + return E.Dom.generateId( y, z + x ); + } + y.id = z; + } + return z; + }; + return E.Dom.batch( G, Y, E.Dom, true ) || Y.apply( E.Dom, arguments ); + }, + isAncestor: function( Y, x ) { + Y = E.Dom.get( Y ); + x = E.Dom.get( x ); + var G = false; + if ( ( Y && x ) && ( Y[ l ] && x[ l ] ) ) { + if ( Y.contains && Y !== x ) { + G = Y.contains( x ); + } else { + if ( Y.compareDocumentPosition ) { + G = !!( Y.compareDocumentPosition( x ) & 16 ); + } + } + } else {} + return G; + }, + inDocument: function( G, Y ) { + return E.Dom._inDoc( E.Dom.get( G ), Y ); + }, + _inDoc: function( Y, x ) { + var G = false; if ( Y && Y[ C ] ) { + x = x || Y[ e ]; + G = E.Dom.isAncestor( x[ v ], Y ); + } else {} + return G; + }, + getElementsBy: function( Y, AF, AB, AD, y, AC, AE ) { + AF = AF || "*"; AB = ( AB ) ? E.Dom.get( AB ) : null || K; + if ( !AB ) { + return []; + } + var x = [], + G = AB.getElementsByTagName( AF ); + for ( var z = 0, AA = G.length; z < AA; ++z ) { + if ( Y( G[ z ] ) ) { + if ( AE ) { + x = G[ z ]; + break; + } else { + x[ x.length ] = G[ z ]; + } + } + } + if ( AD ) { + E.Dom.batch( x, AD, y, AC ); + } + return x; + }, + getElementBy: function( x, G, Y ) { + return E.Dom.getElementsBy( x, G, Y, null, null, null, true ); + }, + batch: function( x, AB, AA, z ) { + var y = [], + Y = ( z ) ? AA : window; + x = ( x && ( x[ C ] || x.item ) ) ? x : E.Dom.get( x ); + if ( x && AB ) { + if ( x[ C ] || x.length === undefined ) { + return AB.call( Y, x, AA ); + } + for ( var G = 0; G < x.length; ++G ) { + y[ y.length ] = AB.call( Y, x[ G ], AA ); + } + } else { + return false; + } + return y; + }, + getDocumentHeight: function() { + var Y = ( K[ t ] != M || I ) ? K.body.scrollHeight : W.scrollHeight, + G = Math.max( Y, E.Dom.getViewportHeight() ); + return G; + }, + getDocumentWidth: function() { + var Y = ( K[ t ] != M || I ) ? K.body.scrollWidth : W.scrollWidth, + G = Math.max( Y, E.Dom.getViewportWidth() ); + return G; + }, + getViewportHeight: function() { + var G = self.innerHeight, + Y = K[ t ]; + if ( ( Y || T ) && !D ) { + G = ( Y == M ) ? W.clientHeight : K.body.clientHeight; + } + return G; + }, + getViewportWidth: function() { + var G = self.innerWidth, + Y = K[ t ]; + if ( Y || T ) { + G = ( Y == M ) ? W.clientWidth : K.body.clientWidth; + } + return G; + }, + getAncestorBy: function( G, Y ) { + while ( ( G = G[ Z ] ) ) { + if ( E.Dom._testElement( G, Y ) ) { + return G; + } + } + return null; + }, + getAncestorByClassName: function( Y, G ) { + Y = E.Dom.get( Y ); + if ( !Y ) { + return null; + } + var x = function( y ) { + return E.Dom.hasClass( y, G ); + }; + return E.Dom.getAncestorBy( Y, x ); + }, + getAncestorByTagName: function( Y, G ) { + Y = E.Dom.get( Y ); + if ( !Y ) { + return null; + } + var x = function( y ) { + return y[ C ] && y[ C ].toUpperCase() == G.toUpperCase(); + }; + return E.Dom.getAncestorBy( Y, x ); + }, + getPreviousSiblingBy: function( G, Y ) { + while ( G ) { + G = G.previousSibling; + if ( E.Dom._testElement( G, Y ) ) { + return G; + } + } + return null; + }, + getPreviousSibling: function( G ) { + G = E.Dom.get( G ); + if ( !G ) { + return null; + } + return E.Dom.getPreviousSiblingBy( G ); + }, + getNextSiblingBy: function( G, Y ) { + while ( G ) { + G = G.nextSibling; + if ( E.Dom._testElement( G, Y ) ) { + return G; + } + } + return null; + }, + getNextSibling: function( G ) { + G = E.Dom.get( G ); + if ( !G ) { + return null; + } + return E.Dom.getNextSiblingBy( G ); + }, + getFirstChildBy: function( G, x ) { + var Y = ( E.Dom._testElement( G.firstChild, x ) ) ? G.firstChild : null; + return Y || E.Dom.getNextSiblingBy( G.firstChild, x ); + }, + getFirstChild: function( G, Y ) { + G = E.Dom.get( G ); + if ( !G ) { + return null; + } + return E.Dom.getFirstChildBy( G ); + }, + getLastChildBy: function( G, x ) { + if ( !G ) { + return null; + } + var Y = ( E.Dom._testElement( G.lastChild, x ) ) ? G.lastChild : null; + return Y || E.Dom.getPreviousSiblingBy( G.lastChild, x ); + }, + getLastChild: function( G ) { + G = E.Dom.get( G ); + return E.Dom.getLastChildBy( G ); + }, + getChildrenBy: function( Y, y ) { + var x = E.Dom.getFirstChildBy( Y, y ), + G = x ? [ x ] : []; + E.Dom.getNextSiblingBy( x, function( z ) { + if ( !y || y( z ) ) { + G[ G.length ] = z; + } + return false; + }); + return G; + }, + getChildren: function( G ) { + G = E.Dom.get( G ); + if ( !G ) {} + return E.Dom.getChildrenBy( G ); + }, + getDocumentScrollLeft: function( G ) { + G = G || K; return Math.max( G[ v ].scrollLeft, G.body.scrollLeft ); + }, + getDocumentScrollTop: function( G ) { + G = G || K; return Math.max( G[ v ].scrollTop, G.body.scrollTop ); + }, + insertBefore: function( Y, G ) { + Y = E.Dom.get( Y ); + G = E.Dom.get( G ); + if ( !Y || !G || !G[ Z ] ) { + return null; + } + return G[ Z ].insertBefore( Y, G ); + }, + insertAfter: function( Y, G ) { + Y = E.Dom.get( Y ); + G = E.Dom.get( G ); + if ( !Y || !G || !G[ Z ] ) { + return null; + } + if ( G.nextSibling ) { + return G[ Z ].insertBefore( Y, G.nextSibling ); + } else { + return G[ Z ].appendChild( Y ); + } + }, + getClientRegion: function() { + var x = E.Dom.getDocumentScrollTop(), + Y = E.Dom.getDocumentScrollLeft(), + y = E.Dom.getViewportWidth() + Y, + G = E.Dom.getViewportHeight() + x; + return new E.Region( x, y, G, Y ); + }, + setAttribute: function( Y, G, x ) { + G = E.Dom.CUSTOM_ATTRIBUTES[ G ] || G; + Y.setAttribute( G, x ); + }, + getAttribute: function( Y, G ) { + G = E.Dom.CUSTOM_ATTRIBUTES[ G ] || G; + return Y.getAttribute( G ); + }, + _toCamel: function( Y ) { + var x = d; + + function G( y, z ) { + return z.toUpperCase(); + } + return x[ Y ] || ( x[ Y ] = Y.indexOf( "-" ) === -1 ? Y : Y.replace( /-([a-z])/gi, G ) ); + }, + _getClassRegex: function( Y ) { + var G; if ( Y !== undefined ) { + if ( Y.exec ) { + G = Y; + } else { + G = h[ Y ]; + if ( !G ) { + Y = Y.replace( E.Dom._patterns.CLASS_RE_TOKENS, "\\$1" ); + G = h[ Y ] = new RegExp( s + Y + k, U ); + } + } + } + return G; + }, + _patterns: { ROOT_TAG: /^body|html$/i, CLASS_RE_TOKENS: /([\.\(\)\^\$\*\+\?\|\[\]\{\}])/g }, + _testElement: function( G, Y ) { + return G && G[ l ] == 1 && ( !Y || Y( G ) ); + }, + _calcBorders: function( x, y ) { + var Y = parseInt( E.Dom[ w ]( x, R ), 10 ) || 0, + G = parseInt( E.Dom[ w ]( x, q ), 10 ) || 0; + if ( H ) { + if ( N.test( x[ C ] ) ) { + Y = 0; + G = 0; + } + } + y[ 0 ] += G; + y[ 1 ] += Y; + return y; + } }; var S = E.Dom[ w ]; + if ( m.opera ) { + E.Dom[ w ] = function( Y, G ) { + var x = S( Y, G ); + if ( X.test( G ) ) { + x = E.Dom.Color.toRGB( x ); + } + return x; + }; + } + if ( m.webkit ) { + E.Dom[ w ] = function( Y, G ) { + var x = S( Y, G ); + if ( x === "rgba(0, 0, 0, 0)" ) { + x = "transparent"; + } + return x; + }; + } +})(); +YAHOO.util.Region = function( C, D, A, B ) { + this.top = C; + this.y = C; + this[ 1 ] = C; + this.right = D; + this.bottom = A; + this.left = B; + this.x = B; + this[ 0 ] = B; + this.width = this.right - this.left; + this.height = this.bottom - this.top; +}; +YAHOO.util.Region.prototype.contains = function( A ) { + return ( A.left >= this.left && A.right <= this.right && A.top >= this.top && A.bottom <= this.bottom ); +}; +YAHOO.util.Region.prototype.getArea = function() { + return ( ( this.bottom - this.top ) * ( this.right - this.left ) ); +}; +YAHOO.util.Region.prototype.intersect = function( E ) { + var C = Math.max( this.top, E.top ), + D = Math.min( this.right, E.right ), + A = Math.min( this.bottom, E.bottom ), + B = Math.max( this.left, E.left ); + if ( A >= C && D >= B ) { + return new YAHOO.util.Region( C, D, A, B ); + } else { + return null; + } +}; +YAHOO.util.Region.prototype.union = function( E ) { + var C = Math.min( this.top, E.top ), + D = Math.max( this.right, E.right ), + A = Math.max( this.bottom, E.bottom ), + B = Math.min( this.left, E.left ); + return new YAHOO.util.Region( C, D, A, B ); +}; +YAHOO.util.Region.prototype.toString = function() { + return ( "Region {" + "top: " + this.top + ", right: " + this.right + ", bottom: " + this.bottom + ", left: " + this.left + ", height: " + this.height + ", width: " + this.width + "}" ); +}; +YAHOO.util.Region.getRegion = function( D ) { + var F = YAHOO.util.Dom.getXY( D ), + C = F[ 1 ], + E = F[ 0 ] + D.offsetWidth, + A = F[ 1 ] + D.offsetHeight, + B = F[ 0 ]; + return new YAHOO.util.Region( C, E, A, B ); +}; +YAHOO.util.Point = function( A, B ) { + if ( YAHOO.lang.isArray( A ) ) { + B = A[ 1 ]; + A = A[ 0 ]; + } + YAHOO.util.Point.superclass.constructor.call( this, B, A, B, A ); +}; +YAHOO.extend( YAHOO.util.Point, YAHOO.util.Region ); +(function() { + var B = YAHOO.util, + A = "clientTop", + F = "clientLeft", + J = "parentNode", + K = "right", + W = "hasLayout", + I = "px", + U = "opacity", + L = "auto", + D = "borderLeftWidth", + G = "borderTopWidth", + P = "borderRightWidth", + V = "borderBottomWidth", + S = "visible", + Q = "transparent", + N = "height", + E = "width", + H = "style", + T = "currentStyle", + R = /^width|height$/, + O = /^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i, + M = { + get: function( X, Z ) { + var Y = "", + a = X[ T ][ Z ]; + if ( Z === U ) { + Y = B.Dom.getStyle( X, U ); + } else { + if ( !a || ( a.indexOf && a.indexOf( I ) > -1 ) ) { + Y = a; + } else { + if ( B.Dom.IE_COMPUTED[ Z ] ) { + Y = B.Dom.IE_COMPUTED[ Z ]( X, Z ); + } else { + if ( O.test( a ) ) { + Y = B.Dom.IE.ComputedStyle.getPixel( X, Z ); + } else { + Y = a; + } + } + } + } + return Y; + }, + getOffset: function( Z, e ) { + var b = Z[ T ][ e ], + X = e.charAt( 0 ).toUpperCase() + e.substr( 1 ), + c = "offset" + X, + Y = "pixel" + X, + a = "", + d; + if ( b == L ) { + d = Z[ c ]; + if ( d === undefined ) { + a = 0; + } + a = d; + if ( R.test( e ) ) { + Z[ H ][ e ] = d; + if ( Z[ c ] > d ) { + a = d - ( Z[ c ] - d ); + } + Z[ H ][ e ] = L; + } + } else { + if ( !Z[ H ][ Y ] && !Z[ H ][ e ] ) { + Z[ H ][ e ] = b; + } + a = Z[ H ][ Y ]; + } + return a + I; + }, + getBorderWidth: function( X, Z ) { + var Y = null; if ( !X[ T ][ W ] ) { + X[ H ].zoom = 1; + } + switch ( Z ) { + case G: + Y = X[ A ]; + break;case V: + Y = X.offsetHeight - X.clientHeight - X[ A ]; + break;case D: + Y = X[ F ]; + break;case P: + Y = X.offsetWidth - X.clientWidth - X[ F ]; + break; + } + return Y + I; + }, + getPixel: function( Y, X ) { + var a = null, + b = Y[ T ][ K ], + Z = Y[ T ][ X ]; + Y[ H ][ K ] = Z; + a = Y[ H ].pixelRight; + Y[ H ][ K ] = b; + return a + I; + }, + getMargin: function( Y, X ) { + var Z; if ( Y[ T ][ X ] == L ) { + Z = 0 + I; + } else { + Z = B.Dom.IE.ComputedStyle.getPixel( Y, X ); + } + return Z; + }, + getVisibility: function( Y, X ) { + var Z; while ( ( Z = Y[ T ] ) && Z[ X ] == "inherit" ) { + Y = Y[ J ]; + } + return ( Z ) ? Z[ X ] : S; + }, + getColor: function( Y, X ) { + return B.Dom.Color.toRGB( Y[ T ][ X ] ) || Q; + }, + getBorderColor: function( Y, X ) { + var Z = Y[ T ], + a = Z[ X ] || Z.color; + return B.Dom.Color.toRGB( B.Dom.Color.toHex( a ) ); + } }, + C = {}; + C.top = C.right = C.bottom = C.left = C[ E ] = C[ N ] = M.getOffset; + C.color = M.getColor; + C[ G ] = C[ P ] = C[ V ] = C[ D ] = M.getBorderWidth; + C.marginTop = C.marginRight = C.marginBottom = C.marginLeft = M.getMargin; + C.visibility = M.getVisibility; + C.borderColor = C.borderTopColor = C.borderRightColor = C.borderBottomColor = C.borderLeftColor = M.getBorderColor; + B.Dom.IE_COMPUTED = C; + B.Dom.IE_ComputedStyle = M; +})(); +(function() { + var C = "toString", + A = parseInt, + B = RegExp, + D = YAHOO.util; + D.Dom.Color = { + KEYWORDS: { black: "000", silver: "c0c0c0", gray: "808080", white: "fff", maroon: "800000", red: "f00", purple: "800080", fuchsia: "f0f", green: "008000", lime: "0f0", olive: "808000", yellow: "ff0", navy: "000080", blue: "00f", teal: "008080", aqua: "0ff" }, + re_RGB: /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i, re_hex: /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i, re_hex3: /([0-9A-F])/gi, toRGB: function( E ) { + if ( !D.Dom.Color.re_RGB.test( E ) ) { + E = D.Dom.Color.toHex( E ); + } + if ( D.Dom.Color.re_hex.exec( E ) ) { + E = "rgb(" + [ A( B.$1, 16 ), A( B.$2, 16 ), A( B.$3, 16 ) ].join( ", " ) + ")"; + } + return E; + }, + toHex: function( H ) { + H = D.Dom.Color.KEYWORDS[ H ] || H; + if ( D.Dom.Color.re_RGB.exec( H ) ) { + var G = ( B.$1.length === 1 ) ? "0" + B.$1 : Number( B.$1 ), + F = ( B.$2.length === 1 ) ? "0" + B.$2 : Number( B.$2 ), + E = ( B.$3.length === 1 ) ? "0" + B.$3 : Number( B.$3 ); + H = [ G[ C ]( 16 ), F[ C ]( 16 ), E[ C ]( 16 ) ].join( "" ); + } + if ( H.length < 6 ) { + H = H.replace( D.Dom.Color.re_hex3, "$1$1" ); + } + if ( H !== "transparent" && H.indexOf( "#" ) < 0 ) { + H = "#" + H; + } + return H.toLowerCase(); + } }; +}() ); +YAHOO.register( "dom", YAHOO.util.Dom, { version: "2.7.0", build: "1796" } ); +YAHOO.util.CustomEvent = function( D, C, B, A ) { + this.type = D; + this.scope = C || window; + this.silent = B; + this.signature = A || YAHOO.util.CustomEvent.LIST; + this.subscribers = []; + if ( !this.silent ) {} + var E = "_YUICEOnSubscribe"; + if ( D !== E ) { + this.subscribeEvent = new YAHOO.util.CustomEvent( E, this, true ); + } + this.lastError = null; +}; +YAHOO.util.CustomEvent.LIST = 0; +YAHOO.util.CustomEvent.FLAT = 1; +YAHOO.util.CustomEvent.prototype = { + subscribe: function( A, B, C ) { + if ( !A ) { + throw new Error( "Invalid callback for subscriber to '" + this.type + "'" ); + } + if ( this.subscribeEvent ) { + this.subscribeEvent.fire( A, B, C ); + } + this.subscribers.push( new YAHOO.util.Subscriber( A, B, C ) ); + }, + unsubscribe: function( D, F ) { + if ( !D ) { + return this.unsubscribeAll(); + } + var E = false; + for ( var B = 0, A = this.subscribers.length; B < A; ++B ) { + var C = this.subscribers[ B ]; + if ( C && C.contains( D, F ) ) { + this._delete( B ); + E = true; + } + } + return E; + }, + fire: function() { + this.lastError = null; var K = [], + E = this.subscribers.length; + if ( !E && this.silent ) { + return true; + } + var I = [].slice.call( arguments, 0 ), + G = true, + D, + J = false; + if ( !this.silent ) {} + var C = this.subscribers.slice(), + A = YAHOO.util.Event.throwErrors; + for ( D = 0; D < E; ++D ) { + var M = C[ D ]; + if ( !M ) { + J = true; + } else { + if ( !this.silent ) {} + var L = M.getScope( this.scope ); + if ( this.signature == YAHOO.util.CustomEvent.FLAT ) { + var B = null; + if ( I.length > 0 ) { + B = I[ 0 ]; + } + try { + G = M.fn.call( L, B, M.obj ); + } catch ( F ) { + this.lastError = F; + if ( A ) { + throw F; + } + } + } else { + try { + G = M.fn.call( L, this.type, I, M.obj ); + } catch ( H ) { + this.lastError = H; + if ( A ) { + throw H; + } + } + } + if ( false === G ) { + if ( !this.silent ) {} + break; + } + } + } + return ( G !== false ); + }, + unsubscribeAll: function() { + var A = this.subscribers.length, + B; for ( B = A - 1; B > -1; B-- ) { + this._delete( B ); + } + this.subscribers = []; + return A; + }, + _delete: function( A ) { + var B = this.subscribers[ A ]; + if ( B ) { + delete B.fn; + delete B.obj; + } + this.subscribers.splice( A, 1 ); + }, + toString: function() { + return "CustomEvent: " + "'" + this.type + "', " + "context: " + this.scope; + } }; YAHOO.util.Subscriber = function( A, B, C ) { + this.fn = A; + this.obj = YAHOO.lang.isUndefined( B ) ? null : B; + this.overrideContext = C; +}; +YAHOO.util.Subscriber.prototype.getScope = function( A ) { + if ( this.overrideContext ) { + if ( this.overrideContext === true ) { + return this.obj; + } else { + return this.overrideContext; + } + } + return A; +}; +YAHOO.util.Subscriber.prototype.contains = function( A, B ) { + if ( B ) { + return ( this.fn == A && this.obj == B ); + } else { + return ( this.fn == A ); + } +}; +YAHOO.util.Subscriber.prototype.toString = function() { + return "Subscriber { obj: " + this.obj + ", overrideContext: " + ( this.overrideContext || "no" ) + " }"; +}; +if ( !YAHOO.util.Event ) { + YAHOO.util.Event = function() { + var H = false; + var I = []; + var J = []; + var G = []; + var E = []; + var C = 0; + var F = []; + var B = []; + var A = 0; + var D = { 63232: 38, 63233: 40, 63234: 37, 63235: 39, 63276: 33, 63277: 34, 25: 9 }; var K = YAHOO.env.ua.ie ? "focusin" : "focus"; var L = YAHOO.env.ua.ie ? "focusout" : "blur"; return { + POLL_RETRYS: 2000, POLL_INTERVAL: 20, EL: 0, TYPE: 1, FN: 2, WFN: 3, UNLOAD_OBJ: 3, ADJ_SCOPE: 4, OBJ: 5, OVERRIDE: 6, lastError: null, isSafari: YAHOO.env.ua.webkit, webkit: YAHOO.env.ua.webkit, isIE: YAHOO.env.ua.ie, _interval: null, _dri: null, DOMReady: false, throwErrors: false, startInterval: function() { + if ( !this._interval ) { + var M = this; + var N = function() { + M._tryPreloadAttach(); + }; + this._interval = setInterval( N, this.POLL_INTERVAL ); + } + }, + onAvailable: function( S, O, Q, R, P ) { + var M = ( YAHOO.lang.isString( S ) ) ? [ S ] : S; + for ( var N = 0; N < M.length; N = N + 1 ) { + F.push({ id: M[ N ], fn: O, obj: Q, overrideContext: R, checkReady: P } ); + } + C = this.POLL_RETRYS; + this.startInterval(); + }, + onContentReady: function( P, M, N, O ) { + this.onAvailable( P, M, N, O, true ); + }, + onDOMReady: function( M, N, O ) { + if ( this.DOMReady ) { + setTimeout( function() { + var P = window; + if ( O ) { + if ( O === true ) { + P = N; + } else { + P = O; + } + } + M.call( P, "DOMReady", [], N ); + }, 0 ); + } else { + this.DOMReadyEvent.subscribe( M, N, O ); + } + }, + _addListener: function( O, M, Y, S, W, b ) { + if ( !Y || !Y.call ) { + return false; + } + if ( this._isValidCollection( O ) ) { + var Z = true; + for ( var T = 0, V = O.length; T < V; ++T ) { + Z = this.on( O[ T ], M, Y, S, W ) && Z; + } + return Z; + } else { + if ( YAHOO.lang.isString( O ) ) { + var R = this.getEl( O ); + if ( R ) { + O = R; + } else { + this.onAvailable( O, function() { + YAHOO.util.Event.on( O, M, Y, S, W ); + }); + return true; + } + } + } + if ( !O ) { + return false; + } + if ( "unload" == M && S !== this ) { + J[ J.length ] = [ O, M, Y, S, W ]; + return true; + } + var N = O; + if ( W ) { + if ( W === true ) { + N = S; + } else { + N = W; + } + } + var P = function( c ) { + return Y.call( N, YAHOO.util.Event.getEvent( c, O ), S ); + }; + var a = [ O, M, Y, P, N, S, W ]; + var U = I.length; + I[ U ] = a; + if ( this.useLegacyEvent( O, M ) ) { + var Q = this.getLegacyIndex( O, M ); + if ( Q == -1 || O != G[ Q ][ 0 ] ) { + Q = G.length; + B[ O.id + M ] = Q; + G[ Q ] = [ O, M, O[ "on" + M ] ]; + E[ Q ] = []; + O[ "on" + M ] = function( c ) { + YAHOO.util.Event.fireLegacyEvent( YAHOO.util.Event.getEvent( c ), Q ); + }; + } + E[ Q ].push( a ); + } else { + try { + this._simpleAdd( O, M, P, b ); + } catch ( X ) { + this.lastError = X; + this.removeListener( O, M, Y ); + return false; + } + } + return true; + }, + addListener: function( N, Q, M, O, P ) { + return this._addListener( N, Q, M, O, P, false ); + }, + addFocusListener: function( N, M, O, P ) { + return this._addListener( N, K, M, O, P, true ); + }, + removeFocusListener: function( N, M ) { + return this.removeListener( N, K, M ); + }, + addBlurListener: function( N, M, O, P ) { + return this._addListener( N, L, M, O, P, true ); + }, + removeBlurListener: function( N, M ) { + return this.removeListener( N, L, M ); + }, + fireLegacyEvent: function( R, P ) { + var T = true, + M, V, U, N, S; V = E[ P ].slice(); + for ( var O = 0, Q = V.length; O < Q; ++O ) { + U = V[ O ]; + if ( U && U[ this.WFN ] ) { + N = U[ this.ADJ_SCOPE ]; + S = U[ this.WFN ].call( N, R ); + T = ( T && S ); + } + } + M = G[ P ]; + if ( M && M[ 2 ] ) { + M[ 2 ]( R ); + } + return T; + }, + getLegacyIndex: function( N, O ) { + var M = this.generateId( N ) + O; + if ( typeof B[ M ] == "undefined" ) { + return -1; + } else { + return B[ M ]; + } + }, + useLegacyEvent: function( M, N ) { + return ( this.webkit && this.webkit < 419 && ( "click" == N || "dblclick" == N ) ); + }, + removeListener: function( N, M, V ) { + var Q, T, X; if ( typeof N == "string" ) { + N = this.getEl( N ); + } else { + if ( this._isValidCollection( N ) ) { + var W = true; + for ( Q = N.length - 1; Q > -1; Q-- ) { + W = ( this.removeListener( N[ Q ], M, V ) && W ); + } + return W; + } + } + if ( !V || !V.call ) { + return this.purgeElement( N, false, M ); + } + if ( "unload" == M ) { + for ( Q = J.length - 1; Q > -1; Q-- ) { + X = J[ Q ]; + if ( X && X[ 0 ] == N && X[ 1 ] == M && X[ 2 ] == V ) { + J.splice( Q, 1 ); + return true; + } + } + return false; + } + var R = null; + var S = arguments[ 3 ]; + if ( "undefined" === typeof S ) { + S = this._getCacheIndex( N, M, V ); + } + if ( S >= 0 ) { + R = I[ S ]; + } + if ( !N || !R ) { + return false; + } + if ( this.useLegacyEvent( N, M ) ) { + var P = this.getLegacyIndex( N, M ); + var O = E[ P ]; + if ( O ) { + for ( Q = 0, T = O.length; Q < T; ++Q ) { + X = O[ Q ]; + if ( X && X[ this.EL ] == N && X[ this.TYPE ] == M && X[ this.FN ] == V ) { + O.splice( Q, 1 ); + break; + } + } + } + } else { + try { + this._simpleRemove( N, M, R[ this.WFN ], false ); + } catch ( U ) { + this.lastError = U; + return false; + } + } + delete I[ S ][ this.WFN ]; + delete I[ S ][ this.FN ]; + I.splice( S, 1 ); + return true; + }, + getTarget: function( O, N ) { + var M = O.target || O.srcElement; return this.resolveTextNode( M ); + }, + resolveTextNode: function( N ) { + try { + if ( N && 3 == N.nodeType ) { + return N.parentNode; + } + } catch ( M ) {} + return N; + }, + getPageX: function( N ) { + var M = N.pageX; if ( !M && 0 !== M ) { + M = N.clientX || 0; + if ( this.isIE ) { + M += this._getScrollLeft(); + } + } + return M; + }, + getPageY: function( M ) { + var N = M.pageY; if ( !N && 0 !== N ) { + N = M.clientY || 0; + if ( this.isIE ) { + N += this._getScrollTop(); + } + } + return N; + }, + getXY: function( M ) { + return [ this.getPageX( M ), this.getPageY( M ) ]; + }, + getRelatedTarget: function( N ) { + var M = N.relatedTarget; if ( !M ) { + if ( N.type == "mouseout" ) { + M = N.toElement; + } else { + if ( N.type == "mouseover" ) { + M = N.fromElement; + } + } + } + return this.resolveTextNode( M ); + }, + getTime: function( O ) { + if ( !O.time ) { + var N = new Date().getTime(); + try { + O.time = N; + } catch ( M ) { + this.lastError = M; + return N; + } + } + return O.time; + }, + stopEvent: function( M ) { + this.stopPropagation( M ); + this.preventDefault( M ); + }, + stopPropagation: function( M ) { + if ( M.stopPropagation ) { + M.stopPropagation(); + } else { + M.cancelBubble = true; + } + }, + preventDefault: function( M ) { + if ( M.preventDefault ) { + M.preventDefault(); + } else { + M.returnValue = false; + } + }, + getEvent: function( O, M ) { + var N = O || window.event; if ( !N ) { + var P = this.getEvent.caller; + while ( P ) { + N = P.arguments[ 0 ]; + if ( N && Event == N.constructor ) { + break; + } + P = P.caller; + } + } + return N; + }, + getCharCode: function( N ) { + var M = N.keyCode || N.charCode || 0; if ( YAHOO.env.ua.webkit && ( M in D ) ) { + M = D[ M ]; + } + return M; + }, + _getCacheIndex: function( Q, R, P ) { + for ( var O = 0, N = I.length; O < N; O = O + 1 ) { + var M = I[ O ]; + if ( M && M[ this.FN ] == P && M[ this.EL ] == Q && M[ this.TYPE ] == R ) { + return O; + } + } + return -1; + }, + generateId: function( M ) { + var N = M.id; if ( !N ) { + N = "yuievtautoid-" + A; + ++A; + M.id = N; + } + return N; + }, + _isValidCollection: function( N ) { + try { + return ( N && typeof N !== "string" && N.length && !N.tagName && !N.alert && typeof N[ 0 ] !== "undefined" ); + } catch ( M ) { + return false; + } + }, + elCache: {}, + getEl: function( M ) { + return ( typeof M === "string" ) ? document.getElementById( M ) : M; + }, + clearCache: function() {}, + DOMReadyEvent: new YAHOO.util.CustomEvent( "DOMReady", this ), _load: function( N ) { + if ( !H ) { + H = true; + var M = YAHOO.util.Event; + M._ready(); + M._tryPreloadAttach(); + } + }, + _ready: function( N ) { + var M = YAHOO.util.Event; if ( !M.DOMReady ) { + M.DOMReady = true; + M.DOMReadyEvent.fire(); + M._simpleRemove( document, "DOMContentLoaded", M._ready ); + } + }, + _tryPreloadAttach: function() { + if ( F.length === 0 ) { + C = 0; + if ( this._interval ) { + clearInterval( this._interval ); + this._interval = null; + } + return; + } + if ( this.locked ) { + return; + } + if ( this.isIE ) { + if ( !this.DOMReady ) { + this.startInterval(); + return; + } + } + this.locked = true; + var S = !H; + if ( !S ) { + S = ( C > 0 && F.length > 0 ); + } + var R = []; + var T = function( V, W ) { + var U = V; + if ( W.overrideContext ) { + if ( W.overrideContext === true ) { + U = W.obj; + } else { + U = W.overrideContext; + } + } + W.fn.call( U, W.obj ); + }; + var N, M, Q, P, + O = []; + for ( N = 0, M = F.length; N < M; N = N + 1 ) { + Q = F[ N ]; + if ( Q ) { + P = this.getEl( Q.id ); + if ( P ) { + if ( Q.checkReady ) { + if ( H || P.nextSibling || !S ) { + O.push( Q ); + F[ N ] = null; + } + } else { + T( P, Q ); + F[ N ] = null; + } + } else { + R.push( Q ); + } + } + } + for ( N = 0, M = O.length; N < M; N = N + 1 ) { + Q = O[ N ]; + T( this.getEl( Q.id ), Q ); + } + C--; + if ( S ) { + for ( N = F.length - 1; N > -1; N-- ) { + Q = F[ N ]; + if ( !Q || !Q.id ) { + F.splice( N, 1 ); + } + } + this.startInterval(); + } else { + if ( this._interval ) { + clearInterval( this._interval ); + this._interval = null; + } + } + this.locked = false; + }, + purgeElement: function( Q, R, T ) { + var O = ( YAHOO.lang.isString( Q ) ) ? this.getEl( Q ) : Q; + var S = this.getListeners( O, T ), + P, M; + if ( S ) { + for ( P = S.length - 1; P > -1; P-- ) { + var N = S[ P ]; + this.removeListener( O, N.type, N.fn ); + } + } + if ( R && O && O.childNodes ) { + for ( P = 0, M = O.childNodes.length; P < M; ++P ) { + this.purgeElement( O.childNodes[ P ], R, T ); + } + } + }, + getListeners: function( O, M ) { + var R = [], + N; + if ( !M ) { + N = [ I, J ]; + } else { + if ( M === "unload" ) { + N = [ J ]; + } else { + N = [ I ]; + } + } + var T = ( YAHOO.lang.isString( O ) ) ? this.getEl( O ) : O; + for ( var Q = 0; Q < N.length; Q = Q + 1 ) { + var V = N[ Q ]; + if ( V ) { + for ( var S = 0, U = V.length; S < U; ++S ) { + var P = V[ S ]; + if ( P && P[ this.EL ] === T && ( !M || M === P[ this.TYPE ] ) ) { + R.push({ type: P[ this.TYPE ], fn: P[ this.FN ], obj: P[ this.OBJ ], adjust: P[ this.OVERRIDE ], scope: P[ this.ADJ_SCOPE ], index: S } ); + } + } + } + } + return ( R.length ) ? R : null; + }, + _unload: function( T ) { + var N = YAHOO.util.Event, + Q, P, O, S, R, + U = J.slice(), + M; + for ( Q = 0, S = J.length; Q < S; ++Q ) { + O = U[ Q ]; + if ( O ) { + M = window; + if ( O[ N.ADJ_SCOPE ] ) { + if ( O[ N.ADJ_SCOPE ] === true ) { + M = O[ N.UNLOAD_OBJ ]; + } else { + M = O[ N.ADJ_SCOPE ]; + } + } + O[ N.FN ].call( M, N.getEvent( T, O[ N.EL ] ), O[ N.UNLOAD_OBJ ] ); + U[ Q ] = null; + } + } + O = null; + M = null; + J = null; + if ( I ) { + for ( P = I.length - 1; P > -1; P-- ) { + O = I[ P ]; + if ( O ) { + N.removeListener( O[ N.EL ], O[ N.TYPE ], O[ N.FN ], P ); + } + } + O = null; + } + G = null; + N._simpleRemove( window, "unload", N._unload ); + }, + _getScrollLeft: function() { + return this._getScroll()[ 1 ]; + }, + _getScrollTop: function() { + return this._getScroll()[ 0 ]; + }, + _getScroll: function() { + var M = document.documentElement, + N = document.body; if ( M && ( M.scrollTop || M.scrollLeft ) ) { + return [ M.scrollTop, M.scrollLeft ]; + } else { + if ( N ) { + return [ N.scrollTop, N.scrollLeft ]; + } else { + return [ 0, 0 ]; + } + } + }, + regCE: function() {}, + _simpleAdd: function() { + if ( window.addEventListener ) { + return function( O, P, N, M ) { + O.addEventListener( P, N, ( M ) ); + }; + } else { + if ( window.attachEvent ) { + return function( O, P, N, M ) { + O.attachEvent( "on" + P, N ); + }; + } else { + return function() {}; + } + } + }(), _simpleRemove: function() { + if ( window.removeEventListener ) { + return function( O, P, N, M ) { + O.removeEventListener( P, N, ( M ) ); + }; + } else { + if ( window.detachEvent ) { + return function( N, O, M ) { + N.detachEvent( "on" + O, M ); + }; + } else { + return function() {}; + } + } + }() }; + }(); + (function() { + var EU = YAHOO.util.Event; + EU.on = EU.addListener; + EU.onFocus = EU.addFocusListener; + EU.onBlur = EU.addBlurListener; + /* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */ + if ( EU.isIE ) { + YAHOO.util.Event.onDOMReady( YAHOO.util.Event._tryPreloadAttach, YAHOO.util.Event, true ); + var n = document.createElement( "p" ); + EU._dri = setInterval( function() { + try { + n.doScroll( "left" ); + clearInterval( EU._dri ); + EU._dri = null; + EU._ready(); + n = null; + } catch ( ex ) {} + }, EU.POLL_INTERVAL ); + } else { + if ( EU.webkit && EU.webkit < 525 ) { + EU._dri = setInterval( function() { + var rs = document.readyState; + if ( "loaded" == rs || "complete" == rs ) { + clearInterval( EU._dri ); + EU._dri = null; + EU._ready(); + } + }, EU.POLL_INTERVAL ); + } else { + EU._simpleAdd( document, "DOMContentLoaded", EU._ready ); + } + } + EU._simpleAdd( window, "load", EU._load ); + EU._simpleAdd( window, "unload", EU._unload ); + EU._tryPreloadAttach(); + })(); +} +YAHOO.util.EventProvider = function() {}; +YAHOO.util.EventProvider.prototype = { + __yui_events: null, __yui_subscribers: null, subscribe: function( A, C, F, E ) { + this.__yui_events = this.__yui_events || {}; + var D = this.__yui_events[ A ]; + if ( D ) { + D.subscribe( C, F, E ); + } else { + this.__yui_subscribers = this.__yui_subscribers || {}; + var B = this.__yui_subscribers; + if ( !B[ A ] ) { + B[ A ] = []; + } + B[ A ].push({ fn: C, obj: F, overrideContext: E } ); + } + }, + unsubscribe: function( C, E, G ) { + this.__yui_events = this.__yui_events || {}; + var A = this.__yui_events; + if ( C ) { + var F = A[ C ]; + if ( F ) { + return F.unsubscribe( E, G ); + } + } else { + var B = true; + for ( var D in A ) { + if ( YAHOO.lang.hasOwnProperty( A, D ) ) { + B = B && A[ D ].unsubscribe( E, G ); + } + } + return B; + } + return false; + }, + unsubscribeAll: function( A ) { + return this.unsubscribe( A ); + }, + createEvent: function( G, D ) { + this.__yui_events = this.__yui_events || {}; + var A = D || {}; + var I = this.__yui_events; + if ( I[ G ] ) {} else { + var H = A.scope || this; + var E = ( A.silent ); + var B = new YAHOO.util.CustomEvent( G, H, E, YAHOO.util.CustomEvent.FLAT ); + I[ G ] = B; + if ( A.onSubscribeCallback ) { + B.subscribeEvent.subscribe( A.onSubscribeCallback ); + } + this.__yui_subscribers = this.__yui_subscribers || {}; + var F = this.__yui_subscribers[ G ]; + if ( F ) { + for ( var C = 0; C < F.length; ++C ) { + B.subscribe( F[ C ].fn, F[ C ].obj, F[ C ].overrideContext ); + } + } + } + return I[ G ]; + }, + fireEvent: function( E, D, A, C ) { + this.__yui_events = this.__yui_events || {}; + var G = this.__yui_events[ E ]; + if ( !G ) { + return null; + } + var B = []; + for ( var F = 1; F < arguments.length; ++F ) { + B.push( arguments[ F ] ); + } + return G.fire.apply( G, B ); + }, + hasEvent: function( A ) { + if ( this.__yui_events ) { + if ( this.__yui_events[ A ] ) { + return true; + } + } + return false; + } }; +(function() { + var A = YAHOO.util.Event, + C = YAHOO.lang; + YAHOO.util.KeyListener = function( D, I, E, F ) { + if ( !D ) {} else { + if ( !I ) {} else { + if ( !E ) {} + } + } + if ( !F ) { + F = YAHOO.util.KeyListener.KEYDOWN; + } + var G = new YAHOO.util.CustomEvent( "keyPressed" ); + this.enabledEvent = new YAHOO.util.CustomEvent( "enabled" ); + this.disabledEvent = new YAHOO.util.CustomEvent( "disabled" ); + if ( C.isString( D ) ) { + D = document.getElementById( D ); + } + if ( C.isFunction( E ) ) { + G.subscribe( E ); + } else { + G.subscribe( E.fn, E.scope, E.correctScope ); + } + function H( O, N ) { + if ( !I.shift ) { + I.shift = false; + } + if ( !I.alt ) { + I.alt = false; + } + if ( !I.ctrl ) { + I.ctrl = false; + } + if ( O.shiftKey == I.shift && O.altKey == I.alt && O.ctrlKey == I.ctrl ) { + var J, + M = I.keys, + L; + if ( YAHOO.lang.isArray( M ) ) { + for ( var K = 0; K < M.length; K++ ) { + J = M[ K ]; + L = A.getCharCode( O ); + if ( J == L ) { + G.fire( L, O ); + break; + } + } + } else { + L = A.getCharCode( O ); + if ( M == L ) { + G.fire( L, O ); + } + } + } + } + this.enable = function() { + if ( !this.enabled ) { + A.on( D, F, H ); + this.enabledEvent.fire( I ); + } + this.enabled = true; + }; + this.disable = function() { + if ( this.enabled ) { + A.removeListener( D, F, H ); + this.disabledEvent.fire( I ); + } + this.enabled = false; + }; + this.toString = function() { + return "KeyListener [" + I.keys + "] " + D.tagName + ( D.id ? "[" + D.id + "]" : "" ); + }; + }; + var B = YAHOO.util.KeyListener; + B.KEYDOWN = "keydown"; + B.KEYUP = "keyup"; + B.KEY = { ALT: 18, BACK_SPACE: 8, CAPS_LOCK: 20, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, META: 224, NUM_LOCK: 144, PAGE_DOWN: 34, PAGE_UP: 33, PAUSE: 19, PRINTSCREEN: 44, RIGHT: 39, SCROLL_LOCK: 145, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38 }; +})(); +YAHOO.register( "event", YAHOO.util.Event, { version: "2.7.0", build: "1796" } ); +YAHOO.register( "yahoo-dom-event", YAHOO, { version: "2.7.0", build: "1796" } ); +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +if ( !YAHOO.util.DragDropMgr ) { + YAHOO.util.DragDropMgr = function() { + var A = YAHOO.util.Event, + B = YAHOO.util.Dom; + return { + useShim: false, _shimActive: false, _shimState: false, _debugShim: false, _createShim: function() { + var C = document.createElement( "div" ); + C.id = "yui-ddm-shim"; + if ( document.body.firstChild ) { + document.body.insertBefore( C, document.body.firstChild ); + } else { + document.body.appendChild( C ); + } + C.style.display = "none"; + C.style.backgroundColor = "red"; + C.style.position = "absolute"; + C.style.zIndex = "99999"; + B.setStyle( C, "opacity", "0" ); + this._shim = C; + A.on( C, "mouseup", this.handleMouseUp, this, true ); + A.on( C, "mousemove", this.handleMouseMove, this, true ); + A.on( window, "scroll", this._sizeShim, this, true ); + }, + _sizeShim: function() { + if ( this._shimActive ) { + var C = this._shim; + C.style.height = B.getDocumentHeight() + "px"; + C.style.width = B.getDocumentWidth() + "px"; + C.style.top = "0"; + C.style.left = "0"; + } + }, + _activateShim: function() { + if ( this.useShim ) { + if ( !this._shim ) { + this._createShim(); + } + this._shimActive = true; + var C = this._shim, + D = "0"; + if ( this._debugShim ) { + D = ".5"; + } + B.setStyle( C, "opacity", D ); + this._sizeShim(); + C.style.display = "block"; + } + }, + _deactivateShim: function() { + this._shim.style.display = "none"; this._shimActive = false; + }, + _shim: null, ids: {}, + handleIds: {}, + dragCurrent: null, dragOvers: {}, + deltaX: 0, deltaY: 0, preventDefault: true, stopPropagation: true, initialized: false, locked: false, interactionInfo: null, init: function() { + this.initialized = true; + }, + POINT: 0, INTERSECT: 1, STRICT_INTERSECT: 2, mode: 0, _execOnAll: function( E, D ) { + for ( var F in this.ids ) { + for ( var C in this.ids[ F ] ) { + var G = this.ids[ F ][ C ]; + if ( !this.isTypeOfDD( G ) ) { + continue; + } + G[ E ].apply( G, D ); + } + } + }, + _onLoad: function() { + this.init(); + A.on( document, "mouseup", this.handleMouseUp, this, true ); + A.on( document, "mousemove", this.handleMouseMove, this, true ); + A.on( window, "unload", this._onUnload, this, true ); + A.on( window, "resize", this._onResize, this, true ); + }, + _onResize: function( C ) { + this._execOnAll( "resetConstraints", [] ); + }, + lock: function() { + this.locked = true; + }, + unlock: function() { + this.locked = false; + }, + isLocked: function() { + return this.locked; + }, + locationCache: {}, + useCache: true, clickPixelThresh: 3, clickTimeThresh: 1000, dragThreshMet: false, clickTimeout: null, startX: 0, startY: 0, fromTimeout: false, regDragDrop: function( D, C ) { + if ( !this.initialized ) { + this.init(); + } + if ( !this.ids[ C ] ) { + this.ids[ C ] = {}; + } + this.ids[ C ][ D.id ] = D; + }, + removeDDFromGroup: function( E, C ) { + if ( !this.ids[ C ] ) { + this.ids[ C ] = {}; + } + var D = this.ids[ C ]; + if ( D && D[ E.id ] ) { + delete D[ E.id ]; + } + }, + _remove: function( E ) { + for ( var D in E.groups ) { + if ( D ) { + var C = this.ids[ D ]; + if ( C && C[ E.id ] ) { + delete C[ E.id ]; + } + } + } + delete this.handleIds[ E.id ]; + }, + regHandle: function( D, C ) { + if ( !this.handleIds[ D ] ) { + this.handleIds[ D ] = {}; + } + this.handleIds[ D ][ C ] = C; + }, + isDragDrop: function( C ) { + return ( this.getDDById( C ) ) ? true : false; + }, + getRelated: function( H, D ) { + var G = []; + for ( var F in H.groups ) { + for ( var E in this.ids[ F ] ) { + var C = this.ids[ F ][ E ]; + if ( !this.isTypeOfDD( C ) ) { + continue; + } + if ( !D || C.isTarget ) { + G[ G.length ] = C; + } + } + } + return G; + }, + isLegalTarget: function( G, F ) { + var D = this.getRelated( G, true ); + for ( var E = 0, C = D.length; E < C; ++E ) { + if ( D[ E ].id == F.id ) { + return true; + } + } + return false; + }, + isTypeOfDD: function( C ) { + return ( C && C.__ygDragDrop ); + }, + isHandle: function( D, C ) { + return ( this.handleIds[ D ] && this.handleIds[ D ][ C ] ); + }, + getDDById: function( D ) { + for ( var C in this.ids ) { + if ( this.ids[ C ][ D ] ) { + return this.ids[ C ][ D ]; + } + } + return null; + }, + handleMouseDown: function( E, D ) { + this.currentTarget = YAHOO.util.Event.getTarget( E ); + this.dragCurrent = D; + var C = D.getEl(); + this.startX = YAHOO.util.Event.getPageX( E ); + this.startY = YAHOO.util.Event.getPageY( E ); + this.deltaX = this.startX - C.offsetLeft; + this.deltaY = this.startY - C.offsetTop; + this.dragThreshMet = false; + this.clickTimeout = setTimeout( function() { + var F = YAHOO.util.DDM; + F.startDrag( F.startX, F.startY ); + F.fromTimeout = true; + }, this.clickTimeThresh ); + }, + startDrag: function( C, E ) { + if ( this.dragCurrent && this.dragCurrent.useShim ) { + this._shimState = this.useShim; + this.useShim = true; + } + this._activateShim(); + clearTimeout( this.clickTimeout ); + var D = this.dragCurrent; + if ( D && D.events.b4StartDrag ) { + D.b4StartDrag( C, E ); + D.fireEvent( "b4StartDragEvent", { x: C, y: E } ); + } + if ( D && D.events.startDrag ) { + D.startDrag( C, E ); + D.fireEvent( "startDragEvent", { x: C, y: E } ); + } + this.dragThreshMet = true; + }, + handleMouseUp: function( C ) { + if ( this.dragCurrent ) { + clearTimeout( this.clickTimeout ); + if ( this.dragThreshMet ) { + if ( this.fromTimeout ) { + this.fromTimeout = false; + this.handleMouseMove( C ); + } + this.fromTimeout = false; + this.fireEvents( C, true ); + } else {} + this.stopDrag( C ); + this.stopEvent( C ); + } + }, + stopEvent: function( C ) { + if ( this.stopPropagation ) { + YAHOO.util.Event.stopPropagation( C ); + } + if ( this.preventDefault ) { + YAHOO.util.Event.preventDefault( C ); + } + }, + stopDrag: function( E, D ) { + var C = this.dragCurrent; if ( C && !D ) { + if ( this.dragThreshMet ) { + if ( C.events.b4EndDrag ) { + C.b4EndDrag( E ); + C.fireEvent( "b4EndDragEvent", { e: E } ); + } + if ( C.events.endDrag ) { + C.endDrag( E ); + C.fireEvent( "endDragEvent", { e: E } ); + } + } + if ( C.events.mouseUp ) { + C.onMouseUp( E ); + C.fireEvent( "mouseUpEvent", { e: E } ); + } + } + if ( this._shimActive ) { + this._deactivateShim(); + if ( this.dragCurrent && this.dragCurrent.useShim ) { + this.useShim = this._shimState; + this._shimState = false; + } + } + this.dragCurrent = null; + this.dragOvers = {}; + }, + handleMouseMove: function( F ) { + var C = this.dragCurrent; if ( C ) { + if ( YAHOO.util.Event.isIE && !F.button ) { + this.stopEvent( F ); + return this.handleMouseUp( F ); + } else { + if ( F.clientX < 0 || F.clientY < 0 ) {} + } + if ( !this.dragThreshMet ) { + var E = Math.abs( this.startX - YAHOO.util.Event.getPageX( F ) ); + var D = Math.abs( this.startY - YAHOO.util.Event.getPageY( F ) ); + if ( E > this.clickPixelThresh || D > this.clickPixelThresh ) { + this.startDrag( this.startX, this.startY ); + } + } + if ( this.dragThreshMet ) { + if ( C && C.events.b4Drag ) { + C.b4Drag( F ); + C.fireEvent( "b4DragEvent", { e: F } ); + } + if ( C && C.events.drag ) { + C.onDrag( F ); + C.fireEvent( "dragEvent", { e: F } ); + } + if ( C ) { + this.fireEvents( F, false ); + } + } + this.stopEvent( F ); + } + }, + fireEvents: function( V, L ) { + var a = this.dragCurrent; if ( !a || a.isLocked() || a.dragOnly ) { + return; + } + var N = YAHOO.util.Event.getPageX( V ), + M = YAHOO.util.Event.getPageY( V ), + P = new YAHOO.util.Point( N, M ), + K = a.getTargetCoord( P.x, P.y ), + F = a.getDragEl(), + E = [ "out", "over", "drop", "enter" ], + U = new YAHOO.util.Region( K.y, K.x + F.offsetWidth, K.y + F.offsetHeight, K.x ), + I = [], + D = {}, + Q = [], + c = { outEvts: [], overEvts: [], dropEvts: [], enterEvts: [] }; for ( var S in this.dragOvers ) { + var d = this.dragOvers[ S ]; + if ( !this.isTypeOfDD( d ) ) { + continue; + } + if ( !this.isOverTarget( P, d, this.mode, U ) ) { + c.outEvts.push( d ); + } + I[ S ] = true; + delete this.dragOvers[ S ]; + } + for ( var R in a.groups ) { + if ( "string" != typeof R ) { + continue; + } + for ( S in this.ids[ R ] ) { + var G = this.ids[ R ][ S ]; + if ( !this.isTypeOfDD( G ) ) { + continue; + } + if ( G.isTarget && !G.isLocked() && G != a ) { + if ( this.isOverTarget( P, G, this.mode, U ) ) { + D[ R ] = true; + if ( L ) { + c.dropEvts.push( G ); + } else { + if ( !I[ G.id ] ) { + c.enterEvts.push( G ); + } else { + c.overEvts.push( G ); + } + this.dragOvers[ G.id ] = G; + } + } + } + } + } + this.interactionInfo = { out: c.outEvts, enter: c.enterEvts, over: c.overEvts, drop: c.dropEvts, point: P, draggedRegion: U, sourceRegion: this.locationCache[ a.id ], validDrop: L }; for ( var C in D ) { + Q.push( C ); + } + if ( L && !c.dropEvts.length ) { + this.interactionInfo.validDrop = false; + if ( a.events.invalidDrop ) { + a.onInvalidDrop( V ); + a.fireEvent( "invalidDropEvent", { e: V } ); + } + } + for ( S = 0; S < E.length; S++ ) { + var Y = null; + if ( c[ E[ S ] + "Evts" ] ) { + Y = c[ E[ S ] + "Evts" ]; + } + if ( Y && Y.length ) { + var H = E[ S ].charAt( 0 ).toUpperCase() + E[ S ].substr( 1 ), + X = "onDrag" + H, + J = "b4Drag" + H, + O = "drag" + H + "Event", + W = "drag" + H; + if ( this.mode ) { + if ( a.events[ J ] ) { + a[ J ]( V, Y, Q ); + a.fireEvent( J + "Event", { event: V, info: Y, group: Q } ); + } + if ( a.events[ W ] ) { + a[ X ]( V, Y, Q ); + a.fireEvent( O, { event: V, info: Y, group: Q } ); + } + } else { + for ( var Z = 0, T = Y.length; Z < T; ++Z ) { + if ( a.events[ J ] ) { + a[ J ]( V, Y[ Z ].id, Q[ 0 ] ); + a.fireEvent( J + "Event", { event: V, info: Y[ Z ].id, group: Q[ 0 ] } ); + } + if ( a.events[ W ] ) { + a[ X ]( V, Y[ Z ].id, Q[ 0 ] ); + a.fireEvent( O, { event: V, info: Y[ Z ].id, group: Q[ 0 ] } ); + } + } + } + } + } + }, + getBestMatch: function( E ) { + var G = null; var D = E.length; if ( D == 1 ) { + G = E[ 0 ]; + } else { + for ( var F = 0; F < D; ++F ) { + var C = E[ F ]; + if ( this.mode == this.INTERSECT && C.cursorIsOver ) { + G = C; + break; + } else { + if ( !G || !G.overlap || ( C.overlap && G.overlap.getArea() < C.overlap.getArea() ) ) { + G = C; + } + } + } + } + return G; + }, + refreshCache: function( D ) { + var F = D || this.ids; for ( var C in F ) { + if ( "string" != typeof C ) { + continue; + } + for ( var E in this.ids[ C ] ) { + var G = this.ids[ C ][ E ]; + if ( this.isTypeOfDD( G ) ) { + var H = this.getLocation( G ); + if ( H ) { + this.locationCache[ G.id ] = H; + } else { + delete this.locationCache[ G.id ]; + } + } + } + } + }, + verifyEl: function( D ) { + try { + if ( D ) { + var C = D.offsetParent; + if ( C ) { + return true; + } + } + } catch ( E ) {} + return false; + }, + getLocation: function( H ) { + if ( !this.isTypeOfDD( H ) ) { + return null; + } + var F = H.getEl(), + K, E, D, M, L, N, C, J, G; + try { + K = YAHOO.util.Dom.getXY( F ); + } catch ( I ) {} + if ( !K ) { + return null; + } + E = K[ 0 ]; + D = E + F.offsetWidth; + M = K[ 1 ]; + L = M + F.offsetHeight; + N = M - H.padding[ 0 ]; + C = D + H.padding[ 1 ]; + J = L + H.padding[ 2 ]; + G = E - H.padding[ 3 ]; + return new YAHOO.util.Region( N, C, J, G ); + }, + isOverTarget: function( K, C, E, F ) { + var G = this.locationCache[ C.id ]; + if ( !G || !this.useCache ) { + G = this.getLocation( C ); + this.locationCache[ C.id ] = G; + } + if ( !G ) { + return false; + } + C.cursorIsOver = G.contains( K ); + var J = this.dragCurrent; + if ( !J || ( !E && !J.constrainX && !J.constrainY ) ) { + return C.cursorIsOver; + } + C.overlap = null; + if ( !F ) { + var H = J.getTargetCoord( K.x, K.y ); + var D = J.getDragEl(); + F = new YAHOO.util.Region( H.y, H.x + D.offsetWidth, H.y + D.offsetHeight, H.x ); + } + var I = F.intersect( G ); + if ( I ) { + C.overlap = I; + return ( E ) ? true : C.cursorIsOver; + } else { + return false; + } + }, + _onUnload: function( D, C ) { + this.unregAll(); + }, + unregAll: function() { + if ( this.dragCurrent ) { + this.stopDrag(); + this.dragCurrent = null; + } + this._execOnAll( "unreg", [] ); + this.ids = {}; + }, + elementCache: {}, + getElWrapper: function( D ) { + var C = this.elementCache[ D ]; + if ( !C || !C.el ) { + C = this.elementCache[ D ] = new this.ElementWrapper( YAHOO.util.Dom.get( D ) ); + } + return C; + }, + getElement: function( C ) { + return YAHOO.util.Dom.get( C ); + }, + getCss: function( D ) { + var C = YAHOO.util.Dom.get( D ); + return ( C ) ? C.style : null; + }, + ElementWrapper: function( C ) { + this.el = C || null; this.id = this.el && C.id; this.css = this.el && C.style; + }, + getPosX: function( C ) { + return YAHOO.util.Dom.getX( C ); + }, + getPosY: function( C ) { + return YAHOO.util.Dom.getY( C ); + }, + swapNode: function( E, C ) { + if ( E.swapNode ) { + E.swapNode( C ); + } else { + var F = C.parentNode; + var D = C.nextSibling; + if ( D == E ) { + F.insertBefore( E, C ); + } else { + if ( C == E.nextSibling ) { + F.insertBefore( C, E ); + } else { + E.parentNode.replaceChild( C, E ); + F.insertBefore( E, D ); + } + } + } + }, + getScroll: function() { + var E, C, + F = document.documentElement, + D = document.body; if ( F && ( F.scrollTop || F.scrollLeft ) ) { + E = F.scrollTop; + C = F.scrollLeft; + } else { + if ( D ) { + E = D.scrollTop; + C = D.scrollLeft; + } else {} + } + return { top: E, left: C }; + }, + getStyle: function( D, C ) { + return YAHOO.util.Dom.getStyle( D, C ); + }, + getScrollTop: function() { + return this.getScroll().top; + }, + getScrollLeft: function() { + return this.getScroll().left; + }, + moveToEl: function( C, E ) { + var D = YAHOO.util.Dom.getXY( E ); + YAHOO.util.Dom.setXY( C, D ); + }, + getClientHeight: function() { + return YAHOO.util.Dom.getViewportHeight(); + }, + getClientWidth: function() { + return YAHOO.util.Dom.getViewportWidth(); + }, + numericSort: function( D, C ) { + return ( D - C ); + }, + _timeoutCount: 0, _addListeners: function() { + var C = YAHOO.util.DDM; if ( YAHOO.util.Event && document ) { + C._onLoad(); + } else { + if ( C._timeoutCount > 2000 ) {} else { + setTimeout( C._addListeners, 10 ); + if ( document && document.body ) { + C._timeoutCount += 1; + } + } + } + }, + handleWasClicked: function( C, E ) { + if ( this.isHandle( E, C.id ) ) { + return true; + } else { + var D = C.parentNode; + while ( D ) { + if ( this.isHandle( E, D.id ) ) { + return true; + } else { + D = D.parentNode; + } + } + } + return false; + } }; + }(); + YAHOO.util.DDM = YAHOO.util.DragDropMgr; + YAHOO.util.DDM._addListeners(); +}( function() { + var A = YAHOO.util.Event; + var B = YAHOO.util.Dom; + YAHOO.util.DragDrop = function( E, C, D ) { + if ( E ) { + this.init( E, C, D ); + } + }; + YAHOO.util.DragDrop.prototype = { + events: null, on: function() { + this.subscribe.apply( this, arguments ); + }, + id: null, config: null, dragElId: null, handleElId: null, invalidHandleTypes: null, invalidHandleIds: null, invalidHandleClasses: null, startPageX: 0, startPageY: 0, groups: null, locked: false, lock: function() { + this.locked = true; + }, + unlock: function() { + this.locked = false; + }, + isTarget: true, padding: null, dragOnly: false, useShim: false, _domRef: null, __ygDragDrop: true, constrainX: false, constrainY: false, minX: 0, maxX: 0, minY: 0, maxY: 0, deltaX: 0, deltaY: 0, maintainOffset: false, xTicks: null, yTicks: null, primaryButtonOnly: true, available: false, hasOuterHandles: false, cursorIsOver: false, overlap: null, b4StartDrag: function( C, D ) {}, + startDrag: function( C, D ) {}, + b4Drag: function( C ) {}, + onDrag: function( C ) {}, + onDragEnter: function( C, D ) {}, + b4DragOver: function( C ) {}, + onDragOver: function( C, D ) {}, + b4DragOut: function( C ) {}, + onDragOut: function( C, D ) {}, + b4DragDrop: function( C ) {}, + onDragDrop: function( C, D ) {}, + onInvalidDrop: function( C ) {}, + b4EndDrag: function( C ) {}, + endDrag: function( C ) {}, + b4MouseDown: function( C ) {}, + onMouseDown: function( C ) {}, + onMouseUp: function( C ) {}, + onAvailable: function() {}, + getEl: function() { + if ( !this._domRef ) { + this._domRef = B.get( this.id ); + } + return this._domRef; + }, + getDragEl: function() { + return B.get( this.dragElId ); + }, + init: function( F, C, D ) { + this.initTarget( F, C, D ); + A.on( this._domRef || this.id, "mousedown", this.handleMouseDown, this, true ); + for ( var E in this.events ) { + this.createEvent( E + "Event" ); + } + }, + initTarget: function( E, C, D ) { + this.config = D || {}; + this.events = {}; + this.DDM = YAHOO.util.DDM; + this.groups = {}; + if ( typeof E !== "string" ) { + this._domRef = E; + E = B.generateId( E ); + } + this.id = E; + this.addToGroup( ( C ) ? C : "default" ); + this.handleElId = E; + A.onAvailable( E, this.handleOnAvailable, this, true ); + this.setDragElId( E ); + this.invalidHandleTypes = { A: "A" }; this.invalidHandleIds = {}; + this.invalidHandleClasses = []; + this.applyConfig(); + }, + applyConfig: function() { + this.events = { mouseDown: true, b4MouseDown: true, mouseUp: true, b4StartDrag: true, startDrag: true, b4EndDrag: true, endDrag: true, drag: true, b4Drag: true, invalidDrop: true, b4DragOut: true, dragOut: true, dragEnter: true, b4DragOver: true, dragOver: true, b4DragDrop: true, dragDrop: true }; if ( this.config.events ) { + for ( var C in this.config.events ) { + if ( this.config.events[ C ] === false ) { + this.events[ C ] = false; + } + } + } + this.padding = this.config.padding || [ 0, 0, 0, 0 ]; + this.isTarget = ( this.config.isTarget !== false ); + this.maintainOffset = ( this.config.maintainOffset ); + this.primaryButtonOnly = ( this.config.primaryButtonOnly !== false ); + this.dragOnly = ( ( this.config.dragOnly === true ) ? true : false ); + this.useShim = ( ( this.config.useShim === true ) ? true : false ); + }, + handleOnAvailable: function() { + this.available = true; this.resetConstraints(); + this.onAvailable(); + }, + setPadding: function( E, C, F, D ) { + if ( !C && 0 !== C ) { + this.padding = [ E, E, E, E ]; + } else { + if ( !F && 0 !== F ) { + this.padding = [ E, C, E, C ]; + } else { + this.padding = [ E, C, F, D ]; + } + } + }, + setInitPosition: function( F, E ) { + var G = this.getEl(); + if ( !this.DDM.verifyEl( G ) ) { + if ( G && G.style && ( G.style.display == "none" ) ) {} else {} + return; + } + var D = F || 0; + var C = E || 0; + var H = B.getXY( G ); + this.initPageX = H[ 0 ] - D; + this.initPageY = H[ 1 ] - C; + this.lastPageX = H[ 0 ]; + this.lastPageY = H[ 1 ]; + this.setStartPosition( H ); + }, + setStartPosition: function( D ) { + var C = D || B.getXY( this.getEl() ); + this.deltaSetXY = null; + this.startPageX = C[ 0 ]; + this.startPageY = C[ 1 ]; + }, + addToGroup: function( C ) { + this.groups[ C ] = true; + this.DDM.regDragDrop( this, C ); + }, + removeFromGroup: function( C ) { + if ( this.groups[ C ] ) { + delete this.groups[ C ]; + } + this.DDM.removeDDFromGroup( this, C ); + }, + setDragElId: function( C ) { + this.dragElId = C; + }, + setHandleElId: function( C ) { + if ( typeof C !== "string" ) { + C = B.generateId( C ); + } + this.handleElId = C; + this.DDM.regHandle( this.id, C ); + }, + setOuterHandleElId: function( C ) { + if ( typeof C !== "string" ) { + C = B.generateId( C ); + } + A.on( C, "mousedown", this.handleMouseDown, this, true ); + this.setHandleElId( C ); + this.hasOuterHandles = true; + }, + unreg: function() { + A.removeListener( this.id, "mousedown", this.handleMouseDown ); + this._domRef = null; + this.DDM._remove( this ); + }, + isLocked: function() { + return ( this.DDM.isLocked() || this.locked ); + }, + handleMouseDown: function( J, I ) { + var D = J.which || J.button; if ( this.primaryButtonOnly && D > 1 ) { + return; + } + if ( this.isLocked() ) { + return; + } + var C = this.b4MouseDown( J ), + F = true; + if ( this.events.b4MouseDown ) { + F = this.fireEvent( "b4MouseDownEvent", J ); + } + var E = this.onMouseDown( J ), + H = true; + if ( this.events.mouseDown ) { + H = this.fireEvent( "mouseDownEvent", J ); + } + if ( ( C === false ) || ( E === false ) || ( F === false ) || ( H === false ) ) { + return; + } + this.DDM.refreshCache( this.groups ); + var G = new YAHOO.util.Point( A.getPageX( J ), A.getPageY( J ) ); + if ( !this.hasOuterHandles && !this.DDM.isOverTarget( G, this ) ) {} else { + if ( this.clickValidator( J ) ) { + this.setStartPosition(); + this.DDM.handleMouseDown( J, this ); + this.DDM.stopEvent( J ); + } else {} + } + }, + clickValidator: function( D ) { + var C = YAHOO.util.Event.getTarget( D ); + return ( this.isValidHandleChild( C ) && ( this.id == this.handleElId || this.DDM.handleWasClicked( C, this.id ) ) ); + }, + getTargetCoord: function( E, D ) { + var C = E - this.deltaX; var F = D - this.deltaY; if ( this.constrainX ) { + if ( C < this.minX ) { + C = this.minX; + } + if ( C > this.maxX ) { + C = this.maxX; + } + } + if ( this.constrainY ) { + if ( F < this.minY ) { + F = this.minY; + } + if ( F > this.maxY ) { + F = this.maxY; + } + } + C = this.getTick( C, this.xTicks ); + F = this.getTick( F, this.yTicks ); + return { x: C, y: F }; + }, + addInvalidHandleType: function( C ) { + var D = C.toUpperCase(); + this.invalidHandleTypes[ D ] = D; + }, + addInvalidHandleId: function( C ) { + if ( typeof C !== "string" ) { + C = B.generateId( C ); + } + this.invalidHandleIds[ C ] = C; + }, + addInvalidHandleClass: function( C ) { + this.invalidHandleClasses.push( C ); + }, + removeInvalidHandleType: function( C ) { + var D = C.toUpperCase(); + delete this.invalidHandleTypes[ D ]; + }, + removeInvalidHandleId: function( C ) { + if ( typeof C !== "string" ) { + C = B.generateId( C ); + } + delete this.invalidHandleIds[ C ]; + }, + removeInvalidHandleClass: function( D ) { + for ( var E = 0, C = this.invalidHandleClasses.length; E < C; ++E ) { + if ( this.invalidHandleClasses[ E ] == D ) { + delete this.invalidHandleClasses[ E ]; + } + } + }, + isValidHandleChild: function( F ) { + var E = true; var H; try { + H = F.nodeName.toUpperCase(); + } catch ( G ) { + H = F.nodeName; + } + E = E && !this.invalidHandleTypes[ H ]; + E = E && !this.invalidHandleIds[ F.id ]; + for ( var D = 0, C = this.invalidHandleClasses.length; E && D < C; ++D ) { + E = !B.hasClass( F, this.invalidHandleClasses[ D ] ); + } + return E; + }, + setXTicks: function( F, C ) { + this.xTicks = []; + this.xTickSize = C; + var E = {}; + for ( var D = this.initPageX; D >= this.minX; D = D - C ) { + if ( !E[ D ] ) { + this.xTicks[ this.xTicks.length ] = D; + E[ D ] = true; + } + } + for ( D = this.initPageX; D <= this.maxX; D = D + C ) { + if ( !E[ D ] ) { + this.xTicks[ this.xTicks.length ] = D; + E[ D ] = true; + } + } + this.xTicks.sort( this.DDM.numericSort ); + }, + setYTicks: function( F, C ) { + this.yTicks = []; + this.yTickSize = C; + var E = {}; + for ( var D = this.initPageY; D >= this.minY; D = D - C ) { + if ( !E[ D ] ) { + this.yTicks[ this.yTicks.length ] = D; + E[ D ] = true; + } + } + for ( D = this.initPageY; D <= this.maxY; D = D + C ) { + if ( !E[ D ] ) { + this.yTicks[ this.yTicks.length ] = D; + E[ D ] = true; + } + } + this.yTicks.sort( this.DDM.numericSort ); + }, + setXConstraint: function( E, D, C ) { + this.leftConstraint = parseInt( E, 10 ); + this.rightConstraint = parseInt( D, 10 ); + this.minX = this.initPageX - this.leftConstraint; + this.maxX = this.initPageX + this.rightConstraint; + if ( C ) { + this.setXTicks( this.initPageX, C ); + } + this.constrainX = true; + }, + clearConstraints: function() { + this.constrainX = false; this.constrainY = false; this.clearTicks(); + }, + clearTicks: function() { + this.xTicks = null; this.yTicks = null; this.xTickSize = 0; this.yTickSize = 0; + }, + setYConstraint: function( C, E, D ) { + this.topConstraint = parseInt( C, 10 ); + this.bottomConstraint = parseInt( E, 10 ); + this.minY = this.initPageY - this.topConstraint; + this.maxY = this.initPageY + this.bottomConstraint; + if ( D ) { + this.setYTicks( this.initPageY, D ); + } + this.constrainY = true; + }, + resetConstraints: function() { + if ( this.initPageX || this.initPageX === 0 ) { + var D = ( this.maintainOffset ) ? this.lastPageX - this.initPageX : 0; + var C = ( this.maintainOffset ) ? this.lastPageY - this.initPageY : 0; + this.setInitPosition( D, C ); + } else { + this.setInitPosition(); + } + if ( this.constrainX ) { + this.setXConstraint( this.leftConstraint, this.rightConstraint, this.xTickSize ); + } + if ( this.constrainY ) { + this.setYConstraint( this.topConstraint, this.bottomConstraint, this.yTickSize ); + } + }, + getTick: function( I, F ) { + if ( !F ) { + return I; + } else { + if ( F[ 0 ] >= I ) { + return F[ 0 ]; + } else { + for ( var D = 0, C = F.length; D < C; ++D ) { + var E = D + 1; + if ( F[ E ] && F[ E ] >= I ) { + var H = I - F[ D ]; + var G = F[ E ] - I; + return ( G > H ) ? F[ D ] : F[ E ]; + } + } + return F[ F.length - 1 ]; + } + } + }, + toString: function() { + return ( "DragDrop " + this.id ); + } }; YAHOO.augment( YAHOO.util.DragDrop, YAHOO.util.EventProvider ); +})(); +YAHOO.util.DD = function( C, A, B ) { + if ( C ) { + this.init( C, A, B ); + } +}; +YAHOO.extend( YAHOO.util.DD, YAHOO.util.DragDrop, { + scroll: true, autoOffset: function( C, B ) { + var A = C - this.startPageX; var D = B - this.startPageY; this.setDelta( A, D ); + }, + setDelta: function( B, A ) { + this.deltaX = B; this.deltaY = A; + }, + setDragElPos: function( C, B ) { + var A = this.getDragEl(); + this.alignElWithMouse( A, C, B ); + }, + alignElWithMouse: function( C, G, F ) { + var E = this.getTargetCoord( G, F ); + if ( !this.deltaSetXY ) { + var H = [ E.x, E.y ]; + YAHOO.util.Dom.setXY( C, H ); + var D = parseInt( YAHOO.util.Dom.getStyle( C, "left" ), 10 ); + var B = parseInt( YAHOO.util.Dom.getStyle( C, "top" ), 10 ); + this.deltaSetXY = [ D - E.x, B - E.y ]; + } else { + YAHOO.util.Dom.setStyle( C, "left", ( E.x + this.deltaSetXY[ 0 ] ) + "px" ); + YAHOO.util.Dom.setStyle( C, "top", ( E.y + this.deltaSetXY[ 1 ] ) + "px" ); + } + this.cachePosition( E.x, E.y ); + var A = this; + setTimeout( function() { + A.autoScroll.call( A, E.x, E.y, C.offsetHeight, C.offsetWidth ); + }, 0 ); + }, + cachePosition: function( B, A ) { + if ( B ) { + this.lastPageX = B; + this.lastPageY = A; + } else { + var C = YAHOO.util.Dom.getXY( this.getEl() ); + this.lastPageX = C[ 0 ]; + this.lastPageY = C[ 1 ]; + } + }, + autoScroll: function( J, I, E, K ) { + if ( this.scroll ) { + var L = this.DDM.getClientHeight(); + var B = this.DDM.getClientWidth(); + var N = this.DDM.getScrollTop(); + var D = this.DDM.getScrollLeft(); + var H = E + I; + var M = K + J; + var G = ( L + N - I - this.deltaY ); + var F = ( B + D - J - this.deltaX ); + var C = 40; + var A = ( document.all ) ? 80 : 30; + if ( H > L && G < C ) { + window.scrollTo( D, N + A ); + } + if ( I < N && N > 0 && I - N < C ) { + window.scrollTo( D, N - A ); + } + if ( M > B && F < C ) { + window.scrollTo( D + A, N ); + } + if ( J < D && D > 0 && J - D < C ) { + window.scrollTo( D - A, N ); + } + } + }, + applyConfig: function() { + YAHOO.util.DD.superclass.applyConfig.call( this ); + this.scroll = ( this.config.scroll !== false ); + }, + b4MouseDown: function( A ) { + this.setStartPosition(); + this.autoOffset( YAHOO.util.Event.getPageX( A ), YAHOO.util.Event.getPageY( A ) ); + }, + b4Drag: function( A ) { + this.setDragElPos( YAHOO.util.Event.getPageX( A ), YAHOO.util.Event.getPageY( A ) ); + }, + toString: function() { + return ( "DD " + this.id ); + } } ); +YAHOO.util.DDProxy = function( C, A, B ) { + if ( C ) { + this.init( C, A, B ); + this.initFrame(); + } +}; +YAHOO.util.DDProxy.dragElId = "ygddfdiv"; +YAHOO.extend( YAHOO.util.DDProxy, YAHOO.util.DD, { + resizeFrame: true, centerFrame: false, createFrame: function() { + var B = this, + A = document.body; if ( !A || !A.firstChild ) { + setTimeout( function() { + B.createFrame(); + }, 50 ); + return; + } + var F = this.getDragEl(), + E = YAHOO.util.Dom; + if ( !F ) { + F = document.createElement( "div" ); + F.id = this.dragElId; + var D = F.style; + D.position = "absolute"; + D.visibility = "hidden"; + D.cursor = "move"; + D.border = "2px solid #aaa"; + D.zIndex = 999; + D.height = "25px"; + D.width = "25px"; + var C = document.createElement( "div" ); + E.setStyle( C, "height", "100%" ); + E.setStyle( C, "width", "100%" ); + E.setStyle( C, "background-color", "#ccc" ); + E.setStyle( C, "opacity", "0" ); + F.appendChild( C ); + A.insertBefore( F, A.firstChild ); + } + }, + initFrame: function() { + this.createFrame(); + }, + applyConfig: function() { + YAHOO.util.DDProxy.superclass.applyConfig.call( this ); + this.resizeFrame = ( this.config.resizeFrame !== false ); + this.centerFrame = ( this.config.centerFrame ); + this.setDragElId( this.config.dragElId || YAHOO.util.DDProxy.dragElId ); + }, + showFrame: function( E, D ) { + var C = this.getEl(); + var A = this.getDragEl(); + var B = A.style; + this._resizeProxy(); + if ( this.centerFrame ) { + this.setDelta( Math.round( parseInt( B.width, 10 ) / 2 ), Math.round( parseInt( B.height, 10 ) / 2 ) ); + } + this.setDragElPos( E, D ); + YAHOO.util.Dom.setStyle( A, "visibility", "visible" ); + }, + _resizeProxy: function() { + if ( this.resizeFrame ) { + var H = YAHOO.util.Dom; + var B = this.getEl(); + var C = this.getDragEl(); + var G = parseInt( H.getStyle( C, "borderTopWidth" ), 10 ); + var I = parseInt( H.getStyle( C, "borderRightWidth" ), 10 ); + var F = parseInt( H.getStyle( C, "borderBottomWidth" ), 10 ); + var D = parseInt( H.getStyle( C, "borderLeftWidth" ), 10 ); + if ( isNaN( G ) ) { + G = 0; + } + if ( isNaN( I ) ) { + I = 0; + } + if ( isNaN( F ) ) { + F = 0; + } + if ( isNaN( D ) ) { + D = 0; + } + var E = Math.max( 0, B.offsetWidth - I - D ); + var A = Math.max( 0, B.offsetHeight - G - F ); + H.setStyle( C, "width", E + "px" ); + H.setStyle( C, "height", A + "px" ); + } + }, + b4MouseDown: function( B ) { + this.setStartPosition(); + var A = YAHOO.util.Event.getPageX( B ); + var C = YAHOO.util.Event.getPageY( B ); + this.autoOffset( A, C ); + }, + b4StartDrag: function( A, B ) { + this.showFrame( A, B ); + }, + b4EndDrag: function( A ) { + YAHOO.util.Dom.setStyle( this.getDragEl(), "visibility", "hidden" ); + }, + endDrag: function( D ) { + var C = YAHOO.util.Dom; var B = this.getEl(); + var A = this.getDragEl(); + C.setStyle( A, "visibility", "" ); + C.setStyle( B, "visibility", "hidden" ); + YAHOO.util.DDM.moveToEl( B, A ); + C.setStyle( A, "visibility", "hidden" ); + C.setStyle( B, "visibility", "" ); + }, + toString: function() { + return ( "DDProxy " + this.id ); + } } ); +YAHOO.util.DDTarget = function( C, A, B ) { + if ( C ) { + this.initTarget( C, A, B ); + } +}; +YAHOO.extend( YAHOO.util.DDTarget, YAHOO.util.DragDrop, { + toString: function() { + return ( "DDTarget " + this.id ); + } } ); +YAHOO.register( "dragdrop", YAHOO.util.DragDropMgr, { version: "2.7.0", build: "1796" } ); +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ ( function() { + var B = YAHOO.util.Dom.getXY, + A = YAHOO.util.Event, + D = Array.prototype.slice; + + function C( G, E, F, H ) { + C.ANIM_AVAIL = ( !YAHOO.lang.isUndefined( YAHOO.util.Anim ) ); + if ( G ) { + this.init( G, E, true ); + this.initSlider( H ); + this.initThumb( F ); + } + } + YAHOO.lang.augmentObject( C, { + getHorizSlider: function( F, G, I, H, E ) { + return new C( F, F, new YAHOO.widget.SliderThumb( G, F, I, H, 0, 0, E ), "horiz" ); + }, + getVertSlider: function( G, H, E, I, F ) { + return new C( G, G, new YAHOO.widget.SliderThumb( H, G, 0, 0, E, I, F ), "vert" ); + }, + getSliderRegion: function( G, H, J, I, E, K, F ) { + return new C( G, G, new YAHOO.widget.SliderThumb( H, G, J, I, E, K, F ), "region" ); + }, + SOURCE_UI_EVENT: 1, SOURCE_SET_VALUE: 2, SOURCE_KEY_EVENT: 3, ANIM_AVAIL: false }, true ); + YAHOO.extend( C, YAHOO.util.DragDrop, { + _mouseDown: false, dragOnly: true, initSlider: function( E ) { + this.type = E; this.createEvent( "change", this ); + this.createEvent( "slideStart", this ); + this.createEvent( "slideEnd", this ); + this.isTarget = false; + this.animate = C.ANIM_AVAIL; + this.backgroundEnabled = true; + this.tickPause = 40; + this.enableKeys = true; + this.keyIncrement = 20; + this.moveComplete = true; + this.animationDuration = 0.2; + this.SOURCE_UI_EVENT = 1; + this.SOURCE_SET_VALUE = 2; + this.valueChangeSource = 0; + this._silent = false; + this.lastOffset = [ 0, 0 ]; + }, + initThumb: function( F ) { + var E = this; this.thumb = F; F.cacheBetweenDrags = true; if ( F._isHoriz && F.xTicks && F.xTicks.length ) { + this.tickPause = Math.round( 360 / F.xTicks.length ); + } else { + if ( F.yTicks && F.yTicks.length ) { + this.tickPause = Math.round( 360 / F.yTicks.length ); + } + } + F.onAvailable = function() { + return E.setStartSliderState(); + }; + F.onMouseDown = function() { + E._mouseDown = true; + return E.focus(); + }; + F.startDrag = function() { + E._slideStart(); + }; + F.onDrag = function() { + E.fireEvents( true ); + }; + F.onMouseUp = function() { + E.thumbMouseUp(); + }; + }, + onAvailable: function() { + this._bindKeyEvents(); + }, + _bindKeyEvents: function() { + A.on( this.id, "keydown", this.handleKeyDown, this, true ); + A.on( this.id, "keypress", this.handleKeyPress, this, true ); + }, + handleKeyPress: function( F ) { + if ( this.enableKeys ) { + var E = A.getCharCode( F ); + switch ( E ) { + case 37: + case 38: + case 39: + case 40: + case 36: + case 35: + A.preventDefault( F ); + break;default: + } + } + }, + handleKeyDown: function( J ) { + if ( this.enableKeys ) { + var G = A.getCharCode( J ), + F = this.thumb, + H = this.getXValue(), + E = this.getYValue(), + I = true; + switch ( G ) { + case 37: + H -= this.keyIncrement; + break;case 38: + E -= this.keyIncrement; + break;case 39: + H += this.keyIncrement; + break;case 40: + E += this.keyIncrement; + break;case 36: + H = F.leftConstraint; + E = F.topConstraint; + break;case 35: + H = F.rightConstraint; + E = F.bottomConstraint; + break;default: + I = false; + } + if ( I ) { + if ( F._isRegion ) { + this._setRegionValue( C.SOURCE_KEY_EVENT, H, E, true ); + } else { + this._setValue( C.SOURCE_KEY_EVENT, ( F._isHoriz ? H : E ), true ); + } + A.stopEvent( J ); + } + } + }, + setStartSliderState: function() { + this.setThumbCenterPoint(); + this.baselinePos = B( this.getEl() ); + this.thumb.startOffset = this.thumb.getOffsetFromParent( this.baselinePos ); + if ( this.thumb._isRegion ) { + if ( this.deferredSetRegionValue ) { + this._setRegionValue.apply( this, this.deferredSetRegionValue ); + this.deferredSetRegionValue = null; + } else { + this.setRegionValue( 0, 0, true, true, true ); + } + } else { + if ( this.deferredSetValue ) { + this._setValue.apply( this, this.deferredSetValue ); + this.deferredSetValue = null; + } else { + this.setValue( 0, true, true, true ); + } + } + }, + setThumbCenterPoint: function() { + var E = this.thumb.getEl(); + if ( E ) { + this.thumbCenterPoint = { x: parseInt( E.offsetWidth / 2, 10 ), y: parseInt( E.offsetHeight / 2, 10 ) }; + } + }, + lock: function() { + this.thumb.lock(); + this.locked = true; + }, + unlock: function() { + this.thumb.unlock(); + this.locked = false; + }, + thumbMouseUp: function() { + this._mouseDown = false; if ( !this.isLocked() && !this.moveComplete ) { + this.endMove(); + } + }, + onMouseUp: function() { + this._mouseDown = false; if ( this.backgroundEnabled && !this.isLocked() && !this.moveComplete ) { + this.endMove(); + } + }, + getThumb: function() { + return this.thumb; + }, + focus: function() { + this.valueChangeSource = C.SOURCE_UI_EVENT; var E = this.getEl(); + if ( E.focus ) { + try { + E.focus(); + } catch ( F ) {} + } + this.verifyOffset(); + return !this.isLocked(); + }, + onChange: function( E, F ) {}, + onSlideStart: function() {}, + onSlideEnd: function() {}, + getValue: function() { + return this.thumb.getValue(); + }, + getXValue: function() { + return this.thumb.getXValue(); + }, + getYValue: function() { + return this.thumb.getYValue(); + }, + setValue: function() { + var E = D.call( arguments ); + E.unshift( C.SOURCE_SET_VALUE ); + return this._setValue.apply( this, E ); + }, + _setValue: function( I, L, G, H, E ) { + var F = this.thumb, + K, J; if ( !F.available ) { + this.deferredSetValue = arguments; + return false; + } + if ( this.isLocked() && !H ) { + return false; + } + if ( isNaN( L ) ) { + return false; + } + if ( F._isRegion ) { + return false; + } + this._silent = E; + this.valueChangeSource = I || C.SOURCE_SET_VALUE; + F.lastOffset = [ L, L ]; + this.verifyOffset( true ); + this._slideStart(); + if ( F._isHoriz ) { + K = F.initPageX + L + this.thumbCenterPoint.x; + this.moveThumb( K, F.initPageY, G ); + } else { + J = F.initPageY + L + this.thumbCenterPoint.y; + this.moveThumb( F.initPageX, J, G ); + } + return true; + }, + setRegionValue: function() { + var E = D.call( arguments ); + E.unshift( C.SOURCE_SET_VALUE ); + return this._setRegionValue.apply( this, E ); + }, + _setRegionValue: function( F, J, H, I, G, K ) { + var L = this.thumb, + E, M; if ( !L.available ) { + this.deferredSetRegionValue = arguments; + return false; + } + if ( this.isLocked() && !G ) { + return false; + } + if ( isNaN( J ) ) { + return false; + } + if ( !L._isRegion ) { + return false; + } + this._silent = K; + this.valueChangeSource = F || C.SOURCE_SET_VALUE; + L.lastOffset = [ J, H ]; + this.verifyOffset( true ); + this._slideStart(); + E = L.initPageX + J + this.thumbCenterPoint.x; + M = L.initPageY + H + this.thumbCenterPoint.y; + this.moveThumb( E, M, I ); + return true; + }, + verifyOffset: function( F ) { + var G = B( this.getEl() ), + E = this.thumb; + if ( !this.thumbCenterPoint || !this.thumbCenterPoint.x ) { + this.setThumbCenterPoint(); + } + if ( G ) { + if ( G[ 0 ] != this.baselinePos[ 0 ] || G[ 1 ] != this.baselinePos[ 1 ] ) { + this.setInitPosition(); + this.baselinePos = G; + E.initPageX = this.initPageX + E.startOffset[ 0 ]; + E.initPageY = this.initPageY + E.startOffset[ 1 ]; + E.deltaSetXY = null; + this.resetThumbConstraints(); + return false; + } + } + return true; + }, + moveThumb: function( K, J, I, G ) { + var L = this.thumb, + M = this, + F, E, H; if ( !L.available ) { + return; + } + L.setDelta( this.thumbCenterPoint.x, this.thumbCenterPoint.y ); + E = L.getTargetCoord( K, J ); + F = [ Math.round( E.x ), Math.round( E.y ) ]; + if ( this.animate && L._graduated && !I ) { + this.lock(); + this.curCoord = B( this.thumb.getEl() ); + this.curCoord = [ Math.round( this.curCoord[ 0 ] ), Math.round( this.curCoord[ 1 ] ) ]; + setTimeout( function() { + M.moveOneTick( F ); + }, this.tickPause ); + } else { + if ( this.animate && C.ANIM_AVAIL && !I ) { + this.lock(); + H = new YAHOO.util.Motion( L.id, { + points: { to: F } }, this.animationDuration, YAHOO.util.Easing.easeOut ); + H.onComplete.subscribe( function() { + M.unlock(); + if ( !M._mouseDown ) { + M.endMove(); + } + }); + H.animate(); + } else { + L.setDragElPos( K, J ); + if ( !G && !this._mouseDown ) { + this.endMove(); + } + } + } + }, + _slideStart: function() { + if ( !this._sliding ) { + if ( !this._silent ) { + this.onSlideStart(); + this.fireEvent( "slideStart" ); + } + this._sliding = true; + } + }, + _slideEnd: function() { + if ( this._sliding && this.moveComplete ) { + var E = this._silent; + this._sliding = false; + this._silent = false; + this.moveComplete = false; + if ( !E ) { + this.onSlideEnd(); + this.fireEvent( "slideEnd" ); + } + } + }, + moveOneTick: function( F ) { + var H = this.thumb, + G = this, + I = null, + E, J; if ( H._isRegion ) { + I = this._getNextX( this.curCoord, F ); + E = ( I !== null ) ? I[ 0 ] : this.curCoord[ 0 ]; + I = this._getNextY( this.curCoord, F ); + J = ( I !== null ) ? I[ 1 ] : this.curCoord[ 1 ]; + I = E !== this.curCoord[ 0 ] || J !== this.curCoord[ 1 ] ? [ E, J ] : null; + } else { + if ( H._isHoriz ) { + I = this._getNextX( this.curCoord, F ); + } else { + I = this._getNextY( this.curCoord, F ); + } + } + if ( I ) { + this.curCoord = I; + this.thumb.alignElWithMouse( H.getEl(), I[ 0 ] + this.thumbCenterPoint.x, I[ 1 ] + this.thumbCenterPoint.y ); + if ( !( I[ 0 ] == F[ 0 ] && I[ 1 ] == F[ 1 ] ) ) { + setTimeout( function() { + G.moveOneTick( F ); + }, this.tickPause ); + } else { + this.unlock(); + if ( !this._mouseDown ) { + this.endMove(); + } + } + } else { + this.unlock(); + if ( !this._mouseDown ) { + this.endMove(); + } + } + }, + _getNextX: function( E, F ) { + var H = this.thumb, + J, + G = [], + I = null; + if ( E[ 0 ] > F[ 0 ] ) { + J = H.tickSize - this.thumbCenterPoint.x; + G = H.getTargetCoord( E[ 0 ] - J, E[ 1 ] ); + I = [ G.x, G.y ]; + } else { + if ( E[ 0 ] < F[ 0 ] ) { + J = H.tickSize + this.thumbCenterPoint.x; + G = H.getTargetCoord( E[ 0 ] + J, E[ 1 ] ); + I = [ G.x, G.y ]; + } else {} + } + return I; + }, + _getNextY: function( E, F ) { + var H = this.thumb, + J, + G = [], + I = null; + if ( E[ 1 ] > F[ 1 ] ) { + J = H.tickSize - this.thumbCenterPoint.y; + G = H.getTargetCoord( E[ 0 ], E[ 1 ] - J ); + I = [ G.x, G.y ]; + } else { + if ( E[ 1 ] < F[ 1 ] ) { + J = H.tickSize + this.thumbCenterPoint.y; + G = H.getTargetCoord( E[ 0 ], E[ 1 ] + J ); + I = [ G.x, G.y ]; + } else {} + } + return I; + }, + b4MouseDown: function( E ) { + if ( !this.backgroundEnabled ) { + return false; + } + this.thumb.autoOffset(); + this.resetThumbConstraints(); + }, + onMouseDown: function( F ) { + if ( !this.backgroundEnabled || this.isLocked() ) { + return false; + } + this._mouseDown = true; + var E = A.getPageX( F ), + G = A.getPageY( F ); + this.focus(); + this._slideStart(); + this.moveThumb( E, G ); + }, + onDrag: function( F ) { + if ( this.backgroundEnabled && !this.isLocked() ) { + var E = A.getPageX( F ), + G = A.getPageY( F ); + this.moveThumb( E, G, true, true ); + this.fireEvents(); + } + }, + endMove: function() { + this.unlock(); + this.fireEvents(); + this.moveComplete = true; + this._slideEnd(); + }, + resetThumbConstraints: function() { + var E = this.thumb; E.setXConstraint( E.leftConstraint, E.rightConstraint, E.xTickSize ); + E.setYConstraint( E.topConstraint, E.bottomConstraint, E.xTickSize ); + }, + fireEvents: function( G ) { + var F = this.thumb, + I, H, E; if ( !G ) { + F.cachePosition(); + } + if ( !this.isLocked() ) { + if ( F._isRegion ) { + I = F.getXValue(); + H = F.getYValue(); + if ( I != this.previousX || H != this.previousY ) { + if ( !this._silent ) { + this.onChange( I, H ); + this.fireEvent( "change", { x: I, y: H } ); + } + } + this.previousX = I; + this.previousY = H; + } else { + E = F.getValue(); + if ( E != this.previousVal ) { + if ( !this._silent ) { + this.onChange( E ); + this.fireEvent( "change", E ); + } + } + this.previousVal = E; + } + } + }, + toString: function() { + return ( "Slider (" + this.type + ") " + this.id ); + } } ); + YAHOO.lang.augmentProto( C, YAHOO.util.EventProvider ); + YAHOO.widget.Slider = C; +})(); +YAHOO.widget.SliderThumb = function( G, B, E, D, A, F, C ) { + if ( G ) { + YAHOO.widget.SliderThumb.superclass.constructor.call( this, G, B ); + this.parentElId = B; + } + this.isTarget = false; + this.tickSize = C; + this.maintainOffset = true; + this.initSlider( E, D, A, F, C ); + this.scroll = false; +}; +YAHOO.extend( YAHOO.widget.SliderThumb, YAHOO.util.DD, { + startOffset: null, dragOnly: true, _isHoriz: false, _prevVal: 0, _graduated: false, getOffsetFromParent0: function( C ) { + var A = YAHOO.util.Dom.getXY( this.getEl() ), + B = C || YAHOO.util.Dom.getXY( this.parentElId ); + return [ ( A[ 0 ] - B[ 0 ] ), ( A[ 1 ] - B[ 1 ] ) ]; + }, + getOffsetFromParent: function( H ) { + var A = this.getEl(), + E, I, F, B, K, D, C, J, G; + if ( !this.deltaOffset ) { + I = YAHOO.util.Dom.getXY( A ); + F = H || YAHOO.util.Dom.getXY( this.parentElId ); + E = [ ( I[ 0 ] - F[ 0 ] ), ( I[ 1 ] - F[ 1 ] ) ]; + B = parseInt( YAHOO.util.Dom.getStyle( A, "left" ), 10 ); + K = parseInt( YAHOO.util.Dom.getStyle( A, "top" ), 10 ); + D = B - E[ 0 ]; + C = K - E[ 1 ]; + if ( isNaN( D ) || isNaN( C ) ) {} else { + this.deltaOffset = [ D, C ]; + } + } else { + J = parseInt( YAHOO.util.Dom.getStyle( A, "left" ), 10 ); + G = parseInt( YAHOO.util.Dom.getStyle( A, "top" ), 10 ); + E = [ J + this.deltaOffset[ 0 ], G + this.deltaOffset[ 1 ] ]; + } + return E; + }, + initSlider: function( D, C, A, E, B ) { + this.initLeft = D; this.initRight = C; this.initUp = A; this.initDown = E; this.setXConstraint( D, C, B ); + this.setYConstraint( A, E, B ); + if ( B && B > 1 ) { + this._graduated = true; + } + this._isHoriz = ( D || C ); + this._isVert = ( A || E ); + this._isRegion = ( this._isHoriz && this._isVert ); + }, + clearTicks: function() { + YAHOO.widget.SliderThumb.superclass.clearTicks.call( this ); + this.tickSize = 0; + this._graduated = false; + }, + getValue: function() { + return ( this._isHoriz ) ? this.getXValue() : this.getYValue(); + }, + getXValue: function() { + if ( !this.available ) { + return 0; + } + var A = this.getOffsetFromParent(); + if ( YAHOO.lang.isNumber( A[ 0 ] ) ) { + this.lastOffset = A; + return ( A[ 0 ] - this.startOffset[ 0 ] ); + } else { + return ( this.lastOffset[ 0 ] - this.startOffset[ 0 ] ); + } + }, + getYValue: function() { + if ( !this.available ) { + return 0; + } + var A = this.getOffsetFromParent(); + if ( YAHOO.lang.isNumber( A[ 1 ] ) ) { + this.lastOffset = A; + return ( A[ 1 ] - this.startOffset[ 1 ] ); + } else { + return ( this.lastOffset[ 1 ] - this.startOffset[ 1 ] ); + } + }, + toString: function() { + return "SliderThumb " + this.id; + }, + onChange: function( A, B ) {} } ); +(function() { + var A = YAHOO.util.Event, + B = YAHOO.widget; + + function C( I, F, H, D ) { + var G = this, + J = { min: false, max: false }, + E, K; this.minSlider = I; this.maxSlider = F; this.activeSlider = I; this.isHoriz = I.thumb._isHoriz; E = this.minSlider.thumb.onMouseDown; K = this.maxSlider.thumb.onMouseDown; this.minSlider.thumb.onMouseDown = function() { + G.activeSlider = G.minSlider; + E.apply( this, arguments ); + }; + this.maxSlider.thumb.onMouseDown = function() { + G.activeSlider = G.maxSlider; + K.apply( this, arguments ); + }; + this.minSlider.thumb.onAvailable = function() { + I.setStartSliderState(); + J.min = true; + if ( J.max ) { + G.fireEvent( "ready", G ); + } + }; + this.maxSlider.thumb.onAvailable = function() { + F.setStartSliderState(); + J.max = true; + if ( J.min ) { + G.fireEvent( "ready", G ); + } + }; + I.onMouseDown = F.onMouseDown = function( L ) { + return this.backgroundEnabled && G._handleMouseDown( L ); + }; + I.onDrag = F.onDrag = function( L ) { + G._handleDrag( L ); + }; + I.onMouseUp = F.onMouseUp = function( L ) { + G._handleMouseUp( L ); + }; + I._bindKeyEvents = function() { + G._bindKeyEvents( this ); + }; + F._bindKeyEvents = function() {}; + I.subscribe( "change", this._handleMinChange, I, this ); + I.subscribe( "slideStart", this._handleSlideStart, I, this ); + I.subscribe( "slideEnd", this._handleSlideEnd, I, this ); + F.subscribe( "change", this._handleMaxChange, F, this ); + F.subscribe( "slideStart", this._handleSlideStart, F, this ); + F.subscribe( "slideEnd", this._handleSlideEnd, F, this ); + this.createEvent( "ready", this ); + this.createEvent( "change", this ); + this.createEvent( "slideStart", this ); + this.createEvent( "slideEnd", this ); + D = YAHOO.lang.isArray( D ) ? D : [ 0, H ]; + D[ 0 ] = Math.min( Math.max( parseInt( D[ 0 ], 10 ) | 0, 0 ), H ); + D[ 1 ] = Math.max( Math.min( parseInt( D[ 1 ], 10 ) | 0, H ), 0 ); + if ( D[ 0 ] > D[ 1 ] ) { + D.splice( 0, 2, D[ 1 ], D[ 0 ] ); + } + this.minVal = D[ 0 ]; + this.maxVal = D[ 1 ]; + this.minSlider.setValue( this.minVal, true, true, true ); + this.maxSlider.setValue( this.maxVal, true, true, true ); + } + C.prototype = { + minVal: -1, maxVal: -1, minRange: 0, _handleSlideStart: function( E, D ) { + this.fireEvent( "slideStart", D ); + }, + _handleSlideEnd: function( E, D ) { + this.fireEvent( "slideEnd", D ); + }, + _handleDrag: function( D ) { + B.Slider.prototype.onDrag.call( this.activeSlider, D ); + }, + _handleMinChange: function() { + this.activeSlider = this.minSlider; this.updateValue(); + }, + _handleMaxChange: function() { + this.activeSlider = this.maxSlider; this.updateValue(); + }, + _bindKeyEvents: function( D ) { + A.on( D.id, "keydown", this._handleKeyDown, this, true ); + A.on( D.id, "keypress", this._handleKeyPress, this, true ); + }, + _handleKeyDown: function( D ) { + this.activeSlider.handleKeyDown.apply( this.activeSlider, arguments ); + }, + _handleKeyPress: function( D ) { + this.activeSlider.handleKeyPress.apply( this.activeSlider, arguments ); + }, + setValues: function( H, K, I, E, J ) { + var F = this.minSlider, + M = this.maxSlider, + D = F.thumb, + L = M.thumb, + N = this, + G = { min: false, max: false }; if ( D._isHoriz ) { + D.setXConstraint( D.leftConstraint, L.rightConstraint, D.tickSize ); + L.setXConstraint( D.leftConstraint, L.rightConstraint, L.tickSize ); + } else { + D.setYConstraint( D.topConstraint, L.bottomConstraint, D.tickSize ); + L.setYConstraint( D.topConstraint, L.bottomConstraint, L.tickSize ); + } + this._oneTimeCallback( F, "slideEnd", function() { + G.min = true; + if ( G.max ) { + N.updateValue( J ); + setTimeout( function() { + N._cleanEvent( F, "slideEnd" ); + N._cleanEvent( M, "slideEnd" ); + }, 0 ); + } + }); + this._oneTimeCallback( M, "slideEnd", function() { + G.max = true; + if ( G.min ) { + N.updateValue( J ); + setTimeout( function() { + N._cleanEvent( F, "slideEnd" ); + N._cleanEvent( M, "slideEnd" ); + }, 0 ); + } + }); + F.setValue( H, I, E, false ); + M.setValue( K, I, E, false ); + }, + setMinValue: function( F, H, I, E ) { + var G = this.minSlider, + D = this; this.activeSlider = G; D = this; this._oneTimeCallback( G, "slideEnd", function() { + D.updateValue( E ); + setTimeout( function() { + D._cleanEvent( G, "slideEnd" ); + }, 0 ); + }); + G.setValue( F, H, I ); + }, + setMaxValue: function( D, H, I, F ) { + var G = this.maxSlider, + E = this; this.activeSlider = G; this._oneTimeCallback( G, "slideEnd", function() { + E.updateValue( F ); + setTimeout( function() { + E._cleanEvent( G, "slideEnd" ); + }, 0 ); + }); + G.setValue( D, H, I ); + }, + updateValue: function( J ) { + var E = this.minSlider.getValue(), + K = this.maxSlider.getValue(), + F = false, + D, M, H, I, L, G; + if ( E != this.minVal || K != this.maxVal ) { + F = true; + D = this.minSlider.thumb; + M = this.maxSlider.thumb; + H = this.isHoriz ? "x" : "y"; + G = this.minSlider.thumbCenterPoint[ H ] + this.maxSlider.thumbCenterPoint[ H ]; + I = Math.max( K - G - this.minRange, 0 ); + L = Math.min( -E - G - this.minRange, 0 ); + if ( this.isHoriz ) { + I = Math.min( I, M.rightConstraint ); + D.setXConstraint( D.leftConstraint, I, D.tickSize ); + M.setXConstraint( L, M.rightConstraint, M.tickSize ); + } else { + I = Math.min( I, M.bottomConstraint ); + D.setYConstraint( D.leftConstraint, I, D.tickSize ); + M.setYConstraint( L, M.bottomConstraint, M.tickSize ); + } + } + this.minVal = E; + this.maxVal = K; + if ( F && !J ) { + this.fireEvent( "change", this ); + } + }, + selectActiveSlider: function( H ) { + var E = this.minSlider, + D = this.maxSlider, + J = E.isLocked() || !E.backgroundEnabled, + G = D.isLocked() || !E.backgroundEnabled, + F = YAHOO.util.Event, + I; + if ( J || G ) { + this.activeSlider = J ? D : E; + } else { + if ( this.isHoriz ) { + I = F.getPageX( H ) - E.thumb.initPageX - E.thumbCenterPoint.x; + } else { + I = F.getPageY( H ) - E.thumb.initPageY - E.thumbCenterPoint.y; + } + this.activeSlider = I * 2 > D.getValue() + E.getValue() ? D : E; + } + }, + _handleMouseDown: function( D ) { + if ( !D._handled ) { + D._handled = true; + this.selectActiveSlider( D ); + return B.Slider.prototype.onMouseDown.call( this.activeSlider, D ); + } else { + return false; + } + }, + _handleMouseUp: function( D ) { + B.Slider.prototype.onMouseUp.apply( this.activeSlider, arguments ); + }, + _oneTimeCallback: function( F, D, E ) { + F.subscribe( D, function() { + F.unsubscribe( D, arguments.callee ); + E.apply( {}, [].slice.apply( arguments ) ); + }); + }, + _cleanEvent: function( K, E ) { + var J, I, D, G, H, F; if ( K.__yui_events && K.events[ E ] ) { + for ( I = K.__yui_events.length; I >= 0; --I ) { + if ( K.__yui_events[ I ].type === E ) { + J = K.__yui_events[ I ]; + break; + } + } + if ( J ) { + H = J.subscribers; + F = []; + G = 0; + for ( I = 0, D = H.length; I < D; ++I ) { + if ( H[ I ] ) { + F[ G++ ] = H[ I ]; + } + } + J.subscribers = F; + } + } + } }; YAHOO.lang.augmentProto( C, YAHOO.util.EventProvider ); + B.Slider.getHorizDualSlider = function( H, J, K, G, F, D ) { + var I = new B.SliderThumb( J, H, 0, G, 0, 0, F ), + E = new B.SliderThumb( K, H, 0, G, 0, 0, F ); + return new C( new B.Slider( H, H, I, "horiz" ), new B.Slider( H, H, E, "horiz" ), G, D ); + }; + B.Slider.getVertDualSlider = function( H, J, K, G, F, D ) { + var I = new B.SliderThumb( J, H, 0, 0, 0, G, F ), + E = new B.SliderThumb( K, H, 0, 0, 0, G, F ); + return new B.DualSlider( new B.Slider( H, H, I, "vert" ), new B.Slider( H, H, E, "vert" ), G, D ); + }; + YAHOO.widget.DualSlider = C; +})(); +YAHOO.register( "slider", YAHOO.widget.Slider, { version: "2.7.0", build: "1796" } ); +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +YAHOO.util.Attribute = function( B, A ) { + if ( A ) { + this.owner = A; + this.configure( B, true ); + } +}; +YAHOO.util.Attribute.prototype = { + name: undefined, value: null, owner: null, readOnly: false, writeOnce: false, _initialConfig: null, _written: false, method: null, setter: null, getter: null, validator: null, getValue: function() { + var A = this.value; if ( this.getter ) { + A = this.getter.call( this.owner, this.name ); + } + return A; + }, + setValue: function( F, B ) { + var E, + A = this.owner, + C = this.name; var D = { type: C, prevValue: this.getValue(), newValue: F }; if ( this.readOnly || ( this.writeOnce && this._written ) ) { + return false; + } + if ( this.validator && !this.validator.call( A, F ) ) { + return false; + } + if ( !B ) { + E = A.fireBeforeChangeEvent( D ); + if ( E === false ) { + return false; + } + } + if ( this.setter ) { + F = this.setter.call( A, F, this.name ); + if ( F === undefined ) {} + } + if ( this.method ) { + this.method.call( A, F, this.name ); + } + this.value = F; + this._written = true; + D.type = C; + if ( !B ) { + this.owner.fireChangeEvent( D ); + } + return true; + }, + configure: function( B, C ) { + B = B || {}; + if ( C ) { + this._written = false; + } + this._initialConfig = this._initialConfig || {}; + for ( var A in B ) { + if ( B.hasOwnProperty( A ) ) { + this[ A ] = B[ A ]; + if ( C ) { + this._initialConfig[ A ] = B[ A ]; + } + } + } + }, + resetValue: function() { + return this.setValue( this._initialConfig.value ); + }, + resetConfig: function() { + this.configure( this._initialConfig, true ); + }, + refresh: function( A ) { + this.setValue( this.value, A ); + } }; +(function() { + var A = YAHOO.util.Lang; + YAHOO.util.AttributeProvider = function() {}; + YAHOO.util.AttributeProvider.prototype = { + _configs: null, get: function( C ) { + this._configs = this._configs || {}; + var B = this._configs[ C ]; + if ( !B || !this._configs.hasOwnProperty( C ) ) { + return null; + } + return B.getValue(); + }, + set: function( D, E, B ) { + this._configs = this._configs || {}; + var C = this._configs[ D ]; + if ( !C ) { + return false; + } + return C.setValue( E, B ); + }, + getAttributeKeys: function() { + this._configs = this._configs; var C = [], + B; + for ( B in this._configs ) { + if ( A.hasOwnProperty( this._configs, B ) && !A.isUndefined( this._configs[ B ] ) ) { + C[ C.length ] = B; + } + } + return C; + }, + setAttributes: function( D, B ) { + for ( var C in D ) { + if ( A.hasOwnProperty( D, C ) ) { + this.set( C, D[ C ], B ); + } + } + }, + resetValue: function( C, B ) { + this._configs = this._configs || {}; + if ( this._configs[ C ] ) { + this.set( C, this._configs[ C ]._initialConfig.value, B ); + return true; + } + return false; + }, + refresh: function( E, C ) { + this._configs = this._configs || {}; + var F = this._configs; + E = ( ( A.isString( E ) ) ? [ E ] : E ) || this.getAttributeKeys(); + for ( var D = 0, B = E.length; D < B; ++D ) { + if ( F.hasOwnProperty( E[ D ] ) ) { + this._configs[ E[ D ] ].refresh( C ); + } + } + }, + register: function( B, C ) { + this.setAttributeConfig( B, C ); + }, + getAttributeConfig: function( C ) { + this._configs = this._configs || {}; + var B = this._configs[ C ] || {}; + var D = {}; + for ( C in B ) { + if ( A.hasOwnProperty( B, C ) ) { + D[ C ] = B[ C ]; + } + } + return D; + }, + setAttributeConfig: function( B, C, D ) { + this._configs = this._configs || {}; + C = C || {}; + if ( !this._configs[ B ] ) { + C.name = B; + this._configs[ B ] = this.createAttribute( C ); + } else { + this._configs[ B ].configure( C, D ); + } + }, + configureAttribute: function( B, C, D ) { + this.setAttributeConfig( B, C, D ); + }, + resetAttributeConfig: function( B ) { + this._configs = this._configs || {}; + this._configs[ B ].resetConfig(); + }, + subscribe: function( B, C ) { + this._events = this._events || {}; + if ( !( B in this._events ) ) { + this._events[ B ] = this.createEvent( B ); + } + YAHOO.util.EventProvider.prototype.subscribe.apply( this, arguments ); + }, + on: function() { + this.subscribe.apply( this, arguments ); + }, + addListener: function() { + this.subscribe.apply( this, arguments ); + }, + fireBeforeChangeEvent: function( C ) { + var B = "before"; B += C.type.charAt( 0 ).toUpperCase() + C.type.substr( 1 ) + "Change"; + C.type = B; + return this.fireEvent( C.type, C ); + }, + fireChangeEvent: function( B ) { + B.type += "Change"; return this.fireEvent( B.type, B ); + }, + createAttribute: function( B ) { + return new YAHOO.util.Attribute( B, this ); + } }; YAHOO.augment( YAHOO.util.AttributeProvider, YAHOO.util.EventProvider ); +})(); +(function() { + var B = YAHOO.util.Dom, + C = YAHOO.util.AttributeProvider; + var A = function( D, E ) { + this.init.apply( this, arguments ); + }; + A.DOM_EVENTS = { "click": true, "dblclick": true, "keydown": true, "keypress": true, "keyup": true, "mousedown": true, "mousemove": true, "mouseout": true, "mouseover": true, "mouseup": true, "focus": true, "blur": true, "submit": true, "change": true }; A.prototype = { + DOM_EVENTS: null, DEFAULT_HTML_SETTER: function( F, D ) { + var E = this.get( "element" ); + if ( E ) { + E[ D ] = F; + } + }, + DEFAULT_HTML_GETTER: function( D ) { + var E = this.get( "element" ), + F; + if ( E ) { + F = E[ D ]; + } + return F; + }, + appendChild: function( D ) { + D = D.get ? D.get( "element" ) : D; + return this.get( "element" ).appendChild( D ); + }, + getElementsByTagName: function( D ) { + return this.get( "element" ).getElementsByTagName( D ); + }, + hasChildNodes: function() { + return this.get( "element" ).hasChildNodes(); + }, + insertBefore: function( D, E ) { + D = D.get ? D.get( "element" ) : D; + E = ( E && E.get ) ? E.get( "element" ) : E; + return this.get( "element" ).insertBefore( D, E ); + }, + removeChild: function( D ) { + D = D.get ? D.get( "element" ) : D; + return this.get( "element" ).removeChild( D ); + }, + replaceChild: function( D, E ) { + D = D.get ? D.get( "element" ) : D; + E = E.get ? E.get( "element" ) : E; + return this.get( "element" ).replaceChild( D, E ); + }, + initAttributes: function( D ) {}, + addListener: function( H, G, I, F ) { + var E = this.get( "element" ) || this.get( "id" ); + F = F || this; + var D = this; + if ( !this._events[ H ] ) { + if ( E && this.DOM_EVENTS[ H ] ) { + YAHOO.util.Event.addListener( E, H, function( J ) { + if ( J.srcElement && !J.target ) { + J.target = J.srcElement; + } + D.fireEvent( H, J ); + }, I, F ); + } + this.createEvent( H, this ); + } + return YAHOO.util.EventProvider.prototype.subscribe.apply( this, arguments ); + }, + on: function() { + return this.addListener.apply( this, arguments ); + }, + subscribe: function() { + return this.addListener.apply( this, arguments ); + }, + removeListener: function( E, D ) { + return this.unsubscribe.apply( this, arguments ); + }, + addClass: function( D ) { + B.addClass( this.get( "element" ), D ); + }, + getElementsByClassName: function( E, D ) { + return B.getElementsByClassName( E, D, this.get( "element" ) ); + }, + hasClass: function( D ) { + return B.hasClass( this.get( "element" ), D ); + }, + removeClass: function( D ) { + return B.removeClass( this.get( "element" ), D ); + }, + replaceClass: function( E, D ) { + return B.replaceClass( this.get( "element" ), E, D ); + }, + setStyle: function( E, D ) { + return B.setStyle( this.get( "element" ), E, D ); + }, + getStyle: function( D ) { + return B.getStyle( this.get( "element" ), D ); + }, + fireQueue: function() { + var E = this._queue; for ( var F = 0, D = E.length; F < D; ++F ) { + this[ E[ F ][ 0 ] ].apply( this, E[ F ][ 1 ] ); + } + }, + appendTo: function( E, F ) { + E = ( E.get ) ? E.get( "element" ) : B.get( E ); + this.fireEvent( "beforeAppendTo", { type: "beforeAppendTo", target: E } ); + F = ( F && F.get ) ? F.get( "element" ) : B.get( F ); + var D = this.get( "element" ); + if ( !D ) { + return false; + } + if ( !E ) { + return false; + } + if ( D.parent != E ) { + if ( F ) { + E.insertBefore( D, F ); + } else { + E.appendChild( D ); + } + } + this.fireEvent( "appendTo", { type: "appendTo", target: E } ); + return D; + }, + get: function( D ) { + var F = this._configs || {}, + E = F.element; + if ( E && !F[ D ] && !YAHOO.lang.isUndefined( E.value[ D ] ) ) { + this._setHTMLAttrConfig( D ); + } + return C.prototype.get.call( this, D ); + }, + setAttributes: function( J, G ) { + var E = {}, + H = this._configOrder; + for ( var I = 0, D = H.length; I < D; ++I ) { + if ( J[ H[ I ] ] !== undefined ) { + E[ H[ I ] ] = true; + this.set( H[ I ], J[ H[ I ] ], G ); + } + } + for ( var F in J ) { + if ( J.hasOwnProperty( F ) && !E[ F ] ) { + this.set( F, J[ F ], G ); + } + } + }, + set: function( E, G, D ) { + var F = this.get( "element" ); + if ( !F ) { + this._queue[ this._queue.length ] = [ "set", arguments ]; + if ( this._configs[ E ] ) { + this._configs[ E ].value = G; + } + return; + } + if ( !this._configs[ E ] && !YAHOO.lang.isUndefined( F[ E ] ) ) { + this._setHTMLAttrConfig( E ); + } + return C.prototype.set.apply( this, arguments ); + }, + setAttributeConfig: function( D, E, F ) { + this._configOrder.push( D ); + C.prototype.setAttributeConfig.apply( this, arguments ); + }, + createEvent: function( E, D ) { + this._events[ E ] = true; + return C.prototype.createEvent.apply( this, arguments ); + }, + init: function( E, D ) { + this._initElement( E, D ); + }, + destroy: function() { + var D = this.get( "element" ); + YAHOO.util.Event.purgeElement( D, true ); + this.unsubscribeAll(); + if ( D && D.parentNode ) { + D.parentNode.removeChild( D ); + } + this._queue = []; + this._events = {}; + this._configs = {}; + this._configOrder = []; + }, + _initElement: function( F, E ) { + this._queue = this._queue || []; + this._events = this._events || {}; + this._configs = this._configs || {}; + this._configOrder = []; + E = E || {}; + E.element = E.element || F || null; + var H = false; + var D = A.DOM_EVENTS; + this.DOM_EVENTS = this.DOM_EVENTS || {}; + for ( var G in D ) { + if ( D.hasOwnProperty( G ) ) { + this.DOM_EVENTS[ G ] = D[ G ]; + } + } + if ( typeof E.element === "string" ) { + this._setHTMLAttrConfig( "id", { value: E.element } ); + } + if ( B.get( E.element ) ) { + H = true; + this._initHTMLElement( E ); + this._initContent( E ); + } + YAHOO.util.Event.onAvailable( E.element, function() { + if ( !H ) { + this._initHTMLElement( E ); + } + this.fireEvent( "available", { type: "available", target: B.get( E.element ) } ); + }, this, true ); + YAHOO.util.Event.onContentReady( E.element, function() { + if ( !H ) { + this._initContent( E ); + } + this.fireEvent( "contentReady", { type: "contentReady", target: B.get( E.element ) } ); + }, this, true ); + }, + _initHTMLElement: function( D ) { + this.setAttributeConfig( "element", { value: B.get( D.element ), readOnly: true } ); + }, + _initContent: function( D ) { + this.initAttributes( D ); + this.setAttributes( D, true ); + this.fireQueue(); + }, + _setHTMLAttrConfig: function( D, F ) { + var E = this.get( "element" ); + F = F || {}; + F.name = D; + F.setter = F.setter || this.DEFAULT_HTML_SETTER; + F.getter = F.getter || this.DEFAULT_HTML_GETTER; + F.value = F.value || E[ D ]; + this._configs[ D ] = new YAHOO.util.Attribute( F, this ); + } }; YAHOO.augment( A, C ); + YAHOO.util.Element = A; +})(); +YAHOO.register( "element", YAHOO.util.Element, { version: "2.7.0", build: "1796" } ); +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +YAHOO.util.Color = function() { + var A = "0", + B = YAHOO.lang.isArray, + C = YAHOO.lang.isNumber; + return { + real2dec: function( D ) { + return Math.min( 255, Math.round( D * 256 ) ); + }, + hsv2rgb: function( H, O, M ) { + if ( B( H ) ) { + return this.hsv2rgb.call( this, H[ 0 ], H[ 1 ], H[ 2 ] ); + } + var D, I, L, + G = Math.floor( ( H / 60 ) % 6 ), + J = ( H / 60 ) - G, + F = M * ( 1 - O ), + E = M * ( 1 - J * O ), + N = M * ( 1 - ( 1 - J ) * O ), + K; + switch ( G ) { + case 0: + D = M; + I = N; + L = F; + break;case 1: + D = E; + I = M; + L = F; + break;case 2: + D = F; + I = M; + L = N; + break;case 3: + D = F; + I = E; + L = M; + break;case 4: + D = N; + I = F; + L = M; + break;case 5: + D = M; + I = F; + L = E; + break; + } + K = this.real2dec; + return [ K( D ), K( I ), K( L ) ]; + }, + rgb2hsv: function( D, H, I ) { + if ( B( D ) ) { + return this.rgb2hsv.apply( this, D ); + } + D /= 255; + H /= 255; + I /= 255; + var G, L, + E = Math.min( Math.min( D, H ), I ), + J = Math.max( Math.max( D, H ), I ), + K = J - E, + F; + switch ( J ) { + case E: + G = 0; + break;case D: + G = 60 * ( H - I ) / K; + if ( H < I ) { + G += 360; + } + break;case H: + G = ( 60 * ( I - D ) / K ) + 120; + break;case I: + G = ( 60 * ( D - H ) / K ) + 240; + break; + } + L = ( J === 0 ) ? 0 : 1 - ( E / J ); + F = [ Math.round( G ), L, J ]; + return F; + }, + rgb2hex: function( F, E, D ) { + if ( B( F ) ) { + return this.rgb2hex.apply( this, F ); + } + var G = this.dec2hex; + return G( F ) + G( E ) + G( D ); + }, + dec2hex: function( D ) { + D = parseInt( D, 10 ) | 0; + D = ( D > 255 || D < 0 ) ? 0 : D; + return ( A + D.toString( 16 ) ).slice( -2 ).toUpperCase(); + }, + hex2dec: function( D ) { + return parseInt( D, 16 ); + }, + hex2rgb: function( D ) { + var E = this.hex2dec; return [ E( D.slice( 0, 2 ) ), E( D.slice( 2, 4 ) ), E( D.slice( 4, 6 ) ) ]; + }, + websafe: function( F, E, D ) { + if ( B( F ) ) { + return this.websafe.apply( this, F ); + } + var G = function( H ) { + if ( C( H ) ) { + H = Math.min( Math.max( 0, H ), 255 ); + var I, J; + for ( I = 0; I < 256; I = I + 51 ) { + J = I + 51; + if ( H >= I && H <= J ) { + return ( H - I > 25 ) ? J : I; + } + } + } + return H; + }; + return [ G( F ), G( E ), G( D ) ]; + } }; +}(); +(function() { + var J = 0, + F = YAHOO.util, + C = YAHOO.lang, + D = YAHOO.widget.Slider, + B = F.Color, + E = F.Dom, + I = F.Event, + A = C.substitute, + H = "yui-picker"; + + function G( L, K ) { + J = J + 1; + K = K || {}; + if ( arguments.length === 1 && !YAHOO.lang.isString( L ) && !L.nodeName ) { + K = L; + L = K.element || null; + } + if ( !L && !K.element ) { + L = this._createHostElement( K ); + } + G.superclass.constructor.call( this, L, K ); + this.initPicker(); + } + YAHOO.extend( G, YAHOO.util.Element, { + ID: { R: H + "-r", R_HEX: H + "-rhex", G: H + "-g", G_HEX: H + "-ghex", B: H + "-b", B_HEX: H + "-bhex", H: H + "-h", S: H + "-s", V: H + "-v", PICKER_BG: H + "-bg", PICKER_THUMB: H + "-thumb", HUE_BG: H + "-hue-bg", HUE_THUMB: H + "-hue-thumb", HEX: H + "-hex", SWATCH: H + "-swatch", WEBSAFE_SWATCH: H + "-websafe-swatch", CONTROLS: H + "-controls", RGB_CONTROLS: H + "-rgb-controls", HSV_CONTROLS: H + "-hsv-controls", HEX_CONTROLS: H + "-hex-controls", HEX_SUMMARY: H + "-hex-summary", CONTROLS_LABEL: H + "-controls-label" }, + TXT: { ILLEGAL_HEX: "Illegal hex value entered", SHOW_CONTROLS: "Show color details", HIDE_CONTROLS: "Hide color details", CURRENT_COLOR: "Currently selected color: {rgb}", CLOSEST_WEBSAFE: "Closest websafe color: {rgb}. Click to select.", R: "R", G: "G", B: "B", H: "H", S: "S", V: "V", HEX: "#", DEG: "\u00B0", PERCENT: "%" }, + IMAGE: { PICKER_THUMB: "../../build/colorpicker/assets/picker_thumb.png", HUE_THUMB: "../../build/colorpicker/assets/hue_thumb.png" }, + DEFAULT: { PICKER_SIZE: 180 }, + OPT: { HUE: "hue", SATURATION: "saturation", VALUE: "value", RED: "red", GREEN: "green", BLUE: "blue", HSV: "hsv", RGB: "rgb", WEBSAFE: "websafe", HEX: "hex", PICKER_SIZE: "pickersize", SHOW_CONTROLS: "showcontrols", SHOW_RGB_CONTROLS: "showrgbcontrols", SHOW_HSV_CONTROLS: "showhsvcontrols", SHOW_HEX_CONTROLS: "showhexcontrols", SHOW_HEX_SUMMARY: "showhexsummary", SHOW_WEBSAFE: "showwebsafe", CONTAINER: "container", IDS: "ids", ELEMENTS: "elements", TXT: "txt", IMAGES: "images", ANIMATE: "animate" }, + skipAnim: true, _createHostElement: function() { + var K = document.createElement( "div" ); + if ( this.CSS.BASE ) { + K.className = this.CSS.BASE; + } + return K; + }, + _updateHueSlider: function() { + var K = this.get( this.OPT.PICKER_SIZE ), + L = this.get( this.OPT.HUE ); + L = K - Math.round( L / 360 * K ); + if ( L === K ) { + L = 0; + } + this.hueSlider.setValue( L, this.skipAnim ); + }, + _updatePickerSlider: function() { + var L = this.get( this.OPT.PICKER_SIZE ), + M = this.get( this.OPT.SATURATION ), + K = this.get( this.OPT.VALUE ); + M = Math.round( M * L / 100 ); + K = Math.round( L - ( K * L / 100 ) ); + this.pickerSlider.setRegionValue( M, K, this.skipAnim ); + }, + _updateSliders: function() { + this._updateHueSlider(); + this._updatePickerSlider(); + }, + setValue: function( L, K ) { + K = ( K ) || false; + this.set( this.OPT.RGB, L, K ); + this._updateSliders(); + }, + hueSlider: null, pickerSlider: null, _getH: function() { + var K = this.get( this.OPT.PICKER_SIZE ), + L = ( K - this.hueSlider.getValue() ) / K; + L = Math.round( L * 360 ); + return ( L === 360 ) ? 0 : L; + }, + _getS: function() { + return this.pickerSlider.getXValue() / this.get( this.OPT.PICKER_SIZE ); + }, + _getV: function() { + var K = this.get( this.OPT.PICKER_SIZE ); + return ( K - this.pickerSlider.getYValue() ) / K; + }, + _updateSwatch: function() { + var M = this.get( this.OPT.RGB ), + O = this.get( this.OPT.WEBSAFE ), + N = this.getElement( this.ID.SWATCH ), + L = M.join( "," ), + K = this.get( this.OPT.TXT ); + E.setStyle( N, "background-color", "rgb(" + L + ")" ); + N.title = A( K.CURRENT_COLOR, { "rgb": "#" + this.get( this.OPT.HEX ) } ); + N = this.getElement( this.ID.WEBSAFE_SWATCH ); + L = O.join( "," ); + E.setStyle( N, "background-color", "rgb(" + L + ")" ); + N.title = A( K.CLOSEST_WEBSAFE, { "rgb": "#" + B.rgb2hex( O ) } ); + }, + _getValuesFromSliders: function() { + this.set( this.OPT.RGB, B.hsv2rgb( this._getH(), this._getS(), this._getV() ) ); + }, + _updateFormFields: function() { + this.getElement( this.ID.H ).value = this.get( this.OPT.HUE ); + this.getElement( this.ID.S ).value = this.get( this.OPT.SATURATION ); + this.getElement( this.ID.V ).value = this.get( this.OPT.VALUE ); + this.getElement( this.ID.R ).value = this.get( this.OPT.RED ); + this.getElement( this.ID.R_HEX ).innerHTML = B.dec2hex( this.get( this.OPT.RED ) ); + this.getElement( this.ID.G ).value = this.get( this.OPT.GREEN ); + this.getElement( this.ID.G_HEX ).innerHTML = B.dec2hex( this.get( this.OPT.GREEN ) ); + this.getElement( this.ID.B ).value = this.get( this.OPT.BLUE ); + this.getElement( this.ID.B_HEX ).innerHTML = B.dec2hex( this.get( this.OPT.BLUE ) ); + this.getElement( this.ID.HEX ).value = this.get( this.OPT.HEX ); + }, + _onHueSliderChange: function( N ) { + var L = this._getH(), + K = B.hsv2rgb( L, 1, 1 ), + M = "rgb(" + K.join( "," ) + ")"; + this.set( this.OPT.HUE, L, true ); + E.setStyle( this.getElement( this.ID.PICKER_BG ), "background-color", M ); + if ( this.hueSlider.valueChangeSource !== D.SOURCE_SET_VALUE ) { + this._getValuesFromSliders(); + } + this._updateFormFields(); + this._updateSwatch(); + }, + _onPickerSliderChange: function( M ) { + var L = this._getS(), + K = this._getV(); + this.set( this.OPT.SATURATION, Math.round( L * 100 ), true ); + this.set( this.OPT.VALUE, Math.round( K * 100 ), true ); + if ( this.pickerSlider.valueChangeSource !== D.SOURCE_SET_VALUE ) { + this._getValuesFromSliders(); + } + this._updateFormFields(); + this._updateSwatch(); + }, + _getCommand: function( K ) { + var L = I.getCharCode( K ); + if ( L === 38 ) { + return 3; + } else { + if ( L === 13 ) { + return 6; + } else { + if ( L === 40 ) { + return 4; + } else { + if ( L >= 48 && L <= 57 ) { + return 1; + } else { + if ( L >= 97 && L <= 102 ) { + return 2; + } else { + if ( L >= 65 && L <= 70 ) { + return 2; + } else { + if ( "8, 9, 13, 27, 37, 39".indexOf( L ) > -1 || K.ctrlKey || K.metaKey ) { + return 5; + } else { + return 0; + } + } + } + } + } + } + } + }, + _useFieldValue: function( L, K, N ) { + var M = K.value; if ( N !== this.OPT.HEX ) { + M = parseInt( M, 10 ); + } + if ( M !== this.get( N ) ) { + this.set( N, M ); + } + }, + _rgbFieldKeypress: function( M, K, O ) { + var N = this._getCommand( M ), + L = ( M.shiftKey ) ? 10 : 1; + switch ( N ) { + case 6: + this._useFieldValue.apply( this, arguments ); + break;case 3: + this.set( O, Math.min( this.get( O ) + L, 255 ) ); + this._updateFormFields(); + break;case 4: + this.set( O, Math.max( this.get( O ) - L, 0 ) ); + this._updateFormFields(); + break;default: + } + }, + _hexFieldKeypress: function( L, K, N ) { + var M = this._getCommand( L ); + if ( M === 6 ) { + this._useFieldValue.apply( this, arguments ); + } + }, + _hexOnly: function( L, K ) { + var M = this._getCommand( L ); + switch ( M ) { + case 6: + case 5: + case 1: + break;case 2: + if ( K !== true ) { + break; + }default: + I.stopEvent( L ); + return false; + } + }, + _numbersOnly: function( K ) { + return this._hexOnly( K, true ); + }, + getElement: function( K ) { + return this.get( this.OPT.ELEMENTS )[ this.get( this.OPT.IDS )[ K ] ]; + }, + _createElements: function() { + var N, M, P, O, L, + K = this.get( this.OPT.IDS ), + Q = this.get( this.OPT.TXT ), + S = this.get( this.OPT.IMAGES ), + R = function( U, V ) { + var W = document.createElement( U ); + if ( V ) { + C.augmentObject( W, V, true ); + } + return W; + }, + T = function( U, V ) { + var W = C.merge({ autocomplete: "off", value: "0", size: 3, maxlength: 3 }, V ); + W.name = W.id; + return new R( U, W ); + }; + L = this.get( "element" ); + N = new R( "div", { id: K[ this.ID.PICKER_BG ], className: "yui-picker-bg", tabIndex: -1, hideFocus: true } ); + M = new R( "div", { id: K[ this.ID.PICKER_THUMB ], className: "yui-picker-thumb" } ); + P = new R( "img", { src: S.PICKER_THUMB } ); + M.appendChild( P ); + N.appendChild( M ); + L.appendChild( N ); + N = new R( "div", { id: K[ this.ID.HUE_BG ], className: "yui-picker-hue-bg", tabIndex: -1, hideFocus: true } ); + M = new R( "div", { id: K[ this.ID.HUE_THUMB ], className: "yui-picker-hue-thumb" } ); + P = new R( "img", { src: S.HUE_THUMB } ); + M.appendChild( P ); + N.appendChild( M ); + L.appendChild( N ); + N = new R( "div", { id: K[ this.ID.CONTROLS ], className: "yui-picker-controls" } ); + L.appendChild( N ); + L = N; + N = new R( "div", { className: "hd" } ); + M = new R( "a", { id: K[ this.ID.CONTROLS_LABEL ], href: "#" } ); + N.appendChild( M ); + L.appendChild( N ); + N = new R( "div", { className: "bd" } ); + L.appendChild( N ); + L = N; + N = new R( "ul", { id: K[ this.ID.RGB_CONTROLS ], className: "yui-picker-rgb-controls" } ); + M = new R( "li" ); + M.appendChild( document.createTextNode( Q.R + " " ) ); + O = new T( "input", { id: K[ this.ID.R ], className: "yui-picker-r" } ); + M.appendChild( O ); + N.appendChild( M ); + M = new R( "li" ); + M.appendChild( document.createTextNode( Q.G + " " ) ); + O = new T( "input", { id: K[ this.ID.G ], className: "yui-picker-g" } ); + M.appendChild( O ); + N.appendChild( M ); + M = new R( "li" ); + M.appendChild( document.createTextNode( Q.B + " " ) ); + O = new T( "input", { id: K[ this.ID.B ], className: "yui-picker-b" } ); + M.appendChild( O ); + N.appendChild( M ); + L.appendChild( N ); + N = new R( "ul", { id: K[ this.ID.HSV_CONTROLS ], className: "yui-picker-hsv-controls" } ); + M = new R( "li" ); + M.appendChild( document.createTextNode( Q.H + " " ) ); + O = new T( "input", { id: K[ this.ID.H ], className: "yui-picker-h" } ); + M.appendChild( O ); + M.appendChild( document.createTextNode( " " + Q.DEG ) ); + N.appendChild( M ); + M = new R( "li" ); + M.appendChild( document.createTextNode( Q.S + " " ) ); + O = new T( "input", { id: K[ this.ID.S ], className: "yui-picker-s" } ); + M.appendChild( O ); + M.appendChild( document.createTextNode( " " + Q.PERCENT ) ); + N.appendChild( M ); + M = new R( "li" ); + M.appendChild( document.createTextNode( Q.V + " " ) ); + O = new T( "input", { id: K[ this.ID.V ], className: "yui-picker-v" } ); + M.appendChild( O ); + M.appendChild( document.createTextNode( " " + Q.PERCENT ) ); + N.appendChild( M ); + L.appendChild( N ); + N = new R( "ul", { id: K[ this.ID.HEX_SUMMARY ], className: "yui-picker-hex_summary" } ); + M = new R( "li", { id: K[ this.ID.R_HEX ] } ); + N.appendChild( M ); + M = new R( "li", { id: K[ this.ID.G_HEX ] } ); + N.appendChild( M ); + M = new R( "li", { id: K[ this.ID.B_HEX ] } ); + N.appendChild( M ); + L.appendChild( N ); + N = new R( "div", { id: K[ this.ID.HEX_CONTROLS ], className: "yui-picker-hex-controls" } ); + N.appendChild( document.createTextNode( Q.HEX + " " ) ); + M = new T( "input", { id: K[ this.ID.HEX ], className: "yui-picker-hex", size: 6, maxlength: 6 } ); + N.appendChild( M ); + L.appendChild( N ); + L = this.get( "element" ); + N = new R( "div", { id: K[ this.ID.SWATCH ], className: "yui-picker-swatch" } ); + L.appendChild( N ); + N = new R( "div", { id: K[ this.ID.WEBSAFE_SWATCH ], className: "yui-picker-websafe-swatch" } ); + L.appendChild( N ); + }, + _attachRGBHSV: function( L, K ) { + I.on( this.getElement( L ), "keydown", function( N, M ) { + M._rgbFieldKeypress( N, this, K ); + }, this ); + I.on( this.getElement( L ), "keypress", this._numbersOnly, this, true ); + I.on( this.getElement( L ), "blur", function( N, M ) { + M._useFieldValue( N, this, K ); + }, this ); + }, + _updateRGB: function() { + var K = [ this.get( this.OPT.RED ), this.get( this.OPT.GREEN ), this.get( this.OPT.BLUE ) ]; + this.set( this.OPT.RGB, K ); + this._updateSliders(); + }, + _initElements: function() { + var O = this.OPT, + N = this.get( O.IDS ), + L = this.get( O.ELEMENTS ), + K, M, P; + for ( K in this.ID ) { + if ( C.hasOwnProperty( this.ID, K ) ) { + N[ this.ID[ K ] ] = N[ K ]; + } + } + M = E.get( N[ this.ID.PICKER_BG ] ); + if ( !M ) { + this._createElements(); + } else {} + for ( K in N ) { + if ( C.hasOwnProperty( N, K ) ) { + M = E.get( N[ K ] ); + P = E.generateId( M ); + N[ K ] = P; + N[ N[ K ] ] = P; + L[ P ] = M; + } + } + }, + initPicker: function() { + this._initSliders(); + this._bindUI(); + this.syncUI( true ); + }, + _initSliders: function() { + var K = this.ID, + L = this.get( this.OPT.PICKER_SIZE ); + this.hueSlider = D.getVertSlider( this.getElement( K.HUE_BG ), this.getElement( K.HUE_THUMB ), 0, L ); + this.pickerSlider = D.getSliderRegion( this.getElement( K.PICKER_BG ), this.getElement( K.PICKER_THUMB ), 0, L, 0, L ); + this.set( this.OPT.ANIMATE, this.get( this.OPT.ANIMATE ) ); + }, + _bindUI: function() { + var K = this.ID, + L = this.OPT; this.hueSlider.subscribe( "change", this._onHueSliderChange, this, true ); + this.pickerSlider.subscribe( "change", this._onPickerSliderChange, this, true ); + I.on( this.getElement( K.WEBSAFE_SWATCH ), "click", function( M ) { + this.setValue( this.get( L.WEBSAFE ) ); + }, this, true ); + I.on( this.getElement( K.CONTROLS_LABEL ), "click", function( M ) { + this.set( L.SHOW_CONTROLS, !this.get( L.SHOW_CONTROLS ) ); + I.preventDefault( M ); + }, this, true ); + this._attachRGBHSV( K.R, L.RED ); + this._attachRGBHSV( K.G, L.GREEN ); + this._attachRGBHSV( K.B, L.BLUE ); + this._attachRGBHSV( K.H, L.HUE ); + this._attachRGBHSV( K.S, L.SATURATION ); + this._attachRGBHSV( K.V, L.VALUE ); + I.on( this.getElement( K.HEX ), "keydown", function( N, M ) { + M._hexFieldKeypress( N, this, L.HEX ); + }, this ); + I.on( this.getElement( this.ID.HEX ), "keypress", this._hexOnly, this, true ); + I.on( this.getElement( this.ID.HEX ), "blur", function( N, M ) { + M._useFieldValue( N, this, L.HEX ); + }, this ); + }, + syncUI: function( K ) { + this.skipAnim = K; this._updateRGB(); + this.skipAnim = false; + }, + _updateRGBFromHSV: function() { + var L = [ this.get( this.OPT.HUE ), this.get( this.OPT.SATURATION ) / 100, this.get( this.OPT.VALUE ) / 100 ], + K = B.hsv2rgb( L ); + this.set( this.OPT.RGB, K ); + this._updateSliders(); + }, + _updateHex: function() { + var N = this.get( this.OPT.HEX ), + K = N.length, + O, M, L; + if ( K === 3 ) { + O = N.split( "" ); + for ( M = 0; M < K; M = M + 1 ) { + O[ M ] = O[ M ] + O[ M ]; + } + N = O.join( "" ); + } + if ( N.length !== 6 ) { + return false; + } + L = B.hex2rgb( N ); + this.setValue( L ); + }, + _hideShowEl: function( M, K ) { + var L = ( C.isString( M ) ? this.getElement( M ) : M ); + E.setStyle( L, "display", ( K ) ? "" : "none" ); + }, + initAttributes: function( K ) { + K = K || {}; + G.superclass.initAttributes.call( this, K ); + this.setAttributeConfig( this.OPT.PICKER_SIZE, { value: K.size || this.DEFAULT.PICKER_SIZE } ); + this.setAttributeConfig( this.OPT.HUE, { value: K.hue || 0, validator: C.isNumber } ); + this.setAttributeConfig( this.OPT.SATURATION, { value: K.saturation || 0, validator: C.isNumber } ); + this.setAttributeConfig( this.OPT.VALUE, { value: C.isNumber( K.value ) ? K.value : 100, validator: C.isNumber } ); + this.setAttributeConfig( this.OPT.RED, { value: C.isNumber( K.red ) ? K.red : 255, validator: C.isNumber } ); + this.setAttributeConfig( this.OPT.GREEN, { value: C.isNumber( K.green ) ? K.green : 255, validator: C.isNumber } ); + this.setAttributeConfig( this.OPT.BLUE, { value: C.isNumber( K.blue ) ? K.blue : 255, validator: C.isNumber } ); + this.setAttributeConfig( this.OPT.HEX, { value: K.hex || "FFFFFF", validator: C.isString } ); + this.setAttributeConfig( this.OPT.RGB, { + value: K.rgb || [ 255, 255, 255 ], method: function( O ) { + this.set( this.OPT.RED, O[ 0 ], true ); + this.set( this.OPT.GREEN, O[ 1 ], true ); + this.set( this.OPT.BLUE, O[ 2 ], true ); + var Q = B.websafe( O ), + P = B.rgb2hex( O ), + N = B.rgb2hsv( O ); + this.set( this.OPT.WEBSAFE, Q, true ); + this.set( this.OPT.HEX, P, true ); + if ( N[ 1 ] ) { + this.set( this.OPT.HUE, N[ 0 ], true ); + } + this.set( this.OPT.SATURATION, Math.round( N[ 1 ] * 100 ), true ); + this.set( this.OPT.VALUE, Math.round( N[ 2 ] * 100 ), true ); + }, + readonly: true } ); + this.setAttributeConfig( this.OPT.CONTAINER, { + value: null, method: function( N ) { + if ( N ) { + N.showEvent.subscribe( function() { + this.pickerSlider.focus(); + }, this, true ); + } + } } ); + this.setAttributeConfig( this.OPT.WEBSAFE, { value: K.websafe || [ 255, 255, 255 ] } ); + var M = K.ids || C.merge( {}, this.ID ), + L; + if ( !K.ids && J > 1 ) { + for ( L in M ) { + if ( C.hasOwnProperty( M, L ) ) { + M[ L ] = M[ L ] + J; + } + } + } + this.setAttributeConfig( this.OPT.IDS, { value: M, writeonce: true } ); + this.setAttributeConfig( this.OPT.TXT, { value: K.txt || this.TXT, writeonce: true } ); + this.setAttributeConfig( this.OPT.IMAGES, { value: K.images || this.IMAGE, writeonce: true } ); + this.setAttributeConfig( this.OPT.ELEMENTS, { + value: {}, + readonly: true } ); + this.setAttributeConfig( this.OPT.SHOW_CONTROLS, { + value: C.isBoolean( K.showcontrols ) ? K.showcontrols : true, method: function( N ) { + var O = E.getElementsByClassName( "bd", "div", this.getElement( this.ID.CONTROLS ) )[ 0 ]; + this._hideShowEl( O, N ); + this.getElement( this.ID.CONTROLS_LABEL ).innerHTML = ( N ) ? this.get( this.OPT.TXT ).HIDE_CONTROLS : this.get( this.OPT.TXT ).SHOW_CONTROLS; + } } ); + this.setAttributeConfig( this.OPT.SHOW_RGB_CONTROLS, { + value: C.isBoolean( K.showrgbcontrols ) ? K.showrgbcontrols : true, method: function( N ) { + this._hideShowEl( this.ID.RGB_CONTROLS, N ); + } } ); + this.setAttributeConfig( this.OPT.SHOW_HSV_CONTROLS, { + value: C.isBoolean( K.showhsvcontrols ) ? K.showhsvcontrols : false, method: function( N ) { + this._hideShowEl( this.ID.HSV_CONTROLS, N ); + if ( N && this.get( this.OPT.SHOW_HEX_SUMMARY ) ) { + this.set( this.OPT.SHOW_HEX_SUMMARY, false ); + } + } } ); + this.setAttributeConfig( this.OPT.SHOW_HEX_CONTROLS, { + value: C.isBoolean( K.showhexcontrols ) ? K.showhexcontrols : false, method: function( N ) { + this._hideShowEl( this.ID.HEX_CONTROLS, N ); + } } ); + this.setAttributeConfig( this.OPT.SHOW_WEBSAFE, { + value: C.isBoolean( K.showwebsafe ) ? K.showwebsafe : true, method: function( N ) { + this._hideShowEl( this.ID.WEBSAFE_SWATCH, N ); + } } ); + this.setAttributeConfig( this.OPT.SHOW_HEX_SUMMARY, { + value: C.isBoolean( K.showhexsummary ) ? K.showhexsummary : true, method: function( N ) { + this._hideShowEl( this.ID.HEX_SUMMARY, N ); + if ( N && this.get( this.OPT.SHOW_HSV_CONTROLS ) ) { + this.set( this.OPT.SHOW_HSV_CONTROLS, false ); + } + } } ); + this.setAttributeConfig( this.OPT.ANIMATE, { + value: C.isBoolean( K.animate ) ? K.animate : true, method: function( N ) { + if ( this.pickerSlider ) { + this.pickerSlider.animate = N; + this.hueSlider.animate = N; + } + } } ); + this.on( this.OPT.HUE + "Change", this._updateRGBFromHSV, this, true ); + this.on( this.OPT.SATURATION + "Change", this._updateRGBFromHSV, this, true ); + this.on( this.OPT.VALUE + "Change", this._updateRGBFromHSV, this, true ); + this.on( this.OPT.RED + "Change", this._updateRGB, this, true ); + this.on( this.OPT.GREEN + "Change", this._updateRGB, this, true ); + this.on( this.OPT.BLUE + "Change", this._updateRGB, this, true ); + this.on( this.OPT.HEX + "Change", this._updateHex, this, true ); + this._initElements(); + } } ); + YAHOO.widget.ColorPicker = G; +})(); +YAHOO.register( "colorpicker", YAHOO.widget.ColorPicker, { version: "2.7.0", build: "1796" } ); + +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ ( function() { + var B = YAHOO.util; + var A = function( D, C, E, F ) { + if ( !D ) {} + this.init( D, C, E, F ); + }; + A.NAME = "Anim"; + A.prototype = { + toString: function() { + var C = this.getEl() || {}; + var D = C.id || C.tagName; + return ( this.constructor.NAME + ": " + D ); + }, + patterns: { noNegatives: /width|height|opacity|padding/i, offsetAttribute: /^((width|height)|(top|left))$/, defaultUnit: /width|height|top$|bottom$|left$|right$/i, offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i }, + doMethod: function( C, E, D ) { + return this.method( this.currentFrame, E, D - E, this.totalFrames ); + }, + setAttribute: function( C, F, E ) { + var D = this.getEl(); + if ( this.patterns.noNegatives.test( C ) ) { + F = ( F > 0 ) ? F : 0; + } + if ( "style" in D ) { + B.Dom.setStyle( D, C, F + E ); + } else { + if ( C in D ) { + D[ C ] = F; + } + } + }, + getAttribute: function( C ) { + var E = this.getEl(); + var G = B.Dom.getStyle( E, C ); + if ( G !== "auto" && !this.patterns.offsetUnit.test( G ) ) { + return parseFloat( G ); + } + var D = this.patterns.offsetAttribute.exec( C ) || []; + var H = !!( D[ 3 ] ); + var F = !!( D[ 2 ] ); + if ( "style" in E ) { + if ( F || ( B.Dom.getStyle( E, "position" ) == "absolute" && H ) ) { + G = E[ "offset" + D[ 0 ].charAt( 0 ).toUpperCase() + D[ 0 ].substr( 1 ) ]; + } else { + G = 0; + } + } else { + if ( C in E ) { + G = E[ C ]; + } + } + return G; + }, + getDefaultUnit: function( C ) { + if ( this.patterns.defaultUnit.test( C ) ) { + return "px"; + } + return ""; + }, + setRuntimeAttribute: function( D ) { + var I; var E; var F = this.attributes; this.runtimeAttributes[ D ] = {}; + var H = function( J ) { + return ( typeof J !== "undefined" ); + }; + if ( !H( F[ D ][ "to" ] ) && !H( F[ D ][ "by" ] ) ) { + return false; + } + I = ( H( F[ D ][ "from" ] ) ) ? F[ D ][ "from" ] : this.getAttribute( D ); + if ( H( F[ D ][ "to" ] ) ) { + E = F[ D ][ "to" ]; + } else { + if ( H( F[ D ][ "by" ] ) ) { + if ( I.constructor == Array ) { + E = []; + for ( var G = 0, C = I.length; G < C; ++G ) { + E[ G ] = I[ G ] + F[ D ][ "by" ][ G ] * 1; + } + } else { + E = I + F[ D ][ "by" ] * 1; + } + } + } + this.runtimeAttributes[ D ].start = I; + this.runtimeAttributes[ D ].end = E; + this.runtimeAttributes[ D ].unit = ( H( F[ D ].unit ) ) ? F[ D ][ "unit" ] : this.getDefaultUnit( D ); + return true; + }, + init: function( E, J, I, C ) { + var D = false; var F = null; var H = 0; E = B.Dom.get( E ); + this.attributes = J || {}; + this.duration = !YAHOO.lang.isUndefined( I ) ? I : 1; + this.method = C || B.Easing.easeNone; + this.useSeconds = true; + this.currentFrame = 0; + this.totalFrames = B.AnimMgr.fps; + this.setEl = function( M ) { + E = B.Dom.get( M ); + }; + this.getEl = function() { + return E; + }; + this.isAnimated = function() { + return D; + }; + this.getStartTime = function() { + return F; + }; + this.runtimeAttributes = {}; + this.animate = function() { + if ( this.isAnimated() ) { + return false; + } + this.currentFrame = 0; + this.totalFrames = ( this.useSeconds ) ? Math.ceil( B.AnimMgr.fps * this.duration ) : this.duration; + if ( this.duration === 0 && this.useSeconds ) { + this.totalFrames = 1; + } + B.AnimMgr.registerElement( this ); + return true; + }; + this.stop = function( M ) { + if ( !this.isAnimated() ) { + return false; + } + if ( M ) { + this.currentFrame = this.totalFrames; + this._onTween.fire(); + } + B.AnimMgr.stop( this ); + }; + var L = function() { + this.onStart.fire(); + this.runtimeAttributes = {}; + for ( var M in this.attributes ) { + this.setRuntimeAttribute( M ); + } + D = true; + H = 0; + F = new Date(); + }; + var K = function() { + var O = { duration: new Date() - this.getStartTime(), currentFrame: this.currentFrame }; O.toString = function() { + return ( "duration: " + O.duration + ", currentFrame: " + O.currentFrame ); + }; + this.onTween.fire( O ); + var N = this.runtimeAttributes; + for ( var M in N ) { + this.setAttribute( M, this.doMethod( M, N[ M ].start, N[ M ].end ), N[ M ].unit ); + } + H += 1; + }; + var G = function() { + var M = ( new Date() - F ) / 1000; + var N = { duration: M, frames: H, fps: H / M }; N.toString = function() { + return ( "duration: " + N.duration + ", frames: " + N.frames + ", fps: " + N.fps ); + }; + D = false; + H = 0; + this.onComplete.fire( N ); + }; + this._onStart = new B.CustomEvent( "_start", this, true ); + this.onStart = new B.CustomEvent( "start", this ); + this.onTween = new B.CustomEvent( "tween", this ); + this._onTween = new B.CustomEvent( "_tween", this, true ); + this.onComplete = new B.CustomEvent( "complete", this ); + this._onComplete = new B.CustomEvent( "_complete", this, true ); + this._onStart.subscribe( L ); + this._onTween.subscribe( K ); + this._onComplete.subscribe( G ); + } }; B.Anim = A; +})(); +YAHOO.util.AnimMgr = new function() { + var C = null; + var B = []; + var A = 0; + this.fps = 1000; + this.delay = 1; + this.registerElement = function( F ) { + B[ B.length ] = F; + A += 1; + F._onStart.fire(); + this.start(); + }; + this.unRegister = function( G, F ) { + F = F || E( G ); + if ( !G.isAnimated() || F == -1 ) { + return false; + } + G._onComplete.fire(); + B.splice( F, 1 ); + A -= 1; + if ( A <= 0 ) { + this.stop(); + } + return true; + }; + this.start = function() { + if ( C === null ) { + C = setInterval( this.run, this.delay ); + } + }; + this.stop = function( H ) { + if ( !H ) { + clearInterval( C ); + for ( var G = 0, F = B.length; G < F; ++G ) { + this.unRegister( B[ 0 ], 0 ); + } + B = []; + C = null; + A = 0; + } else { + this.unRegister( H ); + } + }; + this.run = function() { + for ( var H = 0, F = B.length; H < F; ++H ) { + var G = B[ H ]; + if ( !G || !G.isAnimated() ) { + continue; + } + if ( G.currentFrame < G.totalFrames || G.totalFrames === null ) { + G.currentFrame += 1; + if ( G.useSeconds ) { + D( G ); + } + G._onTween.fire(); + } else { + YAHOO.util.AnimMgr.stop( G, H ); + } + } + }; + var E = function( H ) { + for ( var G = 0, F = B.length; G < F; ++G ) { + if ( B[ G ] == H ) { + return G; + } + } + return -1; + }; + var D = function( G ) { + var J = G.totalFrames; + var I = G.currentFrame; + var H = ( G.currentFrame * G.duration * 1000 / G.totalFrames ); + var F = ( new Date() - G.getStartTime() ); + var K = 0; + if ( F < G.duration * 1000 ) { + K = Math.round( ( F / H - 1 ) * G.currentFrame ); + } else { + K = J - ( I + 1 ); + } + if ( K > 0 && isFinite( K ) ) { + if ( G.currentFrame + K >= J ) { + K = J - ( I + 1 ); + } + G.currentFrame += K; + } + }; +}; +YAHOO.util.Bezier = new function() { + this.getPosition = function( E, D ) { + var F = E.length; + var C = []; + for ( var B = 0; B < F; ++B ) { + C[ B ] = [ E[ B ][ 0 ], E[ B ][ 1 ] ]; + } + for ( var A = 1; A < F; ++A ) { + for ( B = 0; B < F - A; ++B ) { + C[ B ][ 0 ] = ( 1 - D ) * C[ B ][ 0 ] + D * C[ parseInt( B + 1, 10 ) ][ 0 ]; + C[ B ][ 1 ] = ( 1 - D ) * C[ B ][ 1 ] + D * C[ parseInt( B + 1, 10 ) ][ 1 ]; + } + } + return [ C[ 0 ][ 0 ], C[ 0 ][ 1 ] ]; + }; +}; +(function() { + var A = function( F, E, G, H ) { + A.superclass.constructor.call( this, F, E, G, H ); + }; + A.NAME = "ColorAnim"; + A.DEFAULT_BGCOLOR = "#fff"; + var C = YAHOO.util; + YAHOO.extend( A, C.Anim ); + var D = A.superclass; + var B = A.prototype; + B.patterns.color = /color$/i; + B.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i; + B.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i; + B.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i; + B.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; + B.parseColor = function( E ) { + if ( E.length == 3 ) { + return E; + } + var F = this.patterns.hex.exec( E ); + if ( F && F.length == 4 ) { + return [ parseInt( F[ 1 ], 16 ), parseInt( F[ 2 ], 16 ), parseInt( F[ 3 ], 16 ) ]; + } + F = this.patterns.rgb.exec( E ); + if ( F && F.length == 4 ) { + return [ parseInt( F[ 1 ], 10 ), parseInt( F[ 2 ], 10 ), parseInt( F[ 3 ], 10 ) ]; + } + F = this.patterns.hex3.exec( E ); + if ( F && F.length == 4 ) { + return [ parseInt( F[ 1 ] + F[ 1 ], 16 ), parseInt( F[ 2 ] + F[ 2 ], 16 ), parseInt( F[ 3 ] + F[ 3 ], 16 ) ]; + } + return null; + }; + B.getAttribute = function( E ) { + var G = this.getEl(); + if ( this.patterns.color.test( E ) ) { + var I = YAHOO.util.Dom.getStyle( G, E ); + var H = this; + if ( this.patterns.transparent.test( I ) ) { + var F = YAHOO.util.Dom.getAncestorBy( G, function( J ) { + return !H.patterns.transparent.test( I ); + }); + if ( F ) { + I = C.Dom.getStyle( F, E ); + } else { + I = A.DEFAULT_BGCOLOR; + } + } + } else { + I = D.getAttribute.call( this, E ); + } + return I; + }; + B.doMethod = function( F, J, G ) { + var I; + if ( this.patterns.color.test( F ) ) { + I = []; + for ( var H = 0, E = J.length; H < E; ++H ) { + I[ H ] = D.doMethod.call( this, F, J[ H ], G[ H ] ); + } + I = "rgb(" + Math.floor( I[ 0 ] ) + "," + Math.floor( I[ 1 ] ) + "," + Math.floor( I[ 2 ] ) + ")"; + } else { + I = D.doMethod.call( this, F, J, G ); + } + return I; + }; + B.setRuntimeAttribute = function( F ) { + D.setRuntimeAttribute.call( this, F ); + if ( this.patterns.color.test( F ) ) { + var H = this.attributes; + var J = this.parseColor( this.runtimeAttributes[ F ].start ); + var G = this.parseColor( this.runtimeAttributes[ F ].end ); + if ( typeof H[ F ][ "to" ] === "undefined" && typeof H[ F ][ "by" ] !== "undefined" ) { + G = this.parseColor( H[ F ].by ); + for ( var I = 0, E = J.length; I < E; ++I ) { + G[ I ] = J[ I ] + G[ I ]; + } + } + this.runtimeAttributes[ F ].start = J; + this.runtimeAttributes[ F ].end = G; + } + }; + C.ColorAnim = A; +})(); +/* +TERMS OF USE - EASING EQUATIONS +Open source under the BSD License. +Copyright 2001 Robert Penner All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +YAHOO.util.Easing = { + easeNone: function( B, A, D, C ) { + return D * B / C + A; + }, + easeIn: function( B, A, D, C ) { + return D * ( B /= C ) * B + A; + }, + easeOut: function( B, A, D, C ) { + return -D * ( B /= C ) * ( B - 2 ) + A; + }, + easeBoth: function( B, A, D, C ) { + if ( ( B /= C / 2 ) < 1 ) { + return D / 2 * B * B + A; + } + return -D / 2 * ( ( --B ) * ( B - 2 ) - 1 ) + A; + }, + easeInStrong: function( B, A, D, C ) { + return D * ( B /= C ) * B * B * B + A; + }, + easeOutStrong: function( B, A, D, C ) { + return -D * ( ( B = B / C - 1 ) * B * B * B - 1 ) + A; + }, + easeBothStrong: function( B, A, D, C ) { + if ( ( B /= C / 2 ) < 1 ) { + return D / 2 * B * B * B * B + A; + } + return -D / 2 * ( ( B -= 2 ) * B * B * B - 2 ) + A; + }, + elasticIn: function( C, A, G, F, B, E ) { + if ( C == 0 ) { + return A; + } + if ( ( C /= F ) == 1 ) { + return A + G; + } + if ( !E ) { + E = F * 0.3; + } + if ( !B || B < Math.abs( G ) ) { + B = G; + var D = E / 4; + } else { + var D = E / ( 2 * Math.PI ) * Math.asin( G / B ); + } + return -( B * Math.pow( 2, 10 * ( C -= 1 ) ) * Math.sin( ( C * F - D ) * ( 2 * Math.PI ) / E ) ) + A; + }, + elasticOut: function( C, A, G, F, B, E ) { + if ( C == 0 ) { + return A; + } + if ( ( C /= F ) == 1 ) { + return A + G; + } + if ( !E ) { + E = F * 0.3; + } + if ( !B || B < Math.abs( G ) ) { + B = G; + var D = E / 4; + } else { + var D = E / ( 2 * Math.PI ) * Math.asin( G / B ); + } + return B * Math.pow( 2, -10 * C ) * Math.sin( ( C * F - D ) * ( 2 * Math.PI ) / E ) + G + A; + }, + elasticBoth: function( C, A, G, F, B, E ) { + if ( C == 0 ) { + return A; + } + if ( ( C /= F / 2 ) == 2 ) { + return A + G; + } + if ( !E ) { + E = F * ( 0.3 * 1.5 ); + } + if ( !B || B < Math.abs( G ) ) { + B = G; + var D = E / 4; + } else { + var D = E / ( 2 * Math.PI ) * Math.asin( G / B ); + } + if ( C < 1 ) { + return -0.5 * ( B * Math.pow( 2, 10 * ( C -= 1 ) ) * Math.sin( ( C * F - D ) * ( 2 * Math.PI ) / E ) ) + A; + } + return B * Math.pow( 2, -10 * ( C -= 1 ) ) * Math.sin( ( C * F - D ) * ( 2 * Math.PI ) / E ) * 0.5 + G + A; + }, + backIn: function( B, A, E, D, C ) { + if ( typeof C == "undefined" ) { + C = 1.70158; + } + return E * ( B /= D ) * B * ( ( C + 1 ) * B - C ) + A; + }, + backOut: function( B, A, E, D, C ) { + if ( typeof C == "undefined" ) { + C = 1.70158; + } + return E * ( ( B = B / D - 1 ) * B * ( ( C + 1 ) * B + C ) + 1 ) + A; + }, + backBoth: function( B, A, E, D, C ) { + if ( typeof C == "undefined" ) { + C = 1.70158; + } + if ( ( B /= D / 2 ) < 1 ) { + return E / 2 * ( B * B * ( ( ( C *= ( 1.525 ) ) + 1 ) * B - C ) ) + A; + } + return E / 2 * ( ( B -= 2 ) * B * ( ( ( C *= ( 1.525 ) ) + 1 ) * B + C ) + 2 ) + A; + }, + bounceIn: function( B, A, D, C ) { + return D - YAHOO.util.Easing.bounceOut( C - B, 0, D, C ) + A; + }, + bounceOut: function( B, A, D, C ) { + if ( ( B /= C ) < ( 1 / 2.75 ) ) { + return D * ( 7.5625 * B * B ) + A; + } else { + if ( B < ( 2 / 2.75 ) ) { + return D * ( 7.5625 * ( B -= ( 1.5 / 2.75 ) ) * B + 0.75 ) + A; + } else { + if ( B < ( 2.5 / 2.75 ) ) { + return D * ( 7.5625 * ( B -= ( 2.25 / 2.75 ) ) * B + 0.9375 ) + A; + } + } + } + return D * ( 7.5625 * ( B -= ( 2.625 / 2.75 ) ) * B + 0.984375 ) + A; + }, + bounceBoth: function( B, A, D, C ) { + if ( B < C / 2 ) { + return YAHOO.util.Easing.bounceIn( B * 2, 0, D, C ) * 0.5 + A; + } + return YAHOO.util.Easing.bounceOut( B * 2 - C, 0, D, C ) * 0.5 + D * 0.5 + A; + } }; +(function() { + var A = function( H, G, I, J ) { + if ( H ) { + A.superclass.constructor.call( this, H, G, I, J ); + } + }; + A.NAME = "Motion"; + var E = YAHOO.util; + YAHOO.extend( A, E.ColorAnim ); + var F = A.superclass; + var C = A.prototype; + C.patterns.points = /^points$/i; + C.setAttribute = function( G, I, H ) { + if ( this.patterns.points.test( G ) ) { + H = H || "px"; + F.setAttribute.call( this, "left", I[ 0 ], H ); + F.setAttribute.call( this, "top", I[ 1 ], H ); + } else { + F.setAttribute.call( this, G, I, H ); + } + }; + C.getAttribute = function( G ) { + if ( this.patterns.points.test( G ) ) { + var H = [ F.getAttribute.call( this, "left" ), F.getAttribute.call( this, "top" ) ]; + } else { + H = F.getAttribute.call( this, G ); + } + return H; + }; + C.doMethod = function( G, K, H ) { + var J = null; + if ( this.patterns.points.test( G ) ) { + var I = this.method( this.currentFrame, 0, 100, this.totalFrames ) / 100; + J = E.Bezier.getPosition( this.runtimeAttributes[ G ], I ); + } else { + J = F.doMethod.call( this, G, K, H ); + } + return J; + }; + C.setRuntimeAttribute = function( P ) { + if ( this.patterns.points.test( P ) ) { + var H = this.getEl(); + var J = this.attributes; + var G; + var L = J[ "points" ][ "control" ] || []; + var I; + var M, O; + if ( L.length > 0 && !( L[ 0 ] instanceof Array ) ) { + L = [ L ]; + } else { + var K = []; + for ( M = 0, O = L.length; M < O; ++M ) { + K[ M ] = L[ M ]; + } + L = K; + } + if ( E.Dom.getStyle( H, "position" ) == "static" ) { + E.Dom.setStyle( H, "position", "relative" ); + } + if ( D( J[ "points" ][ "from" ] ) ) { + E.Dom.setXY( H, J[ "points" ][ "from" ] ); + } else { + E.Dom.setXY( H, E.Dom.getXY( H ) ); + } + G = this.getAttribute( "points" ); + if ( D( J[ "points" ][ "to" ] ) ) { + I = B.call( this, J[ "points" ][ "to" ], G ); + var N = E.Dom.getXY( this.getEl() ); + for ( M = 0, O = L.length; M < O; ++M ) { + L[ M ] = B.call( this, L[ M ], G ); + } + } else { + if ( D( J[ "points" ][ "by" ] ) ) { + I = [ G[ 0 ] + J[ "points" ][ "by" ][ 0 ], G[ 1 ] + J[ "points" ][ "by" ][ 1 ] ]; + for ( M = 0, O = L.length; M < O; ++M ) { + L[ M ] = [ G[ 0 ] + L[ M ][ 0 ], G[ 1 ] + L[ M ][ 1 ] ]; + } + } + } + this.runtimeAttributes[ P ] = [ G ]; + if ( L.length > 0 ) { + this.runtimeAttributes[ P ] = this.runtimeAttributes[ P ].concat( L ); + } + this.runtimeAttributes[ P ][ this.runtimeAttributes[ P ].length ] = I; + } else { + F.setRuntimeAttribute.call( this, P ); + } + }; + var B = function( G, I ) { + var H = E.Dom.getXY( this.getEl() ); + G = [ G[ 0 ] - H[ 0 ] + I[ 0 ], G[ 1 ] - H[ 1 ] + I[ 1 ] ]; + return G; + }; + var D = function( G ) { + return ( typeof G !== "undefined" ); + }; + E.Motion = A; +})(); +(function() { + var D = function( F, E, G, H ) { + if ( F ) { + D.superclass.constructor.call( this, F, E, G, H ); + } + }; + D.NAME = "Scroll"; + var B = YAHOO.util; + YAHOO.extend( D, B.ColorAnim ); + var C = D.superclass; + var A = D.prototype; + A.doMethod = function( E, H, F ) { + var G = null; + if ( E == "scroll" ) { + G = [ this.method( this.currentFrame, H[ 0 ], F[ 0 ] - H[ 0 ], this.totalFrames ), this.method( this.currentFrame, H[ 1 ], F[ 1 ] - H[ 1 ], this.totalFrames ) ]; + } else { + G = C.doMethod.call( this, E, H, F ); + } + return G; + }; + A.getAttribute = function( E ) { + var G = null; + var F = this.getEl(); + if ( E == "scroll" ) { + G = [ F.scrollLeft, F.scrollTop ]; + } else { + G = C.getAttribute.call( this, E ); + } + return G; + }; + A.setAttribute = function( E, H, G ) { + var F = this.getEl(); + if ( E == "scroll" ) { + F.scrollLeft = H[ 0 ]; + F.scrollTop = H[ 1 ]; + } else { + C.setAttribute.call( this, E, H, G ); + } + }; + B.Scroll = D; +})(); +YAHOO.register( "animation", YAHOO.util.Anim, { version: "2.7.0", build: "1799" } ); diff --git a/sites/all/modules/ckeditor/plugins/counter/plugin.js b/sites/all/modules/ckeditor/plugins/counter/plugin.js new file mode 100644 index 0000000..28ce728 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/counter/plugin.js @@ -0,0 +1,62 @@ +/** + * @file Plugin to count symbols, symbols without blanks and words + */ +( function(){ + var emptyHtml = ' '; + CKEDITOR.plugins.add( 'counter', + { + init : function( editor ) + { + var spaceId = 'cke_counter_' + editor.name; + var spaceElement; + var ckeditorEventThemeSpace = 'uiSpace'; + var getSpaceElement = function() + { + if ( !spaceElement ) + spaceElement = CKEDITOR.document.getById( spaceId ); + return spaceElement; + }; + + if (Drupal.ckeditor_ver == 3) { + ckeditorEventThemeSpace = 'themeSpace'; + } + + editor.on( ckeditorEventThemeSpace, function( event ) + { + if ( event.data.space == 'bottom' ) + { + event.data.html += + 'Counter' + + '
        ' + emptyHtml + '
        '; + } + }); + + function count( ev ) + { + var space = getSpaceElement(); + var text = ev.editor.getData(); + // decode HTML entities; it also removes HTML tags, but works only if jQuery is available + text = jQuery('
        ').html(text).text(); + // remove all redundant blank symbols + text = text.replace(new RegExp('\\s+', 'g'), ' '); + // remove all blank symbols at the start and at the end + text = text.replace(new RegExp('(^\\s+)|(\\s+$)', 'g'), ''); + var symbols = text.length; + var words = text.split(' ').length; + //remove all blank symbols + text = text.replace(new RegExp('\\s+', 'g'), ''); + var symbols_wo_blanks = text.length; + + space.setHtml( '' + symbols + ' / ' + symbols_wo_blanks + ' symbols; ' + words + ' words' ); + } + + editor.on( 'dataReady', count ); + editor.on( 'blur', count ); + editor.on( 'focus', count ); + // Almost useless + //editor.on( 'saveSnapshot', count ); + // Requires too much resources + //editor.on( 'key', count ); + } + }); +})(); diff --git a/sites/all/modules/ckeditor/plugins/drupalbreaks/images/drupalbreak.png b/sites/all/modules/ckeditor/plugins/drupalbreaks/images/drupalbreak.png new file mode 100644 index 0000000..97dfea4 Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/drupalbreaks/images/drupalbreak.png differ diff --git a/sites/all/modules/ckeditor/plugins/drupalbreaks/images/drupalpagebreak.png b/sites/all/modules/ckeditor/plugins/drupalbreaks/images/drupalpagebreak.png new file mode 100644 index 0000000..ab96d5d Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/drupalbreaks/images/drupalpagebreak.png differ diff --git a/sites/all/modules/ckeditor/plugins/drupalbreaks/images/pagebreak.gif b/sites/all/modules/ckeditor/plugins/drupalbreaks/images/pagebreak.gif new file mode 100644 index 0000000..8d1cffd Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/drupalbreaks/images/pagebreak.gif differ diff --git a/sites/all/modules/ckeditor/plugins/drupalbreaks/plugin.js b/sites/all/modules/ckeditor/plugins/drupalbreaks/plugin.js new file mode 100644 index 0000000..b90728b --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/drupalbreaks/plugin.js @@ -0,0 +1,169 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +/** + * @file Plugin for inserting Drupal teaser and page breaks. + */ +var pluginRequires = [ 'fakeobjects' ]; +if (Drupal.ckeditor_ver == 3) { + pluginRequires = [ 'fakeobjects', 'htmldataprocessor' ]; +} + +CKEDITOR.plugins.add( 'drupalbreaks', +{ + requires : pluginRequires, + + init : function( editor ) + { + var addCssObj = CKEDITOR; + + if (Drupal.ckeditor_ver == 3) { + addCssObj = editor; + } + // Add the styles that renders our fake objects. + addCssObj.addCss( + 'img.cke_drupal_pagebreak,img.cke_drupal_break' + + '{' + + 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/pagebreak.gif' ) + ');' + + 'background-position: center center;' + + 'background-repeat: no-repeat;' + + 'clear: both;' + + 'display: block;' + + 'float: none;' + + 'width: 100%;' + + 'border-top: #999999 1px dotted;' + + 'border-bottom: #999999 1px dotted;' + + 'height: 5px;' + + '}' + + 'img.cke_drupal_break' + + '{' + + 'border-top: #FF0000 1px dotted;' + + 'border-bottom: #FF0000 1px dotted;' + + '}' + ); + + // Register the toolbar buttons. + if ( Drupal.ckeditorTeaserInfo(editor.name) || Drupal.settings.ckeditor.teaser == editor.name ) { + editor.ui.addButton( 'DrupalBreak', + { + label : Drupal.t('Insert Teaser Break'), + icon : this.path + 'images/drupalbreak.png', + command : 'drupalbreak' + }); + + editor.ui.addButton( 'DrupalPageBreak', + { + label : Drupal.t( 'Insert Page Break' ), + icon : this.path + 'images/drupalpagebreak.png', + command : 'drupalpagebreak' + }); + } + + // Register the commands. + + editor.addCommand( 'drupalbreak', + { + exec : function() + { + // There should be only one in document. So, look + // for an image with class "cke_drupal_break" (the fake element). + var images = editor.document.getElementsByTag( 'img' ); + for ( var i = 0, len = images.count() ; i < len ; i++ ) + { + var img = images.getItem( i ); + if ( img.hasClass( 'cke_drupal_break' ) ) + { + if ( confirm( Drupal.t( 'The document already contains a teaser break. Do you want to proceed by removing it first?' ) ) ) + { + img.remove(); + break; + } + else + return; + } + } + + insertComment( 'break' ); + } + } ); + + editor.addCommand( 'drupalpagebreak', + { + exec : function() + { + insertComment( 'pagebreak' ); + } + } ); + + // This function effectively inserts the comment into the editor. + function insertComment( text ) + { + // Create the fake element that will be inserted into the document. + // The trick is declaring it as an
        , so it will behave like a + // block element (and in effect it behaves much like an
        ). + if ( !CKEDITOR.dom.comment.prototype.getAttribute ) { + CKEDITOR.dom.comment.prototype.getAttribute = function() { return ''; }; + CKEDITOR.dom.comment.prototype.attributes = { align : '' }; + } + var fakeElement = editor.createFakeElement( new CKEDITOR.dom.comment( text ), 'cke_drupal_' + text, 'hr' ); + + // This is the trick part. We can't use editor.insertElement() + // because we need to put the comment directly at level. + // We need to do range manipulation for that. + + // Get a DOM range from the current selection. + var range = editor.getSelection().getRanges()[0], + elementsPath = new CKEDITOR.dom.elementPath( range.getCommonAncestor( true ) ), + element = ( elementsPath.block && elementsPath.block.getParent() ) || elementsPath.blockLimit, + hasMoved; + + // If we're not in go moving the position to after the + // elements until reaching it. This may happen when inside tables, + // lists, blockquotes, etc. + while ( element && element.getName() != 'body' ) + { + range.moveToPosition( element, CKEDITOR.POSITION_AFTER_END ); + hasMoved = 1; + element = element.getParent(); + } + + // Split the current block. + if ( !hasMoved ) + range.splitBlock( 'p' ); + + // Insert the fake element into the document. + range.insertNode( fakeElement ); + + // Now, we move the selection to the best possible place following + // our fake element. + var next = fakeElement; + while ( ( next = next.getNext() ) && !range.moveToElementEditStart( next ) ) + {} + + range.select(); + } + }, + + afterInit : function( editor ) + { + // Adds the comment processing rules to the data filter, so comments + // are replaced by fake elements. + editor.dataProcessor.dataFilter.addRules( + { + comment : function( value ) + { + if ( !CKEDITOR.htmlParser.comment.prototype.getAttribute ) { + CKEDITOR.htmlParser.comment.prototype.getAttribute = function() { return ''; }; + CKEDITOR.htmlParser.comment.prototype.attributes = { align : '' }; + } + + if ( value == 'break' || value == 'pagebreak' ) + return editor.createFakeParserElement( new CKEDITOR.htmlParser.comment( value ), 'cke_drupal_' + value, 'hr' ); + + return value; + } + }); + } +}); diff --git a/sites/all/modules/ckeditor/plugins/imce/images/icon.png b/sites/all/modules/ckeditor/plugins/imce/images/icon.png new file mode 100644 index 0000000..ab168a1 Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/imce/images/icon.png differ diff --git a/sites/all/modules/ckeditor/plugins/imce/plugin.js b/sites/all/modules/ckeditor/plugins/imce/plugin.js new file mode 100644 index 0000000..0e56fb0 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/imce/plugin.js @@ -0,0 +1,59 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +/** + * @file Plugin for inserting files from imce without image dialog + */ +( function() { + CKEDITOR.plugins.add( 'imce', + { + init: function( editor ) + { + //adding button + editor.ui.addButton( 'IMCE', + { + label: 'IMCE', + command: 'IMCEWindow', + icon: this.path + 'images/icon.png' + }); + + //opening imce window + editor.addCommand( 'IMCEWindow', { + exec : function () { + var width = editor.config.filebrowserWindowWidth || '80%', + height = editor.config.filebrowserWindowHeight || '70%'; + + editor.popup(Drupal.settings.basePath + 'index.php?q=imce\x26app=ckeditor|sendto@ckeditor_setFile|&CKEditorFuncNum=' + editor._.filebrowserFnIMCE, width, height); + } + }); + + //add editor function + editor._.filebrowserFnIMCE = CKEDITOR.tools.addFunction( setFile, editor ) + + //function which receive imce response + window.ckeditor_setFile = function (file, win) { + var cfunc = win.location.href.split('&'); + + for (var x in cfunc) { + if (cfunc[x].match(/^CKEditorFuncNum=\d+$/)) { + cfunc = cfunc[x].split('='); + break; + } + } + + CKEDITOR.tools.callFunction(cfunc[1], file); + win.close(); + }; + } + } ); + function setFile(file) { + //checking if it is image + if (file.width != 0 && file.height != 0) { + this.insertHtml('' + file.name + ''); + } else { + this.insertHtml('' + file.name + ''); + } + } +} )(); diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/css/linktocontent.css b/sites/all/modules/ckeditor/plugins/linktomenu/css/linktocontent.css new file mode 100644 index 0000000..0ca0d09 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktomenu/css/linktocontent.css @@ -0,0 +1,114 @@ +form { + padding: 0; + margin: 0; +} + +.panel_wrapper { + display: none; +} + +/* +.panel_wrap { + border: 1px solid #919b9c; + border-top: 0; + padding: .5em 0; + margin: 0; + background: #fff; + float: left; + width: 100%; +}*/ +.panel_wrap .panel { + display: none; +} + +.panel_wrap .current { + display: block; + width: 100%; + height: auto; +} + +label { + margin-bottom: .5em; + display: block; +} + +#form_browse { + margin: 0 .5em; +} + +.mceActionPanel { + float: left; + margin: .5em 0 0 0; +} + +.panel_wrap .nodes { + margin: 0; + padding: 0; +} + +#nodelist { + padding: 0; + height: 13.5em; + width: 96%; + overflow: auto; + border: #D5D59D; +} + +th { + font-size: 11px; + border-bottom: 1px solid #D5D59D; +} + +td { + text-align: left; + padding: .05em .5em .05em 0; + white-space: nowrap; +} + +tr { + cursor: pointer; +} + +tr.head { + cursor: auto; +} + +td.nid { + display: none; +} + +#statusImg { + display: block; + position: absolute; + left: 15px; + top: 125px; + width: 90%; + font-size: 14px; + color: #333333; + width: auto; + padding-right: .5em; + line-height: 82px; + vertical-align: middle; +} + +#statusImg img { + margin: 36px 10px; + float: left; +} + +#browse_panel select { + background: #FFF; +} + +#nodelist table { + margin: 5px +} + +#nodelist table tr { + border: 1px #e0e0e0; + border-collapse: collapse; +} + +#nodelist table tr td { + cursor: pointer; +} diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/dialogs/link.js b/sites/all/modules/ckeditor/plugins/linktomenu/dialogs/link.js new file mode 100644 index 0000000..a49ea2f --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktomenu/dialogs/link.js @@ -0,0 +1,827 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.dialog.add( 'linktomenu', function( editor ) +{ + // + CKEDITOR.scriptLoader.load( Drupal.settings.basePath + "misc/jquery.js"); + CKEDITOR.scriptLoader.load( Drupal.settings.ckeditor.module_path + "/plugins/linktomenu/jscripts/functions.js", function() { + loadCategories(null); + }); + // + + + // Handles the event when the "Target" selection box is changed. + var targetChanged = function() + { + var dialog = this.getDialog(), + popupFeatures = dialog.getContentElement( 'target', 'popupFeatures' ), + targetName = dialog.getContentElement( 'target', 'linkTargetName' ), + value = this.getValue(); + + if ( !popupFeatures || !targetName ) + return; + + popupFeatures = popupFeatures.getElement(); + + if ( value == 'popup' ) + { + popupFeatures.show(); + targetName.setLabel( editor.lang.link.targetPopupName ); + } + else + { + popupFeatures.hide(); + targetName.setLabel( editor.lang.link.targetFrameName ); + this.getDialog().setValueOf( 'target', 'linkTargetName', value.charAt( 0 ) == '_' ? value : '' ); + } + }; + + // Loads the parameters in a selected link to the link dialog fields. + var emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/, + emailSubjectRegex = /subject=([^;?:@&=$,\/]*)/, + emailBodyRegex = /body=([^;?:@&=$,\/]*)/, + anchorRegex = /^#(.*)$/, + urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/, + selectableTargets = /^(_(?:self|top|parent|blank))$/; + + var popupRegex = + /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/; + var popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi; + + var parseLink = function( editor, element ) + { + var href = element ? ( element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) : '', + emailMatch = '', + anchorMatch = '', + urlMatch = false, + retval = {}; + + if ( href ) + { + emailMatch = href.match( emailRegex ); + anchorMatch = href.match( anchorRegex ); + urlMatch = href.match( urlRegex ); + } + + // Load the link type and URL. + if ( emailMatch ) + { + var subjectMatch = href.match( emailSubjectRegex ), + bodyMatch = href.match( emailBodyRegex ); + retval.type = 'email'; + retval.email = {}; + retval.email.address = emailMatch[1]; + subjectMatch && ( retval.email.subject = decodeURIComponent( subjectMatch[1] ) ); + bodyMatch && ( retval.email.body = decodeURIComponent( bodyMatch[1] ) ); + } + else if ( anchorMatch ) + { + retval.type = 'anchor'; + retval.anchor = {}; + retval.anchor.name = retval.anchor.id = anchorMatch[1]; + } + else if ( href && urlMatch ) // urlRegex matches empty strings, so need to check for href as well. + { + retval.type = 'url'; + retval.url = {}; + retval.url.protocol = urlMatch[1]; + retval.url.url = urlMatch[2]; + } + else + retval.type = 'url'; + + // Load target and popup settings. + if ( element ) + { + var target = element.getAttribute( 'target' ); + retval.target = {}; + retval.adv = {}; + + // IE BUG: target attribute is an empty string instead of null in IE if it's not set. + if ( !target ) + { + var onclick = element.getAttribute( '_cke_pa_onclick' ) || element.getAttribute( 'onclick' ), + onclickMatch = onclick && onclick.match( popupRegex ); + if ( onclickMatch ) + { + retval.target.type = 'popup'; + retval.target.name = onclickMatch[1]; + + var featureMatch; + while ( ( featureMatch = popupFeaturesRegex.exec( onclickMatch[2] ) ) ) + { + if ( featureMatch[2] == 'yes' || featureMatch[2] == '1' ) + retval.target[ featureMatch[1] ] = true; + else if ( isFinite( featureMatch[2] ) ) + retval.target[ featureMatch[1] ] = featureMatch[2]; + } + } + } + else + { + var targetMatch = target.match( selectableTargets ); + if ( targetMatch ) + retval.target.type = retval.target.name = target; + else + { + retval.target.type = 'frame'; + retval.target.name = target; + } + } + + var me = this; + var advAttr = function( inputName, attrName ) + { + var value = element.getAttribute( attrName ); + if ( value !== null ) + retval.adv[ inputName ] = value || ''; + }; + advAttr( 'advId', 'id' ); + advAttr( 'advLangDir', 'dir' ); + advAttr( 'advAccessKey', 'accessKey' ); + advAttr( 'advName', 'name' ); + advAttr( 'advLangCode', 'lang' ); + advAttr( 'advTabIndex', 'tabindex' ); + advAttr( 'advTitle', 'title' ); + advAttr( 'advContentType', 'type' ); + advAttr( 'advCSSClasses', 'class' ); + advAttr( 'advCharset', 'charset' ); + advAttr( 'advStyles', 'style' ); + } + + // Find out whether we have any anchors in the editor. + // Get all IMG elements in CK document. + var elements = editor.document.getElementsByTag( 'img' ), + realAnchors = new CKEDITOR.dom.nodeList( editor.document.$.anchors ), + anchors = retval.anchors = []; + + for( var i = 0; i < elements.count() ; i++ ) + { + var item = elements.getItem( i ); + if ( item.getAttribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type' ) == 'anchor' ) + { + anchors.push( editor.restoreRealElement( item ) ); + } + } + + for ( i = 0 ; i < realAnchors.count() ; i++ ) + anchors.push( realAnchors.getItem( i ) ); + + for ( i = 0 ; i < anchors.length ; i++ ) + { + item = anchors[ i ]; + anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) }; + } + + // Record down the selected element in the dialog. + this._.selectedElement = element; + + return retval; + }; + + var setupParams = function( page, data ) + { + if ( data[page] ) + this.setValue( data[page][this.id] || '' ); + }; + + var setupPopupParams = function( data ) + { + return setupParams.call( this, 'target', data ); + }; + + var setupAdvParams = function( data ) + { + return setupParams.call( this, 'adv', data ); + }; + + var commitParams = function( page, data ) + { + if ( !data[page] ) + data[page] = {}; + + data[page][this.id] = this.getValue() || ''; + }; + + var commitPopupParams = function( data ) + { + return commitParams.call( this, 'target', data ); + }; + + var commitAdvParams = function( data ) + { + return commitParams.call( this, 'adv', data ); + }; + + return { + title : 'Link to menu', + minWidth : 350, + minHeight : 230, + contents : [ + { + id : 'info', + label : editor.lang.link.info, + title : editor.lang.link.info, + elements : + [ + { + type : 'html', + html : + '' + + '' + + '' + + '
        ' + + '
        ' + + '
        ' + + 'Browse' + + '
        ' + + '
        ' + + '
        ' + + '' + + '
        ' + + '
        ' + + '
        ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
        Title
        ' + + '
        ' + + '
        ' + + '
        ' + + '
        loadingloading...
        ' + } + ] + }, + { + id : 'target', + label : editor.lang.link.target, + title : editor.lang.link.target, + elements : + [ + { + type : 'hbox', + widths : [ '50%', '50%' ], + children : + [ + { + type : 'select', + id : 'linkTargetType', + label : editor.lang.link.target, + 'default' : 'notSet', + style : 'width : 100%;', + 'items' : + [ + [ editor.lang.link.targetNotSet, 'notSet' ], + [ editor.lang.link.targetFrame, 'frame' ], + [ editor.lang.link.targetPopup, 'popup' ], + [ editor.lang.link.targetNew, '_blank' ], + [ editor.lang.link.targetTop, '_top' ], + [ editor.lang.link.targetSelf, '_self' ], + [ editor.lang.link.targetParent, '_parent' ] + ], + onChange : targetChanged, + setup : function( data ) + { + if ( data.target ) + this.setValue( data.target.type ); + }, + commit : function( data ) + { + if ( !data.target ) + data.target = {}; + + data.target.type = this.getValue(); + } + }, + { + type : 'text', + id : 'linkTargetName', + label : editor.lang.link.targetFrameName, + 'default' : '', + setup : function( data ) + { + if ( data.target ) + this.setValue( data.target.name ); + }, + commit : function( data ) + { + if ( !data.target ) + data.target = {}; + + data.target.name = this.getValue(); + } + } + ] + }, + { + type : 'vbox', + width : 260, + align : 'center', + padding : 2, + id : 'popupFeatures', + children : + [ + { + type : 'html', + html : CKEDITOR.tools.htmlEncode( editor.lang.link.popupFeatures ) + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'resizable', + label : editor.lang.link.popupResizable, + setup : setupPopupParams, + commit : commitPopupParams + }, + { + type : 'checkbox', + id : 'status', + label : editor.lang.link.popupStatusBar, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'location', + label : editor.lang.link.popupLocationBar, + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'checkbox', + id : 'toolbar', + label : editor.lang.link.popupToolbar, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'menubar', + label : editor.lang.link.popupMenuBar, + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'checkbox', + id : 'fullscreen', + label : editor.lang.link.popupFullScreen, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'scrollbars', + label : editor.lang.link.popupScrollBars, + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'checkbox', + id : 'dependent', + label : editor.lang.link.popupDependent, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'text', + widths : [ '30%', '70%' ], + labelLayout : 'horizontal', + label : editor.lang.link.popupWidth, + id : 'width', + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'text', + labelLayout : 'horizontal', + widths : [ '55%', '45%' ], + label : editor.lang.link.popupLeft, + id : 'left', + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'text', + labelLayout : 'horizontal', + widths : [ '30%', '70%' ], + label : editor.lang.link.popupHeight, + id : 'height', + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'text', + labelLayout : 'horizontal', + label : editor.lang.link.popupTop, + widths : [ '55%', '45%' ], + id : 'top', + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + } + ] + } + ] + }, + { + id : 'advanced', + label : editor.lang.link.advanced, + title : editor.lang.link.advanced, + elements : + [ + { + type : 'vbox', + padding : 1, + children : + [ + { + type : 'hbox', + widths : [ '45%', '35%', '20%' ], + children : + [ + { + type : 'text', + id : 'advId', + label : editor.lang.link.id, + setup : setupAdvParams, + commit : commitAdvParams + }, + { + type : 'select', + id : 'advLangDir', + label : editor.lang.link.langDir, + 'default' : '', + style : 'width:110px', + items : + [ + [ editor.lang.link.langDirNotSet, '' ], + [ editor.lang.link.langDirLTR, 'ltr' ], + [ editor.lang.link.langDirRTL, 'rtl' ] + ], + setup : setupAdvParams, + commit : commitAdvParams + }, + { + type : 'text', + id : 'advAccessKey', + width : '80px', + label : editor.lang.link.acccessKey, + maxLength : 1, + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + }, + { + type : 'hbox', + widths : [ '45%', '35%', '20%' ], + children : + [ + { + type : 'text', + label : editor.lang.link.name, + id : 'advName', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.langCode, + id : 'advLangCode', + width : '110px', + 'default' : '', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.tabIndex, + id : 'advTabIndex', + width : '80px', + maxLength : 5, + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + } + ] + }, + { + type : 'vbox', + padding : 1, + children : + [ + { + type : 'hbox', + widths : [ '45%', '55%' ], + children : + [ + { + type : 'text', + label : editor.lang.link.advisoryTitle, + 'default' : '', + id : 'advTitle', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.advisoryContentType, + 'default' : '', + id : 'advContentType', + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + }, + { + type : 'hbox', + widths : [ '45%', '55%' ], + children : + [ + { + type : 'text', + label : editor.lang.link.cssClasses, + 'default' : '', + id : 'advCSSClasses', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.charset, + 'default' : '', + id : 'advCharset', + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'text', + label : editor.lang.link.styles, + 'default' : '', + id : 'advStyles', + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + } + ] + } + ] + } + ], + onShow : function() + { + this.fakeObj = false; + + var editor = this.getParentEditor(), + selection = editor.getSelection(), + ranges = selection.getRanges(), + element = null, + me = this; + // Fill in all the relevant fields if there's already one link selected. + if ( ranges.length == 1 ) + { + + var rangeRoot = ranges[0].getCommonAncestor( true ); + element = rangeRoot.getAscendant( 'a', true ); + if ( element && element.getAttribute( 'href' ) ) + { + selection.selectElement( element ); + } + else if ( ( element = rangeRoot.getAscendant( 'img', true ) ) && + element.getAttribute( '_cke_real_element_type' ) && + element.getAttribute( '_cke_real_element_type' ) == 'anchor' ) + { + this.fakeObj = element; + element = editor.restoreRealElement( this.fakeObj ); + selection.selectElement( this.fakeObj ); + } + else + element = null; + } + + this.setupContent( parseLink.apply( this, [ editor, element ] ) ); + }, + onOk : function() + { + var attributes = { href : 'javascript:void(0)/*' + CKEDITOR.tools.getNextNumber() + '*/' }, + removeAttributes = [], + data = { href : attributes.href }, + me = this, editor = this.getParentEditor(); + + this.commitContent( data ); + // + attributes._cke_saved_href = (Drupal.settings.ckeditor.linktomenu_basepath || '' ) + $('#linktomenu_url').val(); + // + + // Popups and target. + if ( data.target ) + { + if ( data.target.type == 'popup' ) + { + var onclickList = [ 'window.open(this.href, \'', + data.target.name || '', '\', \'' ]; + var featureList = [ 'resizable', 'status', 'location', 'toolbar', 'menubar', 'fullscreen', + 'scrollbars', 'dependent' ]; + var featureLength = featureList.length; + var addFeature = function( featureName ) + { + if ( data.target[ featureName ] ) + featureList.push( featureName + '=' + data.target[ featureName ] ); + }; + + for ( var i = 0 ; i < featureLength ; i++ ) + featureList[i] = featureList[i] + ( data.target[ featureList[i] ] ? '=yes' : '=no' ) ; + addFeature( 'width' ); + addFeature( 'left' ); + addFeature( 'height' ); + addFeature( 'top' ); + + onclickList.push( featureList.join( ',' ), '\'); return false;' ); + attributes[ CKEDITOR.env.ie || CKEDITOR.env.webkit ? '_cke_pa_onclick' : 'onclick' ] = onclickList.join( '' ); + } + else + { + if ( data.target.type != 'notSet' && data.target.name ) + attributes.target = data.target.name; + removeAttributes.push( '_cke_pa_onclick', 'onclick' ); + } + } + + // Advanced attributes. + if ( data.adv ) + { + var advAttr = function( inputName, attrName ) + { + var value = data.adv[ inputName ]; + if ( value ) + attributes[attrName] = value; + else + removeAttributes.push( attrName ); + }; + + if ( this._.selectedElement ) + advAttr( 'advId', 'id' ); + advAttr( 'advLangDir', 'dir' ); + advAttr( 'advAccessKey', 'accessKey' ); + advAttr( 'advName', 'name' ); + advAttr( 'advLangCode', 'lang' ); + advAttr( 'advTabIndex', 'tabindex' ); + advAttr( 'advTitle', 'title' ); + advAttr( 'advContentType', 'type' ); + advAttr( 'advCSSClasses', 'class' ); + advAttr( 'advCharset', 'charset' ); + advAttr( 'advStyles', 'style' ); + } + + if ( !this._.selectedElement ) + { + // Create element if current selection is collapsed. + var selection = editor.getSelection(), + ranges = selection.getRanges(); + if ( ranges.length == 1 && ranges[0].collapsed ) + { + // + var text = new CKEDITOR.dom.text( $('#linktomenu_text').val() || attributes._cke_saved_href, editor.document ); + // + ranges[0].insertNode( text ); + ranges[0].selectNodeContents( text ); + selection.selectRanges( ranges ); + } + + // Apply style. + var style = new CKEDITOR.style( { element : 'a', attributes : attributes } ); + style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why. + style.apply( editor.document ); + + // Id. Apply only to the first link. + if ( data.adv && data.adv.advId ) + { + var links = this.getParentEditor().document.$.getElementsByTagName( 'a' ); + for ( i = 0 ; i < links.length ; i++ ) + { + if ( links[i].href == attributes.href ) + { + links[i].id = data.adv.advId; + break; + } + } + } + } + else + { + // We're only editing an existing link, so just overwrite the attributes. + var element = this._.selectedElement; + + // IE BUG: Setting the name attribute to an existing link doesn't work. + // Must re-create the link from weired syntax to workaround. + if ( CKEDITOR.env.ie && attributes.name != element.getAttribute( 'name' ) ) + { + var newElement = new CKEDITOR.dom.element( '', + editor.document ); + + selection = editor.getSelection(); + + element.moveChildren( newElement ); + element.copyAttributes( newElement, { name : 1 } ); + newElement.replace( element ); + element = newElement; + + selection.selectElement( element ); + } + + element.setAttributes( attributes ); + element.removeAttributes( removeAttributes ); + + // Make the element display as an anchor if a name has been set. + if ( element.getAttribute( 'name' ) ) + element.addClass( 'cke_anchor' ); + else + element.removeClass( 'cke_anchor' ); + + if ( this.fakeObj ) + editor.createFakeElement( element, 'cke_anchor', 'anchor' ).replace( this.fakeObj ); + + delete this._.selectedElement; + } + }, + onLoad : function() + { + if ( !editor.config.linkShowAdvancedTab ) + this.hidePage( 'advanced' ); //Hide Advanded tab. + + if ( !editor.config.linkShowTargetTab ) + this.hidePage( 'target' ); //Hide Target tab. + + } + }; +} ); diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/images/descendant.gif b/sites/all/modules/ckeditor/plugins/linktomenu/images/descendant.gif new file mode 100644 index 0000000..10af8cf Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/linktomenu/images/descendant.gif differ diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/images/linktomenu.gif b/sites/all/modules/ckeditor/plugins/linktomenu/images/linktomenu.gif new file mode 100644 index 0000000..51a908e Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/linktomenu/images/linktomenu.gif differ diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/images/loading.gif b/sites/all/modules/ckeditor/plugins/linktomenu/images/loading.gif new file mode 100644 index 0000000..00fa620 Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/linktomenu/images/loading.gif differ diff --git a/sites/all/modules/ckeditor/plugins/linktomenu/jscripts/functions.js b/sites/all/modules/ckeditor/plugins/linktomenu/jscripts/functions.js new file mode 100644 index 0000000..a1cba14 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktomenu/jscripts/functions.js @@ -0,0 +1,302 @@ + +function selectRow(row) { + if (!row) { + return; + } + $('#nodelist tbody tr').each( function() { + $(this).css('background', 'transparent'); + }); + $(row).css('background', '#dadfe9'); + selectedNode = row; + $('#linktomenu_url').val(row.cells[0].firstChild.nodeValue); + $('#linktomenu_text').val(row.cells[1].firstChild.nodeValue); +} + +//save node/path urls +function SaveDrupalUrls() +{ + //if ((!FCKConfig.DrupalLinkToContentSelect && FCKConfig.DrupalPathFilter) || GetE('cmbDrupalProtocol').value == 'internal') { + var url = CKEDITOR._._linkToNodeDialog.getContentElement( 'info', 'url' ); + var type = CKEDITOR._._linkToNodeDialog.getContentElement( 'info', 'linkType' ); + + if ( type.getValue() == 'internal' ) { + url.setValue($('#txtUrlInternal').val()); + } + else { + url.setValue($('#txtUrlPath').val()); + } +} + +/** + * loadCategories() + * @param obj parent Object + **/ +function loadCategories(obj) { + var params = ''; + var mid = '0'; + var top = 95; + var objTop; + if (obj != null) { + mid = $(obj).get(0).value; + + try { + objTop = $(obj).attr('id').match(/_(\d+)_sel/); + top += (objTop[1] * 17); + } catch (e) { + top += 0; + } + } + params = 'ltc-type=linktocontent_menu<c-menu-id=' + mid; + + $('#statusImg').css( { + top : top + 'px' + }).show(); + + $.ajax( { + type : "POST", + url : Drupal.settings.basePath + 'index.php?q=linktocontent', + data : params, + error : function(xml, msg, exc) { + $('#statusImg').hide(); + alert(Drupal.t('Error !msg', {'!msg' : msg + '\n' + xml.responseText })); + }, + success : function(data) { + try { + var results = eval('(' + data + ');'); + _clearNodeList(); + if ((obj == null) || ($(obj).get(0).value > -1)) { + _fillDropdown(obj, results); + } + _fillNodelist(results); + } catch (e) { + alert(Drupal.t('Error on retrieving data from module.') + '\n' + e.name + '\n' + e.message); + } finally { + $('#statusImg').hide(); + } + } + }); +} + +// dropdown functions +/** + * + * @access public + * @return void + */ +function _createDropdown(obj) { + var dropdown; + var elemname = ''; + if (obj == null) { + elemname = 'browse_sel_-1'; + } else { + elemname = $(obj).parent().attr('id'); + _removeDescendant($(obj)); + } + + var level = parseInt(elemname.substring(elemname.lastIndexOf("_") + 1, elemname.length)) + 1; + + var elemBase = elemname.substring(0, elemname.lastIndexOf("_") + 1); + + // create surrounding
        + var sel_div = $('
        '); + $(sel_div).attr('name', elemBase + level); + $(sel_div).attr('id', elemBase + level); + $(sel_div).attr('style', 'display: block; margin: 1px 0; padding: 0; border: 0;'); + + // create '); + $(select).attr('size', 1); + $(select).attr('name', elemBase + level + '_sel'); + $(select).attr('id', elemBase + level + '_sel'); + + // add event handler + $(select).change( function() { + _removeDescendant($(this).parent()); + _clearNodeList(); + loadCategories($(this)); + }); + + // create image (only if level > 0) + if (level > 0) { + var img = $(''); + $(img).attr('id', elemname.substring(0, elemname.lastIndexOf('_') + 1) + level + '_img'); + $(img).attr('alt', ''); + $(img).attr('src', 'images/descendant.gif'); + // extra margin for IE + $(img).css( { + margin : '0px 2px', + border : 0 + }); + $(img).css( { + marginLeft : String((parseInt(level) - 1) * 14) + 'px', + marginRight : '2px' + }); + $(sel_div).append($(img)); + } + + $(sel_div).append($(select)); + $(sel_div).hide(); + $('#form_browse').append($(sel_div)); + $(sel_div).show('slow'); + return select; +} + +/** + * _fillDropdown + * @return true if a dropdown was inserted + **/ +function _fillDropdown(obj, results) { + if (results.menus != false) { + var select = _createDropdown(obj); + $(select).addOption(-1, "Choose Category"); + for (key in results.menus) { + if (results.menus[key].hasChildren) { + $(select).addOption(results.menus[key].mid, results.menus[key].title); + } + } + return true; + } + return false; +} + +/** + * remove "child" elements + **/ +function _removeDescendant(elem) { + if (elem == null) + return; + $(elem).next().each( function() { + _removeDescendant($(this)); + $(this).hide('slow').remove(); + }); +} + +// nodelist functions +var selectedNode = null; + +function _fillNodelist(results) { + if ((results == null) || (results.menus == null) || (results.menus == false)) + return; + + for (key in results.menus) { + if (results.menus[key].root) { + continue; + } + _addNodeToList(results.menus[key]); + } +} + +function _clearNodeList() { + $('#nodelist tbody tr').each( function() { + $(this).remove(); + }); +} + +function _addNodeToList(node) { + var tr = $('
        ' + node.path + '' + node.title + '
        ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
        Node titleCreatedAuthor
        ' + + '
    ' + + '
' + + '
' + + '' + + '' + + '' + + '
loadingloading...
' + } + ] + }, + { + id : 'target', + label : editor.lang.link.target, + title : editor.lang.link.target, + elements : + [ + { + type : 'hbox', + widths : [ '50%', '50%' ], + children : + [ + { + type : 'select', + id : 'linkTargetType', + label : editor.lang.link.target, + 'default' : 'notSet', + style : 'width : 100%;', + 'items' : + [ + [ editor.lang.link.targetNotSet, 'notSet' ], + [ editor.lang.link.targetFrame, 'frame' ], + [ editor.lang.link.targetPopup, 'popup' ], + [ editor.lang.link.targetNew, '_blank' ], + [ editor.lang.link.targetTop, '_top' ], + [ editor.lang.link.targetSelf, '_self' ], + [ editor.lang.link.targetParent, '_parent' ] + ], + onChange : targetChanged, + setup : function( data ) + { + if ( data.target ) + this.setValue( data.target.type ); + }, + commit : function( data ) + { + if ( !data.target ) + data.target = {}; + + data.target.type = this.getValue(); + } + }, + { + type : 'text', + id : 'linkTargetName', + label : editor.lang.link.targetFrameName, + 'default' : '', + setup : function( data ) + { + if ( data.target ) + this.setValue( data.target.name ); + }, + commit : function( data ) + { + if ( !data.target ) + data.target = {}; + + data.target.name = this.getValue(); + } + } + ] + }, + { + type : 'vbox', + width : 260, + align : 'center', + padding : 2, + id : 'popupFeatures', + children : + [ + { + type : 'html', + html : CKEDITOR.tools.htmlEncode( editor.lang.link.popupFeatures ) + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'resizable', + label : editor.lang.link.popupResizable, + setup : setupPopupParams, + commit : commitPopupParams + }, + { + type : 'checkbox', + id : 'status', + label : editor.lang.link.popupStatusBar, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'location', + label : editor.lang.link.popupLocationBar, + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'checkbox', + id : 'toolbar', + label : editor.lang.link.popupToolbar, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'menubar', + label : editor.lang.link.popupMenuBar, + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'checkbox', + id : 'fullscreen', + label : editor.lang.link.popupFullScreen, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'checkbox', + id : 'scrollbars', + label : editor.lang.link.popupScrollBars, + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'checkbox', + id : 'dependent', + label : editor.lang.link.popupDependent, + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'text', + widths : [ '30%', '70%' ], + labelLayout : 'horizontal', + label : editor.lang.link.popupWidth, + id : 'width', + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'text', + labelLayout : 'horizontal', + widths : [ '55%', '45%' ], + label : editor.lang.link.popupLeft, + id : 'left', + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'text', + labelLayout : 'horizontal', + widths : [ '30%', '70%' ], + label : editor.lang.link.popupHeight, + id : 'height', + setup : setupPopupParams, + commit : commitPopupParams + + }, + { + type : 'text', + labelLayout : 'horizontal', + label : editor.lang.link.popupTop, + widths : [ '55%', '45%' ], + id : 'top', + setup : setupPopupParams, + commit : commitPopupParams + + } + ] + } + ] + } + ] + }, + { + id : 'advanced', + label : editor.lang.link.advanced, + title : editor.lang.link.advanced, + elements : + [ + { + type : 'vbox', + padding : 1, + children : + [ + { + type : 'hbox', + widths : [ '45%', '35%', '20%' ], + children : + [ + { + type : 'text', + id : 'advId', + label : editor.lang.link.id, + setup : setupAdvParams, + commit : commitAdvParams + }, + { + type : 'select', + id : 'advLangDir', + label : editor.lang.link.langDir, + 'default' : '', + style : 'width:110px', + items : + [ + [ editor.lang.link.langDirNotSet, '' ], + [ editor.lang.link.langDirLTR, 'ltr' ], + [ editor.lang.link.langDirRTL, 'rtl' ] + ], + setup : setupAdvParams, + commit : commitAdvParams + }, + { + type : 'text', + id : 'advAccessKey', + width : '80px', + label : editor.lang.link.acccessKey, + maxLength : 1, + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + }, + { + type : 'hbox', + widths : [ '45%', '35%', '20%' ], + children : + [ + { + type : 'text', + label : editor.lang.link.name, + id : 'advName', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.langCode, + id : 'advLangCode', + width : '110px', + 'default' : '', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.tabIndex, + id : 'advTabIndex', + width : '80px', + maxLength : 5, + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + } + ] + }, + { + type : 'vbox', + padding : 1, + children : + [ + { + type : 'hbox', + widths : [ '45%', '55%' ], + children : + [ + { + type : 'text', + label : editor.lang.link.advisoryTitle, + 'default' : '', + id : 'advTitle', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.advisoryContentType, + 'default' : '', + id : 'advContentType', + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + }, + { + type : 'hbox', + widths : [ '45%', '55%' ], + children : + [ + { + type : 'text', + label : editor.lang.link.cssClasses, + 'default' : '', + id : 'advCSSClasses', + setup : setupAdvParams, + commit : commitAdvParams + + }, + { + type : 'text', + label : editor.lang.link.charset, + 'default' : '', + id : 'advCharset', + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + }, + { + type : 'hbox', + children : + [ + { + type : 'text', + label : editor.lang.link.styles, + 'default' : '', + id : 'advStyles', + setup : setupAdvParams, + commit : commitAdvParams + + } + ] + } + ] + } + ] + } + ], + onShow : function() + { + this.fakeObj = false; + + var editor = this.getParentEditor(), + selection = editor.getSelection(), + ranges = selection.getRanges(), + element = null, + me = this; + // Fill in all the relevant fields if there's already one link selected. + if ( ranges.length == 1 ) + { + + var rangeRoot = ranges[0].getCommonAncestor( true ); + element = rangeRoot.getAscendant( 'a', true ); + if ( element && element.getAttribute( 'href' ) ) + { + selection.selectElement( element ); + } + else if ( ( element = rangeRoot.getAscendant( 'img', true ) ) && + element.getAttribute( '_cke_real_element_type' ) && + element.getAttribute( '_cke_real_element_type' ) == 'anchor' ) + { + this.fakeObj = element; + element = editor.restoreRealElement( this.fakeObj ); + selection.selectElement( this.fakeObj ); + } + else + element = null; + } + + this.setupContent( parseLink.apply( this, [ editor, element ] ) ); + }, + onOk : function() + { + var attributes = { href : 'javascript:void(0)/*' + CKEDITOR.tools.getNextNumber() + '*/' }, + removeAttributes = [], + data = { href : attributes.href }, + me = this, editor = this.getParentEditor(); + this.commitContent( data ); + // + attributes._cke_saved_href = this.getContentElement( 'info', 'url' ).getValue(); + // + + // Popups and target. + if ( data.target ) + { + if ( data.target.type == 'popup' ) + { + var onclickList = [ 'window.open(this.href, \'', + data.target.name || '', '\', \'' ]; + var featureList = [ 'resizable', 'status', 'location', 'toolbar', 'menubar', 'fullscreen', + 'scrollbars', 'dependent' ]; + var featureLength = featureList.length; + var addFeature = function( featureName ) + { + if ( data.target[ featureName ] ) + featureList.push( featureName + '=' + data.target[ featureName ] ); + }; + + for ( var i = 0 ; i < featureLength ; i++ ) + featureList[i] = featureList[i] + ( data.target[ featureList[i] ] ? '=yes' : '=no' ) ; + addFeature( 'width' ); + addFeature( 'left' ); + addFeature( 'height' ); + addFeature( 'top' ); + + onclickList.push( featureList.join( ',' ), '\'); return false;' ); + attributes[ CKEDITOR.env.ie || CKEDITOR.env.webkit ? '_cke_pa_onclick' : 'onclick' ] = onclickList.join( '' ); + } + else + { + if ( data.target.type != 'notSet' && data.target.name ) + attributes.target = data.target.name; + removeAttributes.push( '_cke_pa_onclick', 'onclick' ); + } + } + + // Advanced attributes. + if ( data.adv ) + { + var advAttr = function( inputName, attrName ) + { + var value = data.adv[ inputName ]; + if ( value ) + attributes[attrName] = value; + else + removeAttributes.push( attrName ); + }; + + if ( this._.selectedElement ) + advAttr( 'advId', 'id' ); + advAttr( 'advLangDir', 'dir' ); + advAttr( 'advAccessKey', 'accessKey' ); + advAttr( 'advName', 'name' ); + advAttr( 'advLangCode', 'lang' ); + advAttr( 'advTabIndex', 'tabindex' ); + advAttr( 'advTitle', 'title' ); + advAttr( 'advContentType', 'type' ); + advAttr( 'advCSSClasses', 'class' ); + advAttr( 'advCharset', 'charset' ); + advAttr( 'advStyles', 'style' ); + } + + if ( !this._.selectedElement ) + { + // Create element if current selection is collapsed. + var selection = editor.getSelection(), + ranges = selection.getRanges(); + if ( ranges.length == 1 && ranges[0].collapsed ) + { + // + var text = new CKEDITOR.dom.text( $('#txtUrlText').val() || attributes._cke_saved_href, editor.document ); + // + ranges[0].insertNode( text ); + ranges[0].selectNodeContents( text ); + selection.selectRanges( ranges ); + } + + // Apply style. + var style = new CKEDITOR.style( { element : 'a', attributes : attributes } ); + style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why. + style.apply( editor.document ); + + // Id. Apply only to the first link. + if ( data.adv && data.adv.advId ) + { + var links = this.getParentEditor().document.$.getElementsByTagName( 'a' ); + for ( i = 0 ; i < links.length ; i++ ) + { + if ( links[i].href == attributes.href ) + { + links[i].id = data.adv.advId; + break; + } + } + } + } + else + { + // We're only editing an existing link, so just overwrite the attributes. + var element = this._.selectedElement; + + // IE BUG: Setting the name attribute to an existing link doesn't work. + // Must re-create the link from weired syntax to workaround. + if ( CKEDITOR.env.ie && attributes.name != element.getAttribute( 'name' ) ) + { + var newElement = new CKEDITOR.dom.element( '', + editor.document ); + + selection = editor.getSelection(); + + element.moveChildren( newElement ); + element.copyAttributes( newElement, { name : 1 } ); + newElement.replace( element ); + element = newElement; + + selection.selectElement( element ); + } + + element.setAttributes( attributes ); + element.removeAttributes( removeAttributes ); + + // Make the element display as an anchor if a name has been set. + if ( element.getAttribute( 'name' ) ) + element.addClass( 'cke_anchor' ); + else + element.removeClass( 'cke_anchor' ); + + if ( this.fakeObj ) + editor.createFakeElement( element, 'cke_anchor', 'anchor' ).replace( this.fakeObj ); + + delete this._.selectedElement; + } + }, + onLoad : function() + { + CKEDITOR._._linkToNodeDialog = this; + + if ( !editor.config.linkShowAdvancedTab ) + this.hidePage( 'advanced' ); //Hide Advanded tab. + + if ( !editor.config.linkShowTargetTab ) + this.hidePage( 'target' ); //Hide Target tab. + + } + }; +} ); diff --git a/sites/all/modules/ckeditor/plugins/linktonode/images/descendant.gif b/sites/all/modules/ckeditor/plugins/linktonode/images/descendant.gif new file mode 100644 index 0000000..10af8cf Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/linktonode/images/descendant.gif differ diff --git a/sites/all/modules/ckeditor/plugins/linktonode/images/linktonode.gif b/sites/all/modules/ckeditor/plugins/linktonode/images/linktonode.gif new file mode 100644 index 0000000..0a6474c Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/linktonode/images/linktonode.gif differ diff --git a/sites/all/modules/ckeditor/plugins/linktonode/images/loading.gif b/sites/all/modules/ckeditor/plugins/linktonode/images/loading.gif new file mode 100644 index 0000000..00fa620 Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/linktonode/images/loading.gif differ diff --git a/sites/all/modules/ckeditor/plugins/linktonode/jscripts/functions.js b/sites/all/modules/ckeditor/plugins/linktonode/jscripts/functions.js new file mode 100644 index 0000000..c10fa4b --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktonode/jscripts/functions.js @@ -0,0 +1,302 @@ + +function selectRow(row) { + if (!row) { + return; + } + $('#nodelist tbody tr').each(function() { + $(this).css({background: '#ffffff'}); + selectedNode = null; + }); + + selectedNode = row; + $(row).css({background: '#dadfe9'}); + + $('#txtUrlPath').val( selectedNode.cells[0].firstChild.nodeValue ); + $('#txtUrlInternal').val( 'internal:' + selectedNode.cells[4].firstChild.nodeValue ); + $('#txtUrlText').val( selectedNode.cells[1].firstChild.nodeValue ); + + var type = CKEDITOR._._linkToNodeDialog.getContentElement( 'info', 'linkType' ); + type.onChange(); +} + +/** + * loadCategories() + * @param obj parent Object + **/ +function loadCategories(obj) { + var params = ''; + var vid = '-1'; + var top = 95; + var objTop; + + if (obj != null) { + var fSel = $('#browse_sel_0_sel'); + if (fSel !== null) { + vid = $(fSel).get(0).value; + } + if ($(obj).attr('id') != 'browse_sel_0_sel') { + params = '<c-term-id=' + $(obj).get(0).value; + } + + try + { + objTop = $(obj).attr('id').match(/_(\d+)_sel/); + top += (objTop[1] * 17); + } + catch (e) { + top += 0; + } + } + params = 'ltc-type=linktocontent_node<c-vocab-id=' + vid + params; + + $('#statusImg').css( { + top : top + 'px' + }).show(); + + $.ajax( { + type : "POST", + url : Drupal.settings.basePath + 'index.php?q=linktocontent', + data : params, + error : function(xml, msg, exc) { + $('#statusImg').hide(); + alert(Drupal.t('Error !msg', {'!msg' : msg + '\n' + xml.responseText })); + }, + success : function(data) { + try { + var results = eval('(' + data + ');'); + _clearNodeList(); + if ((obj == null) || ($(obj).get(0).value > -1)) { + _fillDropdown(obj, results); + } + _fillNodelist(results); + } catch (e) { + alert(Drupal.t('Error on retrieving data from module.') + '\n' + e.name + '\n' + e.message); + } finally { + $('#statusImg').hide(); + } + } + }); +} + +// dropdown functions +/** + * + * @access public + * @return void + */ +function _createDropdown(obj) { + var dropdown; + var elemname = ''; + if (obj == null) { + elemname = 'browse_sel_-1'; + } else { + elemname = $(obj).parent().attr('id'); + _removeDescendant($(obj)); + } + + var level = parseInt(elemname.substring(elemname.lastIndexOf("_") + 1, elemname.length)) + 1; + + var elemBase = elemname.substring(0, elemname.lastIndexOf("_") + 1); + + // create surrounding
+ var sel_div = $('
'); + $(sel_div).attr('name', elemBase + level); + $(sel_div).attr('id', elemBase + level); + $(sel_div).attr('style', 'display: block; margin: 1px 0; padding: 0; border: 0;'); + + // create '); + $(select).attr('size', 1); + $(select).attr('name', elemBase + level + '_sel'); + $(select).attr('id', elemBase + level + '_sel'); + + // add event handler + $(select).change( function() { + _removeDescendant($(this).parent()); + _clearNodeList(); + loadCategories($(this)); + }); + + // create image (only if level > 0) + if (level > 0) { + var img = $(''); + $(img).attr('id', elemname.substring(0, elemname.lastIndexOf('_') + 1) + level + '_img'); + $(img).attr('alt', ''); + $(img).attr('src', 'images/descendant.gif'); + // extra margin for IE + $(img).css( { + margin : '0px 2px', + border : 0 + }); + $(img).css( { + marginLeft : String((parseInt(level) - 1) * 14) + 'px', + marginRight : '2px' + }); + $(sel_div).append($(img)); + } + + $(sel_div).append($(select)); + $(sel_div).hide(); + $('#form_browse').append($(sel_div)); + $(sel_div).show('slow'); + return select; +} + +/** + * _fillDropdown + * @return true if a dropdown was inserted + **/ +function _fillDropdown(obj, results){ + if (results.categories != false) { + var select = _createDropdown(obj); + + $(select).addOption(-1, "Choose category"); + // + for (key in results.categories) + $(select).addOption(results.categories[key].tid, results.categories[key].title); + return true; + } + return false; +} + +/** + * remove "child" elements + **/ +function _removeDescendant(elem) { + if (elem == null) + return; + $(elem).next().each( function() { + _removeDescendant($(this)); + $(this).hide('slow').remove(); + }); +} + +// nodelist functions +var selectedNode = null; + +function _fillNodelist(results) { + if ((results == null) || (results.nodes == null) || (results.nodes == false)) + return; + + for (key in results.nodes) { + _addNodeToList(results.nodes[key]); + } +} + +function _clearNodeList() { + $('#nodelist tbody tr').each( function() { + $(this).remove(); + }); +} + +function _addNodeToList(node) { + var tr = $('').appendTo('#nodelist tbody'); + tr.hover( function() { + if (!selectedNode || this != selectedNode) + $(this).css('background', '#cecece'); + }, function() { + if (!selectedNode || this != selectedNode) + $(this).css('background', 'transparent'); + }); + tr.click( function() { + selectRow(this); + }); + + $('' + node.href + '').appendTo(tr); + $('' + node.title + '').appendTo(tr); + $('' + node.date + '').appendTo(tr); + $('' + node.author + '').appendTo(tr); + $('' + node.orig_href + '').appendTo(tr); +} + +/** + * make the nodelist accessible by keyboard + **/ +$('.accessible').keypress( function(e) { + switch (e.keyCode) { + case 39: + case 40: // move selection down + if (selectedNode == null) + selectedNode = $('#nodelist tbody tr').get(0); + else + selectedNode = $(selectedNode).next('tr').get(0); + selectRow(selectedNode); + break; + case 37: + case 38: // move selection up + if (selectedNode == null) + selectedNode = $('#nodelist tbody tr').get($('#nodelist tbody tr').length - 1); + else + selectedNode = $(selectedNode).prev('tr').get(0); + selectRow(selectedNode); + break; + } + }); + +// options +$.fn.addOption = function() { + if (arguments.length == 0) + return this; + // select option when added? default is false + var selectOption = false; + // multiple items + var multiple = false; + if (typeof arguments[0] == "object") { + multiple = true; + var items = arguments[0]; + } + if (arguments.length >= 2) { + if (typeof arguments[1] == "boolean") + selectOption = arguments[1]; + else if (typeof arguments[2] == "boolean") + selectOption = arguments[2]; + if (!multiple) { + var value = arguments[0]; + var text = arguments[1]; + } + } + this.each( function() { + if (this.nodeName.toLowerCase() != "select") + return; + if (multiple) { + for (v in items) { + $(this).addOption(v, items[v], selectOption); + } + } else { + var option = document.createElement("option"); + option.value = value; + option.text = text; + this.options.add(option); + } + if (selectOption) { + this.options[this.options.length - 1].selected = true; + } + }) + return this; +} + +$.fn.removeOption = function() { + if (arguments.length == 0) + return this; + if (typeof arguments[0] == "string") + var value = arguments[0]; + else if (typeof arguments[0] == "number") + var index = arguments[0]; + else + return this; + this.each( function() { + if (this.nodeName.toLowerCase() != "select") + return; + if (value) { + var optionsLength = this.options.length; + for ( var i = optionsLength - 1; i >= 0; i--) { + if (this.options[i].value == value) { + this.options[i] = null; + } + } + } else { + this.remove(index); + } + }) + return this; +} diff --git a/sites/all/modules/ckeditor/plugins/linktonode/plugin.js b/sites/all/modules/ckeditor/plugins/linktonode/plugin.js new file mode 100644 index 0000000..1457d20 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/linktonode/plugin.js @@ -0,0 +1,56 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.add( 'linktonode', +{ + init : function( editor ) + { + // Add the link and unlink buttons. + editor.addCommand( 'linktonode', new CKEDITOR.dialogCommand( 'linktonode' ) ); + editor.ui.addButton( 'LinkToNode', + { + label : 'Link to node', + icon : this.path + 'images/linktonode.gif', + command : 'linktonode' + } ); + CKEDITOR.dialog.add( 'linktonode', this.path + 'dialogs/link.js' ); + + // If the "menu" plugin is loaded, register the menu items. + if ( editor.addMenuItems ) + { + editor.addMenuItems( + { + linktomenu : + { + label : 'Link to node', + command : 'linktonode', + group : 'linktonode', + order : 1 + } + }); + } + + // If the "contextmenu" plugin is loaded, register the listeners. + if ( editor.contextMenu ) + { + editor.contextMenu.addListener( function( element, selection ) + { + if ( !element ) + return null; + + var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' ); + + if ( !isAnchor ) + { + if ( !( element = element.getAscendant( 'a', true ) ) ) + return null; + + isAnchor = ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) ); + } + + return { linktomenu : CKEDITOR.TRISTATE_OFF }; + }); + } + } +} ); diff --git a/sites/all/modules/ckeditor/plugins/mediaembed/dialogs/mediaembed.js b/sites/all/modules/ckeditor/plugins/mediaembed/dialogs/mediaembed.js new file mode 100644 index 0000000..6f49f62 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/mediaembed/dialogs/mediaembed.js @@ -0,0 +1,54 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.dialog.add( 'mediaembedDialog', function( editor ) { + var numberRegex = /^\d+(?:\.\d+)?$/; + var cssifyLength = function( length ) + { + if ( numberRegex.test( length ) ) + return length + 'px'; + return length; + } + return { + title : Drupal.t('Embed Media Dialog'), + minWidth : 400, + minHeight : 200, + contents : [ + { + id : 'mediaTab', + label : Drupal.t('Embed media code'), + title : Drupal.t('Embed media code'), + elements : + [ + { + id : 'embed', + type : 'textarea', + rows : 9, + label : Drupal.t('Paste embed code here') + } + ] + } + ], + onOk : function() { + var editor = this.getParentEditor(); + var content = this.getValueOf( 'mediaTab', 'embed' ); + if ( content.length>0 ) { + var realElement = CKEDITOR.dom.element.createFromHtml('
'); + realElement.setHtml(content); + var fakeElement = editor.createFakeElement( realElement , 'cke_mediaembed', 'div', true); + var matches = content.match(/width=(["']?)(\d+)\1/i); + if (matches && matches.length == 3) { + fakeElement.setStyle('width', cssifyLength(matches[2])); + } + matches = content.match(/height=([\"\']?)(\d+)\1/i); + if (matches && matches.length == 3) { + fakeElement.setStyle('height', cssifyLength(matches[2])); + } + editor.insertElement(fakeElement); + } + } + }; +}); + diff --git a/sites/all/modules/ckeditor/plugins/mediaembed/images/icon.png b/sites/all/modules/ckeditor/plugins/mediaembed/images/icon.png new file mode 100644 index 0000000..b052b7a Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/mediaembed/images/icon.png differ diff --git a/sites/all/modules/ckeditor/plugins/mediaembed/images/placeholder.gif b/sites/all/modules/ckeditor/plugins/mediaembed/images/placeholder.gif new file mode 100644 index 0000000..7650af0 Binary files /dev/null and b/sites/all/modules/ckeditor/plugins/mediaembed/images/placeholder.gif differ diff --git a/sites/all/modules/ckeditor/plugins/mediaembed/plugin.js b/sites/all/modules/ckeditor/plugins/mediaembed/plugin.js new file mode 100644 index 0000000..e617008 --- /dev/null +++ b/sites/all/modules/ckeditor/plugins/mediaembed/plugin.js @@ -0,0 +1,110 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +/** + * @file Plugin for inserting Drupal embeded media + */ +( function() { + var numberRegex = /^\d+(?:\.\d+)?$/; + var cssifyLength = function( length ) + { + if ( numberRegex.test( length ) ) + return length + 'px'; + return length; + } + CKEDITOR.plugins.add( 'mediaembed', + { + requires : [ 'dialog', 'fakeobjects' ], + init: function( editor ) + { + var addCssObj = CKEDITOR; + + if (Drupal.ckeditor_ver == 3) { + addCssObj = editor; + } + addCssObj.addCss( + 'img.cke_mediaembed' + + '{' + + 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.gif' ) + ');' + + 'background-position: center center;' + + 'background-repeat: no-repeat;' + + 'border: 1px solid #a9a9a9;' + + 'width: 80px;' + + 'height: 80px;' + + '}' + ); + + editor.addCommand( 'mediaembedDialog', new CKEDITOR.dialogCommand( 'mediaembedDialog', { allowedContent : 'div(media_embed);iframe[*](*)' } ) ); + editor.ui.addButton( 'MediaEmbed', + { + label: 'Embed Media', + command: 'mediaembedDialog', + icon: this.path + 'images/icon.png' + } ); + CKEDITOR.dialog.add( 'mediaembedDialog', this.path + 'dialogs/mediaembed.js' ); + }, + afterInit : function( editor ) + { + var dataProcessor = editor.dataProcessor, + dataFilter = dataProcessor && dataProcessor.dataFilter, + htmlFilter = dataProcessor && dataProcessor.htmlFilter; + + if ( htmlFilter ) + { + htmlFilter.addRules({ + elements : + { + 'div' : function ( element ) { + if( element.attributes['class'] == 'media_embed' ) { + for (var x in element.children) { + if (typeof(element.children[x].attributes) != 'undefined') { + if (typeof(element.children[x].attributes.width) != undefined) { + element.children[x].attributes.width = element.attributes.width; + } + if (typeof(element.children[x].attributes.height) != undefined) { + element.children[x].attributes.height = element.attributes.height; + } + } + } + } + } + } + }); + } + if ( dataFilter ) + { + dataFilter.addRules( + { + elements : + { + 'div' : function( element ) + { + var attributes = element.attributes, + classId = attributes.classid && String( attributes.classid ).toLowerCase(); + + if (element.attributes[ 'class' ] == 'media_embed') { + var fakeElement = editor.createFakeParserElement(element, 'cke_mediaembed', 'div', true); + var fakeStyle = fakeElement.attributes.style || ''; + if (element.children[0] && typeof(element.children[0].attributes) != 'undefined') { + var height = element.children[0].attributes.height, + width = element.children[0].attributes.width; + } + if ( typeof width != 'undefined' ) + fakeStyle = fakeElement.attributes.style = fakeStyle + 'width:' + cssifyLength( width ) + ';'; + + if ( typeof height != 'undefined' ) + fakeStyle = fakeElement.attributes.style = fakeStyle + 'height:' + cssifyLength( height ) + ';'; + + return fakeElement; + } + return element; + } + } + }, + 5); + } + } + } ); +} )();